OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: idleness on 16 Sep 2005, 08:22:28

Title: Total Units Count
Post by: idleness on 16 Sep 2005, 08:22:28
Right now i'm doing this by grouping all my units in groups and using:

count units mygroup + count units nextgroup


i'm curious as to whether there is any way to use the ALL keyword to implement this instead. Thanks
Title: Re:Total Units Count
Post by: bedges on 16 Sep 2005, 09:38:03
hmmm, i've checked both my comrefs and i'm not seeing an 'ALL' keyword...

what you can do is make a trigger which covers the whole map which is triggered by one side, and in the on activation box put

Code: [Select]
number_of_loons = count thislist
untested, but i'm pretty sure that's the syntax. thislist will keep a dynamic record of how many units of that side are on the map. if you want to check for the beginning total, i.e. a static number, use '+thislist'.
Title: Re:Total Units Count
Post by: idleness on 16 Sep 2005, 10:06:24
WOW !!!!! IT WORKS!!!

Where do u get this stuff?? mind sending me URLs to ur comrefs?? =)

btw i was using this one with the 'ALL' thingy:

http://www.ofpec.com/publicfiles/files/tutorials/CMDREFv104.htm#AA

Thanks a bunch!!

i just realized tt if u set the activation to anybody, it returns the total number of units on the map. (even neutrals)

one other thing: just wat exactly is thislist
Title: Re:Total Units Count
Post by: bedges on 16 Sep 2005, 10:09:39
for reference, our online comref can be found here (http://www.ofpec.com/editors/comref.php).
Title: Re:Total Units Count
Post by: h- on 16 Sep 2005, 10:28:40
Quote
just wat exactly is thislist
It returns an array of the trigger contents..

So if you have units named like grunt01, grunt02 and grunt03 in the the trigger area (and the trigger set so that it will get triggered by one or all of those units) thisList in the trigger then returns [grunt01,grunt02,grunt03]..
Title: Re:Total Units Count
Post by: macguba on 16 Sep 2005, 10:33:15
"All" is not a command.   It is part of the class tree used to define objects in the game, and can be used as an argument with certain commands, for example counttype.

That unofficial comref you were looking at can be extrememely useful and should be your second port of call after the link bedges posted.  However it is a bit old now.