You are here

OnSpawn - Just Die Damn It! :-)

6 posts / 0 new
Last post
Tawmis
Tawmis's picture
OnSpawn - Just Die Damn It! :-)

I have created several NPC characters in an area; and OnSpawn I'd like them to just fall over and die. :-)

This way when characters come through, they're going to see a lot of dead NPCs in the area. Any ideas on how to write that script? I have the check mark for leaving lootable bodies, so that their bodies don't simply vanish upon Spawning.

 

  • up
    50%
  • down
    50%
Tawmis
Tawmis's picture

Wait - couldn't I just use the nw_c2_default7 script, which is the OnDeath script?

Going to try that now...

  • up
    50%
  • down
    50%
Tawmis
Tawmis's picture

Yeah - using the nw_c2_default7 script didn't work. :-)

 

  • up
    50%
  • down
    50%
Tarot Redhand

Have a look at the scripts in this module of mine. I placed a number of dead creatures (ie die on spawn) in it but can't for the life of me remember how I did it (sorry blush). Feel free to use anything you find useful.

TR

  • up
    100%
  • down
    0%
Tarot Redhand

Try calling this function (part of unearthed-gold) from within the creatures OnSpawn event, using OBJECT_SELF as the parameter.

void KillLeaveCorpse(object oCreature)
{
    if (GetIsObjectValid (oCreature))
    {
         AssignCommand(oCreature, SetIsDestroyable(FALSE, FALSE));
         AssignCommand(oCreature, ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectDeath(), oCreature));
    }
}
 
TR
  • up
    100%
  • down
    0%
Tawmis
Tawmis's picture

Thank you, Tarot! I actually dug around online - searching for "lootable corpse neverwinter nights" rather than "kill NPC on spawn Neverwinter Nights" and found this site:
http://nwn.wikia.com/wiki/Make_a_corpse_out_of_a_creature


Which, combining those main two into one script that I called "dieonspawn" and putting it on the OnSpawn did exactly what I need. So if anyone else ever needs it, it looks like this:

void main()
{
ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectDeath(), OBJECT_SELF ) ;
SetIsDestroyable( FALSE ) ;
}

  • up
    50%
  • down
    50%