Status
Not open for further replies.

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hello everyone, I'm having trouble trying to get one of my character's counter skill(s) working utilizing the <Custom Counter Condition> note tag with Yanfly's Counter Control (I have version 1.10). No matter what eval I seem to put in, the same skill is only ever countered with, despite its conditions returning false.

I've searched ahead of time to see if anyone else was having this problem and came across this thread. I tried the "solution" but it still didn't work for me: still doing as it was before & broke counters when only one enemy was left.
I have the plugin right under YEP Battle Engine for what its worth (as I use none of the other plugins above it on the wiki).

The battle I tested with had 4 alive enemies. They had a testable amount of HP so none died during the testing until like 3-4+ turns off of pure counters. Did this trial about 10+ times also with a CNT rate of 60%. Also did a new, blank project with only YEP Battle Engine, YEP Passive States and YEP Counter Control. Got same results.
Screenshots of my settings are here, here and here.

The passive state has this (main project):
Code:
<Counter Skills: 111, 114>

The first skill (that is always countering regardless of its condition being false) is ID 111 and has the following code:
JavaScript:
<Custom Counter Condition>
   if ($gameTroops.aliveMembers().length <= 3) {
     condition = true;
   } else {
     condition = false;
   }
</Custom Counter Condition>
The second skill (that is never used even if its condition is true) is ID 114 and has:
JavaScript:
<Custom Counter Condition>

   if ($gameTroops.aliveMembers().length >= 4) {

     condition = true;

   } else {

     condition = false;

   }
</Custom Counter Condition>
So essentially ID 111 is only supposed to happen if there are 3 or less enemies while 114 only happens if enemy count is 4 or more.

I even did
JavaScript:
$gameTroops.aliveMembers().length === 2
for skill 111 and it still functioned when attacked when enemy count wasn't 2.

Anyway, I'm not really sure what I'm doing wrong - if anything.
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,214
Reaction score
1,902
First Language
English
Primarily Uses
RMMV
It's troop, singular, not troops. You could also make all of the code for the conditions more efficient, but that's the basis of your problem, you're referencing a game variable that doesn't exist (if you opened the console, you'd probably see errors about it).

For example, your 111 could simply say:
Code:
condition=$gameTroop.aliveMembers().length<=3;
 

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
It's troop, singular, not troops.
Oops, my bad.
Yeah, first thing I did was open the console, but I saw no errors pointing to it, so it left me even more perplexed.

I'm assuming the tag is supposed to be:
Code:
<Custom Counter Condition>
condition=$gameTroop.aliveMembers().length<=3;
</Custom Counter Condition>

I tried copy-pasting your code and the first skill is still only being used (swapped both skills' conditions to see if it would use the second skill).
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,214
Reaction score
1,902
First Language
English
Primarily Uses
RMMV
Then you should post screenshots of both skills. It seems likely that one of them has an error in the rest of its configuration that makes the actor unable to use it.
 

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Then you should post screenshots of both skills. It seems likely that one of them has an error in the rest of its configuration that makes the actor unable to use it.
Using the clean database when you first start a project.
Only thing changed was char name and graphic. No skill costs were adjusted.
Skill 9 - Fire
Skill 10 - Spark
Counter state
Participating enemies
Countering
If I only put <Counter Skills: 10> (Spark) for the state
Counter control plugin settings
Plugins
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,214
Reaction score
1,902
First Language
English
Primarily Uses
RMMV
Have you tried using the regular conditions list, then an Eval: condition? It does seem like something isn't working properly, I'll poke at it on my end for you.

Edit: Based on my initial troubleshooting, it seems that the custom conditions aren't actually being read and saved into the skills. I'll see if I can fix it, but it won't be until tonight.
 
Last edited:

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
I just substituted
Code:
<Counter Condition>
magical hit
single target
</Counter Condition>
for Fire
and
Code:
<Counter Condition>
physical hit
single target
</Counter Condition>
for Spark

and Fire is still only used. Enemies are only using the default Attack action so it should have no business activating Fire (GIF) if I'm understanding the regular conditions list correctly.

Edit: didn't see your edit. Thank you putting your time aside to try and help, I really appreciate it.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,214
Reaction score
1,902
First Language
English
Primarily Uses
RMMV
I just substituted...for Spark and Fire is still only used.
That one I can't duplicate, putting those conditions in Fire make it not get used for me. Did you try my suggestion above of using the Eval condition? It would be the same code I gave you for the custom, starting with $gameTroop.

I'll poke at it in a while, because something is wrong in the code end regarding the custom.

Edit: Alright, @Thornton - here we go. I got it to work as expected, it'll require you to edit the plugin file with a text editor (such as Notepad++).

Make line 1105 read:
Code:
    if (!this.meetCounterConditionsEval(skill, subject, target)) return false;

Then...I can't figure out the original logic of this function. But it will work if we make these changes, and I haven't seen it break anything else yet. Change line 1112 to read:
Code:
    if (skill.counterConditionEval=='') return true;

and then line 1122:
Code:
    var code = skill.counterConditionEval;

Making those changes, the existing custom conditions work exactly as expected in my test project.
 
Last edited:

Thornton

Villager
Member
Joined
Jul 17, 2015
Messages
14
Reaction score
3
First Language
English
Primarily Uses
RMMV
Did you try my suggestion above of using the Eval condition? It would be the same code I gave you for the custom, starting with $gameTroop.
Yeah, some weird stuff happened where Spark would indeed counter, but then its the only thing used even when the conditions were false, but the moment I changed Fire's magic hit condition back to physical it was Fire only. /shrug

Not all heroes wear capes - thank you! This edit works perfectly and everything is working as intended. Thanks for helping me again, can't thank you enough! :LZSproud:
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,647
Reaction score
15,742
First Language
English
Primarily Uses
RMMV

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.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

1.6 update incoming with quality breakthrough! :kaoluv:

1643254634071.png
I might try the mechanical bull at the fair on Friday... for one of the challenges, if you stay on for two minutes, you win $200. I might give that a try and see if I win--I'm pretty good at holding on to things.
Remaking a more streamlined version of my Remote Move map skill in MZ, just one switch and one variable to handle everything. If you seen the Move skill in Golden Sun before, moving far away items with your mind is pretty cool

MZtestRemoteMove.gif
I don't want to brag or anything but I was entertaining a woman the other night. I told her jokes while she bandaged my foot.
Okay so, I'm using this script, right? And it works. If you press :Y a menu should come up allowing you to choose an item to use. Nothing happens. You press :A to open the event options menu and choose "Use an Item"? The item selection menu appears. I have no idea how I set this up or why it works the way it does. Absolutely bizarre.

Forum statistics

Threads
118,733
Messages
1,118,329
Members
155,889
Latest member
pgimstone
Top