Author Sticky: Post Working Scripts Here
Llynerion Posted: Saturday, 29 June 03:44AM
Script Name: df_gob_hb_anim

Function: Provide idle PC animation

Notes: Primarily useful for stationary mobiles, this script should replace the default OnHearbeat script. You also need to add the following lines to the default OnSpawn script(make sure it is inside the curly braces) and DO A SAVE AS TO CHANGE THE FILE NAME!!! Otherwise, you will replace the default bioware script...and that is _not_ good!

NWScript:
SetLocalInt(OBJECT_SELF, "ThisAction");

SetLocalInt(OBJECT_SELF, "LastAction");



You want to SetLocalInt so the script will not for some statistically insane reason repeat the same animation...this is crucial as I've only included 3 animations! Ok, now for the script.

NWScript:
// New OnHeartbeat() for Gob Chieftain

void main()

{

   while (GetLocalInt(OBJECT_SELF, "LastAction") ==

          GetLocalInt(OBJECT_SELF, "ThisAction") ) {

      SetLocalInt(OBJECT_SELF, "ThisAction", d3() );

      }

   SetLocalInt(OBJECT_SELF, "LastAction",

               GetLocalInt(OBJECT_SELF, "ThisAction") );



    switch (GetLocalInt(OBJECT_SELF, "ThisAction") ) {

       case 1: ActionPlayAnimation(

               ANIMATION_FIREFORGET_HEAD_TURN_LEFT);

               break;

       case 2: ActionPlayAnimation(

               ANIMATION_FIREFORGET_HEAD_TURN_RIGHT);

               break;

       case 3: ActionPlayAnimation(

               ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);

               break;

     }

}
Author Sticky: Post Working Scripts Here
Llynerion Posted: Saturday, 29 June 03:20PM
Quote: Posted 06/29/02 03:44:34 (GMT) by Llynerion

Script Name: df_gob_hb_anim

Function: Provide idle PC animation

Notes: Primarily useful for stationary mobiles, this script should replace the default OnHearbeat script. You also need to add the following lines to the default OnSpawn script(make sure it is inside the curly braces) and DO A SAVE AS TO CHANGE THE FILE NAME!!! Otherwise, you will replace the default bioware script...and that is _not_ good!

NWScript:
SetLocalInt(OBJECT_SELF, "ThisAction");

SetLocalInt(OBJECT_SELF, "LastAction");



You want to SetLocalInt so the script will not for some statistically insane reason repeat the same animation...this is crucial as I've only included 3 animations! Ok, now for the script.

NWScript:
// New OnHeartbeat() for Gob Chieftain

void main()

{

   while (GetLocalInt(OBJECT_SELF, "LastAction") ==

          GetLocalInt(OBJECT_SELF, "ThisAction") ) {

      SetLocalInt(OBJECT_SELF, "ThisAction", d3() );

      }

   SetLocalInt(OBJECT_SELF, "LastAction",

               GetLocalInt(OBJECT_SELF, "ThisAction") );



    switch (GetLocalInt(OBJECT_SELF, "ThisAction") ) {

       case 1: ActionPlayAnimation(

               ANIMATION_FIREFORGET_HEAD_TURN_LEFT);

               break;

       case 2: ActionPlayAnimation(

               ANIMATION_FIREFORGET_HEAD_TURN_RIGHT);

               break;

       case 3: ActionPlayAnimation(

               ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);

               break;

     }

}


Ok, sorry to repost this, but it occured to me that this script would make your fighting/talking/etc mobs scratch their heads and such. If that is a concern for you, add the following lines before the "while" statement.

NWScript:
if(IsInConversation(OBJECT_SELF) ||

      GetIsInCombat(OBJECT_SELF) ) {

      return;

   }



This wasn't a concern for my mob, but it does make it more universal. Please note that Bioware had included an option in the default OnSpawn script that plays animations, but I like a little control over what those are.