RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Getting an error when setting an item-based variable

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 40
Chronically Spontaneous
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 :)
Spoiler for Current Project:
Chrononauts V: The Time Between Moments
[Working Title]
The first and final game in the epic Chrononauts series

Survived the kraaken and weeaboos. No power at home. Back when I learn to fix the electricity.

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Biggest Drama Whore2013 Zero to HeroParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Do you get the error when you try to store the variable, or when you try to pull it?
&&&&&&&&&&&&&&&&

**
Rep: +0/-0Level 40
Chronically Spontaneous
Storing it. I've tried an event that only has that one line in it, and it's giving me the same result D:
Spoiler for Current Project:
Chrononauts V: The Time Between Moments
[Working Title]
The first and final game in the epic Chrononauts series

Survived the kraaken and weeaboos. No power at home. Back when I learn to fix the electricity.

*
Rep:
Level 84
Rubber Shark
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]]