Actors will gain stat points whenever they level up or when you want to give
them via script call: $gameActors.actor(id).gainStats(amount)
Those points can be used to increase the actor's stats via a custom scene.
To call the scene use the call: SceneManager.sceneDistribution(actor)
Example: SceneManager.sceneDistribution($gameParty.members()[0])
Learn the basic script calls
To call the scene for the entire party use SceneManager.partyDistribution()
Press Q/W to swap the party members. You can use SceneManager.partyDistribution(id)
to have the scene start with the actor in position "id" in the party, example:
SceneManager.partyDistribution(2) will start the scene with the third actor in the
party.
Holding shift while increasing the attributes will increase them faster.
Press "x" to toggle between decrease/increase option
Put the following tags to determine how much the param/stat will increase per
stat point spent:
For extra parameters:
The tags should be put in the class notebox OR in the actor notebox
To have custom parameter limits for each actor/class put those tags in the notebox:
Feel free to use for free/comercial games, just give credit.
Enjoy
ChangeLog:
--1.2
-Fixed bug of max hp value displaying 999 on screen even when the actual value was higher
-Added option to add custom limits for parameters, those can be different for each actor
-Added option to limit how much points you can spend on the same parameter each level
-Added party option, press Q/W to swap between party members
-Can now put tags in the actor's note box as well
--1.1
-Added names for some stuff
-Added option to decrease stat
-Added support for extra parameters (crit/evasion etc)
@param PointsName
@desc The name given to stat points
@default Points
@param ActorName
@desc The word before the actor's name
@default Name
@param ClassName
@desc The word before the actor's class
@default Class
@param ExpName
@desc The word before the actor's experience
@default EXP
@param IncreaseName
@desc The word that means increase duhhh (if doing game on another language)
@default Increase
@param DecreaseName
@desc Same thing as before
@default Decrease
@param StatNameColor
@desc The color the stat's name appears, select a number from the windowskin
@default 1
@param StatValueColor
@desc The color the stat's value appears, select a number from the windowskin
@default 0
@param ShiftIncrease
@desc When holding shift, the amount increased will be multiplicated by this parameter
@default 5
@param LevelUpPoints
@desc Points gained on level up, can be any number or formula that returns a number
@default 10
@param UsedStats
@desc The basic stats that will be available to increase, put the id separated by a comma Example: 0,3,4,5
@default 0,1,2,3,4,5,6,7
@param UsedXStats
@desc Same as before, but for extra parameters (crit/evasion etc)
@default
@param ExtraParamNames
@desc Names for the extra stats (crit/evasion etc), just modify the strings in the default.
@default ["Hit rate", "Evasion", "Crit chance", "Crit Evasion", "Magic Evasion", "Magic Reflect", "Counter", "HP Regen", "MP Regen", "TP Regen"]
@param DefaultLimits
@desc Highest possible value for the parameter
Just change the values, in order: hp/mp/atk/def/mat/mdf/agi/luk
@default [99999, 9999, 999, 999, 999, 999, 999, 999]
@param DefaultxParamLimits
@desc Highest possible value for special parameters
Just change the values, in order: hit/eva/crit/criteva etc.
@default [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
@param MaxPointsPerLevel
@desc How much points you can spend per level on a single parameter
use any formula that returns a number, leave 0 for no limits
@default 0
*/
(function(){
//Parameters
var parameters = PluginManager.parameters('StatDistribution');
var pointsName = String(parameters["PointsName"]);
var actorName = String(parameters["ActorName"]);
var className = String(parameters["ClassName"]);
var expName = String(parameters["ExpName"]);
var increaseName = String(parameters["IncreaseName"]);
var decreaseName = String(parameters["DecreaseName"]);
var statNameColor = Number(parameters["StatNameColor"]);
var statValueColor = Number(parameters["StatValueColor"]);
var shiftIncrease = Number(parameters["ShiftIncrease"]);
var levelUpPoints = String(parameters["LevelUpPoints"]);
var usedStats = String(parameters["UsedStats"]);
var usedXStats = String(parameters["UsedXStats"]);
var xParamNames = String(parameters["ExtraParamNames"]);
var defaultLimits = String(parameters['DefaultLimits']);
var defaultxLimits = String(parameters['DefaultxParamLimits']);
var maxPointsPerLevel = String(parameters['MaxPointsPerLevel']);
//This function will return an array with the ids of the used stats
getUsedStats = function(){
var re = /\d+/g;
return usedStats.match(re) || [];
}
//This function will return an array with the ids of the used extra stats
getUsedXStats = function(){
var re = /\d+/g;
return usedXStats.match(re) || [];
}
//This function will return the name of the extra param with given index
getXParamName = function(id){
var names = eval(xParamNames);
return names[id];
}
//Game batlerbase
Game_BattlerBase.prototype.xparam = function(xparamId){
var value = this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId) + this._gainedxparams[xparamId];
return value;
};
Game_Actor.prototype.increasePointLimit = function(){
for(i=0; i this.paramMax(paramid)){
result =false;
}
return result;
}
Game_Actor.prototype.canIncreasex = function(paramid, points, alreadyUsed){
var result = true;
if(((this._usedxPoints[paramid] + points) > this.maxPerLevel()) && (this.maxPerLevel() != 0)){
result = false;
}
if((this.xparam(paramid) + alreadyUsed + points*this.xstatPerPoint(paramid)) > this.xparamMax(paramid)){
result =false;
}
return result;
}
Game_Actor.prototype.paramMax = function(paramId){
var limit;
var meta = "this.actor().meta." + getTag(paramId);
meta = eval(meta);
meta = meta ? meta : "$dataClasses[this.actor().id].meta." + getTag(paramId);
meta = eval(meta);
if(meta){
limit = Number(meta);
}else{
limit = getLimit(paramId);
}
return limit;
};
Game_Actor.prototype.xparamMax = function(paramId){
var limit = eval(defaultxLimits);
return limit[paramId];
};
//Stat increase per stat point
Game_Actor.prototype.statPerPoint = function(id){
var str;
switch(id){
case0:
str = "ihp";
break;
case1:
str = "imp";
break;
case2:
str = "iatk";
break;
case3:
str = "idef";
break;
case4:
str = "imat";
break;
case5:
str = "imdf";
break;
case6:
str = "iagi";
break;
case7:
str = "iluk";
break;
}
var met = "$dataClasses[this._classId].meta." + str;
met = eval(met);
met = met ? met : "this.actor().meta." + str;
met = eval(met);
return met ? eval(met) : 1;
}
//Xstat increase per stat point
Game_Actor.prototype.xstatPerPoint = function(id){
var str;
switch(id){
case0:
str = "ihit";
break;
case1:
str = "ieva";
break;
case2:
str = "icri";
break;
case3:
str = "icev";
break;
case4:
str = "imev";
break;
case5:
str = "imrf";
break;
case6:
str = "icnt";
break;
case7:
str = "ihrg";
break;
case8:
str = "imrg";
break;
case9:
str = "itrg";
}
var met = "$dataClasses[this._classId].meta." + str;
met = eval(met);
met = met ? met : "this.actor().meta." + str;
met = eval(met);
returneval(met) ? eval(met) : 1;
}
//-New function gainStats to call on level ups etc
Game_Actor.prototype.gainStats = function(amount){
this._statPoints += amount;
}
//-Gain stats on level up
_GameActorLevelUp = Game_Actor.prototype.levelUp;
Game_Actor.prototype.levelUp = function(){
_GameActorLevelUp.call(this);
this.gainStats(eval(levelUpPoints));
this.increasePointLimit();
};
//-Actor current stats
Game_Actor.prototype.statPoints = function(){
returnthis._statPoints;
}
//-----New windows
//****************************************************
//
//---Window Points, to display stat points.
//
//****************************************************
function Window_Points(){
this.initialize.apply(this, arguments);
}
Window_Points.prototype.refresh = function(newActor){
if(!newActor){
newActor = this.actor();
}
this._actor = newActor;
var x = this.textPadding();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
this.drawThings();
};
Window_Points.prototype.drawThings = function(){
var x = 1;
var y = 1;
var mWidth = Math.round(this.windowWidth()/2.5);
var value = this._actor.statPoints();
this.changeTextColor(this.textColor(statNameColor));
this.drawText(pointsName, x, y, mWidth);
this.changeTextColor(this.textColor(statValueColor));
this.drawText(value, x + mWidth + 10, y, mWidth);
}
//****************************************************
//
//---Window Selecting, to increase stats or leave scene
//
//****************************************************
Window_Selecting.prototype.activate = function(index){
Window_Base.prototype.activate.call(this);
index2 = index ? index : this._index;
this.select(index2);
};
Window_Selecting.prototype.makeCommandList = function(){
varname;
var used = getUsedStats();
var usedx = getUsedXStats();
var k;
var mode = this._mode;
for(i=0;i