TP Energy System
TP Energy System v1.4by Phalk
Introduction
A js script to change the way the TP system works to make it work similar to World of Warcraft's energy system.
Features
* You always start battles with a fixed amount of TP, defined in the params.
* You earn a predetermined amount of TP once per turn, defined in the configuration.
* You can enable or disable TP gain from damage.
* You can also set the maximum amount of TP all actors can have.
How to Use
Just put the js file inside your plugins folder and set the desired values at the plugin parameters configuration.
Script
Code:
//=============================================================================
// Phalk_TpEnergy
//=============================================================================
var Imported = Imported || {};
Imported.Phalk_TpEnergy = true;
//=============================================================================
/*:
* @plugindesc v1.4 You can now enable or disable the TP gain on damage taken.
* @version 1.4
* @author Phalk| Version 1.4
*
* @param TP Gain
* @desc Amount of TP gained each turn.
* Default: 10.
* @default 10
*
* @param Starting TP
* @desc Amount of TP to start battles with.
* Default: 100.
* @default 100
*
* @param Max TP
* @desc Define the maximum amount of TP.
* Default: 100.
* @default 100
*
* @param TP on Damage
* @desc Gain TP on received damage. Set 0 to disable or 1 to enable.
* Default: 0.
* @default 0
*
* @help
* <Phalk_TpEnergy>
* =======================================
* This plugin changes the way TP works.
* =======================================
*
* HOW IT WORKS
* =======================================
*
* * You always start battles with a fixed amount of TP, defined in the params.
* * You earn a predetermined amount of TP once per turn, defined in the configuration.
* * You can enable or disable TP gain from damage.
* * You can also set the maximum amount of TP all actors can have.
*
*
* @tags battle, tp
*/
//=============================================================================
(function () {
var parameters = PluginManager.parameters('Phalk_TpEnergy');
var TpGain = Number(parameters['TP Gain'] || 0);
var TpStart = Number(parameters['Starting TP'] || 0);
var MaximumTp = Number(parameters['Max TP'] || 100);
var TpDamage = Number(parameters['TP on Damage'] || 0);
if (TpDamage == 0) { Game_Battler.prototype.onDamage = function(value) { this.removeStatesByDamage(); }; }
Game_Battler.prototype.initTp = function() { this.setTp(TpStart); };
Game_BattlerBase.prototype.maxTp = function() { return MaximumTp; };
Game_Battler.prototype.onAllActionsEnd = function() {
this.clearResult();
this.removeStatesAuto(1);
this.removeBuffsAuto();
this.setTp(Math.floor(this.tp + TpGain));
};
Game_Battler.prototype.onBattleEnd = function() {
this.clearResult();
this.removeBattleStates();
this.removeAllBuffs();
this.clearActions();
this.setTp(MaximumTp);
this.appear();
};
Game_BattlerBase.prototype.recoverAll = function() {
this.clearStates();
this._hp = this.mhp;
this._mp = this.mmp;
this.setTp(MaximumTp);
};
})();
FAQ
Q: If I start a new game the TP starts at 0. How do I fix this?
A: Just create a "RecoverAll" event before the start and it'll max the TP for everyone. After that TP should always be maxed outside of battles.
Credit and Thanks
- Me
Terms
You are free to use this plugin in commercial games as long as you mention me in the credits.
Author's Notes
This is probably buggy and not compatible with a lot of things.
At least I can confirm it works with most free Yanfly battle plugins, since I use them.
本贴来自国际rpgmaker官方论坛作者:Phalk处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/tp-energy-system.123023/
页:
[1]