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.

[Resolved]A Seperate window to show treasures when battle ends.

Status
Not open for further replies.
I want to know how to have a seperate window for showing treasures apart from exp. and gold without having an argumenterror. I made a new class Window_Treasures copying everything regarding treasures from the BattleResult Window and tried adding @treasure_window = Window_Treasures.new(treasures) after @result_window = Window_BattleResult.new(exp, gold), and it said there was a wrong number of arguements (1 for 4). I even tried adding the @treasure_window without the (treasures) part, but then it said wrong number of arguments (0 for 4).
Anyone know how I can fix this?



Long description:sleepy01:
 
Alright here are the codes I've modified. I'm using the class job script by Prexus and your additional items script. Ignore the window coordinates, because I'm just trying to test and see if it works.

Window_BattleResult
Code:
class Window_BattleResult < Window_Base
def initialize(exp, gold)
  @exp = exp
  @gold = gold
  super(0, 0, 640, 192)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.visible = false
  refresh
end
def refresh
  self.contents.clear
  self.contents.font.color = system_color
  self.contents.draw_text(4, 0, 128, 32, "Gold:")
  self.contents.draw_text(4, 64, 128, 32, "EXP:")
  self.contents.draw_text(4, 96, 128, 32, "C-EXP:")
  self.contents.draw_text(4, 128, 128, 32, "P-EXP:")
  self.contents.font.color = normal_color
  self.contents.draw_text(4, 0, 128, 32, @gold.to_s, 2)
  self.contents.draw_text(4, 64, 128, 32, @exp.to_s, 2)
  self.contents.draw_text(4, 96, 128, 32, (@exp*0.75).floor.to_s, 2)
  self.contents.draw_text(4, 128, 128, 32, (@exp*0.5).floor.to_s, 2)
  self.contents.font.color = system_color
  end
end

Window_Treasures
Code:
class Window_Treasures
  def initialize
    @treasures = treasures
      super(0, 0, 192, 192)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.visible = false
  refresh
end
def refresh
  self.contents.clear
  self.contents.font.color = system_color
  self.contents.draw_text(164, 0, 128, 32, "Items Found:")
  self.contents.font.color = system_color
  y = 32
  for item in @treasures
    draw_item_name(item, 164, y)
    y += 32
     end
end
end

Part in Scene_Battle where error occurs:
Code:
   for item in treasures
     case item
     when RPG::Item
       $game_party.gain_item(item.id, 1)
     when RPG::Weapon
       $game_party.gain_weapon(item.id, 1)
     when RPG::Armor
       $game_party.gain_armor(item.id, 1)
     end
   end
   [COLOR=Red] @treasure_window = Window_Treasures.new[/COLOR]
   @result_window = Window_BattleResult.new(exp, gold)

There you go.
 
You could save yourself a seperate window by working through my window tutorial (link in signature) and just overlay the normal window with two dummy windows... no need to change anything besides the y-value of the treasures.
 
This topic has been resolved. If RMdude333 or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
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