View Single Post
draco963
Member
 
Join Date: Jul 2015
Location: Ottawa
Posts: 58

Old July 27th, 2019, 01:29 AM
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 ) 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!
draco963 is offline   #1 Reply With Quote