Yanfly buff states core

Hello I'm trying to make an Armor for my drone character. When it gets attacked it's supposed to convert the damage into mp (EP). I'm using this code below in the state. What's happening is that no matter who my party attacks the enemy gets 10 mp. When I do equip the Armor it works properly. But how to stop my characters giving the enemy mp.
<Custom Respond Effect>

target.gainMp(10)

</Custom Respond Effect>
Moved to: Plugin Support(Plugin Requests is for when you need a new plugin made to fulfill a certain need.)

This looks to me like a correct tag - I'm not 100% sure, but I think that target is indeed the correct way to call the battler who has the state whenever they are the target of a move.

I'm confused when you say that "When I do equip the Armor it works properly." What is it doing correctly, what is it doing incorrectly, and what behavior are you seeing that you believe you shouldn't see? Also, do you have any notetags on the Armor itself? (I assume the notetag you specified is on the State). My first instinct, if I understand you correctly, is that you might have a second, incorrect notetag on another entry (such as an enemy or an equip) in your database.
Respond effect plays when the afflicted battler takes an action. In your example, you're giving MP (via the gainMp function) to the target of the afflicted battler. You want the user to gain Mp, not the target.
user.gainMp(10)

edit:
You probably also want the mp gain to show up on the screen as well, so throw in a user.startDamagePopup() as well.

second edit:
I messed up respond effect, I never use that one. I'd personally go with a react effect instead. In either case, restoring mp to user rather than target is probably what should fix this for you.
@ramza I think that they want the affected battler (not the user) to gain MP, based on this (emphasis mine):
Hello I'm trying to make an Armor for my drone character. When it gets attacked it's supposed to convert the damage into mp (EP).
So in other words (if I understand correctly), whenever an enemy attacks the Drone character, the Drone character should gain some MP.
So if the drone character has a state on them, they are the afflicted battler. That means respond and react effects are correct to use here. And technically, the 'target' in that case should also be the drone character, so they should be the one restoring Mp when they get hit.

That would imply that the state for the mp restoration isn't on the drone character at all, but on the enemy, and that's why the enemy is restoring mp whenever it gets hit.
So if the drone character has a state on them, they are the afflicted battler. That means respond and react effects are correct to use here. And technically, the 'target' in that case should also be the drone character, so they should be the one restoring Mp when they get hit.

That would imply that the state for the mp restoration isn't on the drone character at all, but on the enemy, and that's why the enemy is restoring mp whenever it gets hit.
I kinda solved the issue. The state in question is a passive state that should happen whenever the actor equips the Armor. For some reason whenever my actors attack the enemy, the enemy gets the state applied to them. What I did was make them resistant to the state and it stopped applying to them. Go figure.
So if the drone character has a state on them, they are the afflicted battler. That means respond and react effects are correct to use here. And technically, the 'target' in that case should also be the drone character, so they should be the one restoring Mp when they get hit.

That would imply that the state for the mp restoration isn't on the drone character at all, but on the enemy, and that's why the enemy is restoring mp whenever it gets hit.

I'm having one more issue. The drones MP is restored using a drone cell item during battle using this formula.

c = b.isActor() ? b.actor() : b.enemy(); c.meta.Drone ? 250 : 0;

I place this within the damage formula. Whenever my drone has "absorb shield"equipped the player sees that only 10 MP was restored when in fact 250 was restored. The MP is still restored, but what is showing to the player is inaccurate. How can I fix this?
Respond effect plays when the afflicted battler takes an action. In your example, you're giving MP (via the gainMp function) to the target of the afflicted battler. You want the user to gain Mp, not the target.
user.gainMp(10)

edit:
You probably also want the mp gain to show up on the screen as well, so throw in a user.startDamagePopup() as well.

second edit:
I messed up respond effect, I never use that one. I'd personally go with a react effect instead. In either case, restoring mp to user rather than target is probably what should fix this for you.
okay I will try this thanks a lot, but see my new post please thanks
Respond effect plays when the afflicted battler takes an action. In your example, you're giving MP (via the gainMp function) to the target of the afflicted battler. You want the user to gain Mp, not the target.
user.gainMp(10)

edit:
You probably also want the mp gain to show up on the screen as well, so throw in a user.startDamagePopup() as well.

second edit:
I messed up respond effect, I never use that one. I'd personally go with a react effect instead. In either case, restoring mp to user rather than target is probably what should fix this for you.
okay changing it to custom react effect fixed most my problems. The only issue now is when my players use a drone cell on the drone they get 10 MP while the drone MP restored is showing accurately.
okay changing it to custom react effect fixed most my problems. The only issue now is when my players use a drone cell on the drone they get 10 MP while the drone MP restored is showing accurately.
Did you also use a startDamagePopUp() in the react effect like I suggested in my first post? If it's only showing one MP gain, it's probably only popping up one 'damage' effect.
Did you also use a startDamagePopUp() in the react effect like I suggested in my first post? If it's only showing one MP gain, it's probably only popping up one 'damage' effect.
When I used that it popped up two mp gains.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-buff-states-core.120395/