Creating a State Effect that prevents the afflicted from targeting the caster

Okay, let's say an Imp casts "Fear" on one of my characters.
If the Imp manages to apply the "Fear" state on them, the character will be scared of the Imp, and will not be able to target it anymore with Skills, nor Items.
Is there a way to replicate this effect in MV?
not by default, you'll need a plugin for this
Im also pretty curious on how to
implement this or rather which plugin to use to achieve this.

Hmmm
Can you try this? It lets you add an unreachable state to a battler. If done correctly you should be able to implement what you need

Ohyeah. There's also YEP selection control.
Ok, i'm trying this:

I give the caster this tag:
Code:
<custom unreachable>
result = user
</custom unreachable>

And i add to the Fear State these tags:
Code:
<Custom Apply Effect>
target._Scared = origin;
</Custom Apply Effect>

<custom reach target>
result = target._Scared;
</custom reach target>

Theoretically it should give to the Scared target the informations regarding the one who scared him, and since the user has himself as his own Unreachable tag, it should prevent him from being targeted. It doesn't work though.

EDIT: In the end i decided to go for a more dumber solution by using the Tag
"<Cannot Select: All>" The Fear state is applied on the user, and the State will prevent them from being targeted. Not exactly what i wanted to do, but at least it works.

EDIT2: In case anyone wanted to create a Skill that allows you to remove the Fear effect from an enemy, here's an easy solution:

Spoiler
1)Set the skill that will act as "Fear remover" to target the user. This one is important because, in the case where all the enemies have the Fear State, you wouldn't be able to even use the Fear Remover otherwise, since it will consider all available targets unselectable.

2) Add this tag to the aforementioned skill:
Code:
<Custom Target Eval>
for (var i = 0; i < foes.aliveMembers().length; ++i)
{
   var member = foes.aliveMembers()[i];
   if (member.isStateAffected(fearStateID)) targets.push(member);
}
</Custom Target Eval>

This one will overwrite the original Skill's target AFTER you've selected it, going only after the enemies with the Fear state.

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-state-effect-that-prevents-the-afflicted-from-targeting-the-caster.130104/