Member
Join Date: Nov 2013
Posts: 36
|
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 |
#1 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
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 by Sendric; February 4th, 2014 at 06:12 AM. |
#2 |
Member
Join Date: Nov 2013
Posts: 36
|
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.
|
#3 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
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.
|
#4 |
Member
Join Date: Nov 2013
Posts: 36
|
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). |
#5 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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 |
#6 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
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. |
#7 |
Member
Join Date: Nov 2013
Posts: 36
|
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? |
#8 |
Member
Join Date: Nov 2013
Posts: 36
|
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. |
#9 |
Senior Member
Join Date: Jul 2010
Posts: 3,147
|
Quote:
"foreach pick in hero from BaseWep where..." Again, sorry about that. |
|
#10 |
|
|