View Single Post
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old January 18th, 2007, 03:10 AM
Pre-requisites are always treated as separate conditions that are AND'd by HL. So an "or" would need to be implemented as its own complete pre-requisite.

You can start by copying another feat that has a requirement of an ability score minimum. I'll use Power Attack for this example. It has a pre-requisite with the following script.

*** if (child[aSTR].field[aNormal].value >= 13) then
***** @valid = 1
***** endif

Changing that over to verify a minimum Int of 17 gives you the following.

*** if (child[aINT].field[aNormal].value >= 17) then
***** @valid = 1
***** endif

We also need to factor in the separate test of the Elf race. A quick look at the hero tags using the debugging aids shows a tag of "Race.Elf" when I've chosen the Elf race for my hero. So the other test we need to make is to look for this tag. Since HL's scripting is very simple and doesn't allow for complex boolean expressions within "if/then" tests, we modify the script as shown below.

*** if (child[aINT].field[aNormal].value >= 17) then
***** @valid = 1
*** elseif (tagis[Race.Elf] <> 0) then
***** @valid = 1
***** endif

The net result is a single pre-requisite that checks both requirements. The script first tests if the Int is high enough and marks the prereq as valid if so. If that isn't satisfy, the script then tests if the "Race.Elf" tag is present, making the prereq as valid if so. When the script ends, if either condition is satisfied, the "@valid" special symbol is non-zero - just the way we want it. If not, the value is zero and the prereq fails - just the way we want it.

Hope this helps,
Rob

P.S. You'll find "tagis" documented in the Authoring Kit. It simply tests whether a tag is present or not, returning 1 if a tag is found and 0 if not.


At 11:35 AM 1/17/2007, you wrote:

Quote:
How do you do an "or" statement, specifically in regards to feat prerequisites.

For instance, "Intelligence 17 or elf."

(and if it's as simple as putting the word "or" in somewhere, I'm gonna cry.) [img]./modules/mdforum/images/smiles/icon_lol.gif[/img]
rob is offline   #2 Reply With Quote