YesNoOk
avatar

AnimTime (Triggers) (Read 6696 times)

Started by JustNoPoint, September 08, 2015, 06:29:43 pm
Share this topic:
AnimTime (Triggers)
New #1  September 08, 2015, 06:29:43 pm
  • ******
    • www.justnopoint.com/
Gives the difference between the looptime of the current animation action and the player's animation-time. Useful for knowing when the end of the animation has been reached. (Animation-time is the time in game-ticks that the player has spent within the current animation action.) The name may be confusing. Try to think of it as "time from the end of the animation". During the animation, AnimTime will always return a non-positive number.

Format:
AnimTime
Arguments:
none
Return type:
int
Error conditions:
none
Example:

Code:
trigger1 = AnimTime = 0
  Triggers when the animation-time is equal to the animation
  action's looptime, ie. the end of the action has been
  reached.

I'm going to quote some users from the thread that inspired this board.
To count the time until the current animation ends.
Time counts how much time has passed while the char is in the current STATE, AnimTime counts how much time there is until the current animation ends, it is usefull because the character can change its Anim inside the one state multiple times and you may want to calculate the time based in one specific anim, and not the time in the state.
It is important to note that the value that AnimTime return is negative, so, for example, if the anim is going to end in 10 ticks, it will return -10, if the animation has ended, it will return 0.
To be fair, The MugenDocs can be pretty vague or hard to understand. I know that's not why he asked, but still.

If you have a Changestate from 0 to 5110 (stand to liedown) with a trigger = animtime = -4, then you will activate changestate 4 TICKS before your stand animation ends. If you have it set to animtime = 4, nothing will happen because the animation repeats. If you have an animation with a negative time then that means the animation is over and will be stuck forever unless you make it change states. With an animation like that, animtime = 4 will activate the changestate 4 ticks after the animation has started.
An animation with a negative time is essentially the same as looping an animation, however the looped animation still has a time and is still technically playing whereas the animation with the negative time has...no time and is equivalent to time freezing, but the gametime is still counting how long you've been frozen on that animation and is the only time where an animtime with a positive number will be read.
Animtime = 0 is equivalent to "when the animation is over".

See? Animtime is more intricate than you'd think.
Last Edit: September 18, 2015, 02:58:17 pm by Just No Point