Ok so I made a spew that when activated with a switch would fire a spew.
My problem is that it's possible to hit the switch 10 times and have 10 spews come out.
Here's what I'd like the script to say:
When the player hit's the switch,
check to see if a spew from that object is already going.
IF so, don't turn on spew.
IF NOT, turn on spew.
Any help would be much appreciated.
How to make a spew only work once.
- Jon the Great
- DBB Captain
- Posts: 538
- Joined: Fri Nov 28, 2003 3:01 am
- Location: California
Seems to me you want to instantiate a timer that lasts the duration of that spew and a bool that is true, but returns to false when the timer expires. So the clause of the switch would go "If player hit switch and bool A is false, then set timer B and set bool A to true." Elsewhere, a second event would go "If timer B has elapsed, set bool A to false."
- Interceptor6
- DBB Ace
- Posts: 138
- Joined: Sat Mar 01, 2003 3:01 am
- Location: baton rouge, LA, USA
There are multiple ways to do this, but here is what should be the simplest. Here's what you need to do:
-When the player hit's the switch,
check to see if a spew from that object is already going.
to do this, make a script that has the Owner (switch) with a condition of 'Collided with it'. Next, set the condition as 'if Timer is active' to false with your spew timer as the TimerID.
-IF so, don't turn on spew.
The script won't execute with the above code, since the spewtimer is inactive.
-IF NOT, turn on spew.
Make sure that when the spew is activated, that a timer is set to a time equal to the spew's lifetime. As long as this timer is active, the spew won't be able to turn on.
------
Another way to do this is to set a USERFlag to true whenever the spew is active, and have a timer change it back to false whenever the spew ends. Just set the condition to the 'check' script to 'userflag is false and you are ready to go.
Good luck.
-Int
-When the player hit's the switch,
check to see if a spew from that object is already going.
to do this, make a script that has the Owner (switch) with a condition of 'Collided with it'. Next, set the condition as 'if Timer is active' to false with your spew timer as the TimerID.
-IF so, don't turn on spew.
The script won't execute with the above code, since the spewtimer is inactive.
-IF NOT, turn on spew.
Make sure that when the spew is activated, that a timer is set to a time equal to the spew's lifetime. As long as this timer is active, the spew won't be able to turn on.
------
Another way to do this is to set a USERFlag to true whenever the spew is active, and have a timer change it back to false whenever the spew ends. Just set the condition to the 'check' script to 'userflag is false and you are ready to go.
Good luck.
-Int
- Jon the Great
- DBB Captain
- Posts: 538
- Joined: Fri Nov 28, 2003 3:01 am
- Location: California
- Jon the Great
- DBB Captain
- Posts: 538
- Joined: Fri Nov 28, 2003 3:01 am
- Location: California