OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NightJay0044 on 14 Sep 2005, 20:13:40

Title: Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:13:40
Hi, does anybody know how I can make the time go from night to day? I have an intro start at night time that targets west soldeirs, and then after the cutscene is over, i want to have a black out, then have the camera target the enemy soldiers, but it's going to be during the day, I want to also have it set at a specific time during the day, say like 9am in the morning. ANy help please, thank you.
Title: Re:Accelerating Time??
Post by: THobson on 14 Sep 2005, 20:16:41
Use the command
skiptime

http://www.ofpec.com/editors/comref.php?letter=S#skipTime


To go to forward to 9:00am try:
Code: [Select]
_endtime = 9
_skip = (_endtime - daytime + 24) % 24
skiptime _skip
Title: Re:Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:23:23
How do i do that, do I use it like this?

Code: [Select]
this skiptime 2.5

And then the 2.5 is how many hours ahead you want it to move too. THen how do you make it stop? Or does it automatically stop?
Title: Re:Accelerating Time??
Post by: THobson on 14 Sep 2005, 20:24:23
Just read the comref and try the script I gave you.
Title: Re:Accelerating Time??
Post by: macguba on 14 Sep 2005, 20:26:10
You don't nee the "this":  it's just

skiptime 2.5

The time change is instantaneous:  it affects time of day, sun, moon, stars and tide (I think).   It has no effect on units.  

Just experiment a bit till you see what it does.  ;)

THobson's code is useful if you want to go from an unknown time to a known time.  
Title: Re:Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:26:22
Hi, not sure how to implement the script. Do i create a so called script "time.sqs" then put that code in. THen how do I execute such a script, should i do it with a trigger or can I do it in the cutscene sqs file?
Title: Re:Accelerating Time??
Post by: THobson on 14 Sep 2005, 20:29:08
To use it in a trigger put this in the activation field of the trigger:


skiptime ((9 - daytime + 24) % 24)

It will take you forward to 9:00am

Apologies for being a bit short - I had to rush off.
Title: Re:Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:31:02
Awesome, it worked, so I can use that in a camera script sqs file too right? Just simply put that code how ever I want?
Title: Re:Accelerating Time??
Post by: macguba on 14 Sep 2005, 20:33:14
Yes.
Title: Re:Accelerating Time??
Post by: bored_onion on 14 Sep 2005, 20:34:07
in a word: yes

EDIT: argh macbuga beats me to it by seconds
Title: Re:Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:36:30
Awesome, now I can make a cool cutscene. Hey another questions. IF the command reference says this

Code: [Select]
skiptime 2.5
just an example. How are you sapose to know how to even type that almost complicated code you gave me above ??The command reference is good but I think it doesn't explain most of the things you need to know for the commands

Code: [Select]
skiptime ((9 - daytime + 24) % 24)
Title: Re:Accelerating Time??
Post by: THobson on 14 Sep 2005, 20:45:26
I suggest you look up daytime and % in the comref.  Then you should be able to work out how it all works.  How do we know to do this?  Experimentation.

Now if you want something at looks really cool run a script with this in it:

Code: [Select]
_EndTime = 9
_timeSlices = 200
_timeIncrements = ((_EndTime +24 - daytime) % 24)/_timeSlices
_counter = _timeSlices
_ScanTime = 9
_Pausetime = _ScanTime/_timeSlices



#loop
skipTime _timeIncrements
~ _Pausetime
_counter = _counter - 1
? (_counter > 0): goto "loop"
Sorry if this is a bit messy.  It is from an old mission I wrote a while ago.
Title: Re:Accelerating Time??
Post by: Kyle Sarnik on 14 Sep 2005, 20:48:11
Awesome, now I can make a cool cutscene. Hey another questions. IF the command reference says this

Code: [Select]
skiptime 2.5
just an example. How are you sapose to know how to even type that almost complicated code you gave me above ??The command reference is good but I think it doesn't explain most of the things you need to know for the commands

Code: [Select]
skiptime ((9 - daytime + 24) % 24)

Hehe, its not a complicated line of code, just some basic math. Math is an important thing to be good at if you wish to become a good scripter, you will use a lot of it. Daytime is a command that returns the current time of day (in hours), and the rest will calculate how to get from the current time to the desired time (the difference in hours).
Title: Re:Accelerating Time??
Post by: NightJay0044 on 14 Sep 2005, 20:50:20
Thanks guys for all your fast replies, that fixed my problem.. I'm using a cutscene where i use 1985 voices and resistance voices as part of it.