Aller au contenu

Photo

How Do You Stop A Looping Animation? (Wake up from sleep.)


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi All,

I find working with animations very confusing and difficult. Help is appreciated.

I have a simple animation command that gives the appearance of a sleeping NPC by using:-

PlayCustomAnimation(oTarget,  "proneb", 1, 1.0);

Then, when this NPC is spoken to I apply the following in its On Coversation script:-

PlayCustomAnimation(OBJECT_SELF, "standupb", 0, 3.0);

With this, the NPC stands up OK, but then immediately lays down again.

My only guess is that the later animation is not cancelling/stopping the "looping" animation.

How do I stop the looping (sleep) animation?

Many thanks in advance.

Lance.

Modifié par Lance Botelle, 04 juin 2011 - 10:10 .


#2
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I too have had difficulty with PlayCustomAnimation(). It does not seem to behave as predictably as PlayAnimation() or ActionPlayAnimation(). Have you tried calling ClearAllActions() as part of the second script?

In some ambient animations, I have some custom animations that play as part of a scripted waypoint system. They seem to shut off fine. Maybe you could try calling some other command very briefly and see if that stops the animation.

Let me know how it goes. I am very interested in learning as much about the custom animations as possible since there are some very useful ones.

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi Matt,

I have tried various things, including ClearAllAction function, applying a 0 looping same effect just prior to another effect, etc. There is one possible solution I have yet to try, which is forcing the PC and NPC to collide, which appears to disrupt the loop and prevent them from laying down again. I am also trying the effectsleep to see what results that gives.

I will let you know.

HOWEVER, if there is a simple way to stop a looping animation, I would like to know. :)

Lance.

EDIT: I went with applying the EffectSleep instead and added a variable to ensure I was only waking NPCs I wanted. I applied the effect as a 6 second effect in their HB until no longer required. (I guess really cannot get on with the animation commands.)

Modifié par Lance Botelle, 04 juin 2011 - 11:07 .


#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
If a collision stops it then you can just scrit the on bump event to happen in the script and that should take care of it. If that works, let me know.

oh... I just saw that you worked around it. Well, maybe next time I need some custom animations, I will mess with the on bump idea.

#5
Orion7486

Orion7486
  • Members
  • 161 messages
If you still want to use the proneb, then use the custom animation of "idle". This is the default animation of a character.
Edit: Meaning, use the animation of idle to get him out of the proneb animation.  Since 'idle' is the default animation, the character won't fall back to a previous animation.

Modifié par Orion7486, 05 juin 2011 - 09:48 .


#6
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
I use the PlayCustomAnimation function to just call a different animation. Not perfect, but it works well enough. If that fails--and it has--I have them move forward like 0.0001 ft. Use the GetAheadLocation function or something to that extent.

Modifié par Chaos Wielder, 05 juin 2011 - 07:44 .


#7
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Lance use a percent sign to set the looping animations to defaults.

So you'd apply the sleeping animation as a loop, play the standing up and then apply the removal.
CSLPlayCustomAnimation_Void(oPC, "%")


// or as follows to stop the meditation
void CSLEmoteDoPuke(object oPC)
{
   if (CSLDontEmoteSpam(oPC, 3.0)) return;
   AssignCommand(oPC, ClearAllActions(TRUE));
   //DelayCommand(0.2, AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE )));
   DelayCommand(0.2, AssignCommand(oPC,  CSLPlayCustomAnimations(oPC, "meditate", FALSE, 1.0f, 0.35f ) ));
   DelayCommand(0.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile("fx_blood_green1_L.sef"), oPC));
   DelayCommand(0.4, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectNWN2SpecialEffectFile("fx_blood_green1.sef"), oPC));
   DelayCommand(0.3, AssignCommand(oPC, SpeakString(CSLPickOne("Blaaarg!", "Raaaalphfff", "Bhhuaaarrggg"), TALKVOLUME_TALK)));
   DelayCommand(0.0, AssignCommand(oPC, PlaySound(CSLSexString(oPC, CSLPickOne("as_pl_spittingm2", "as_pl_coughm6"), CSLPickOne("as_pl_coughf5", "as_pl_coughf6")))));
   DelayCommand(0.5, AssignCommand(oPC,  CSLPlayCustomAnimation_Void(oPC, "%") ));
}


#8
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi CW,

I did try to play a different animation, which failed. Moving forward, as you say, is probably a workaround (like bumping them), I guess.

Hi Orion,

Ah! I did not know that idle was the default one. That makes sense.

Hi Pain,

Great! If that works, then I guess that line is excatly what I was after. At least I now have a function I can use for future animations. EDIT: I did this: PlayCustomAnimation(OBJECT_SELF, "%", 0);  which did work. Thanks!

EDIT 2: I am curious as to why we need only delay this call for 0.5 seconds rather than the 3.0 for the animation to take place? It seems you *HAVE* to use the 0.5 to ensure the animation works correctly, but one would have thought you could not apply the % to cancel the animation until the animation had completed. This does not appear to be the case. Therefore, is 0.5 the delay we must use in EVERY instance when cancelling an animation?

Thanks you everyone, I do feel better armed with ideas for potential future animation ideas now, which is very much appreciated. I am even tempted to redo the sleep animation, just to test out these suggestions and familiarise myself with the code.

Many thanks all.

Lance.

Modifié par Lance Botelle, 06 juin 2011 - 10:33 .