Project1
标题:
关于转换2种货币的问题
[打印本页]
作者:
小源创世
时间:
2010-12-5 19:37
标题:
关于转换2种货币的问题
本帖最后由 小源创世 于 2010-12-6 13:02 编辑
关于转换货币的问题
就是说
如果10银币,马上就会转换成1金币?(自动转换哦!不是NPC那转)
2个货币都要在菜单里显示呀!?
作者:
白鬼
时间:
2010-12-5 20:10
本帖最后由 白鬼 于 2010-12-5 20:14 编辑
把NPC的货币兑换设置成自动执行,加一个条件判断:
if 银币>=10
-10银币 +1金币
循环 直到银币<10
停止循环
脚本有基础的话,你也可以把这一段+到有发生货币变化的 refresh 里面,或者 updata 里面。
Window 类脚本里面 gold 那一个,draw 一下不就好了
我很懒的……
作者:
Wind2010
时间:
2010-12-5 20:32
$小货币单位 = "银币" #你说用银币的……
$大货币单位 = "金币" #你说用金币的……
$进率 = 10
class Window_Gold < Window_Base
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
if $game_party.gold >= $进率
shiziSG = $game_party.gold % $进率
shiziBG = $game_party.gold
shiziBG -= shiziSG
shiziBG /= $进率
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-2, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
else
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120-2, 32, $game_party.gold.to_s + $小货币单位, 2)
end
end
end
class Window_ShopBuy < Window_Selectable
def draw_item(index)
item = @data[index]
# 获取物品所持数
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
# 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
# 除此之外的情况设置为无效文字色
if item.price <= $game_party.gold and number < 99
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
if item.price >= $进率
shiziSG = item.price % $进率
shiziBG = item.price
shiziBG -= shiziSG
shiziBG /= $进率
self.contents.draw_text(x + 180, y, 148, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
else
self.contents.draw_text(x + 180, y, 148, 32, item.price.to_s + $小货币单位, 2)
end
end
end
class Window_ShopNumber < Window_Base
def refresh
self.contents.clear
draw_item_name(@item, 4, 96)
self.contents.font.color = normal_color
self.contents.draw_text(272, 96, 32, 32, "×")
self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
self.cursor_rect.set(304, 96, 32, 32)
# 描绘合计价格和货币单位
domination = $data_system.words.gold
# cx = contents.text_size(domination).width
total_price = @price * @number
self.contents.font.color = normal_color
if total_price >= $进率
shiziSG = total_price % $进率
shiziBG = total_price
shiziBG -= shiziSG
shiziBG /= $进率
self.contents.draw_text(x , y, 328, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
else
self.contents.draw_text(x , y, 328, 32, total_price.to_s + $小货币单位, 2)
end
end
end
复制代码
自己刚刚写的,看看可不可以吧...
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1