• 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

How do you make disappearing options

darkwrath

Member
My exact scenario is this, I need an option for a unit to disappear when the individual cost per goes above 8. I know I need to call a script from the "live" button on the option, but I don't know how to code it.

Can anyone help me out?

B.
 
The "Live" button allows you to enter a TAG EXPRESSION. Tagexprs are
described in great detail in the documentation. They even have an entire
chapter dedicated to them. So that's where to start.

The "Live" tagexpr is a boolean expression that will determine whether the
unit is active for the unit at any point in time. The one problem you'll
encounter is that you say the option needs to be based on the current model
cost. The model cost is NOT available via a runtime tag. That means that
you'll need to devise an alternate way of tracking the important bits of
the cost, probably via a private unit stat.

I can't remember ever seeing a game for which options came and went based
on the individual model cost of a unit. That's the main reason the cost
isn't tracked via a runtime stat (it would be very processing expensive to
track it and I didn't envision any need to offset that huge penalty). What
game is this? And what unit? This sounds strange to me, so a little bit of
explanation would be much appreciated.

-Rob

At 12:47 PM 6/6/2005 -0400, you wrote:

>My exact scenario is this, I need an option for a unit to disappear when
>the individual cost per goes above 8. I know I need to call a script from
>the "live" button on the option, but I don't know how to code it.
>
>Can anyone help me out?
>
>B.


---------------------------------------------------------------------------
Rob Bowes (rob@wolflair.com) (408) 927-9880
Lone Wolf Development www.wolflair.com
 
The situation is two fold. I am almost done with entering the new Tyranid rules, and it has 2 units which require this. One is the Carnifex, if it is under 115 points and the list is at least 1500 it may be made an elite choice, the other is the Gaunts, at 8 points or less they may take an upgrade Without Number for 3 points.

Any ideas as to how to accomplish this?

B.
 
the 'fex can be dealt with via script: if the costs meet the criteria then drop the regular Group tag and add an elite tag instead.

the gaunts could be handled via a rule instead: assign the cost[unit] to a variable, divide by the model count. If it is 8 or less then the rule is valid, otherwise invalid and throw an error, target it with the target id at the gaunt unit as well.
 
I'm really, really new at editing these files. I have to thank Warmonger since he really did all the work in the first place, I'm just altering everything. I think I can figure out the Carnifex, but the Gaunts may just have to wait until Warmonger gets around to it.
I'll play around with it and see if I can do it.
But everything else is done and I plan to submit it to the AB40k3 guys to look at and clean up. etc...

Thanks for the quick reply.

B.
 
At 05:31 PM 6/6/2005 -0400, you wrote:
>The situation is two fold. I am almost done with entering the new Tyranid
>rules, and it has 2 units which require this. One is the Carnifex, if it
>is under 115 points and the list is at least 1500 it may be made an elite
>choice, the other is the Gaunts, at 8 points or less they may take an
>upgrade Without Number for 3 points.

For the Carnifex, do the rules say MAY be an elite choice, or does it HAVE
to be an elite choice. This is an important distinction.

As Harkan pointed out, both can be dealt with easy by using rules. It's the
dynamic option behavior based on the cost that is the hard part.

For the Carnifex, you would write a rule with "unit" scope and make it
unit-specific by setting the "targetid" to be the id of the Carnifex unit.
I'll assume that the composition group tag for "elite" is "compgroup.elite"
for my example. Then the rule script would look something like below.

~ If the unit hasn't been re-assigned as an Elite choice, we don't care
if (unit.tagis[compgroup.elite] = 0) then
@valid = 1
done
endif
~ If the unit cost is less than 115 and the roster size is 1500+, this is
legitimate
if (unit.cost[total] < 115) then
if (roster.activesize > 1500)
@valid = 1
endif
endif

For the Gaunts, you'll write a similar rule with "unit" scope that is
unit-specific to the id of the Gaunts. You'll also need to assign a tag to
the Gaunts when the "Without Number" option is selected. For my example,
I'll assume this tag is "special.withoutnum". Then the rule script would
look like the following.

~ If the option hasn't been selected (i.e. the tag isn't present), we don't
care
if (unit.tagis[special.withoutnum] = 0) then
@valid = 1
done
endif
~ The rule is only valid if the cost of a single model is 8 or less
if (unit.cost[one] <= 8) then
@valid = 1
endif

That ought to be all you need to do. Just yell if any of this doesn't make
any sense.

Hope this helps,
Rob

---------------------------------------------------------------------------
Rob Bowes (rob@wolflair.com) (408) 927-9880
Lone Wolf Development www.wolflair.com
 
At 06:56 PM 6/6/2005 -0400, you wrote:
>The rule is MAY.

If the rule is "MAY", then, I'm not sure the approach recommended by Harkan
is accurate. If I'm understanding correctly, the suggestion always changed
composition group assignment, instead of presenting it as an option for the
user.

I believe you'll need to use the rule-based approach to deal with the
optional nature. I'm still trying to come up with a way to handle it
cleanly via a "live" expression, but I'm coming up empty thus far.

-Rob

---------------------------------------------------------------------------
Rob Bowes (rob@wolflair.com) (408) 927-9880
Lone Wolf Development www.wolflair.com
 
Could you use the script to determine if the Carnifex is legal and give it a tag or stat such as EliteLegal and then set an option with that live tag so the player could select that option and then change the comp group the Carnifex is assigned?
 
There are other similar situations in the 40K files - if the game option is 'may' then if you add an option to change the Group tag to elite, using the roster category and use the rule to ensure that if it is changed over then it is a legal change then that should work
 
Back
Top