OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Tinky the target on 16 Aug 2004, 01:31:17
-
Doods...
Am making a mission where part of it is assaulting a big base, but earlier in the mission you can do summin that hampers the enemies reinforcements. Thing is, I thought it would be more 'realistic' if the enemy did get reinforcements, but they took longer to get there...
So, I was just gunna stick a countdown on a trig or summin to wait say 10 mins (for example) before allowing reinforcements, but what I would like to know is if I could display the countdown so the player can see it?
thanks
tinks
-
I don't think you can display the countdown directly, but you can display a separate countdown. You'll need to do some playtesting and adjusting to make sure they finish at the same time ... OFP seconds are not always the same as RL seconds.
The trigger in question also calls a script.
; this script shows the countdown
; length of countdown in seconds
_i=600
#loop
Hint format ["Time remaining - %1s", _i]
~10
_i=_i-10
? _i <= 0 : exit
goto "loop"
exit
Not guaranteed in any way but you get the idea.
-
Okay, so just for clarification if anyone has any experience with this:
~10 in a script should be somewhat consistent with the time variable, right?
I.e.,
_start = time
~150
hint format ["150 ? %1", time - _start]
Should show the correct time (150).
(with a one second marginal for decimal -> integer conversion)
Or is this not true?
Apart from that, execution time and fair-queuing of the script itself will, as you said, probably make it inaccurate to a certain degree.
-
well, if its timed to say10 mins, and its actually 11 or 9...dont think that matters...maybe even randomise the number between say 7 and 12 for a slightly less linear mission
But anyway...I'll test these out...ta very much...
-
_time is the number of seconds since script start.
To make a script hold for a period of time, you simply use:
@(_time >= 100)
Where 100, obviously, is the number of seconds you want to hold it for. Note that this will HOLD the script up completely, you can't use this method in a loop.
To use it in a loop, to make sure it runs for X seconds, you could do this:
#loop
; Your code here
?(_time >= 100): exit
~0.1
goto "loop"
edit
You could also use the timeout feature on triggers. Just enter the minimum amount of seconds it should wait, maximum and medium. If you place your code in the On Deactivation field of the trigger, the trigger will wait for that many seconds before activating the code.
Placing the same number in all three fields will set the trigger to wait that many seconds, place different numbers and you can get a random timeperiod.