Buffing Hit and Evasion chance

Good morning, everyone!

In one of my skill-trees, I want to buff the party's success, evasion (and magic evasion) rate. I changed the formula that calculates the above mentioned Extra Parameters, but I decided that it was a safer alternative to simply apply a buff-like state. This should work similarly to Sukukaja from the Shin Megami Tensei series, by adding 12.5% chance to hit and dodge and can be reapplied up to 4 times. I already did this with attack and defence, as it's enough to simply apply the buffs, but I can't figure out a way to do this for Ex-Parameters.

Any help would be very appreciated!

(Also, is this the correct category?)
I feel like I don't understand something in the question. If you already did this with attack and defence, then it should be just as straightforward to add a state that buffs up your hit chance and evasion chance by 12.5% each time.

Here is a screenshot Database > States > Traits section

1689078638637.png
I feel like I don't understand something in the question. It should be straightforward to add a state that buffs up your hit chance and evasion chance by 12.5% each time.

Here is a screenshot Database > States > Traits section

View attachment 269047
By default, states don't stack though. You need to use a plugin that provides state-stacking functionality.
By default, states don't stack though. You need to use a plugin that provides state-stacking functionality.
Exactly. Do you know any that could help me? Can, for instance, Buffs and States Core do it? I noticed that State Counters are KIND of what I whant, but I'm really not sure how they work...
By default, states don't stack though. You need to use a plugin that provides state-stacking functionality.
OOOOH, I guess TIL 😀 Thanks Trihan.
Exactly. Do you know any that could help me? Can, for instance, Buffs and States Core do it? I noticed that State Counters are KIND of what I whant, but I'm really not sure how they work...
Buffs & States Core can do it, but it requires a bit of setup.
Buffs & States Core can do it, but it requires a bit of setup.
Mh, ok. I'm thinking about having a Custom Action Start Effect notetag to the state that simply adds 12,5% to the various Ex-Parameters that will be buffed, but I'm not sure how to do this last part. Is there a script to increase EX-Parameters?
Buffs & States Core can do it, but it requires a bit of setup.
Ok, problem solved. Not the most elegant solution, but it works well.
@Marco_C Would you mind posting your solution here for others?

I ended up doing it this way for Hit Rate, capping the buff at a max of +50% using YEP Buff & States Core
1689082961556.png

Code:
<Custom Apply Effect>
target._hitBuff = target._hitBuff || 0;
target._hitBuff += 12.5;
target._hitBuff = Math.min(target._hitBuff, 50);
$dataStates[stateId].traits[0].value = target._hitBuff / 100;
</Custom Apply Effect>

Code:
<Custom Remove Effect>
target._hitBuff = 0;
$dataStates[stateId].traits[0].value = target._hitBuff;
</Custom Remove Effect>

Edit: As @ATT_Turan pointed out, this will not work when you want this state applied to more than one individual actor.
Wow, your solution is a LOT more elegant than mine ahahahah. I simply created four states, one for each grade of the buff, and one general state that lasts one turn and basically decides which state you got. So, for example, if you have none of the four states, you will get grade I and so forth. When you hit grade IV it simply adds it again to refill the turn counts. As elegant as a drunken sailor but it works
@TESTOSTERONE You don't want to put in code that tries to change anything in $dataStates.

That's database information that isn't saved in the save game. So changing that will cause wonky effects:
- it will persist for the entire game session, so if they load a different save or start a new game, it will persist there

- but if the player quits the game and boots it up again, that value will not be saved

There are plugins for dynamic traits that can do it. Or just give the battler an adjustment to the parameter without the state having a trait at all.

So you could use, for example, Quasi Params Plus and put
Code:
<ratesformula>hit: 12.5*a.getStateCounter(ID)</ratesformula>

<Custom Apply Effect>
target.addStateCounter(stateId, 1);
target.clampStateCounter(stateId, 1, 4);
</Custom Apply Effect>
in the first notetag, replace ID with the ID of your state, no leading zeros.

This uses the state counter functionality from Yanfly's Buffs & States Core, and should increase hit by 12.5% per counter, and the counter should increase each time you use the skill, to a max of 4.

@TESTOSTERONE You don't want to put in code that tries to change anything in $dataStates.

That's database information that isn't saved in the save game. So changing that will cause wonky effects:
- it will persist for the entire game session, so if they load a different save or start a new game, it will persist there

- but if the player quits the game and boots it up again, that value will not be saved

There are plugins for dynamic traits that can do it. Or just give the battler an adjustment to the parameter without the state having a trait at all.
Your replies are always very insightful! These days I managed to find a lot of help in old threads and in at least 20% of them it was your comment that solved the issue
@TESTOSTERONE You don't want to put in code that tries to change anything in $dataStates.

That's database information that isn't saved in the save game. So changing that will cause wonky effects:
- it will persist for the entire game session, so if they load a different save or start a new game, it will persist there

- but if the player quits the game and boots it up again, that value will not be saved

There are plugins for dynamic traits that can do it. Or just give the battler an adjustment to the parameter without the state having a trait at all.
You beat me to saying this.

@Marco_C Do you have YEP Extra Parameter Formula? If so I can do this real easily for you.
You guys are right, but in this case it doesn't matter. If player resets the game, great we are back at 0.

If player continues the game, great when battle ends and state is removed, we are back at 0.
You guys are right, but in this case it doesn't matter.
It matters in case more than one battler gets targeted by the skill within a battle.

You might have two actors with different numbers of stacks on them, but they'd be referencing the same database object and changing the value back and forth to apply to them both.

I'd recommending trying the code I supplied above 😉
You beat me to saying this.

@Marco_C Do you have YEP Extra Parameter Formula? If so I can do this real easily for you.
Yes, actually!
So for example, using the state you have currently, in the "hit" formula parameter of that plugin you'd do

JavaScript:
(base + plus) * rate + flat + ((user._hitBuff || 0) / 100)
So for example, using the state you have currently, in the "hit" formula parameter of that plugin you'd do

JavaScript:
(base + plus) * rate + flat + ((user._hitBuff || 0) / 100)
Ah, wow, sounds easy enough. Unfortunately, being still new to all this, I don't know what hitBuff is exactly? Like, is it something added by Yanfly? Because I can't find it in the usual script list that I use to find things that I can use.
Unfortunately, being still new to all this, I don't know what hitBuff is exactly?
It's in the code that Testosterone offered in Post #9. It's a variable created on the actor.

You would delete the lines in that code referencing $dataStates and use the plugin parameter that Trihan supplied.
It's in the code that Testosterone offered in Post #9. It's a variable created on the actor.

You would delete the lines in that code referencing $dataStates and use the plugin parameter that Trihan supplied.
Ah, I feel like an idiot now ahahah. Ok, now I understand everything, thanks to all of you for the help!

Original thread: https://forums.rpgmakerweb.com/threads/buffing-hit-and-evasion-chance.159200/