OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Ironman on 16 Apr 2008, 07:58:12

Title: Checking if a unit is in a group
Post by: Ironman on 16 Apr 2008, 07:58:12
Ok, I tried searching for about 45min for a cure to this but haven't seen it. I want to make a trigger set the player group(s) [sf1, sf2] to non-captives if they capture an enemy officer. I thought something like this would work, but I get an error complaining about how "e1_3 in sf2" is expecting an Array.... not a group name.

In trigger:
Code: [Select]
Condition: this || e1_3 in sf1|| e1_3 in sf2
Activation: player setCaptive false;
Title: Re: Checking if a unit is in a group
Post by: Mandoble on 16 Apr 2008, 08:36:55
what are el_3, sf1 and sf2?
Title: Re: Checking if a unit is in a group
Post by: Wolfrug on 16 Apr 2008, 08:50:59
Indeed so: el_3 is a UNIT whereas sf1/2 are GROUPS. To be able to compare units to units, you need to use (units sf1), as so:

 
Code: [Select]
this || e1_3 in (units sf1)|| e1_3 in (units sf2)
Should work, try it out!  :good:

Wolfrug out.

Title: Re: Checking if a unit is in a group
Post by: Mandoble on 16 Apr 2008, 09:29:36
if sf1 and sf2 are groups and el_1 is a unit it might be more efficient to just compare with the group:
Code: [Select]
group el_1 in [sf1, sf2]or
Code: [Select]
(group el_1 == sf1) || (group el_1 == sf2)
Title: Re: Checking if a unit is in a group
Post by: Ironman on 16 Apr 2008, 11:27:14
I am sorry I wasn't more precise... yes e1_3 is a unit where as sf1/2 are groups

Thanks for your immediate help guys.... I tell everyone I know to come here... unless I know the answer...  :dunno: