Member
Join Date: Feb 2010
Location: Charlotte, NC
Posts: 81
|
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! |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Phase and priority?
For your >29 scenario, you can reduce the typing with this: Code:
#applybonus[BonEnhance, hero.child[Speed], 30] Code:
if ( >= 30) then ~>= 30 scenario else ~< 30 scenario endif Code:
hero.child[Attack].field[Bonus].value += 1 hero.child[ArmorClass].field[tACDodge].value += 1 hero.child[vRef].field[Bonus].value += 1 Last edited by Mathias; October 29th, 2010 at 01:49 PM. Reason: said the wrong thing |
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
I thought of a better way to handle the speed - you want to add in your speed again, but not add more than 30:
Phase: Final, Priority: 9900 Code:
var bonusspeed as number bonusspeed = minimum(hero.child[Speed].field[tSpeed].value, 30) #applybonus[BonEnhance, hero.child[Speed], bonusspeed] Code:
~start by calculating the swim speed #value[xSwim] = maximum(#value[xSwim], hero.childfound[xSwim].tagmax[Value.?]) ~then add 30 (or the current value) #value[xSwim] += maximum(30, #value[xSwim]) |
#3 |
Senior Member
Join Date: Feb 2007
Location: Nottinghamshire, United Kingdom
Posts: 1,265
|
Quote:
From the D20 srd http://www.d20srd.org/srd/theBasics.htm#dodgeBonus Quote:
Last edited by bodrin; October 29th, 2010 at 01:01 PM. Reason: Wrong source used! |
||
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Oops, I said "don't" rather than "do" - the rest of my explanation is correct for stacking bonuses - simple addition, rather than the #applybonus[] macro.
|
#5 |
|
|