Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   Army Builder (http://forums.wolflair.com/forumdisplay.php?f=16)
-   -   Counting squads/squardons with certain tag (http://forums.wolflair.com/showthread.php?t=6189)

rob April 17th, 2006 06:35 PM

Counting squads/squardons with certain tag
 
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?


All times are GMT -8. The time now is 06:07 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.