Problem with Set Move Route

I have a problem executing a Set Move Route.
I made a command to demonstrate a death, changing by frames of the character's image.
But in execution it does not follow the order.
Here's an example video and images of the code: Video

1650244101895.png


Image I used as the basis for the animation:

HeroDie_1a4.png


Can anyone help me?
I'm not really sure of the issue, but it sort of looks like it's being played twice?

How are you calling this event?

I don't think the Wait 300 Frames and Erase Event have any effect, after you've executed a GameOver.
I'm not really sure of the issue, but it sort of looks like it's being played twice?

How are you calling this event?

I don't think the Wait 300 Frames and Erase Event have any effect, after you've executed a GameOver.

There is only one call for this event.
I tried putting 300 frames and Game over to try to end the event before he repeats the move.
Shaz is right in that anything after the "Game Over" call will not be processed. There's no need to have anything else below it.

This might actually be a bug with XP (it's definitely not the first). When you change the graphic in a move route, it calls this method in Game_Character:
Code:
def move_type_custom
  # ... removed for brevity

        when 41  # Change Graphic
          @tile_id = 0
          @character_name = command.parameters[0]
          @character_hue = command.parameters[1]
          if @original_direction != command.parameters[2]
            @direction = command.parameters[2]
            @original_direction = @direction
            @prelock_direction = 0
          end
          if @original_pattern != command.parameters[3]
            @pattern = command.parameters[3]
            @original_pattern = @pattern
          end
The problem appears to be the @original_direction. By default, all events (and the player) have this value set to 2, meaning it's facing down. The only purpose this variable serves is whenever Game_Event#refresh is called, changing the event's direction to how it should be according to its event page. When it comes to the player, this variable will typically never change, so you can expect it to always be 2.

Your death animation starts with the top left graphic of the spritesheet, which is when the character is facing down (so a value of 2). Because the player's @original_direction is currently 2, no matter which way it is currently facing at the time the move route is called, your 'Change Graphic' does not seem to change the player's direction. It's not until after your fifth 'Change Graphic' call that runs onto the second line of your spritesheet where the character faces left (a value of 4) that your player's direction then changes.

The obvious solution to me would be to change the line in the method I called out above from
Code:
          if @original_direction != command.parameters[2]
to
Code:
          if @direction != command.parameters[2]
in the Game_Character 2 script.

Alternatively, if you don't want to mess with the code, you could just put a 'Turn Down' right after the first 'Change Graphic'.
Shaz is right in that anything after the "Game Over" call will not be processed. There's no need to have anything else below it.

This might actually be a bug with XP (it's definitely not the first). When you change the graphic in a move route, it calls this method in Game_Character:
Code:
def move_type_custom
  # ... removed for brevity

        when 41  # Change Graphic
          @tile_id = 0
          @character_name = command.parameters[0]
          @character_hue = command.parameters[1]
          if @original_direction != command.parameters[2]
            @direction = command.parameters[2]
            @original_direction = @direction
            @prelock_direction = 0
          end
          if @original_pattern != command.parameters[3]
            @pattern = command.parameters[3]
            @original_pattern = @pattern
          end
The problem appears to be the @original_direction. By default, all events (and the player) have this value set to 2, meaning it's facing down. The only purpose this variable serves is whenever Game_Event#refresh is called, changing the event's direction to how it should be according to its event page. When it comes to the player, this variable will typically never change, so you can expect it to always be 2.

Your death animation starts with the top left graphic of the spritesheet, which is when the character is facing down (so a value of 2). Because the player's @original_direction is currently 2, no matter which way it is currently facing at the time the move route is called, your 'Change Graphic' does not seem to change the player's direction. It's not until after your fifth 'Change Graphic' call that runs onto the second line of your spritesheet where the character faces left (a value of 4) that your player's direction then changes.

The obvious solution to me would be to change the line in the method I called out above from
Code:
          if @original_direction != command.parameters[2]
to
Code:
          if @direction != command.parameters[2]
in the Game_Character 2 script.

Alternatively, if you don't want to mess with the code, you could just put a 'Turn Down' right after the first 'Change Graphic'.

Solved!

With the code, he did it 3 times haha
But i put 'Turn Down' as you said, e worked!
Thank you!
Correct video link:

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-set-move-route.146854/