Knightmare

Knight of the Night
Regular
Joined
Mar 14, 2012
Messages
1,281
Reaction score
333
First Language
English
Primarily Uses
RMMZ
@Vandeliar You have to do it like this $gameActors.actor(1).gainStats(3)
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
@Vandeliar You have to do it like this $gameActors.actor(1).gainStats(3)



Yeah, I did put it wrong in the script description, my bad there.


Will update this and add some things, today or tomorrow maybe
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
Updated:


-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
 

Richard John S

Rpg Maker Music Pack Contributor
Regular
Joined
Jan 31, 2014
Messages
221
Reaction score
794
First Language
English
Primarily Uses
RMMZ
Looks good, but every time I download MS Security Essentials keeps targeting it as a virus and deletes it. This is not the first script MS: SE has done this. It did it for one of Yanfly's scripts too.
 

Vandeliar

Regular
Regular
Joined
Oct 31, 2013
Messages
68
Reaction score
6
First Language
German
Primarily Uses
Nice Plugin Update.


You need to edit your Start Post, because there is still the old Description.


Another Idea, i know the parameter limit overwrites the Yanfly Parameter Limits.


Thats ok, but another Question, is it possible to do the limit without the Weapon ?


Example:


Strenght Parameter Limit = 120


If you equip ah Weapon with 17 Damage, it should be 137 right ?


But it doesn't, the Limit is with equiped Weapon 120..


Or do i need to rewrite the Plugin Limit ?


A Option would be nice to set the Plugin Limit enable or disable with true/false, but the custom notetags for limits should work.


Don't know how to setup this Plugin, to get maximal 120 Points and if i equip ah Weapon, the weapon should break the limit on their own.


Like the example above.


Sorry for my bad Englisch.


it's still ah nice Plugin
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
Nice Plugin Update.


You need to edit your Start Post, because there is still the old Description.


Another Idea, i know the parameter limit overwrites the Yanfly Parameter Limits.


Thats ok, but another Question, is it possible to do the limit without the Weapon ?


Example:


Strenght Parameter Limit = 120


If you equip ah Weapon with 17 Damage, it should be 137 right ?


But it doesn't, the Limit is with equiped Weapon 120..


Or do i need to rewrite the Plugin Limit ?


A Option would be nice to set the Plugin Limit enable or disable with true/false, but the custom notetags for limits should work.


Don't know how to setup this Plugin, to get maximal 120 Points and if i equip ah Weapon, the weapon should break the limit on their own.


Like the example above.


Sorry for my bad Englisch.


it's still ah nice Plugin





I will format this topic, but lazy....


The limit is global, all sources of the parameter added up can't exceed the limit. In your example if you set the strength limit to 120, it won't increase past 120 by any means.


I can add an option to limit only the raw stats in the next update.
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
double post
 
Last edited by a moderator:

Vandeliar

Regular
Regular
Joined
Oct 31, 2013
Messages
68
Reaction score
6
First Language
German
Primarily Uses
@Frozen_Phoenix:


Hey Frozen, it's been awhile.


Well i got ah new thing to recreate something on your Plugin.


The Names and stats and Parameters..


can you make an option to set the Alignment of it ?


Because if you got ah charactername with something about 8 Words.. the Name gets cut off..


And i cant get it to work.


Please Help ^^

Unbenannt-1.jpg
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
@Frozen_Phoenix:


Hey Frozen, it's been awhile.


Well i got ah new thing to recreate something on your Plugin.


The Names and stats and Parameters..


can you make an option to set the Alignment of it ?


Because if you got ah charactername with something about 8 Words.. the Name gets cut off..


And i cant get it to work.


Please Help ^^


View attachment 38646





The text should shrink, but something messed up because of the smaller font size I think. Will see what I can do.

I did some tests and couldn't reproduce the problem even when changing the font size, but it happened when I changed the screen width.

Try this and tell me if it works:

Code:
//=============================================================================
// 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()[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:

<ihp: amount>
<imp: amount>
<iatk: amount>
<idef: amount>
<imat: amount>
<imdf: amount>
<iagi: amount>
<iluk: amount>

For extra parameters:

<ihit: amount>
<ieva: amount>
<icri: amount>
<icev: amount>
<imev: amount>
<imrf: amount>
<icnt: amount>
<ihrg: amount>
<imrg: amount>
<itrg: amount>

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:

<hplimit: >
<mplimit: >
<atklimit: >
<deflimit: >
<matlimit: >
<mdflimit: >
<agilimit: >
<luklimit: >



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']);

getLimit = function(id) {
	limits = eval(defaultLimits);
	return limits[id];
}

getTag = function(id) {
	switch(id) {
		case 0:
			return "hplimit";
		case 1:
			return "mplimit";
		case 2:
			return "atklimit";
		case 3:
			return "deflimit";
		case 4:
			return "matlimit";
		case 5:
			return "mdflimit";
		case 6:
			return "agilimit";
		case 7:
			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[id];
}

//Game batlerbase

Game_BattlerBase.prototype.xparam = function(xparamId) {
	var value = this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId) + this._gainedxparams[xparamId];
    return value;
};

_GameBattlerBaseInitialize = Game_BattlerBase.prototype.initialize;
Game_BattlerBase.prototype.initialize = function() {
    _GameBattlerBaseInitialize.call(this);
	this._gainedxparams = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
};


Game_BattlerBase.prototype.paramMax = function(paramId) {
    if (paramId == 0) {
        return 999999;  // MHP
    } else if (paramId == 1) {
        return 9999;    // MMP
    } else {
        return 999;
    }
};

	
//---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 = [0, 0, 0, 0, 0, 0, 0, 0];
	this._usedxPoints = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}

Game_Actor.prototype.increasePointLimit = function() {
	for (i=0; i<this._usedxPoints.length; i++) {
		if (i<this._usedPoints.length) {
			this._usedPoints[i] -= this.maxPerLevel();
		}
		this._usedxPoints[i] -= this.maxPerLevel();
	}
}

Game_Actor.prototype.usePoints = function(paramid, points) {
	this._usedPoints[paramid] += points;
}

Game_Actor.prototype.usexPoints = function(paramid, points) {
	this._usedxPoints[paramid] += points;
}

Game_Actor.prototype.canIncrease = function(paramid, points, alreadyUsed) {
	var result = true;
	if (((this._usedPoints[paramid] + points) > this.maxPerLevel()) && (this.maxPerLevel() != 0)) {
		result = false;
	}
	if ((this.param(paramid) + alreadyUsed + points*this.statPerPoint(paramid)) > 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];
};

Game_Actor.prototype.maxPerLevel = function() {
	return eval(this.actor().meta.maxPerLevel) || Number(maxPointsPerLevel); 
}

//Stat increase per stat point
Game_Actor.prototype.statPerPoint = function(id) {
	var str;
	switch(id) {
		case 0:
			str = "ihp";
			break;
		case 1:
			str = "imp";
			break;
		case 2:
			str = "iatk";
			break;
		case 3:
			str = "idef";
			break;
		case 4:
			str = "imat";
			break;
		case 5:
			str = "imdf";
			break;
		case 6:
			str = "iagi";
			break;
		case 7:
			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) {
		case 0:
			str = "ihit";
			break;
		case 1:
			str = "ieva";
			break;
		case 2:
			str = "icri";
			break;
		case 3:
			str = "icev";
			break;
		case 4:
			str = "imev";
			break;
		case 5:
			str = "imrf";
			break;
		case 6:
			str = "icnt";
			break;
		case 7:
			str = "ihrg";
			break;
		case 8:
			str = "imrg";
			break;
		case 9:
			str = "itrg";
	}
	var met = "$dataClasses[this._classId].meta." + str;
	met = eval(met);
	met = met ? met : "this.actor().meta." + str;
	met = eval(met);
	return eval(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() {
	return this._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() {
    return 300;
};

Window_Points.prototype.actor = function () {
	return this._actor;
}

Window_Points.prototype.windowHeight = function() {
    return this.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() {
    return 350;
};

Window_Selecting.prototype.numVisibleRows = function() {
    return 9;
};

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() {
	var name;
	var used = getUsedStats();
	var usedx = getUsedXStats();
	var k;
	var mode = this._mode;
	for(i=0;i<used.length;i++) {
		k = Number(used[i]);
		name = mode + " " + TextManager.param(k);
		this.addCommand(name, 'param' + k.toString());
	}
	for(i=0;i<usedx.length;i++) {
		k = Number(usedx[i]);
		y = k + 10;
		name = mode + " " + getXParamName(k);
		this.addCommand(name, 'param' + y.toString());
	}
	this.addCommand("Exit", 'exit');
}


//****************************************************
//
//---Window xParams, display character especial parameters
//
//****************************************************

function Window_xParams() {
	this.initialize.apply(this, arguments);
}

Window_xParams.prototype = Object.create(Window_Base.prototype);
Window_xParams.prototype.constructor = Window_xParams;

Window_xParams.prototype.initialize = function (x, y, actor, increased) {
	this._increased = increased;
	this._width = Graphics.boxWidth - x;
    var height = Graphics.boxHeight - y;
	Window_Base.prototype.initialize.call(this, x, y, this._width, height);
	this._actor = actor;
    this.refresh();
};

Window_xParams.prototype.actor = function() {
	return this._actor;
};

Window_xParams.prototype.baseDraw = function(name, value, x, y) {
	var mWidth = Math.round(this._width/1.5);
	var x2 = x + mWidth + 5;
    this.changeTextColor(this.textColor(statNameColor));
    this.drawText(name, x, y, mWidth);
    this.changeTextColor(this.textColor(statValueColor));
    this.drawText(value, x2, y, mWidth);
}

Window_xParams.prototype.drawActorStat = function(x, y, id) {
	var pName = getXParamName(id);
	var pValue = this.actor().xparam(id) + this._increased[id];
	this.baseDraw(pName, pValue.toFixed(2), x, y);
};

Window_xParams.prototype.drawParameters = function() {
	var x = 1;
	var y = 1;
	var usedx = getUsedXStats();
	var lineHeight = this.lineHeight();
	for(i=0;i<usedx.length;i++) {
		this.drawActorStat(x, y + lineHeight * i, Number(usedx[i]));		
	}
}

Window_xParams.prototype.refresh = function(newActor) {
	if (!newActor) {
		newActor = this.actor();
	}
	this._actor = newActor;
	if (this.contents) {
		this.contents.clear();
		this.drawParameters();
	}
}


//****************************************************
//
//---Window Char, display character image and current stats
//
//****************************************************


function Window_Char() {
	this.initialize.apply(this, arguments);
}

Window_Char.prototype = Object.create(Window_Base.prototype);
Window_Char.prototype.constructor = Window_Char;


Window_Char.prototype.initialize = function (x, y, actor, increased) {
	var width = this.windowWidth();
    var height = this.windowHeight();
	this._increased = increased;
	this._actor = actor;
    Window_Base.prototype.initialize.call(this, x, y, width, height);
	this.loadImages();
    this.refresh();
};

Window_Char.prototype.actor = function() {
	return this._actor;
};

Window_Char.prototype.windowWidth = function() {
    return Graphics.boxWidth;
};

Window_Char.prototype.windowHeight = function() {
    return Math.round(Graphics.boxHeight / 3) - 20;
};

Window_Char.prototype.loadImages = function() {
	for (i=0; i<$gameParty.members().length;i++){
    	ImageManager.loadFace($gameParty.members()[i].faceName());
    }
};

Window_Char.prototype.drawItem = function() {
	this.drawItemImage();
	this.drawItemStatus();
    this.drawParameters();
};

Window_Char.prototype.drawItemImage = function() {
	this.drawActorFace(this.actor(), 1, 1, 144, 144);
};

Window_Char.prototype.drawItemStatus = function() {
	var x = 160;
	var actor = this.actor();
	var y = 1;
	var lineHeight = this.lineHeight();
    this.drawActorName(actor, x, y);
    this.drawActorLevel(actor, x, y + lineHeight * 1);
    this.drawActorClass(actor, x, y + lineHeight * 2);
	this.drawActorExp(actor, x, y + lineHeight * 3);
};

Window_Char.prototype.drawParameters = function() {
	var x = 390;
	var y = 1;
	var used = getUsedStats();
	var lineHeight = this.lineHeight();
	var k;
	for(i=0;i<used.length;i++) {
		if (i < 4) {
			this.drawActorStat(x, y + lineHeight * i, used[i]);
		} else {
			k = i-4;	
			this.drawActorStat(x + 220, y + lineHeight * k, used[i]);
		}	
	}
}


Window_Char.prototype.baseDraw = function(name, value, x, y) {
	var mWidth = 100;
	var x2 = x + mWidth + 10;
    this.changeTextColor(this.textColor(statNameColor));
    this.drawText(name, x, y, mWidth);
    this.changeTextColor(this.textColor(statValueColor));
    this.drawText(value, x2, y, mWidth);
}

Window_Char.prototype.drawActorExp = function(actor, x, y) {
	this.baseDraw(expName, actor.currentExp(), x, y);
}

Window_Char.prototype.drawActorClass = function(actor, x, y) {
	this.baseDraw(className, actor.currentClass().name, x, y);
}

Window_Char.prototype.drawActorName = function(actor, x, y) {
    this.baseDraw(actorName, actor.name(), x, y);
};

Window_Char.prototype.drawActorLevel = function(actor, x, y) {
	this.baseDraw(TextManager.level, actor.level, x, y);
};


Window_Char.prototype.drawActorStat = function(x, y, id) {
	var pName = TextManager.param(id);
	var pValue = this.actor().param(id) + this._increased[id];
	this.baseDraw(pName, pValue.toFixed(0), x, y);
};

Window_Char.prototype.refresh = function(newActor) {
	if (!newActor) {
		newActor = this.actor();
	}
	this._actor = newActor;
	if (this.contents) {
		this.contents.clear();
		this.drawItem();
	}
}



//****************************************************
//
//---Scene Distribution, the main scene
//
//****************************************************


function Scene_Distribution() {
    this.initialize.apply(this, arguments);
}

Scene_Distribution.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Distribution.prototype.constructor = Scene_Distribution;


Scene_Distribution.prototype.initialize = function(actor, party) {
	this._actorr = actor;
	this._party = party;
	this._params = [0,0,0,0,0,0,0,0,0,0,0,0,0];
	this._xparams = [0,0,0,0,0,0,0,0,0,0,0,0,0];
	this._usedStats = 0;
    Scene_MenuBase.prototype.initialize.call(this);
};

Scene_Distribution.prototype.actor = function() {
	return this._actorr;
}

Scene_Distribution.prototype.inPartyMode = function() {
	return this._party;
}

Scene_Distribution.prototype.create = function() {
	Scene_MenuBase.prototype.create.call(this);
	this.createCharWindow(this.actor());
	this.createXParamWindow(this.actor());
	this.createDecreaseWindow();
	this.createSelectingWindow();
	this.createPointWindow(this.actor());
}


Scene_Distribution.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
    this._charWindow.refresh();
};


Scene_Distribution.prototype.createCharWindow = function(actor) {
	this._charWindow = new Window_Char(0, 0, actor, this._params);
	this.addWindow(this._charWindow);
}

Scene_Distribution.prototype.createXParamWindow = function(actor) {
	var usedx = getUsedXStats();
	if (usedx) {
		if (usedx.length >= 1) {
			this._xParamWindow = new Window_xParams(500, this._charWindow.windowHeight(), actor, this._xparams);
			this.addWindow(this._xParamWindow);
		}		
	}	
}

Scene_Distribution.prototype.createSelectingWindow = function() {
	this._selectingWindow = new Window_Selecting(0, this._charWindow.windowHeight(), increaseName);
	var used = getUsedStats();
	var usedx = getUsedXStats();
	var k;
	for(i=0;i<used.length;i++) {
		k = Number(used[i]);
		this._selectingWindow.setHandler('param' + k.toString(), this.increaseParam.bind(this, k));
	}
	for(i=0;i<usedx.length;i++) {
		k = Number(usedx[i]);
		y = k + 10;
		this._selectingWindow.setHandler('param' + y.toString(), this.increaseExParam.bind(this, k));
	}
	if (this.inPartyMode()) {
		this._selectingWindow.setHandler('pageup', this.nextActor.bind(this, false));
		this._selectingWindow.setHandler('pagedown', this.nextActor.bind(this, true));
	}
	this._selectingWindow.setHandler('exit', this.exit.bind(this));
	this._selectingWindow.setHandler('cancel', this.swapWindows.bind(this, "decrease"));
	this.addWindow(this._selectingWindow);
	this._selectingWindow.activate();
}

Scene_Distribution.prototype.createDecreaseWindow = function() {
	this._decreaseWindow = new Window_Selecting(0, this._charWindow.windowHeight(), decreaseName);
	var used = getUsedStats();
	var usedx = getUsedXStats();
	var k;
	for(i=0;i<used.length;i++) {
		k = Number(used[i]);
		this._decreaseWindow.setHandler('param' + k.toString(), this.decreaseParam.bind(this, k));
	}
	for(i=0;i<usedx.length;i++) {
		k = Number(usedx[i]);
		y = k + 10;
		this._decreaseWindow.setHandler('param' + y.toString(), this.decreaseExParam.bind(this, k));
	}
	if (this.inPartyMode()) {
		this._decreaseWindow.setHandler('pageup', this.nextActor.bind(this, false));
		this._decreaseWindow.setHandler('pagedown', this.nextActor.bind(this, true));
	}
	this._decreaseWindow.setHandler('exit', this.exit.bind(this));
	this._decreaseWindow.setHandler('cancel', this.swapWindows.bind(this, "increase"));
	this.addWindow(this._decreaseWindow);
	this._decreaseWindow.hide();
	this._decreaseWindow.deactivate();
}

Scene_Distribution.prototype.nextActor = function(mode) {
	SoundManager.playEvasion;
	var j = $gameParty.members().indexOf(this.actor());
	var l = $gameParty.members().length;
	if (mode) {
		j = (j+1)==l ? 0 : (j+1);
	} else {
		j = (j-1)<0 ? (l-1) : (j-1);
	}
	this.addParameters();
	this._actorr = $gameParty.members()[j];
	this._charWindow.refresh(this.actor());
	if (this._xParamWindow) {
		this._xParamWindow.refresh(this.actor());
	}
	this._pointWindow.refresh(this.actor());
	this.swapWindows("increase");
}

Scene_Distribution.prototype.swapWindows = function(mode) {
	SoundManager.playEvasion;
	switch (mode) {
		case "increase":
			this._decreaseWindow.deactivate();
			this._decreaseWindow.hide();
			this._selectingWindow.show();
			this._selectingWindow.activate(this._decreaseWindow._index);
			break;
		case "decrease":
			this._selectingWindow.deactivate();
			this._selectingWindow.hide();
			this._decreaseWindow.show();
			this._decreaseWindow.activate(this._selectingWindow._index);
			break;			
	}
}

Scene_Distribution.prototype.addParameters = function() {
	for (i=0;i<8;i++) {
		this.actor().addParam(i, Number(this._params[i].toFixed()));
	}
	for (i=0;i<10;i++) {
		this.actor()._gainedxparams[i] += Number(this._xparams[i].toFixed(2));
	}
	for (i=0;i<13;i++){
		this._params[i] = 0;
		this._xparams[i] = 0;
	}
	this._usedStats = 0;
}

Scene_Distribution.prototype.exit = function() {
	SoundManager.playCancel();
	this.addParameters();
	SceneManager.pop();
}

Scene_Distribution.prototype.createPointWindow = function(actor) {
	var y = this._charWindow.windowHeight() + this._selectingWindow.windowHeight();
	this._pointWindow = new Window_Points(0, y, actor);
	this.addWindow(this._pointWindow);
}

Scene_Distribution.prototype.increaseParam = function(id) {
	var x = Input.isPressed('shift') ? shiftIncrease : 1;
	var amount;
	var condition = this.actor().canIncrease(id, x, this._params[id]);
	if ((this.actor().statPoints() >= x) && condition) {
		amount = this.actor().statPerPoint(id)*x;
		this._params[id] += amount;
		this._selectingWindow.playOkSound();
		this._usedStats += x;
		this.actor().gainStats(-x);
		this.actor().usePoints(id, x);
	} else {
		this._selectingWindow.playBuzzerSound();
	}
	this._charWindow.refresh();
	this._pointWindow.refresh();
	if (this._xParamWindow) {
		this._xParamWindow.refresh();
	}
	this._selectingWindow.activate();
}

Scene_Distribution.prototype.increaseExParam = function(id) {
	var x = Input.isPressed('shift') ? shiftIncrease : 1;
	var amount;
	var condition = this.actor().canIncreasex(id, x, this._xparams[id]);
	if ((this.actor().statPoints() >= x) && condition) {
		amount = this.actor().xstatPerPoint(id)*x;
		this._xparams[id] += amount;
		this._selectingWindow.playOkSound();
		this._usedStats += x;
		this.actor().gainStats(-x);
		this.actor().usexPoints(id, x);
	} else {
		this._selectingWindow.playBuzzerSound();
	}
	this._charWindow.refresh();
	this._pointWindow.refresh();
	if (this._xParamWindow) {
		this._xParamWindow.refresh();
	}
	this._selectingWindow.activate();
}

Scene_Distribution.prototype.decreaseParam = function(id) {
	var x = Input.isPressed('shift') ? shiftIncrease : 1;
	var amount = this.actor().statPerPoint(id)*x;;
	if ((this._usedStats >= x) && (this._params[id] >= amount)) {
		this._params[id] -= amount;
		SceneManager.playCancel;
		this._usedStats -= x;
		this.actor().gainStats(x);
		this.actor().usePoints(id, -x);
	} else {
		this._decreaseWindow.playBuzzerSound();
	}
	this._charWindow.refresh();
	this._pointWindow.refresh();
	if (this._xParamWindow) {
		this._xParamWindow.refresh();
	}
	this._decreaseWindow.activate();
}

Scene_Distribution.prototype.decreaseExParam = function(id) {
	var x = Input.isPressed('shift') ? shiftIncrease : 1;
	var amount = this.actor().xstatPerPoint(id)*x;;
	if ((this._usedStats >= x) && (this._xparams[id] >= amount)) {
		this._xparams[id] -= amount;
		SceneManager.playCancel;
		this._usedStats -= x;
		this.actor().gainStats(x);
		this.actor().usePoints(id, -x);
	} else {
		this._decreaseWindow.playBuzzerSound();
	}
	this._charWindow.refresh();
	this._pointWindow.refresh();
	if (this._xParamWindow) {
		this._xParamWindow.refresh();
	}
	this._decreaseWindow.activate();
}



SceneManager.sceneDistribution = function(actor, party) {
	if (typeof(party) === 'undefined') {
		party = false;
	}
	this._stack.push(this._scene.constructor);
	if (Scene_Distribution) {
        this._nextScene = new Scene_Distribution(actor, party);
    }
    if (this._scene) {
        this._scene.stop();
    }
}

SceneManager.partyDistribution = function(index) {
	if (typeof(index) === 'undefined') {
		index = 0;
	}
	var actor = $gameParty.members()[index];
	this.sceneDistribution(actor, true);
}
	
})();
 
Last edited by a moderator:

Vandeliar

Regular
Regular
Joined
Oct 31, 2013
Messages
68
Reaction score
6
First Language
German
Primarily Uses
@Frozen_Phoenix:


Hey ^^


Sorry for the long reply.


It works now. Maybe it was ah problem with the changed screen width.


It's working Perfect now.


Thank you for this amazing Plugin !
 

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
The max width for words scaled with screen width, but the x position of the words was constant, that's what caused the problem. Will update the download with the new code
 

Recruit

Villager
Member
Joined
Sep 14, 2015
Messages
20
Reaction score
5
First Language
English
Primarily Uses
Hey there im not sure if your still updating this or not, but I'm running windows 10 and every time I download it normally, it automatically deletes your plug-in. So i tried copying your scripts, and reapplying them into a fresh plug-in.


The problem is when i start my RPGMMV it says TYPE ERROR: cannot read property '0''of undefined.


I tried unplugging all the other plug-ins and problems still persist. Any help would be very much appreciated. Or if you could make another way to download your file, it would also be very much appreciated
 

Mo zero

Warper
Member
Joined
May 24, 2016
Messages
3
Reaction score
0
Primarily Uses
This is a cool plugin,Thank you for sharing
But you can give it adds an extra feature?
such as, Increase when IHP , ITRG and IMRF Will also follow the increaseI


PS:I was using the translation software to play these words, if you feel confused I am sorry
 
Last edited by a moderator:

Frozen_Phoenix

Regular
Regular
Joined
Nov 15, 2014
Messages
134
Reaction score
79
First Language
Portuguese
Primarily Uses
RMMV
@Recruit Sorry, just saw your post today... The plugin is working fine here, the download problem might be windows defender deleting it because it thinks it is a virus or something.

@Mo zero Didn't understand what you mean. You can already increase those parameters, maybe make it so one parameter also increases when other gets increased?
 

Forthright

Regular
Regular
Joined
Mar 9, 2016
Messages
60
Reaction score
10
First Language
English
Primarily Uses
So Frozen, could this be used to adjust custom stats?   We use custom stats to define everything in our game as it is a D20 style system and we really need something to allow the assigning of points.  Also, it's possible to set increases based on the stat right?  Meaning lets say I have 15 Vitality, it would cost me 3 points to increase it and if it was at 20 Vitality it would cost me 4.
 

Zarsla

Regular
Regular
Joined
Jan 23, 2015
Messages
715
Reaction score
236
First Language
English
Primarily Uses
RMMZ
@Frozen_Phoenix
I've made some edits to your plugin.

1. Menu Name:
Adds a Menu Name that can be called upon using Yanfly's Main Menu Manager,

2.Point Options:
In the Plugin Parameters there's a new Parameter called "Point Use", it allows for 3 new point typess to be used besides the Default, You can use JP aka Job Points if you have Yanfly's Job Points plugin, you can also use GP aka Gold Points aka Gold, XP aka Experience Points aka Experience and the default is DP or Default Points , referring to the Default Points

3. Parameter Expansion:
the <ihp>, <imp>, <iatk>, etc now refer to how many points will be spend on increasing the parameter they're assigned to.
While <php>,<pmp>,<patk>, etc refer to how much is increased.
For example :
<ihp: 176>
<php: 5>

Means that when you go in and spend points, you'll get 5 hp and you'll spend 176 points.

And the shift parameter now acts as a multipler so if the shift increase paramter said 5, and using the example above, it'll gain 25 hp and will spend 880 points.

And That's it.

Plugin
 
Last edited:

styx92

Regular
Regular
Joined
Jan 7, 2016
Messages
310
Reaction score
39
First Language
German
Primarily Uses
@Frozen_Phoenix
Hey dude, looks like a nice plugin.
Could i use yanflys job points as the currency?

I like the optical, but job points would be a nicr currency for this
 

Zarsla

Regular
Regular
Joined
Jan 23, 2015
Messages
715
Reaction score
236
First Language
English
Primarily Uses
RMMZ
@Frozen_Phoenix
Hey dude, looks like a nice plugin.
Could i use yanflys job points as the currency?

I like the optical, but job points would be a nicr currency for this
Use this:
https://www.dropbox.com/s/v3rryhchtnoc0ef/StatDistribution.js?dl=0

It's just an edited version Frozen's Plugin, with JP, Gold and Expereince added a currency you can use, but only 1.

Just make sure that you keep in mind that:
<ihp:x>, <imp:x>, <iatk:x> and all the other <iParams:x> & <iXparams: x> are by how much they increased when you buy a parameter
while:
<php:x>, <pmp:x>, <patk:x> and all the other <iParams:x> & <iXparams: x> are how much they cost when you buy a parameter once.

Under the "Points Type Parameter", type JP; and under "LevelUpPoints" type 0.
 

styx92

Regular
Regular
Joined
Jan 7, 2016
Messages
310
Reaction score
39
First Language
German
Primarily Uses
Haha sorry i dont read the last post xD

Really nice if this works. I test it if im home.
Is there a way to increase the costs after each point? I wanna do it like dark souls. So if an update costs 100 points and you increase atk for 100 points. Than the next update costs 150 for example, but for every stat!
So the player really have to think befor he choose a stat.
 

Latest Threads

Latest Profile Posts

How it feels right now with Advent resources and Sleigh the Competition event screenshots coming in.
WindRyder_ChristmasIncoming.png
So, apparently, Glow-in-the-Dark cats exist.

Are Sir Oinkers and the fairy responsible for all those dead uhm sleeping monsters?
Well, they now can be in your game, thanks to Day 4's content!
1701691228682.png
Stealing.
1701688258164287088.gif

Forum statistics

Threads
136,736
Messages
1,269,332
Members
180,455
Latest member
Razuk
Top