MV looking for a skill that absorbs damage on behalf of allies.

I have several characters in my party who play the tank role called 'Guard.' I am planning a skill where these allies absorb damage—either completely 'on behalf of' or a certain percentage—on behalf of other allies.
I am currently using multiple Yanfly plugins. Therefore, I have tried using the Taunt plugin (https://www.yanfly.moe/wiki/Taunt_(YEP)), but it is difficult to handle boss area-of-effect attacks or skills that target random enemies without specific targets using Taunt alone. Consequently, there are too many situations where the Guard becomes unnecessary, so I am looking for a skill that absorbs the damage on their behalf. https://www.yanfly.moe/wiki/Damage_Dispersion_(MV_Plugin_Tips_&_Tricks)?utm_source=chatgpt.com

The closest I found was Damage Dispersion (https://www.yanfly.moe/wiki/Damage_Dispersion_(MV_Plugin_Tips_&_Tricks)?utm_source=chatgpt.com), but this is slightly different because it doesn't have the Guard absorb damage on behalf of the allies, but rather distributes the damage they receive to other allies.

I asked the GPT team just in case, and although they provided some code utilizing <Custom React Effect>, it didn't work at all.

Do happen to have any related information?
A simple question first:
what do you not like about the default guard effect? Because it does something like you described in your first two sentences, without the need for any plugin.
So it might be easier to modify that instead of adding and searching for new plugins.

and by the way
I asked the GPT team just in case, it didn't work at all.
That is the usual outcome in 99% of all cases, because there is no intelligence in any of those so-called AI's at all, they are just a complex variant of a search engine that cannot create answers, only find them if someone asked something similar before and provided an answer with the correct keywords as well.
code utilizing <Custom React Effect>, it didn't work at all.
It depends on what it gave you. Chat GPT isnt going to give you functional code reliably, but a <Custom React Effect> can create an effect like the you're describing. It just requires Yanfly's Buffs and States Core plugin to implement the notetag in the first place, ideally the Passive Aura Effects plugin (for the all allies version) to make its application to all other party members and its duration tied to a "guard" state on the user, and the correct JS to go inside of the notetag.

Alternatively, you can use taaspider's substitute plugin to have better control over the substitute system and use it instead. Then you can set up your party guards, your single ally guards, remove the hp requirements, designate applicable damage types, etc.
It sounds like you might be able to get the effect you want just by setting the Guard skill to target all allies, instead of the user.
A simple question first:
what do you not like about the default guard effect? Because it does something like you described in your first two sentences, without the need for any plugin.
So it might be easier to modify that instead of adding and searching for new plugins.

and by the way

That is the usual outcome in 99% of all cases, because there is no intelligence in any of those so-called AI's at all, they are just a complex variant of a search engine that cannot create answers, only find them if someone asked something similar before and provided an answer with the correct keywords as well.

Hmm, I might have misunderstood or misspoke.

Basically, isn't the effect of 'Guard' in RPG Maker to sacrifice turn and solidify a defensive stance to reduce actor own damage by 'half'? Ah, I might have been confused due to translation issues. but it unless referring to the second skill in the skill tab...

I believe there were instances where a message saying "Stepped in for 'A character(of front? I am not sure how this appears in English.)'" would automatically appear, and the character would take the damage instead. However, wasn't that based on probability? Also, I understood that it only blocked damage when an ally's HP was low. Furthermore, it did not block skills other than the opponent's 'normal attacks' (especially area-of-effect skills and those that select random targets).

In my game, enemy patterns are displayed in advance. Therefore, it is a game where allies can react, but the problem arises when a boss that attacks three times per turn uses a powerful area-of-effect skill three times in a row due to the randomness of the patterns.

Of course, since my game has a feature to swap allies, there is the option of pulling them back and bringing them out again, but because there are often situations where that is impossible, a skill that protects allies from the start is necessary.

Please explain if I have misunderstood.

It depends on what it gave you. Chat GPT isnt going to give you functional code reliably, but a <Custom React Effect> can create an effect like the you're describing. It just requires Yanfly's Buffs and States Core plugin to implement the notetag in the first place, ideally the Passive Aura Effects plugin (for the all allies version) to make its application to all other party members and its duration tied to a "guard" state on the user, and the correct JS to go inside of the notetag.

Alternatively, you can use taaspider's substitute plugin to have better control over the substitute system and use it instead. Then you can set up your party guards, your single ally guards, remove the hp requirements, designate applicable damage types, etc.
Oh! Yes, that is why I also wanted to create such skills using <Custom React Effect>.

However, since I am a layman when it comes to coding or JavaScript... I was unable to write the code myself. I was also already using Yanfly's Buffs and States Core plugin.

However, adding another plugin is a bit tricky. Since quite a few plugins are already in use, and I have already coordinated with forum members and through various Discord questions to ensure they do not conflict with each other, I currently only want to use the <Custom React Effect> from Yanfly's Buffs and States Core.

It sounds like you might be able to get the effect you want just by setting the Guard skill to target all allies, instead of the user.
I am aware that using the 'Substitute' special flag allows an ally to take damage on my behalf when HP is low, but that comes with conditions attached, preventing the guard from fully absorbing the damage at the timing I desire.

I will list the exact effects of some of the skills I wish to create.

1. A - When used, protects a 'specific' ally. This guard takes all damage from the designated ally instead. (I want to create skills that last for 1 turn, multiple turns, or even indefinitely from the start of combat.)

2. B - When used, protects all allies for n turns and takes damage on their behalf.

3. C - When used, this guard takes 'partial' damage on their behalf for n turns.

I wanted to utilize them in various ways like this.

@Dehsalp , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.



However, wasn't that based on probability? Also, I understood that it only blocked damage when an ally's HP was low. Furthermore, it did not block skills other than the opponent's 'normal attacks' (especially area-of-effect skills and those that select random targets).
Substitute isnt based on probability. It'll always happen if the conditions are met. the engine's default conditions are that the tank has a substitute trait on them (state, equipment, w/e), the target of the attack is dying (below 25% of their max hp), and the attack is not a certain hit (must be either physical or magical). The scope of the attack does not matter. If this isnt the case, then you may have a plugin interfering.

However, since I am a layman when it comes to coding or JavaScript... I was unable to write the code myself. I was also already using Yanfly's Buffs and States Core plugin.
are you also using the aura plugin? it'd simplify the party guard a bit by letting you tie that entire effect on all other party into one visible state on the tank and automatically ends it if the tank loses their state.

1. A - When used, protects a 'specific' ally. This guard takes all damage from the designated ally instead. (I want to create skills that last for 1 turn, multiple turns, or even indefinitely from the start of combat.)
a basic form of it could be:
Code:
<Custom React Effect>
if (this.isForOpponent() && this.isDamage() && target != origin && origin.isAlive()){
   const rate = 1;
   const dmg = Math.ceil(value * rate);
   value = Math.max(0, value - dmg);
 
   origin.gainHp(-dmg);
   origin.startDamagePopup();
   if (origin.hp === 0 && !origin.isStateResist(1))
        origin.performCollapse();
}

if (origin.isDead()){
  target.removeState(stateId);
}
</Custom React Effect>

<Custom Remove Effect>
user.friendsUnit().aliveMembers().forEach(m=> {
   if (user != m && m.isStateAffected(stateId) && m.stateOrigin(stateId) === user.stateOrigin(stateId))
      m.removeState(stateId);
})
</Custom Remove Effect>
where the tank gives the state to an ally and the state reduces a portion of the damage and redirects it to the tank. All you'd need to do is change the "rate" variable to the percentage of the damage the tank should take.

2. B - When used, protects all allies for n turns and takes damage on their behalf.

3. C - When used, this guard takes 'partial' damage on their behalf for n turns.
same as above, but the skill that applies this state targets all allies and you change the rate variable accordingly (.5 = 50%, 1.5 = 150%, etc).
As mentioned, the aura plugin can make it so that a state thats placed on the tank can project the protection state on all allies and that'd handle the durations and removing the state from the others should the tank die, but it's not required. It'd also need a slight readjustment for the code, but you havent mentioned using it yet.

the remove effect should remove the protection from all allies if the tank dies from protecting someone else, and the state removes itself from the target (and then all allies) if the target takes a hit while the tank is dead, but I haven't tried that out to make sure it covers all situations.
Double-post notice: @Dehsalp


Substitute isnt based on probability. It'll always happen if the conditions are met. the engine's default conditions are that the tank has a substitute trait on them (state, equipment, w/e), the target of the attack is dying (below 25% of their max hp), and the attack is not a certain hit (must be either physical or magical). The scope of the attack does not matter. If this isnt the case, then you may have a plugin interfering.


are you also using the aura plugin? it'd simplify the party guard a bit by letting you tie that entire effect on all other party into one visible state on the tank and automatically ends it if the tank loses their state.


a basic form of it could be:
Code:
<Custom React Effect>
if (this.isForOpponent() && this.isDamage() && target != origin && origin.isAlive()){
   const rate = 1;
   const dmg = Math.ceil(value * rate);
   value = Math.max(0, value - dmg);
 
   origin.gainHp(-dmg);
   origin.startDamagePopup();
   if (origin.hp === 0 && !origin.isStateResist(1))
        origin.performCollapse();
}

if (origin.isDead()){
  target.removeState(stateId);
}
</Custom React Effect>

<Custom Remove Effect>
user.friendsUnit().aliveMembers().forEach(m=> {
   if (user != m && m.isStateAffected(stateId) && m.stateOrigin(stateId) === user.stateOrigin(stateId))
      m.removeState(stateId);
})
</Custom Remove Effect>
where the tank gives the state to an ally and the state reduces a portion of the damage and redirects it to the tank. All you'd need to do is change the "rate" variable to the percentage of the damage the tank should take.


same as above, but the skill that applies this state targets all allies and you change the rate variable accordingly (.5 = 50%, 1.5 = 150%, etc).
As mentioned, the aura plugin can make it so that a state thats placed on the tank can project the protection state on all allies and that'd handle the durations and removing the state from the others should the tank die, but it's not required. It'd also need a slight readjustment for the code, but you havent mentioned using it yet.

the remove effect should remove the protection from all allies if the tank dies from protecting someone else, and the state removes itself from the target (and then all allies) if the target takes a hit while the tank is dead, but I haven't tried that out to make sure it covers all situations.

Oh, I apologize. I remember answering that way when I used the forum a few years ago. I will be more careful and keep that in mind from now on.

Yes, that is correct. The problem was the condition of 'low HP,' meaning protecting allies with less than 25% HP. In my case, attacks from some bosses (like those on challenging difficulty or hidden bosses) are very powerful from the start, so I could die even with 100% HP; therefore, what I had previously was useless.

I had considered adding an Aura plugin before, but decided against it because it wasn't really necessary.

Not all skills need to be in the form of an 'Aura,' but is an Aura plugin absolutely necessary for using the <Custom React Effect> you mentioned? I intend to avoid adding plugins as much as possible in the current state.

Additionally, there is another reason why I do not want to include it as an Aura.

First, since I was just giving an example, it doesn't actually need to last infinitely. I am already using passive and buff & state plugins, and I believe I can make it last from the start by not specifying the duration of the state turns. Another reason is that this buff actually needs to last only for a 'small number of turns' at the 'desired timing'. (Of course, it seems like this could be resolved by using a skill to add just a few turns to the state.)

This is what I have written so far based on my understanding, but please verify if my understanding of the code you provided below is correct.




Code:
<Custom React Effect>
if (this.isForOpponent() && this.isDamage() && target != origin && origin.isAlive()){
   const rate = 1;
   const dmg = Math.ceil(value * rate);
   value = Math.max(0, value - dmg);
 
   origin.gainHp(-dmg);
   origin.startDamagePopup();
   if (origin.hp === 0 && !origin.isStateResist(1))
        origin.performCollapse();
}

if (origin.isDead()){
  target.removeState(stateId);
}
</Custom React Effect>

<Custom Remove Effect>
user.friendsUnit().aliveMembers().forEach(m=> {
   if (user != m && m.isStateAffected(stateId) && m.stateOrigin(stateId) === user.stateOrigin(stateId))
      m.removeState(stateId);
})
</Custom Remove Effect>



Do I only need to modify the part `const rate = 'N'` in the code you wrote?

The part below that, `const dmg = Math.ceil(value * rate);`, appears to be retrieving the value set by the 'rate' just above it. Is that correct?

In other words, if I use it exactly as you wrote, 1 = 100%.

This means the Guard takes 100% of the damage received by the ally. Is that correct?

If I set this value to 0.5, does that mean the protected ally's HP takes 50% of the damage, and the Guard takes the remaining 50%? Or does it fully defend the allies' health while dealing 50% of the damage to the guards?

Additionally, in the case of 1.5, is it correct that it blocks all damage to allies, and the guards take 150% of that damage—in other words, the guards take an additional 50% of the damage?


If so, to utilize this,
I create a skill named 'A' for the 'Guard' and set its target to 'Allies'.

I insert a state named 'S', which has the code above entered into this skill 'A'.

The Guard uses skill A on an ally.

Is that correct?
Not all skills need to be in the form of an 'Aura,' but is an Aura plugin absolutely necessary for using the <Custom React Effect> you mentioned? I intend to avoid adding plugins as much as possible in the current state.
No. As mentioned, it's not required. It'd help manage the state for the all party member versions, but it's not needed to get the effect going.

First, since I was just giving an example, it doesn't actually need to last infinitely. I am already using passive and buff & state plugins, and I believe I can make it last from the start by not specifying the duration of the state turns.
Yanfly's auras don't last indefinitely. They last for however long the state they're attached to is active on the target. It means they can last indefinitely if the state doesn't have an end duration or is a passive, but if the base state has a duration, the auras have the same duration (and will also end on all allies automatically if the base state is removed early, or be extended on all allies if the duration of the base state is extended)

So with auras, you would have your tank target themself with a skill that gives them the "guardian" state. It'll last lets say 3 turns, and that state would have an aura effect to project the "guarded" state on all allies with that react effect. The code would need to change a little bit though.

Its entirely up to you. What I gave you already is how it should be if you're not using auras, but the state is applied to all other party members individually, the state isn't actually tied to the user, they all technically last for their own durations, and you have to add manual checks to remove the states or else it'll linger and you get situations like "the tank takes damage for an ally, dies, gets back up, and then dies again because the ally never lost the cover state"

Do I only need to modify the part `const rate = 'N'` in the code you wrote?
yep. that's the only needed modification.
The part below that, `const dmg = Math.ceil(value * rate);`, appears to be retrieving the value set by the 'rate' just above it. Is that correct?

In other words, if I use it exactly as you wrote, 1 = 100%.

This means the Guard takes 100% of the damage received by the ally. Is that correct?
correct on all of these
If I set this value to 0.5, does that mean the protected ally's HP takes 50% of the damage, and the Guard takes the remaining 50%? Or does it fully defend the allies' health while dealing 50% of the damage to the guards?
The protected ally takes 50% of the damage and the tank takes the other 50% that the ally didn't take.

Additionally, in the case of 1.5, is it correct that it blocks all damage to allies, and the guards take 150% of that damage—in other words, the guards take an additional 50% of the damage?
It was a functional example, but exactly so. If it's 1.5, the guard takes 150% of the damage the ally would have taken. Since its greater than 100% it still means that the target is fully protected from the damage, but the tank takes 50% more additional damage than what the ally would have taken.

If so, to utilize this,
I create a skill named 'A' for the 'Guard' and set its target to 'Allies'.

I insert a state named 'S', which has the code above entered into this skill 'A'.

The Guard uses skill A on an ally.

Is that correct?
Yes. And it should work as is for both the the single target, and the full party protection.
No. As mentioned, it's not required. It'd help manage the state for the all party member versions, but it's not needed to get the effect going.


Yanfly's auras don't last indefinitely. They last for however long the state they're attached to is active on the target. It means they can last indefinitely if the state doesn't have an end duration or is a passive, but if the base state has a duration, the auras have the same duration (and will also end on all allies automatically if the base state is removed early, or be extended on all allies if the duration of the base state is extended)

So with auras, you would have your tank target themself with a skill that gives them the "guardian" state. It'll last lets say 3 turns, and that state would have an aura effect to project the "guarded" state on all allies with that react effect. The code would need to change a little bit though.

Its entirely up to you. What I gave you already is how it should be if you're not using auras, but since the state is applied to all other party members individually, the state isn't actually tied to the user, they all technically last for their own durations, and you have to add manual checks to remove the states or else it'll linger and you get situations like "the tank takes damage for an ally, dies, gets back up, and then dies again because the ally never lost the cover state"


yep. that's the only needed modification.

correct on all of these

The protected ally takes 50% of the damage and the tank takes the other 50% that the ally didn't take.


It was a functional example, but exactly so. If it's 1.5, the guard takes 150% of the damage the ally would have taken. Since its greater than 100% it still means that the target is fully protected from the damage, but the tank takes 50% more additional damage than what the ally would have taken.


Yes. And it should work as is for both the the single target, and the full party protection.

Thank you very much.

I am unable to work today, so I will test it out right away tomorrow!
Hmm, I might have misunderstood or misspoke.

Basically, isn't the effect of 'Guard' in RPG Maker to sacrifice turn and solidify a defensive stance to reduce actor own damage by 'half'? Ah, I might have been confused due to translation issues. but it unless referring to the second skill in the skill tab...
That is the default effect of guard, yes. Specifically, it applies a state that reduces damage by about half (modified by the Guard Effect special parameter). But there's nothing to stop you from making a skill that applies that state to the whole party, instead of just the user. Then one actor would sacrifice their turn to reduce damage for the entire party.

It's clear now that that's not what you were looking for, however. It sounds like what you need is a plugin that modifies how Substitute works, or something that partly simulates the Substitute mechanic, and it even sounds like you've found what you needed, so I won't go into any more detail.
No. As mentioned, it's not required. It'd help manage the state for the all party member versions, but it's not needed to get the effect going.


Yanfly's auras don't last indefinitely. They last for however long the state they're attached to is active on the target. It means they can last indefinitely if the state doesn't have an end duration or is a passive, but if the base state has a duration, the auras have the same duration (and will also end on all allies automatically if the base state is removed early, or be extended on all allies if the duration of the base state is extended)

So with auras, you would have your tank target themself with a skill that gives them the "guardian" state. It'll last lets say 3 turns, and that state would have an aura effect to project the "guarded" state on all allies with that react effect. The code would need to change a little bit though.

Its entirely up to you. What I gave you already is how it should be if you're not using auras, but the state is applied to all other party members individually, the state isn't actually tied to the user, they all technically last for their own durations, and you have to add manual checks to remove the states or else it'll linger and you get situations like "the tank takes damage for an ally, dies, gets back up, and then dies again because the ally never lost the cover state"


yep. that's the only needed modification.

correct on all of these

The protected ally takes 50% of the damage and the tank takes the other 50% that the ally didn't take.


It was a functional example, but exactly so. If it's 1.5, the guard takes 150% of the damage the ally would have taken. Since its greater than 100% it still means that the target is fully protected from the damage, but the tank takes 50% more additional damage than what the ally would have taken.


Yes. And it should work as is for both the the single target, and the full party protection.


Oh, first of all, I created a skill using the code you provided, and it definitely takes the damage on behalf of the character!

Just in case, I created another state with the same effect and applied it to both simultaneously for testing purposes.

I need to verify whether this is intended or not, and since it might be helpful to someone, I will write down what I tested.

Guard B first applied the 'Take Instead' state to Character A. Then, later, Character C applied a different 'Take Instead' state to A using a different skill, with exactly the same effect.

Now, when an enemy attacks A, the damage for both A and B appears as 0, and C takes the damage instead.

Does the state's ID number take priority?

Additionally, if there is a problem, it is with defense and damage reduction.

1. Character A took 3,000 damage by default.

2. B applied the 'Take Instead' state. Now let's take the attack again.

3. An enemy attacks A, and B takes 3,000 damage. Excellent.

4. However, there is another issue. B uses 'Defense' (the 'Defense' command, which is the most basic skill number 2 in the skill tab).

5. The enemy attacks A, but B still takes 3,000 damage.

6. Conversely, A uses 'Defense'.

7. When the enemy attacks A, this time B takes 1,500 damage.

I understand that the reason for this judgment is likely because the 'damage received' by character A is transferred directly to B, but is it possible to reduce the damage received based on character B? (However, this is not strictly necessary; perhaps for the sake of balance, the current state might actually be better.)

It is very useful as it is, and I think it is good!

Then, the problem arises when there are various 'take damage' skills in the game.

Since it is difficult to determine which state takes precedence, I believe it would be better to make it impossible to target or ineffective against allies afflicted with the "Take Instead" state, rather than trying to make it easier for players to understand which "Take Instead" takes priority.

I am using YEP's State Categories plugin and Target Core; would it be possible to utilize these to prevent targets with the "Take Instead" state from being targeted, and additionally, to prevent the state from being applied specifically to targets with skills that guard the entire party?



EDIT+) Additionally, the same applies when enemy attacks inflict status effects such as "Stun." Currently, Character A takes the status effect, but Character B takes the damage; I would like to resolve this as well.



That is the default effect of guard, yes. Specifically, it applies a state that reduces damage by about half (modified by the Guard Effect special parameter). But there's nothing to stop you from making a skill that applies that state to the whole party, instead of just the user. Then one actor would sacrifice their turn to reduce damage for the entire party.

It's clear now that that's not what you were looking for, however. It sounds like what you need is a plugin that modifies how Substitute works, or something that partly simulates the Substitute mechanic, and it even sounds like you've found what you needed, so I won't go into any more detail.

That is fine. Any suggestions are welcome.
Does the state's ID number take priority?
partially. for this, the order is the state's priority value underneath the state icon (highest to lowest), and then their ID (lowest to highest). Essentially, if you can see the actor's list of states in the status windows, its the order the states appear in

I understand that the reason for this judgment is likely because the 'damage received' by character A is transferred directly to B, but is it possible to reduce the damage received based on character B? (However, this is not strictly necessary; perhaps for the sake of balance, the current state might actually be better.)
That becomes tricky depending on what you want to happen. If you want B to take damage as if they were the target of the skill, all the calculations within the notetag has to be done manually. Running the damage formula, applying damage type and element rates, using B's guard rate if theyre guarding, etc.
If you want to reduce the damage B would take in general, then you can subtract from the damage B would take easily.

EDIT+) Additionally, the same applies when enemy attacks inflict status effects such as "Stun." Currently, Character A takes the status effect, but Character B takes the damage; I would like to resolve this as well.
Yeah, this and the damage calculation are the reasons i suggested TAASpider's substitute plugin the other day. substitution would do all the calculation based on B instead of A, also give all the resulting effects to B, and you can decrease the requirements for substitution. This <Custom React Effect> method only transfers damage done specifically
You could in theory check for any states that were applied to A, remove them, and then apply them to B, but that can get messy and can invite other problems

Since it is difficult to determine which state takes precedence, I believe it would be better to make it impossible to target or ineffective against allies afflicted with the "Take Instead" state, rather than trying to make it easier for players to understand which "Take Instead" takes priority.
I agree, and personally Id go with making the skills being unable to target someone that already has a guard state, but both are doable.

I am using YEP's State Categories plugin and Target Core; would it be possible to utilize these to prevent targets with the "Take Instead" state from being targeted, and additionally, to prevent the state from being applied specifically to targets with skills that guard the entire party?
With no plugins, have each guard state have a resist state trait for the other guards so that its impossible to have multiple.

With Yanfly's state categories, you can assign a category to all of the guard states, and then either make each guard skill remove all guard states from their target and then apply its own, or give each guard state a <custom apply effect> to remove all other states with the guard category from the target.

I forget if its Yanfly's target core that requires Yanfly's selection core or if its the other way around, but yanfly's selection core would let you outright disable the skills from being able to target someone who has any guard state
partially. for this, the order is the state's priority value underneath the state icon (highest to lowest), and then their ID (lowest to highest). Essentially, if you can see the actor's list of states in the status windows, its the order the states appear in


That becomes tricky depending on what you want to happen. If you want B to take damage as if they were the target of the skill, all the calculations within the notetag has to be done manually. Running the damage formula, applying damage type and element rates, using B's guard rate if theyre guarding, etc.
If you want to reduce the damage B would take in general, then you can subtract from the damage B would take easily.


Yeah, this and the damage calculation are the reasons i suggested TAASpider's substitute plugin the other day. substitution would do all the calculation based on B instead of A, also give all the resulting effects to B, and you can decrease the requirements for substitution. This <Custom React Effect> method only transfers damage done specifically

You could in theory check for any states that were applied to A, remove them, and then apply them to B, but that can get messy and can invite other problems


I agree, and personally Id go with making the skills being unable to target someone that already has a guard state, but both are doable.


With no plugins, have each guard state have a resist state trait for the other guards so that its impossible to have multiple.

With Yanfly's state categories, you can assign a category to all of the guard states, and then either make each guard skill remove all guard states from their target and then apply its own, or give each guard state a <custom apply effect> to remove all other states with the guard category from the target.

I forget if its Yanfly's target core that requires Yanfly's selection core or if its the other way around, but yanfly's selection core would let you outright disable the skills from being able to target someone who has any guard state

I see. It gets quite complicated... Rather than trying to combine and analyze various things to create it here, adding a plugin would be more convenient and minimize inconvenience for everyone.

I am currently using over 70 plugins, so it looks like I have no choice but to add more, haha.

I will take a look at the taaspider's substitute plugin you recommended. My main concern was that if a plugin overlaps with other systems, the processes that were originally running properly might change, causing problems to erupt. This is especially true when modifying such a fundamental system.

In that case, where should I place the taaspider's substitute plugin?

I am wondering if it would be okay to place it below the Yep core-type plugins, in the same location as the combat-related plugins, but do you have a recommended placement?

Additionally, I am trying to read the manual, but my English skills are terrible, so I am struggling to understand the plugin descriptions while using a translator. I will try using an AI translation for now.




EDIT+)
After testing, it does work when I put <TAA_SSK: type:all> into the state!

Ah, but the same problem still exists.

Let me give an example. Suppose you used a state category for the state applied by a skill and wrote the phrase "<Category: Protected>" in a note.

Skills A, B, and C all belong to the "<Category: Protected>" category. The problem is that while all three skills protect allies, Skill A protects one character for only one turn, Skill B protects one character for five turns, and Skill C protects all allies for three turns.

In this case, I want to prevent Skill B from targeting a character that is already affected by Skill A...

or I want to remove Skill A and overwrite it with the newly applied state. How should I handle this situation?
I will take a look at the taaspider's substitute plugin you recommended. My main concern was that if a plugin overlaps with other systems, the processes that were originally running properly might change, causing problems to erupt. This is especially true when modifying such a fundamental system.

In that case, where should I place the taaspider's substitute plugin?
without knowing what other plugins you have, I'd say you could have it anywhere after Yanfly's battle core but it can be placed anywhere between there and the very bottom of the list. Its a fairly specific plugin, doesnt really change much preexisting systems, and substitute is a system that is generally ignored by other plugins. it should be safe generally.

Skills A, B, and C all belong to the "<Category: Protected>" category. The problem is that while all three skills protect allies, Skill A protects one character for only one turn, Skill B protects one character for five turns, and Skill C protects all allies for three turns.

In this case, I want to prevent Skill B from targeting a character that is already affected by Skill A...

or I want to remove Skill A and overwrite it with the newly applied state. How should I handle this situation?
I am unsure of the issue here. I believe I've addressed it in the previous post? did all of these not end up working out for you?
With no plugins, have each guard state have a resist state trait for the other guards so that its impossible to have multiple.

With Yanfly's state categories, you can assign a category to all of the guard states, and then either make each guard skill remove all guard states from their target and then apply its own, or give each guard state a <custom apply effect> to remove all other states with the guard category from the target.

I forget if its Yanfly's target core that requires Yanfly's selection core or if its the other way around, but yanfly's selection core would let you outright disable the skills from being able to target someone who has any guard state
I never checked what happens with that plugin if you attempt to apply a substitute state and fail to do so via point #1, but points #2 and #3 should still work to my knowledge
without knowing what other plugins you have, I'd say you could have it anywhere after Yanfly's battle core but it can be placed anywhere between there and the very bottom of the list. Its a fairly specific plugin, doesnt really change much preexisting systems, and substitute is a system that is generally ignored by other plugins. it should be safe generally.


I am unsure of the issue here. I believe I've addressed it in the previous post? did all of these not end up working out for you?

I never checked what happens with that plugin if you attempt to apply a substitute state and fail to do so via point #1, but points #2 and #3 should still work to my knowledge
Ah, it seems my explanation was insufficient.

I meant that I didn't know 'how' to do it.

Since there was no explanation regarding the correlation between the note tags in the target core plugin and the state category plugin, I asked how to input them to make them work as intended.

For example, in the target core, it can insert a note tag called <Target: Everybody> to apply it to 'everyone.' <Target: All Allies But User> refers to all allies except self.

However, how do I prevent allies who are in a 'specific category state' from being selected?
It seems like I could do this by utilizing the code from the state category plugin in the <Custom Target Text> or <Custom Target Eval> sections... I can understand the general idea by reading the code, but I am unable to write the code myself, which is why I asked.
I meant that I didn't know 'how' to do it.

Since there was no explanation regarding the correlation between the note tags in the target core plugin and the state category plugin, I asked how to input them to make them work as intended.
ah. no worries, i see now.

As mentioned, what I was referring to wasn't the Target Core, but the Selection Core.
I forget if its Yanfly's target core that requires Yanfly's selection core or if its the other way around, but yanfly's selection core would let you outright disable the skills from being able to target someone who has any guard state
I couldn't remember if the Target Core required the selection core, which would mean you already are using it, or if the Selection Core required the Target core and you needed to add it. You bringing up those targeting notetags reminded me that the Selection Core needed the Target Core.

Now, you *can* use the Target core to prevent the skill from being executed on a target with a guard on them, but IMO the selection core's approach is better. Because of the difference between being able to target something and being able to select them, the Selection Core will prevent the player from wasting their turn if the target of a guard skill already has one. using the Target Core will make the skill go off and then not target its target. It's a little hard to describe to someone without them already knowing what it is or seeing it.

However, how do I prevent allies who are in a 'specific category state' from being selected?
It seems like I could do this by utilizing the code from the state category plugin in the <Custom Target Text> or <Custom Target Eval>
I'll describe it with both the target core and the selection core so you can try out both and see what I mean.

With the selection core, you don't actually need any code for this. You can if you want, but it provides a notetag that lets you say the requirements to be able to select someone without code

Code:
<Select Conditions>
Not User
Not State: Guard A
Not State: Guard B
Not State: Guard C
</Select Conditions>
and that makes it so that the player can't select the user or anyone with any of the guards on them.

With the Target core, it'd require code and would be like this:
Code:
<Custom Target Eval>
if (target != user && !target.isStateCategoryAffected('Protected'))
  targets.push(target);
</Custom Target Eval>
But, as the target core doesn't restrict selection, it doesn't prevent you from wasting your turn. Like, it won't prevent the tank from selecting themself for guard, but the skill will not target them and will instead do nothing and waste their turn.

For the guard skill thats meant to target all allies, the Selection Core notetag doesn't have to change. the Target Core's would need to change to be this to target all allies except the user and whoever has one of your guard states in them. this uses the state category so you don't have to list the states
Code:
<Custom Target Eval>
user.friendsUnit().aliveMembers().forEach(ally => {
  if (ally != user && !ally.isStateCategoryAffected('Protected'))
    targets.push(ally);
})
</Custom Target Eval>
ah. no worries, i see now.

As mentioned, what I was referring to wasn't the Target Core, but the Selection Core.

I couldn't remember if the Target Core required the selection core, which would mean you already are using it, or if the Selection Core required the Target core and you needed to add it. You bringing up those targeting notetags reminded me that the Selection Core needed the Target Core.

Now, you *can* use the Target core to prevent the skill from being executed on a target with a guard on them, but IMO the selection core's approach is better. Because of the difference between being able to target something and being able to select them, the Selection Core will prevent the player from wasting their turn if the target of a guard skill already has one. using the Target Core will make the skill go off and then not target its target. It's a little hard to describe to someone without them already knowing what it is or seeing it.


I'll describe it with both the target core and the selection core so you can try out both and see what I mean.

With the selection core, you don't actually need any code for this. You can if you want, but it provides a notetag that lets you say the requirements to be able to select someone without code

Code:
<Select Conditions>
Not User
Not State: Guard A
Not State: Guard B
Not State: Guard C
</Select Conditions>
and that makes it so that the player can't select the user or anyone with any of the guards on them.

With the Target core, it'd require code and would be like this:
Code:
<Custom Target Eval>
if (target != user && !target.isStateCategoryAffected('Protected'))
  targets.push(target);
</Custom Target Eval>
But, as the target core doesn't restrict selection, it doesn't prevent you from wasting your turn. Like, it won't prevent the tank from selecting themself for guard, but the skill will not target them and will instead do nothing and waste their turn.

For the guard skill thats meant to target all allies, the Selection Core notetag doesn't have to change. the Target Core's would need to change to be this to target all allies except the user and whoever has one of your guard states in them. this uses the state category so you don't have to list the states
Code:
<Custom Target Eval>
user.friendsUnit().aliveMembers().forEach(ally => {
  if (ally != user && !ally.isStateCategoryAffected('Protected'))
    targets.push(ally);
})
</Custom Target Eval>


Ah, I was being silly. I was actually already using the Selection Core, lol.

I was using a note tag with information like <Enemy or Actor Select>, and I thought it was the Target Core, but it turns out it was the Selection Core. Since I took a break for a few years due to personal reasons, I must have forgotten.

In that case, as an example:

<Select Conditions>
Not User
Not State: Guard A
Not State: Guard B
Not State: Guard C
</Select Conditions>

You wrote this, but according to the Selection Core, the part where it says "Guard A" is supposed to be the actual 'skill name' used in-game.

In that case, do I have to add a line for every increase in the number of protection skills?

ex) For Skill A:

<Select Conditions>
Not User
Not State: Guard B
Not State: Guard C

</Select Conditions>

For Skill B:

<Select Conditions>
Not User
Not State: Guard A
Not State: Guard C

</Select Conditions>

For Skill C:

<Select Conditions>
Not User
Not State: Guard A
Not State: Guard B

</Select Conditions>

Is it correct to write it like this?

Additionally, if Skills D, E, and F are created, do I have to add Not State: Guard D ... E ... F... to every single skill? Is it not possible to make selection impossible at once by utilizing categories? Or, if not, is it possible, but is this method much more stable?

As another question, does this only make 'selection' impossible?

For example, there are three characters in a party named X, Y, and Z.

And Y used Skill A on X to apply State A and protect X. However, regardless of the target, the skill C targets all allies. In this case, if Z uses C to apply the status effect C to all allies and thus protects them, what happens?

1. Since A is already applied to X, X is not designated as a target, nor is it applied to skills that target all allies. Therefore, only A remains on X, and C is not applied.

2. The A applied to X disappears, and C takes priority and overwrites it.

3. Both A and C are stacked on X, causing the problem to persist.




EDIT) Sorry! i missed the last part of the text because it was cut off by the translator; I see that I just need to put that in the note tags for area protection.

I think you only need to answer the first question!
You wrote this, but according to the Selection Core, the part where it says "Guard A" is supposed to be the actual 'skill name' used in-game.

In that case, do I have to add a line for every increase in the number of protection skills?
Has to be the state name or it can be the state's ID, but yeah, the no code version needs to have a line for each one. I mentioned it because you only mentioned 3 states till now and I figured a line for each wouldn't have been a hassle. If you do want to add more, you can use this and it'll go off of the state category instead. You wont have to add any more lines, you'd just need to make sure new states have the category tag.
Code:
<Custom Select Condition>
condition = target != user && !target.isStateCategoryAffected('Protected');
</Custom Select Condition>
Has to be the state name or it can be the state's ID, but yeah, the no code version needs to have a line for each one. I mentioned it because you only mentioned 3 states till now and I figured a line for each wouldn't have been a hassle. If you do want to add more, you can use this and it'll go off of the state category instead. You wont have to add any more lines, you'd just need to make sure new states have the category tag.
Code:
<Custom Select Condition>
condition = target != user && !target.isStateCategoryAffected('Protected');
</Custom Select Condition>

Code:
<Custom Select Condition>
condition = target != user && !target.isStateCategoryAffected('Protected');
</Custom Select Condition>

Thank you.

I will test it as soon as possible.

I will also check for issues such as nesting or duplication of other states while conducting the test, and I will let you know the results!




EDIT + )

Code:
<Category: 버프>
<Category: 대타>

<TAA_SSK: type:all>

<Custom Select Condition>
condition = target != user && !target.isStateCategoryAffected('대타');
</Custom Select Condition>


Hmm, it's not working.

It gets selected, and the effect actually works, so both STATES are applied to the actor.



Code:
<Category: buff>
<Category: protect>

<TAA_SSK: type:all>

<Custom Select Condition>
condition = target != user && !target.isStateCategoryAffected('protect');
</Custom Select Condition>


Since it might be difficult to understand the Korean, I will also write down the translated version.


EDIT ++) Ah, wait. i was stupid..

I was putting what should have been in the 'skill' note tag into the 'state' note tag (Idiot lol).

It works now that I've put it in the skill!

What I've tried so far is that if I use Protection on the same target in the same turn, target selection becomes impossible, so it switches to a different target.

I will test it a bit more.




EDIT +++)

Yes, it seems to work well in various situations.

Thank you!

I think I can use this code as is until any other issues arise in the future!

Thank you very much.



EDIT ++++)


If there is exactly one problem I found, it is when blocking area-of-effect attacks.

Let's assume an enemy attacks 8 allies, with 1 serving as a Guard and the remaining 7 all having protection buffs applied. The enemy uses an area-of-effect skill to attack all allies. However, no matter how much damage is inflicted exceeding the Guard's HP, only the Guard is knocked down; the excess damage is not calculated. It is as if the damage calculation treated the Guard as having taken a barrage of hits.

Ah, of course, I am not asking for the exact excess damage to be calculated.

For example, if HP is 500 and DAMAGE is 1000 + 1000, I am not asking to subtract 500 to calculate 500 and 1000 separately!

I believe it is correct to take damage equivalent to the HP excess once.

EX2) Taking the example above as is, with HP 500 and DAMAGE 1000 + 1000, blocking 1000 damage once causes the guard to fall, and then blocking the 1000 damage from a second different actor. I was considering the feasibility of this.

Of course, this is not strictly necessary. I believe both approaches have their pros and cons. However, since this tended to make the difficulty significantly easier, it made me think about the matter.

Original thread: https://forums.rpgmakerweb.com/threads/looking-for-a-skill-that-absorbs-damage-on-behalf-of-allies.183850/