Home   Help Search Login Register  

Author Topic: displaying a countdown  (Read 621 times)

0 Members and 1 Guest are viewing this topic.

Tinky the target

  • Guest
displaying a countdown
« 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

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:displaying a countdown
« Reply #1 on: 16 Aug 2004, 10:40:08 »
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.
Plenty of reviewed ArmA missions for you to play

Offline Mud_Spike

  • Contributing Member
  • **
Re:displaying a countdown
« Reply #2 on: 16 Aug 2004, 11:48:57 »
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.

Tinky the target

  • Guest
Re:displaying a countdown
« Reply #3 on: 16 Aug 2004, 12:02:18 »
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...

Offline KTottE

  • Former Staff
  • ****
Re:displaying a countdown
« Reply #4 on: 16 Aug 2004, 12:04:10 »
_time is the number of seconds since script start.

To make a script hold for a period of time, you simply use:

Code: [Select]
@(_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:
Code: [Select]
#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.
« Last Edit: 16 Aug 2004, 12:06:36 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"