The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: Space on August 26, 2013, 05:26:29 PM

Title: [VX] Getting an error when setting an item-based variable
Post by: Space on August 26, 2013, 05:26:29 PM
I have an event that's supposed to change depending on how much <item name>s the player has in his inventory and it's causing an error in one of the main scripts.
I'm getting it no matter what I set the item to, whether it's an RTP item or a custom one.

Spoiler for Error details:
The Error:
Quote
Script 'Game Interpreter' line 750: NoMethodError occurred.
undefined method '[]' for nil:NilClass

The line referenced:
Code: [Select]
    when 3  # Item
      value = $game_party.item_number($data_items[@params[4]])
      actor = $game_actors[@parameters[1]]  #THIS ONE
      actor = $game_actors[@params[4]]


The event command causing the error:
Code: [Select]
@>Control Variables: [0015: Milk Possessed] = [Milk] in Inventory

Spoiler for Scripts I'm using that affect items:
Jet's Percentage of Damage Snippet
KGC's Equipment Effects
Modern Algebra's Skill Teaching Equipment & Items
Modern Algebra's Cursed Equipment
KGC's Restored Combat Functions

Any help solving this will be hugely appreciated :)
Title: Re: [VX] Getting an error when setting an item-based variable
Post by: &&&&&&&&&&&&& on August 26, 2013, 05:54:39 PM
Do you get the error when you try to store the variable, or when you try to pull it?
Title: Re: [VX] Getting an error when setting an item-based variable
Post by: Space on August 26, 2013, 06:09:25 PM
Storing it. I've tried an event that only has that one line in it, and it's giving me the same result D:
Title: Re: [VX] Getting an error when setting an item-based variable
Post by: Yeyinde on August 30, 2013, 10:12:36 PM
Replace that one line with "when 4".  The error is actually a bug with the default scripts in VX.  It should look like this:

Code: [Select]
    when 3  # Item
      value = $game_party.item_number($data_items[@params[4]])
    when 4  # Actor
      actor = $game_actors[@params[4]]