设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1720|回复: 2
打印 上一主题 下一主题

[已经解决] 关于转换2种货币的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
97 小时
注册时间
2010-10-16
帖子
175
跳转到指定楼层
1
发表于 2010-12-5 19:37:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 小源创世 于 2010-12-6 13:02 编辑

关于转换货币的问题
就是说
如果10银币,马上就会转换成1金币?(自动转换哦!不是NPC那转)
2个货币都要在菜单里显示呀!?

点评

如果满意请认可。  发表于 2010-12-5 21:01
插入到main前,你会的  发表于 2010-12-5 20:38

Lv3.寻梦者

梦石
0
星屑
1733
在线时间
484 小时
注册时间
2006-1-7
帖子
1073
2
发表于 2010-12-5 20:10:49 | 只看该作者
本帖最后由 白鬼 于 2010-12-5 20:14 编辑

把NPC的货币兑换设置成自动执行,加一个条件判断:
if 银币>=10
   -10银币 +1金币
循环 直到银币<10
停止循环

脚本有基础的话,你也可以把这一段+到有发生货币变化的 refresh 里面,或者 updata 里面。

Window 类脚本里面 gold 那一个,draw 一下不就好了

我很懒的……

点评

其实我也在写……刚刚搞定菜单,还有商店什么的……  发表于 2010-12-5 20:15
初从文,三年不中;后习武,校场发一矢,中鼓吏,逐之出;遂学医,有所成。自撰一良方,服之,卒。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
3
发表于 2010-12-5 20:32:29 | 只看该作者
  1. $小货币单位 = "银币" #你说用银币的……
  2. $大货币单位 = "金币" #你说用金币的……
  3. $进率 = 10
  4. class Window_Gold < Window_Base
  5.   def refresh
  6.     self.contents.clear
  7.     cx = contents.text_size($data_system.words.gold).width
  8.     if $game_party.gold >= $进率
  9.       shiziSG = $game_party.gold % $进率
  10.       shiziBG = $game_party.gold
  11.       shiziBG -= shiziSG
  12.       shiziBG /= $进率
  13.       self.contents.font.color = normal_color
  14.       self.contents.draw_text(4, 0, 120-2, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
  15.     else
  16.       self.contents.font.color = normal_color
  17.       self.contents.draw_text(4, 0, 120-2, 32, $game_party.gold.to_s + $小货币单位, 2)
  18.     end
  19.   end
  20. end

  21. class Window_ShopBuy < Window_Selectable
  22.   def draw_item(index)
  23.     item = @data[index]
  24.     # 获取物品所持数
  25.     case item
  26.     when RPG::Item
  27.       number = $game_party.item_number(item.id)
  28.     when RPG::Weapon
  29.       number = $game_party.weapon_number(item.id)
  30.     when RPG::Armor
  31.       number = $game_party.armor_number(item.id)
  32.     end
  33.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通文字颜色
  34.     # 除此之外的情况设置为无效文字色
  35.     if item.price <= $game_party.gold and number < 99
  36.       self.contents.font.color = normal_color
  37.     else
  38.       self.contents.font.color = disabled_color
  39.     end
  40.     x = 4
  41.     y = index * 32
  42.     rect = Rect.new(x, y, self.width - 32, 32)
  43.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  44.     bitmap = RPG::Cache.icon(item.icon_name)
  45.     opacity = self.contents.font.color == normal_color ? 255 : 128
  46.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  47.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  48.     if item.price >= $进率
  49.       shiziSG = item.price % $进率
  50.       shiziBG = item.price
  51.       shiziBG -= shiziSG
  52.       shiziBG /= $进率
  53.       self.contents.draw_text(x + 180, y, 148, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
  54.     else
  55.       self.contents.draw_text(x + 180, y, 148, 32, item.price.to_s + $小货币单位, 2)
  56.     end
  57.   end
  58. end

  59. class Window_ShopNumber < Window_Base
  60.   def refresh
  61.     self.contents.clear
  62.     draw_item_name(@item, 4, 96)
  63.     self.contents.font.color = normal_color
  64.     self.contents.draw_text(272, 96, 32, 32, "×")
  65.     self.contents.draw_text(308, 96, 24, 32, @number.to_s, 2)
  66.     self.cursor_rect.set(304, 96, 32, 32)
  67.     # 描绘合计价格和货币单位
  68.     domination = $data_system.words.gold
  69.     # cx = contents.text_size(domination).width
  70.     total_price = @price * @number
  71.     self.contents.font.color = normal_color
  72.     if total_price >= $进率
  73.       shiziSG = total_price % $进率
  74.       shiziBG = total_price
  75.       shiziBG -= shiziSG
  76.       shiziBG /= $进率
  77.       self.contents.draw_text(x , y, 328, 32, shiziBG.to_s + $大货币单位 + shiziSG.to_s + $小货币单位, 2)
  78.     else
  79.       self.contents.draw_text(x , y, 328, 32, total_price.to_s + $小货币单位, 2)
  80.     end
  81.   end
  82. end
复制代码
自己刚刚写的,看看可不可以吧...

点评

您在帮我看一下....我想要在菜单显示:XX银币 XX金币 也就是中间要有个空格,金币在右边...还想请教一下...怎么将银币或金币加上图片?  发表于 2010-12-6 12:54
怎么用?  发表于 2010-12-5 20:37

评分

参与人数 2星屑 +334 收起 理由
小源创世 + 2 只能评1...呃....
fux2 + 332 认可答案

查看全部评分


http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 14:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表