Jump to content

Overriding walking animation.


Meow Spore
 Share

You are about to reply to a thread that has been inactive for 3386 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello, I'm trying to find a script that lets an animation placed in an object continue to play when walking.

Right now I have different types of weapons with a script and a priority 4 animation in them that lets the priority 4 animation override the stand animations in my AOs. Since the priority 4 animation in the item just animates part of the body, the rest of the body follows the stand animations in the AO as I want.

My problem is that whenever I walk, the walk animation in the AO completely runs over the priority 4 animations in the item.

Is there any way I can get the same type of result when walking as when standing still? To let the the priority 4 animation in my worn item to keep control of the limbs it animates, and have the rest of the body follow the walk animation.

PS, I have absolutely no idea how to script. So I've been unable to properly search for a solution.

Link to comment
Share on other sites

Your problem is that animations with the same priority are handled with a LAST Started = Highest priority algorithm.  If your walk animation is a priority 4 and includes motions for your upper body parts,  those motions are overriding your object animations. 

The simplest (scripting) fix is to reverse the order the animations are started.  If you restart your object animation AFTER you start the walk, your upper body animation will override the same level walk.   Most AO scripts are open source so someone should be able to modify it to communicate to your object when it has started the walk animation.  Use the notication to restart your object animation.   A brute force option would be to have your object check to see if your animation state  CHANGED to walking and force restart your animation when it does.

A "non-scripting" alternative is to reload the walk animation as a lower priority. 

A second "non-scripting" option is to make a new priority 4 walk animation that does NOT move any of the body joints involved in your object animation.  You can then play both in any order and they they should not interfere with each other.

 

Link to comment
Share on other sites

The brute force one does sound more simple in the sense that I'd just need one script.

But any idea what such a script would be called so I know what to search for?

Ps,  really don't understand anything how the script works when looking inside them. So I might need pretty dumbed down instructions.

Link to comment
Share on other sites

Here is an example of a script that might work for you.

It is a brute force method to force a non-looped animation (like the example animation.. aim_r_handgun) to play when you are walking, running or crouch-walking.  Instructions for modifying are in the comments.. 

Test it by creating a prim, adding this script, take the prim into inventory, and attach it to one of your hands. 
Touch the prim to make it turn green and then see what happens when you walk or run.  Touch it again to turn it off.

Modify it by dropping it on the ground, adding your animation to the contents of the prim and change this line to match the name of the animation you added..

 

string  ForceAnimation = "YourAnimationNameHERE(in quotes)";           //Change this to your animation name

Save the script, take the object back into inventory and wear it again.   

 

Usual Creative Commons license restrictions and disclaimers apply, feel free to use and change to suit your needs.

 

//  Simple Animation Override for WALKING animations//  Once attached   touch to toggle ON/OFF//  Dz  2013//=========================================================================// ---LICENSE START---// http://creativecommons.org/licenses/by-sa/3.0/// ie: Attribution licence://   Give me credit by leaving it in the script I created. //  Set the value of ForceAnimation to the name of an animation you want to play when the avatar walks//  Your animation needs to be of equal or higher priority than the walk for this to work.//  Place this script and the animation in an object that will be attached , wear the object//  Grant permissions and touch the object to toggle the override on and off.//  There is an old bug report that the llGetAgentInfo  may not report correctly immediately after a sim border crossingkey owner = NULL_KEY ;                            string  ForceAnimation = "aim_r_handgun";           //Change this to your animation nameinteger PermsList = 0;default                     // this is where the script starts... and waits until the object is touched to start running{    state_entry()    {        owner = llGetOwner();                       //  Find out who I'm attached to                llSetColor(<1.0, 0.0, 0.0>, ALL_SIDES );     //change this to prevent your object from turning red when it is off                PermsList = llGetPermissions();                              //  If we dont have permissions to start animations,  ASK        if (!(PermsList & PERMISSION_TRIGGER_ANIMATION))        {            llRequestPermissions(owner, PERMISSION_TRIGGER_ANIMATION);  //Trigger the  pop-up        }    }            run_time_permissions(integer p)                                 //Even though attached objects dont have to ask, we play nice    {        if(p & PERMISSION_TRIGGER_ANIMATION)        {            llOwnerSay( "Override Functional,  touch to turn on/off");          // Notify owner script is ready for activation            PermsList = p;                                                      // Save new permissions list        }    }    touch_end(integer total_number)              // NEVER change state in touch_start    {        if (PermsList & PERMISSION_TRIGGER_ANIMATION)            state Running;                                                      // Once we have permission, start the RUNNING part of the script    }        attach(key id)                                                              // Reset the script every time the object is worn    {        if (id)                                       //  is a valid key and not NULL_KEY            llResetScript();    }    }state Running                                     // This part of the script handles events when the override is active{    state_entry()    {        llSetTimerEvent(0.5);           // This is how often (in seconds) the script will check to see if you are walking                                        // The higher the number, the less impact the script has on the sim.                                          //  The lower the number, the faster the animation will start.   Adjust to your situation.                                                         llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES );    //change this to prevent your object from turning green when it is active    }        timer()    {        if(llGetAgentInfo(owner) & AGENT_WALKING)   //AGENT_WALKING covers walking, running, and crouch walking modes            llStartAnimation(ForceAnimation);       //  When TRUE   Start the animation        else            llStopAnimation(ForceAnimation);        // When NOT walking  stop the animation    }        touch_end(integer total_number)                 // After a touch, toggel to waiting,  again  NEVER change state in touch_start.    {        llStopAnimation(ForceAnimation);            // Stop the animation and return to the default (waiting) state        llSetTimerEvent(0);                         //  turn off the timer..we dont need to check any more        state default;                 }    }

 

I hope that sheds some light on the "insides" of animation scripts.

Link to comment
Share on other sites

Haha, thank you. You'd think with those instructions I should been able to get it right, but no. The walking part works fine. But the problem is that I want the animation constantly, standing, sitting, walking, running.

And this script seems to cancel out my other one that worked for standing and sitting. 

So how can I get it to work in the way to always run the animation?

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...

I'm looking for the same thing. I used to upload priority 6 animations, but this seems no longer possible. So, how can I make a priority 4 animation inside an attached prim override the priority 4 walking and turning animations of most AOs? If anybody out there has the answer, please help!

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3386 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...