• 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

How can I change the Melee bonus using math from the Attribute modifiers?

draco963

Well-known member
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!
 
Back
Top