OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ice Man 3:16 on 16 May 2004, 23:05:05

Title: Timer for countdown trigger displayed on screen
Post by: Ice Man 3:16 on 16 May 2004, 23:05:05
How would i make it so when you trip a countdown trigger (it has 600 seconds) it would show the timer for the countdown on screen so you can see how long you have left until the countdown is compleate.
Title: Re:Timer for countdown trigger displayed on screen
Post by: macguba on 17 May 2004, 10:19:37
Make the trigger start a script which looks something like this.  This just a sketch, not a working script.  Syntax not guaranteed.

; this script shows the countdown

_timer=600

#loop
?condition: goto "end"
hint format ["Time remaining %1s", _timer]
~1
_timer=_timer - 1
? _timer <=0: goto "timeout"
goto "loop"

#timeout
whatever
exit

#end
whatever
exit


--------------------------------

Unrelated PS - Thanks Chris, it's nice to be back
Title: Re:Timer for countdown trigger displayed on screen
Post by: nEO iNC on 18 May 2004, 08:24:57
Hey Ice Man/Macguba, I wrote these a while ago it's a couple of scripts that do a countdown in hours/minutes format. It's meant for client/server operation, but you can easy modify for client only.

Just remove the line '?!local dedserver: exit' from 'stimer.sqs'

format for the server/client side script init is;

[number of hours, number of minutes] exec "stimer.sqs"

format for the client side script is;

[] exec "ctimer.sqs"

That's it... There are two predefined variables in the script. 'ontime' can be used to test if the objective has been completed ontime. 'timeup' can be used to see if time has run out.

All you have to do to use these, is set whichever one you want to 1. If your running client/server, you would need to make sure 'ontime' is made public. 'timeup' is handled in the script for you.

Hope this helps... Feel free to modify in anyway you want to...

Title: Re:Timer for countdown trigger displayed on screen
Post by: nEO iNC on 18 May 2004, 08:25:28
The other srcipt...

Title: Re:Timer for countdown trigger displayed on screen
Post by: nEO iNC on 20 May 2004, 14:05:40
Oh... Knew I'd forget something... You can prefix the timer display by putting a message in the init array for ctimer.sqs

eg. ["Transport leaves in: "] exec "ctimer.sqs"

That's all...  :)
Title: Re:Timer for countdown trigger displayed on screen
Post by: Ice Man 3:16 on 22 May 2004, 03:34:01
sweet, ive gotta try those scripts out.  One this is the trigger is set so when the time is out an objective is compleate.  Will that still work with this script??

thanks again
Title: Re:Timer for countdown trigger displayed on screen
Post by: macguba on 22 May 2004, 14:24:55
Yes, you just need to put the objective complete commands at the appropriate place in the script.
Title: Re:Timer for countdown trigger displayed on screen
Post by: nEO iNC on 24 May 2004, 08:12:39
Or, rather than mod-ing the script, just have a trigger that equates the 'timeup' variable to the objective being complete.

eg. cond: timeup == 1
      onact: "1" objstatus "done"

 ;)