Author Topic: RE: Need Help with Spellhook Event  (Read 328 times)

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« on: August 08, 2011, 06:43:10 pm »


               I need help with a simple spellhook event. Is there anyway to make this script so that it doesn't decrement the remaining spell uses if the caster doesn't have the component bag item I've designed?

#include "x2_inc_switches"
void main()
{
    if (!GetIsObjectValid(GetSpellCastItem()))
    {
        if (GetItemPossessedBy(OBJECT_SELF, "m1_it_pouch001") == OBJECT_INVALID)
        {
            SendMessageToPC(OBJECT_SELF, "You cannot cast spells. You have no basic components.");
            SetModuleOverrideSpellScriptFinished();
        }
    }
}
               
               

               
            

Legacy_Alex Warren

  • Sr. Member
  • ****
  • Posts: 326
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #1 on: August 08, 2011, 06:46:32 pm »


               It's not possible in vanilla NWN. You'll have to use NWNX to do that.

Edit: Some more info about this issue - By the time spellhook code is executed the spell use has already been decreased, and unfortunately there is no InrementRemainingSpellUses() function '<img'>
               
               

               


                     Modifié par Alex Warren, 08 août 2011 - 05:49 .
                     
                  


            

Legacy_Axe_Murderer

  • Full Member
  • ***
  • Posts: 199
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #2 on: August 08, 2011, 07:11:33 pm »


               Spells that can't fail make the game boring to play anyhow. I say if a caster tries to use a spell without knowing how, they deserve to lose it. Since they can get it back in less than two minutes by resting it isn't much of a consequence. I'd just give them a hint so they know something was missing or they did something wrong that caused it to fail. It gives them something to learn. It won't take long for them to figure it out and then the code you're looking for becomes code that would rarely if ever get executed anyway.
               
               

               


                     Modifié par Axe_Murderer, 08 août 2011 - 06:14 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #3 on: August 08, 2011, 07:32:41 pm »


               Good point axe. The entry area for newbies has a huge sign that says "READ ME" which tells them to buy a component pouch and a spellbook (wizards) or divine focus (priests and druids). The exit even pops a conversation that asks spellcasters if they bought the required items. In light of these safeguards, it might be too nice to give them back the spell use...
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #4 on: August 08, 2011, 08:27:44 pm »


               Its possible to do via linux nwnx_events there is something like PreCast hook. And I disagree with Axe, losing spell is very annoying and personally when I encounter this behavior (no effect, lost of the spell) especially in no-rest environments (almost each RP server has this) then thats just sucks.
               
               

               
            

Legacy_Axe_Murderer

  • Full Member
  • ***
  • Posts: 199
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #5 on: August 08, 2011, 09:52:28 pm »


               Well I like to let them rest up if they want, but yeah in an environment where you're prevented from resting and studying your book, it becomes more of a punishment...tho I would argue it is really the rest restriction punishment that makes it suck not the losing of the spell so much.

If you aren't gonna have any consequence for not bringing what you need, why even have components then? All you gotta do is have one and it doesn't matter if the server takes your spell or not. I like to leave that responsibility up to the character. It just seems more robotic to me playing where the server validates everything you do and you can't really make any tactical blunders or when you do it's no big deal. Newbies learn, then it doesn't matter. Vets tell them about it right off. Personal preference I suppose.
               
               

               
            

Legacy_Morbane

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #6 on: August 08, 2011, 10:08:07 pm »


               interesting subject

i think i am going to incorporate components for certain spells - i think it would add to depth. I have several new spells and it might be fun to have them require a component that gets used up when the spell is successfully cast.

a good reason to write some scripts - i like scripting '<img'>
               
               

               
            

Legacy_ShadowM

  • Hero Member
  • *****
  • Posts: 1373
  • Karma: +0/-0
RE: Need Help with Spellhook Event
« Reply #7 on: August 08, 2011, 10:27:30 pm »


               Well if you have like a newbie are ( wizard training area where they can rest unlimited and some spell components then they can practice some before heading out and learn what spell components are needed.) but outside that environment they mess up they mess up and lose the spell.