Jump to content
Sign in to follow this  
4ntifa

Scripting & triggers

Recommended Posts

I've been examining the comref and a couple of code snippets, but haven't found a way to find out which unit activated a trigger. Could someone point me to the right direction?

Also, how do I find out if a unit has exited the trigger area? Repeatative checks with something like "soldier1 distance trigger1"?

Share this post


Link to post
Share on other sites

Okay, I found the "list" command, which I can use to get all the units in the area: "_unitsInArea = list trigger1". Still, no way to find out exactly who activated the trigger?

Hmm. Does "player" work? Ie. does "player" return the activating unit when used in trigger context?

Also, when does deactivation happen? When the activating condition becomes false? Eg. if a East unit present in area activates the trigger, are deactivation commands run when there are no more East units present?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (4ntifa @ Jan. 05 2002,15:30)</td></tr><tr><td id="QUOTE">Okay, I found the "list" command, which I can use to get all the units in the area: "_unitsInArea = list trigger1". Still, no way to find out exactly who activated the trigger?

Hmm. Does "player" work? Ie. does "player" return the activating unit when used in trigger context?

Also, when does deactivation happen? When the activating condition becomes false? Eg. if a East unit present in area activates the trigger, are deactivation commands run when there are no more East units present?<span id='postcolor'>

Okay, I did some experimenting to find out. I thought I'll post my findings, someone might find them helpful.

- "player" returns the activating player, dunno if it works in MP, though

- deactivation happens when the condition becomes false

Share this post


Link to post
Share on other sites

Just continuing my monoloque. It's nice to have good company!

Share this post


Link to post
Share on other sites

Hi,

as far as I know the List command returns an array of units that are in the SCOPE of the trigger, i.e. that are within the trigger area and fulfill the trigger condition, e.g. all west units.

If you group the trigger with a specific unit only this unit activates the trigger and List should only return this unit (if within area).

You are right about the deactivation.

To check if a unit is in the trigger scope (both area and condition) use the In command:

unitname In (List triggername)

This checks if unitname is contained in the array (List triggername) and returns true or false.

Hope this helps,

Spinor

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Spinor @ Jan. 05 2002,15:42)</td></tr><tr><td id="QUOTE">as far as I know the List command returns an array of units that are in the SCOPE of the trigger, i.e. that are within the trigger area and fulfill the trigger condition, e.g. all west units.<span id='postcolor'>

Thanks, that really made it a lot clearer!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×