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

Old August 23rd, 2006, 01:44 AM
Fortunately, #1 is actually quite easy to solve. :-) The trick is to use your own custom accrual script in the profile. The script below is NOT how to solve this.

For the "rare" profile, you already have a Quality tagexpr to identify only the "rare" units. And I'm sure your Final script takes the automatically tallied cost of the profile and divides it by the total size to yield the percentage. All you need to add is an "Accrue" script that tallies up exactly what you need and ignores the rest. Doing that requires just a single line of code, with the Accrue script looking as follows:

*** @accrue = cost[total] - cost[unit]

The above script simply subtracts out the cost of all child units from the amount being tallied. As long as your Qualify tagexpr includes ALL units with the "rare" compgroup, including child units, this will yield the proper total of "rare" units throughout the roster.

The only other change needed is in the Final script. Instead of using the "cost" target reference for calculating the percentage, you need to change that to "custom". This will pull the value calculated by your Accrue script and use it in the calculation.

If you do the above, you don't need to do anything special to accommodate the "Special" compgroup units. Just tally them with all the default handling (and get rid of the script you are currently using to juggle the cost). Everything ought to work smoothly.

For #2, I still don't have all the pieces I need to give you a concrete answer. :-( Where do you want to access the values from? I assume you want unit A to get its own model count. However, do you want unit A to be able to access the total number of models in all the unit B children? Or do you want to access that value from within the top unit B? Or both? Are you intending to access these counts during script evaluation? Or for use in validation rules? Or do you need them tallied for use in profiles? All of these factors impact the optimal way to solve #2, so please give me the details and I'll do my best to get you a viable solution.

Hope this helps,

At 06:05 AM 8/20/2006, you wrote:

#1 - Here's a good example. There are two profiles I have for a race: characters and special. Both accumulate points and are % based. A character has the option to ride an elephant. When the link is selected, I want the points for the character only (not the elephant) to go to the Characters pool and the elephant to go to the Special pool. Just putting the tags on units and making the elephant a linked option puts the right points to the Special total, but the combined points go to the Characters total. Using the script I was suggested here before:

if (entity.option[ecEle].selection=1) then
@base = @base - 140
@item = @item + 140

gives me the proper Characters total, but no points go to the Special pool. How do I get it so that the points are properly split while still forcing the elephant to be attached to the character and only allowing the link to be selected once?

#2 I have a unit A that can choose to add a child linked unit B. I want the count of figure in A and the count of figures in B. In some cases, B can have more B's linked to it, in which case I want the count of all subsequently linked B's. I haven't been able to get this to work at all before.

The remainder thing is not a huge deal since I've already done a work around. It was just a suggestion, but if it's not possible due to a technical issue, that's fine.

rob is offline   #5 Reply With Quote