Script to change the offset of PCs/NPCs?

Discussion in 'RGSS3 Script Requests' started by AttentionEPIC, May 26, 2019.

    Tags:
  1. AttentionEPIC

    AttentionEPIC Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    It's pretty self-explanatory...

    A script to change the offset of characters in X and/or Y values - avoiding changing the offset of stationary objects (doors, lights, switches, etc).

    For example:
    [​IMG][​IMG]
     

    Attached Files:

    Last edited: May 27, 2019
    #1
  2. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,122
    Likes Received:
    412
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    Here is a little something for you.
    Code:
    #========================================================
    # Author: Heirukichi
    # Last update: 05-26-2019 [MM-DD-YYYY]
    # License: CC 4.0 BY-SA
    #========================================================
    
    module HRK_CHOFS
    
      #======================================================
      # Set this to false if you want to use the default offset
      #======================================================
      USE_CUSTOM_OFFSET = true
     
      #======================================================
      # Change these to be your character offset
      #======================================================
      OFFSET_FOR_CHARACTERS_X = 12
      OFFSET_FOR_CHARACTERS_Y = 12
    
      #======================================================
      # - - - WARNING! Do not modify after this point!
      #======================================================
      def self.custom_offset?
        USE_CUSTOM_OFFSET
      end
    
      def self.shift_y
        OFFSET_FOR_CHARACTERS_Y
      end
    
      def self.shift_x
        return 0 unless custom_offset?
        OFFSET_FOR_CHARACTERS_X
      end
    end
    
    #========================================================
    # * Game_CharacterBase class
    #========================================================
    class Game_CharacterBase
     
      alias hrk_chofs_shift_y_old shift_y
      def shift_y
        if  HRK_CHOFS.custom_offset?
          object_character? ? 0 : HRK_CHOFS.shift_y
        else
          hrk_chofs_shift_y_old
        end
      end
    
      def shift_x
        object_character? ? 0 : HRK_CHOFS.shift_x
      end
    
      alias hrk_chofs_screen_x_old screen_x
      def screen_x
        hrk_chofs_screen_x_old - shift_x
      end
    
    end
    

    P.S. I hope this does what you want (the image link is broken).
     
    Last edited: May 26, 2019
    #2
  3. AttentionEPIC

    AttentionEPIC Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    Fixed (Hopefully)

    I'm pretty sure that it is, you can see similarities in the examples I gave. Of course 0,0 probably won't be as I put it but it wasn't a necessity. I will return to see if it works for me. Thank you.
     
    #3
  4. Heirukichi

    Heirukichi Veteran Veteran

    Messages:
    1,122
    Likes Received:
    412
    Location:
    Italy
    First Language:
    Italian
    Primarily Uses:
    RMVXA
    It should be exactly as it is in the picture as long as you set the custom offset to true.
     
    #4
  5. AttentionEPIC

    AttentionEPIC Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMVXA
    It's perfect, thank you
     
    #5

Share This Page