Jump to content
Sign in to follow this  
JacobJ

How to refer to the player who triggered a trigger

Recommended Posts

Hey all

Don't know if this has been up before, but can't seem to find anything about it.

I think its a simple one, but I can't figure it out.

If I need to refer to the unit that triggers and trigger, how would I do that?

/Jacob

Share this post


Link to post
Share on other sites

Oh I see, so the unit that triggers the trigger will always be the first in the array list. I get the system. Thank you very much.

Can I somehow change triggername to this? And that will then refer to the trigger? Then I wouldnt have to put a name to many triggers, if I was using a lot of triggers.

Share this post


Link to post
Share on other sites

You can use:


[left][color=#3E3E3E]unit_Who_triggered = [/color]thisList [color=#3E3E3E]select 0;[/color][/left]


It has to be used in the init/condition or deactivation of the trigger.

Its not documented to well but it does work, you just have to be careful with the settings of the trigger or it might not return what your expecting.

http://community.bistudio.com/wiki/Mission_Editor:_Triggers#Condition

http://forums.bistudio.com/showthread.php?105511-count-thislist-question&p=1718973&viewfull=1#post1718973

Edited by Riouken

Share this post


Link to post
Share on other sites

Can I somehow change triggername to this? And that will then refer to the trigger? Then I wouldnt have to put a name to many triggers, if I was using a lot of triggers.

thisList in the trigger fields refer to the list of things triggering it.

thisTrigger in the trigger fields refer to the trigger itself.

Both only work in the trigger fields, not in any script, as Riouken said, its not very documented.

lets say you have a trigger with no name with bluefor present as condition:

in on act field of trigger you can use the 2 above commands, and pass them on to other scripts etc.

hint format["%1 is this trigger, and %2 is the trigger list",thisTrigger,thisList];

or you can pass them to a script:

on act:

[thisTrigger,thisList] execVM "script.sqf";

script.sqf:

_trigger = _this select 0;
_triggerList = _this select 1;  // now its not really needed to pass the list as you can gather it here now by using the "list _trigger" command.

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  

×