Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   How can I change the Melee bonus using math from the Attribute modifiers? (http://forums.wolflair.com/showthread.php?t=62935)

draco963 July 27th, 2019 01:29 AM

How can I change the Melee bonus using math from the Attribute modifiers?
 
Ok, another one. I've got an item that needs to be able to substitute the normal Str bonus to melee attacks with the Dex bonus instead. Here's the script I've written for the item to (not :rolleyes:) do this:

Code:

~ "Precision Assault" Use Dex instead of Str for attacks

~ If we're not enabled, get out now.
doneif (field[gIsEquip].value = 0)

var HD as number
HD = hero.tagcount[Hero.HitDice] + 2
var Rit as number
Rit = field[Value].value
var vDex as number
vDex = hero.child[aDEX].field[aModBonus].value
var vStr as number
vStr = hero.child[aSTR].field[aModBonus].value
var Diff as number
Diff = vDex - vStr

~ Change our base attack bonus.
    if (HD >= 5) then
        if (Rit >= 1) then
            hero.child[Attack].field[tAtkMelee].value += Diff
        endif
    endif

Now, as written, it doesn't work. However, if I change the final math line to a hard value, say, +4 or +18 or whatever I please, it works.

Best I can think of, my script is firing in the wrong place. right now, I've tried both Pre-levels 10000 and Post-levels 10000. Both places work for a hard-coded amount, but not a variable amount.

Any suggestions what I've done wrong?
Thanks!

Sendric July 29th, 2019 06:50 AM

Quote:

Originally Posted by draco963 (Post 280524)
Any suggestions what I've done wrong?
Thanks!

Yes. You need to run any scripts working with ability score modifiers during Post-Attributes. Otherwise you get nothing but 0's. :D


All times are GMT -8. The time now is 09:28 AM.

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