Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Hubrice
Member
 
Join Date: Nov 2013
Posts: 36

Old February 3rd, 2014, 06:05 PM
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
Hubrice is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old February 4th, 2014, 06:08 AM
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.
Sendric is offline   #2 Reply With Quote
Hubrice
Member
 
Join Date: Nov 2013
Posts: 36

Old February 4th, 2014, 11:03 AM
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.
Hubrice is offline   #3 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old February 4th, 2014, 11:12 AM
Quote:
Originally Posted by Hubrice View Post
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.
Sendric is offline   #4 Reply With Quote
Hubrice
Member
 
Join Date: Nov 2013
Posts: 36

Old February 4th, 2014, 06:01 PM
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).
Hubrice is offline   #5 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old February 4th, 2014, 08:15 PM
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
Mathias is online now   #6 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old February 5th, 2014, 05:35 AM
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.
Sendric is offline   #7 Reply With Quote
Hubrice
Member
 
Join Date: Nov 2013
Posts: 36

Old February 5th, 2014, 12:45 PM
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?
Hubrice is offline   #8 Reply With Quote
Hubrice
Member
 
Join Date: Nov 2013
Posts: 36

Old February 5th, 2014, 10:20 PM
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.
Hubrice is offline   #9 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old February 6th, 2014, 07:23 AM
Quote:
Originally Posted by Hubrice View Post
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.
Sendric is offline   #10 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:27 PM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.