Jump to content
HotosHideout

Set var on unit for trigger condition

Recommended Posts

I've created a public variable and set it in the init file of my mission.

BOB = true; publicvariable "BOB";

 

I'm trying to set the var on several (but not all) playable units as a constant. This way a trigger can be activated when any unit with that var walks or drives into the trigger. I've tried all sorts of different conditions but I cant seem to find the right one. Even if I have to check the units variable individually then I will. I can't seem to get the syntax correct.   


To sum it up, I need help with the syntax on both the init for the unit and the condition of the trigger. 

Share this post


Link to post
Share on other sites

trigger:

Type: None

Activation: Anybody

Activation type: Present

 

unit init field:

this setVariable ["bob",true,false];

 

trigger condition:

this && {!(thisList select {_x getVariable ["bob",false]} isEqualTo [])}

 

Share this post


Link to post
Share on other sites

1: You don't need to make it "global" (nor publicVariable , neither true as last param of setVariable). init field are run on all PCs.

2: use anyPlayer

3 if you need to trigger on each "bob" player, not only the first one, you need to "rearm" it.

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

×