I am having a problem with the script that I downloaded from the tutorial off of this site for RPG Maker VX Ace, the game crashes and give me this message "Script Line 37; No Method Error occurred, undefined method '[]' for nil:NilClass" every time i land a hit or am hit in battle. I have no idea how to fix this problem, so any help would be greatly appreciated.
Error with Tutorial Script
RGSSx Script SupportPlease link the script; we need to know what script it is for that line number and error message to have any meaning 🙂
Or search. This question has been asked and answered probably a dozen times already.
Here is the script that I downloaded and thank you for the quick reply and help
class RPG::Skill
def self_effects
if @self_effects.nil?
@self_effects = []
self.note.each_line {|a|
scan = a.scan(/<self[ ]*effect[ ]*\:[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i)
scan[0][0].scan(/\d+/).each {|b|
@self_effects.push(@effects[b.to_i - 1]) if b.to_i >= 1
}
}
end
@self_effects
end
end
class Game_Battler
alias jet3745_item_effect_apply item_effect_apply
def item_effect_apply(user, item, effect, reffed = false)
if item.is_a?(RPG::Skill) && item.self_effects.include?(effect) && !reffed
user.item_effect_apply(user, item, effect, true)
return
end
jet3745_item_effect_apply(user, item, effect)
end
end
class RPG::Skill
def self_effects
if @self_effects.nil?
@self_effects = []
self.note.each_line {|a|
scan = a.scan(/<self[ ]*effect[ ]*\:[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i)
scan[0][0].scan(/\d+/).each {|b|
@self_effects.push(@effects[b.to_i - 1]) if b.to_i >= 1
}
}
end
@self_effects
end
end
class Game_Battler
alias jet3745_item_effect_apply item_effect_apply
def item_effect_apply(user, item, effect, reffed = false)
if item.is_a?(RPG::Skill) && item.self_effects.include?(effect) && !reffed
user.item_effect_apply(user, item, effect, true)
return
end
jet3745_item_effect_apply(user, item, effect)
end
end
Link to the script, please - don't just paste it. You also haven't provided the whole script. The error says line 37. That snippet you posted doesn't have 37 lines. And can you provide the EXACT error message? What you've got above has no script name - so either you haven't posted the complete error message, or you're not naming your scripts (which could mean it's not even an issue IN the script above, but a different one entirely).
Also, this should be in its own thread, since it's a question specific to a script you've downloaded. So I'll split these posts out.
Anyway, as I already said (and you must have missed, because you still didn't search), this has been asked and answered several times. Since you didn't, I took the liberty of typing "error with tutorial script" in the forum search box. At least 4 threads clearly indicate people are asking about the same error. Here's one of them:
http://forums.rpgmakerweb.com/index.php?/topic/6955-jets-self-effects-script-error/
Do what it says there, and your problem should go away.
Also, this should be in its own thread, since it's a question specific to a script you've downloaded. So I'll split these posts out.
Anyway, as I already said (and you must have missed, because you still didn't search), this has been asked and answered several times. Since you didn't, I took the liberty of typing "error with tutorial script" in the forum search box. At least 4 threads clearly indicate people are asking about the same error. Here's one of them:
http://forums.rpgmakerweb.com/index.php?/topic/6955-jets-self-effects-script-error/
Do what it says there, and your problem should go away.
Original thread: https://forums.rpgmakerweb.com/threads/error-with-tutorial-script.21570/