查看: 2351|回复: 1

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

[复制链接]
梦石
0
星屑
50
在线时间
8 小时
注册时间
2016-8-22
回帖
4
发表于 2016-8-25 08:53:28 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 翻滚的石头 于 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,在查阅了无数资料又上老站又查外网后我承认我是一个脚本白痴……
谁来帮帮我啊……
梦石
0
星屑
50
在线时间
8 小时
注册时间
2016-8-22
回帖
4
 楼主| 发表于 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 的脚本……
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部