View Single Post
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old July 14th, 2009, 12:27 PM
Actually, I was talking about going into the spells/day adjustment, figuring out how that works, and using it to create the code for your ring.

Code:
 
<eval phase="Final" priority="10000"><![CDATA[
~ If we're not enabled, get out now
if (field[pIsOn].value = 0) then
done
endif
~ If nothing chosen, get out now
if (field[pChosen].ischosen = 0) then
done
endif
~ Add extra spell levels appropriately
var spelllevel as number
spelllevel = field[pSpellLvl].value
field[pChosen].chosen.field[cMemMax].arrayvalue[spelllevel] += field[pAdjust].value
field[pChosen].chosen.field[cCastMax].arrayvalue[spelllevel] += field[pAdjust].value
]]></eval>
field[pChosen].chosen references the class that is chosen on the adjustment, so, since we know this only works for wizards, we can replace that with:

Code:
hero.childfound[cHelpWiz]
field[pAdjust].value is the amount to increase the values by. In this case, we're multiplying by 2 instead of adding a value.

arrayvalue[spelllevel] references the level of spells we want to modify. Since we know we're modifying 5th level spells, that can be changed to arrayvalue[5].

We'll start with the if/then statement from the ring of wizardry 4 that makes sure the ring only works while it's equiped:

Code:
 
if (field[gIsEquip].value <> 0) then
 
endif
next, change context to the class we're modifying:

Code:
 
if (field[gIsEquip].value <> 0) then
hero.childfound[cHelpWiz]
endif
and to the array we're modifying, along with the correct spell level:

Code:
 
if (field[gIsEquip].value <> 0) then
hero.childfound[cHelpWiz].field[cMemMax].arrayvalue[5]
endif
and then multiply that value by 2:

Code:
 
if (field[gIsEquip].value <> 0) then
hero.childfound[cHelpWiz].field[cMemMax].arrayvalue[5] *= 2
endif
The adjustment's timing is Final, 10000. I recommend any time in the Final Phase (Users) for this script, so that the ring happens before the adjustment does (in case something else is affecting the number of spells per day, we should probably muliply before adding/subtracting).
Mathias is offline   #5 Reply With Quote