Jump to content

Home

Help with script


Veldrin

Recommended Posts

Originally posted by tk102

[size=1]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));

}[/size]

This script has been tested on Carth in the "Hideout" when first arriving on Taris.

Hey and what if i want a group of npcs not just one to perform the same kind of action?

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply
Originally posted by Xavier2

Hey and what if i want a group of npcs not just one to perform the same kind of action?

add lines for each of them - example-

object oNPC=GetObjectByTag("Carth");    // insert NPC's tag here
object oNPC1=GetObjectByTag("Bastila");    // insert NPC's tag here
ActionDoCommand(SetCommandable(TRUE,oNPC));
ActionDoCommand(SetCommandable(TRUE,oNPC1));
etc...

you could also create more than one npc with the same tag if you want them to always react the same way.

Link to comment
Share on other sites

I thought it would be nice to let you know it is working and i have putted an addition that has an interesting effect:

 

[size=1]void main () {

 // goodbye.nss

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

 object oNPC1=GetObjectByTag("tat19_tdan01");    // insert NPC's tag here
 object oNPC2=GetObjectByTag("tat19_tdan02");
 object oNPC3=GetObjectByTag("tat19_tdan03");
 object oNPC4=GetObjectByTag("tat19_tdan04");
 object oNPC5=GetObjectByTag("tat19_tdan05");
 object oNPC6=GetObjectByTag("tat19_tdan06");
 object oNPC7=GetObjectByTag("tat19_tdan07");
 object oNPC8=GetObjectByTag("tat19_tdan08");
 object oNPC9=GetObjectByTag("tat19_tdan09");

 float x=107.77;                         // do a whereami cheat
 float y=140.16;                        // 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);

 AssignCommand(oNPC1,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC2,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC3,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC4,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC5,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC6,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC7,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC8,ActionPlayAnimation(0,1.0,1.0));
 AssignCommand(oNPC9,ActionPlayAnimation(0,1.0,1.0));

 ActionDoCommand(SetCommandable(TRUE,oNPC1));
 ActionDoCommand(SetCommandable(TRUE,oNPC2));
 ActionDoCommand(SetCommandable(TRUE,oNPC3));
 ActionDoCommand(SetCommandable(TRUE,oNPC4));
 ActionDoCommand(SetCommandable(TRUE,oNPC5));
 ActionDoCommand(SetCommandable(TRUE,oNPC6));
 ActionDoCommand(SetCommandable(TRUE,oNPC7));
 ActionDoCommand(SetCommandable(TRUE,oNPC8));
 ActionDoCommand(SetCommandable(TRUE,oNPC9));

 DelayCommand(0.1, AssignCommand (oNPC1,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(1.0, AssignCommand (oNPC2,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(2.0, AssignCommand (oNPC3,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(3.0, AssignCommand (oNPC4,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(4.0, AssignCommand (oNPC5,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(5.0, AssignCommand (oNPC6,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(6.0, AssignCommand (oNPC7,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(7.0, AssignCommand (oNPC8,ActionForceMoveToLocation(lExit,bRun)));
 DelayCommand(8.0, AssignCommand (oNPC9,ActionForceMoveToLocation(lExit,bRun)));

 DelayCommand(0.5, AssignCommand (oNPC1,ActionDoCommand(DestroyObject(oNPC1))));
 DelayCommand(1.5, AssignCommand (oNPC2,ActionDoCommand(DestroyObject(oNPC2))));
 DelayCommand(2.5, AssignCommand (oNPC3,ActionDoCommand(DestroyObject(oNPC3))));
 DelayCommand(3.5, AssignCommand (oNPC4,ActionDoCommand(DestroyObject(oNPC4))));
 DelayCommand(4.5, AssignCommand (oNPC5,ActionDoCommand(DestroyObject(oNPC5))));
 DelayCommand(5.5, AssignCommand (oNPC6,ActionDoCommand(DestroyObject(oNPC6))));
 DelayCommand(6.5, AssignCommand (oNPC7,ActionDoCommand(DestroyObject(oNPC7))));
 DelayCommand(7.5, AssignCommand (oNPC8,ActionDoCommand(DestroyObject(oNPC8))));
 DelayCommand(8.5, AssignCommand (oNPC9,ActionDoCommand(DestroyObject(oNPC9))));
}[/size] 

With this code the 9 npcs above run one after each other to the same spot and vanish.

 

Thanks again.:)

Link to comment
Share on other sites

Archived

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


×
×
  • Create New...