AutoSave+ (Also for weather, day/night, skillgrid etc)

What did trigger you to try this plugin?

  • Autosave

    Votes: 14 82.4%
  • Weather system

    Votes: 1 5.9%
  • Day/Night System

    Votes: 1 5.9%
  • Something else (tell me in a reply)

    Votes: 0 0.0%
  • Skill grid system

    Votes: 1 5.9%

  • Total voters
    17

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
117
Reaction score
59
First Language
Dutch
Primarily Uses
RMMV
========================================
ABOUT THIS PLUGIN - JDN_AutoSavePlus.js
========================================

This plugin:
Runs common event of your choice
- when you switch maps
- when you lvl up

Saves or loads the game at a plugin command

This is useful for:
- Autosave
- Weather
- Day/Night time.
- Skill grid
- More...


========================================
TERMS OF USE
========================================

Free to use for commercial, or non commercial projects,
Credits to: JohnDoeNews
If you put a link to your credits, please use this link, no matter
where you found this plugin: http://games.johndoenews.nl

This plugin may be shared for free, but the tems of use must
stay the same.

========================================
PLUGIN COMMANDS
========================================


JDNForceLoad
- This opens the load scene, if a saved game is present, or start
a new game if no game is saved.

JDNForceSave
- This will force a silent save in slot 1

========================================
DEVLOG
========================================

1.1.0 Added params with help of Aloe Guvner
26 April 2018

1.0.1 Added common event on lvl up.
22 April 2018

1.0.0 Finished!
19 April 2018

========================================
DOWNLOAD THE PLUGIN ON MY WEBSITE!!
========================================

Link To My Website



========================================
Preview
=======================================

The preview of my current project, is in fact made with
this plugin, and shows a perfect example of how
to make a weather and a day/night system with this
plugin: (Just walk around map to map and see the weather
change slowely)
Link my project on Itch.io
 

Attachments

Last edited:

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
117
Reaction score
59
First Language
Dutch
Primarily Uses
RMMV
I want to make parameters, so the user can choose the common event triggered by the plugin.
Unfortunately I have not been successful so far.

If anyone who knows JS and took a look at the file, can tell me how to do this, I would be most thankful, and put you in the devlog.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,096
First Language
English
Primarily Uses
RMMV
You can use this for reference on all parameter types available:
https://forums.rpgmakerweb.com/inde...w-plugin-manager-in-rpg-maker-mv-1-5-0.79764/

Video tutorial on how to make plugin parameters:
(basic parameters)
(new, advanced parameters)

For your plugin, in the header add:
Code:
@param saveSlot
@text Save Slot
@type number
@desc The save slot number that is used in the autosave.
@default 1
I see that you included the first 2 methods of your plugin within separate IIFE and the 3rd method is not within an IIFE. You should wrap the whole thing in a single IIFE for better variable scoping and protection.

So at the top but inside your IIFE:
Code:
var params = PluginManager.parameters("Your Plugin Name");
var saveSlot = Number(params["saveSlot"]);
Then you can change the line later to:
Code:
DataManager.saveGame(saveSlot);
No credit/dev log required.
 
Last edited:

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
117
Reaction score
59
First Language
Dutch
Primarily Uses
RMMV
Ha, those are the tutorials I used to make this plugin :p Haha.

I am quite new to plugins, are java script all together. I am going to try and make it all into one IIFE (function?) and see if I can make it run.

Would you mind if I credited you for it? It's like saying thank you. :p
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,096
First Language
English
Primarily Uses
RMMV
If you want to, sure, but not required.

Yeah an IIFE is an Immediately Invoked Function Expression. The link I posted does a better job explaining, but it's the part that looks like this:
Code:
(function() {
   //put all of your stuff here
})();
Basically any new variable declared inside there is only local to that function. So you can declare any new variables you want, and it is always safe and won't mess with other plugins.

That's why it is safe to declare a new variable like this:
Code:
var params = PluginManager.parameters("Your plugin name");
Even though "params" is probably a popular choice for a variable name. Because of the IIFE, it is locally scoped and it doesn't overwrite anybody else's "params".
 

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
117
Reaction score
59
First Language
Dutch
Primarily Uses
RMMV
I tried the same thing before, and I get the same error now. Or actually the game just freezes. But I can't figure out what I do wrong.
I have everything working, untill I put (saveSlot) instead of (1)
After I have set up the parameters ofcourse.

Code:
(function() {

    var params = PluginManager.parameters("JDN_AutoSavePlusTEST.js");
    var saveSlot = Number(params["Auto Save Slot"]);
    var commonEventTr = Number(params["Common Event On Transfer"]);
    var commonEventLvl = Number(params["Common Event On Level Up"]);
  
  
    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
        _Game_Interpreter_pluginCommand.call(this, command, args);      
      
            if(command == 'JDNForceLoad') {
                 if (DataManager.isAnySavefileExists() == true){
                 SceneManager.push(Scene_Load);
                     }
                else {
                  DataManager.setupNewGame();
                SceneManager.goto(Scene_Map);
                          }
            }
            if(command == 'JDNForceSave') {
                $gameSystem.onBeforeSave();
                    DataManager.saveGame(saveSlot);              
            }
};  
  
Game_Interpreter.prototype.command201 = function() {
        $gameTemp.reserveCommonEvent(commonEventTr);
    };

Game_Actor.prototype.levelUp = function() {
    $gameTemp.reserveCommonEvent(commonEventLvl);
};  
})();
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,096
First Language
English
Primarily Uses
RMMV
Drop the .js from the file name when reading the parameters and make sure that "Auto Save Slot" matches exactly with what you put on the @param line.

Just below this:
Code:
   var params = PluginManager.parameters("JDN_AutoSavePlusTEST");
Add this line:
Code:
console.log(params);
Open up the console with F8 and make sure that the params variable got created correctly. You can also experiement by typing code directly into the console to test. You can remove the console.log line once it's working.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Husband has roped me into playing one of his PSO2 characters. Productivity is now negative.
Tileset A is lava! Don't burn D:
as MZ come out what you guys think about.....Some particles engine :3c?
Who wants to sing this song with me?~

Decided to submit my games to the Monday Night Stream. Figured it might be a fun way to get some traction.

Forum statistics

Threads
100,703
Messages
978,541
Members
132,319
Latest member
ZlayerDragg
Top