Author Topic: High Level NPC Caster Fix!  (Read 9235 times)

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
High Level NPC Caster Fix!
« on: February 04, 2009, 01:48:39 PM »
I've been working on a set of quests that scale to the level of the PC. However, I ran into a problem with the "boss" NPC which is a wizard. At lower levels he works just fine but once he gets up into the higher levels he stops attacking.

The reason for this is the Invisibility spell. Apparently the default AI won't attack if it has the Indivisibility effect on it because that would make the Invisibility wear off. Unfortunately this means that you can pound on him all day and he will never attack, especially at level 40 where Invisibility lasts for 40 minutes.

The fix for this is to simply put this bit of code in the NPC's heartbeat.
Code: [Select]
void main()
{
effect eEffect = GetFirstEffect(OBJECT_SELF);
while(GetIsEffectValid(eEffect))
    {
    if(GetEffectType(eEffect) == 56)
        {
        RemoveEffect(OBJECT_SELF, eEffect);
        }
    eEffect=GetNextEffect(OBJECT_SELF);
    }
}
After banging my head on this for a week and I can finally get back to finishing up the quests.

-420

Offline Mo

  • Administrator
  • Hero Member
  • *****
  • Posts: 3051
    • MSN Messenger - cochy@msn.com
    • View Profile
    • http://lucidmagic.net
    • Email
Re: High Level NPC Caster Fix!
« Reply #1 on: February 04, 2009, 02:38:53 PM »
haha I'll just have to spam cast invisibility on him.  That should screw him up but good.

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Re: High Level NPC Caster Fix!
« Reply #2 on: February 04, 2009, 05:31:48 PM »
haha I'll just have to spam cast invisibility on him.  That should screw him up but good.
It's a legitimate strategy. In fact, that may work on any enemy in NWN. Sort of like casting an Otiluke's Resilient Sphere, only you can still injure the target.

I could use the spellhook script to make sure you can only cast invisibility on non-hostile targets but I don't think it will be a problem.

-420

Offline Soul Sojourner

  • Resident Awesome
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2748
  • Nothing is true; everything is permitted.
    • View Profile
    • Email
Re: High Level NPC Caster Fix!
« Reply #3 on: February 04, 2009, 08:13:27 PM »
The only people who are likely to know are the people here anyway...

Although, we are also most likely to be the ones to actually play it...

lol.

We should all get together in Smith Hold sometime... that might be a challenge. =P

Offline 420

  • Hero Member
  • *****
  • Posts: 4087
    • View Profile
    • Email
Re: High Level NPC Caster Fix!
« Reply #4 on: February 05, 2009, 01:56:09 AM »

We should all get together in Smith Hold sometime... that might be a challenge.
Once this new three part quest is ready I'll let everyone know and set aside a weekend for everyone to come and team up to take on the quest.

I can deal with any bugs and balance issues that way. We can all make brand new level 1 characters and test the quests at a bunch of different levels.

-420

Offline Soul Sojourner

  • Resident Awesome
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2748
  • Nothing is true; everything is permitted.
    • View Profile
    • Email
Re: High Level NPC Caster Fix!
« Reply #5 on: February 05, 2009, 03:02:28 AM »
As long as I get to kill things, I'm happy.