Junior Member
Join Date: Dec 2009
Posts: 5
|
The other day my DM gave my cleric an item that gives a cleric an extra 1st, 2nd, 3rd, and 4th spell slot. I know the command to check if the item is equiped but I do not know how to increase the spells and was wondering how you would give extra spell slots.
Thanks |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Go to the adjust tab, and note the "Spells Cast Per Day" adjustment - that'll be our starting point in the editor. So, in the editor, go to the adjustments, and use "New (Copy)" to pull up "Spells Cast Per Day".
Here's its script: Code:
~ 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 field[pSpellLvl].value is also adjustment-specific - it's what the user sets when they choose the level of spells to change. this code: Code:
field[pChosen].chosen Since you know you want to transition to the cleric class, you can instead use: Code:
hero.childfound[cHelpClr] Code:
hero.childfound[cHelpClr].field[cMemMax].arrayvalue[1] Code:
hero.childfound[cHelpClr].field[cCastMax].arrayvalue[1] Since the Cleric is a memorized spellcaster (like the wizard, and unlike sorcerer or bard), all we need to worry about is the first line. If we were creating this item for a bard, we'd only need the second line. No problems will be created if you adjust both for any class (you'll note the adjustment changes both, so that it doesn't have to test what type of class it's adjusting). field[pAdjust].value is what the user has entered for how much to adjust the spells - you said you get +1 to each level. Putting all that together: Code:
hero.childfound[cHelpClr].field[cMemMax].arrayvalue[1] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[2] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[3] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[4] += 1 Code:
if (field[gIsEquip].value <> 0) then hero.childfound[cHelpClr].field[cMemMax].arrayvalue[1] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[2] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[3] += 1 hero.childfound[cHelpClr].field[cMemMax].arrayvalue[4] += 1 endif |
#2 |
Junior Member
Join Date: Dec 2009
Posts: 5
|
I did all of that and it increased the amount of spells my character was able to cast perfectly. The only problem that showed up was when I added the extra spell to my character's known spells all of the spells of that level became red in color. I was wondering if there was any way to get rid of the spells being red.
Thanks again. |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
Turns out there's a bug in the adjustment I started with - I should have tested things before starting. I apologize for not doing so.
Move the timing of your script to Post-Attributes/19000, and it'll be good. The bug only applies to the color of the spells - there are no validation warnings associated with it. I'll get this fixed in the next update by moving the test that turns the spells red to much later than the current PostAttr/20000 (at which point it won't matter whether the timing of yours is at Final/10000 or PostAttr/19000) (but since the update may not be available for a while, go ahead and fix yours now). |
#4 |
|
|