Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder

Notices

Reply
 
Thread Tools Display Modes
Decurion
Junior Member
 
Join Date: Jun 2010
Location: Los Angeles, California, USA
Posts: 12

Old March 15th, 2011, 04:04 PM
I am trying to write a script that will make sure UnitA is the smallest unit of its type.

This means I have to compare it to from 1 to many units and verify that UnitA has the smallest number of models.

I am sure there is a simple solution here, but I don't see it.

Tim
Decurion is offline   #1 Reply With Quote
Garfunkel
Senior Member
Volunteer Data File Author
 
Join Date: May 2005
Location: Grenoble, France
Posts: 167

Old March 17th, 2011, 02:59 AM
Hello,

An idea:

- define a dynamic group for unit type tagging ("type" for what follow)
- define a GLOBAL dynamic group for unit type tagging with the same tags ("TYPE" for what follow)

- On prelink unit, set type.unittypeXX where XX is the model count
- create a global linkset 'LTYPE'
- Define sets of option with a live script relying on the unit # for enabling which set the associated Global tag: TYPE.unitypeXX This will be quite boring as you will need 1 option for each # in the range * number of unit type as global tags cannot be assigned by other ways...

- With a greatest priority, define an option that will compare the minimum of TYPE.unittypeXX assigned to the unit (As it is global, you will have the lowest of the roster) and the type.unittypeXX if equal, the unit is the one with the lowest model. If TYPE.unittypeXX is assigned more than one time, there are several unit with the lowest model count.

This is the general description of one solution, just ask if you need more technical details.

Which game system is it, and what is the purpose behind the solution you asked for? There may be another way... (Stat, rules...)

Regards,
Frédéric
Garfunkel is offline   #2 Reply With Quote
Colen
Senior Member
Lone Wolf Staff
 
Join Date: Dec 2008
Posts: 4,718

Old March 17th, 2011, 04:46 PM
You could also try defining a statcalc that held the unit size of the smallest unit. Then, in a validation rule for Unit A, you can compare your unit size against the statcalc. If it's the same, you're valid - if not, you're bigger than at least one unit, so you're invalid.

Hope this helps!
Colen is offline   #3 Reply With Quote
Decurion
Junior Member
 
Join Date: Jun 2010
Location: Los Angeles, California, USA
Posts: 12

Old March 24th, 2011, 09:21 AM
I appreciate both answers...

Frédéric, I am working with the Warhammer Ancient Battles Ancient Greek list, which has a unit of hoplites which must be the smallest unit of hoplites in the army. I am not sure I follow your solution, I am working at a pretty basic level so if you can point me to an example of what you are talking about I would appreciate it.

Colen, would it be possible for you to point me to an example of what you are talking about. I follow what you are saying, but am a bit fuzzy on the execution.

Thanks much guys!

Tim
Decurion is offline   #4 Reply With Quote
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
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:43 PM.


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