I was wondering if a script that just skipped missing resources existed.
Scenario:
"Map 1" has "BGM A"
I delete "BGM A"
When I play "Map 1" the game crashes "Missing BGM A!"
What I'm looking for:
"Map 1" has "BGM A"
I delete "BGM A"
When I play "Map 1" it just doesn't play any music.
Why did they do this? Most games (non-rpg maker) that have a missing file, that file just doesn't load. Why does a missing file just out right crash the game?
ts;dc
Also, this is probably something handled at a level that scripts can't change. I was just hoping that it was possible to change this with a script or something, IDK.
I'm skeptical that this will be error free due to how quickly I made this little snippet, but this should work:
#==============================================================================
# ** Audio
#==============================================================================
class << Audio
[:bgm, :bgs, :me, :se].each { |method|
alias_method("coz_aud_skmrsc_#{method}_play".intern, "#{method}_play".intern)
define_method("#{method}_play".intern) { |filename, *args|
send("coz_aud_skmrsc_#{method}_play".intern, filename, *args) rescue nil
}
}
end
#==============================================================================
# ** Cache
#==============================================================================
class << Cache
alias coz_cch_skmrsc_load_bitmap load_bitmap
def load_bitmap(*args)
coz_cch_skmrsc_load_bitmap(*args) rescue empty_bitmap
end
end
Wow. Thank you.
It works perfectly. I made a test map, set a song, then deleted it. The game just continued on like normal.
I don't know why they didn't just make it this way. >_>
Again, thank you. ^_^
Maybe make it load an error trap file?