'Cache' line 88: "NoMethod Error"

Greetings, fellow bipeds! I seem to be running into more problems as of late.

I got the wild hair to go back and alter an area in my game that I had originally finished with some months ago. I added a new side quest, complete with a new playable character. When the player completes the new area, they meet the new character. Then, using control variables and a conditional branch, I created a scenario that changes depending on how many party characters already exist. If the party has five members or more, the choices the player gets are a) help the new character with a problem or b) let the new character deal. If the party has four members or less, the choices the player gets are a) new character joins, or b) new character gets turned away.

That part goes just fine. It's what happens AFTER the new character joins the party that things get weird. I set this character up in the database just the same as all the others, so I had no reason to think there was anything wrong. But... if this character gets killed in battle, the game crashes.

I *AM* using the ghost followers script I had inquired about sometime back, but even when I removed that script just to test things out, the game STILL crashed when this particular character got killed. This never happens with any of the other party characters or the main character. Just this new one.

Every single time the same error message appears following the crash:

Script 'cache' line 88: NoMethod Error occurred.
undefined method 'empty?' for nil:NilClass

I deleted my save file and started a new playthrough from the very beginning, just to see if that would have any effect. It did not. The game continues to crash whenever the new character is killed. I have no idea why this happens. I've looked through the database, the event containing all the script for the meeting with the character, and anything else I could think of... and I got nothing. I can't understand why this is happening. Can anyone here think of anything I could possibly try (besides the obvious "never let the character die") that would fix this issue? Thanks in advance!
If you want a fool proof. Add this.
Code:
module Cache
  def self.load_bitmap(folder_name, filename, hue = 0)
    if filename.nil?
      return empty_bitmap
    end
    @cache ||= {}
    if filename.empty?
      empty_bitmap
    elsif hue == 0
      normal_bitmap(folder_name + filename)
    else
      hue_changed_bitmap(folder_name + filename, hue)
    end
  end
end
See if you game is 'glitched' but not crashed.

If you want to actually debug it. Add this script
https://github.com/theoallen/RGSS3/blob/master/Untranslated/Script Backtracer.rb
Then, instead of adding one above, add this instead
Code:
module Cache
  def self.load_bitmap(folder_name, filename, hue = 0)
    if filename.nil?
      backtrace
      return empty_bitmap
    end
    @cache ||= {}
    if filename.empty?
      empty_bitmap
    elsif hue == 0
      normal_bitmap(folder_name + filename)
    else
      hue_changed_bitmap(folder_name + filename, hue)
    end
  end
end
My script will print a log file to trace script that might cause the issue.
If you want a fool proof. Add this.
Code:
module Cache
  def self.load_bitmap(folder_name, filename, hue = 0)
    if filename.nil?
      return empty_bitmap
    end
    @cache ||= {}
    if filename.empty?
      empty_bitmap
    elsif hue == 0
      normal_bitmap(folder_name + filename)
    else
      hue_changed_bitmap(folder_name + filename, hue)
    end
  end
end
See if you game is 'glitched' but not crashed.

If you want to actually debug it. Add this script
https://github.com/theoallen/RGSS3/blob/master/Untranslated/Script Backtracer.rb
Then, instead of adding one above, add this instead
Code:
module Cache
  def self.load_bitmap(folder_name, filename, hue = 0)
    if filename.nil?
      backtrace
      return empty_bitmap
    end
    @cache ||= {}
    if filename.empty?
      empty_bitmap
    elsif hue == 0
      normal_bitmap(folder_name + filename)
    else
      hue_changed_bitmap(folder_name + filename, hue)
    end
  end
end
My script will print a log file to trace script that might cause the issue.

To clarify: do I put that in the Cache script, replacing the segment that was originally there, or do I put it between Materials and Main?
To clarify: do I put that in the Cache script, replacing the segment that was originally there, or do I put it between Materials and Main?
While actually it doesn't matter as long as it's below 'Cache', always put in 'Materials' section for easier to organize.
While actually it doesn't matter as long as it's below 'Cache', always put in 'Materials' section for easier to organize.

Thank you! I'll try it and let you know what happens!
While actually it doesn't matter as long as it's below 'Cache', always put in 'Materials' section for easier to organize.

Okay, I plugged your scripts in, and when the character was killed in battle, the game crashed again, this time delivering the following message:

Unable to find file:
Graphics/System/cmd/c "start Backtrace.txt"
lol, idk how it turned that way. If it doesn't work, try to set
Code:
OpenFile = false
It should create a file on your game folder when the game is supposed to crash.
lol, idk how it turned that way. If it doesn't work, try to set
Code:
OpenFile = false
It should create a file on your game folder when the game is supposed to crash.

You, my friend, are a genius!

I did as you said and play-tested the game. Here's what happened this time:

When the character was killed, the game kept going, except instead of displaying a ghost like the other characters, there was simply no character there. (When I resurrected the character, she returned with no problems.) Then I let a battle end with her dead, and she showed up on the map as a ghost like she was supposed to! So I resurrected her, and again, no problem!

The one thing I did notice was the computer started to lag quite a lot during the battle when she was dead (and then ran smoothly when she was revived), but I can live with that if it means the game doesn't crash. I don't know precisely what your script did, but it worked! Thank you!!
LOL, if you're not interested to actually debug it, then remove my backtracer script.
And remove line 4 from module cache script. It's not important. It will take away your slight lag.
LOL, if you're not interested to actually debug it, then remove my backtracer script.
And remove line 4 from module cache script. It's not important. It will take away your slight lag.

Here is the report I got from your backtrace script:

TheoAllen Cache --- Line: 4:in `load_bitmap'
Cache --- Line: 39:in `character'
Lune Frontal Battle System --- Line: 219:in `block in move_actors_back'
Lune Frontal Battle System --- Line: 210:in `each'
Lune Frontal Battle System --- Line: 210:in `move_actors_back'
Lune Frontal Battle System --- Line: 238:in `update_move_troops'
Lune Frontal Battle System --- Line: 131:in `update_basic'
Scene_Battle --- Line: 67:in `update_for_wait'
Scene_Battle --- Line: 98:in `wait_for_message'
BattleManager --- Line: 162:in `call'
BattleManager --- Line: 162:in `wait_for_message'
BattleManager --- Line: 332:in `gain_drop_items'
BattleManager --- Line: 208:in `process_victory'
BattleManager --- Line: 194:in `judge_win_loss'
Scene_Battle --- Line: 566:in `process_action_end'
Lune Frontal Battle System --- Line: 275:in `process_action'
Scene_Battle --- Line: 48:in `update'
Scene_Base --- Line: 14:in `main'
SceneManager --- Line: 23:in `run'
Main --- Line: 7:in `block in <main>'
:1:in `block in rgss_main'
:1:in `loop'
:1:in `rgss_main'
Main --- Line: 7:in `<main>'
ruby:in `eval'

I'm afraid I don't understand what it is telling me.
There you have it. It seems it has to do with Lune Frontal Battle System. But idk what script is that and how it works. Maybe you can try to report to the scripter if they're still active?
There you have it. It seems it has to do with Lune Frontal Battle System. But idk what script is that and how it works. Maybe you can try to report to the scripter if they're still active?

I will attempt to contact them. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/cache-line-88-nomethod-error.97728/