PDA

View Full Version : Feat Prerequistes


Kaleb
October 20th, 2010, 10:54 PM
How do you enter feat prerequsites?

In a laer version of the Editior would it be possible to just have a tab in the feat secton clearly marked feat prereqs and have a menu where you just select the Pre reqs and the program does its magic behind the scenes?

chiefweasel
October 21st, 2010, 07:10 AM
ON the editor Feat Tab there is a button for pre-req. when you click it you have the option to enter in the code to check for pre-reqs. for instance, the feat Awesome Smite from Complete Champion, there is a pre-req to have Power Attack feat. so the code for this would be:

@valid = #hasfeat[fPowerAtt]

Hope this helps.

ShadowChemosh
October 21st, 2010, 08:13 AM
Also you can do a NEW(Copy), blue button bottom left, in the Feat tab to create a copy of an existing feat. Find one that has similar prereq and you can just copy stuff that HL has already done.

tatteredking
March 29th, 2011, 03:25 PM
OK, so having an issue here with an Item Creation feat I am entering. The feat has a prereq of at least one other Item Creation feat. Checking the Help, I find this script for having at least 3 Item Creation or Metamagic feats.

<prereq onlyonce="yes" message="3 Metamagic or Item Creation feats required.">
<valid><![CDATA[

~ Start out invalid
@valid = 0

~ Count our metamagic and itemcreation feats - do we have at least 3?
if (tagcount[fCategory.Metamagic] + tagcount[fCategory.ItemCreate] >= 3) then

~ If so, we're valid.
@valid = 1
endif
]]></valid>
</prereq>


Changing this slightly, I put this in for a pre-req

<prereq onlyonce="yes" message="One other Item Creation Feat required.">
<valid><![CDATA[

~ Start out invalid
@valid = 0

~ Count our item creation feats - do we have at least 1?
if (tagcount[fCategory.ItemCreate] >= 1) then

~ If so, we're valid.
@valid = 1
endif
]]></valid>
</prereq>

I get an error at line 534...which is the line in red, reading Expected close tag for item 'validate'. Opening the xml file, I see that the interface had added other lines of code

<prereq message="">
<validate><![CDATA[<prereq onlyonce="yes" message="One other Item Creation Feat required.">
<valid><![CDATA[

~ Start out invalid
@valid = 0

~ Count our item creation feats - do we have at least 1?
if (tagcount[fCategory.ItemCreate] >= 1) then

~ If so, we're valid.
@valid = 1
endif
]]></valid>
</prereq>]]></validate>
</prereq>

And I can understand why I get the error, as the tags don't line up. But I don't know how to fix it.

Thoughts?

Mathias
March 29th, 2011, 03:46 PM
It's somehow nested the proper prereq within an empty prereq. In the help, did it list the entire XML, and you copied all of it? If so, the only part you want to copy into the editor is the part between <![CDATA[ and ]]>. Then, copy the contents of the message="XXXX" into the Message box in the editor - only the message itself, not the quotes or the message=.

You may want to start with something that's already in Hero Lab with this prereq - for example, you could go to the Class Level tab and make a copy of the Loremaster class (you'll just be making a copy of the class level, so you won't end up going through the class creation wizard). Then, you can take a look at its prereqs and see what the "3 Metamagic or Item Creation Feats required" looks like as seen in the editor.

tatteredking
March 29th, 2011, 04:55 PM
The help listed the entire contents of the first quoted text, so that's what I put in. I looked through all the feats and couldn't find something to base it off. I will try your suggestion. Just starting with the scripting, so it will take me a little to get used to the language.

Thanks!

tatteredking
March 30th, 2011, 12:05 PM
OK Continued :)

I entered this into the Pre-reqs

<![CDATA[

~ Start out invalid
@valid = 0

~ Count our item creation feats - do we have at least 1?
if (tagcount[fCategory.ItemCreate] >= 1) then

~ If so, we're valid.
@valid = 1
endif
]]>

I compiled and got an error on line 1. "Unspecified error on line 1". So I removed that.

Following your advice, I checked out the Loremaster. Under the Expr-reqs, I checked out the script and put this script in my feat.

tagcount[fCategory.ItemCreate] >= 1

Tried it out, EDIT: Works fine!

Sendric
March 30th, 2011, 12:15 PM
I made a quick feat, and used this expression in Expr-reqs:


tagcount[fCategory.Metamagic] + tagcount[fCategory.ItemCreate] >= 3


It seemed to work. Note that this is the same expression from the Loremaster class level.

Mathias
March 30th, 2011, 12:44 PM
Don't copy the <![CDATA[ and ]]> parts - copy everything between those.

The exprreq you have looks fine, and I don't understand why it's a problem. (If this feat you're creating is an Item Creation feat, remember that it will fulfill its own prereq once selected, so you're looking for whether or not the feat can be taken in the first place).

tatteredking
April 4th, 2011, 12:48 PM
OK thanks for that, guys. Got it working like a carm.

Next challenge.

I have a bunch of feats that are restricted to a subset of races (human, elf, dwarf, gnome, halfling, half elf, and half-orc). So I am trying to figure out how to restrict a feat to those races without having to alter the races to contain a new tag.

The script for restricting a feat to a specific race is #hasrace[rXXX] <>0. But can I 'sum' them like this?

#hasrace[rHuman] + hasrace[rElf] + hasrace[rDwarf] + hasrace[rGnome] + hasrace[rHalfling]+ hasrace[rHalfOrc] + hasrace[rHalfElf] <>0

EDIT: I tried itand it didn't work as written, but when I used this, it did.

#hasrace[rHuman] + #hasrace[rElf] + #hasrace[rDwarf] + #hasrace[rGnome] + #hasrace[rHalfling]+ #hasrace[rHalfOrc] + #hasrace[rHalfElf] <>0

Lawful_g
April 4th, 2011, 02:14 PM
I think that'll work. Why don't you try it and test?