Creating an enemy which will counterattack with a specific skill when you use a specific skill?

I had another question about counterattacking in another thread (ended up using Fomar's script for it, since Tsukihime's caused the game to crash), but that only seems to be a script to change an enemy's default counterattack (determined by CNT) into another skill, and I think MAYBE this idea may be usable without scripts through Troop events...

Basically, what I want to do is create an enemy that will, through a Forced Action, counterattack with a given skill if you use a given skill.

For example, normally he might only use normal attacks... but if you cast Fire on him, he will cast Fire right back at you. Ideally, I'd also like this to apply to healing and buffing skills as well, which have not actually targetted the enemy, but simply been used, so it's less of a "counterattack" and more of a "reactionary command", which is why I think this may be workable through events.

But I also need to be able to determine which skill he reacts with, because as I said in a previous thread, all the skills used by my party members factor Level into the equation, so I have to use separate skills for enemies. Therefore, if I cast Fire on him, I have to have him react with the enemy-version of Fire, not a mirror of the same skill.

Is there any way I can do this?
Counter Skills is a terrible script. It does too much and does all of it pretty bad.


Anyways so you just want to specify which skill the enemy counters with? (offensive or healing, doesn't matter)
Counter Skills is a terrible script. It does too much and does all of it pretty bad.

Anyways so you just want to specify which skill the enemy counters with? (offensive or healing, doesn't matter)
Not just which skills they counter with, but like a conditional counter based on what you do.

Like I said, I already tried yours and Fomar's scripts for a normal counterattack skill change, but this is something more complicated.

So for example, if Eric casts Fire, Monster will cast Fire back, or if you wanted, he could cast Ice back or even Cure on himself.

Or if Eric casts Cure on himself, Monster would "counter" that action with Thunder on Eric.

That's the kind of thing I need.
Well here's a start

http://himeworks.wordpress.com/2013/09/17/battle-reactions/

For now, reactions only occur when you're actually a target, so if you cast cure on yourself, enemies aren't going to react to that. Maybe in the future when I have thought about the consequence of checking if anyone can react to it.

This script supports multiple reactions, but does not give you the ability to control how many reactions will occur, so all reactions will occur.

Reactions can be added to basically any database object related to battlers.

It only supports skill-to-skill reactions. I have not thought about using items in response to skills or any other variations of the sort.

The skill does not need to be something you can actually use. So if you wanted to have a heal reaction, and you can't use heal...well it'll get used anyways. The only restriction is whether you have enough MP/TP, but that can be overridden if you set it as a "forced reaction"

You do not get to choose the target. The index is set to the attacker if the reaction skill is for enemies, and set to the target if the reaction skill is for allies. The scope is then used to determine the final target(s).

Note that in the future I'm going to be introducing an extended note-tag that looks like this

<reaction>type: skillid: 1react_type: skillreact_id: 51...</reaction>Which obviously provides more control over your reactions (I can add item reactions, or command reactions, etc), but will become very verbose.Anyways for now you get that limited skill reaction.
Well here's a start

http://himeworks.wordpress.com/2013/09/17/battle-reactions/

For now, reactions only occur when you're actually a target, so if you cast cure on yourself, enemies aren't going to react to that. Maybe in the future when I have thought about the consequence of checking if anyone can react to it.

This script supports multiple reactions, but does not give you the ability to control how many reactions will occur, so all reactions will occur.

Reactions can be added to basically any database object related to battlers.

It only supports skill-to-skill reactions. I have not thought about using items in response to skills or any other variations of the sort.

The skill does not need to be something you can actually use. So if you wanted to have a heal reaction, and you can't use heal...well it'll get used anyways. The only restriction is whether you have enough MP/TP, but that can be overridden if you set it as a "forced reaction"

You do not get to choose the target. The index is set to the attacker if the reaction skill is for enemies, and set to the target if the reaction skill is for allies. The scope is then used to determine the final target(s).

Note that in the future I'm going to be introducing an extended note-tag that looks like this

<reaction>type: skillid: 1react_type: skillreact_id: 51...</reaction>Which obviously provides more control over your reactions (I can add item reactions, or command reactions, etc), but will become very verbose.Anyways for now you get that limited skill reaction.
It doesn't seem to be working...

It should look like this right?

<skill reaction: 166 535 100 forced>

This should make him counter Fire with Fire... but it doesn't happen. I even made sure that he had the skill available.
My documentation didn't match my code lol


I've fixed the code to match what I wrote. Try again and it should work.
My documentation didn't match my code lol

I've fixed the code to match what I wrote. Try again and it should work.
Well... Now there's another problem...

It seems to cause the game to hang. Not even crash with an error. It just freezes up.

I even tried deleting Fomar's counterattack script to see if there was a conflict, but that didn't fix it. Seems that removing the forced trait didn't fix it either.

Maybe it's something with my battle system? I'm using a modified version of Yami's Charge Turn Battle System, which you can find in this thread: http://forums.rpgmakerweb.com/index.php?/topic/13223-game-crashing-whenever-berserkconfuseetc-is-used-on-actor-in-yami-ctb/

Could you take a look at it?

Edit: To clarify, the game hangs after using the skill that he needs to react to. It says "Monster reacted to Fire" and then hangs.
I've updated the script so the reactions have the same privileges as "forced actions" as well (sort of, since they pretty much are.


Still has compatibility issues with "charge_on" but I'm not going to try to figure that out since I'm not interested in that battle system.
I've updated the script so the reactions have the same privileges as "forced actions" as well (sort of, since they pretty much are.

Still has compatibility issues with "charge_on" but I'm not going to try to figure that out since I'm not interested in that battle system.
Now it causes a crash with Ace Battle Engine: https://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/

http://i.imgur.com/Uj20150.jpg

At that line.

I don't think charge_on is relevant. I think that's a special function of the battle system that allows you to require skills to charge up before they fire off, but I never use it.
Should be fine now.


I don't know what charge_on is for but I keep crashing on that so I just deleted it. If anyone is using that charge_on, I have no idea how to handle it.
Should be fine now.

I don't know what charge_on is for but I keep crashing on that so I just deleted it. If anyone is using that charge_on, I have no idea how to handle it.
Well... if I'm still getting the crash, then do you think that's the case?

I guess I can't use the script then...

Original thread: https://forums.rpgmakerweb.com/threads/creating-an-enemy-which-will-counterattack-with-a-specific-skill-when-you-use-a-specific-skill.18165/