Hey all, I just have a few quick questions about NPC's as I am populating a module of mine.
What I really want to know is: how do I have an NPC constantly doing an action? i.e how do I have an NPC who continuously is doing the "working on a computer" animation or talking animation? Is this something I need to put in the characters .utc like a script, or is it something I can do via the module files? I'm at a loss as to how this is done.
Thanks a lot!
If I want a NPC do to a continuous action when doing a module, I usually put a script into the NPC's OnSpawn script parameter.
Or you can do a script and have the NPC do it when a trigger is tripped, or when a door is opened...etc.
For instance, in my Korriban mod I put the following script on a door's OnOpen script parameter
void main() {
AssignCommand(GetObjectByTag("n_proselyte01", 0), ActionPlayAnimation(10024, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_proselyte02", 0), ActionPlayAnimation(10024, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_proselyte03", 0), ActionPlayAnimation(10024, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_proselyte06", 0), ActionPlayAnimation(ANIMATION_LOOPING_SIT_CHAIR, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_proselyte08", 0), ActionPlayAnimation(ANIMATION_LOOPING_SIT_CHAIR, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_yogasith", 0), ActionPlayAnimation(10024, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_sithcleric01", 0), ActionPlayAnimation(10027, 1.0, -1.0));
AssignCommand(GetObjectByTag("n_sithcleric02", 0), ActionPlayAnimation(10026, 1.0, -1.0));
}
Where all those different NPC's are doing a looping animation - sitting, meditating,etc. The -1 in the ActionPlayAnimation command is the value to create a looping continuous animation.
Don't know if it's the best way, but it works.
^^^ A very good way to do it, not sure there is a better one :)
The -1 does not create a looping continuous animation, the -1 simply means that there is no specific duration for the looping animation: it will continue until the script in question or another script tells it to stop. Minor detail, but according to the parameters that is a duration slot. Learned that from the whole Sith Stalker deal...
Just semantics really, sorry newbiemodder for feeling the need to be so specific... Your advice and help, as always, is excellent!
This could help very much.