Lone Wolf Development Forums  

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

Notices

Reply
 
Thread Tools Display Modes
thebutcher
Senior Member
Volunteer Data File Author
 
Join Date: Apr 2005
Posts: 222

Old November 27th, 2005, 10:43 AM
Ok, I'm trying to set an option that will only be available if the model cost is over 14 points.
Something like entity.cost>14
But, nothing that simple is working, gah!

Thanks again
Butcher

Warmachine/Hordes ('Retired' Confrontation and AT-43) Army Builder Author.
Magic the Gathering Card Vault Author.
thebutcher is offline   #1 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,005

Old November 27th, 2005, 12:49 PM
By implication, I'm going to assume the there are other options on the unit. You want the option in question to only be available if sufficient other options have been selected to push the overall cost of the unit over 14 points.

The problem is that costs are being calculated AFTER everything is evaluated. So checking the cost during evaluation will always net you a value of zero. This means it is not possible to base the availability of an option on the in-progress cost of the containing entity.

There is only one approach I can think of that ought to work in this situation. You'll need to setup a private unit stat in which to track the necessary information during the evaluation process. This means having the various options for the unit assign their cost to the unit stat from their Evaluate script. You can use a Live tag expression to determine whether the option is valid by basing it on the current stat value.

Yes, I realize this is ugly, and probably a lot of work to setup. Another alternative would be to use a validation rule that simply ensures the option is not selected unless the entity model cost is above the threshold. This would be easy to do via a "unit" scope rule and a tag to identity when the option is selected.

I'm going to check with Colen in case he's got any brilliant ideas that I can't think of right now. If he comes up with anything, we'll be sure to post it here. :-)

Thanks, Rob

At 11:43 AM 11/27/2005, you wrote:

Quote:
Ok, I'm trying to set an option that will only be available if the model cost is over 14 points.
Something like entity.cost>14
But, nothing that simple is working, gah!

Thanks again
Butcher
rob is offline   #2 Reply With Quote
Colen
Senior Member
Lone Wolf Staff
 
Join Date: Dec 2008
Posts: 4,728

Old November 28th, 2005, 11:26 PM
At 02:43 PM 11/27/2005 -0500, you wrote:
>Ok, I'm trying to set an option that will only be available if the
>model cost is over 14 points.
>Something like entity.cost>14
>But, nothing that simple is working, gah!


We're trying to think of a way to set this up, and currently we're
drawing a blank (other than the solution Rob already outlined). Is
this a common situation you're coming up against, or is it just a
problem for one or two units in the whole game system? Could you give
us more details?


Thanks.



--
Colen McAlister (colen@wolflair.com)
Chief Engineer, Lone Wolf Development
http://www.wolflair.com/
Colen is offline   #3 Reply With Quote
thebutcher
Senior Member
Volunteer Data File Author
 
Join Date: Apr 2005
Posts: 222

Old December 27th, 2005, 02:25 PM
Well, to get back to this.
It is something that's popped up a few times with Rackham's new army packs.
For instance certain options when you build a particular "flavor" of an Undead army are available to models of a certain points cost ( I wish they would have used the Rank system they have built into the game instead, but.... ).
If I set up a "limit" group and assign a tag through the EVAL like "limit.cost19" I would be able to set up a Unit scope Rule to check
if tagcount[limit.cost19 ] >=1 then
if cost[unit] < 19 then
@valid = 1
endif
endif
:?:

Thanks
Butcher

Warmachine/Hordes ('Retired' Confrontation and AT-43) Army Builder Author.
Magic the Gathering Card Vault Author.
thebutcher is offline   #4 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,005

Old December 29th, 2005, 04:36 PM
If the option availability is based on the "base" cost of the model (i.e. without any options attached), then this can be easily done. AB automatically defines a "costvalue" tag for every entity that corresponds to the base cost of that entity. You could easily setup a Live tag expression for each of the special options that requires the unit to have a "costvalue" tag with a value of at least X (whatever the minimum is). For example, if an option requires the model cost to be at least 30 points, the tagexpr would look like the following:
*** val:costvalue.? >= 30

You could further restrict the Live tagexpr to only apply when the certain "flavor" of army is selected. This would be done by using rulesets to have the user specify which "flavor" he wishes to field. Each ruleset would define a corresponding global tag. You could then include tests of the appropriate ruleset tag(s) within the Live tagexpr by combining them with the cost test above via a boolean expression.

The above approach would completely hide the option for units that were not allowed to take it based on the point requirement. However, this approach assumes you can use the "base" cost of the model. If you have to use the adjusted cost, then you'll have to use a rule-based method to solve this.

If you need to handle this via a rule, your outlined approach below is on the right track, but it's not quite going to work. For each option that requires a minimum cost, you'll need to assign an appropriate tag. Since we're talking about minimum costs, I'd create a new tag group and name it "mincost". You could then assign the tags as "mincost.19" to reflect a minimum cost of 19 points. This is much like what you are proposing below.

To detect and handle these conditions, things get a bit more interesting. What you really want is to identify the maximum cost requirement of any options and then compare that against the actual model cost of the unit. This will flag a validation error to indicate that one or more options selected for the unit are invalid based on the cost requirement. To identify the maximum cost, you'll need to use "tagmax[costvalue.?]". You'll then ned to compare that against the MODEL cost of the unit, just in case the user selects multiple models of the unit. This entails using the "entity" context and accessing the "cost[one]" target reference. So your rule would look something like the following:

var maxcost as number
maxcost = this.tagmax[costvalue.?]
if (maxcost <= this.entity.cost[one]) then
*** @valid = 1
*** endif

I haven't tried the above myself, but I'm 99% sure it should work. If I've missed something, let me know and I'll see what I can do to get things sorted out. :-)

Hope this helps,
Rob

At 03:25 PM 12/27/2005, you wrote:

Quote:
Well, to get back to this.
It is something that's popped up a few times with Rackham's new army packs.
For instance certain options when you build a particular "flavor" of an Undead army are available to models of a certain points cost ( I wish they would have used the Rank system they have built into the game instead, but.... ).
If I set up a "limit" group and assign a tag through the EVAL like "limit.cost19" I would be able to set up a Unit scope Rule to check
if tagcount[limit.cost19 ] >=1 then
if cost[unit] < 19 then
@valid = 1
endif
endif
[img]./modules/mdforum/images/smiles/icon_question.gif[/img] *

Thanks
Butcher
rob is offline   #5 Reply With Quote
Warmonger
Member
Volunteer Data File Author
 
Join Date: Apr 2005
Location: North Western Arizona
Posts: 97

Old December 30th, 2005, 05:31 AM
Quote:
Originally Posted by rob
Another alternative would be to use a validation rule that simply ensures the option is not selected unless the entity model cost is above the threshold. This would be easy to do via a "unit" scope rule and a tag to identity when the option is selected.

This is the approach that I took with two similar options in the 40k Tyranid files. I have a validation script assess the over cost of everything and then set off a validation error if that option shouldn't be selected at that time.
Warmonger is offline   #6 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 12:57 PM.


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