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

Project1

 找回密码
 注册会员
搜索
查看: 1456|回复: 1

[已经解决] 改了个打折脚本然而nil can't be coerced into fixnum

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2016-8-22
帖子
5
发表于 2016-8-25 08:53:28 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 翻滚的石头 于 2016-8-25 08:56 编辑

#-------------------------------------------------------------------------------
#--------打折技能制作,任意队伍成员习得该技能后即可在商店购买物品时享受折扣
#--------by crow2006   from 66RPG-----------------------------------------------
#--------20160816---------------------------------------------------------------
module RPG
  $discount1 = $game_variables_1 #此处设置打折的百分比 打七五折就填75
  class Item
    def price
      return Integer(@price * $discount1 / 100)
      return @price
     end
  end

  class Weapon
    def price
      return Integer(@price * $discount1 / 100)
      return @price
     end
  end  

  class Armor
    def price
      return Integer(@price * $discount1 / 100)
      return @price
     end
  end
end

原贴是https://rpg.blue/forum.php?mod=v ... &extra=page%3D1
里面的脚本是根据技能是否学习来判断是否打折的,想要改成用一个变量指定打折程度.
然而第九行nil can't be coerced into fixnum,在查阅了无数资料又上老站又查外网后我承认我是一个脚本白痴……
谁来帮帮我啊……

Lv1.梦旅人

梦石
0
星屑
50
在线时间
8 小时
注册时间
2016-8-22
帖子
5
 楼主| 发表于 2016-8-25 08:59:38 | 显示全部楼层
自己解决了……
#-------------------------------------------------------------------------------
#--------打折技能制作,任意队伍成员习得该技能后即可在商店购买物品时享受折扣
#--------by crow2006   from 66RPG-----------------------------------------------
#--------20160816---------------------------------------------------------------
module RPG
  class Item
    def price
      return Integer(@price * $game_variables[1] / 100)
      return @price
     end
  end

  class Weapon
    def price
      return Integer(@price * $game_variables[1] / 100)
      return @price
     end
  end  

  class Armor
    def price
      return Integer(@price * $game_variables[1] / 100)
      return @price
     end
  end
end
感谢@crow2006 的脚本……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 16:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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