• 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

Script ammendment on minimum and maximum

harkan

Well-known member
Is there a way to change the min and max of an item through script. At the moment some of the items are added through an option with a range of 0 - 3, however on other occassions only one is available. An example of this is the psychic powers in the chaos file where individual characters take one of them, however a squad of Tzeentch Chosen can take multiple of the same power.

Ideally the script would ammend the minimum and maximum of the item so that in the above case it would be set to a max/min of one for the character but dynamic for the squad dependant on size.
 
Wouldn't you be better off using an exclusion group (you could base it on a stat, or the model count)? you can use different exclusion mechanisms (stat/fixed/model count) on each different link as required.

Just a thought,
Russell.
 
thats what I thought originally but it didn't work - most probably me messing it up, will retry

tvm
 
have just retried - that works OK if selecting it from an option however doesn't seem to work if you select the item and then use the +/- buttons to ammend the count
 
Assigning the exclusion usage to the item ought to work perfectly, just as Russell suggested. The exclusion group limits should be properly imposed if the items tally up the proper usage.

If this isn't working for you, please outline how you're solving it and we'll see if we can spot where the misunderstanding is.

-Rob

At 10:56 PM 1/23/2006, you wrote:

You need to put the exclusion on the item for that to work... will that help any?
 
using the ork file as an example:

new unit that allows the user to select between one and three buggies using the +/- butttons top right of roster. Weapons are set up as options using the range of 0 - 3 with exclusions to control them.

The issue is coming with the vehicle equipment. Each piece of equipment is set up as an item with an option that inherits from that, i.e. orSrch is the item with orSrch as the option. The user selects the option which then adds the item to the unit. They then set the number of searchlights using the +/- buttons top right of the roster list to set the number of searchlights the unit has.

The prob is coming from if the unit only has two vehicles then the user needs to be capped at two items, I've applied an exclusion to the item - no luck, applied an exclusion to the option, no luck.

The reason I want to do it this way round is so that the unit lists the equipment it has, the items of equipment show the correct count and cost as well on the list.

Does that make it any clearer?
 
Everything you described below sounds exactly right. I did a quick check on my end, and this looks like it could be a bug with exclusion references on child entities being broken. I'm going to have to investigate further. Stay tuned.

-Rob


At 10:38 AM 1/24/2006, you wrote:

using the ork file as an example:

new unit that allows the user to select between one and three buggies using the +/- butttons top right of roster. Weapons are set up as options using the range of 0 - 3 with exclusions to control them.

The issue is coming with the vehicle equipment. Each piece of equipment is set up as an item with an option that inherits from that, i.e. orSrch is the item with orSrch as the option. The user selects the option which then adds the item to the unit. They then set the number of searchlights using the +/- buttons top right of the roster list to set the number of searchlights the unit has.

The prob is coming from if the unit only has two vehicles then the user needs to be capped at two items, I've applied an exclusion to the item - no luck, applied an exclusion to the option, no luck.

Is that any clearer?
 
have got further with this, instead opf putting 1 into the exclusion and thinking that the increment of the unit/item count would increase this, have put # instead which seems to have resolved that issue of the exclusion not catching it.

Am gonna play a bit more, set up an exclusion linked to a unit stat that is 0 - @stat and then link them together to see if that gives me the flexibility I'm after

cheers
 
solution that seems to be workable: within the aug file have created a unitstat called orLimit, created an exclusion called orLimit that runs 0 - @orLimit

With the unit, added a line to prelink 'basestat[orLimit] = count[model]'

Added the exclusion to the item of orLimit set to #

This all seems to work, however the other issue is that each vehicle has 9 bits of vehicle equipment which would seem to mean I am going to need 9 exlcusions - is there a way round this?
 
First of all, I'm glad that you got this working. :-)

If you have 9 different things that you want to apply exclusions to simultaneously, I'm afraid you will need 9 different exclusion groups and 9 different unit stats to handle this situation.

One alternative you can try is to use the SizeLimit script. Since you are looking to constrain the count of a child item, this might be a better approach if you've got a bunch of stuff to restrict. The SizeLimit script needs to be attached to the OPTION that ties the child entity to the parent. It allows you to specify the minimum and maximum limits for the entity size, with the limits derived based on the nature of the parent entity. For example, parent unit X can have 2-5 of the child, while parent unit Y can have 1-3 of the child. This sounds like it's the behavior you are looking for, so I recommend giving it a try. :-)

And now I need to get to bed.....

Hope this helps,
Rob

At 03:21 AM 1/28/2006, you wrote:

solution that seems to be workable: within the aug file have created a unitstat called orLimit, created an exclusion called orLimit that runs 0 - @orLimit

With the unit, added a line to prelink 'basestat[orLimit] = count[model]'

Added the exclusion to the item of orLimit set to #

This all seems to work, however the other issue is that each vehicle has 9 bits of vehicle equipment which would seem to mean I am going to need 9 exlcusions - is there a way round this?
 
sorted - cheers for the steer about the sizelimit!!!!! :)

Have added in a set of tags that run orCount1, orCount2, orCount3

Unit has a prelink script as follows:

var retval as number
retval = delete[orTagsDy.?]

if (count[model] = 1) then

retval = assign[orTagsDy.orCount1]
endif

if (count[model] = 2) then

retval = assign[orTagsDy.orCount2]
endif

if (count[model] = 3) then

retval = assign[orTagsDy.orCount3]
endif

Each applicable option has in the sizelimit script:

@maximum = this.tagvalue[orTagsDy.orCount?]

Now, as soon as the user adds another vehicle the tag is changed to reflect this, when adding the vehicle equipment they cannot add more than is in the squad - I can now do away with the long list of exclusions etc and also roll this script into other areas :)
 
Excellent! That's exactly the type of solution that I was envisioning you could use!!! :->

One thing to be aware of as you propogate the solution elsewhere. Remember that using the PreLinks script like this will only work if the unit itself does not have behaviors that force an evaluation restart. If so, then you could have problems getting the behavior you ideally want. The details on this are outlined in the docs, but it's an important thing to remember.

If you ARE bit by the above limitation, you can put the exactly same logic below into an option and then attach the option to the unit with a priority of zero, making it happen before anything else. This will achieve the same net result and avoid any issues with the PreLinks restart.

I point this out simply because the 40K files are much more complex than most of games and are therefore likely to have a number of units that force an evaluation restart due to that complexity. Consider this a preemptive answer to a likely question. :-)

-Rob

At 05:56 AM 1/28/2006, you wrote:

sorted - cheers for the steer about the sizelimit!!!!!
icon_smile.gif


Have added in a set of tags that run orCount1, orCount2, orCount3

Unit has a prelink script as follows:

var retval as number
retval = delete[orTagsDy.?]

if (count[model] = 1) then

retval = assign[orTagsDy.orCount1]
endif

if (count[model] = 2) then

retval = assign[orTagsDy.orCount2]
endif

if (count[model] = 3) then

retval = assign[orTagsDy.orCount3]
endif

Each applicable option has in the sizelimit script:

@maximum = this.tagvalue[orTagsDy.orCount?]

Now, as soon as the user adds another vehicle the tag is changed to reflect this, when adding the vehicle equipment they cannot add more than is in the squad - I can now do away with the long list of exclusions etc and also roll this script into other areas
icon_smile.gif
 
Back
Top