• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Essentials v17.2] Turn Around Animation (like HGSS)

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
  • Let's make this happen:
    XA3w85l.gif

    Find 'Game_Character' script. Then, inside the script, find this code:
    Code:
      def jumping?
        return @jump_count > 0
      end
    And below that code, paste:
    Code:
      def pattern=(value)
        @pattern=value
      end

    Now, replace 'def turnGeneric(dir)' to:
    Code:
      def turnGeneric(dir)
        unless @direction_fix
          oldDirection=@direction
          @direction=dir
          if dir!=oldDirection
            if @pattern == 0 && @walk_anime
              @pattern = 3
            end
            @stop_count=0
            pbCheckEventTriggerAfterTurning
          end
        end
      end

    Now, replace 'update_stop' to:
    Code:
      def update_stop
        if @step_anime
          @anime_count += 1
        elsif @pattern != @original_pattern
          @anime_count += 1.5
        end
        unless @starting or lock?
          @stop_count += 1
        end
      end

    Finally, replace 'def update' to:
    Code:
      def update
        if !$game_temp.in_menu
          if jumping?; update_jump
          elsif moving?; update_move
          else; update_stop
          end
          if @anime_count > 18-@move_speed*3
            if !@step_anime && @stop_count>0
              @pattern = @original_pattern
            else
              @pattern = (@pattern+1)%4
            end
            @anime_count = 0
          end
          if @wait_count>0
            @wait_count -= 1
          elsif @move_route_forcing
            move_type_custom
          elsif !@starting && !lock?
            if @stop_count>(40-@move_frequency*2)*(6-@move_frequency)
              case @move_type
              when 1; move_type_random
              when 2; move_type_toward_player
              when 3; move_type_custom
              end
            end
          end
        end
      end

    See ya!
     
    Last edited:
    153
    Posts
    4
    Years
    • Seen Feb 4, 2020
    Hey Wolf,

    I tried it but my character keeps the movement sprite after turning around instead of showing it then going back to neutral
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Hey Wolf,

    I tried it but my character keeps the movement sprite after turning around instead of showing it then going back to neutral

    You need to replace your 'def update_stop':
    Code:
      def update_stop
        if @step_anime
          @anime_count += 1
        elsif @pattern != @original_pattern
          @anime_count += 1.5
        end
        unless @starting or lock?
          @stop_count += 1
        end
      end

    Added this part into main post.
     
    Last edited:

    Juno and Ice

    Developer of Pokémon Floral Tempus
    150
    Posts
    5
    Years
    • Seen Apr 30, 2024
    This script actually messes up door animations since they also turn as well. Any way to fix that, as door animations are very prominent in my game.
     
    Last edited:
    16
    Posts
    7
    Years
  • It also works in version 16.2 ^^
    But gives problems with the animation of the doors, but it is easy to fix. You only have to uncheck "move animation" when the door event is edited.
     

    Juno and Ice

    Developer of Pokémon Floral Tempus
    150
    Posts
    5
    Years
    • Seen Apr 30, 2024
    Thanks to ClaraDragon for the door fix, but is there also a way to make this script not activate during speech/text bubbles. So that NPC's turn like normal when interacting with them, but then turn like HGSS style when just walking around the overworld?
     

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Maybe adding something like:
    Code:
    @event!=$game_player && pbEventCommentInput(@event,0,"NoTurnAroundEffect")

    When i have time i'll check that.
     

    Juno and Ice

    Developer of Pokémon Floral Tempus
    150
    Posts
    5
    Years
    • Seen Apr 30, 2024
    How would I go about adding in that line that you mentioned in your above post? Where would it be placed?
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • How would I go about adding in that line that you mentioned in your above post? Where would it be placed?

    Like i said, when i have time i will try to do that. But you can try too. Check the codes than i made for the script and make trials and errors.

    EDIT: Try with this code:
    Spoiler:
    EDIT 2: I think i found the solution. Ignore above and just replace your 'def turnGeneric(dir) for:
    Spoiler:

    You need to put a Comment 'NoTurnAround' inside each Event Page than you won't want the turn around effect:
    AYfS4xz.png


    Or you can put 'Move Animation OFF' into the event, like:
    l6dkGCp.png
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Now, to have animation while event jumps, replace 'def screen_y' (from Game_Character script):
    Code:
      def screen_y
        y = (@real_y - self.map.display_y + 3) / 4 + (Game_Map::TILEHEIGHT)
        if jumping?
          n = (@jump_count - @jump_peak).abs
          if @walk_anime
            @anime_count += n
          end
          return y - (@jump_peak * @jump_peak - n * n) / 2
        end
        return y
      end
     
    Last edited:

    DiegoWT

    Discord: diegowt
    24
    Posts
    7
    Years
  • Here's the version which works with v18.1:

    Go to 'Game_Character' script and, inside the script, find this code:

    Code:
      def jumping?
        return (@jump_distance_left || 0) > 0 || @jump_count > 0
      end

    And then, right below, paste this:

    Code:
      def pattern=(value)
        @pattern=value
      end

    Now, find the following:

    Code:
      def turnGeneric(dir)
        return if @direction_fix
        oldDirection = @direction
        @direction = dir
        @stop_count = 0
        pbCheckEventTriggerAfterTurning if dir != oldDirection
      end

    And replace to:

    Code:
      def turnGeneric(dir)
        return if @direction_fix
        oldDirection = @direction
        @direction = dir
        if dir != oldDirection
          if @pattern == 0 && @walk_anime
            @pattern = 3
          end
          @stop_count = 0
          pbCheckEventTriggerAfterTurning
        end
      end

    After, find the following:

    Code:
      def update
        @moved_last_frame = @moved_this_frame
        if !$game_temp.in_menu
          # Update command
          update_command
          # Update movement
          (moving? || jumping?) ? update_move : update_stop
        end
        # Update animation
        update_pattern
      end

    And replace to:

    Code:
      def update
        @moved_last_frame = @moved_this_frame
        if !$game_temp.in_menu
          # Update command
          update_command
          # Update movement
          (moving? || jumping?) ? update_move : update_stop
        end
        if @anime_count > 18-@move_speed*3
          if !@step_anime && @stop_count>0
            @pattern = @original_pattern
          else
            @pattern = (@pattern+1)%4
          end
          @anime_count = 0
        end
        # Update animation
        update_pattern
      end

    And, as the last thing to do, find the following:

    Code:
      def update_stop
        @anime_count += 1 if @step_anime
        @stop_count  += 1 if !@starting && !lock?
        @moved_this_frame = false
      end

    And replace to:

    Code:
      def update_stop
        if @step_anime
          @anime_count += 1
        elsif @pattern != @original_pattern
          @anime_count += 1.5
        end
        @stop_count  += 1 if !@starting && !lock?
        @moved_this_frame = false
      end

    That's all, folks. You don't need to credit me for using this version, just give credits to WolfPP.
    Note: keep in mind that some overworld animations (like the door opening/closing animation) can become "buggy" when you make these alterations (which occurs with the v17 version too). To avoid that, mark 'Move Animation' off for the animations to work correctly.
     
    77
    Posts
    3
    Years
    • They/Them, One/One
    • Seen Apr 24, 2023
    Updated DiegoWT's code to v19.1. I use the GitHub version of Essentials so I made it all a single script, but here it is for whoever wants to use it. Only problem is that it seems to break Following Pokemon EX (haven't figured out how to fix it.)

    Code:
    class Game_Character
      attr_reader   :id
      attr_reader   :original_x
      attr_reader   :original_y
      attr_reader   :x
      attr_reader   :y
      attr_reader   :real_x
      attr_reader   :real_y
      attr_accessor :width
      attr_accessor :height
      attr_accessor :sprite_size
      attr_reader   :tile_id
      attr_accessor :character_name
      attr_accessor :character_hue
      attr_reader   :opacity
      attr_reader   :blend_type
      attr_accessor :direction
      attr_accessor :pattern
      attr_accessor :pattern_surf
      attr_accessor :lock_pattern
      attr_reader   :move_route_forcing
      attr_accessor :through
      attr_accessor :animation_id
      attr_accessor :transparent
      attr_reader   :move_speed
      attr_accessor :walk_anime
      attr_writer   :bob_height
      
      def initialize(map=nil)
        @map                       = map
        @id                        = 0
        @original_x                = 0
        @original_y                = 0
        @x                         = 0
        @y                         = 0
        @real_x                    = 0
        @real_y                    = 0
        @width                     = 1
        @height                    = 1
        @sprite_size               = [Game_Map::TILE_WIDTH, Game_Map::TILE_HEIGHT]
        @tile_id                   = 0
        @character_name            = ""
        @character_hue             = 0
        @opacity                   = 255
        @blend_type                = 0
        @direction                 = 2
        @pattern                   = 0
        @pattern_surf              = 0
        @lock_pattern              = false
        @move_route_forcing        = false
        @through                   = false
        @animation_id              = 0
        @transparent               = false
        @original_direction        = 2
        @original_pattern          = 0
        @move_type                 = 0
        self.move_speed            = 3
        self.move_frequency        = 6
        @move_route                = nil
        @move_route_index          = 0
        @original_move_route       = nil
        @original_move_route_index = 0
        @walk_anime                = true    # Whether character should animate while moving
        @step_anime                = false   # Whether character should animate while still
        @direction_fix             = false
        @always_on_top             = false
        @anime_count               = 0
        @stop_count                = 0
        @jump_peak                 = 0   # Max height while jumping
        @jump_distance             = 0   # Total distance of jump
        @jump_distance_left        = 0   # Distance left to travel
        @jump_count                = 0   # Frames left in a stationary jump
        @bob_height                = 0
        @wait_count                = 0
        @moved_this_frame          = false
        @locked                    = false
        @prelock_direction         = 0
      end
      
      def pattern=(value)
    	@pattern=value
      end
      
      def turn_generic(dir)
        return if @direction_fix
        oldDirection = @direction
        @direction = dir
        if dir != oldDirection
          if @pattern == 0 && @walk_anime
            @pattern = 3
          end
          @stop_count = 0
          pbCheckEventTriggerAfterTurning
        end
      end
      
      def update
        @moved_last_frame = @moved_this_frame
        if !$game_temp.in_menu
          # Update command
          update_command
          # Update movement
          (moving? || jumping?) ? update_move : update_stop
        end
        if @anime_count > 18-@move_speed*3
          if !@step_anime && @stop_count>0
            @pattern = @original_pattern
          else
            @pattern = (@pattern+1)%4
          end
          @anime_count = 0
        end
        # Update animation
        update_pattern
      end
      
      def update_stop
        if @step_anime
          @anime_count += 1
        elsif @pattern != @original_pattern
          @anime_count += 1.5
        end
        @stop_count  += 1 if !@starting && !lock?
        @moved_this_frame = false
      end
    end
     
    4
    Posts
    5
    Years
    • Seen Oct 9, 2023
    Was very broken with V20.1 so I tweaked it, Change def update to this
    This wasn't fully tested so it might still have issues with plugins and scripts like Follower pokemon EX
    Besides that, this should do the trick
    Code:
      def update
        @moved_last_frame = @moved_this_frame
        @stopped_last_frame = @stopped_this_frame
        @moved_this_frame = false
        @stopped_this_frame = false
        if !$game_temp.in_menu
          # Update command
          update_command
          # Update movement
          (moving? || jumping?) ? update_move : update_stop
        end
        if @anime_count > 18-@move_speed*3
          if !@step_anime && @stop_count>0
            @pattern = @original_pattern
          else
            @pattern = (@pattern+1)%4
          end
          @anime_count = 0
        end
     
    163
    Posts
    7
    Years
    • Seen yesterday
    Was very broken with V20.1 so I tweaked it, Change def update to this
    This wasn't fully tested so it might still have issues with plugins and scripts like Follower pokemon EX
    Besides that, this should do the trick
    Code:
      def update
        @moved_last_frame = @moved_this_frame
        @stopped_last_frame = @stopped_this_frame
        @moved_this_frame = false
        @stopped_this_frame = false
        if !$game_temp.in_menu
          # Update command
          update_command
          # Update movement
          (moving? || jumping?) ? update_move : update_stop
        end
        if @anime_count > 18-@move_speed*3
          if !@step_anime && @stop_count>0
            @pattern = @original_pattern
          else
            @pattern = (@pattern+1)%4
          end
          @anime_count = 0
        end

    So far it works for me using Following EX. I would just point out that I replace the line
    Code:
      if @anime_count > 18-@move_speed*3
    with
    Code:
      if @anime_count > 14-@move_speed*3
    otherwise my character would be striding slowly instead of running.

    Thanks!
     
    4
    Posts
    5
    Years
    • Seen Oct 9, 2023
    So far it works for me using Following EX. I would just point out that I replace the line
    Code:
      if @anime_count > 18-@move_speed*3
    with
    Code:
      if @anime_count > 14-@move_speed*3
    otherwise my character would be striding slowly instead of running.

    Thanks!

    Striding slowly? Could you elaborate on that? I wasn't having issues with running, so I'm a bit confused.
     
    163
    Posts
    7
    Years
    • Seen yesterday
    Sorry, English is not my first language. I will try to explain. Originally my character was running at a certain pace and at a certain speed. They were agile and constant steps, once I installed everything the character didn't change his speed but the frequency in which the steps were animated. Although he was running at the same speed as before, the animation of his steps was much slower (as if he was running in slow motion), however when I changed that line (from 18 to 14) he recovered the original rhythm.
     
    Back
    Top