I'm working on a way to create the json file automatically in case it doesn't exist.
I added compatybility with YEP_MessageCore, it'll surely be on the next version but I'll need to take a look at EvalText and Macros.
Happy holidays everyone!😍
I'm working on a way to create the json file automatically in case it doesn't exist.
SMO.AM.saveGlobalAchievements = function() {
var achievs = JSON.stringify(SMO.AM.GlobalAchievements);
var fs, path;
fs = require('fs');
path = 'data/Achievements.json';
if (fs.existsSync(path)) {
achievs = btoa(achievs);
achievs = 'S' + achievs;
fs.writeFileSync(path, achievs);
}
}
SMO.AM.saveGlobalAchievements = function() {
var achievs = JSON.stringify(SMO.AM.GlobalAchievements);
var fs, path;
fs = require('fs');
path = 'www/data/Achievements.json';
if (fs.existsSync(path)) {
achievs = btoa(achievs);
achievs = 'S' + achievs;
fs.writeFileSync(path, achievs);
}
}
var value = 1;
var variableId = 10;
var newValue = $gameVariables.value(variableId) + value;
$gameVariables.setValue(variableId, newValue);$gameActors.actor(2).gainExp(50);$gameParty.leader().gainExp(20);One thing I'll warn you about that someone pointed out to me before (not sure if it's still the case): apparently require('fs') doesn't work in deployed projects because it's an nwjs feature and deployment doesn't support anything that's nwjs-exclusive.
Actually, it works on deployed projects too, RPGMaker MV's StoreManager uses require('fs') to save and load files, but it doesn't work on browser, then you'd need to call the localStorage.
StorageManager.localFileDirectoryPath (which works for the save folder) and use it to get the data folder.Ah, good to know! I had no intention of making any of my projects available on browser, so turns out I've been given erroneous advice. XD
Original thread: https://forums.rpgmakerweb.com/threads/smo-achievements-menu-v1-04.122651/