View Single Post
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old April 17th, 2006, 07:35 PM
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:

Quote:
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?
rob is offline   #1 Reply With Quote