Chained Echoes States Resistance

Hello! I would like to know if there is any way to use the "negative states" system from Chained Echoes in RPG Maker MZ.

For those who are not familiar with it, I'll describe it: it's a mechanic where negative states like poison, paralysis, or sleep have a "dynamic resistance". The first time you apply a state, it always succeeds. However, to apply the same state again, you need to hit the target twice with abilities that apply that state, then three times, and so on.

When trying with the editor, I only found options to modify the percentage chance of inflicting a certain state...

I looked for a plugin, but couldn't find anything either.

Any ideas? =)
You could do this in the editor using common events. It would get a little complicated with multiple variables, but it's absolutely doable.

It's easier to do with a plugin that lets you execute code when you use a skill.

If you're not already using anything like that, you could use my Eval Tags plugin, linked in my signature. If you're using any VisuStella products, you can use their Battle Core.

Examples using my Eval Tags:
In your Poison state:
Code:
<State Apply Eval>
target.poisoned ??= 0;
target.poisoned++;
target.poisonHits = 0;
</State Apply Eval>

In your skill:
Code:
<Action Post-Apply Eval>
if (target.poisoned)
{
    target.poisonHits++;
    if (target.poisonHits > target.poisoned)
        target.addState(42);
}
else
    target.addState(42);
</Action Post-Apply Eval>
where 42 is the ID of your poison state.
You could do this in the editor using common events. It would get a little complicated with multiple variables, but it's absolutely doable.

It's easier to do with a plugin that lets you execute code when you use a skill.

If you're not already using anything like that, you could use my Eval Tags plugin, linked in my signature. If you're using any VisuStella products, you can use their Battle Core.

Examples using my Eval Tags:
In your Poison state:
Code:
<State Apply Eval>
target.poisoned ??= 0;
target.poisoned++;
target.poisonHits = 0;
</State Apply Eval>

In your skill:
Code:
<Action Post-Apply Eval>
if (target.poisoned)
{
    target.poisonHits++;
    if (target.poisonHits > target.poisoned)
        target.addState(42);
}
else
    target.addState(42);
</Action Post-Apply Eval>
where 42 is the ID of your poison state.
Thank you very much for your response!!

In my project, I use VisuStella Battle Core, but I tried using your Eval Tags plugin in a new project without any other plugins and it doesn't work... =(

The poison state is always applied whenever I use the poison skill; the "resistance" effect is not generated... What could I be doing wrong? I followed all the steps.


Screenshots:
1727219212453.png
1727219193586.png
Youd have to remove the effect for the state to be added from the skill. The game is still trying to apply it the default way as well as through the notebox. You want for it to just do it through the notebox

(Its also was certain hit with a 100% chance to poison, so it would have never not poisoned the target without a resist trait)
Youd have to remove the effect for the state to be added from the skill. The game is still trying to apply it the default way as well as through the notebox. You want for it to just do it through the notebox

(Its also was certain hit with a 100% chance to poison, so it would have never not poisoned the target without a resist trait)
😮!

I understand...

I did what you mentioned, and now the enemy never receives the poison state; it simply says "it had no effect on enemy A."

The skill is still a certain hit.

Now, my idea is for the effect, in this case poison, to hit 100% of the time as long as the condition in the notetag is met...

What could it be?
Your skill needs to do something in order for the hit (and therefore the notetag) to process.

So it needs to have something in the damage formula or something in the Effects - it can be adding and removing another state, an empty common event, whatever.
Your skill needs to do something in order for the hit (and therefore the notetag) to process.

So it needs to have something in the damage formula or something in the Effects - it can be adding and removing another state, an empty common event, whatever.
I added damage to the attack (1 HP), and now it applies the poison effect again. But once it is cured, the next time the enemy gets poisoned immediately upon receiving the attack, without generating the resistance (it should resist once without getting the poison state).

Sorry to be so persistent… any other ideas?
Change the notetags with these added lines. Then, while playing, press F8 and go to the Console tab - see what it says, show us a screenshot.

Code:
<State Apply Eval>
target.poisoned ??= 0;
target.poisoned++;
target.poisonHits = 0;
console.log("State Apply, poisoned is ", target.poisoned);
</State Apply Eval>

Code:
<Action Post-Apply Eval>
if (target.poisoned)
{
    target.poisonHits++;
console.log("Action Eval, poisoned is ", target.poisoned, ", poisonHits is ", target.poisonHits);
    if (target.poisonHits > target.poisoned)
        target.addState(42);
}
else
{
console.log("Action Eval, no poisoned");
    target.addState(42);
}
</Action Post-Apply Eval>
Change the notetags with these added lines. Then, while playing, press F8 and go to the Console tab - see what it says, show us a screenshot.

Code:
<State Apply Eval>
target.poisoned ??= 0;
target.poisoned++;
target.poisonHits = 0;
console.log("State Apply, poisoned is ", target.poisoned);
</State Apply Eval>

Code:
<Action Post-Apply Eval>
if (target.poisoned)
{
    target.poisonHits++;
console.log("Action Eval, poisoned is ", target.poisoned, ", poisonHits is ", target.poisonHits);
    if (target.poisonHits > target.poisoned)
        target.addState(42);
}
else
{
console.log("Action Eval, no poisoned");
    target.addState(42);
}
</Action Post-Apply Eval>
Ok!!

I used the skill twice on each enemy (with two different characters each turn), and both times the enemy ended up with the poison state (for one turn, because to test quickly, I reduced the duration to just 1 turn).

1727226807011.png
For now, try changing every instance of "target" inside of the state's notetag to "user"
For now, try changing every instance of "target" inside of the state's notetag to "user"
Aaaaaaaaaaaaaaaaaaaaand it worked!!! 😀

This is a screenshot of the console. Actor applied poison to enemy 3 times, with de "resistance" to state working =)

So, for other states (paralize, sleep, etc.) I just have to replace the part of "poisoned" with another state? For example, sleep?

Another question: is there any part of the code that would be good to "clean up" now that we know what the error was? Maybe the part causing reports to appear in the console?

Thanks for everything =)

(I’m going to sleep now, I’ll reply tomorrow; it’s already late here in my country xD)

1727229449477.png
So, for other states (paralize, sleep, etc.) I just have to replace the part of "poisoned" with another state? For example, sleep?
yep. but do keep in mind that these values will have to be cleared at some point for actors, or else its just going to keep building for the entire game

Maybe the part causing reports to appear in the console?
yeah, you can remove all the "console.log" lines. those were just for debugging.
now that its been brought up that there isnt a target reference for that tag, @ATT_Turan can add one if he chooses, but user should be fine in either case
now that its been brought up that there isnt a target reference for that tag, @ATT_Turan can add one if he chooses, but user should be fine in either case
roflmao, it's really excellent for me to know how my own plugin works, isn't it?

Yeah, I'll add a target variable just to reduce stupid mistakes like this and make it more like the Yanfly MV stuff.
*patiently waited in the corner for the solution* Great job team. *picks up prize and walks away*
Oops!!! Sorry for the delay in responding...!! The truth is, the very next day I had a rough work week and had to put my game development on hold for a few days... and then I forgot to reply and say thank you. (I understand this isn't necroposting since the necessary days haven't passed yet)

Thanks to everyone for the help.

yep. but do keep in mind that these values will have to be cleared at some point for actors, or else its just going to keep building for the entire game

Now, I still have one question! How can I clear those values for the actors? Would a script that resets all state counters to 0 at the end of each battle be enough? (I don’t mind doing it as a common event after the battle to keep it simple. Now, the question is, what would be the script to reset these values to 0? (or if it's not a script, how could it be done?)

Thanks in advance =)
Now, I still have one question! How can I clear those values for the actors? Would a script that resets all state counters to 0 at the end of each battle be enough? (I don’t mind doing it as a common event after the battle to keep it simple. Now, the question is, what would be the script to reset these values to 0? (or if it's not a script, how could it be done?)
a common event that plays after every battle would be easy enough to make. the only thing of note is that without reorganizing the data to be a bit cleaner, youd have to add to it every time you make a new state that works off the resistance

the common event could have a script command to do this
Code:
$gameParty.allMembers().forEach(member =>{
  //clear the poison data
  delete member.poisoned;
  delete member.poisonHits;
 
  //clear confusion data
  delete member.confused;
  delete member.confuseHits;
 
  //and so on

})
a common event that plays after every battle would be easy enough to make. the only thing of note is that without reorganizing the data to be a bit cleaner, youd have to add to it every time you make a new state that works off the resistance

the common event could have a script command to do this
Code:
$gameParty.allMembers().forEach(member =>{
  //clear the poison data
  delete member.poisoned;
  delete member.poisonHits;
 
  //clear confusion data
  delete member.confused;
  delete member.confuseHits;
 
  //and so on

})

Ok, I get it. I'll try a common event with that script then.

What do you mean by reorganizing the data to make it cleaner? Isn't the code for poison (like we saw above) clean enough to work, for example?

Sorry if I'm not understanding very well 😛
What do you mean by reorganizing the data to make it cleaner? Isn't the code for poison (like we saw above) clean enough to work, for example?
it works, and it perfectly does exactly what its supposed to. theres nothing wrong with it. its just that possible to write it in a way for your resistances are a single property that contains all the state resistance data. as a singular property, youd only have to do is clear the the one property to clear them all. you wouldnt have to update the common event with every state you add (which is just adding two lines each time)

its not a whole lot of saved effort in the long run unless you have many states with resistances like this.
it works, and it perfectly does exactly what its supposed to. theres nothing wrong with it. its just that possible to write it in a way for your resistances are a single property that contains all the state resistance data. as a singular property, youd only have to do is clear the the one property to clear them all. you wouldnt have to update the common event with every state you add (which is just adding two lines each time)

its not a whole lot of saved effort in the long run unless you have many states with resistances like this.
Ok ok I get it now. Tbh I think it's only going to be a couple of states, so I think I'll be fine. Thank you very much for the clarification and advice (and help) 🙂

Original thread: https://forums.rpgmakerweb.com/threads/chained-echoes-states-resistance.172129/