Home   Help Search Login Register  

Author Topic: starting a timer when you use a switch  (Read 572 times)

0 Members and 1 Guest are viewing this topic.

Ice Man 3:16

  • Guest
starting a timer when you use a switch
« 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.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:starting a timer when you use a switch
« Reply #1 on: 28 Apr 2004, 01:04:29 »
does the switch return any variables you could use?

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:starting a timer when you use a switch
« Reply #2 on: 28 Apr 2004, 01:24:33 »
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


Ice Man 3:16

  • Guest
Re:starting a timer when you use a switch
« Reply #3 on: 28 Apr 2004, 02:24:09 »
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?

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:starting a timer when you use a switch
« Reply #4 on: 28 Apr 2004, 03:38:50 »
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



Ice Man 3:16

  • Guest
Re:starting a timer when you use a switch
« Reply #5 on: 28 Apr 2004, 04:21:56 »
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

Code: [Select]
      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.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:starting a timer when you use a switch
« Reply #6 on: 28 Apr 2004, 19:22:40 »
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.

Ice Man 3:16

  • Guest
Re:starting a timer when you use a switch
« Reply #7 on: 28 Apr 2004, 23:19:37 »
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 :)