What is the script for making two or more people move to a spot and dissapear? For K1.
What you can do to achieve this is use this script twice:
void main () {
// goodbye.nss
// This script will make any NPC
// move to a desired location and vanish.
object oNPC=GetObjectByTag("NPC_TAG"); // 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));
}
Complete the script with the correct X, Y and X coordinates and replace "NPC_TAG" with the tag of the NPC you want to vanish, then compile this script and place the name of the compiled script (without the .NCS extension) in the "OnEndDialog" field in the NPC's .UTC file. Make sure this NPC is the one that owns the dialog in his conversation box in his .UTC file.
Now for the second NPC create a duplicate of the above script but replace "NPC_TAG" with the tag of the second NPC, compile then place the name of the second compiled script (without the .NCS extension) on the last line of the dialog. Now when the dialog ends both NPC's will run (or walk) to their programed destination and vanish.
There may be an easier way to do this, but that is the way i do it, and find it fairly easy to do.
What you can do to achieve this is use this script twice:
It's probably easier to combine it into one script that can be used for an arbitrary number of NPCs as needed: :)
void ST_GoAway(float x, float y, int bRunAway=FALSE);
void main () {
// ST: Set NPC#_TAG to the Tag of the creatures to leave and the x and y
// coordinates they should move to before they vanish.
AssignCommand(GetObjectByTag("NPC1_TAG"), ST_GoAway(93.77, 141.06));
AssignCommand(GetObjectByTag("NPC2_TAG"), ST_GoAway(93.77, 141.06));
}
void ST_GoAway(float x, float y, int bRunAway=FALSE) {
location lExit=Location(Vector(x, y, 0.0), 0.0);
SetCommandable(TRUE);
ClearAllActions();
ActionForceMoveToLocation(lExit, bRunAway);
ActionDoCommand(DestroyObject(OBJECT_SELF));
SetCommandable(FALSE);
}
(This should probably be used in areas where there aren't many obstacles between where the character is and the exit point is though, since, IIRC, ActionMoveToLocation() doesn't pathfind as well as ActionMoveToObject() does.)
Ok, so i didn't know about that script, hehe, well now using that script all you would need to do is leave the .UTC file alone and just place the name of the above compiled script into the last line of the dialog.
And thanks stoffe now i have a new script to play with, instead of using the OnEndDialog field. :)
I didn't know you could embed your own custom function in the second parameter of a AssignCommand call. :D That's seriously cool because then you can use the OBJECT_SELF object as shorthand.
Very good stoffe!
I didn't know you could embed your own custom function in the second parameter of a AssignCommand call. :D That's seriously cool because then you can use the OBJECT_SELF object as shorthand.
Very good stoffe!
Yeah, it's handy, you can also place them in the DelayCommand second parameter. An example:
/*
CreateObject() is not an action so cannot be used
with DelayCommand(). In order that the cutscene might
continue as planned we need to turn it into
an action.
*/
void STU_CreateEvilSmoke() {
object oSion = GetObjectByTag("nih_darthsion");
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_smokedfrc01", GetLocation(oSion), TRUE);
}
And later on:
... DelayCommand(1.8, STU_CreateEvilSmoke());...
That sort of thing is insanely useful when dealing with cut scenes :).
Mmm... interesting guys, gonna get rid of some nasty NPC's I added over there ... thanks! :)
Well this is a really nooby question but i cant make a guy dissepear beacuze i dont know the cordinates. How can i find out he's cordinates? I have tried whereami but it just show my player location.
Walk your player to where you want the NPC to go to, then do a whereami and write down the coordinates.