Author Topic: Restoring/Incrementing NPC spell uses  (Read 308 times)

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« on: June 08, 2011, 02:25:43 am »


               I have some NPCs who need more spells when confronted with larger groups.  They do well up front, then run out of steam when their spells are gone.  Is there a way to refresh their spell uses during combat - like you can with IncrementRemainingFeatUses()?

...and another question while I'm at it.  Is their a cap on the number of spells you can give an NPC in the toolset?  I know that if I give them too many, some of the spells won't show up for them to use in-game.  Also, if I make the NPC go past 40 casting levels, it often bugs and then they'll have 1 or 2 castings of 1 or 2 spells out of their entire list.
               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #1 on: June 08, 2011, 04:12:03 am »


               This isn't exactly the answer to your question, but what I have been doing is counting the player party size and then creating extra scrolls of spells to equip the NPC casters for larger groups. Just make sure that the dropable flag is unset so that the party doesn't end up with unintened extra loot. (Not sure if it's needed for NPCs, but I also mark each item as identified as I spawn it.)
               
               

               


                     Modifié par MrZork, 08 juin 2011 - 03:13 .
                     
                  


            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #2 on: June 08, 2011, 12:42:39 pm »


               There are functions to refresh spell uses in nwnx_funcs... But I don't know if they work for NPCs. If you don't use nwnx you could ForceRest them and damage them to the HP they were before, but that would remove most effects from the NPC...

Other then that I can't think of a way.
               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #3 on: June 09, 2011, 06:26:05 am »


               I think adding bonus spell slots to the creature skin has improved the number of spells for one NPC.  When I control them as DM, they definitely have more spells available to them than before.  The part I haven't confirmed, is whether they actually cast these extra spells.  I was pretty sure I saw the NPC use several it hadn't previously, but more on that when I have more time.  

I wanted to avoid raising the INT score on a wizard to 80 or 90 to avoid ridiculous DCs, but I know that adds a few slots.

The scroll idea made me realize that there are some buffs I should either replace with scrolls or as special abilities to free up slots.

Maybe I can copy all the effects to something, then copy them back to a replacement version of the NPC when they reach a certain HP level - setting the HP of the replacement to the appropriate level of course.  Add in a vfx or two to distract the eye during the transition and it might turn out nicely.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #4 on: June 09, 2011, 06:05:10 pm »


               

Terrorble wrote...

I think adding bonus spell slots to the creature skin has improved the number of spells for one NPC.  When I control them as DM, they definitely have more spells available to them than before.  The part I haven't confirmed, is whether they actually cast these extra spells.  I was pretty sure I saw the NPC use several it hadn't previously, but more on that when I have more time.

Yes, they will cast them on their own.

I wanted to avoid raising the INT score on a wizard to 80 or 90 to avoid ridiculous DCs, but I know that adds a few slots.

Quite a few. Adding props to skins is the best option.

The scroll idea made me realize that there are some buffs I should either replace with scrolls or as special abilities to free up slots.

Or you can just apply the effects onspawn, if you like.

Maybe I can copy all the effects to something, then copy them back to a replacement version of the NPC when they reach a certain HP level - setting the HP of the replacement to the appropriate level of course.  Add in a vfx or two to distract the eye during the transition and it might turn out nicely.

What's the goal you're attempting to achieve here? If i'ts just scaling encounter difficulty, there's a ton of ways to do this. If you just want to ramp up healable hit points, and aren't using nwnx, something like adding a magical con bonus properety to the skin would do the trick.

Funky
               
               

               
            

Legacy_Terrorble

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #5 on: June 10, 2011, 06:21:39 am »


               I am in fact getting much closer to my desired NPC by adding many extra spell slots to the creature skin.  The NPC is able to continue casting spells significantly longer than before.  I thought, from a test I did a long time ago, that bonus spell slots didn't help NPCs, but apparently I was mistaken.

The issue was, my epic wizard NPC was running out of spells (particularly against groups of 3 or more players), and then resorting to melee.  He's still very tough and takes out his fair share of PCs with spells, but I want more.  I want him to be able to throw out 5 lightning bolts, 5 fireballs, 5 scintillating spheres, 5 mestil's acid breaths, 5 gusts of wind, and have room to re-cast 3rd level buff spells.
If I make a sorceror, they will cast more spells, but they tend to spam the same ones in whatever AI setup we use.  I prefer the control and variety I get from wizard NPC casters.

My ideal NPC spell caster might regenerate their spell uses a random number of rounds after they cast it.  This way, they cast a spell and cannot recast it for a while, forcing them to move onto other options.  When prior spells become available again at random intervals, they could use them again.  It prevents spamming, and the random regeneration of a spell use keeps the player guessing a bit at what will come next.  
Some of our players have our NPCs down to an art.  They swap out immunity items at certain points because they know exactly how many times an NPC can cast something, or at what point they generally do.  They use summons to draw spellfire until they can reduce NPC casters down to weak spells and melee.  I guess in the end, I want their lives to be harder '<img'>
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Restoring/Incrementing NPC spell uses
« Reply #6 on: June 10, 2011, 09:47:21 am »


               

Terrorble wrote...

If I make a sorceror, they will cast more spells, but they tend to spam the same ones in whatever AI setup we use.  I prefer the control and variety I get from wizard NPC casters.

We use wizards exclusively for arcane casters for this exact reason, even the ones that are 'sorcerers'.


Some of our players have our NPCs down to an art.  They swap out immunity items at certain points because they know exactly how many times an NPC can cast something, or at what point they generally do.  They use summons to draw spellfire until they can reduce NPC casters down to weak spells and melee.  I guess in the end, I want their lives to be harder '<img'>

We like modifying certain spells for certain NPCs based on an ID int set on them. Take, for example, this Silver Dragonkin Sorcerer's modificatino to the cone of cold spell, increasing damage, adding a second damage type, and inflicting cold vulnerability:


        case SPELL_CONE_OF_COLD:
        case SPELL_SHADES_CONE_OF_COLD:
            if (nID == 203) {
                /* Dire Winter Wolf */
                si.clevel = 90;
                si.dc     = 49;
                si.sp     = 70;
            }

            eVis      = EffectVisualEffect(VFX_IMP_FROST_L);
            nDamType  = DAMAGE_TYPE_COLD;
            nDamDice  = (si.clevel * 3) / 4;

            if (nID == 269) {
                /* Silver Dragonkin Sorcerer */
                nDamDice *= 3;
                nDamVuln  = 50;
                nDamType2 = DAMAGE_TYPE_POSITIVE;
                nDamDice2 = -2;
            } else if (nID == 538 || nID == 720) {
                /* Ice Weird, Water Weird */
                nDamDice *= 2;
                nDamVuln  = 50;
            }
            break;


Funky