A bug happening... For no reason... With the original code of the game?

hypershadic11

Veteran
Veteran
Joined
Nov 25, 2017
Messages
53
Reaction score
27
First Language
English
Primarily Uses
RMVXA
Okay so what... Why... I'm so confused... The line of code is this, under Game_Event line 203:

return false unless $game_switches[c.switch1_id]

Usually I'd provide more... But... This is the original code of the game!...

Script 'Game_Event' line 203: NoMethodError occurred.

undefined method '[]' for nil:NilClass

And I'm just... Wondering why? Lol...

Okay so here's the thing: I can NOT start a new game. That's what this line of code is for.. But... I can load a state?... I'm so confused someone please halp lol
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
What have you done in OTHER areas of the script?

The error message is saying $game_switches is not defined. This happens when you try to access $game_switches outside of a game - usually when you try to add your own code to do something but haven't put it into the correct class/method.

Where did you download Ace from, and how long ago?
 

hypershadic11

Veteran
Veteran
Joined
Nov 25, 2017
Messages
53
Reaction score
27
First Language
English
Primarily Uses
RMVXA
I downloaded ace from steam, a couple months ago.. Before that, I had downloaded the free trial and messed around with it, but not much else really.
I downloaded a Pokemon extension to it during the free trial... Maybe that messed with some code I guess?...
I also put some things under materials and erased it afterwards?... I mean, I thought if you erased it, it wouldn't cause any more problems...... Seeing as .... It's not there anymore lol
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
Basically something is in Materials that doesn't belong where it is now, either because you forget to erase it completely or because it is incomplete and contains bugs.
You need to find out what or where that is, because we do not know what you have added or deleted there.

I suggest you follow the link "how to use a script" in my signature and see if the explanations there help you find where you made a mistake.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
Are you SURE you erased all of it? Just double check - especially if you have any slots without names. Those are good places to look for stuff someone was "playing" with and forgot they had there.

Or just create a brand new project, then grab the scripts.rvdata2 file from that project and paste it into your current one.

Also, I think with Ace, you can make changes to scripts, then play without saving, so it would have the old version of the scripts file.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
do a project-wide search for RPG::Event and make sure no plugins are overwriting it.
you would see something like
Code:
class RPG::Event 
   <some code>
end
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
It is probably not in that class @gstv87 because it's being called when switches aren't instantiated.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
I know, but I debug one function at a time.
if Event is not affected, then it's gotta be an error before Main is even run.
going directly for debugging from Main can branch into many possibilities.

they pointed to a problem at Game_Event:203
Game_Event:203 is specifically conditions_met?()
if that is changed, then chances are Game_Event itself is changed.
better secure that the RPG:: object is safe, and then move from there.

the next step is tracking $game_switches itself, and then further down.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
it's gotta be an error before Main is even run
That's exactly what I'm thinking. It's pretty common here for people to add their own scripts and try to manipulate the $game_... objects, but because they don't put them inside the correct classes, it's trying to run their code before the $game_... objects have been instantiated.
 

hypershadic11

Veteran
Veteran
Joined
Nov 25, 2017
Messages
53
Reaction score
27
First Language
English
Primarily Uses
RMVXA
Okay, so first off... This place... Blew up holy crap, second off:
Yes, it's all deleted... Even the green text is deleted from material, which I'm pretty sure was just notes?...(Future Edit: Fixed Material itself btw, went into a new game and just copied and pasted) I think? I know a bit about code, and I know that most of the time you can just type // and then write out whatever you want without messing with the game at all... Of course that's java, but I've seen a couple others do it as well... What got me about that green text was it didn't have a // in front of it, just an =begin sign.. But then again, I also know RpgMaker uses Ruby for coding... And I know nothing about Ruby. So I might have just messed it up, I don't know...
Anyway, I opened a new game, fixed up Game_Event, made sure it was the actual code anyway... I think I messed with Game_Variables or Game_Switches a bit too... I'm gonna fix those and see if it works.
It did not work! :D
Kill me.
I also did a global search through the script editor for any plug-ins.. Looks like it really just kept to itself in one game... Because I opened both, and saw no remnants of the plug-in in my new game, where they were in the game with the plug-in anyway...
So... Life?... Yeah... Life...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,715
First Language
English
Primarily Uses
RMMV
Let's clear up a few things.

MV uses Javascript
Ace uses Ruby

// is for a comment in Javascript
# is for a comment in Ruby

If you went in and added // all over your scripts, you're definitely going to have problems.

If you haven't added any extra scripts, or you deleted all the ones you added (as far as you know) and you just want an original RTP script file, do what I already said - create a new project and copy its scripts.rvdata2 file into your existing project, overwriting the one you have there. Then don't mess with scripts if you don't know what you're doing ;)
 

hypershadic11

Veteran
Veteran
Joined
Nov 25, 2017
Messages
53
Reaction score
27
First Language
English
Primarily Uses
RMVXA
Yeah, like I said in the above reply, I already knew that it used Ruby, and that // was for java.

But I actually took a look myself and saw that it started with an = sign, which is why I already did what you suggested lol

And I never said I did a //, I was just saying that Java and a lot of other languages use that...

ANYWHO~ I finally got it working, thank goodness, and thank all of you for helping me through that nightmare lol
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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

Forum statistics

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