View Single Post
Garfunkel
Senior Member
Volunteer Data File Author
 
Join Date: May 2005
Location: Grenoble, France
Posts: 167

Old March 25th, 2011, 07:53 AM
Hello,

For Colen solution, (I think it is shorter to implement) In the exemple, the valid range of the unit is 20-25. Note you can use runtime.effectXX if needed.
The target units to look at for the minimum size are all tagged as type.unitTypeXX and the one which must be of the lowest count is both type.unitTypeXX and type.hopliteMini


The statcalc:
Id: mini
Priority 100
Scope: Roster
Calculate Expression:
var val as number

val = tally[unit:runtime.count25 & type.unitTypeXX]
if (val>0) then
@value = 25
endif
val = tally[unit:runtime.count24 & type.unitTypeXX]
if (val>0) then
@value = 24
endif
val = tally[unit:runtime.count23 & type.unitTypeXX]
if (val>0) then
@value = 23
endif
val = tally[unit:runtime.count22 & type.unitTypeXX]
if (val>0) then
@value = 22
endif
val = tally[unit:runtime.count21 & type.unitTypeXX]
if (val>0) then
@value = 21
endif
val = tally[unit:runtime.count20 & type.unitTypeXX]
if (val>0) then
@value = 20
endif

There may be a shorter way to parse the range of model count...

Rule:

Scope: Unit
Priority: 110
Test Expression: type.unitTypeXX & type.hopliteMini
Script:

if (statcalc[mini]>= count[model]) then
@valid = 1
endif


by this way, you identify any unit with the lowest count. (There might be several, but it is OK, only add a unique 'always' to your hoplites)

Hope this help.
Garfunkel is offline   #5 Reply With Quote