本帖最后由 喵呜喵5 于 2013-9-7 15:31 编辑
关于你的第二个问题,把脚本改成这样就好了
sprintf("%03d贯%03d文",value/1000, value % 1000)
sprintf("%03d贯%03d文",value/1000, value % 1000)
当然,我个人是喜欢这么来显示,你可以试试看(把脚本插到main以上你的脚本以下就可以了)
=begin =============================================================================== 元角分 By喵呜喵5 =============================================================================== 【说明】 把金钱的显示方式修改成了XX元XX角XX分这样的形式 =end module M5Money #============================================================================== # 设定部分 #============================================================================== RATE = 10 #设定进制,例如10分=1角、10角=1元的时候就把上方的数字设置成10 FEN = "分" #设定游戏中1G所对应的单位,默认获得1G即获得1分钱 JIAO = "角" #设定游戏中1G*RATE所对应的单位 YUAN = "元" #设定游戏中1G*RATE*RATE所对应的单位 #============================================================================== # 设定结束 #============================================================================== #============================================================================== # 脚本部分 #============================================================================== end class Window_Gold < Window_Base def refresh contents.clear draw_currency_value("",m5_gain_gold($game_party.gold),4, 0, contents.width - 8) end def m5_gain_gold(gold) yuan = gold / ( M5Money::RATE * M5Money::RATE) val = (yuan == 0 ? "" : yuan.to_s + M5Money::YUAN ) jiao = (gold / M5Money::RATE) % M5Money::RATE val += (jiao == 0 ? "" : jiao.to_s + M5Money::JIAO ) fen = gold % ( M5Money::RATE ) val += fen.to_s + M5Money::FEN end end class << BattleManager def gain_gold if $game_troop.gold_total > 0 gold = $game_troop.gold_total yuan = gold / ( M5Money::RATE * M5Money::RATE) val = (yuan == 0 ? "" : yuan.to_s + M5Money::YUAN ) jiao = (gold / M5Money::RATE) % M5Money::RATE val += (jiao == 0 ? "" : jiao.to_s + M5Money::JIAO ) fen = gold % ( M5Money::RATE ) val += fen.to_s + M5Money::FEN text = '获得了' + val $game_message.add('\.' + text) $game_party.gain_gold($game_troop.gold_total) end wait_for_message end end
=begin
===============================================================================
元角分 By喵呜喵5
===============================================================================
【说明】
把金钱的显示方式修改成了XX元XX角XX分这样的形式
=end
module M5Money
#==============================================================================
# 设定部分
#==============================================================================
RATE = 10
#设定进制,例如10分=1角、10角=1元的时候就把上方的数字设置成10
FEN = "分"
#设定游戏中1G所对应的单位,默认获得1G即获得1分钱
JIAO = "角"
#设定游戏中1G*RATE所对应的单位
YUAN = "元"
#设定游戏中1G*RATE*RATE所对应的单位
#==============================================================================
# 设定结束
#==============================================================================
#==============================================================================
# 脚本部分
#==============================================================================
end
class Window_Gold < Window_Base
def refresh
contents.clear
draw_currency_value("",m5_gain_gold($game_party.gold),4, 0,
contents.width - 8)
end
def m5_gain_gold(gold)
yuan = gold / ( M5Money::RATE * M5Money::RATE)
val = (yuan == 0 ? "" : yuan.to_s + M5Money::YUAN )
jiao = (gold / M5Money::RATE) % M5Money::RATE
val += (jiao == 0 ? "" : jiao.to_s + M5Money::JIAO )
fen = gold % ( M5Money::RATE )
val += fen.to_s + M5Money::FEN
end
end
class << BattleManager
def gain_gold
if $game_troop.gold_total > 0
gold = $game_troop.gold_total
yuan = gold / ( M5Money::RATE * M5Money::RATE)
val = (yuan == 0 ? "" : yuan.to_s + M5Money::YUAN )
jiao = (gold / M5Money::RATE) % M5Money::RATE
val += (jiao == 0 ? "" : jiao.to_s + M5Money::JIAO )
fen = gold % ( M5Money::RATE )
val += fen.to_s + M5Money::FEN
text = '获得了' + val
$game_message.add('\.' + text)
$game_party.gain_gold($game_troop.gold_total)
end
wait_for_message
end
end
|