Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting/Animations

Page: 1 of 1
 Silveredge9
06-19-2006, 11:42 AM
#1
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.
 stoffe
06-19-2006, 1:32 PM
#2
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));
}
Page: 1 of 1