Is it possible to have a state alter specific values of parameters?

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
So basically the engine provides us with the ability to have states that alter percentages of parameters (attack * 100%) but doesn't allow for specific values (attack +1) like equipment does.

I tried to follow how the states are handled but i'm a junior in JS so i got lost before i could reach the source. My solution was to change how it handles the multiplication and do an addition instead. I even tried looking at the states object in the console.log but the only thing i found was a "traits" property. I tried changing the traits but the parameter wouldn't be affected - it seems it must be "refreshed" somehow. But still, i think i'm looking at it the wrong way.

Does anyone know how to have a state affect a parameter using additions/subtractions rather than multiplication? Even if all the states will be changed to behave this way.

EDIT: I'm not talking about the battle scene. I'm talking about getting a state outside it. For example, if you haven't eaten for too long, you get a "hungry" state, which lowers specific values of your stats (for example -1 def). It will only be removed manually.

EDIT:
Found it!!!!

Code:
Game_BattlerBase.prototype.param = function(paramId) {
var value = this.paramBase(paramId) + this.paramPlus(paramId);
value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
var maxValue = this.paramMax(paramId);
var minValue = this.paramMin(paramId);
return Math.round(value.clamp(minValue, maxValue));
};
See this function? This is what changes the parameter. So instead of "value*=" if you write "value+=" you get the result of the percentage ADDED.

This means that if your state has a trait of "attack 100%" it will add 1. 200% will add 2, etc.

However, in this manner, you will replace the behavior of ALL states, ALL traits. So handle with care. In my case, that's exactly what i wanted to do.

EDIT on the previous EDIT: It seems that i had to also change this:

Code:
Game_BattlerBase.prototype.traitsPi = function (code, id) {
        return this.traitsWithId(code, id).reduce(function (r, trait) {
            return r * trait.value;
        }, 1);
    };
and replace * with +


Take ultra care when changing these. In my game i am making my own systems/mechanics and most likely these functions affect how enemies behave as well. In my game these changes will not clash with anything else, but in your games they might.

However, i even used 2 states (500% each) and removed them to check what it does to the parameters. It seems that in each case, 5 was added with each state and then 5 was reduced with their removal. So it SEEMS to be working as intended. If i come across bugs or errors i will edit this post to let you know.
 
Last edited:

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
485
Reaction score
190
First Language
thai
Primarily Uses
RMMV
I'm not sure
but doesn't just make update function in battle scene
and check if actor got state etc
then use script call add atck +x/-x
if not then return the modifyer to zero or something?

well I know it actually harder than I talk
like you need to check if battle ending or whose turn is it now

and I not sure
doesn't yanfly got statmodifyer plugin about this
it will check what state or buff actor had and plus the stat
maybe you can use that
or you can dig how to make similar thing from it
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
I'm not sure
but doesn't just make update function in battle scene
and check if actor got state etc
then use script call add atck +x/-x
if not then return the modifyer to zero or something?

well I know it actually harder than I talk
like you need to check if battle ending or whose turn is it now

and I not sure
doesn't yanfly got statmodifyer plugin about this
it will check what state or buff actor had and plus the stat
maybe you can use that
or you can dig how to make similar thing from it
Thanks for your reply. I will edit my post to make it clearer: i'm not talking about the battle scene. I'm talking about getting a state outside it.

For example, if you haven't eaten for too long, you get a "hungry" state, which lowers specific values of your stats (for example -1 def). It will only be removed manually. I will also check Yanfly's plugin although i've pretty much checked all his states plugins...
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
485
Reaction score
190
First Language
thai
Primarily Uses
RMMV
Thanks for your reply. I will edit my post to make it clearer: i'm not talking about the battle scene. I'm talking about getting a state outside it.

For example, if you haven't eaten for too long, you get a "hungry" state, which lowers specific values of your stats (for example -1 def). It will only be removed manually. I will also check Yanfly's plugin although i've pretty much checked all his states plugins...
well... in that case
you can actually do it manually by even
pararell check if actor got stat
and change parameter doesn't it?
if you prefer to write a fucntion plugin
these are in the script call sheet
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
well... in that case
you can actually do it manually by even
pararell check if actor got stat
and change status doesn't it?
if you prefer to write a fucntion plugin
these are in the script call sheet

I know.. i will probably end up doing it manually but that's what i want to avoid. I would prefer to write a plugin that changes the way states behave when it comes to parameters, but i can't find which function governs that.
 

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
485
Reaction score
190
First Language
thai
Primarily Uses
RMMV
I know.. i will probably end up doing it manually but that's what i want to avoid. I would prefer to write a plugin that changes the way states behave when it comes to parameters, but i can't find which function governs that.
you can find scene_map update
it will check every frame like parallel event
and just alias it
to check your custom condition
there no checking state running on map
you just need to add one
and it still use the same script call to do
try open up some plugin that update thing on map you will see how it constructs
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
you can find scene_map update
it will check every frame like parallel event
and just alias it
to check your custom condition
there no checking state running on map
you just need to add one
and it still use the same script call to do
try open up some plugin that update thing on map you will see how it constructs
If i have to do it manually, i can come up with ideas of how to. But, again, that's what i want to avoid.

The states are already there, they already take input from the dev, and translate it to change values of the actor. This means that somewhere in there, there is a function that takes the number, finds the percentage (i have found this is stored in $dataStates[id].traits) and then multiplies it with the parameter in question.

What i'm trying to find is where that multiplication process takes place and change it to addition. As simple as that.
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
I think i found it. I found this:


Game_BattlerBase.prototype.traitsPi = function(code, id) {
return this.traitsWithId(code, id).reduce(function(r, trait) {
return r * trait.value;
}, 1);

trait.value is the value after the percentage. I'm going to check if it works now.

EDIT: Not as simple as changing * to + but i'll keep on working on it :p
 

MiD

Veteran
Veteran
Joined
Oct 22, 2018
Messages
57
Reaction score
22
First Language
Greek
Primarily Uses
RMMV
Found it!!!!


Game_BattlerBase.prototype.param = function(paramId) {
var value = this.paramBase(paramId) + this.paramPlus(paramId);
value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
var maxValue = this.paramMax(paramId);
var minValue = this.paramMin(paramId);
return Math.round(value.clamp(minValue, maxValue));
};

See this function? This is what changes the parameter. So instead of "value*=" if you write "value+=" you get the result of the percentage ADDED.

This means that if your state has a trait of "attack 100%" it will add 1. 200% will add 2, etc.

However, in this manner, you will replace the behavior of ALL states, ALL traits. So handle with care. In my case, that's exactly what i wanted to do.

EDIT: This find has been editted since this, alone, doesn't produce the desired effect. see my original post as i have included my other finds there. Long story short the traits.value is the result of the percentage so you need to also change where this is added.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I forget what is bumping rule in this forum. Is anyone know? Thank you.
BCj
Ew, why does my blogpost on the rpgmaker.net site look like a garbled mess? Are html codes disabled or something?
I feel that I should cut down on my order queue so I can get some more time for my projects, its been quite a longggg while since I worked on them LOL
I friend of mine insisted on practicing dubbing things with him... and its quite funny, yet, it really takes a huge amount of practice!
Gotta save this for my next thread later...

Forum statistics

Threads
97,878
Messages
947,593
Members
129,114
Latest member
Alwar
Top