OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BLITZKRIEG_ROF on 08 Aug 2004, 19:26:17
-
Here's my situation:
I'm making a MP mission that's supposed to be played in all of the day/night stages, but I don't know the best way to do this.
I'm looking for one of these two things:
A script that accelerates time to roughly 1:60 (one hour game-time for one minute real-time)
A script that will advance time one hour for each minute of game-time
If there's already a thread on this, just call me a dumb badger and gimmie the URL.
-
Couldn't you just make a trigger that has a countdown timer of 60, put it on repeatedly, and then in the activation field "skiptime 1"?
-
Learn about the commands
skipTime
setAccTime
-
Have a look at the following script
_gametime = 9
_realtime = 9
_counter = 200
_timeIncrements = _realtime/_counter
_Pausetime = _gametime/_counter
#loop
skipTime _timeIncrements
~ _Pausetime
_counter = _counter - 1
? (_counter > 0): goto "loop"
Note that _gametime is in seconds & _realtime is in hours. Note also that this accelerates time but not accurately. The above script should advance time by 9 hours in 9 seconds. In fact it advances time by 9 hours but it takes more than 9 seconds to do because of the time spent by the processor doing other things
Play with the variables a bit - it should get you started.
-
I have just tried this with
_gametime = 24*60
_realtime = 24
_counter = 10000
It should accelerate time so that 24 hours pass (_realtime) in a bit over 24 minutes (_gametime in seconds) and it works okay but with an otherwise empty mission. You could probably drop _counter to 1000 or even lower and not notice much differentce so long as you don't watch the stars. The higher the value of _counter the more porcessing is being done and that might cause lag in a real mission
-
Thanks, I'll give 'em a shot.
Now, this may sound stupid, and I already know most of what you're going to say, but I have a nagging feeling i'm doing something wrong.
How does one impliment these scripts? How do I get it from what you gave me to making a difference in my mission?
-
It is always the getting started that is difficult.
Copy and paste the code in the post above into a text file. Just open Notepad and copy the text in there.
Save the file into the folder where your mission.sqm file is located. Give it a name such as TimeAcc.sqs
In your mission set a trigger that will cause time acceleration to start. If you want it to start straight away then set the condition to 'true'
in the activation field put
[] exec "TimeAcc.sqs"
I would encourage you to have a look at some scripts from the Editors Dept, they usually come with a sample mission showing how they run. I found it a good way to learn.
-
Read snYpir's A Friendly Intro to Code Snippets and also Johan Gustafsson's Scripting Tutorial. The Tutorial Mission has some very simple scripts which are a good way to see real, live scripting integrated into a working mission.
-
Thank you, thank you, that solved the problem.