Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Fixing My Menu

Status
Not open for further replies.
This shouldn't be too hard, but for me, it seems to be. I want to fix my menu to where the main one shows the character's face portraits by their HP, SP, and such, and in the status menu, I want to show the battler, under the equipment list. Where and what do I need to edit to do this?
 
Put this in a new window above main:
Code:
module RPG::Cache
  def self.portrait(filename, hue = 0)
    self.load_bitmap("Graphics/Portrait/", filename, hue)
  end
end

class Window_Base < Window
  def draw_actor_face(actor, x, y)
    bitmap = RPG::Cache.portrait(actor.character_name, actor.character_hue)
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
  end
  
  def draw_actor_battler(actor, x, y)
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    self.contents.blt(x, y, bitmap, Rect.new(0, 0, bitmap.width, bitmap.height))
  end
  
end

Create a new Folder in "Graphics" and name it Portrait.

Put in there your portraits and named them like the character sets filename, so Aluxes portrait would be named 001-Fighter01.

Then in Window_MenuStatus in the refresh method replace draw_actor_graphic with draw_actor_face.
You can play with the x and y values to place the portraits where you want.

Then in Window_Status insert the code draw_actor_battler(@actor, x, y) into the refresh method before the
Code:
    self.contents.font.color = system_color
    self.contents.draw_text(320, 160, 96, 32, "equipment")
    draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)

part.
Change the x and y values to whatever you want.

If you still have questions, feel free to ask.
 
That took care of the main menu, but my status screen still doesn't show the battlers in the desired location. It still shows the field graphic in the top left corner...
 
Then in Window_Status insert the code draw_actor_battler(@actor, x, y) into the refresh method before the
Code:
    self.contents.font.color = system_color
    self.contents.draw_text(320, 160, 96, 32, "equipment")
    draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)

part.
Change the x and y values to whatever you want.

That should do the trick.
 
This is what I have in that portion of the script:

def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
draw_actor_battler(@actor, 96, 96)
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "Exp")
self.contents.draw_text(320, 80, 80, 32, "Next Level")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 160, 96, 32, "Equipment")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)

And when I test it still looks like this:
View attachment 1794
 
Make sure there is no other script overwriting the refresh method. In this case you'd have to add the code to the script that overwrites the refresh method in Window_Status.
 
I see. The multi-equip script I used over rid it. I fixed it, but I have one last question since it is a menu of sorts. Is there a way to put the faces in the save file screen in place of the field graphics?
 
You mean instead of the charactersets?
Sure just change:
Code:
    if @file_exist
        bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width / 4
        ch = bitmap.rect.height / 4
        src_rect = Rect.new(0, 0, cw, ch)
        x = 300 - @characters.size * 32 + i * 64 - cw / 2
        self.contents.blt(x, 68 - ch, bitmap, src_rect)
      end

in Window_SaveFile to

Code:
      for i in 0...@characters.size
        bitmap = RPG::Cache.portrait(@characters[i][0], @characters[i][1])
        cw = bitmap.rect.width
        ch = bitmap.rect.height
        src_rect = Rect.new(0, 0, cw, ch)
        x = 300 - @characters.size * 32 + i * 64 - cw / 2
        self.contents.blt(x, 68 - ch, bitmap, src_rect)
      end
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top