What sort of script would I use to make an NPC run a certain animation?
So far I have:
void main () {
object oNPC=GetObjectByTag("mechanic"); // insert NPC's tag here
float x=48.39; // do a whereami cheat
float y=29.66; // to get x, y, and z
float z=-1.27;
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));
}
Basically I need the NPC to play the UseComputerLoop animation when he reaches the destination set by the MoveToLocation command.
Also how can I determine which way the NPC faces when he has reached his destination? Say for example 270 degrees.
What sort of script would I use to make an NPC run a certain animation?
Also how can I determine which way the NPC faces when he has reached his destination? Say for example 270 degrees.
You can use the ActionPlayAnimation() function to make the NPC play an animation. Since it's an Action function, it gets added to the action queue and should not trigger until they are done with their Move action.
To make the NPC face 270 degrees when arriving, you can add a Setfacing() call to the action queue. I don't remember if the Move functions use the facing set in the location they move to.
Something like this might work:
void main() {
object oNPC = GetObjectByTag("mechanic");
location lExit = Location([48.39, 29.66, 0.0], 270.0f);
AssignCommand(oNPC, SetCommandable(TRUE));
AssignCommand(oNPC, ActionForceMoveToLocation(lExit, FALSE));
AssignCommand(oNPC, ActionDoCommand(SetFacing(270.0)));
AssignCommand(oNPC, ActionPlayAnimation( ANIMATION_LOOPING_USE_COMPUTER, 1.0, -1.0));
}