Member
Join Date: Jun 2007
Location: United Kingdom
Posts: 80
|
How do I code so that, for example, an Ability that can only be picked three times presents an error message if more than three picks are made. I'm pretty sure I need to count the number of times it's picked, but not sure what the code to do so is or the correct syntax for the "iserror"
A more explicit example: I have an ability called Extra Elemental Reduction with the Unique ID abXElemRed - it's limited to seven picks, so an error needs to appear if the number of picks satisfies the conditions "abXElemRed > 7". It's not simply a matter of saying Code:
if abXElemRed < 8 then @valid endif I'm trying to create the ability via the editor rather than the data files, as it is dependant on a source. Last edited by RayPrancer; March 7th, 2010 at 09:54 AM. Reason: Tested code, didn't work. |
#1 |
Member
Join Date: Jun 2007
Location: United Kingdom
Posts: 80
|
I think I've found a script that should work (adapted from the prerequisite script for one of the abilities in the sample ability) but can't work out where to add it.
Code:
if (#trait[abXElemRed] >= 7) then @valid = 0 done endif altthing.linkvalid = 1 |
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Your first clue for whether to put this test comes from your very own post. You adapted the script from a pre-requisite script on an ability, so you should probably set this up as a pre-requisite as well.
If you're using the Editor, you can add a pre-requisite test via the "Pre-reqs" button. Your script can be written as you have it above, except that I don't think you need the last line (with "linkvalid"). You can also simplify the script if you'd like, as shown below. Code:
validif (#trait[abXElemRed] < 7) |
#3 |
|
|