What did trigger you to try this plugin?

  • Autosave

    Votes: 15 83.3%
  • Weather system

    Votes: 1 5.6%
  • Day/Night System

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

    Votes: 0 0.0%
  • Skill grid system

    Votes: 1 5.6%

  • Total voters
    18

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
218
Reaction score
128
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...

31239472_10209877279363689_8630957714429706240_o.jpg

========================================
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

  • upload_2018-4-26_4-40-50.png
    upload_2018-4-26_4-40-50.png
    157.1 KB · Views: 44
Last edited:

JohnDoeNews

Veteran
Veteran
Joined
Apr 25, 2017
Messages
218
Reaction score
128
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,141
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
218
Reaction score
128
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,141
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
218
Reaction score
128
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,141
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:

Latest Threads

Latest Posts

Latest Profile Posts

welp, I literally can't continue working on ALEX now that my MZ trial is up (unless I somehow place in the jam which I don't remotely deserve to for my unfinished crap) so I am back on my bullshit
some test stuff. Empty for now. My other project (this project) needs more attention. The lagging really kicks up when I try to capture gameplay. ✨
Real-Time Battles, Pixel Filter, Animate Cursor & Menus & Windows | RPG Maker News #114

When your side job becomes more interesting than your dayjob and you think "do I quit again or finally actually do the same thing for more than five consecutive years..." I don't think I'll ever be able to say that though, I just cannot stick with one thing like you're 'supposed to'.
Does the word "research" imply that you're searching for something that had been found before?

Forum statistics

Threads
113,882
Messages
1,078,172
Members
147,970
Latest member
mvkgant
Top