J MapTime Regen

Jragyn

idk wat this is
Member
Joined
Aug 14, 2012
Messages
21
Reaction score
4
First Language
English
Primarily Uses
J_MapTime


V: 1.0 
Creator name: J ( Jragyn, J, Jeremy, take your pick)
Introduction

This is a stand-alone plugin that puts use to stats like HRG/MRG/TRG on the map. I'll say this many times, but even though it does work without a HUD, I imagine that it would make the most sense to find a HUD that displays two or three of the stats: HP/MP/TP, or whatever you're using.

Features
This enables HRG/MRG/TRG to function while on the map.
Additionally, due to the way I used it (and figured others may too), I setup TP to regenerate about 10x faster than HP/MP.


I did this to give the illusion that TP was like stamina or something, so it can be (is by default) configured to consume TP when dashing.

Screenshots
It is difficult to capture regeneration with imagery.

How to Use

Just take the plugin and throw it in your project like you would any other plugin.


It should just work.


There is a single setting: "useTPtoDash". Set it to "true"(default) to consume TP when dashing. Set it to "false" to disable that.



Demo
This is plug-n-play, there are no dependencies, nor demo needed to demonstrate this.

Script



If I am a slacker and fail to keep it up to date on here, you can also find it on my pastebin.

/* -------------------------------------------------------------------------- */
// J_MapTime
// V: 1.0

/*:mad:plugindesc Provides functionality for HRG/MRG/TRG while on the map.
@author J

@param useTPforDash
@desc Enable/Disable to control dashing with TP availability.
@default true

@help This plugin adds the functionality of HP/MP/TP regeneration on the map.
Ideally, this system would be used in conjunction with an ABS of sorts,
as it was originally designed to hold hands with qABS, but it does work all
by itself, too.

MATH BREAKDOWN: actor's HRG = 50(%).
formula per tick = ((actor.hrg * 100) / 2) / 5;
((0.5 * 100) / 2) / 5
(50 / 2) / 5
25 / 5
5 per tick (1 tick = 30 frames = 0.5 seconds)

In short, the actor will regenerate 1/10 of whatever his HRG/MRG is, per tick.
I opted into making it flatHP instead of %maxHP since % would be pretty op.

NOTE: TRG's regeneration is updated 10x faster (1 tick = 3 frames = 0.05s)
Currently, it is being used as "stamina".
Try making a skill cost like, 15 TP or something and use it as a basic
attack limiter to prevent the player from swinging excessively.
If you don't like it, you can just turn it off, too.
For reference, it takes 15% TRG to cancel out TP depletion while dashing.

If you intend to use this, I highly recommend you make use of a couple other
plugins as well:
> Some ABS (qABS works, but I don't have a link to the original code)
> A functional HUD: http://pastebin.com/53UjUNiZ (I made it myself :] )
*/
/* -------------------------------------------------------------------------- */
var Imported = Imported || {};
Imported.J_MapTime = true;

var J = J || {};
J.mapTime = J.mapTime || {};
J.mapTime.Parameters = PluginManager.parameters('J_MapTime');
J.mapTime.useTPforDash = String(J.mapTime.Parameters['useTPforDash']);

(function() { // start plugin.
/* -------------------------------------------------------------------------- */
// Game_Map Modifications
// Handles all the extra variables and adds functionality for the xRG stuff.
/* -------------------------------------------------------------------------- */

// adds in timing variables for monitoring when to tick the regenerations.
var _Game_Map_jRegen_initialize = Game_Map.prototype.initialize;
Game_Map.prototype.initialize = function() {
_Game_Map_jRegen_initialize.call(this);
this._timingHPMP = 0;
this._timingTP = 0;
};

// processes the function that provides HRG/MRG/TRG on the map.
var _Game_Map_jRegen_update = Game_Map.prototype.update;
Game_Map.prototype.update = function(sceneActive) {
_Game_Map_jRegen_update.call(this, sceneActive);
this.regenOnMap();
window.console.log(J.mapTime.useTPforDash + ": dash4tp?");
};

// Checks if party exists, then performs the onMapFX once per 30 frames.
// Effects are divided into HP+MP, and TP, so that TP can regenerate at
// a faster rate for purpose of being like "stamina".
Game_Map.prototype.regenOnMap = function() {
if ($gameParty != null) { var actor = $gameParty.leader(); }
if (actor) {
if (this._timingHPMP <= 0) {
this.doHPMPregen(actor);
this._timingHPMP = 30;
}
else { this._timingHPMP--; }
if (this._timingTP <= 0) {
this.doTPregen(actor);
this._timingTP = 3;
}
else { this._timingTP--; }
}
};

// Here, HP/MP regeneration is handled based on HRG/MRG.
// It is significantly slower than TP Regeneration.
// Additionally, it is flat regen, not %max regen.
Game_Map.prototype.doHPMPregen = function(actor) {
var hpRegen = ((actor.hrg * 100) / 2) / 5;
var mpRegen = ((actor.mrg * 100) / 2) / 5;
actor.gainHp(hpRegen);
actor.gainMp(mpRegen);
};

// this rapidly regenerates the player's TP.
// and also deplete stamina while dashing.
Game_Map.prototype.doTPregen = function(actor) {
var mod = 0;
if (J.mapTime.useTPforDash === "true")
mod = Game_Player.prototype.isDashButtonPressed() ? 2.5 : 0.0;
var tpRegen = (((actor.trg + 0.1) * 100) / 10) - mod;
actor.gainTp(tpRegen);
};

// this forces the player to be unable to run while out of TP.
// note: hopefully this is okay since only actor's can dash (?).
var _Game_CharacterBase_jqmt_realMoveSpeed = Game_CharacterBase.prototype.realMoveSpeed;
Game_CharacterBase.prototype.realMoveSpeed = function() {
if (J.mapTime.useTPforDash === "true") {
if ($gameParty != null) { var actor = $gameParty.leader(); }
return this._moveSpeed + ((this.isDashing() && actor.tp > 0) ? 1 : 0);
}
else { return _Game_CharacterBase_jqmt_realMoveSpeed.call(this); }
};
/* -------------------------------------------------------------------------- */
// Window_Base Modification
// Because floats are innately messy, this is cleans them up visually.
/* -------------------------------------------------------------------------- */

// this fixes the issue of drawing excessively long decimal numbers
// in places like the menu that draw gauges for HP/MP.
var _Window_Base_jqmt_drawCurrentAndMax = Window_Base.prototype.drawCurrentAndMax;
Window_Base.prototype.drawCurrentAndMax = function(current, max, x, y, width, color1, color2) {
current = current.toFixed(0);
_Window_Base_jqmt_drawCurrentAndMax.call(this, current, max, x, y, width, color1, color2);
};
/* -------------------------------------------------------------------------- */
})(); // end plugin.



FAQPost question and answers to common question here in the following format:Q: How come I can't see anything happening?A: You'll probably need a on-the-map HUD. Additionally, you may need to add some base HRG/MRG/TRG to your characters.Credit and Thanks- I wrote this, J, or Jragyn, but J makes more sense based on how I setup stuff in the plugin.Author's NotesAs I mentioned before, this plugin works stand-alone, but is best used in tandem with a HUD or something... and probably an ABS of sorts.


I've never really submitted anything to these forums, so hopefully this is useful, not bug-ridden, and in proper format!
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I forgot I had an account on rpgmakercentral lol
"What do you think the best place to visit on this cold days?" "Hell..."
Been so busy lately that I wonder if I should slowly start preparing the advent calendar resources so I have enough in december.
Man, I wish it was harder for mean d-holes to make me feel like crying.
Made 8 games. Was aiming for 20. Gonna go for 40. Because 20 + 20. /Bed.

Forum statistics

Threads
94,538
Messages
921,719
Members
124,402
Latest member
KINGty
Top