AeroFunk80

Veteran
Veteran
Joined
Aug 25, 2016
Messages
170
Reaction score
49
First Language
English
Primarily Uses
RMMV
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?
 

AeroFunk80

Veteran
Veteran
Joined
Aug 25, 2016
Messages
170
Reaction score
49
First Language
English
Primarily Uses
RMMV
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 !!');
}
}
});
});
});
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
562
Reaction score
810
First Language
English
Primarily Uses
RMMV
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.
 

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
608
Reaction score
320
First Language
German
Primarily Uses
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. :)
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,151
Reaction score
10,715
First Language
Czech
Primarily Uses
RMMV
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
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

Working on a new Visual Novel, it's my first one so I hope people enjoy it! :D
TIL, TP means Tactical Points.
I think those extra pixels did it. ^_^ Now to work on the front and back views.
PlusTest-02.gif
What props/tiles are missing from this scene?

My team recruitment thread is finally online. Please, if you guys are interested in language learning, take a look. Even if you don't join, a word of encouragement is always welcome.

Forum statistics

Threads
116,470
Messages
1,098,918
Members
152,055
Latest member
KeinHexer
Top