Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
chef
Junior Member
 
Join Date: Dec 2009
Posts: 5

Old December 21st, 2009, 12:15 AM
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
chef is offline   #1 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 21st, 2009, 08:02 AM
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
The first test, for being enabled, is specific to adjustments - specifically to the on/off checkbox they have. The second test is to make sure that a class has been chosen.

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
transitions the context of the script to whichever class was chosen.

Since you know you want to transition to the cleric class, you can instead use:
Code:
 
hero.childfound[cHelpClr]
Putting those together,
Code:
 
hero.childfound[cHelpClr].field[cMemMax].arrayvalue[1]
Is the Cleric's maximum memorized 1st level spells, and:
Code:
 
hero.childfound[cHelpClr].field[cCastMax].arrayvalue[1]
is the Cleric's maximum cast 1st level spells.

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
You said that you've already figured out how to make sure the item is equipped, but for the use of anyone else reading this post:
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
Next is the timing: the adjustment uses Final/10000 as its timing - stick with that.
Mathias is offline   #2 Reply With Quote
chef
Junior Member
 
Join Date: Dec 2009
Posts: 5

Old December 22nd, 2009, 11:03 PM
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.
chef is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,213

Old December 23rd, 2009, 07:54 AM
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).
Mathias is offline   #4 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:45 PM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.