Home   Help Search Login Register  

Author Topic: variable and trigger question  (Read 506 times)

0 Members and 1 Guest are viewing this topic.

dez

  • Guest
variable and trigger question
« on: 21 Jan 2003, 07:11:07 »
question: How can I make a trigger capture an objects name?
  For an example, lets say the trigger executes trigger.sqs
 in trigger.sqs would be

 removeallweapons _X
 where X = objects name


i want the trigger to set _x to whoever triggered it
is there a way?


broken down:
 a) i want the trigger to tell the script what triggered it
 b) i want the script to store it


?

g

  • Guest
Re:variable and trigger question
« Reply #1 on: 21 Jan 2003, 07:26:18 »
if the thing you want to trigger is certain object that you have in mind, for example the player you can set the trigger up to only execute when the player enters it.

for example in the condition field you put:

player in thislist

or what ever name of the object that you want

Soldier in thislist

that will ensure that only that object sets off the trigger.

However if you want anything to store the trigger thats a different matter. What exactly are you trying to do, why do you need the name passing on to the script?

dez

  • Guest
Re:variable and trigger question
« Reply #2 on: 21 Jan 2003, 07:39:34 »
there are alot of reasons to pass the object that triped the trigger,
 but i dont want to setup 50 thousand triggers in one spot to do the job,
the main reason to find out is simple, there are alot of things you can do if the trigger reconizes what triggered it..

there is an endless amount of things you can do, im thinking maybe having to script a trigger to set a variable of what triped it? if that is at all possible

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:variable and trigger question
« Reply #3 on: 21 Jan 2003, 18:02:30 »
In order to discover what unit or units have activated a trigger, use the list command.  E.g.:

this MyTrigger

This will provide an array of all units that currently meet the trigger's conditions.  Thus, if you want to save this array, use the following code:

units = list MyTrigger

Or, if this is in a script, use a local variable instead.  E.g.:

_units = list MyTrigger

If you just want the first unit that meets the condition, add the select command.  E.g.:

(this MyTrigger) select 0

Good luck!
Ranger