Auto Saving & Auto Delete Save

● ARCHIVED · READ-ONLY
Started by AeroFunk80 6 posts View original ↗
  1. So... here's what I'm looking for.

    I'm making a rogue-like survival game. Players get one save file. The game auto-saves throughout. That part I have figured out. You can even save at a Save Point in the event players want to stop and take a break.

    Players have a group of survivors that permadeath. When their last survivor dies... I want some sort of script/plugin that forces the game to delete the save file, making players have to start from the beginning.

    I know this sounds crazy... but it's a short game/project, so players won't be investing in hours of game play just to lose everything after death.

    I found a few RMVX/Ace ones, but they don't work in MV. Any ideas?
  2. Poryg said:
    Actually, searching for this isn't a necessarily MV thing, it's a global javascript thing.
    Because you cannot delete files with javascript.
    https://stackoverflow.com/questions/19721621/how-to-delete-file-from-folder-using-javascript

    Thanks for your help. I read over the link you posted. Since you can't delete files using Java Script, I guess my next question... can you use server-side scripting in MV? I tried some of the coding examples on the site you gave me, but it isn't working. Not sure if it's a compatibility issue or maybe I'm not changing/naming something correctly. Here's one that I tried... I know I did it wrong... I basically created an event in game and posted that into Script under Advanced/Page 3. I get an "unexpected end of input" error when I select the event.

    It said you have to add this code in... not sure into what, though? Or is there no way to implement this into MV?

    This is what I tried...

    $(function(){
    $('a.delete').click(function(){
    $.ajax({
    url:'delete.php',
    data:'id/name here',
    method:'GET',
    success:function(response){
    if (response === 'deleted')
    {
    alert('Deleted !!');
    }
    }
    });
    });
    });
  3. https://nodejs.org/api/fs.html#fs_fs_unlink_path_callback

    Files are just paths to the computer. Each file is just a link to some area in the memory on the disk. Since Node.js has an unlink method, you should be able to unlink a file (delete it) from the directory with that, so long as your game is running on the desktop.
  4. Haven't tried it, but by default the RMMV uses
    StorageManager.remove( ID-of-your-savestate )
    to remove a savefile. I don't have the RMMV available and can't say if this actually deletes the file though.

    You can also use
    DataManager.saveGame( ID-of-your-savestate )
    to save the game into the specified savefile if that helps.

    It's probably worth to mention that this function was probably not meant to be called directly through an event. Usually the game makes sure that everything is updated once every frame and the game is only supposed to be saved after the update cycle is completed.
    Saving the game in the middle of the update cycle will skip the rest of the update when that savestate is loaded. Usually this shouldn't be a problem though.


    And thanks for providing those links everyone. Those were really helpful to me too. :)
  5. Yanfly uses StorageManager.remove(ID ) in his save core, I completely forgot his save core can remove saves... So it should delete the files for good.

    Well, I've made a stupid one from myself for once... :D