Page 1 of 1

How can i change the maximum selection of an option

PostPosted: Tue Sep 11, 2007 3:07 pm
by hasturspawn
Hi,

i'm pretty new to programming and so did fare pretty well. There is one thing that i was not able to found. How to change the maximum number of selection for an option based on a unit size.

exemple: if the unit is between 1 and 9 models, only one option, and if 10 or above, 2 options... etc

thanks in advance

PostPosted: Wed Sep 12, 2007 4:39 pm
by osman
This usually involves making a new 'unit stat', and a new 'exclusion group'. There are a few examples in the existing data files, but you have to start by editing your race's AUG file (not the DAT file). Add a new unit stat (myStat).

Then go to excl groups, and add a new group (myExclGrp), with a min of 0 (or whatever), and a max of @myStat.

Now, use myExclGrp as the exclusion group for your option link in the unit. In the pre-link script for the unit, set unit.basestat[myStat] to whatever the maximum should be, based on any logic at all.

Like (if you want to allow a second choice once there are at least 10 models in a unit):

if ( unit.count[effective] >= 10 ) then
unit.basestat[myStat] = 2
else
unit.basestat[myStat] = 1
endif