Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
I've written a rule to make sure that the named characters in the game I'm working on are not duplicated.
Unit-Level scope, test expression: Notes.Character, script: if (this.overall.tagunique[unitid.?] = this.overall.tagcount[Notes.Character]) then @valid = 1 endif This works as expected, but the problem is that if it does have an error, every character model shows the error. I'd rather not have the same error show up many times in the error list (I can understand it showing up twice - for each of the duplicates). Is there a better way to write a rule for uniqueness? The majority of units in this game are characters, so I don't want to write a rule for every unit. |
#1 |
Senior Member
Volunteer Data File Author
Join Date: Mar 2005
Posts: 345
|
If I am understanding you correctly you can take any number of characters (or a game based limit) but no character can be taken more than once?
If so, take a look at the 40k files, particularly the generalstuff.dat file and the rule that handles the multiple items. The way we have it running is you can tag a unit so it can be limited ot the number of times it can be taken, once twice or more etc. If the user exceeds this limit then only the applicable units are highlighted. The beauty of this is it only needs a tag adding to a unit and is flexible enough to handle any number of restrictions. When I can get near ABC will post up the particular rule name and tag group name. |
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Thank you, that worked.
For the benefit of anyone running a search on this topic later, what worked was: Merge-level scope (note that change), test expression: Notes.Character, script: if(count[basic] <=1) then @valid = 1 endif The 40K version checks the tag on the right-hand side of the boolean, to allow ranges greater than 1. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
At 12:02 PM 4/1/2007, you wrote:
Quote:
Hope this hels, Rob |
|
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
At 04:46 PM 4/3/2007, you wrote:
Quote:
|
|
#5 |
Senior Member
Volunteer Data File Author
Join Date: Apr 2005
Posts: 220
|
Would it be possible to have the warning alert the user as to which unit has gone over it's limit?
I'm guessing this would require rules for each unit? Say, instead of "You are limited to X units." It could be "You are limited to X Blue units." Thanks Butcher Warmachine/Hordes ('Retired' Confrontation and AT-43) Army Builder Author. Magic the Gathering Card Vault Author. |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Butcher, what I used does this. The error it reports (only once) is: "Unit 'Akjo Kageshima': You may only have one of a character model".
|
#7 |
Senior Member
Volunteer Data File Author
Join Date: Mar 2005
Posts: 345
|
The merge option does highlight the relevant units that are breaking it in red and you can tailor the rule message in the usual way
|
#8 |
Senior Member
Volunteer Data File Author
Join Date: Apr 2005
Posts: 220
|
Awsome! Just tried it out and she's a beauty!
Exactly what I was looking for!! Thanks, everyone! Butcher Warmachine/Hordes ('Retired' Confrontation and AT-43) Army Builder Author. Magic the Gathering Card Vault Author. |
#9 |
|
|