Home   Help Search Login Register  

Author Topic: Count object in a list via classname  (Read 2163 times)

0 Members and 1 Guest are viewing this topic.

Offline Gen.Iceman

  • Members
  • *
Count object in a list via classname
« 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.

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Count object in a list via classname
« Reply #1 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;

Offline Gen.Iceman

  • Members
  • *
Re: Count object in a list via classname
« Reply #2 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.

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Count object in a list via classname
« Reply #3 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