MV Counter attack that add burn state

Hello everyone,

I recently decided to add to my project a shield that counterattacks when the wearer is hit by a physical blow and adds a burn state, the only problem is that everything works except the code that is supposed to add the burn state.
I'm using Yanfly Buffs & States Core (and I have a very poor knowledge of Java scripts).
Here's my (very basic) code:

<Custom React Effect>

if (this.isPhysical()) {

use.addState(13);

}

</Custom React Effect>
Thank in advance for your help !
did you use "use" in your game? or did you retype it into the textbox when posting? it should be "user"

its unclear if your "counter" is an actual counterattack or is a passive state with that attached, but if it is the state, that should work after you change "use". the only thing is that itll work on anyone that lands a physical action on the wearer. even allies using support effects
did you use "use" in your game? or did you retype it into the textbox when posting? it should be "user"

its unclear if your "counter" is an actual counterattack or is a passive state with that attached, but if it is the state, that should work after you change "use". the only thing is that itll work on anyone that lands a physical action on the wearer. even allies using support effects
Indeed, it was a typo in both the script and here but unfortunately not the answer, the way I create this shield is probably much more complicated than it should be. I created the shield, created the counter and burn state, created a common event that adds the counter state to the shield wielder, added as a trait the counter attack directly in the counter state and put the script in the counter state notepad.
I created the shield, created the counter and burn state, created a common event that adds the counter state to the shield wielder, added as a trait the counter attack directly in the counter state and put the script in the counter state notepad.
my suggestion is to use yanfly's auto passive states plugin for that. itll simplify it to just attaching the state to the shield. a common event isnt needed.
added as a trait the counter attack directly in the counter state
im not entirely sure what you mean here, but first thing to check would be making sure that your state is actually on the actor at all. did you give it an icon to see if its active?
if it is active, you made sure that the skill triggering it is physical and not certain hit?
my suggestion is to use yanfly's auto passive states plugin for that. itll simplify it to just attaching the state to the shield. a common event isnt needed.

im not entirely sure what you mean here, but first thing to check would be making sure that your state is actually on the actor at all. did you give it an icon to see if its active?
if it is active, you made sure that the skill triggering it is physical and not certain hit?
First of all thanks for the plugin, it's really good, easy to use and open to lots of ideas.
As for the rest, everything works fine except the application of the burn state after a counter attack.
I can't seem to figure out how to make it work and I'm pretty sure it's not that complicated.
It's not, but you're kind of running around in circles.

Take a deep breath, calm down, and show us screenshots of everything.

The shield, the states, anything else that's involved.
It's not, but you're kind of running around in circles.

Take a deep breath, calm down, and show us screenshots of everything.

The shield, the states, anything else that's involved.
Thanks for your help, here are the screenshots.
I hope the mix of French and English won't be a problem.
I hope the mix of French and English won't be a problem.
Not at all, so long as the editor is in English it's perfectly legible.

Your problem is that you're using Custom React. From the documentation:
1730046829423.png


When you counterattack, you never get hit - you hit them instead. So React is never going to be looked at.

You can use Select or Deselect instead, or you can use Yanfly's Counter Control to change how counter attacking works, so you get hit, apply the state, then hit them back.

The this.subject() is unnecessary, use the included user and target variables.
Not at all, so long as the editor is in English it's perfectly legible.

Your problem is that you're using Custom React. From the documentation:
View attachment 321454

When you counterattack, you never get hit - you hit them instead. So React is never going to be looked at.

You can use Select or Deselect instead, or you can use Yanfly's Counter Control to change how counter attacking works, so you get hit, apply the state, then hit them back.

The this.subject() is unnecessary, use the included user and target variables
Thank you very much, I may be a bit troublesome but I could really use some more guidance on how the script should look to be most effective, I'm a bit lost in all that, I have basically never coded in Java before.
Thank you very much, I may be a bit troublesome but I could really use some more guidance on how the script should look to be most effective, I'm a bit lost in all that, I have basically never coded in Java before.
You're still not coding in Java - MV uses JavaScript, which has a similar name but is a different programming language.

Can you tell me what I said that you're confused by?
You're still not coding in Java - MV uses JavaScript, which has a similar name but is a different programming language.

Can you tell me what I said that you're confused by?
To be honest, it's the Select/Deselect part that confuses me, should I redo the whole script or replace part of the existing script with Select/Deselect?

I've just recently started using scripts for my game and I'm really not sure what I'm doing, I find it really confusing most of the time.
Okay - that's just reading the description of the notetags in the documentation for Buffs & States.

Select and Deselect both happen regardless of whether the target gets hit - which is why the notetag you chose didn't work.

One of them happens before the skill executes, the other after. You have to decide whether it matters to you which way, and what your preference is.

Have you tried simply doing it with one of them to see how it works?
Okay - that's just reading the description of the notetags in the documentation for Buffs & States.

Select and Deselect both happen regardless of whether the target gets hit - which is why the notetag you chose didn't work.

One of them happens before the skill executes, the other after. You have to decide whether it matters to you which way, and what your preference is.

Have you tried simply doing it with one of them to see how it works?
Okay so after some testing with Select and Deselect it works halfway, the only target that get burn is the actor using the shield when he hit himself in a state of confusion wich is already something I guess🤣.
This is the Select version of the script :
<Custom Select Effect>

if (this.isPhysical()) {

target.addState(13);

}

</Custom Select Effect>
the only target that get burn is the actor using the shield when he hit himself in a state of confusion wich is already something I guess
cause you told it to.
i said "user" earlier in the thread because when youre using those set of notetags, the user is the one using the skill and the target is the target of the skill. who the state is on doesnt change it. so if a state with a select effect is on a battler and they are getting attacked, the select effect will run and burn the target - the one with the state
cause you told it to.
i said "user" earlier in the thread because when youre using those set of notetags, the user is the one using the skill and the target is the target of the skill. who the state is on doesnt change it. so if a state with a select effect is on a battler and they are getting attacked, the select effect will run and burn the target - the one with the state
Honestly, now I'm just completely lost because whether I use user or target, the result is the same and nothing works the way I want it to.
did you save your project and make a not reuse an old save when testing it?
plugin and notebox changes do not take place until the project is saved, and those changes will not be reflected in old saves either
Always start up a new game when testing changes.
Well after some time I finally manage to make it work, I had to make some change to make it work but know it does !
Thank you so very much for all your help !!

Original thread: https://forums.rpgmakerweb.com/threads/counter-attack-that-add-burn-state.172839/