OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: 456820 on 30 Aug 2007, 16:05:45
-
Well new computer and I've started creating missions again however after not doing any scripting for a very long time I'm now very rusty.
My question is...
I have a trigger which I want to run a script on every squad leader in the area. However I cant quite remember how to do so.
I have set the activation trigger up however this is running on every single soldier in the trigger how do I make the trigger check if its a squad leader?
Closest I could think of is "this and leader" in the condition field, however no luck like I expected.
Cheers.
-
Welcome home! :cool2:
A little more detail. Are you trying to get the trigger to activate for only the leaders, or trying to get the on activation code to run only on the leaders?
-
Trying to get the trigger to activate for only the leaders.
-
myLeader in thisList
or
myLeader1 in thisList || myLeader2 in thisList ...
or
({_x in thisList} count [myLeader1, myLeader2, ...]) > 0
edit: You could also group the trigger to the leaders, but make sure the trigger type is for the unit, not for the group.
-
Thanks for the reply.
But by any chance is there a more easier way, for use of a lot of squads? for example about 100+ squads or will I have to start naming them all? :D
-
I guess you could loop thru the whole trigger list finding :scratch:
leader group _this and then adding them to an array, _leaders[].
Somebody who knows what they are doing will come along...I hope. ;)
-
Condition
{leader _x == _x} count thisList > 0;
OnActivation
{if (leader _x == _x) then {nul = [_x] execVM "myScript.sqf";}} forEach thisList
-
thankyou very much, shall try and report back.
-
Well seems to work, thanks alot.
#topic solved