lfnetwork.com mark read register faq members calendar

Thread: Make an NPC exit (move to a location and vanish)
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 11-01-2004, 01:26 AM   #1
Veldrin
Rookie
 
Join Date: Jun 2004
Posts: 64
Help with script2

How can I make an NPC move to a location and vanish gracefully?

Original thread

Last edited by tk102; 01-23-2005 at 11:14 AM.
Veldrin is offline   you may: quote & reply,
Old 11-05-2004, 11:06 AM   #2
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,767
Current Game: FTL
Forum Veteran Helpful! Notable contributor 
Code:
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.



Last edited by Darth InSidious; 08-02-2009 at 03:28 PM. Reason: Removed size tags.
tk102 is offline   you may: quote & reply,
Old 11-05-2004, 11:24 AM   #3
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,767
Current Game: FTL
Forum Veteran Helpful! Notable contributor 
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.



Last edited by tk102; 11-05-2004 at 11:32 PM.
tk102 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Tutorials: Scripting > Make an NPC exit (move to a location and vanish)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:30 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.