I'm trying to set up an automatic adjustment condition related to the Haste spell and hitting a snag when trying to set the new speed.
The way the spell is written, if the target's speed is <30, then the new speed is 2x the old speed.
If the target's speed is 30 or higher, the new speed is 30 + the old speed.
I am trying to use the following script to take care of this:
doneif (state.isoutput <> 0)
doneif (field[pIsOn].value = 0)
hero.child[Attack].field[ModCirc].value = hero.child[Attack].field[ModCirc].value + 1
#applybonus[tACDodge, hero.child[ArmorClass], 1]
#applybonus[vMisc, hero.child[vRef], 1]
if (hero.child[Speed].field[tSpeed].value > 29) then
hero.child[Speed].field[BonEnhance].value = maximum(hero.child[Speed].field[BonEnhance].value, 30)
endif
if (hero.child[Speed].field[tSpeed].value < 30) then
hero.child[Speed].field[BonEnhance].value = maximum(hero.child[Speed].field[BonEnhance].value, hero.child[Speed].field[tSpeedMod].value)
endif
However, no matter what the base speed of the hero is, it always adds 30.
I have been using the floating debug screens to make sure that I am referencing the right fields but no matter how I write this, is is still only applying the +30 conditional and not the 2x conditional. I can understand if my calculations in the <30 scenario are written wrong and thus the hero would receive no bonus, but it ALWAYS reads the >29 conditional as true...which is wrong.
Any ideas on what is going on here?
Thanks!
The way the spell is written, if the target's speed is <30, then the new speed is 2x the old speed.
If the target's speed is 30 or higher, the new speed is 30 + the old speed.
I am trying to use the following script to take care of this:
doneif (state.isoutput <> 0)
doneif (field[pIsOn].value = 0)
hero.child[Attack].field[ModCirc].value = hero.child[Attack].field[ModCirc].value + 1
#applybonus[tACDodge, hero.child[ArmorClass], 1]
#applybonus[vMisc, hero.child[vRef], 1]
if (hero.child[Speed].field[tSpeed].value > 29) then
hero.child[Speed].field[BonEnhance].value = maximum(hero.child[Speed].field[BonEnhance].value, 30)
endif
if (hero.child[Speed].field[tSpeed].value < 30) then
hero.child[Speed].field[BonEnhance].value = maximum(hero.child[Speed].field[BonEnhance].value, hero.child[Speed].field[tSpeedMod].value)
endif
However, no matter what the base speed of the hero is, it always adds 30.
I have been using the floating debug screens to make sure that I am referencing the right fields but no matter how I write this, is is still only applying the +30 conditional and not the 2x conditional. I can understand if my calculations in the <30 scenario are written wrong and thus the hero would receive no bonus, but it ALWAYS reads the >29 conditional as true...which is wrong.
Any ideas on what is going on here?
Thanks!