属性点分配插件无法使用
如题,找到个很好用的升级分配属性插件但总报错,新人表示灰常无奈。。哪位大大给指点一下。{:2_281:}附代码:
JAVASCRIPT 代码
//=============================================================================
// StatDistribution.js
//=============================================================================
/*:
@author Icaro10100 / FrozenPhoenix
@plugindesc Get stat points on level up, those points can be spent to increase stat value
@help
*********************************************************************************
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())
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
@param DefaultxParamLimits
@desc Highest possible value for special parameters
Just change the values, in order: hit/eva/crit/criteva etc.
@default
@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']);
getLimit = function(id){
limits = eval(defaultLimits);
return limits;
}
getTag = function(id){
switch(id){
case0:
return"hplimit";
case1:
return"mplimit";
case2:
return"atklimit";
case3:
return"deflimit";
case4:
return"matlimit";
case5:
return"mdflimit";
case6:
return"agilimit";
case7:
return"luklimit";
}
}
//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;
}
//Game batlerbase
Game_BattlerBase.prototype.xparam = function(xparamId){
var value = this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId) + this._gainedxparams;
return value;
};
_GameBattlerBaseInitialize = Game_BattlerBase.prototype.initialize;
Game_BattlerBase.prototype.initialize = function(){
_GameBattlerBaseInitialize.call(this);
this._gainedxparams = ;
};
Game_BattlerBase.prototype.paramMax = function(paramId){
if(paramId == 0){
return999999;// MHP
}elseif(paramId == 1){
return9999; // MMP
}else{
return999;
}
};
//---Game Actor
_GameActorInitialize = Game_Actor.prototype.initialize;
Game_Actor.prototype.initialize = function(actorId){
_GameActorInitialize.call(this, actorId);
this._statPoints = 0;
this.resetUsedPoints();
};
Game_Actor.prototype.resetUsedPoints = function(){
this._usedPoints = ;
this._usedxPoints = ;
}
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 + 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.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;
};
Game_Actor.prototype.maxPerLevel = function(){
returneval(this.actor().meta.maxPerLevel) || Number(maxPointsPerLevel);
}
//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.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.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 = Object.create(Window_Base.prototype);
Window_Points.prototype.constructor = Window_Points;
Window_Points.prototype.initialize = function(x, y, actor){
var width = this.windowWidth();
var height = this.windowHeight();
this._actor = actor;
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};
Window_Points.prototype.windowWidth = function(){
return300;
};
Window_Points.prototype.actor = function(){
returnthis._actor;
}
Window_Points.prototype.windowHeight = function(){
returnthis.fittingHeight(1);
};
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_Points.prototype.open = function(){
this.refresh();
Window_Base.prototype.open.call(this);
};
//****************************************************
//
//---Window Selecting, to increase stats or leave scene
//
//****************************************************
Window_Selecting.prototype = Object.create(Window_Command.prototype);
Window_Selecting.prototype.constructor = Window_Selecting;
function Window_Selecting(){
this.initialize.apply(this, arguments);
}
Window_Selecting.prototype.initialize = function(x, y, mode){
this._mode = mode;
Window_Command.prototype.initialize.call(this, x, y);
}
Window_Selecting.prototype.windowWidth = function(){
return350;
};
Window_Selecting.prototype.numVisibleRows = function(){
return9;
};
Window_Selecting.prototype.processOk = function(){
if(this.isCurrentItemEnabled()){
this.updateInputData();
this.deactivate();
this.callOkHandler();
}
};
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
页:
[1]