Load TypeError 'displayName' of null

Good day. When writing the code, I ran into a problem where the name of the map $gameMap.displayName() in the load menu gives an error TypeError Сannot read property 'displayName' of null', but when loading everything works fine, and the gold indicator $gameParty.gold() works fine. Please tell me what is the actual problem of loading the name of the map.
Two possibilities :
1) You're using $gameMap while you're on the title screen, you cannot use something that doesn't exist. therefore $gameMap.displayName() works only in-game (after loading a save or pressing "new game").
2) Corruption or a plugin caused $gameMap.displayName() to just not work as intended.

Also please avoid making multiple thread for the same thing, mods are gonna be angry 😅

EDIT: Just noticed you're talking about a load menu, if you're on the load screen, you can't get $gameMap.displayName(). Because you're not on a map, you need to get the value from the save directly.
EDIT: Just noticed you're talking about a load menu, if you're on the load screen, you can't get $gameMap.displayName(). Because you're not on a map, you need to get the value from the save directly.
Thank you for your help, but there are only more questions. Is it possible to somehow write down the name of the map so that it would still be displayed?
Thank you for your help, but there are only more questions. Is it possible to somehow write down the name of the map so that it would still be displayed?
Yanfly Save Core plugin allows to get datas from the saves files. http://www.yanfly.moe/wiki/Save_Core_(YEP)
It allows to display the map's name, but it might not be the save menu you want...

I don't think there's a way to get the current map's name of a savefile, not an obvious one at least. you'll need to go in your loading script, and check the content of your save files after it has been loaded by the game & JsonEx.parse();
you could try to console.log() it to see what it contains in F8.
Yanfly Save Core plugin allows to get datas from the saves files. http://www.yanfly.moe/wiki/Save_Core_(YEP)
It allows to display the map's name, but it might not be the save menu you want...

I don't think there's a way to get the current map's name of a savefile, not an obvious one at least. you'll need to go in your loading script, and check the content of your save files after it has been loaded by the game & JsonEx.parse();
you could try to console.log() it to see what it contains in F8.
Thanks for your help, I'll look into this issue further.
For more details,
1642057063063.png


search in your script what is pre-loading your saves, after the content of the saves passed through JsonEx.parse(), put a "console.log();" like I did. then when you playtest and select a save (without loading it) press F8. You should be able to navigate inside the content of your own save object. allowing you to see if you can get the name of the map the player is currently on.

it'll probably be in a Window_SaveInfo function. Always make backup of the scripts before modifying anything !
Also, once you're done, delete the console.log();
@Reizod please don't mini-mod. If there's something wrong, please just report the post to let us know.

@Tenebris_Viridi are you using a plugin or making your own? The screenshot in your other thread doesn't mention any plugin names. Are you changing the core files? This is not a good idea, as it's hard to keep track of what you've changed. Better to create a little plugin that redefines the function you want to change.
@Tenebris_Viridi are you using a plugin or making your own? The screenshot in your other thread doesn't mention any plugin names. Are you changing the core files? This is not a good idea, as it's hard to keep track of what you've changed. Better to create a little plugin that redefines the function you want to change.
Based on the main core, I create plugins with a change.

In fact, everything was very simple and even a little ashamed of it, but it was just necessary to register the saving of data info.displayName = $gameMap.displayName() and that's it. Thank you all again for your help.

DataManager.makeSavefileInfo = function() { var info = {}; info.globalId = this._globalId; info.title = $dataSystem.gameTitle; info.characters = $gameParty.charactersForSavefile(); info.faces = $gameParty.facesForSavefile(); info.playtime = $gameSystem.playtimeText(); info.displayName = $gameMap.displayName(); info.timestamp = Date.now(); return info; };
Based on the main core, I create plugins with a change.

In fact, everything was very simple and even a little ashamed of it, but it was just necessary to register the saving of data info.displayName = $gameMap.displayName() and that's it. Thank you all again for your help.

DataManager.makeSavefileInfo = function() { var info = {}; info.globalId = this._globalId; info.title = $dataSystem.gameTitle; info.characters = $gameParty.charactersForSavefile(); info.faces = $gameParty.facesForSavefile(); info.playtime = $gameSystem.playtimeText(); info.displayName = $gameMap.displayName() info.timestamp = Date.now(); return info; };
change
Code:
 info.displayName   = $gameMap.displayName()
by
Code:
 info.displayName   = $gameMap.displayName();
in theory it should work without the ";", but you know... JS rules...

EDIT : would be bad if it decided to cause any issue 😅 never know
change
Code:
 info.displayName   = $gameMap.displayName()
by
Code:
 info.displayName   = $gameMap.displayName();
in theory it should work without the ";", but you know... JS rules...
I really didn't notice, thanks - corrected.

Original thread: https://forums.rpgmakerweb.com/threads/load-typeerror-displayname-of-null.143915/