• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

smallest unit

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
 
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:

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
 
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.
 
Back
Top