how to set character animation

  • #1, by mulewaThursday, 27. January, 23:47 5 months ago
    Hello,
    in the 3 pictures you can see a scene with a mouse that should walk to a NutellaGlas and change to the stand-outfit.
    I am really a noop in programming and something with the script looks not ok.
    can you please help me
    Script:   getObject("Game.Maus"):CharacterAnimState(4)

    Newbie

    20 Posts


  • #2, by esmeraldaFriday, 28. January, 08:49 5 months ago
    I'm not sure why you are using a script to play that animation. There is an action part "play animation" to call character animations.

    Not sure your code is correct. You are accessing the object, but not playing the animation. But I only know some of the basics in Lua, so I'm not the person to help here.^^ (But I am quite sure that the character Maus is no part of the game field. So it would be getObject("Characters[Maus]"). But it would still not play the animation, I think. There is a startAnimation() method which you could use.)

    Simplest approach would be the "play animation" action part - if your animation is set to infinite it will only change back to your idle after stopping the animation (action part) or when the animation is interrupted (by calling another animation like walking or talking). When not set to infinite it will only play according to your settings in the animation properties. The default is 1 loop for 20 ms, so you would need to change that to the desired length.

    Equally simple would be what you described in your text. Change the outfit.
    Create a second outfit for the character whith the animation you want as idle animation and use the action part "change outfit".
    When changing the outfit the standing is the idle animation and will not change back to the crouching idle until you change the outfit again.

    Great Poster

    454 Posts

  • #3, by mulewaFriday, 28. January, 13:13 5 months ago
    Thank you so much Esmeralda,
    I was not aware that the play animation can be used on characters.
    Because i saw direct under the chategory Characters the action: change-characters-animation-index and I was thinking all character related actions regarding animation should be found direct under Characters.
    So i was thinking to complex for easy thinks.
    However, i tryed it out and the part with the standing mouse on the NutellaGlas is so cute!!!
    Thx Thx Thx

    Newbie

    20 Posts

Write post