MV Issues with Yanfly counter control (solved!)

I have been working on a project for a few months now.
I have no experience with JS at all but I have enough of
a background that I can parse through most of it,

However I have been struggling with this part for two days and getting no where.

The issue I have is with Yanfly's counter control
Spoiler: link

I have two skills that are only meant to answer an attack that is magical or physical
and that part works fine, however no matter what else I put in as the trigger condition it will always return true:

Code:
 <Custom Counter Condition>
if (this.isMagical() && a.hasSkill(210))
{
condition = true
} else {
condition = false;
}
 </Custom Counter Condition>

<Counter Skills: 233>
Code:
 <Custom Counter Condition>
if (this.isPhysical() && a.hasSkill(219))
{
condition = true
} else {
condition = false;
}
  </Custom Counter Condition>

<Counter Skills: 234>

For clarity.... any time anyone is hit it will answer with the correct skill (either magic / physical) but it will ignore everything else I have put it no matter what that is ( even when I just straight up ordered it to return false it would still return true)

what am I doing wrong?
Hmmmm, <Custom Counter Condition> is a skill notetag?
It's not supposed to be in the same place as <Counter Skills: x>

And I don't think it interprets 'a'. Try user/target or the example seems to have attacker/defender.
Hmmmm, <Custom Counter Condition> is a skill notetag?
yeah. its valid. counter control is a little... weird with how its set up
And I don't think it interprets 'a'. Try user/target or the example seems to have attacker/defender.
a and b should work. i remember the variables being made in the eval the counter condition gets ran in.

For clarity.... any time anyone is hit it will answer with the correct skill (either magic / physical) but it will ignore everything else I have put it no matter what that is ( even when I just straight up ordered it to return false it would still return true)
i dont have access to my project rn to check anything, but i dont think enemies have hasSkill(), iirc "this" refers to the BattleManager within that notetag, and i do know offhand that the "condition" variable there defaults to being true. so your condition might be creating errors and the the eval is defaulting to being true.

replace this.isPhysical() with action.isPhysical(), and if this is an actor countering an enemy the hasSkill() wont do anything. if its an enemy countering an actor it should be fine
Cool. Just to make sure, when I said that hmmm stuff which you quoted, I meant that as a statement. Like that it is a skill notetag. But right now it seems that they've added it to the same place where they put the <Counter Skills> (so actor or whatever)?
Or did you mean with your "it's valid" that it can be put in many places? 😀
Cool. Just to make sure, when I said that hmmm stuff which you quoted, I meant that as a statement. Like that it is a skill notetag. But right now it seems that they've added it to the same place where they put the <Counter Skills> (so actor or whatever)?
ah, youre right about that. when i saw the tags i thought they meant they had just grouped them together instead of putting them on the same object. if theyre both on a state or skill or w/e it wouldnt be working as intended
Sorry I was stuck at work, just got home and I will try your suggestions now,

I hope it works, but so everything I put in returns true even if the only thing is :

Code:
<Custom Counter Condition>

if (this.isMagical()

{

condition = false;

}

 </Custom Counter Condition>



<Counter Skills: 233>

So I suspect you may be right about the conditions

I'll test everything though and let you know

-------------------------------------------
Edit :

Ok, so I got it working.
after rereading what you both said again and again I finally understood what you was asking me and what I was doing wrong,

I had simply overlooked the fact that I had put most of it in the wrong notetag.

I don't understand why it was still half working ( filtering out between physical or magical hits) - but with a bit of trial and error Now that I was on the right path I managed to fix it in just 10 minutes so thank you. you are live savers ! :LZYgrin:

Original thread: https://forums.rpgmakerweb.com/threads/issues-with-yanfly-counter-control-solved.176806/