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.

XRXS HUD- not updating [Resolved]

Hey all,
I'm running into a little problem with a HUD script in the XAS-ABS pack by XRXS.

The equipment section doesn't refresh/update unless you go into another scene (like the menu) and leave. Normally this wouldn't be a problem, but sometimes I'll have to use the "Change Party Members" which will result in an equipment change without entering the menu. Because of this, the old weapon/armors still show in the equipment HUD after changing equipment and they don't change until I enter/exit the menu. So what I'm really asking is, could someone edit the script so that the HUD will update if I use the aforementioned command?

Hopefully this shouldn't be too difficult.

And of course, here is the (slightly modified) script. Either a patch or edit would work.
Code:
#_______________________________________________________________________________
# MOG MPW Equip V2.0c            
#_______________________________________________________________________________
# By Moghunter
# http://www.atelier-rgss.com
#_______________________________________________________________________________
module MOG
  #Disable Window Switch ID.
  EQPMAPVIS = 1
  #Window opacity.
  EQPMAPOPA = 0
  #Windowskin name.
  EQPMAPSKIN = "yellow"
  #HUD Position.
  EQPMAPX = 290 #X Pos
  EQPMAPY = 390 #Y Pos
  # This function only functions with script XAS.
  # It presents the amount of items that it corresponds the use
  # of the tool. (EX - arrows when the bow is used)
  # It is necessary to define which weapon will have the item cost.
  # XASWEP_ITEM = {A=>B, A=>B, A=>B,...}
  # A = ID of the weapon.
  # B = ID of the item.
  XASWEP_ITEM = {} #{6=>8}
  #_____________________________________________________________________________
end
$xrxs = {} if $xrxs == nil
$mogscript = {} if $mogscript == nil
$mogscript["mpequip"] = true
###############
# Window_Base #
###############
class Window_Base < Window
  def draw_equip_map(item, x, y)
    if item == nil
      return
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x + 3, y + 34, bitmap, Rect.new(0, 0, 24, 24))
  end
  def draw_mequip(x, y)
    mequip = RPG::Cache.picture("Mequip")    
    cw = mequip.width
    ch = mequip.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x , y - ch + 65 ,mequip, src_rect)
  end
end
####################
# Window_Equip_Map #
####################
class Window_Equipmap < Window_Base 
  def initialize(actor)
    super(0, 0, 195, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = MOG::EQPMAPOPA
    self.windowskin = RPG::Cache.windowskin(MOG::EQPMAPSKIN)
    @actor = actor
    refresh
  end
  def refresh
    self.contents.clear
    draw_mequip(0,0)
    @data = []
    @data.push($data_weapons[@actor.weapon_id])
    @data.push($data_armors[@actor.armor1_id])
    @data.push($data_armors[@actor.armor2_id])
    @data.push($data_armors[@actor.armor3_id])
    @data.push($data_armors[@actor.armor4_id])
    draw_equip_map(@data[0], 32 * 0 +14, 0)
    draw_equip_map(@data[1], 32 * 1 +14, 0)
    draw_equip_map(@data[2], 32 * 2 +14, 0)
    draw_equip_map(@data[3], 32 * 3 +14, 0)
#    draw_equip_map(@data[4], 32 * 4, 0)
    if $xrxs["xas"] == true
      actor = $game_party.actors[0]
      weapon_id = actor.weapon_id
      weapon_item = MOG::XASWEP_ITEM[actor.weapon_id]
      if weapon_item != nil
        self.contents.font.color = Color.new(0,0,0,255)
        self.contents.font.name = "Georgia"
        self.contents.draw_text(-9, 41 , 50, 32, $game_party.item_number(weapon_item).to_s,1)
        self.contents.font.color = Color.new(255,255,255,255)
        self.contents.draw_text(-10, 40 , 50, 32, $game_party.item_number(weapon_item).to_s,1)
      end
    end
  end
end
#############
# Scene_Map #
#############
class Scene_Map
  alias mog8_main main
  def main
    @actor = $game_party.actors[0]
    @eqmap = Window_Equipmap.new(@actor)
    @eqmap.x = MOG::EQPMAPX
    @eqmap.y = MOG::EQPMAPY
    if $game_switches[MOG::EQPMAPVIS] == false
      @eqmap.visible = true
    else
      @eqmap.visible = false
    end
    mog8_main
    @eqmap.dispose
  end
  alias mog8_update update
  def update
    if $game_switches[MOG::EQPMAPVIS] == false
      @eqmap.visible = true
    else
      @eqmap.visible = false
    end
    if $eref == true
      @eqmap.refresh
      $eref = false
    end
    mog8_update
  end
end
############
# Game_Map #
############
class Game_Map
  attr_accessor :eref
end
class Interpreter
  alias mog319ref command_319
  def command_319
    $eref = true
    mog319ref
  end
  if $xrxs["xas"] == true
    alias mog126ref command_126
    def command_126
      $eref = true
      mog126ref
    end
  end
end


EDIT: Okay, I figured out it was a script below that was messing up with the Scene_Map.update. So "Change Equipment" and "Change Items" work fine now. However, I also tried adding a "def command_129" for "Change Party Members." But the HUD doesn't refresh when the commands are given. It'd be much appreciated if someone could help.

EDIT2: khmp fixed the problem in a PM, thanks.
 

khmp

Sponsor

See that global boolean is meant to ensure that the window refreshes if the equipment changes. I just opened the XAS Hero Edition which has that same HUD script in it. It works fine. It refreshes when I swap out equipment using the "Change Equipment" event command. You most likely have a script below that one that overrides Scene_Map.update. Which is preventing the equip window on the screen from updating and seeing it needs to refresh. If this isn't the case though I'll need to see a demo of the bug to help you. If you are worried about privacy feel free to PM me.
 
I see, thanks. It was a script below it that messed up the Scene_Map.update. Now the "Change Equipment" works fine.

The only problem is, "Change Party Members" still doesn't work. I've tried adding this code between command_319 and command_126:
Code:
  alias mog129ref command_129
  def command_129 # Change Party Members
    $eref = true
    mog129ref
  end

but it doesn't seem to work. Could you check if I'm doing something wrong?
 

khmp

Sponsor

That code snippet is how the method should look. As long as it's within a class definition of Interpreter. Demo then Mr. Regi?

Code:
class Interpreter
  alias mog129ref command_129
  def command_129 # Change Party Member
    $eref = true
    mog129ref
  end
  alias mog319ref command_319
  def command_319 # Change Equipment
    $eref = true
    mog319ref 
  end
end
 

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