"Control Variable" doesn't work?

Here is the problem:
The boss is moving towards the player and dashes when it's close enough. I don't want him to be able to dash constantly, so there is a variable "counter_2" that will make sure that the boss will have to wait until he recovers this ability.

But "Control Variable" command doesn't seem to work at all. Like it's simply skipping it.
I tried to use a Script call ($gameVariables.setValue(32, +1) inside the "Movement route", but nothing happens.

Spoiler
0VvqIix.png
Nothing wrong with that, that I can see. Where are you resetting the variable back to 0? What's the rest of the event? Have you checked what the variable is set to after a little bit of dashing - is it increasing at all? Is your movement route waiting until it completes before executing the next command?

You can't do += 1 inside the script call. You'd have to do $gameVariables.setValue(32, $gameVariables.value(32) + 1). However, I don't think that's the issue. It's more likely the Control Variables isn't being run at all, or you have another event that's changing the variable as well. You could temporarily add a Show Text command after the Control Variables that just contains \v[32] to repeatedly show what the variable contains. At least then you'd know that the variable is actually incrementing. I'd change the 120 to a much lower number though, 'cause you don't want to have to dismiss the text box 120 times to test the condition. Maybe just change it to 10 or something.
Hi! I'm not sure if I understand correctly.
But, try to use in the first conditional branch instead of "= 120" put ">= 120".
[is front clear] is NOT a script command, so that part is where the entire sequence breaks as well.

and as Shaz said above we need to see the rest of the event, the parts you cut off from the screenshot and where you reset the variable (if you don't reset the variable to zero, the entire sequence will only work once)
[is front clear] is NOT a script command, so that part is where the entire sequence breaks as well.

and as Shaz said above we need to see the rest of the event, the parts you cut off from the screenshot and where you reset the variable (if you don't reset the variable to zero, the entire sequence will only work once)
I think the [is front clear] part is from a plugin from SRD.
BUT I'm not sure if it is a plugin command or script call either ^^``
oh - can we please see the ENTIRE event window, and not just a cropped part? The issue might be somewhere else.

What plugins are you using? I didn't even pay any attention to those script commands. It may be that the variable is working just fine, but your script calls are wrong and are never evaluating to true. Please post links to the plugins.

What IS happening? Is the event moving right up to the player? Adding 1 to a variable every frame would make the event move for 2 seconds before the variable reaches 120. Maybe there isn't 2 seconds worth of moving to be done?
@Eliaquim That's actually not a script.
Code:
eval("[this front clear]")
will throw a syntax error. Either way, until the OP tells us where they got it from, we'll never know what is it actually supposed to be.
Thanks.
I found the issue! It would recover his ability if counter=120, but if it's bigger, it won't do anything 😀 So I just set it to counter>=120 and now it works perfectly fine 🙂
okay - something is ONLY going to happen with this event if the JMW.checkDist(7,2) script call returns true on the exact frame that the variable reaches 120.

Why are you doing both tests? You want them to run for 2 seconds, or you want them to run a certain distance - pick one and go with that. If checkDist returns true on frame 119 or frame 121, the rest of the commands will never be run.
@Eliaquim That's actually not a script.
Code:
eval("[this front clear]")
will throw a syntax error. Either way, until the OP tells us where they got it from, we'll never know what is it actually supposed to be.
It's just a script 🙂
what script? I've never seen a script that uses syntax like that. And you can't use a plugin command inside a script call.
what script? I've never seen a script that uses syntax like that. And you can't use a plugin command inside a script call.
Sorry, I mean it's a plugin. SRD CollisionChecker(I actually don't need it in this one, since the distance is only two tiles.
you can't use a plugin command inside a script call
You actually can(depending on plugin you use).
So you're sure the problem is resolved? You're now able to see that whole event play all the way through with the little change you made?

If so, you can report your first post and let the mods know you have a solution, and they'll lock the thread for you. But don't do that unless you've seen the whole thing play out properly.
If so, you can report your first post and let the mods know you have a solution, and they'll lock the thread for you. But don't do that unless you've seen the whole thing play out properly.
It's working great.
I'll do that. Thanks! 🙂

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.

Original thread: https://forums.rpgmakerweb.com/threads/control-variable-doesnt-work.112657/