• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Counting squads/squardons with certain tag

rob

Administrator
Staff member
There are a couple of ways you could implement this, and I'm not sure either one is clearly "better" than the other. So I'll outline them both and you can pick the one you like the most. :-)

Both methods assume that the squads are able to identify the number of units possessing the tag. The easiest way to do that is to designate the tag group as "accrued". That way, the squad can easily verify the number of tags assigned to units within it. Once the squad can determine the number of tags, there are two different places to perform the tallying.

The first approach is to use the SquadDone script. Within the script, you access the accrued tags for the squad. You can delete all instances of the tag except for the first one. The net result is that a single tag will exist for the squad (if any), so only that one tag will be accrued for the overall roster. You can then reference the total number of the tag within the roster and it will be assured to be the number of squads containing units that had the tag.

The second approach is to use a RosterStat. Within the stat, you would specify a scope of "squad". This will then iterate through every squad in the roster. Within the Tally script, you would check for the presence of the tag and increment the value by one if the tag is present. The net result is that the total number of squads containing the tag will be the value of the stat.

Both of these methods is easy to implement, and neither is going to perform discernibly "faster" than the other. So pick the one you like the most and use it. :-)

Hope this helps,
Rob

At 02:08 PM 4/17/2006, you wrote:

I'm looking for a way to count how many squad have units with a particular tag (rtTags.Escort).

What is the best way to accomplish this?
 
Back
Top