Author Topic: How to make NPC disappear?  (Read 281 times)

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
How to make NPC disappear?
« on: October 22, 2011, 05:20:16 am »


               Hiya sweeties,

I have an npc that lures players to an area via waypoints. Once it reaches the last wp, how can I make it disappear?

Thank you '<img'>
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How to make NPC disappear?
« Reply #1 on: October 22, 2011, 05:55:56 am »


               How do you want it to disappear. Do you want the creature to be destroyed or do you want it to appear somewhere else, or do you want it simply hidden from view but remain in place?

Most of the answers will likely involve the cutscene invisibility visual effect as well as other things.
               
               

               
            

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
How to make NPC disappear?
« Reply #2 on: October 22, 2011, 10:39:31 am »


               Hiya sweetie,

I want the creature to be destroyed when it reaches the last wp.
               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
How to make NPC disappear?
« Reply #3 on: October 22, 2011, 01:13:49 pm »


               In the code wich makes your NPC move from one waypoint to another, once your NPC reaches the last waypoint, simply call DestroyObject(<your npc object>). So, if the code is executed from one of the NPC event handlers, it would be: DestroyObject(OBJECT_SELF). If the NPC is controlled by another object, simply replace OBJECT_SELF by the variable referencing your NPC in code.

Kato
               
               

               


                     Modifié par Kato_Yang, 22 octobre 2011 - 12:14 .
                     
                  


            

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
How to make NPC disappear?
« Reply #4 on: October 22, 2011, 11:10:59 pm »


               Umm...ok, so I would put this destroy script in the nw c2 default 9 in the onspawn slot? I believe that's the script that makes npc's walk waypoints, right?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
How to make NPC disappear?
« Reply #5 on: October 22, 2011, 11:30:42 pm »


               Don't go making modifications to the stock NWN scripts unless you're prepared to create complications with every NPC that walks waypoints being destroyed at the end of their waypoint cycle.

Draw a trigger around the last waypoint this particular NPC walks.

void main()
{

object oEntering = GetEnteringObject();

if (GetTag(oEntering) == "TAG_OF_NPC")
 {
   DestroyObject(oEntering);
 }
}


FP!
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
How to make NPC disappear?
« Reply #6 on: October 22, 2011, 11:59:50 pm »


               

Fester Pot wrote...

Don't go making modifications to the stock NWN scripts unless you're prepared to create complications with every NPC that walks waypoints being destroyed at the end of their waypoint cycle.

Draw a trigger around the last waypoint this particular NPC walks.

void main()
{

object oEntering = GetEnteringObject();

if (GetTag(oEntering) == "TAG_OF_NPC")
{
DestroyObject(oEntering);
}
}


FP!


FP's suggestion is one I've long used to make carraiges and wagons dissappear at a transtion or even make an NPC the appears to enter a door or drop down a sewer.
               
               

               
            

Legacy_archer4217

  • Full Member
  • ***
  • Posts: 206
  • Karma: +0/-0
How to make NPC disappear?
« Reply #7 on: October 23, 2011, 02:05:38 am »


               Awesome FP, thank you so much. That's just what I needed. And thank you to everyone else who replied. *hugs*