OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Gen.Iceman on 14 Dec 2012, 19:25:26

Title: Count object in a list via classname
Post by: Gen.Iceman on 14 Dec 2012, 19:25:26
I would like to count how many "Misc_cargo_cont_net1" there are in a trigger list. How would I do this? isKindOf will not work.
Title: Re: Count object in a list via classname
Post by: SaOk on 14 Dec 2012, 19:43:49
Code: [Select]
{typeOf _x isKindof "Misc_cargo_cont_net1"} count TriggerList;
This may also work:
Code: [Select]
{typeOf _x == "Misc_cargo_cont_net1"} count TriggerList;
Title: Re: Count object in a list via classname
Post by: Gen.Iceman on 14 Dec 2012, 20:01:53
Thanks. I tried using both of those as a trigger condition + anybody present, 20x20.

Code: [Select]
{typeOf _x == "Misc_cargo_cont_net1"} count thisList > 0
onAct:
Code: [Select]
hint "Inside"
The trigger never fired, when I brought the container inside the trigger.
Title: Re: Count object in a list via classname
Post by: SaOk on 14 Dec 2012, 21:53:02
The anybody in triggers dosent work for static objects. Use nearestObject instead with condition like this:
Code: [Select]
thisTrigger distance (nearestObject [thisTrigger, "Misc_cargo_cont_net1"]) < 20