Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Make an NPC exit (move to a location and vanish)

Page: 1 of 1
 Veldrin
11-01-2004, 12:26 AM
#1
How can I make an NPC move to a location and vanish gracefully?

Original thread (http://www.lucasforums.com/showthread.php?s=&threadid=143254)
 tk102
11-05-2004, 10:06 AM
#2
void main () {

// goodbye.nss

// This script will make any NPC
// move to a desired location and vanish.

object oNPC=GetObjectByTag("Carth"); // insert NPC's tag here

float x=93.77; // do a whereami cheat
float y=141.06; // to get x, y, and z
float z=0.0;

int bRun=FALSE; // you can set this to TRUE
// if you want the NPC to run


vector vExit=Vector(x,y,z);
location lExit=Location(vExit,0.0f);
ActionDoCommand(SetCommandable(TRUE,oNPC));
AssignCommand (oNPC,ActionForceMoveToLocation(lExit,bRun));
AssignCommand (oNPC,ActionDoCommand(DestroyObject(oNPC)));

// you can omit this last command if you like --
// if the NPC is not able to move to the
// location, this command will prevent
// you from being able to speak with him
// again. But if they're going to leave anyway...

ActionDoCommand(SetCommandable(FALSE,oNPC));

}
This script has been tested on Carth in the "Hideout" when first arriving on Taris.
 tk102
11-05-2004, 10:24 AM
#3
The trick here is to bury the DestroyObject function into the AssignCommand and ActionDoCommand functions. That way the 'commands' are issued in order. Otherwise the NPC will disappear before they move.
Page: 1 of 1