Well, I've launched into implementing the rules in the blog from post #1. I tackled Weapon Focus first. The blog says:
Combat feats like Weapon Focus now apply to weapon groups instead of a specific weapon by default.
I fired up the editor and made a copy of Weapon Focus. Happily, it seems that the code to make this happen is already built in! There's a feat
Martial Versatility which makes this exact change to the rules. Weapon Focus checks for the relevant tags to see if the character has that feat, and applies it to the weapon group if so:
Code:
if (tagcount[Hero.MartVersa] + hero.tagcount[Hero.MartMaster] <> 0) then
Since this is supposed to be the default behavior now, I changed this to always execute:
And it worked! Hooray, bounce bounce.
But ... if you don't have proficiency with a weapon, and this script gives you weapon focus, HL quite logically throws an error. For example, a wizard with Weapon Focus (club) who picks up a warhammer will then get an error about having weapon focus without proficiency.
The blog post is silent about what happens if you lack proficiency with a weapon in a group that you have focus in. I'm assuming that if you lack proficiency, you cannot gain weapon focus.
I've just spent three hours banging my head against figuring out how to detect whether the character has proficiency. Here's the original unmodified loop from Weapon Focus that I'm working with:
Code:
foreach pick in hero from BaseWep
if (eachpick.tagmatch[wFtrGroup,wFtrGroup,initial] <> 0) then
perform eachpick.assign[Broadcast.WepFocus]
perform eachpick.pulltags[WepFocus.?]
endif
nexteach
Between looking at a bunch of other feats and some reading in the manuals, I've determined that I can test for proficiency with something like:
Code:
tagis[WepProf.wWarhammer]
I've also determined that I can get the ID of the weapon currently being iterated over using eachpick.idstring. Then all I need to do is add a nested IF that checks the hero to see if they have the WepProf.whatever tag, and only proceed if they do.
So ... how do I put these things together? So far all of the following have failed:
Code:
~ This turned out to be a wildcard, not subbing eachpick
if (tagis[WepProf.?] <> 0) then
~ eachpick is not defined on WepProf
if (tagis[WepProf.eachpick.idstring] <> 0) then
~ weapon is not defined on WepProf
var weapon as string
weapon = eachpick.idstring
if (tagis[WepProf.weapon] <> 0) then
~ invalid tag syntax
var weapon as string
weapon = "WepProf." & eachpick.idstring
if (tagis[weapon] <> 0) then
I've got the tag, and the ID. How do I put them together? I've spent ages dredging through the help files, the authoring kit wiki, and assorted posts on this forum, with no luck. It seems like such a basic thing to want to put together a tag and an ID like this, but I can't find the syntax for the life of me.