Junior Member
Join Date: Jun 2013
Posts: 10
|
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 |
#1 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
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.
|
#2 |
Junior Member
Join Date: Jun 2013
Posts: 10
|
Hi Aaron
Thanks for your answer, could you please describe the syntax a little bit or guide me to a documentation? Thanks, Vyzzini |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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? |
#4 |
Senior Member
Join Date: Oct 2011
Posts: 6,793
|
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 Last edited by Aaron; December 10th, 2014 at 10:55 AM. |
#5 |
Junior Member
Join Date: Jun 2013
Posts: 10
|
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 |
#6 |
Junior Member
Join Date: Jun 2013
Posts: 10
|
This seems to work:
var numfound as number numfound=hero.child[cHelpMag].field[cMemCur].arrayvalue[0] Thanks a lot for your help! |
#7 |
|
|