• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Number of prepared spells

Vyzzini

Member
Hi,

In the editor, is there a way to retrieve in a variable how many spells of a certain level a character has prepared?

Thanks,
Vyzzini
 
You could foreach through all spells of that level on the hero and add them up to find out. Careful though, you'll want to look at the final spell level FIELD, rather than the sLevel tag, because the tag doesn't include increases from applied MM and the like.
 
Hi Aaron
Thanks for your answer, could you please describe the syntax a little bit or guide me to a documentation?
Thanks,
Vyzzini
 
I think there's a better way to look up this information than searching for spells.

On the Develop menu, make sure you have "Enable Data File Debugging", and then add a level of a test class that can cast spells. Prepare a few spells for this class.

Then, on the Develop menu, go to "Floating Info Windows" at the bottom, and then choose "Show Selection Fields". Use the search option at the top to find the class you're testing with, and you'll see there are several options with that name - one of them will have the Id "cHelpXXX" where XXX is a three-letter abbreviation for that class, and the rest will have the Id "cXXXXXXXXXX", where the Xs are the first 9 letters of that class' name. Select the cHelp one for this class, and then click OK.

Now, that's a long list, but the information you're looking for is actually relatively close to the top. Scroll down through the list of field names until you find something that looks like that might be it. Then, you can click on the "click to view array" or "click to view matrix", and compare the numbers in there with the number of spells you've prepared for this class, to make sure you found the correct field.

Tell me what field you've found.

Also, I'll need more information about how you're using this. Are you working on a class special? Is it for a new class, or a new archetype? Or is this a feat? If it is a feat or something else that's not connected to a particular class, how is it choosing which class's spells to look up? Or do you want to know about all spells prepared for all of the character's spellcasting classes?
 
As usual, not tested, tweak as necessary.

Code:
~ Set up a variable to store the number of qualifying spells we find
var numfound as number

~foreach through all 2nd level spells on the hero which are not item spells or spell like abilities
foreach pick in hero from BaseSpell where "fieldval:sLevel = 2 & !Helper.ItemSpell & !Helper.SpellLike"
  numfound += 1
  nexteach

~ Then do whatever you need based on the number of spells found at that level
if (numfound >= 5) then
  DO WHATEVER
else
  DO WHATEVER ELSE
  endif

As Mathias says, some more information about why you want this information/what you intend to use it for could be helpful.
 
Last edited:
Hi,

I'm implementing a spell-point system from a third party editor (Spellpoint Compilation from Housrule handbook).
I have created a "Spell pool item" calculating the number of spell points per day depending on the class and level in order to monitor those spell points as a tracked ressource.
The last thing I need in order to have the correct value is to remove 1 point of that "pool" for each prepared level 0 spell, the character has.

I'll try what Aaron has suggested.

Thank you again for your help,
Vyzzini
 
This seems to work:

var numfound as number
numfound=hero.child[cHelpMag].field[cMemCur].arrayvalue[0]

Thanks a lot for your help!
 
Back
Top