Need help with an error please.

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
Hey there gang. I have been getting a seemingly random crash in battle. I understand most of the error code but it references a .json.parse () and that is throwing me off I was hoping some could help me with this one. My MV is version 1.6.2. I'll post an image of the error below.

Big thanks for taking a look.

2.jpg
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
A JSON.parse() error usually means invalid source, so note tags or damage formula maybe. That it's being called by makeDeepCopy and the actionSettings could help you to identify where it's being triggered. Can you narrow down an actor or enemy, and a skill or item that applies to the current turn (if the crash happens mid-turn), or that might be getting set up for the next person's turn?
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
Big thanks @Shaz Now I have a good lead. I believe I will be able to find the error now. You rock. :smile:
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,190
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
I also suggest you check the error message in the console.

Yanfly's modified error screen is much better than the original error screen, but it does not transfer all data that is on the console, only most of it.
The full console should give you additional info as to which json file was called and so on.
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
I also suggest you check the error message in the console.

Yanfly's modified error screen is much better than the original error screen, but it does not transfer all data that is on the console, only most of it.
The full console should give you additional info as to which json file was called and so on.
When I took the pic of the crash I was playing on a deployed version so I couldn't bring up the console unfortunately. I tend to leave the console closed these days as it causes massive battle lag for me but thanks for pointing that out. I will try and get it to crash with the console open.

My problem has been I haven't been able to get it to crash again. I am doing the same battle over and over under the same situations but so far nothing. The battle unfortunately has many random aspects to it so it isn't that odd that I haven't gotten it to reappear yet.

I have looked through all my skills with formulas and checked the note boxes of them but I have found nothing out of place. From my crash message I take this:
unexpected u token in json at position 0
To mean there is a U in the very first position of say either the formula or note box that shouldn't be there or perhaps is missing something like a < in front of it.

If anyone can confirm that is correct I would really appreciate it. And a big thanks for the help I have already gotten. :smile:
 
Last edited:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
So I just had a bit of a search around for this error message, and found a few other threads with similar errors, but using different plugins, as well as a bit of stuff out there in the big wide world. None of it is conclusive, but a few things were mentioned that might be relevant.

You said your MV version is 1.6.2, but what about your project version? Is this a new project that you created since getting 1.6.2 or is it an older one? You can tell by opening your project folder and going into the js folder and looking at the rpg_core.js file - the version number will be clearly visible on the first couple of lines (if you don't have a version number within the first 5 lines, you're probably using 1.0.0)

Are your Yanfly plugins all in the correct order, which is the order they're listed on Yanfly's master plugin list?

Do you have other plugins? Can you show a screenshot of your plugin manager (multiple screenshots if one isn't enough to show them all)?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,190
Reaction score
6,758
First Language
German
Primarily Uses
RMMV
get it to crash with the console open
no need to keep it open, you can still get the same messages if you only open it after the error message appears.
and you should be able to open it even in deployed version by following the browser menu structure to the developer tools if the F8 button does not work.
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
@Shaz I am fully updated to 1.6.2 and the plugins are in the correct order. I even ran a plugin that checks their order to make sure they are right. I use most of Yanflys plugins and a handfull of others I'll post some pics below.

@Andar Yeah I wasn't able to open the console after the crash with f8 but I never thought about opening it in a browser. That is great to know.

Thank you both for your help here, you have already helped a great deal. :smile:
 

Attachments

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,438
Reaction score
924
First Language
EN
Primarily Uses
RMMV
Previously when I've encountered this "JSON.parse token u at position 0" error, it has meant that something tried to JSON.parse(undefined). Given that line 2015 of Yanfly's Battle Engine Core seems to be this:
JavaScript:
      action: JsonEx.makeDeepCopy(this._action),
...I would suspect that the error is due to BattleManager._action being undefined. This is possible if the battler in question is immobilised, since in that case their action queue will be empty and the first action undefined. :kaoback:

Maybe try applying a permanent stun (just for testing) to whoever you think is undergoing the force action to see if that is a problem?
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
Previously when I've encountered this "JSON.parse token u at position 0" error, it has meant that something tried to JSON.parse(undefined). Given that line 2015 of Yanfly's Battle Engine Core seems to be this:
JavaScript:
      action: JsonEx.makeDeepCopy(this._action),
...I would suspect that the error is due to BattleManager._action being undefined. This is possible if the battler in question is immobilised, since in that case their action queue will be empty and the first action undefined. :kaoback:

Maybe try applying a permanent stun (just for testing) to whoever you think is undergoing the force action to see if that is a problem?
Hey there and thanks for replying, it sounds like you're on to something here. I just tried some battles where I kept the enemies perma stunned. So far nothing has happened but the battle that it crashed on has 12 random different enemies with up around 7 different skills each so I might not have gotten lucky yet.

If I'm understanding you right, if the enemy is stunned the game will crash if they try the skill or what ever is crashing the game. There are common events that the enemy might try to run as well.

You also mentioned Force Action. Any chance you mean one that I set with the force action command or on the regular game runs. I haven't used a lot of force actions so that would narrow it down some.

This would be so much easier if I could reproduce the dang crash. :smile:
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
Instead of letting it be random, create new troops with the same enemies, but make them not random anymore. Try them one at a time until the issue happens. Don't use Battle Test from the Troops tab, because some plugins don't load all their stuff unless you're doing a proper play test.
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
Instead of letting it be random, create new troops with the same enemies, but make them not random anymore. Try them one at a time until the issue happens. Don't use Battle Test from the Troops tab, because some plugins don't load all their stuff unless you're doing a proper play test.
Good thinking I'll give that a try. Still no luck, Dang I wish I would have got the
consoles crash report. I really thank you for the help. :smile:
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
I can confirm it is coming from a Force Action event command - either in your troop event, or one of the common events.
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
I can confirm it is coming from a Force Action event command - either in your troop event, or one of the common events.
Ok that definitely helps. And I also just discovered that ctrl F works in mv, this is an amazing discovery for me. :smile:

I've done some searching around and I found this in a skills, state that I believe I had used at the time of the crash.

// Queue the forced action.
BattleManager.queueForceAction(user, skill, target);

It's part of a standard jump in the air for a turn styled attack. It seems like this is likely the culprit now what do I do about it hehe.:smile: I'd like to keep the skill but if it's faulty I would rather not have a crash.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,438
Reaction score
924
First Language
EN
Primarily Uses
RMMV
I've done some searching around and I found this in a skills, state that I believe I had used at the time of the crash.

// Queue the forced action.
BattleManager.queueForceAction(user, skill, target);

It's part of a standard jump in the air for a turn styled attack. It seems like this is likely the culprit now what do I do about it hehe.:smile: I'd like to keep the skill but if it's faulty I would rather not have a crash.
It might help to have more context: is that in a notetag? If so, what notetag, and which plugin? When you say "a standard jump...attack" do you mean like this, and if so what is your "Jump" state's removal timing (action end or turn end)? :kaoswt2:

There could be other reasons for an empty action queue, e.g. if they've already completed their action phase this turn. Since this "remember previous action" thing is introduced by Yanfly's Battle Engine Core, I think the most effective solution would be to patch that plugin somehow. It would be best to try to reliably reproduce the problem first, though: that way you can be much more certain that any fix you find actually does (or doesn't) work. :kaopride:

I came up with something that might solve the problem (just theory, I haven't tested it). Save the following code as a .js file (Save As > File Type: All Files, Filename: whateverYouLike.js), import as a plugin, and make sure to load it immediately after Battle Engine Core in the Plugin Manager~
JavaScript:
// Place immediately below YEP_BattleEngineCore in the Plugin Manager

// Override - "no action" failsafe to avoid JSON.parse failure
BattleManager.setPreForceActionSettings = function() {
  return {
    subject: this._subject,
    action: this._action ? JsonEx.makeDeepCopy(this._action) : undefined,  // <- edit 1 of 1
    actionList: JsonEx.makeDeepCopy(this._actionList),
    targets: this._targets.slice(),
    allTargets: this._allTargets.slice(),
    indTargets: this._individualTargets.slice(),
    phaseSteps: JsonEx.makeDeepCopy(this._phaseSteps),
    returnPhase: this._returnPhase,
    phase: this._phase,
    conditionFlags: JsonEx.makeDeepCopy(this._conditionFlags),
    trueFlags: JsonEx.makeDeepCopy(this._trueFlags)
  }
};

// Override - do not restore "no action"
BattleManager.loadPreForceActionSettings = function() {
    var settings = this._forceActionQueue[0];
    if (settings) {
      this._forceActionQueue.shift();
      if (!settings.action) return false;  // <- edit 1 of 1
      this.resetPreForceActionSettings(settings);
      return this._subject && this._subject.isAppeared();
    } else {
      return false;
    }    
};
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
Whoops sorry @caethyril, yeah that is in a state notetag box. It uses a couple yanfly plugins namely the action sequence ones, Battle core Selection Core and Buffs/States Core. The state removal happens at the turns end. And yep that is that jump skill I use that you linked.

And Wow, huge thanks for putting together that javascript. :smile: I have it added to the game now I will do a bunch of testing to see what I can come up with. That is amazing that you put the js together thank you so much.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
I wonder if your actions cost MP, and your enemy has run out? With the default battle system, this will just stop them using any skills, so they'll use the basic attack all the time. But for the plugin, perhaps it makes them unable to use the skill, but maybe doesn't cater for that possibility.

Was it a battle that had been going on for a little while?

I normally make all my enemy skills cost 0, so the enemy never runs out of MP and reverts to attack.

If you think this is a possibility, it would be easy to test out - just give the enemy a very low amount of MP, then ensure that force action command is run.
 

Jeremiah Eastman

Gladiator
Veteran
Joined
Apr 24, 2017
Messages
480
Reaction score
260
First Language
English
Primarily Uses
RMMV
I wonder if your actions cost MP, and your enemy has run out? With the default battle system, this will just stop them using any skills, so they'll use the basic attack all the time. But for the plugin, perhaps it makes them unable to use the skill, but maybe doesn't cater for that possibility.

Was it a battle that had been going on for a little while?

I normally make all my enemy skills cost 0, so the enemy never runs out of MP and reverts to attack.

If you think this is a possibility, it would be easy to test out - just give the enemy a very low amount of MP, then ensure that force action command is run.
Hmm, I hadn't thought about this as a possible issue. The battle it crashed on however was still in the first few turns I believe, so they shouldn't have had an issue. However I will go through and check out the enemies MP to make sure they have enough. I didn't realize that that could cause an issue, I have skills that damage the enemies MP so maybe I need to get rid of that aspect to make sure nothing can go wrong from running out of MP.

Thanks for pointing that out. So far I still haven't been able to reproduce the dang crash, problems can never be simple fixes can they. :smile:
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,453
Reaction score
12,014
First Language
English
Primarily Uses
RMMV
If you don't want them to run out of MP, just make your enemy skills cost 0 MP. Then, of course, there's not really any point in having skills that damage the enemy's MP, because it won't have any effect.

Note - I don't know that running out of MP is something that would cause this issue. It is just another possibility to consider, if you are still no closer to a solution. It would just be an easy thing to test, by giving your enemy low MP then forcing them (via that same plugin and Force Action command) to use a skill that costs more MP than they have. If it crashes, then it's a very good possibility that this is your issue. If it doesn't crash, then it rules out that option, which is still a good thing.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Here's a quality DPS class idea: The Beekeeper, who uses the "Bees!!" skill to attack and poison enemies.
Please don't create long, boring cutscenes in which characters do nothing but stand around talking.
What if I took a lesson from Half Minute Hero? Let the player get dumb powerful each area, but reset them down to just slightly stronger than before for the next map?
Been averaging 2-3 hours sleep for almost a month now. Starting to space out all the time ^^;
loopk wrote on whtdragon's profile.
Nice to meet you. My name is loopk.
May I use the materials distributed here for adult games for sale?

Thank you in advance.

Forum statistics

Threads
94,264
Messages
919,482
Members
123,981
Latest member
bruguel
Top