Main Menu
  • Welcome to The RPG Maker Resource Kit.

Script Error

Started by sinjihn, February 25, 2009, 03:10:56 AM

0 Members and 1 Guest are viewing this topic.

sinjihn

Line 20 of Game_Switches

"Says: Type Error Occured
no implicit conversion from nil to interger"


Game Switches reads
[spoiler]#==============================================================================
# ** Game_Switches
#------------------------------------------------------------------------------
#  This class handles switches. It's a wrapper for the built-in class "Array."
# The instance of this class is referenced by $game_switches.
#==============================================================================

class Game_Switches
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @data = []
  end
  #--------------------------------------------------------------------------
  # * Get Switch
  #     switch_id : switch ID
  #--------------------------------------------------------------------------
  def [](switch_id)
    if @data[switch_id] == nil
      return false
    else
      return @data[switch_id]
    end
  end
  #--------------------------------------------------------------------------
  # * Set Switch
  #     switch_id : switch ID
  #     value     : ON (true) / OFF (false)
  #--------------------------------------------------------------------------
  def []=(switch_id, value)
    if switch_id <= 5000
      @data[switch_id] = value
    end
  end
end
[/spoiler]

I have never tampered with it.

The scripts I have in use:
Menu Bars
Menu Cursor
Ring Menu
Get Item window
Level up window
Message before Skill window
Equip item in battle

I deleted equip item in battle and tried again, but still got the same error so I put it back in. Help is greatly appreciated.

SolstICE

where are u when you get the error ?

sinjihn

I'll go into battle, and after the first round of action, the error pops up.

Or If I try to use a skill with my main character

modern algebra

#3
That's a weird error. Did you copy it verbatim?

Also, it is likely a compatibility error or else an oversight in one of the scripts - if you can locate which script is causing the problem then I will look into it. To do that, try just adding scripts in to a new project one by one until the error occurs. Once it does, delete all the other scripts and repeat the process. If it is jsut the single script, the error will happen immediately, if it is compatibility, it will happen once you add in the other problem script. At that time, post links to the (or both of the) problem scripts and I will take a look and see if I can fix it.

sinjihn


sinjihn

Ok, I made a new game and I copied all the scripts and everything worked fine. I changed the order around for the scripts and it worked perfectly.

Now from what I have observed, I only get the error when I try to use a skill that I have created with a battle animation I have created.


modern algebra

And that error occurs no matter what scripts are in the project? It happens in a project with no custom scripts at all?

I guess you did copy it verbatim. Sorry about that; I think I expected a different error.

sinjihn

Now im getting another error, I think i'll just recreate the project and start from square 1, noting everything that I'm doing and seeing where the error occurs.