Fear State (cannot target caster)

Hang on. I have to draw it to have some visualizations
In short...
e.g
Bob has ability "Fear" and he is using it on Goblin
When Goblin is affected with Fear, Goblin still can attack anyone except Bob as long Goblin is under "Fear"

Try with this
Code:
<Select Conditions>
var caster = $gameActors.actor(1)
condition = (target.isEnemy() && target != caster || this.isStateAffected(49));
</Select Conditions>

explanation:
&& means AND
target.isEnemy() - checks if target is your enemy (returns true)
target != this - checks if target is not an actor num 1 in DB (I gave him fear skill)
this.isStateAffected(49) - checks if you are ander fear state


Correct me if I screw up this code - I'm pretty tired...
Hang on. I have to draw it to have some visualizations
In short...
e.g
Bob has ability "Fear" and he is using it on Goblin
When Goblin is affected with Fear, Goblin still can attack anyone except Bob as long Goblin is under "Fear"
Correct, no actions can be taken to target Bob. However "ALL" and "AoE" still work since it does not target Bob.
@Icenick - check my prev post, I made some edits.
Hang on. I have to draw it to have some visualizations
In short...
e.g
Bob has ability "Fear" and he is using it on Goblin
When Goblin is affected with Fear, Goblin still can attack anyone except Bob as long Goblin is under "Fear"

Try with this
Code:
<Select Conditions>
var caster = $gameActors.actor(1)
condition = (target.isEnemy() && target != caster || this.isStateAffected(49));
</Select Conditions>

explanation:
&& means AND
target.isEnemy() - checks if target is your enemy (returns true)
target != this - checks if target is not an actor num 1 in DB (I gave him fear skill)
this.isStateAffected(49) - checks if you are ander fear state


Correct me if I screw up this code - I'm pretty tired...

I didnt get it working.
I have a skill called FEAR, which is important that it does not cast on a target who is already feared. But I dont know why but the enemy cast fear on my actor who was already fear.
Code:
Fear Skill
----------
Adds State fear 100%

<Custom Requirement>
value = !target.isStateAffected(fear);
</Custom Requirement>

My Attack Skill:
Also did not work, the actor who was feared attacked the enemy who feared him.
Code:
<Select Conditions>
var caster = $gameActors.actor(1)
condition = (target.isEnemy() && target != caster || this.isStateAffected(117));
</Select Conditions>
I had an idea what if we (more you because I can't figure it out lol), based the code off Lightning Rod.

The user adds a "fear" state to himself, and a second state (afraid) to target.
The Fear state has foe aura and in the notebox which has if (action && action.isForOpponent() && user.isStatedAffected(afraid)) finally the last line if we can do !action.setTarget(rod.index()); or something that makes it unable to target the enemy with "fear" unless you do not have state "afraid".
Also we can do a math chance to make it so that 50% of the time you'll overcome fear and attack otherwise you'll chicken out and change target.

What do you think?
I think the fundamental issue with this idea is that the state needs to be instanced. Supposed actor A casts fear on enemy D, and actor B casts fear on enemy C. By your logic, enemy D should be able to cast actor B, right? If that's the case, then each instance of the fear state needs to have a record of who cast it.

On the other hand, if that's not the case - if in the example you want both enemies to be unable to target both actors - then this is probably doable using an invisible state on the caster, I would guess. Since I don't use Yanfly plugins though, I can't give any specific suggestions.
I think the fundamental issue with this idea is that the state needs to be instanced. Supposed actor A casts fear on enemy D, and actor B casts fear on enemy C. By your logic, enemy D should be able to cast actor B, right? If that's the case, then each instance of the fear state needs to have a record of who cast it.

On the other hand, if that's not the case - if in the example you want both enemies to be unable to target both actors - then this is probably doable using an invisible state on the caster, I would guess. Since I don't use Yanfly plugins though, I can't give any specific suggestions.

Well ideally yes, but since fear is not a core mechanic of the game I don't mind compremising having some enemies and actor classes the ability.

I'll treat it more like the enemy is being extra scary and your afraid state causes you to not attack th extra scary enemies.
I wanted to have yanfly battle AI have warriors cast this on actors with lower def and hp

Original thread: https://forums.rpgmakerweb.com/threads/fear-state-cannot-target-caster.124472/