YesNoOk
avatar

AnimElemNo (Triggers) (Read 18414 times)

Started by JustNoPoint, September 09, 2015, 05:55:04 pm
Share this topic:
AnimElemNo (Triggers)
#1  September 09, 2015, 05:55:04 pm
  • ******
    • www.justnopoint.com/
Returns the number of the animation element in the current action that would be displayed at the specified time. The argument to AnimElemNo represents the time to check, expressed in game ticks, relative to the present.

Format:
AnimElemNo(exprn)
Arguments:
exprn
Expression that evaluates to the time offset (int).
Return type:
int
Error conditions:
Returns bottom if you try to check a time that would fall before the start of the current action.
Notes:
If the action is currently within its looping portion, then it is assumed to have been looping forever. That is, no matter how far into the past you check, AnimElemNo will always return an element number that lies within the looping portion of the action.
Examples:

Code:
trigger1 = AnimElemNo(0) = 2
  True when the animation element to be displayed 0 ticks in the
  future (i.e., now) is element 2. This is equivalent to:
    trigger1 = AnimElem = 2, >= 0
    trigger1 = AnimElem = 3, < 0

trigger1 = AnimElemNo(2) = 4
  True when the animation element that will be displayed two ticks
  from now is element 4. This is equivalent to:
    trigger1 = AnimElem = 4, >= -2
    trigger1 = AnimElem = 5, < -2
Last Edit: September 18, 2015, 02:56:59 pm by Just No Point
Re: AnimElemNo (Triggers)
#2  September 09, 2015, 08:44:12 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
Animelemno(0) will always return the current animation element the player is.

For example, you can create a frame advance feature that will advance one animation frame when the hit connects, effectively bypassing the hitting frame animation ticks and hitpauses for the player:

[State 0, Advance Frame]
type = ChangeAnim
trigger1 = movehit
value = Anim
elem = AnimElemno(0)+1
ignorehitpause = 1
persistent = 0
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: AnimElemNo (Triggers)
#3  June 02, 2024, 03:55:57 am
  • **
  • Expert Noob
  • I am a lover and a fighter!
    • USA
You can use AnimElemNo(0) to keep track of an animations current element number by using either a varset or a parentvarset if the animation is part of a helper. To do this you need to place the varset code inside the Statedef that contains the animation like this.

[State *, VarSet]
type = VarSet
trigger1 = Anim = (Animation Number)
var(*) = AnimElemNo(0)
ignorehitpause = 1
persistent = 1

You may need to tweak it a bit, but this will make whatever var you set it as continuously update itself with the current animation element number as long as the animation is playing.
May you always win every round, both in MUGEN and Life. :)