RPG Maker VX Ace中的RGSS-

时间:2016-11-13 21:31:26

标签: ruby

我一直在为RPG Maker VX Ace使用一包脚本,纹理和音频,称为Pokémonfor Ace。我一直在成功修复一些错误,但这个我无法修复。 我在控制台中收到此错误:

Item Effects:216:in `block in extra_evs': private method `extra_evs' called for nil:NilClass (NoMethodError)
    from Item Effects:216:in `each'
    from Item Effects:216:in `inject'
    from Item Effects:216:in `extra_evs'
    from Pokémon Battle System:4403:in `block (3 levels) in process_action_end'
    from Pokémon Battle System:4392:in `each'
    from Pokémon Battle System:4392:in `block (2 levels) in process_action_end'
    from Pokémon Battle System:4379:in `each'
    from Pokémon Battle System:4379:in `block in process_action_end'
    from Pokémon Battle System:4373:in `each'
    from Pokémon Battle System:4373:in `process_action_end'
    from Mega Evolution:453:in `process_action'
    from Scene_Battle:48:in `update'
    from Pokedex:1746:in `update'
    from Party Dying Battle BGM:130:in `update'
    from Scene_Base:14:in `main'
    from MOG_Weather_EX:694:in `main'
    from Graphical Object Global Reference:201:in `main'
    from Video Player:153:in `run'
    from Map Screenshot:971:in `run'
    from Screenshot taker:215:in `run'
    from Main:12:in `block in <main>'

以下是产生错误的部分的代码:

class Game_Battler < Game_BattlerBase
    attr_accessor :attacking_item
  attr_accessor :captured
    def extra_evs(stat)
        equips.inject(0) {|r, equip| r += equip.extra_evs(stat)}
    end

1 个答案:

答案 0 :(得分:0)

您的equips数组包含零值。检查它的分配位置。

对于脏修复,请尝试equips.compact.inject(0) {|r, equip| r += equip.extra_evs(stat)}