Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
richardevers2002
Junior Member
 
Join Date: Apr 2006
Posts: 4

Old April 5th, 2006, 07:35 AM
Got this question in AB3. Could someone help me with this problem:

A unit of type X must be smaller than every other instance of a unit
of type Y. For example:

Unit Y1 = 5 models
Unit Y2 = 10 models
Unit Y3 = 12 models
Then Unit X must be 5 models of smaller.

How can I implement this in ABv3?

Greetings,

Richard
richardevers2002 is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old April 5th, 2006, 12:22 PM
You can't enforce this as a fixed behavior, but you can definitely handle this as a validated behavior. First, you'll need to write a hidden statcalc that determines the smallest size unit of type Y. This can be done by having the Test expression only apply to units of type Y and then having the Tally expression update the value to the model count of the unit only if it's smaller than the previous value. Just make sure that you specify a large initial value as the starting value for the statcalc! Once that's done, it's easy to write a rule with "unit" scope that has an explicit "targetid" of unit X. This rule just verifies that the model count of unit X is not larger than the value from the statcalc.

Hope this helps,
Rob

At 08:35 AM 4/5/2006, you wrote:

Quote:
Got this question in AB3. Could someone help me with this problem:

A unit of type X must be smaller than every other instance of a unit
of type Y. For example:

Unit Y1 = 5 models
Unit Y2 = 10 models
Unit Y3 = 12 models
Then Unit X must be 5 models of smaller.

How can I implement this in ABv3?

Greetings,

Richard
rob is offline   #2 Reply With Quote
richardevers2002
Junior Member
 
Join Date: Apr 2006
Posts: 4

Old April 6th, 2006, 06:02 AM
Thanx. I solved the smallest unit problem too.


Did this:

Made a statcalc rule with entity scope. (S1_SmUn)
----------------
Value is 999 to start with.

TEST expression: Tested on a unit with TAG: S1_help.Y

TALLY expression:
if (@value > entity.count[model]) then
@value = entity.count[model]
endif
---------------

Then made a new rule: (S1_SmUn)
--------------
again entity scope.

TEST expression: unit with TAG: S1_help.X

SCRIPT:
var A as number
A = statcalc[S1_SmUn]
if (A = 999) then
@valid=0
else
if (entity.count[model] < A) then
@valid=1
else
@valid=0
endif
endif

--> where the first if-then looks of there any X unit in the roster at all. The second if-then looks if the Y unit is the smaller than the return value of statcalc.
richardevers2002 is offline   #3 Reply With Quote
Reply


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 09:10 AM.


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