Pausing scene object animation until required

  • #1, by andiliddellWednesday, 12. February 2014, 00:27 7 years ago
    I've specified a static png image for a new scene object, and when my character interacts with it I want it to start playing its specified animation.

    The problem i have is i can trigger the playing of the objects animation just fine but the image still remains.

    Is there not a way to specify JUST an animation for an object and have it constantly paused on frame 1? so i can tell it to start playing when i want?

    Many thanks smile

    Forum Fan

    178 Posts


  • #2, by afrlmeWednesday, 12. February 2014, 01:23 7 years ago
    yep smile

    you can use the VAnimationFirstFrame & VAnimationLastFrame to specify which frames you want it to play between.

    so if I set both to 1 then it would loop first frame only. here's how to force the animation frames to play between 2 values:
    getObject("ActiveAnimations[animation name]"):setValue(VAnimationFirstFrame, 1)
    getObject("ActiveAnimations[animation name]"):setValue(VAnimationLastFrame, 1)
    1
    2
    3

    you only need to do the VAnimationLastFrame one really unless you are wanting to shift the first frame to another number.

    an alternative simple solution which doesn't require any code from you, (or me wink) would be to simply add 2 animations to the same object; one containing a single image with a very large pause value 9999 with loop infinite on & another containing the actual animation. you would set the static animation as the default animation in the object properties tab & then on mouse over you would use the play/hide animation action part to hide (stop) the static animation & then again to play (start) the actual animation. If you plan on reverting back to the default animation on mouse out then just do same again but in reverse.

    Imperator

    6842 Posts

  • #3, by andiliddellWednesday, 12. February 2014, 20:34 7 years ago
    Thanks AFRLme, as usual an excellent reply and two great ways of solving this issue.

    Cheers! smile

    Forum Fan

    178 Posts

  • #4, by GregThursday, 29. January 2015, 00:38 6 years ago
    This post and reply was very helpful to me so big thanks to both of you.

    I would like to further expand on it if that's ok.

    How would you go about changing the default animation of an scene object by script? I have a NPC that I made using a scene object and some animations (it's not a regular character, just a scene object) and I set the default animation to a Idle type animation. Whenever I'm changing animations using actions, they always revert to the default idle one, even if the ones I'm changing to are on a infinite loop.

    So what I would like to do is be able to have them become the default animation via Lua script so that I can blend between them in that way.

    Thanks ahead of time.

    Newbie

    23 Posts

  • #5, by afrlmeThursday, 29. January 2015, 01:26 6 years ago
    Ok I'm not sure how relevant this thread is now. I believe that static object sprite now disappears when you play an animation created inside of the same object. Just saying... razz

    If an animation is on an infinite loop then it should stay keep playing until done. I'm assuming that you mean it reverts back to initially linked animation on scene load?

    Hmm according to the data structure the default animation can't be scripted (well it can, but it doesn't store the data in the save game files). My solution to this would be to leave the objects animation as empty & use some kind of condition / value based query to determine which animation should be played. Values get saved to save game files so you could use Lua to write the string name of the animation to value & then use that to determine which animation to play. Or you could use an index value number type query to determine which to play or even conditions. There's lots of methods & solutions to this.

    Sorry about rambling on...

    Imperator

    6842 Posts

  • #6, by GregThursday, 29. January 2015, 04:03 6 years ago
    Sorry about rambling on...


    Dude, you are a life savor and I think I can speak on behalf of everyone here that we actually want you to ramble some more!

    If an animation is on an infinite loop then it should stay keep playing until done. I'm assuming that you mean it reverts back to initially linked animation on scene load?


    Yes I have an animation on a object that is set to infinite loop and it only loops once when inside of a action scripted sequence.

    pretty much what I have been attempting to do in detail is to have a NPC look up at the player then hold that pose while they are in dialogue. When they are done with the dialogue the NPC would exit current animation loop and return to idle.

    It sorta looks (or should look like this)

    1. Hide NPC Default Idle Animation (Infinite Loop)
    2. Play NPC Looks up at player animation
    3. Play NPC Keep looking at Player Idle (Infinite Loop) (This is the problem child one that only loops once when in the action sequence) I've tried setting this one to both -Wait till animation finishes On and Off but still no dice.
    4. While that animation is set to loop the dialogue options will appear and player choices...etc... Once concluded
    5. Play NPC Looks up at player animation (In reverse)
    6. Show NPC Default Idle Animation (Infinite Loop)


    Everything works great except I can't get a animation to loop in the middle of that sequence of actions.


    Newbie

    23 Posts

Write post