09-01-2005, 01:00 PM
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
(Split gold display: Dubealex)
(Idea of the different icon depending of the amount: Jimme Reashu)
First import (or copy) the icons (gold1, ..., gold5) and replace the script Window_Gold...
Code:
#==============================================================================
# ■ Window_Gold
#------------------------------------------------------------------------------
# ゴールドを表示するウィンドウです。
#==============================================================================
class Window_Gold < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Gold" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
end
end
...with that:
Code:
#-----------------------------------------------------------------
class Window_Gold < Window_Base
#-----------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.font.size = $defaultfontsize
self.contents.font.name = $defaultfonttype
refresh
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
if $game_party.gold < 1
icon = RPG::Cache.icon("")
elsif $game_party.gold < 100
icon = RPG::Cache.icon("gold1")
elsif $game_party.gold < 250
icon = RPG::Cache.icon("gold2")
elsif $game_party.gold < 500
icon = RPG::Cache.icon("gold3")
elsif $game_party.gold < 1000
icon = RPG::Cache.icon("gold4")
else
icon = RPG::Cache.icon("gold5")
end
gold = $game_party.gold.to_s
unless gold.size > 4
money = gold
else
case gold.size
when 5
ary = gold.slice!(0,2)
money = ary + ","+ gold
when 6
ary = gold.slice!(0,3)
money = ary + ","+ gold
when 7
ary1 = gold.slice!(0,4)
ary2 = ary1.slice!(1,4)
money = ary1 + ","+ ary2 +","+ gold
end
end
self.contents.draw_text (0,0,104,32,money.to_s,2)
self.contents.blt(104,5,icon, Rect.new(0,0,24,24))
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
Note: If you use a different gold window in other script (like a custom menu) copy my script into it.