[RMXP] Centering Battlers in Battle?

Discussion in 'RGSS Script Requests' started by Tornado Samurai, Feb 26, 2015.

  1. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Hello everyone! :D

    I'm currently experimenting in RPG Maker XP once more and I have come across a slight issue that I do not know how to fix. I almost didn't even know what to call this small problem.

    Does anyone know how to center battlers in RPG Maker XP Battles? Example below:

    *NOTE: The project in the photo is not the project I am working on. It is just an example project.

    Moving Over Battlers.png

    How would I be able to center (move them over) the battler graphics and the menu if they were only three battlers, or two, or even one? This may seem like a small issue but to me it appears like the battle HUD with 3 - 1 battlers seems either a bit lopsided or has a large gap in it where a 4th person should be expected to fill that spot but there will not be. [The gap issue is more visible when there is only one battler and one battler interface for that said character.]

    Any solutions are appreciated.

    - Thanks in advance,

    Tornado Summoner
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,914
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I've moved this thread to RGSS Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.


    I think this would be pretty easy to do, if you are using the RTP battle scripts. But I'm at work so can't look at this at the moment.


    ARE you using any custom battle scripts? Are you using any scripts that allow you to add/remove battlers in the middle of a battle? Or any event commands that change the number of party members during a battle?
     
    #2
  3. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Thanks for placing the topic in the correct forum. :) Silly me XD.

    Also, I have yet to use any scripts for XP at all. Not even once. Ever since I discovered and experimented with making games in RPG Maker XP in January, I have not yet utilized a single script for XP. I only consented use of the basic/default scripts that were preloaded with RPG Maker XP... I honestly do not know the reason why that is...

    - Tornado Summoner

     
     
    Last edited by a moderator: Feb 26, 2015
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,914
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    :) Without default scripts, your game would not run. You do not "consent" to these. Try deleting them (from a new project) and see what happens when you test your game ;)
     
    #4
  5. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Just now tried it. Impeccable, the game might as well just have collapsed on itself. :o

    Would you recommend/think it is necessary/required trying custom scripts for XP, since I have never used another script before, for XP?
     
    Last edited by a moderator: Feb 26, 2015
    #5
  6. Shaz

    Shaz Veteran Veteran

    Messages:
    37,914
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Honestly, you can make a game in ANY of the engines using JUST the custom scripts. But sometimes you want to do some things a bit differently, or some things that the designers didn't think about or include. That's when you resort to scripts. Do not make the mistake of adding many scripts just for the sake of having many scripts. If your game doesn't need it, don't add it. Don't be attracted to all the bling :)

    XP is a bit harder - not to write scripts for, but to gather scripts for - because the methods are so large and do so much, it's hard to get multiple custom scripts working together, unless they're specifically designed for your game. Ace is much better as everything is broken down into little functional chunks, so it's easier to make it do just small things differently, and therefore easier to combine scripts from multiple people that don't interfere/conflict with each other. It still happens, but not as much.

    Anyway, here is your script.

    To use it, go to your list of scripts and scroll down to find Main right at the bottom. Click on Main and press Insert a few times to add a few blank slots above it. Select one of the blank slots and give it a name so it'll be easier to find later if you need to. Then copy and paste the script below into that section.

    Code:
    #==============================================================================# ** Window_BattleStatus#------------------------------------------------------------------------------#  This window displays the status of all party members on the battle screen.#==============================================================================class Window_BattleStatus < Window_Base  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh    self.contents.clear    party_offset = 320 - 80 * $game_party.actors.size    @item_max = $game_party.actors.size    for i in 0...$game_party.actors.size      actor = $game_party.actors[i]      actor_x = i * 160 + 4 + party_offset      draw_actor_name(actor, actor_x, 0)      draw_actor_hp(actor, actor_x, 32, 120)      draw_actor_sp(actor, actor_x, 64, 120)      if @level_up_flags[i]        self.contents.font.color = normal_color        self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")      else        draw_actor_state(actor, actor_x, 96)      end    end  endendclass Game_Actor < Game_Battler  #--------------------------------------------------------------------------  # * Get Battle Screen X-Coordinate  #--------------------------------------------------------------------------  def screen_x    # Return after calculating x-coordinate by order of members in party    if self.index != nil      return self.index * 160 + 400 - 80 * $game_party.actors.size    else      return 0    end  endendclass Scene_Battle  #--------------------------------------------------------------------------  # * Actor Command Window Setup  #--------------------------------------------------------------------------  alias cbs_phase3_setup_command_window phase3_setup_command_window    def phase3_setup_command_window    cbs_phase3_setup_command_window    @actor_command_window.x = @actor_index * 160 + 320 - 80 * $game_party.actors.size  endend 
     
    Last edited by a moderator: Feb 26, 2015
    #6
    Tornado Samurai likes this.
  7. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Thanks for the script :D , but for some strange reason, it won't automatically paste into the XP Script Editor. I even tried pasting in Notebook and then recopying from there. Even tried CTRL+V. For clarification, I'm also not pasting directly on the blank tabs on the left side of the Script Editor: it's inside the box. I've been having this copy-and-paste script problem for a long time with all my projects. The script paste just won't work for some reason.

    - Tornado Summoner
     
    Last edited by a moderator: Feb 26, 2015
    #7
  8. Shaz

    Shaz Veteran Veteran

    Messages:
    37,914
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You insert a new script slot and you name it. Does that work?


    After you copy the script, click in the large box. If you right-click does it give you a paste option?


    If not, you're just going to have to type it out (and hope you don't make any typos).


    I assume you're using a legal (purchased) version of XP?
     
    #8
  9. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Yes, all the steps leading up to the ulterior copy and pasting are functioning normally.

    All right then, I'll try typing it out then.

    Also, yes, I am using a legitimate copy of RPG Maker XP.

    UPDATE: Ok, I just typed the entirety of the script and double checked for errors and then played the game. No errors from the title screen and map until I went into battle. The battle froze with this message:

    "Script 'Character Centering Script' line 18: NameError occured.

    undefined local variable or method 'actor' for

    #<Window_BattleStatus:0x3148010>"

    I rechecked Line 18 for errors but it was just exactly as you had sent me. No errors with typos here.
     
    Last edited by a moderator: Feb 27, 2015
    #9
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    37,914
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Copy your script (if you can do that) and paste it here. Or take a screenshot showing that section of the script.


    It works for me. If it doesn't work for you, then either you've modified or added other scripts, or you do have a typo in there.


    You didn't miss this line, did you?

    Code:
    actor = $game_party.actors[i]
    Make sure there aren't any typos on that line.
     
    Last edited by a moderator: Feb 27, 2015
    #10
    Tornado Samurai likes this.
  11. Tornado Samurai

    Tornado Samurai A Samurai of the Storms Veteran

    Messages:
    577
    Likes Received:
    57
    Location:
    Guarding a Japanese Village
    First Language:
    English
    Oh my goodness, you must excuse me. This was a mistake on my part.

    On that precise line you showed me, I typed it like this:

    ______________________________________

    actors = $game_party.actors

    ______________________________________

    I had assumed that because it was $game_party.actors, that the "actor" was already plural to begin with. XD

     

    Sorry about that... and yet It's so strange how one typo can hinder the entire thing. Even though I know why, it's very intriguing...

     

    Anyway, I tried it out and my battlers have been centered now. :D

     

    Thanks again for all your patience and help! Have a great day! :D
     
    Last edited by a moderator: Feb 27, 2015
    #11

Share This Page