I love how you're both trying to discourage me from this. Without going into detail, allow me to say that most of the people I've approached with the full idea have been completely on-board with both mechanics. Rather than trying to simply "punish the player," the mechanics are in place for the realm of the story, not simply the player. They have to be careful because your actions will shape the world.
That said, there will be plenty of things that make the game forgiving. Many enemies (the only exception really being bosses) will find it hard to kill off any more than the most underleveled party members for the area. There will also be Low Health Warnings ("I'm not doing too well, heal me please!"), Dangerous Area Warnings ("I don't feel comfortable being here. Let's go back."), and a method to send a character with low health back to town, and get a new party member from town. Stuff like that to help out the careful players, but punish the reckless ones that care to ignore it.
Anyways, I have a few ideas. I don't know JavaScript that well, so if someone could help run me through this (or point me to some website that would help me learn how to do this myself), then I would appreciate it.
1. Take on the UNDERTALE method. Write to a file as it happens, and when the game is loaded, call a common event immediately as part of the load process that checks the file, forces switches on and removes characters based on lines in that file (say, if the line "Character 101 is dead." is read, then the death switch for character 101 is turned on, and then character 101 is force-removed from the party.), and maybe chastises the player for cheating, if they did, too.
2. Could I make the Game Over script to check if a certain switch (Mercy Mode, for simplicity's sake) was on, and if Mercy Mode was off, then it deleted the file?
Again, "permadeath" is a very hard mechanic to balance. If you want to approach it from a "I know what you did" aspect like Undertale, rather than "whoops you dead, you can never play again unless you reformat the pc (or hunt down where I stored the cookie)", then that might be palatable. In the case of a game like Starflight, every time you "changed maps" the game state saved, but if you forgot to actually save the game, the game was wrecked.
1.Undertale's method is actually simple. It has 3 save files. One for where the player manually invokes a save, one is a checkpoint, and one is a "final boss state", with the latter being necessary since the game kicks you out when you die and needs a progress marker. Also the switch from neutral to pacifist still requires being able to load the state before the final boss was activated. It also has a flags file which marks down how many times you've met or done something, and one additional flag for marking the no-mercy mode.
So to do "character 101 is dead, you can't get him back by save scumming" type of check, you actually save two files, one is the "save game" the other is the "game state" which is a copy of the tamper switches.
So first, take a look at YEP_SaveEventLocations.js as this plugin does something like that for events on the map.
Second rpg_managers.js
StorageManager.saveToLocalFile = function(savefileId, json) { var data = LZString.compressToBase64(json); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId); if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, data);};This is why you can't do what you want to do out-of-the-box. There are separate save functions for saving/loading from a local file or if it is in a web browser.
So it defines only a save file, and only this data is saved:
DataManager.makeSaveContents = function() { // A save data does not contain $gameTemp, $gameMessage, and $gameTroop. var contents = {}; contents.system = $gameSystem; contents.screen = $gameScreen; contents.timer = $gameTimer; contents.switches = $gameSwitches; contents.variables = $gameVariables; contents.selfSwitches = $gameSelfSwitches; contents.actors = $gameActors; contents.party = $gameParty; contents.map = $gameMap; contents.player = $gamePlayer; return contents;};So for the sake of argument, you add a contents.tamperswitch=heroisdead; which would always be false unless the player died.
then in the save/load process you re-evaluate the conditions which make heroisdead. If they don't match, cut to the "chastise the player" scene.
If you want to do the "two save file" method, eg to progress through a hard boss, you actually check for the existence of the "alternate save" and a flag denoting the battle is complete.
But as I said earlier, people will cheat. When people do the no-mercy run in Undertale, it saves flags throughout the save games and two other files to indicate the progress across game resets. Players can just delete these extra files and the save game to do a true reset. Or they can edit the save game (in the case of RPG Maker, it would be slightly harder than trivial.) So you generally want to do things in a way that is "tamper detection" not outright "if variable is X do Y". Like you could do a md5 sum on the save game, and store the md5 sum in a game state, so if any data was edited in the save game, you'd know it's been tampered with. There are also memory-resident based cheating programs for the really depraved and incompetent cheater.
2. This is more obvious.
DataManager.saveGame = function(savefileId) { try { return this.saveGameWithoutRescue(savefileId); } catch (e) { console.error(e); try { StorageManager.remove(savefileId); } catch (e2) { } return false; }};Notice it tries to save the game and if it can't it deletes the save.
rpg_objects.js
// Game OverGame_Interpreter.prototype.command353 = function() { SceneManager.goto(Scene_Gameover); return true;};So to do what you want, put StorageManager.remove(savefileId) before SceneManager.goto(Scene_Gameover);
you can override this with with a plugin instead of editing the javascript.
Just put a check for the switch, so you'd have something like this:
// Game OverGame_Interpreter.prototype.command353 = function() {if($gameSwitches.value(666)){StorageManager.remove(DataManager.latestSavefileId);} SceneManager.goto(Scene_Gameover); return true;};As I said earlier, people will cheat, and in this case they could bypass it by editing or removing this as plugin.