• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Need help with Finesse Feat

Hubrice

Active member
I am trying to create a new feat that allows a character to use their DEX mod instead of their STR mod for damage, as well as for attack rolls.

I found out that the Weapon Finesse feat does not seem to have any Eval Scripts, so I am not sure how it works, but I could not use it. I decided to use Brutal Throw (use STR mod for attack instead of DEX with thrown weapons) as the template.

I had some issues with that, but managed to get a feat that works for main-hand weapons. However it does not apply the correct damage bonus for the off-hand weapon. One of my players uses two short swords. But instead of applying half his DEX mod for damage, rounded down, it added the difference between his STR and DEX mod.

I need help with the code so that it substitutes the STR mod for the DEX mod, and applies the bonuses correctly for each weapon when he two-weapon attacks.

Here is the code I have so far:

~ If our STR bonus is higher than our DEX bonus exit.
doneif (hero.child[aSTR].field[aModBonus].value >= hero.child[aDEX].field[aModBonus].value)

~ Create variable to hold new Bonus value.
var XBonus as number
~Calc the bonus to apply to Melee attacks
XBonus = hero.child[aDEX].field[aModBonus].value - hero.child[aSTR].field[aModBonus].value

~ Apply bonus to all "Finesse" weapons.
foreach pick in hero where "wCategory.Melee & wClass.Light <>wCategory.RangeThrow"
~ (I had to exclude the RangeThrow weapons because it was calculating the STR bonus mod oddly to his hand axe. I might just limit it to the weapon that he has Weapon Focus for.)
each.field[wAttBonus].value += XBonus
each.field[wDamBonus].value += XBonus
nexteach
 
That code actually seems to work just fine. What is your timing? It has to take place Post-attributes or later (because you are using attribute bonuses). I would try Post-attributes/10000.

FYI, Weapon Finesse assigns a tag, and HL handles changing the bonus to attack from STR to DEX internally.
 
Last edited:
Thanks, I will play around with the timing. I am pretty sure I have it as one of the last User stages, but the timing might be set to only 100. I will bump it up tonight and see if that works.
 
Thanks, I will play around with the timing. I am pretty sure I have it as one of the last User stages, but the timing might be set to only 100. I will bump it up tonight and see if that works.

There's always the chance the timing is too late as well. I'm not sure about that, but I tested it at the timing I mentioned above, and it worked.
 
After adjusting the timing it still does not appear to work for me correctly. I started with a new character:
Human
Fighter
STR 10, DEX 15 (rest of the stats 10)

Feats are two-weapon and this new Improved Weapon Finesse feat.

Equipped normal short shorts, 1 in each hand.

The stats should be:
Main-hand [ +1 to hit ] 1d6+2 damage
Off-hand [ +1 to hit ] 1d6+1 damage

But instead both are at 1d6 +2 damage. The math gets really weird when I increase the STR and DEX, but keeping DEX higher than the STR.

For example, I raise DEX to 18 and the Bonus is 1d6 + 4 for each weapon. When I raise STR to 12, the bonus drops to 1d6 +4 for the main-hand and 1d6+3 for the off-hand. It stays there for STR 14, but then at STR 16 it drops to the correct 1d6+2 for the off-hand. This is probably because how the bonus is being created (Dex-mod - Str-mod).
 
The outer limits of the phase and priority for this are:
After Attribute/100001
Before Final/10000

So, I'd use Post-Attributes/10000.

Also, in the foreach, I'd use a bit of code that's easier to read (I have no idea how the <> is actually compiling in that - I wouldn't have thought that would get past the compiler):

wCategory.Melee & wClass.Light & !wCategory.RangeThrow
 
Oh...I forgot to mention, I did make a slight change to the foreach, though I'm not sure it would matter. I made it:

foreach pick in from BaseWep hero where...

Oh, and I believe off-hand damage only gains half the strength bonus, so that may be another issue you'll need to account for.
 
Mathias,
I will try your suggestions and see if the timing fixes the issue. I could not remember the "NOT" symbol so I used "<>" and it seemed to work. I will switch to the other method for consistency.

Sendric,
I will also try your suggestions. I my expectation was that the off-hand weapon would only receive half of the bonus, rounded down. Though I suppose an argument could be made otherwise (which I will consider if this does not work).


Another thought I had was, is there a way to use tags to switch which bonus is being used, so I do not have to do any calculations at all?
 
Mathias,
I tried your settings for timing and it did not seem to correct the issue. The full Dex bonus is still being added to the off-hand weapon. The only way to get it to change is if the Str mod increases, which is both counter-intuitive and not working as intended.

Sendric,
I was unable to get your code modification to work. I get a Syntax error in 'eval script for Thing 'fWepFinGr' (Eval Script '#1') on line 10 -> Invalid syntax within 'foreach' statement.
 
Sendric,
I was unable to get your code modification to work. I get a Syntax error in 'eval script for Thing 'fWepFinGr' (Eval Script '#1') on line 10 -> Invalid syntax within 'foreach' statement.

Ugh. I completely screwed that up. Sorry about that. It should be:

"foreach pick in hero from BaseWep where..."

Again, sorry about that.
 
Hubrice, remember - you're adding to the field for generic damage bonuses, not a field that's supposed to be acting like the strength and testing whether it's equipped in the main hand, off-hand, or both hands. You need to do that testing yourself, and halve the damage bonus in your own script before adding it to the weapon if the weapon is currently wielded in the off-hand.
 
Hubrice, remember - you're adding to the field for generic damage bonuses, not a field that's supposed to be acting like the strength and testing whether it's equipped in the main hand, off-hand, or both hands. You need to do that testing yourself, and halve the damage bonus in your own script before adding it to the weapon if the weapon is currently wielded in the off-hand.

Ok that makes sense, though I am not sure if I am up to that task. I will take a shot at this next week when I have some time off. I'll look for the wiki and tutorial articles.

On a related note, is there a trick to editing the scripts? It seems that on occasion I get errors because the compiler is picking up a space, or carriage return that is not readily visible. Even if I remove the space or CR (at least I think I am doing so) it still throws up an error. I have to copy the text into another program, edit it, then paste it back in.

It would be helpful if the editor window was resizable. I think what is happening is I cannot tell if there is a space/CR when a line of code wraps around. This happened to me when I was trying to change my version of NOT (<>) to your version (!). The line of code looked like this:

foreach pick in hero where "wCategory.Melee & wClass.Light !
wCategory.RangeThrow"


with wCategory.RangeThrow showing up on a separate line.
 
The ! needs to be part of the next thing it is with. Also, you need an & in there. Like this:

Code:
foreach pick in hero where "wCategory.Melee & wClass.Light & !wCategory.RangeThrow"

So, if your text is wrapping between ! and the letter w then there is a space. For reference, this foreach reads like this:

foreach pick in hero where the tags wCategory.Melee and wClass.Light exist, but not wCategory.RangeThrow.

That means any items on the hero that have those first two tags, but not the third (specifically excluding any that do), select those. Adding in "from BaseWep" limits the search criteria to weapons only.

Other tags you can use to differentiate which hand the weapon is in are "Hero.MainHand" and Hero.OffHand". These appear when 1st and 2nd are checked, respectively.
 
Last edited:
Sendric, that helps a lot. When I was editing that line I must have deleted the ampersand and that is why it was kicking back an error. Thanks for the tip on the main & off-hand tags. That should help me balance out the bonuses correctly. I'll let you know how it turns out.
 
Finally!

Well, I learned far more than I had expected to, but I think I got it working correctly.

Maybe I'll work on a way to make this a more balanced feat by requiring weapon focus and such, but it seems to work. I had to do some creative math to get the bonuses to work correctly when the Str mod was less than zero.

I found out that by trying to have a single variable that contained the difference in the bonus between Dex and Str, it was not calculating correctly when applied to the offhand weapon. So I moved that "math" to the actual line of code where the bonus was being applied. This allowed for HL to apply its values then I just subtracted them.

There is probably a better way to do this, but I had look up most of the code then piecemeal it together.

Please feel free to check out the code below and critique it. I would be happy for suggestions on streamlining it.

And thank you Mathias and Sendric for your help.

Code:
~ If our STR bonus is higher than our DEX bonus exit.
doneif (hero.child[aSTR].field[aModBonus].value >= hero.child[aDEX].field[aModBonus].value)

~ Create variables to hold Stat mods:
var strBonus as number
var dexBonus as number

~Calc the bonuses for Stat mods:
strBonus = hero.child[aSTR].field[aModBonus].value
dexBonus = hero.child[aDEX].field[aModBonus].value

~ Apply bonus to all "Finesse" weapons in MainHand:
foreach pick in hero from BaseWep where "Hero.MainHand & wCategory.Melee & wClass.Light & !wCategory.RangeThrow"
each.field[wAttBonus].value = dexBonus - strBonus
each.field[wDamBonus].value = dexBonus - strBonus
nexteach

~ Apply bonus to all "Finesse" weapons in OffHand:
foreach pick in hero from BaseWep where "Hero.OffHand & wCategory.Melee & wClass.Light & !wCategory.RangeThrow"
each.field[wAttBonus].value = dexBonus - strBonus
if (strBonus <0) then
  each.field[wDamBonus].value = int(dexBonus/2) - strBonus
else
  each.field[wDamBonus].value = int(dexBonus/2) - int(strBonus/2)
endif
nexteach
 
Back
Top