Play anticipation before walking and stop walking too

  • #1, by TinTinMonday, 11. January 2016, 17:22 9 years ago
    Hi
    I made a smooth walk cycle for my game. But I strongly want an anticipation before walk cycle for best result .Also for stop character I want play a little animation before the stop.

    Please let me more clear:
    Anticipation :For example I have 3 frame for anticipation and 20 frame for walk cycle .In the first play 3 frame and after that play only 20 frame cycle.
    Stop : When character stop in the location, first play 3 frame for reaction and stop it.

    I want both for 8 direction
    Is it possible in VS or Lua script ? Although I'm not good programmer in Lua.
    I'm appreciate for any help.

    Forum Fan

    196 Posts


  • #2, by afrlmeMonday, 11. January 2016, 17:42 9 years ago
    Yes technically it would be possible for the initial walk animation you could have the first 3 frames added at the beginning of each animation. In the first frame you could add an if query. if condition / value = something then force it to play between frame 4 & 20 (whatever). In the fourth frame you would tell it to loop between frame 4 & 20. The initial part I mentioned with the condition or value query would be so that it could skip the first 3 frames if the character was already walking to begin with.

    The ending animation is more complicated & depends on how smooth you want the animation to be & what you have in mind. An actual smooth ending would be to get the current frame index value & then play the animation in reverse from said frame. You would also need to listen out for when character state changes back to idle & whether or not the condition value mentioned above has been reset back to its default value.

    Imperator

    7285 Posts

  • #3, by TinTinMonday, 11. January 2016, 17:55 9 years ago
    Thanks for fast reply.
    Sorry I'm beginner in VS . Where I can write 'if condition' for first frame?

    Forum Fan

    196 Posts

  • #4, by afrlmeMonday, 11. January 2016, 18:10 9 years ago
    Yeah... er sorry. grin

    You need to create a condition. Create one in the conditions tab of your playable character. Name it something like: "is_walking" & set it to "false" as the default state.

    Moving on... I was talking about actually adding actions to specific animation frames. If you select an animation frame you can click the edit frame button which will open up a new window. Inside of the window will be a section to do with actions. You can click the "lightning" icon to open up a new window which will allow you to create action parts to be triggered when this particular frame is shown while playing the game.

    Inside of this action block you would create some actions... something along the lines of...

    if condition "is_walking" is true
    execute a script... (see code block below)

    ActiveAnimations["name_of_walk_animation"].AnimationFirstFrame = 4
    

    end if

    You would add the same line of code inside of an execute a script action to the 4th animation frame to force it to loop from that frame instead of going back to the beginning of the animation when it reaches the end of the animation.

    "name_of_walk_animation" needs to be replaced with whatever the relevant walk animation is called. Names are case sensitive. It's also a good idea to give animations unique names. For example, let's say you have 2 characters performing the same animations at exactly the same time & both animations have the exact same name, then you would end up with duplicate animations of the same name in the active animations table & the engine may not know which one you are trying to access.

    Hope this helps a little bit, though probably not. It helps if you try to get a basic understanding of the engine first before diving into the deep end, especially in regards to custom features & the Lua side of things & even more so if you have no prior experience with programming / scripting in general. Obviously I don't know whether you know how to program or not, but you should get the general gist of what I have just said.

    Imperator

    7285 Posts

  • #5, by TinTinMonday, 11. January 2016, 18:45 9 years ago
    Great .It Done smile
    Thanks a lot 'AFRLme' . It's really great structure as access to per frame.

    I try for stop walking animation now.I'm not sure but I think it will do with character Idle only.

    Forum Fan

    196 Posts

  • #6, by afrlmeMonday, 11. January 2016, 19:38 9 years ago
    You can actually force character movement per frame, so it would actually possible to have the first 3 frames or whatever play with character in a static position. wink

    P.S: adding actions to animation frames is useful for other things as well, such as:

    • editing conditions / values
    • executing actions / playing new animations as needed (more precise then trying to use the pause action part method).
    • playing sounds / triggering display texts (as & when needed).
    • etc. etc.

    Imperator

    7285 Posts

  • #7, by MachtnixThursday, 14. January 2016, 17:14 9 years ago
    Hey, that sounds very good. I wanted to start every walk loop with a blowing braid / plait. But I have 8 different walk animations (because of the light from the left side I won't mirror them), so I need this in every walk loop, right?

    Machtnix

    Thread Captain

    1097 Posts

  • #8, by sebastianThursday, 14. January 2016, 18:35 9 years ago
    It would be great if this could be added as a demo/template section of the site. Seems to be some interesting addition

    Thread Captain

    2346 Posts

  • #9, by afrlmeThursday, 14. January 2016, 19:15 9 years ago
    @ Sebastian: Precise movement control has been a feature since 4.0 beta. The other things I mentioned have been available since... well, ages.

    @ Machtnix: Yes you would need to sort it out for each individual walk animation.

    Imperator

    7285 Posts

  • #10, by GlenfxMonday, 09. May 2016, 11:25 9 years ago
    I have a question about this.

    How and when do I tell if the character is already walking or not?, having the condition set to false and nowhere to tell it to change to true won't make the script posted above work, so, when do we tell the condition "is_walking" to change from false to true and from true to false?.

    Could this also work with the idle so the first frames are of the character stopping?.

    (Take in consideration I have no knowledge of code/script/lua.)

    Newbie

    72 Posts

  • #11, by sebastianMonday, 09. May 2016, 12:02 9 years ago
    I would set the condition to true in the first walking animation frame and false in the first standing animation frame

    Thread Captain

    2346 Posts