Simple-ish Passive State Help

Heya guys, quick question for you all, I'm basically trying to find a way to have a Passive State that converts Mat into Atk and vice-versa, I've already got YanFly's Auto Passive States and Base Parameter Control, I've got these two lines here :

user.addAtk(Math.ceil(user.mat * 0.1));
user.addMat(Math.ceil(user.atk * 0.1));


The problems I'm encountering are the following :

This makes Atk scale off Mat and then makes Mat scale off Atk along with its new bonus Atk. I've tried using battler.clearParamPlus() and it somewhat works in the sense that I now deal a reasonable amount of damage rather than 100x what it was supposed to, however the scaling still isn't the same, there will always be more Mat than Atk.

The second one is that I do not know what Notetags to use in order to just have those two lines. I'm currently using the <Custom Passive Condition> notetag from Auto Passive States, because that was the only one that worked so far, but I'm not sure if it's the right answer.

Thanks for your help, as always!
user.addAtk(Math.ceil(user.mat * 0.1));
user.addMat(Math.ceil(user.atk * 0.1));
There's a logical issue here. You're adding 1% of mat to atk, then adding 1% of atk which will include what you just added to your mat.

You can try, instead,
Code:
user.addAtk(Math.ceil(user.paramBase[3] * .1));
user.addMat(Math.ceil(user.paramBase[2] * .1));
and that will add 1% of their base parameters, as calculated by their class, not counting additions from equipment or this code.

Otherwise you'd use variables:
Code:
user.matPercent = Math.ceil(user.mat * .1);
user.atkPercent = Math.ceil(user.atk * .1);
user.addAtk(user.matPercent);
user.addMat(user.atkPercent);

Other issues:
How are you reversing this? My second solution helps with that, as you'd have the percent variables stored on the actor and you can just subtract them, but in your original method you'd have no precise reference for how much was added to each parameter.

How/when are you running this code?
The second one is that I do not know what Notetags to use in order to just have those two lines. I'm currently using the <Custom Passive Condition> notetag from Auto Passive States
That doesn't make much sense, because the document defines that notetag as:
1715951453540.png


None of what you're doing has anything to do with determining whether or not the state is active. Conditions are checked every time the actor is refreshed (so potentially 60 times a second), which means you're going to just be continually sitting there adding more and more to your parameters.

You could try using the modification in my signature's thread to add Custom Apply/Remove effects to passive states.

You could also use Yanfly's Base Parameter formulae to do the addition. So, you might change the ATK Formula to
Code:
(base + plus) * paramRate * buffRate + flat + user.isStateAffected(69) ? Math.ceil(user.paramBase[3] * .1) : 0;
where 69 is the ID of your passive state.
There's a logical issue here. You're adding 1% of mat to atk, then adding 1% of atk which will include what you just added to your mat.
Yeah exactly, that was my problem, although it is 10% rather than 1% x)

Other issues:
How are you reversing this? My second solution helps with that, as you'd have the percent variables stored on the actor and you can just subtract them, but in your original method you'd have no precise reference for how much was added to each parameter.
By removing the state, normally with YanFly's Base Parameter Control would allow for that to correct itself, no? By any case, I am not planning on removing it, I want it to be a passive for a Class I'm working on that's a bit physical and a bit magical.
None of what you're doing has anything to do with determining whether or not the state is active. Conditions are checked every time the actor is refreshed (so potentially 60 times a second), which means you're going to just be continually sitting there adding more and more to your parameters.
Yeah, I am aware of that, however giving it <Custom Apply Effect> tags did not work as it was a Passive state, I was trying to find a way for it to be a constant effect, where if the character uses an ability that boosts its atk and/or mat, it would take the increase in consideration and where equipment could also be calculated in there. I am, however, incredibly unsure as to how I could even achieve such a thing.

After reading your fix/addition to YanFly's Auto Passive States, I've realized that what I'm trying to do is quite difficult as it won't automatically update the stats every time an armor is equipped or removed, I'd have to perform either a repeat every (few) ticks, but I feel like that'd heavily influence the performances of the game. Am I aiming for the Moon here or is there a way to actually have this happen, in your opinion?
By removing the state, normally with YanFly's Base Parameter Control would allow for that to correct itself, no?
No. The Base Parameter Control adds anything stored in the "flat" bonus area, and you're using code to modify that directly. Unless you subtract the same value again, it will be modified permanently.

Am I aiming for the Moon here or is there a way to actually have this happen, in your opinion?
I already gave you a way to have this happen at the end of my previous reply. Does that not work? If so, how?
Okay, sorry for the unrelated thought from out of left field, but this isn't the first time I've seen someone capitalize the F in Yanfly's name, and I'm mad curious as to where people see it written like that.
No. The Base Parameter Control adds anything stored in the "flat" bonus area, and you're using code to modify that directly. Unless you subtract the same value again, it will be modified permanently.
Gotcha, I'll keep that in mind!

I already gave you a way to have this happen at the end of my previous reply. Does that not work? If so, how?
OH RIGHT, my bad I didn't fully understand the script, but I get it now, I do believe that'd work, thanks! x) How do I add whatever amount I want to it in percentage?

Okay, sorry for the unrelated thought from out of left field, but this isn't the first time I've seen someone capitalize the F in Yanfly's name, and I'm mad curious as to where people see it written like that.
Oh my, I just realized I was writing it wrong lmao I believe it could be due to Yan being a nickname and Fly being a word, thus we tend to type it in two words rather than a single one x)
OH RIGHT, my bad I didn't fully understand the script, but I get it now, I do believe that'd work, thanks! x) How do I add whatever amount I want to it in percentage?
The exact same way you did before. Multiplying a number by a decimal results in a fraction of that number.

I did mean to have it typed that way to duplicate what you originally had and I missed it, so I corrected the previous post.

I believe it could be due to Yan being a nickname
...for what? :oops:
...for what? :oops:

Yanedict Flyumberbatch of course.

Original thread: https://forums.rpgmakerweb.com/threads/simple-ish-passive-state-help.168766/