Author Topic: Making more than one NPC say goodbye at the same time  (Read 327 times)

Legacy_LostChangeling

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Making more than one NPC say goodbye at the same time
« on: April 02, 2015, 07:21:17 am »


               

Often, when I want an NPC to say a final goodbye to my PC and then leave, I'll just add the following very simple script to the 'Action Taken' part of the last node of a conversation tree between the NPC and my PC:


 


ActionDoCommand(DestroyObject(OBJECT_SELF));


 


Basically all it does is cause the NPC to say goodbye, and then to fade away.


 


But now let's say I want more than one -- specifically, two -- NPCs to leave in this way. At the same time. How do I do it? I'd very much prefer not to have to talk to one first, have him/her say goodbye, and then talk to the second one and say goodbye to him/her. (The reason is that I'm trying to simulate a mother -- the NPC to whom the PC will be talking -- leaving with her child.) Presumably I'll need to add a couple lines to the script above, where I reference the second NPC (yes, it's the child) by her tag and then apply DestroyObject on her as well. Only trouble is, I don't know how. My knowledge of the language of the script is meager.


 


It is therefore with humility that I ask again for your help. You have all shown amazing patience with my lack of knowledge of NWScript, and for this I thank you yet again.  ':kissing:'



               
               

               
            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
Making more than one NPC say goodbye at the same time
« Reply #1 on: April 02, 2015, 03:44:56 pm »


               

Try this for the child:


 


DestroyObject(GetObjectByTag("child"));


 


Change "child" to the tag for the second NPC you want to destroy.  You also want to make sure that your child NPC has a unique tag -- meaning a tag not shared by anything else in your module. 



               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Making more than one NPC say goodbye at the same time
« Reply #2 on: April 02, 2015, 05:34:33 pm »


               

Just to be safe, I'd follow what 3RavensMore said, only use Get Nearest, just on the off chance the same tag is used by something else somewhere in the module.


 


DestroyObject(GetNearestObjectByTag("child"));


               
               

               
            

Legacy_LostChangeling

  • Newbie
  • *
  • Posts: 49
  • Karma: +0/-0
Making more than one NPC say goodbye at the same time
« Reply #3 on: April 03, 2015, 05:24:46 pm »


               

I experimented with the ideas you fellas suggested. In the end I tried the following and it worked fine:


 


DestroyObject(GetObjectByTag("Angela"));

DestroyObject(GetObjectByTag("Violet"));

 

(Angela is the tag for the child and Violet the mother.)

 

Thanks so much for your help again, fellas. Wouldn't have figured this out without your help!  '<img'>