RPG Maker Forums

I have the following code snippet that seems to cause problems

Code:
def check_daily_tasks
      cooked       = $game_variables[29]
      cooked_miss  = $game_variables[28]
      cleaned      = $game_variables[31]
      cleaned_miss = $game_variables[30]
      cooked_miss  += 2 - cooked
      cleaned_miss += 1 - cleaned
      $game_variables[28] = cooked_miss
      $game_variables[30] = cleaned_miss
      $game_variables[29] = 0
      $game_variables[31] = 0
  end
Everytime it gets called I get the follwoing error:


"Script 'Time' line 49: NoMethodError occured. undefined method `[]=' for 0:Fixnum"


Line 49 is this one:

Code:
$game_variables[28] = cooked_miss
I'm not using any other scripts. All the variables are local variables that are declared in that method. There must be some kind of Syntax error that I don't understand. Can anybody help me figure out what is going wrong here?


Edit: Nevermind, I found my mistake. I accidentally set the whole $game_variables array to 0 in the method from which I was calling the above method, because I forgot the square brackets. Thread can be locked, or marked as solved, or whatever happens in this forum when things get resolved.

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,551
Members
137,837
Latest member
Dabi
Top