OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ice Man 3:16 on 28 Apr 2004, 00:44:31
-
In the mission im working on you have to turn on an animated switch on the side of this one building. The action name for the switch animation is called "fuelon". I was wondering if there was a way to make it when you turn the switch on its starts a timer for 5 mins, and when that 5 mins is up its the end of the mission.
-
does the switch return any variables you could use?
-
You can make a script that monitors the time as soon as the switch is on. It would look something like this:
@ switchon
_reftime = time
#loop
_checktime = time
?(_checktime - _reftime < 300): goto "loop"
hint "Five minute (300 seconds) has elapsed, switch disengaging"
switchon = false
exit
-
You can make a script that monitors the time as soon as the switch is on. It would look something like this:
@ switchon
_reftime = time
#loop
_checktime = time
?(_checktime - _reftime < 300): goto "loop"
hint "Five minute (300 seconds) has elapsed, switch disengaging"
switchon = false
exit
thats exactly what i need, only as soon as the time elapses i need the mission to end. how would i do that?
-
Add another boolean in the script and a trigger in the editor.
@ switchon
_reftime = time
#loop
_checktime = time
?(_checktime - _reftime < 300): goto "loop"
hint "Five minute (300 seconds) has elapsed, switch disengaging"
switchon = false
endgame = true
exit
Then make an end game tigger in the mission that has this in its condition field:
Condition: endgame
-
It doesn't seem to be working.
I set switch box object on the map,
The command for turning the switch on is switchOpen, It tells the switch to go to do the "on" animation meaning the switch goes down.
this is how it looks in the config.cpp for the switch box
class UserActions
{
class switchOpen
Lemmie explain the mission im working on.
You have to go to the airport on everon and there is a switchbox. You pull the switch down and the 5min timer starts, you have to defend the airport for five mins, (the switch box is a fuel switch to refuel a plane) and after that 5 mins the mission is compleate.
-
you need the config to link to the script that begins the timer. Unfortunaltely, since I am no expert at config modification I am not sure how you do this, but I have seen it done before.
-
It's cool, I'll just hook it up to a switch so when youg et close tot eh switch box it starts the timer.
Thanks for all your help :)