dayhjawk

Veteran
Veteran
Joined
Jul 5, 2015
Messages
107
Reaction score
12
First Language
English
Primarily Uses
any update/news on how to get custom stats to effect other stats?
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
168
First Language
English
Primarily Uses
N/A
@Everyone (lol)

I'm about 75% done with the rewrite. The version is being reset to 1.0, and all original notetags work. There will be parameters for each built-in formula (for global formula changes, like evade and crit), and there will also be notetags to allow formula overriding on classes, weapons, armors, and states. It's quite a large rewrite, but is much better and easier to expand in the future. :)

Also, the same basic functionality isn't changing. You can still do actor.stat for the value without having to use varying functions or plugin commands. I know that was a big draw of this plugin, and it is already in the rewrite.

For comparison, the original script was 445 lines long in the last development version. The new script is already 556, and I haven't updated the documentation portion yet. Also, here are some snippets of the new code:

Code:
//=============================================================================// Plugin Objects - CustomStatsStat// This object stores all information about a stat for a parent object.// This object can be found inside of actor.customStats[symbol] or enemy.customStats[symbol]//=============================================================================function CustomStatsStat(symbol, baseValue, percent, evl) {	this._symbol = symbol || null;	this._mods = new CustomStatsStatMods(this._symbol);	this._baseValue = new CustomStatsValue(baseValue, percent, evl);}CustomStatsStat.prototype.increase = function(objSrc) {	if (objSrc.hasCustomStats) {		this._mods.add(objSrc);	}};CustomStatsStat.prototype.decrease = function(objSrc) {	if (objSrc.hasCustomStats) {		this._mods.add(objSrc);	}};CustomStatsStat.prototype.value = function(owner) {	var value = this._baseValue.value(owner);	value += this._mods.value(owner);	return value;};Object.defineProperties(CustomStatsStat.prototype, {	symbol: {		get: function() {			return this._symbol		},		configurable: true	},	percent: {		get: function() {			return this._percent || false;		},		configurable: true	},	baseValue: {		get: function() {			return this._baseValue		},		configurable: true	},	mods: {		get: function() {			return this._mods;		},		configurable: true	},	evl: {		get: function() {			return this._evl;		},		configurable: true	},});//=============================================================================// Plugin Objects - CustomStatsStatMods// This object stores stat mods by source type in an object indexed by the source's id.// The mods are then added to the stat's baseValue by the CustomStatsStat.value() method.// Stat modifications can be added and removed easily due to this.// This object should be called and calculated each time the stat's value is needed.//=============================================================================function CustomStatsStatMods(symbol) {	this._symbol = symbol;	this._data = {		'Weapon': new CustomStatsModCategory('Weapon'),		'Armor': new CustomStatsModCategory('Armor'),		'State': new CustomStatsModCategory('State'),		'Item': new CustomStatsModCategory('Item'),		'Class': new CustomStatsModCategory('Class')	};}CustomStatsStatMods.prototype.add = function(objSrc) {	if (DataManager.isWeapon(objSrc)) {		return this._addWeaponMods(objSrc);	}	if (DataManager.isArmor(objSrc)) {		return this._addArmorMods(objSrc);	}	if (DataManager.isState(objSrc)) {		return this._addStateMods(objSrc);	}	if (DataManager.isItem(objSrc)) {		return this._addItemMods(objSrc);	}	if (DataManager.isClass(objSrc)) {		return this._addClassMods(objSrc);	}};CustomStatsStatMods.prototype._addWeaponMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._appendMods(this._data.Weapon, objId, objSrc);};CustomStatsStatMods.prototype._addArmorMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._appendMods(this._data.Armor, objId, objSrc);};CustomStatsStatMods.prototype._addStateMods = function(objSrc) {	var objId = objSrc.id;	return this._appendMods(this._data.State, objId, objSrc);};CustomStatsStatMods.prototype._addItemMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._appendMods(this._data.Item, objId, objSrc);};CustomStatsStatMods.prototype._addClassMods = function(objSrc) {	var objId = objSrc.id;	return this._appendMods(this._data.Class, objId, objSrc);};CustomStatsStatMods.prototype._appendMods(dataList, objId, objSrc) {	return dataList.add(objId, objSrc.customStats[this._symbol].value());};CustomStatsStatMods.prototype.remove = function(objSrc) {	if (DataManager.isWeapon(objSrc)) {		return this._removeWeaponMods(objSrc);	}	if (DataManager.isArmor(objSrc)) {		return this._removeArmorMods(objSrc);	}	if (DataManager.isState(objSrc)) {		return this._removeStateMods(objSrc);	}	if (DataManager.isItem(objSrc)) {		return this._removeItemMods(objSrc);	}	if (DataManager.isClass(objSrc)) {		return this._removeClassMods(objSrc);	}};CustomStatsStatMods.prototype._removeWeaponMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._deleteMods(this._data.Weapon, objId, objSrc);};CustomStatsStatMods.prototype._removeArmorMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._deleteMods(this._data.Armor, objId, objSrc);};CustomStatsStatMods.prototype._removeStateMods = function(objSrc) {	var objId = objSrc.id;	return this._deleteMods(this._data.State, objId, objSrc);};CustomStatsStatMods.prototype._removeItemMods = function(objSrc) {	var objId = objSrc.baseItemId || objSrc.id;	return this._deleteMods(this._data.Item, objId, objSrc);};CustomStatsStatMods.prototype._removeClassMods = function(objSrc) {	var objId = objSrc.id;	return this._deleteMods(this._data.Class, objId, objSrc);};CustomStatsStatMods.prototype._deleteMods(dataList, objId, objSrc) {	return dataList.remove(objId);};CustomStatsStatMods.prototype.value(owner) {	var value = 0;	for (var cat in this._data) {		var category = this._data[cat];		for (var srcId in category.data) {			var mod = category.data[srcId];			value += mod.value(owner, category.srcList[srcId]);		}	}};
 
Last edited by a moderator:

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
I love this script, it's been a godsend for creating a dungeons and dragons style system in MV.

is there any way for it to modify existing parameters?  Like letting a custom stat (constitution) modify Max HP?
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
168
First Language
English
Primarily Uses
N/A
@lithkast: I'm currently working on the rewrite for this plugin. The new version does not have the ability to have custom stats modify basic parameters, although I think I can swing something like that in the first update. I'd rather get the basic plugin released, have the bugs worked out, then add more formula modifications.
 

Karindanslav

Villager
Member
Joined
Dec 30, 2013
Messages
10
Reaction score
0
First Language
Portuguese
Primarily Uses
Is there any way I can use this plugin to create a new, third resource like MP and TP that will be used by certain skills?

Maybe in combination with some other plugin available?

If not, do you think you could implement that?
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
168
First Language
English
Primarily Uses
N/A
@Karindanslav: It won't be in the initial rewrite, but I can look at something like this in the future. I'm guessing you'd want the gauges displayed in combat as well?
 

greay

Veteran
Veteran
Joined
Dec 19, 2015
Messages
23
Reaction score
2
First Language
English
Primarily Uses
What's the easiest way to define a set of custom stats for all characters?

I'd actually want this for actors & enemies alike. Adding note tags is fine for ones that are specific to a certain character, but it'd be useful for a way to add things across the board.
 

greay

Veteran
Veteran
Joined
Dec 19, 2015
Messages
23
Reaction score
2
First Language
English
Primarily Uses
When I start the game it gives the error "a key is not defined". 
I'm running into this as well. Opening up the debugger, I see that it's stopped at BOB_CustomStats.js:353 (in loadCustomStats) – "key", is, in fact, not defined anywhere in that function.

Also, I can't seem to get weapon stats to work. It's not adding anything to the stat.
 
Last edited by a moderator:

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
For the Key is not defined error.  it means your stat isn't defined.  I got the same error before I started using this script, when I would go into the base plugins and add stats there.  if I added regular params it would always return that error.  Post a screenshot or two of where you are defining your stats (actors, class, etc) and we might be able to help you further.

As for the adding to the stat.  That is something that should be brought up too.  If you have a weapon equiped at the start of the game (not equipped yourself but initially on your character) then it wont add the stat to the character.  If you remove the weapon though, you'll notice it will subtract from the stat though.  

So if STR is 2 on a character and a sword adds 1 STR, but you have the sword equipped at the start, it will show up as 2 STR instead of 3 STR.  If you remove the sword in game, your STR becomes 1.  

That is most likely the error you are experiencing there.  The solution for now is to equip weapons as you find them, or as the game starts in, run a hidden event that equips the character then erases itself.  

If this doesn't fix your error, please provide a list of plugins that you are using and some screenshots :D  I'll do my best to help out (I've been exploring this plugin a lot and am very dedicated to it.  Thank you Bob!)

As for easily adding stats to all characters?  Just copy and paste a template.  Like for instance, all my characters and enemies get the template:

<CustomStat: str=8>
<CustomStat: dex=8>

<CustomStat: con=8>
<CustomStat: wis=8>
<CustomStat: int=8>
<CustomStat: cha=8>

And I mod it from there using the enemies level as a guide, or the characters level as a guide.

Hope this helped you out Greay

---

Its no problem on the wait Bob.  I'm a patient guy and honestly, this is one of the best plugins for MV hands down.  The ability to make new stats has opened up the possibility for so much more.  Thank you for your hard work!
 
Last edited by a moderator:

greay

Veteran
Veteran
Joined
Dec 19, 2015
Messages
23
Reaction score
2
First Language
English
Primarily Uses
For the Key is not defined error.  it means your stat isn't defined.  I got the same error before I started using this script, when I would go into the base plugins and add stats there.  if I added regular params it would always return that error.  Post a screenshot or two of where you are defining your stats (actors, class, etc) and we might be able to help you further.
I did eventually resolve this, but it was a little tricky figuring out which stat was causing the problem.

As for the adding to the stat.  That is something that should be brought up too.  If you have a weapon equiped at the start of the game (not equipped yourself but initially on your character) then it wont add the stat to the character.  If you remove the weapon though, you'll notice it will subtract from the stat though.  


So if STR is 2 on a character and a sword adds 1 STR, but you have the sword equipped at the start, it will show up as 2 STR instead of 3 STR.  If you remove the sword in game, your STR becomes 1.  


That is most likely the error you are experiencing there.  The solution for now is to equip weapons as you find them, or as the game starts in, run a hidden event that equips the character then erases itself.
I see. Thanks! I'll probably go with option #2 for now.

As for easily adding stats to all characters?  Just copy and paste a template.  Like for instance, all my characters and enemies get the template:


...


And I mod it from there using the enemies level as a guide, or the characters level as a guide.
Yeah, this is what I've been doing, but it's still somewhat cumbersome. Especially if down the road I want to add another stat, I'd have to go through every single character & add the field. It'd be really useful if there were a way to just say "every actor gets this stat at X by default". (Also, I really wish there was a way to make that tiny notes field larger)
 

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
I just do all my note tags in notepad++ then copy paste it to the note box lol. Makes it easier
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
168
First Language
English
Primarily Uses
N/A
A lot of these issues will be fixed in the rewrite. It's taking longer than expected due to my day job picking up and also Christmas-related family matters.

Thanks again everyone for your patience and support. It will be here soon! :)
 

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
No problem bob. It's the holidays man, enjoy them lol. Have a merry Christmas!
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
467
Reaction score
228
First Language
Portuguese
Primarily Uses
RMMV
Bobstah, congratulations on another great plugin.

One thing I would like to ask, is it possible with this plugin to call the custom stat of a weapon? Lets say I want damage to be weapon only, and actor atk deal only with hit chance. Is it possible to call "w".stat in damage formula? "a.wpn_dmg"?
 

Bobstah

Pluginstah
Veteran
Joined
Oct 24, 2015
Messages
216
Reaction score
168
First Language
English
Primarily Uses
N/A
@Cristovao: I'm currently rewriting this plugin, but customizing damage formulas was part of the plan. I can look into something like this. I don't think it would too difficult.
 

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
Christ you can already do that in the current version.  I have.

you can call the stat in the damage formula.  There is another script floating around (probably several) that let you change which skill the weapon attacks with (though you don't need that if you want to just use the regular attack skill.)  Anyways do something like this

x = Math.floor((Math.random(20) + 1) + a.atk) ; if (x >= 10) { a.CustomStat * 4; } else { 0; }Quick overview.  X is a temp variable we are storing your random number in.  Math.floor just ensures that we round down instead of round up when  and if we end up with a decimal (for whatever reason).  

(Math.random(20) + 1) is just saying we want a random number between 1 and 20.  You can change that to whatever number you want really.  We add in atk to that number because its going to be our hit number.

next is an if statement.  Essentially if X is either equal to or greater than 10 (or any number really) then the code within the brackets will execute {code execution here} else {alternate code execution}

Of course this isn't actually modifying hit chance.  just set your hit to 100% for this.  you'll return 0 damage if you don't hit the target number.

hope that helped.
 

Crimson Dragon Inc.

Crimson Dragon
Veteran
Joined
Aug 8, 2012
Messages
921
Reaction score
134
First Language
english
Primarily Uses
RMMV
is this compatible with yanfly's scripts.... mainly the status window.... and can i use it to simulate stats strength, dexterity, constitution, intellegence, wisdom, charisma and the will power/cunning stats from dragon age origins?
 

Almost Simon

Villager
Member
Joined
Aug 8, 2013
Messages
21
Reaction score
17
Primarily Uses
Hello there,


I was wondering the exact same thing. I wan't to use custom parameters with the Yanfly Engine. I really like the Yanfly Status menu and would like to implement this plugin as well, but I can't seem to get it to work, since the Yanfly Status menu has set parameters already.


(I tried to call the custom stat 'dex' in the attribute window of the yanfly status menu, showed an empty row in game)


(scripts are in the right order, parameters are set up in the actor db properly)


If someone knows a solution on how to make these 2 script work together, i'd gladly try it out ;)


Thanks in advance


Simon
 

MakeAndCreate

Veteran
Veteran
Joined
Jul 3, 2014
Messages
45
Reaction score
3
First Language
English
Primarily Uses
How do I make an item affect the params of a custom stat of one actor, and not the other actors?
 

Latest Threads

Latest Posts

Latest Profile Posts

Bluh... glad this present heatwave is coming to a close...
Look what I found, it was my first ABS.

This project was never completed because I had lost the computer where it was stored.
Character Creator for RPGM 2000, VX, XP, & LPC Style Sprites | RPG Maker News #72

Is there any way to get more than 8 enemies in a troop in RMMV or is that limit pretty much hardcoded into the engine?
Stream will be live shortly with some game development! Feel free to drop by!

Forum statistics

Threads
112,269
Messages
1,066,972
Members
145,887
Latest member
rob007
Top