Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by dubiousdeeds

  1. dubiousdeeds

    Variable Nil Error

    I'm running a Control Variable with the script (with x and y filled in) $game_actors[x].equips[y].id My problem is when I don't have an item equipped I get the following Nil error Script 'Game_Interpreter' line 543: NoMethodError occured. unidentified method 'id' for nil:NilClass Is there a way to just have the variable set to 0 when this checks and I have nothing equipped. Thanks.
  2. dubiousdeeds

    Variable Nil Error

    Thanks for your help I ended up with the modified script below class Game_Interpreter def armor_equip(actor,variable) num = variable.size num.times {|i| $game_variables[variable] = ($game_actors[actor].equips == nil ? 0 : $game_actors[actor].equips.id) } end end I then was able to call up a script that stored all my items as variables and had no problems with Nil armor_equip(ActorID, [1, 2, 3, 4, 5]) This gave me the outputs fro variables 1 - 5 Thanks again. This topic can be closed.
  3. dubiousdeeds

    Variable Nil Error

    Changing NilClass to 0 didn't work out. I don't quite understand your idea of an "if block". Even if I could nail down how to type that up wouldn't I still receive a NilClass instead of a 0 to set as my variable?
  4. So I'm trying to create an event that optimizes the armor my character is wearing. I've come across the script... $game_actors[1].optimize_equipments Which sort of does what I need but it optimizes everything (weapon, head, shield, etc). Does anyone know of a way to make this work on just one slot such as Body? This is being used for taking off a spacesuit. The character is required to have it on when outside the spaceship but when they come inside they have the choice of multiple outfits. So since I couldn't figure out how to just put back on the outfit that was worn previous to putting on the spacesuit (the spacesuit is equipped at anytime by the player and not forced on by an event) I figured I would just go with the best outfit. Thanks ahead for anyone who can help me with this.
  5. dubiousdeeds

    Optimize Body Armor Only

    This did the trick perfectly. Thank you so much for your speedy help with this!
  6. dubiousdeeds

    Optimize Body Armor Only

    OK, like many have said before me, "sorry for being a Newbie", but I can't seem to get this to work. So first I copied all of that into my event via a script, changed the two instances of i to 3 (since I believe 3 is the standard slot id for body"), and I received the following error... Script 'Game_Interpreter' line 1411: NameError occurred. undefined local variable or method 'equip_slots' for #<Game_Interpreter:0xcee92a4> Then I thought well maybe the first chunk from "items" to "end" should be added via the script editor and the "$" statement should be placed in my event. That didn't work because upon game start I received the following error. Script " line:1 NoMethodError occured. undefined method 'equip_items' for nil:NilClass So as you can see I greatly appreciate your help, but I may need a little more guidance on getting this to work. Should this all be placed inside my event and if so do you know why it's crashing?