OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BlackNight on 30 Oct 2003, 03:28:54
-
hi , could someone tell me how people makes a mission with the controllable time of day thing , where you can change what time of day you want to start a game in. (example) if you select 20:00 it will be night or 15:00 and it will be day. i have seen it in a game and i cant remember what the name of it was. can someone tell me how they do that. they had it to where you could change it to any time of day you wanted.
Please reply.
-
A lot of the BAS missions do that, and also let you select things like fog amount and so on.
In a similar vein, if you don't mind me piggybacking a bit, is there any way of adding a time gap during a mission? Say, having the start of the mission at 0800, then skipping or accelerating through time for the actual mission bit of it to start at 2000, or something?
-
Learn about the commands skipTime and accTime. Also dayTime and just plain old time.
-
you need to define it in the ext like so:
titleParam1 = "Time of Day:";
valuesParam1[] =
{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,};
defValueParam1 = 0;
textsParam1[] =
{"00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00",
"11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00",
"22:00","23:00",};
titleParam2 = "Fog:";
valuesParam2[] = {1,2,3,4};
defValueParam2 = 1;
textsParam2[] ={"No Fog","Lite Fog","Medium Fog","Heavy Fog"};
then make 24 triggers to detect what time is desired:
type:global
activation: once
condition: param1 == x
on activation: skiptime x
Make sure you set the time of day in the editor to 0:00, then in each trigger just set x to 1, then 2 in the next and so on
Fog works in a similar way using the setfog command.
For Torak, if you use skiptime in a mssion, it only adjusts the clock and weather forecast, you can't start moving the skiptime and find yourself down the road, to do that you need acctime, which will make you move at warp speed and be dangerous to drive like that!
-
then make 24 triggers to detect what time is desired:
type:global
activation: once
condition: param1 == x
on activation: skiptime x
Of course, you don't have to do all those 24 triggers ;D
Only one trigger will do the trick:
condition: true
on activation: skiptime param1
-
DOH!
never thought of that approach, but it does make sense. Thanks for the idea!
-
It would be great if you could change weather in real life! :D
-
ya dont need all those times in the description.ext
ya need
sunrise (approx 06:20 depending on month and island)
midday 12:00
sunset 18:20 depending on month and island)
night 00:00
and maybe a 24hr accelerated playing time, eg 24hrs in 30 minutes
and then for param2 ya could use it for switching vehicle respawn on or off, different gametypes, weather etc etc
as standard param1 and param2 are for stating score or missiontime, however these can be stated in a script or the init.sqs, making param1 & 2 available for other things
the efl template maps use param1 and param2 for choosing
any of the following
sunrise, sunset,midday, night, night with autoflare,24hrs, 24hrs with autoflare
match ctf, public ctf, match rctf, public rctf
or if a c&h
1flag, 3 flag or 5 flag progressive all with m,atch or public settings
basically you can do just about anything you want with these param boxes
-
How to set the in-game time to something specific.
--------------------------------------------------------------------------------
Here is the working answer;
skiptime ('dif' + 'num' - daytime)
-skiptime is the normal OFP command.
-'dif' is the difference between start hour and specific hour required (as measured on a 12 hour clock)
-'num' is the mission start hour as selected in Mission Editor.
-daytime is normal OFP varible.
EG:
Mission starts at 0900 hrs (num = 9)
Required time is 1500 hrs (dif = 6) - ie: 10,11,12,13,14,15
Current time that the trigger is activated is 1100 hrs (daytime check by OFP)
So a trigger containing skiptime (6+9-daytime) fired at 1100 hrs would advance time to 1500 hrs.
You can use any part of the hour to find that special sunset....
ie: 30mins = .5, 45 mins = .75
WARNING: With MP, you need to incorporate a 'publicvarible' trigger for all clients to change time.
Full MP Example
Trigger 1)
CONDITION: (circumstantial)
ACTIVATION: changetime=true; publicVariable "changetime"
Trigger 2)
CONDITION: changetime
ACTIVATION: skiptime (6+9-daytime)
I use this all the time and it works sweet as....no scripting, just an INIT field line on a trigger.
Hope this helps someone...
atf_moritori@hotmail.com
-
To go to the next specific time of day:
skiptime (XXX - daytime + 24)%24where XXX is the time of day (in hours) that you want to skip forward to.
So to go to the next 13:30 use:
skiptime (13.5 - daytime + 24)%24
If you want to go to 13:30 of the current day. That is if you don't mind skipping backwards in time if it is already later than the time you want then you can use:
skiptime (13.5 - daytime)
Note the use of the 24 hour clock throughout.