Okay, I'm working on making the exception for NPCs, and I'm confused as !@##.
I've moved the rules to to the House Rules section, thus:
That correctly makes them show up like this:

I also added a custom tag, "WiSRules.PayFeatTax" in the .1st file. So far so good.
I added a Mechanics rule that tests for these things, and tag NPC heros as having to pay the tax:
That runs at Pre-Levels 100, and appears to work correctly. That is:
1) If the whole source is disabled, it does nothing;
2) if the NPC tax is turned off, it does nothing;
3) if both are turned on, it tags NPCs, and NPCs only with WiSRules.PayFeatTax.
Here's where things break down. I went to the mechanic for bootstrapping Combat Expertise, and put in two tests:
But my test characters kept getting Combat Expertise. PCs get it; NPCs get it. NPCs still get it if I check the box to tax them.
So I put in some debug statements:
This tells me that the checkboxes from the hero configuration screen are working correctly; if they are checked, these test both return 1. If they are unchecked, both return 0.
Disabling the source entirely appears to work normally. I can turn off the whole rule set, and nobody gets anything they shouldn't. But trying to tax NPCs has no effect.
I tried flipping the polarity a few times -- compare against 0 rather than 1 in the check for WiSRules.PayFeatTax. This had no effect.
Finally, in desperation, I tried this:
Note the last line: a plain, unqualified done, which is supposed to immediately terminate script execution ... and doesn't. The script hits that "done" and continues running, so everybody continues getting Combat Expertise.
Meanwhile, Weapon Finesse and Point Blank Shot appear to be working correctly with the exact same code. PCs always get them; NPCs get them until you check the box to tax NPCs, and then they stop getting them.
I don't understand. What's different? Why does it work in some places but not in others? I have no idea what's going on, but after beating my head against this for three hours, I'm calling it quits for the night.
I've attached update .user and .1st files -- the .1st is renamed .txt, as before.
I've moved the rules to to the House Rules section, thus:
Code:
<source
id="WiSParent"
name="World is Square"
parent="HouseRules"
selectable="no"
sortorder="0"
description="Rules for eliminating feat taxes, as proposed by Michael Iantorno. Hero Lab implementation by Will Martin.">
</source>
<source
id="WiSRules"
name="Eliminate feat taxes"
parent="WiSParent"
description="Grants assorted bonus feats to characters, and combines others.">
</source>
<source
id="WiSNPCTax"
name="NPCs pay normal feat taxes"
parent="WiSParent"
description="NPC characters must purchase feats like Power Attack normally.">
</source>
That correctly makes them show up like this:

I also added a custom tag, "WiSRules.PayFeatTax" in the .1st file. So far so good.
I added a Mechanics rule that tests for these things, and tag NPC heros as having to pay the tax:
Code:
doneif (hero.tagis[source.WiSRules] = 0)
doneif (hero.tagis[source.WiSNPCTax] = 0)
if (hero.tagis[CharType.typNPC] <> 0) then
perform hero.assign[WiSRules.PayFeatTax]
endif
That runs at Pre-Levels 100, and appears to work correctly. That is:
1) If the whole source is disabled, it does nothing;
2) if the NPC tax is turned off, it does nothing;
3) if both are turned on, it tags NPCs, and NPCs only with WiSRules.PayFeatTax.
Here's where things break down. I went to the mechanic for bootstrapping Combat Expertise, and put in two tests:
Code:
doneif (hero.tagis[source.WiSRules] = 0)
~ We're an NPC, and subject to feat taxes, so we're done
doneif (hero.tagis[WiSRules.PayFeatTax] <> 1)
But my test characters kept getting Combat Expertise. PCs get it; NPCs get it. NPCs still get it if I check the box to tax them.
So I put in some debug statements:
Code:
debug "Is the source turned on? " & hero.tagis[source.WiSRules]
debug "Is this a taxed NPC? " & hero.tagis[WiSRules.PayFeatTax]
This tells me that the checkboxes from the hero configuration screen are working correctly; if they are checked, these test both return 1. If they are unchecked, both return 0.
Disabling the source entirely appears to work normally. I can turn off the whole rule set, and nobody gets anything they shouldn't. But trying to tax NPCs has no effect.
I tried flipping the polarity a few times -- compare against 0 rather than 1 in the check for WiSRules.PayFeatTax. This had no effect.
Finally, in desperation, I tried this:
Code:
doneif (hero.tagis[source.WiSRules] = 0)
~ We're an NPC, and subject to feat taxes, so we're done
doneif (hero.tagis[WiSRules.PayFeatTax] <> 0)
done
Note the last line: a plain, unqualified done, which is supposed to immediately terminate script execution ... and doesn't. The script hits that "done" and continues running, so everybody continues getting Combat Expertise.
Meanwhile, Weapon Finesse and Point Blank Shot appear to be working correctly with the exact same code. PCs always get them; NPCs get them until you check the box to tax NPCs, and then they stop getting them.
I don't understand. What's different? Why does it work in some places but not in others? I have no idea what's going on, but after beating my head against this for three hours, I'm calling it quits for the night.
I've attached update .user and .1st files -- the .1st is renamed .txt, as before.