nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
130 stars 92 forks source link

Function request, GetKnowsSpell #146

Closed wobbinhood closed 6 years ago

wobbinhood commented 6 years ago

Specific to arcane casters, from the old nwnx_func: int GetKnowsSpell(int nSpellId, object oCreature, int nClass=CLASS_TYPE_INVALID);

Thank you in advance, as well as for any guidance if I'm missing something that exists already that covers this functionality.

mtijanic commented 6 years ago

This would just be iterating through all known spells until that one is found or end is reached. No reason to do that in the C++ side, can be done in nwscript with:


// Get the spell at index in level in creature's spellbook from class.
int NWNX_Creature_GetKnownSpell(object creature, int class, int level, int index);

int NWNX_Creature_GetKnownSpellCount(object creature, int class, int level);```
wobbinhood commented 6 years ago

Ah, thanks a lot. I will try that. Closing the issue I suppose.