View previous topic :: View next topic |
Author |
Message |
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Sat Nov 01, 2014 1:25 Post subject: Dabbling in Magic |
|
|
I just recently retook up nwn scripting after a period of living outside my home. So I started dabbling with nwnx_magic(A Terra creation).
The documentation is a little tricky to understand.
The two functions in particular I'm interested in are:
//Adds a memorized spell to oCreature
//This will create additional spellslots if neasesary
//Use with caution
//Formatting: "classindex spelllevel spellid ready metamagic domain"
//Class index should be 0, 1 or 2
int NWNX_Magic_AddMemorizedSpell( object oCreature, string sData );
and
//Sets a memorized spell to oCreature
//This will create additional spellslots if neasesary
//Use with caution
//Formatting: "classindex spelllevel spellslots spellid ready metamagic domain"
//Class index should be 0, 1 or 2
//If spellid, ready, metamagic, domain is 0 the spellslot will be removed (unmemorized)
int NWNX_Magic_SetMemorizedSpell( object oCreature, string sData );
The goal here is to allow players to regenerate a use of their spell when using an item. So for instance, how would I go about regenerating a use of SPELL_FIREBALL for a player who has recently just cast it?
I keep trying things, but they don't work, or worse they basically screw up my character by giving it more spell slots then it should have.
The two important things is what does "spellslots" mean? and does setting ready to 1 for setmemorizedspell reactivate a normally unready spell or does it simply add a readied one? |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Sat Nov 01, 2014 13:58 Post subject: |
|
|
The spellbook is stored as an array of elements, "creating more spellslots" refers to creating more spellslots which means you can create spellslots that the character normally don't have.
If you call: NWNX_Magic_AddMemorizedSpell( oPC, "0 9 400 1 0 0" );
Assuming PC's first class is a wizard, it'll add spell 400 (should probably check so its a valid spell the PC can use) to spell-level 9, set as ready to cast with no metamagic and it isnt a cleric domain. It'll be set in the first available spellslot, if oPC has none ready it'll simply expand and create a new. So if oPC has 8 spellslots normally and they're all taken then he'd have 9 after this.
If you use set you change an existing spellslot, so if you want to regenerate a fireball you'll have to use the other functions to get the contents to find which slot contains a fireball and send a string where spellready is 1.
NWNX_Magic_SetMemorizedSpell( oPC, "0 3 " + IntToString( X ) + " " + IntToString( SPELL_FIREBALL ) + " 1 0 0" ); where X is a spellslot index that contains a fireball already, it'd be set to available to cast. There are get functions for these aswell, I believe. _________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
highv priest
Joined: 01 Mar 2013 Posts: 111
|
Posted: Wed Nov 05, 2014 5:27 Post subject: |
|
|
Ah thank you! Quite possibly the most boring thing about playing a spellcaster is needing to rest when you finally use up all your spells(or use your trusty +0 magic staff of awesome to beat the "knowledge" into your enemies).
Great expansion to the game. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|