VXAce I'm having a issue with counter attack working.

Issue Summary — I have a attack skill that I want to have a counter attack ability. So the warrior character has a chance to counter attack when hit. There is something called Tiger Stance but the Counter Attack is its own skill. I just want it to be a bonus effect.


What tutorials or previous support threads have you referenced? — I haven't found any.

Are you using any scripts? — Yes. Lots of them. But I also can't get it to work in a new game.

Attach any illustrative screenshots, full event pages with no cropping, mock ups, etc. — Added pics.
a notetag in itself does nothing - it is only a place to store text that can then be analyzed by a plugin.

placing a script therte without any tag for a plugin to identify it does nothing - your script there will always be ignored.

And since the target of the skill is an enemy, the enemy will get the counterattack state
That note bag is for another script. I waS told to put it there by a scripter. Otherwise, I wouldn't have put it there. It was for a cover ability that I wanted to work like the counter attack ability. But my warrior character is more like a berserker not a protector. So I wanted to switch it to a counter attack.
I know the enemy will get the counter attack state. And the reason why the counter attack doesn't work is because it needs to be used on the user. Not the enemy.
I waS told to put it there by a scripter.
then either you misunderstood that scripter, or he created a script with a very questionable way of accessing the notebox.
For which script is that entry supposed to be?
Because without a script to read that box, it will do absolutely nothing
And the reason why the counter attack doesn't work is because it needs to be used on the user. Not the enemy.
then you can't use the effect section but have to add the state to the user by damage coding.
please check the VXA section for the topics on how to use code in the damage formula, I don't remember the syntax needed with VXA anymore
It was for a custom script. I didn't say I didn't have a script for it. I don't remember what the script is called and I deleted it from the note box.
In the damage formula window, put this: a.add_state(x) - this will add state x (put the ID of your counterattack state there) to the user of the skill. Then use semicolon ( ; ) and then the formula for the damage.
Well, it works with other states, but when I choose counter attack, all it does is have the counter attack name pop up and does nothing.
So when the actor uses the Wild Swing skill, you want them to counterattack only in that round if they are hit? I think the way you have the state set up (auto-removal timing being action end), it will go away right after the WIld Swing is done, no? Try setting it to turn end and see if it does anything.
Nope. No change.
Can I ask why you haven't used the default counterattack state? That one has no restrictions, yours has "Attack an enemy", maybe that's the problem?
Nope. Same problem.
I think the problem is that you made assumptions of what a counter attack is that are simply not true for the engine.

Your state (which should be without restriction as the restriction has nothing to do with counterattacking) simply increases the chance for a counterattack, but it does NOT change how the counterattack works in itself.
(The restriction only affects what options the player has during the skill selection, and "attack an enemy" basically means that the actor goes berserk, unable to use anything other that attack skills on a rendom enemy)


And the counterattack itself is NEVER a skill, it is a process/function inside the battleengine.
You simply cannot say "use this skill if the actor gets a chance to counterattack" anywhere in the engine - it's simply not possible to set something like that.

so, especially due to answers like
Nope. Same problem.

Please state again exactly what you want to happen and what does actually happen in your project, keeping in mind that the counter effect can only happen after the state has been applied.

And then we can tell you if what you want is even possible without a script modifying the entire engine
I switched counter attack back to 'no restrictions.' It had no effect.
After my character uses 'wide swing' I want him to be able to counter attack if hit. All suggestion so far don't trigger the counter attack effect.
when and how did you test this?
For example the counterattack only happens on physical skills used by the enemies, they won't happen on magical skills of certain hit skills

and did you test it ingame with a new game, ingame with loading an old save or in the database battletest?
No magic. Just normal attacks. I just used the database battle test.
I just used the database battle test.
that might be your problem.

the database battletest speeds up the battle launch by skipping a good part of the game setup.
That only works reliably without anyscripts.

However there are several battle scripts that require a "new game" with the full setup to work correctly.

For this reason you always have to test with a full playtest and selecting "new game" on the title screen.

please add an event with the appropiate troop to your starting map and test there.

Original thread: https://forums.rpgmakerweb.com/threads/im-having-a-issue-with-counter-attack-working.179789/