Hi guys.
Someone knows what is the code to check if map001(example) exist?
Someone knows what is the code to check if map001(example) exist?
My game is online and when some player enter in a map that do not exist the server crash.
good ideia, thanks bro, but soometimes i delete old maps, so i will try to found this code.
$dataMapInfos.some(map => map?.id === 1);
Thanks for your help, but unfortunately dont worked, the hero teleported even the map file not existing.
Like I said before, it won't work if you directly delete the file using your file explorer. That's not the correct way to delete maps, because it still leaves the map listed in the MapInfos file. You need to open the project up in RPG Maker, delete it from the map browser, and then save the project.
Sorry, I think I didn't explain myself properly.
DataManager.localDataFileExists = function(filename) {
const path = require("path");
const base = path.dirname(process.mainModule.filename);
let dataPath = path.join(base, "data/");
const fs = require("fs");
return fs.existsSync(dataPath + filename + ".json");
}
DataManager.localDataFileExists('Map216');
Worked bro, thank u so much 🙂
$dataMapInfos.some(map => map?.id === 1);
Original thread: https://forums.rpgmakerweb.com/threads/mz-check-if-map-file-exist.151404/