So I want to add this constricting mechanic that when an actor uses a certain skill that stops the enemy from acting, but also the actor too. Adding the states isn't the issue, but removing them is where I'm getting the problem. I want it so that if another actor attacks the enemy, the enemy is knocked out of the state and so is the actor, but I'm having issues implementing that. Doe's anyone know of any work arounds or plugins that can accomplish this?
How to add a state to an actor if a certain state is inflicted onto a enemy?
RPG Maker MV SupportAssuming that you're using Yanfly's Buffs and States Core, you can use this notetag on the state:
<Custom Respond Effect>
if (this.isHpEffect() && this.isSkill() && value > 0 && user != origin)
origin.removeState(stateId);
</Custom Respond Effect>
<Custom Respond Effect>
if (this.isHpEffect() && this.isSkill() && value > 0 && user != origin)
origin.removeState(stateId);
</Custom Respond Effect>
Sorry but it didn't seem to work.
Could you elaborate on what you tried and what happened when you tried? I tried it and it worked. One thing I forgot in the initial code was to remove the state from the enemy and also to check if the target being attacked was the enemy. So, try this one instead:
Code:
<Custom Respond Effect>
if (this.isHpEffect() && this.isSkill() && value > 0 && user != origin && target.isEnemy()) {
target.removeState(stateId);
origin.removeState(stateId);
}
</Custom Respond Effect>
@Naveed Ok so I've attached two images, one is the skill and the other is the is the status. In battle it all plays out normally, but the state still stays on the person that the skill was used on even though it's removed from the skill's user. I've also tried changing the state ID in the notebox, but that still didn't help. And I don't have any other plugins that would conflict with yanfly's state plugin so I don't know what would be the issue.
Ah it's because your state has the "Remove By Damage" tag on it. You have to remove that, as otherwise the state is removed before the respond effect triggers. The notetag handles the removing of the state so you don't need remove by damage.
@Naveed Sorry it's still not working. Even tried it in a blank project with just yanfly's stuff and it's still on.
@Naveed Sorry, but it's still not going working. Even in a new project with only Yanfly's stuff on it still doesn't remove itself from the actor. I even turned the cannot move part off and it still stays on the actor.
Try adding this to the notetag of the state as well (don't replace what was previously there, just add this below it):
Code:
<Custom Remove Effect>
origin.removeState(stateId);
</Custom Remove Effect>
Nah it's still not working. Would it be ok if I got a copy of your states and skills files so I can see what I'm getting wrong?
@Naveed Thanks for the help, but I think I'm just gonna call it quits now. It works great in a blank project, but in mine it refuses to do the removing part. I really appreciate the help though and I'm sorry for wasting your time. If there's anything I can ever help with send me a PM and maybe I can help you in return.
Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-state-to-an-actor-if-a-certain-state-is-inflicted-onto-a-enemy.92804/





