Actor sprite - easy fix to move up 4 pixels?

Discussion in 'RPG Maker VX Ace' started by sock, Jan 3, 2018.

  1. sock

    sock Veteran Veteran

    Messages:
    53
    Likes Received:
    4
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A
    Hey guys.

    Curious - I'd like to get my actor sprite, and all NPC sprites to move up 4 pixels. Similar to how they would move down 4 pixels if you put a '!' at the beginning of title for that character graphic. - Can you do the opposite thing (so they move up by 4) with, some other prefix perhaps?

    I've thought about changing my entire tile set to make the fix... But that would take up an unnecessary amount of time, not to mention a doubling of size in all my tilesets.
     
    #1
  2. Harosata

    Harosata Dramatic Lightning's BFF Veteran

    Messages:
    240
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMVXA
    This is what I found: Under Game_CharacterBase, object_character? is determined either if it's part-tile or if ! is detected in the name. Right under that, shift_y will shift the character if it is not considered an object character.

    Anyway, here's something quick to try. Ideally, this means that if the file begins with &, the shift 4 pixels higher than standard:
    Code:
    class Game_CharacterBase
      def up_character?
        @character_name[0, 1] == '&'
      end
    
      def shift_y
        bob = 4
        bob = 0 if object_character?
        bob = 8 if up_character?
        return bob
      end
    end
     
    Last edited: Jan 6, 2018
    #2
    sock likes this.
  3. sock

    sock Veteran Veteran

    Messages:
    53
    Likes Received:
    4
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A
    Hmmm, interesting!! Still teaching myself Ruby atm, but thanks heaps!!!. This helps me in both scripting and in my problem. Haha, up until now I'd decided that the 'positioning' would come to be "the charm of the game". lol

    Few questions though... - I guess I'd be adding/editing the definition of 'up_character?' to the Game_CharacterBase script. Does it matter where it goes?

    - What's an object_character?, is that your actor and all graphics you'd use for events?

    - Lastly are you paraphrasing 'object_character? ? 0 : 4' when you say "bob = 4" etc

    Cheers! B)
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,533
    Likes Received:
    11,252
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    So do you want ALL sprites that don't have a name starting with ! to move up an additional 4 pixels? Or just certain ones?

    If you want them all to be aligned with the grid if they start with !, otherwise up 8 pixels (the default 4 plus an additional 4), just add this into a new slot:

    Code:
    class Game_CharacterBase
      def shift_y
        object_character? ? 0 : 8
      end
    end
    If you only want certain ones to move up (those you specify with a different character), but others that don't have that character or ! at the start will still use 4, go with Harosata's solution.

    object_character? is a function/method within Game_CharacterBase that determines if you have a ! at the beginning of the name or not.
     
    #4
    sock likes this.
  5. sock

    sock Veteran Veteran

    Messages:
    53
    Likes Received:
    4
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A
    Thanks Shaz. I guess ALL sprites was the intention. So I will mess around with that. But it's great to know I can customise whichever ones I want using Harosatas method. Thanks!! Thanks!!
     
    #5
  6. Harosata

    Harosata Dramatic Lightning's BFF Veteran

    Messages:
    240
    Likes Received:
    65
    First Language:
    English
    Primarily Uses:
    RMVXA
    As to where to put these little scripts, you place them where you put any new big scripts. That should be under Materials, near the bottom of the script database. If you have multiple methods of the same name like the default shift_y and either mine or Shaz's version of shift_y, the later ones (closer to the bottom of the database) would be executed.

    Generally, we want to avoid changing the default scripts directly, instead overwriting/aliasing them with a new method, since you might not write a reminder if you decide to edit.

    ---

    Also, object_character? ? 0 : 4 is shorthand for:

    if object_character?
    0
    else
    4
    end

    I can't really use the shorthand with three conditions.
     
    #6

Share This Page