Jump to content

Home

exit problem


HdVaderII

Recommended Posts

Okay, i'm using the script "Make an NPC exit(move to a location and vanish)",in the scripting tutorials, but when i try to use it for my NPC he just dissapears, he doesn't walk away. Am I doing anything wrong in this script?

void main () {

 // reeloend.nss

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

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

 float x=93.85714;                         // do a whereami cheat
 float y=-10.57143;                        // to get x, y, and z
 float z=0.0;                        

 int bRun=TRUE;                         // 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));

}

Also another thing, can the NPC have anything in their path, or will it not work if they do?

Help is appreciated...

Link to comment
Share on other sites

  • 2 weeks later...

The path to the vExit vector must be clear enough for the NPC to walk or run to it, maybe that's why your character just stays in the position before vanishing ... change the vExit coordinates and try. I sometimes use a 2 steps script to move an NPC where I want :)

 

good luck ;)

Link to comment
Share on other sites

Okay, i'm using the script "Make an NPC exit(move to a location and vanish)",in the scripting tutorials, but when i try to use it for my NPC he just dissapears, he doesn't walk away. Am I doing anything wrong in this script?

void main () {

 // reeloend.nss

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

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

 float x=93.85714;                         // do a whereami cheat
 float y=-10.57143;                        // to get x, y, and z
 float z=0.0;                        

 int bRun=TRUE;                         // 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);
[color=Red]ClearAllActions();[/color]
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));

}

Also another thing, can the NPC have anything in their path, or will it not work if they do?

Help is appreciated...

 

I am using almost the same script to move an npc and vanish the only differance is the red line I added to yours.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...