RPG Maker MV - Checking which frame of a character sheet is currently active

495 Views Asked by At

I have a character sheet for the player that triggers when they are idle for a while. The sheet has them going from standing to laying down in 6 frames, sleeping for 3 frames and then standing back up in 7 frames.

I'm looking to pause the animation when it reaches the 9th frame without using timers (as the character sheet may change in the future). Is there a function that will let me query which animation frame is currently being displayed?

Alternatively, is there a way to know if a character sheet has reached the last frame and is about to return to the first frame. I need to know when this animation has finished a cycle so I can smoothly transition back into the walking animation.

character_sheet

1

There are 1 best solutions below

0
On

I'm extending Modern Algebra's ExtraMovementFrames plugin, so the solution ended up being to capture the output of this:

var patternIndex = (this._pattern % this.emfCharacterState().pattern.length);

which uses the ._pattern property of the player, modulo the length of the animation.

I then used this.setStepAnime(false); to pause the walking animation of the character once it reached the desired frame.

Also asked this on the rpg maker mv forums: https://forums.rpgmakerweb.com/index.php?threads/checking-which-frame-of-a-character-sheet-is-currently-active.115662/