• 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

A rule for unique characters

Mathias

Moderator
Staff member
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.
 
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.
 
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.
 
At 12:02 PM 4/1/2007, you wrote:
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.
I believe the solution would be to write a rule with "merge" scope. This will cause the rule to be fired for each disctint unit within the roster. You'll need to verify that you only test named characters with the rule. Then you'll be able to verify that the total number of models of each unit equals one.

Hope this hels,
Rob
 
At 04:46 PM 4/3/2007, you wrote:
Thank you, that worked.
Oops. I saw the email for this one and answered it before seeing it was already handled. Sorry about that....
 
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
 
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".
 
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
 
Back
Top