First plugin - recover all on level up

DSR

Warper
Member
Joined
Dec 22, 2016
Messages
2
Reaction score
0
First Language
English
Primarily Uses
Script Name+Version Number:  DSR_plugin v0.1



Creator name: DSR


 


Introduction


Include script in plugin manager (placing .js file in the js/plugin folder naturally)


By default, it will enable the recover all on level up.  Change parameter to false (or just turn plugin off or remove it) to disable this feature


 


Features


- When an actor levels up, all of their depleted HP MP (and whatever else) will be recovered


 


Screenshots


none


 


How to Use


See above.  Pretty much just plug and play, no dependencies and shouldn't interfere with other plugins.  No guarantees though.


 


Demo


none


 


Script


 

Code:
//=============================================================================
// DSR - plugin
// DSR_plugin.js
// I totally copied all the coding conventions from the Yanfly plugins,
// sorry for biting your style!  I hope you feel, as I do, that
// imitation is the sincerest form of flattery.
//=============================================================================
var Imported = Imported || {};
Imported.DSR_plugin = true;
var DSR = DSR || {};
DSR.plugin = DSR.plugin || {};
DSR.plugin.version = 0.1;
//=============================================================================
/*:
 * @plugindesc adds some functionality I wanted to see.
 * @author DSR
 * @param Restore all on level up
 * @desc run restore all on level up? true or false
 * Default: true
 * @default true
 * @help you're pretty much on your own with this one
 */
//=============================================================================
DSR.Parameters = PluginManager.parameters('DSR_plugin');
DSR.Param = DSR.Param || {};
DSR.Param.RestoreAllOnLevelUp = String(DSR.Parameters['Restore all on level up']);
DSR.Param.RestoreAllOnLevelUp = eval(DSR.Param.RestoreAllOnLevelUp);
DSR.plugin.levelUp = Game_Actor.prototype.levelUp;
Game_Actor.prototype.levelUp = function(){
  DSR.plugin.levelUp.call(this);
  if (DSR.Param.RestoreAllOnLevelUp) this.recoverAll();
};

FAQ


 


Q: Why did you make this plugin?


A: I tried to find a built in way to make this happen, and couldn't find one (please tell me if I missed it) so this is what happened.


 


Q: Limitations on use?


A: Free to use for any purpose, no matter how offensive to god, man, or nature.


 


Credit and Thanks


- Author: DSR


- Mad props to Yanfly, as noted in the script I heavily emulated the conventions and style from the Yanfly series of plugins.


 


Author's Notes


None yet, please provide feedback.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,807
Reaction score
12,225
First Language
English
Primarily Uses
RMMV
The formatting is really bad for a script.  Code should be in a code block - the <> on the toolbar.  And you can leave it as 'no formatting' or set to 'javascript' when you get that window up.  That keeps it aligned to the left and indented correctly.  I'm not sure what those couple of lines are all the way over to the right.


Also, since you asked:





But good on you for having a go and making something that works.  There's nothing quite like sharing your first script :)   If you're planning to release a few, it might be worth getting a pastebin or git or something like that, just to keep your scripts/plugins all in one place away from the forum.  If you look through the old script threads, you'll see one of the forum updates accidentally reformatted all the scripts in such a way that they're no unusable.  If you do that, you can still set up the thread as usual, but instead of pasting the script into the thread, you can just provide a link to it.


Now on to your next one ;)
 
Last edited by a moderator:

DSR

Warper
Member
Joined
Dec 22, 2016
Messages
2
Reaction score
0
First Language
English
Primarily Uses
thanks for the rapid feedback!


when you say the formatting is bad for a script, is that just the way it looks in the forum (i copy-pasted the submission template from another thread), or is there something ugly about the code itself? i'm blind leading blind teaching myself javascript, so if it's the latter, i'd like to fix it before it becomes a habit.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,807
Reaction score
12,225
First Language
English
Primarily Uses
RMMV
It's just the way it's showing on the forum.  The code is centered, with a whopping big horizontal scroll bar, and for some reason there are a couple of commands that should be on their own lines but are far across to the right.  That last bit could be an issue with your code, but the centering is the forum.  I'd say it's probably because the entire post is centered (which isn't necessarily good, either - centered text makes it harder to read).


I think if you remove the centering from the whole post, and take a look at those two lines way out to the right, it should be fine.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Writing out an idea for the No Travel Game Jam. I have a general plot and challenge written out, it's just a matter of filling the rest in and making it interesting.
A definite difficult time right now. How is everyone doing during this pandemic? I already have seen furloughs and layoffs.
Hollow 1977 wrote on Archeia's profile.
Hope you and your family are doing well during this difficult time. :)
My elderly neighbor whom I've been buying groceries for just got carried out of his home on a stretcher by guys with hazmat suits. Considering I've been his only point of contact for the past month it's probably safe to say my boss was right to tell me to stay home once I developed a mild cough after all.
Damn. All these new features to the forums. Takes some getting used to.

Forum statistics

Threads
95,642
Messages
930,673
Members
125,962
Latest member
seogenics
Top