MZ Make a skill do something different when an enemy utilizes it

So I come bringing another issue to you fine folk! Basically, I have added in a sort of variable based system within my game's combat. Each Skill alters the variables using a common event that either raises the variable or lowers the variable. Once the variable reaches a certain count (Such as 5 or -5) it will execute a check and give a buff if the certain variable count is reached. This system being heavily inspired by Library of Ruina. To make it easier from here on out, the system is called elemental resonance.

Though, moving onto my ISSUE. I have found that due to enemies using the same skills as the player, it leads to their attacks also contributing to the variable count. Leading to the count being reached faster than it should. I want to make it so the enemy uses the same skill as the enemy, but doesn't activate the common event that leads to the increase or decrease of the variable. As an example? Claw Swipe. It increases the amount of resonance by 1. WIth how it's currently set, due to the enemy. No matter what it will lead to a positive resonance by the end of turn 1.
1781086220911.png

I am a bit wary of making a duplicate of the skills for enemies, as I want to avoid bloating the skills with more and more variants. The same goes for plugins, as my game heavily uses the Card Game Combat Plugin by MythAtelier. So I don't want to risk compatibility issues.

Spoiler: BONUS!
A less important thing, but still something I would like to fix with my elemental resonance system. Currently with the system I have it where it uses a onscreen meter that changes ONLY when the exact count is reached. But I want it so the player can actually tell when their about to successfully reach a level of resonance. Is there a way to make it so the variable is either turned into onscreen text, or alters something beyond a simple picture?
Example of current Meter:
Empty ER Meter.png
EP1 Meter.png
EN1 Meter.png

It currently has a maximum of three, and only shows when it's reached instead of how close it is to being reached. Again, this is just a less important bonus ask. Feel free to ignore if you feel it isn't needed to be fixed
regular common events are executed independently of their skills.
that s one of the bigger problems when it comes to target CE's.

given your explanations I can only think of one way to handle this, and most likely it will need a custom plugin because I don't know of any already doing this.

basically you need a notetag that is eval'ed on hit.
in that notetag you use javascript to check if the skill user is an enemy or an ally/actor, and only call the common event if an actor used the skill.

There are several plugins that use action sequences to do exactly that, but your battlesystem will not be able to use those.
It might have helped if you give links to the plugins you're using for your card battles, or is that evented only?

EDIT:
it should be possible to do this without a plugin by using the damage formula, but that has several other disadvantages and I would not recommend it if you can find a plugin for the notetags.
If you try it, you basically need to check if a is an actor and if yes, call the script equivalent of the call common event command.
Unfortunately one of the problems is that in case of autobattle tag, that skill/common event will be executed multiple times by the AI trying to determine the best skill to use.
that skill/common event will be executed multiple times
Actually, while it's true the damage formula will be executed multiple times, the event won't be – assuming you use the "reserve" system like a normal effect, the event is only scheduled to run, and you can only have one scheduled at a time (unless you use another plugin), so it'll only run once.

If you want to try that, your damage formula would look like this:

JavaScript:
if(a.isActor()) $gameTemp.reserveCommonEvent(5); 15

Replacing 5 with the ID of the appropriate common event.
It might have helped if you give links to the plugins you're using for your card battles, or is that evented only?
The plugin itself costs money, unfortunately. First time I properly bought a plugin, actually. So I can't show you it fully. Though how it affects the skills isn't related to the issue, as the Skills are turned into cards and are discarded on use akin to Library of Ruina or other deckbuilding games. The variables in combat are event based though.

But I am curious of the possible solution in relation to formulas as I doubt I can find a plugin that fits my needs that doesn't conflict with the Card Game Combat plugin. So I might give that a try, though I might have to create multiple Common events (For the different amounts that the variable is increased) as I doubt I can have the formula run the common event more than once.

EDIT: Solution seems to be working; the formula is causing the common event to activate only when the actor uses the specific skill. It works exactly as needed! Though I am curious if I could make it so the common event kicks in when the damage is dealt by the actor, unless the formula already causes that. Tested that! It does indeed only kick in if damage successfully lands against the enemy! Just as needed!
In the case of paid plugins, it is usually sufficient to link to the shop page where you purchased the plugin.
While having the code of a free plugin is better, often the descriptions on what the plugin does are enough to help.
And you're not the only one who paid for plugins, so giving the specifics may point others who purchased the same plugin to help.
In the case of paid plugins, it is usually sufficient to link to the shop page where you purchased the plugin.
While having the code of a free plugin is better, often the descriptions on what the plugin does are enough to help.
And you're not the only one who paid for plugins, so giving the specifics may point others who purchased the same plugin to help.
Ah, gotcha! Here's the link for ya then https://mythatelier.itch.io/card-game-combat
Hi there!
Fun thing to think off. Just another alternative:
I would do something like that, on the common event itself without using the damage formula:
1781110375789.png


Then you can do what you want for the actor inside the block with the message "actor used skill". If perhaps you want a different behavior for the enemy, use the else block with the enemy message.
Hi there!
Fun thing to think off. Just another alternative:
I would do something like that, on the common event itself without using the damage formula:
View attachment 367831

Then you can do what you want for the actor inside the block with the message "actor used skill". If perhaps you want a different behavior for the enemy, use the else block with the enemy message.
Ah, I'll give this method a shot as well since this would allow some more dynamics. Also, noticed the other common events. Funnily enough I am using this for a Pokemon fangame.

Edit: I might use the formula method instead for one reason, as the formula only allows the common event to kick in if damage is dealt. Though writing this, I am realizing. I can add the two methods together. Common event that picks up on who's doing the attack in the formula, if damage is successfully dealt. Common event activates the specific events

Edit2: Tested it out, for some reason if the attack hits an actor besides my second actor. It will prompt a error. The error seems to kick in on the first actor on the team rather than first actor in the database when their hit. Alright, did some more troubleshooting. It kicks in when the skill is used twice by the enemy. Maybe I put the code in wrong

Edit3: Did some more troubleshooting, if I change the action time to only allow one attack. It will make it so the game instantly shows an error message, meaning it has something to do with switching to another enemy for some reason

1781137040156.png
1781137305853.png
Ah, I'll give this method a shot as well since this would allow some more dynamics. Also, noticed the other common events. Funnily enough I am using this for a Pokemon fangame.

Edit: I might use the formula method instead for one reason, as the formula only allows the common event to kick in if damage is dealt. Though writing this, I am realizing. I can add the two methods together. Common event that picks up on who's doing the attack in the formula, if damage is successfully dealt. Common event activates the specific events

Edit2: Tested it out, for some reason if the attack hits an actor besides my second actor. It will prompt a error. The error seems to kick in on the first actor on the team rather than first actor in the database when their hit. Alright, did some more troubleshooting. It kicks in when the skill is used twice by the enemy. Maybe I put the code in wrong

Edit3: Did some more troubleshooting, if I change the action time to only allow one attack. It will make it so the game instantly shows an error message, meaning it has something to do with switching to another enemy for some reason

View attachment 367843View attachment 367844
Hmm! I see!
I think if we use the subjects from the action will be better than get the subject directly from the Battle manager:
1781142739434.png


But if you want that to only be applied when a damage is done, then it can get more complicated and I don't think this is doable without a plugin(or without the damage formula). Although you can turn on/off a switch on the damage formula if the damage is higher than 0? The check that switch on the common event?

Either way, when it comes to skills that can hit multiple targets ou hit multiple times, the common event way will not work because it will only be executed once, regardless how many targets/times it hits. If that is a question for you.

About pokemon, well I dream to make all movesets from the first generation and also some mechanics. But too short on time haha
Alright, tested it out. Issue is it is reading out a new error message. I think I'll just have to settle with only the Formula method, as I have had the common event executed through the damage formula. Though I am confused as everyone says the event executed will only hit once, when if I use my attacks that hit multiple enemies it will seemingly execute the common event multiple times
1781143520475.png
1781143557357.png
1781143583485.png

Though, to talk a bit more about Pokemon. I believe that you'll be able to complete your objective to make all the movesets from the first generation. For my own game it's anthro pokemon, so I do have to change a few moves to fit the characters and combat system. But I am adapting some aspects such as Z-Moves and elements into the card combat system + Ruina inspired combat

Original thread: https://forums.rpgmakerweb.com/threads/make-a-skill-do-something-different-when-an-enemy-utilizes-it.183975/