Home   Help Search Login Register  

Author Topic: Killing scripts on trigger deactivation  (Read 1265 times)

0 Members and 1 Guest are viewing this topic.

Baphomet

  • Guest
Killing scripts on trigger deactivation
« on: 14 Oct 2002, 22:31:47 »
I have a trigger set to run a script when a player of a certain side is within its boundaries. On the activation of the trigger it is supposed to run a looping script for the duration of time that the player is in the trigger bounds. What do I do to stop the script from running after the person leaves the trigger area? I'm thinking I have to enter something in the deactivation field. I'm not sure what.

Rodd

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #1 on: 14 Oct 2002, 23:06:59 »
The easiest way I can think of is to check the trigger condition itself inside the looping script so that it stops looping (and exits) when you want it to.

Baphomet

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #2 on: 15 Oct 2002, 00:37:02 »
Shit. That means I need to learn more scripting...

Bremmer

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #3 on: 15 Oct 2002, 02:46:45 »
A leetle bit more ... but its not hard  ;)

Set your trigger to repeating if you haven't already done so.
In On Activation I assume you have something like [] exec "script.sqs".
Modify this so it reads:

trig = true; [] exec "script.sqs"

In On Deactivation put

trig= false

Now in your looping script you can insert a condition that checks when trig is true or false. eg:

#loop
.
.
.
? not trig : exit
.
.
.
goto "loop"


Give it a go - its easier than you think  :)
« Last Edit: 15 Oct 2002, 02:47:28 by Bremmer »

Baphomet

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #4 on: 15 Oct 2002, 15:49:49 »
Aaa. It worked!
Cheers m8. Its just what I needed.

Baphomet

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #5 on: 15 Oct 2002, 16:10:19 »
Hm. I'm wondering now If I could take it up a notch or two. Say, adding a condition to allow the trigger to run based on the type of unit that is within it. I'm pretty sure you define that under condition string instead of the default "this" you'd specify the unit.

For example if I wanted a 5t truck to only run the script when its within the trigger boundaries. Right now I have the expcond string set to this&&(local Player).
« Last Edit: 15 Oct 2002, 16:12:45 by Baphomet »

Mike

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #6 on: 15 Oct 2002, 16:23:38 »
if you only want the 5 ton truck to activate the trigger and nothing else, group the trigger to the truck with the (f2)grouping command.. go to the triggers activation, make sure its on vehicle..  I think u can do this several times for several trucks/units or whatever

Baphomet

  • Guest
Re:Killing scripts on trigger deactivation
« Reply #7 on: 16 Oct 2002, 19:56:51 »
Hm. I was more or less thinking -any- 5t truck. Not just one, not just a truck with a specific name, just a generic 5t truck of any type.