Reference specific sprite index

The default sprites seem to 4 directions (Up, down, left, right) with 3 different steps. This is pretty inefficient for door/chest animations though because we are essentially reproducing the same image 3 times for each "direction". Then when we do the door animations we just turn the stepping off and have the door "turn" up, down, left, etc.

1608498472005.png


Seems this would be much more efficient if we could use all 9 of the slots and reference the event/sprite as a picture with 9 indices.

so my question, can i reference the individual cells (1-9) or do I have to turn a direction and then fiddle with "stepping"?
Yep, you can set an event to a specific pattern (a.k.a. "stepping frame") and make sure the event has both Stepping and Walking disabled. Make sure Direction Fix is enabled, too, unless you're OK with it changing "row" when the player interacts with it. 👋

Otherwise, to set a particular frame, you can change the character's direction then use the setPattern script method:
Spoiler: Script call examples
  • In a Script command inside a move route:
    JavaScript:
    this.setPattern(0);
    "For the character being moved: set its pattern to 0."

  • In a Script command in an event:
    JavaScript:
    this.character(1).setPattern(0);
    "For map event ID 1: set its pattern to 0."
    Replace 1 with either an event ID, 0 = "This Event", or -1 = player.

  • In a script call anywhere in the game:
    JavaScript:
    $gameMap.event(1).setPattern(0);
    "For map event ID 1: set its pattern to 0."
By default pattern is from 0 to 3:
  • 0 = left
  • 1 = middle ->
  • 2 = right
  • 3 = middle <-
There are two middle-frame references because by default stepping is animated in "ping-pong" style~

Also, I know you're probably aware, but it's technically 12 frames per character: three frames/patterns per row, one row per direction. 🙏
Oof. 3*4 doesn't = 9? lol.

Thank you for explanation on the set pattern and the 2 middle patterns @caethyril.

This will makes my sprite generation sheets much smaller. Really appreciate the help!

Original thread: https://forums.rpgmakerweb.com/threads/reference-specific-sprite-index.131230/