Crashing issue related to PokemonField

Started by Derxwna Kapsyla September 21st, 2015 10:01 AM
  • 1956 views
  • 10 replies

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
So, for the past few months, I've been receiving an odd bug report for my game. One that I just can't figure out the issue for. I've effectively started calling it the Route 11 Bug, since the only time I've received the issue is in regards to my Kanto Route 11. The Route 11 Bug seems to affect save files on load, and makes them corrupted and unplayable. Between the three reports I've gotten, there were only a few things in common.
  • Firstly, that the bug occured on Route 11
  • Secondly, that the bug involved loading the game
  • and Thirdly, the error report itself
The first time I got the report was with an ask to my Tumblr in regards to it.
Dear Derxwna Kapsyla
I have recently experience a strange error that has not occurred to anyone prior to this point. When I try to load on Route 11 (I have saved and loaded from there successfully before), I get the error message Script 'PokemonField' line 1593: NoMethodError occurred. undefined method spriteset for #scene_intro:<0x28e4558>. What in the world is going on?
When I had mentioned that I had no idea of the bug initially and asked them to give me more information about what happened, I was told this.
Dear Derxwna Kapsyla
It's me, the user with the strange unknown error. I can't even load the save file anymore. I was just leveling up on Route 11, leveling up my Merlin. I had to head off so I could take care of something, so I saved right next to a patch of grass (could it be a void?). Then I closed the window, and when I came back and opened the game window again, the game would spit that error out when the save was just about loaded.
So from that I've deduced it was an issue with something on save/load and ultimately I just couldn't reproduce it on this information. A week later, someone else stepped forward with the same issue. I asked for a detailed report, and I couldn't really find similarities (aside from the aforementioned three) that could cause it. I kinda forgot about it until last week, which is when the third person reported it. Same procedure, same results. Nothing I could directly tie together. But I figure three reports should hopefully be enough to deduce an issue if I brought it here. I've started asking people who do get the bug to send me the corrupted save file so I could try and examine it, however futile it may be.

All issues relating to the bug can be found on my development blog or on my personal blog. For further convenience, here is an image of the full map. This pastebin file also is where the error report says the script is associated with. For further mentioning, before someone asks, I am using a modified version of Essentials V14. (Upgrading isn't really possible, so unless the bug is fixed that way I really don't want suggestions to update).

Hopefully this all will help in resolving this quite vexing issue.
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
I have asked people for the save file so I can try and examine them, yes. Unfortunately, nobody has sent me one I can look at yet, so I'm waiting on that.

And yes, there is an NPC that does walk around in the grass, two of them actually.
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Rot8er_ConeX

Male
The Dissa Region
Seen March 28th, 2022
Posted May 8th, 2017
822 posts
7.2 Years
It's possible that the NPCs are triggering wild Pokemon battles and that's crashing the game because they're not the player.
Features of Pokemon Entropy

The black circular "doodles" in the lower right corner of my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
Someone finally sent me their save file, and I've managed to figure out two things.
  • First and foremost, the issue only shows up on loading the game in Demo 6 of my game. If I load it in Demo 7, it's fixed. Normally, this'd be a non-issue because "hey it's fixed, no more reason to be concerned!" except this bug still makes saves unplayable, so I need to know whats wrong so I can patch it up and release a quick fix to players. Otherwise I have everyone send me their saves and I fix it manually, which is less-than-ideal.
  • Secondly, I now have the full error report.


Hopefully this should gleam more light on the situation at hand. I've already checked and confirmed, the version of Essentials being used between Released Demo 6-2 and Unreleased Demo 7 is Essentials v14, so the issue isn't the base Essentials version (Or it could be, just with the script edits I did fixing it.)
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
So, I've looked into it, and all the changes I've done since Demo 6's release and Demo 7's progress, and all I could find was one small change which could have fixed it. Specifically, it was this script made by KleinStudio. So I set about checking if that was the case by adding it to Demo 6, where I did confirm the bug. Adding it in made the save file loadable once more. I don't know if I'll need any further testing, but this might resolve the issue of the Route 11 Bug.
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
UPDATES REGARDING BUG: So I had someone who had the bug download and test it, but they said they still had it. so I got further gritty with files and eventually fund what may be the fix I need? Apparently a system.rxdata from a working build, when placed in the broken build, makes it work. From my knowledge system.rxdata only controls script and variable names, as well as other "unimportant information". I'm going to see if I can send the file off to them for testing before that, but what I'd like to know now is - is it even possible that system.rxdata could be the fix? If all it contains is switches and variable names, how could that fix it?
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Maruno

Lead Dev of Pokémon Essentials

England
Seen July 3rd, 2022
Posted July 3rd, 2022
5,280 posts
14.5 Years
I believe this error is caused when saving the game while one of the moving NPCs was on-screen, and the NPC was walking in grass and causing the rustling animation. Upon loading, the map is updated once before the scene is set, and the NPC must have been at the exact point in its movement that it makes the animation in that update frame - it therefore tries to play the animation at that time (via $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y,true)) before $scene is set to be the map (it's still Scene_Intro at this point, which doesn't have the def spriteset in it, hence the error).

My solution would be to add the following red lines:

Events.onStepTakenFieldMovement+=proc{|sender,e|
  event=e[0] # Get the event affected by field movement
  if $scene.is_a?(Scene_Map)
    currentTag=pbGetTerrainTag(event)
    if pbGetTerrainTag(event,true)==PBTerrain::Grass  # Won't show if under bridge
      $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y,true)
    elsif event==$game_player && currentTag==PBTerrain::WaterfallCrest
      # Descend waterfall, but only if this event is the player
      Kernel.pbDescendWaterfall(event)
    elsif event==$game_player && PBTerrain.isIce?(currentTag) && !$PokemonGlobal.sliding
      Kernel.pbSlideOnIce(event)
    end
  end
}
If I'm right, the save files should be usable - there's nothing wrong with them, it's just that there's a crack in the scripts for this rare case.

As far as the supposedly broken save files working intermittently, I don't know why. Maybe it's an inaccuracy in rounding values when calculating the NPC movements.
Go to the Essentials Docs Wiki

Essentials Docs Wiki

Follow me on Twitter: @maruno42


Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
I applied your changes, and I got this error report

---------------------------
Touhoumon Faith & Prayer Version 1.8
---------------------------
Exception: NoMethodError

Message: undefined method `isJustGrass?' for PBTerrain:Class

PokemonField:1593

PokemonField:1589:in `call'

PBEvent:54:in `trigger'

PBEvent:49:in `each'

PBEvent:49:in `trigger'

Game_Character_2:67:in `update_move'

Game_Character_2:6:in `update_old2'

Walk_Run:96:in `update'

Game_Event_:252:in `update'

Game_Map_:440:in `update'



This exception was logged in 

C:\Users\Andrew\Saved Games/Touhoumon Faith _ Prayer Version 1_8/errorlog.txt.

Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK   
---------------------------
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress:

Derxwna Kapsyla

Derxwna "The Badman" Kapsyla

Age 29
Male
Everywhere, yet Nowhere
Seen 36 Minutes Ago
Posted May 6th, 2021
429 posts
11.2 Years
Clean indentations in the code, your code looked better indented than the code I had. I know it doesn't matter since code doesn't need to be indented at all, but I felt weird looking at the indentations. I did initially copy the two red lines only, but yeah. Not sure why I didn't think to just... indent it manually, but what's done is done I guess.
It should be working fine now, as the game actually loaded up and ran.
-----------------------------------------------------
Development Blog:
For more information, future news, and updates to any projects, the following blogs are where I post information. You can usually hit me with a message there when it comes to bug reports or feedback, or general conversation about something.
Game Projects:
In Progress: