"Control Variables" Event Crashing Game

● ARCHIVED · READ-ONLY
Started by CeladonneSpero 4 posts View original ↗
  1. I'm a new user to this, so I'm sorry if this is a simple fix or a problem with how I'm understanding something. While trying to make a bank, I found that I needed to store the current gold as a variable so that I could determine whether the amount that the player wanted to deposit is less than the amount that they currently had. The problem is that when I try to use the control variable option in the event creator to set a variable to the current gold value, and then speak to that person in-game, the game crashes with this error:

    Script 'Game_Interpreter' line 649: NoMethoddError occurred.

    undefined method '[]='for #<Game_Variables0x8baa970 @data=[]>

    I'm not familiar with the language in the script, but there seems to be an error in that section where the event references. Is this a common problem? Is there some way to fix it or am I understanding the function of the Control Variables option wrong?
  2. Does this happen with a new project?
  3. Surprisingly, no. I copied my bank event directly into a new project and it works perfectly. I don't think I changed anything in the script that would cause this- is there a simple way to replace the script in my original project with my script in the new project?

    Edit: Never mind. I just found the script file in the clean project and replaced the old one, and that seems to have worked fine. Thanks for the help. :)
  4. Ah yes, I was going to recommend that. If a clean project works, you're either using a custom script that is producing the error, or somehow the original scripts got corrupted, So it's a good idea to copy them over, or to remove the custom script causing the error. Glad you figured it out yourself though!

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.