MV Yanfly's Attach Augment: How to stop regeneration when using a skill type

I explain what I want to do and why I want to do it that way.
My problem is that I want the item that is attached to a piece of equipment that gives HRG or MRG to not regenerate when using a specific type of skill. The reason for this is that this type of ability is more of a selection of combat tactics that alters the development of the combat until it ends. At the beginning of the battle the player can choose which tactic he wants to use. But this becomes a problem since during the course of the battle the player can choose to change tactics and because using that ability is instantaneous and allows an action to be performed again instantly, the player can take advantage of that and change of tactics repeatedly regenerating infinitely.

That's why I'm eliminating all types of regeneration when he uses that type of ability and I'm achieving it without problem with note tags using yanfly's buffsystatescore, but I couldn't achieve it with the HRG or MRG that is gained with attach augment.

I tried making the attached object give a passive state that provides regeneration based on a variable that I set with <attach augment: eval> but apparently the <Custom Regen Formula> does not take the variable that I set in <attach augment eval>

This is what I put in the attached object:


<Augment: Mango>

Add Passive State: 744

Price: +50

Cannot Detach

</Augment: Mango>


<Augment Attach Eval: Mango>

var regenerateHRG = regenerateHRG || 0;

regenerateHRG +=1;

</Augment Attach Eval: Mango>


This is what I put in the passive state:

<Custom Regen Formula>

value = user.mhp * 0.01 * regenerateHRG;

element = 11;

</Custom Regen Formula>

And another thing I realized that doing this is going to be a problem if several teams were attached with hrg or mrg and several actors use it, the regenerateHRG variable will accumulate for all of them. I tried using user._regenerateHRG to customize the regenerateHRG variable for each user so it doesn't accumulate, but I still don't quite understand how that works in note tags. In attach augment eval putting user._ does not work.

Can anyone help me with ideas to solve this problem?

I just need help with that Attach Augment plugin but if you want to see the plugins I use, tell me and I'll show them.
I'm not certain what you're going for, because battlers don't regenerate (or not) when using a skill. Do you mean that you want using a specific skill to block the regeneration phase for that turn?

The way you made the augment attach eval is not good practice - you've made a global variable which, as you observe, will interfere with multiple actors/pieces of equipment (plus it's just unnecessary cluttering).

There's no such thing as a user when attaching an augment, but there is the item, you can create the new property directly on that (the way the examples for the notetag in the plugin instructions show).

The only trick there is you'd have to scan the user's equipment for such a property in other tags.

So, for example,

Code:
<Augment Attach Eval: Mango>
item.regenerateHRG = item.regenerateHRG || 0;

item.regenerateHRG +=1;

</Augment Attach Eval: Mango>

<Custom Regen Formula>
let regenerateHRG = 0;
user.equips().forEach(item => {if (item.regenerateHRG) regenerateHRG += item.regenerateHRG});

value = user.mhp * 0.01 * regenerateHRG;
element = 11;
</Custom Regen Formula>

As far as the whole blocking question...you could make those skills apply a state to the user (via Yanfly Skill Core notetags) and have the above check for the presence of said state before it regens anything.

Code:
<Custom Regen Formula>
if (!user.isStateAffected(69))
{
    let regenerateHRG = 0;
    user.equips().forEach(item => {if (item.regenerateHRG) regenerateHRG += item.regenerateHRG});

    value = user.mhp * 0.01 * regenerateHRG;
    element = 11;
}
</Custom Regen Formula>
Regeneration by default occurs at the end of the turn. When an actor uses a skill and ends the turn, the regeneration effect occurs. Using the action sequence of each skill of a specific type of skills, I activate a switch (49) and in the states that produce a regeneration, check if that switch is activated to ignore the regeneration and deactivate the switch again so that it continues regenerating. in the next turns until I use the type of ability again that I don't want it to regenerate. This works very well for me. I just can't achieve it with attach augment. When I get home I'll try your idea to see if it works for me. I thank you for the help and sorry for not explaining more clearly.
No need to apologize - I just wanted to make sure we were both talking about the same thing.

You had worded it like regenerating was a part of your skills, where in the default engine regeneration is a separate phase after the chosen action has been completed.

Let us know if you have any issues getting the above to work.
It is not working, it does not regenerate at any time. Is it possible that the line "user.equips().forEach(item => {if (item.regenerateHRG) regenerateHRG += item.regenerateHRG});" is the problem? Because if I delete that line the actor regenerates hp but using it with that line doesn't work. I have a feeling there may be a mistake there.
It looks fine to me. Just as a tip, if you want a specific person's attention, you should Reply, Quote, or @tag them - that will give them a notification. Otherwise, they would have to choose to find and click into the thread again.

But if it's not working, we add some troubleshooting. On the augment:
Code:
<Augment Attach Eval: Mango>
item.regenerateHRG = item.regenerateHRG || 0;

item.regenerateHRG +=1;
console.log("Item's regen is ", item.regenerateHRG);
</Augment Attach Eval: Mango>

Then in the passive state:
Code:
<Custom Regen Formula>
if (!user.isStateAffected(69))
{
    let regenerateHRG = 0;
    user.equips().forEach(item => {if (item.regenerateHRG) regenerateHRG += item.regenerateHRG});
console.log("regen total is ", regenerateHRG);
    value = user.mhp * 0.01 * regenerateHRG;
    element = 11;
}
</Custom Regen Formula>

During your playtest, press F8 and go to the Console tab. Take a screenshot of the messages that get printed there.
It looks fine to me. Just as a tip, if you want a specific person's attention, you should Reply, Quote, or @tag them - that will give them a notification. Otherwise, they would have to choose to find and click into the thread again.

But if it's not working, we add some troubleshooting. On the augment:
Code:
<Augment Attach Eval: Mango>
item.regenerateHRG = item.regenerateHRG || 0;

item.regenerateHRG +=1;
console.log("Item's regen is ", item.regenerateHRG);
</Augment Attach Eval: Mango>

Then in the passive state:
Code:
<Custom Regen Formula>
if (!user.isStateAffected(69))
{
    let regenerateHRG = 0;
    user.equips().forEach(item => {if (item.regenerateHRG) regenerateHRG += item.regenerateHRG});
console.log("regen total is ", regenerateHRG);
    value = user.mhp * 0.01 * regenerateHRG;
    element = 11;
}
</Custom Regen Formula>

During your playtest, press F8 and go to the Console tab. Take a screenshot of the messages that get printed there.
1707493452816.png


Could it be that the error is due to the fact that it is a passive state? In the console it shows me that the error is in state 744, which is the passive state that I added for regeneration.
Could it be that the error is due to the fact that it is a passive state? In the console it shows me that the error is in state 744, which is the passive state that I added for regeneration.
That's...where it's supposed to be? I'm not sure where else you'd put the code.

I just need to add a check so it doesn't check empty items (I'm not sure why/how there are empty items in the equipment list, but that's no problem).

Code:
<Custom Regen Formula>
if (!user.isStateAffected(69))
{
    let regenerateHRG = 0;
    user.equips().forEach(item => {if (item && item.regenerateHRG) regenerateHRG += item.regenerateHRG});

    value = user.mhp * 0.01 * regenerateHRG;
    element = 11;
}
</Custom Regen Formula>

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-attach-augment-how-to-stop-regeneration-when-using-a-skill-type.165550/