Jump to content

Getting to grips with overriding animations


Loki Eliot
 Share

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

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

Recommended Posts

Ok today i plan to get stuck in and finally work out how to overide animations, or simply activate animations. Down the road i plan to make some characters for my island that i can use to run RP's. For this i need to learn and understand how to script so that animations kick in for various tasks, basically built in AO's for the Mesh Avatars. 

My limited scripting experience so far resulted in making a torch that could be held up in a custom holding pose and also weapons that you can swing to attack monsters. But i really dont understand fully how it all works yet so this is what im setting out to do here. Any help or advice would be welcomed.

Im going to start with what im hopeing will be a simple AO task.

The Goal : To create a Slingshot that (1.) when worn animates Avatar to stand in a bouncing ready pose. (2.) when fired in mouse look animates a pulling and release animation. (3.) allows default run & walk.

Now i've discovered this was pretty easy to do simply in the way you upload with priorities, but for a while now the priorities have changed in the official LL viewer (which i wrote a Jira about here) making it now impossible without script intervention Unless there is some way to script a debug change.


Link to comment
Share on other sites

So first thing i needed to do was create Two animations, one for when you stand with the Sling Shot, the second for when you release the slingshot. 

original_500d45bd403b1e189e000001.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When it comes to uploading Animation it's 'Priority' number is important to how it is effected. It's a rather confusing subject but i think im beginning to understand it all. Animations override lower numbered priority animations, so for my two animations i made the 'stance' animation priority 3. This will overide default standing animations as they are set to 1 or 2. My 'Release' animation is set to 4 and will overide the 'Stance' animation. 

So i know need to script the Slingshot to animate the 'Stance' when wearing, and animate 'release' when fireing which should be easy.  But i then have to script it to stop animating 'stance' if you run or walk. This is wear it gets really complicated since the UseNewWalkRun priority change

Link to comment
Share on other sites

(Just making sure: these RP "Mesh Avatars" will be regular, logged-in sessions, right, not simply Mesh objects that look like avatars? There's no way currently to use normal avatar animations to deform unattached Mesh objects. I'm guessing that's obvious, but "just making sure.")

I don't exactly understand how the cited problem with default animations applies in this case. You'll be overriding animations anyway, so... why not just use a different walk and stand animation, with the desired priorities? ... and if any default animations interfere, just stop them?

Link to comment
Share on other sites

The details of the animation priorities are something that might be better addressed on the animation creation forum, maybe. The complexity here is that, in fact, animations may have joint-specific priorities, too. But in general, if we're dealing exclusively with uploaded .bvh files, yeah, the priority applies only to those joints that are moved in the animation, and a higher number priority overrides lower priority animations as well as already-playing animations of the same priority.

Link to comment
Share on other sites

OK so i have animations and objects and i have a script that is dealing with all the permissions, and shooting the shot. the bit im trying to work out is the area in the script that will deal with when the avatar is standing still or running or walking.

In this instance i need the script to 'play the STANCE' animation, then when someone clicks the keys to go forward back left or right to turn off 'STANCE' animation and turn on the 'RUN' pose which only animates the top half of the avatar to hold the sling shot while walking or running.

This is the bit i've not had to do before.

Link to comment
Share on other sites

@Rolig

Thanks for that, it's funny as i was just looking at a similar scrypt, but yours made more sense. Unfortunitly with this implemented it's sort of working but it takes up to 10 seconds for the animations to change and i cant figure out why, but im closer to my goal so thanks for that :)

Link to comment
Share on other sites

I've now realised that messing about with my Avatars default animations can cause quite the screw up. My avatar now appears to be stuck in  my stance animation even with the overriding object off, even after selecting 'stop animating me' even after a relogging. I guess i screwed something up with permissions making the Slingshot stance a perminant stand :-s

Link to comment
Share on other sites

The animations should change instantaneously, and if you are firing your timer event rapidly --- I hate to do that, but there's not much choice here --- you should get very quick response when you stand or start walking.  Clearly there's something else going on in your script.

Instead of just stopping that one animation, you might want to do a fail safe move and stop any animation that might be running.  This sort of function ought to do it unless you have an AO running that is restarting some anims continuously.

 

StopAnims(key UUID)  // Pass the function your av's UUID{    list Anims = llGetAnimationList(UUID);    integer i = (Anims !=[]);  // Same as llGetListLength(Anims)    while(i)    {        --i;        llStopAnimation(llList2String(Anims,i) );    }}

 

 

 

  • Like 1
Link to comment
Share on other sites

FinderScreenSnapz001.jpg

So with help from some people i ended up using this evolved version of what Rolig shared. 

    timer()    {        if (have_permissions == FALSE) return;        llSetTimerEvent(0.1);        armed = TRUE;        if (llGetAgentInfo(llGetOwner()) & AGENT_WALKING)        {            if (walking == FALSE) {                llStartAnimation( "sling_run");                llStopAnimation( "sling_stance");                walking = TRUE;            }        }        else        {            walking = FALSE;            llStartAnimation( "sling_stance");            llStopAnimation( "sling_run");

The biggest issue i had was understanding permissions and i'll need to get to grips with THAT if im going to be using LL's new experience tools which hinge on getting user permissions.

Whether with this i can expand to include overriding other default animations i'll find out later when i start on some RP Mesh Avatars but it's a good jump off point. Thanks everyone who send me IM's of advice and ideas :)

HERE IS A VIDEO OF THE SLINGSHOT IN ACTION on twitvid.


Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4334 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...