How to Make "Sketch" Skill From Pokémon in RPG Maker MZ?

The "Sketch" skill from Pokémon works as follows:

When selected, the user learns the last skill the selected enemy used.
However, this also takes time to use, just like any other skill. So, if an enemy uses a fire skill, the turn ends, the player selects to use "Sketch" but their agility is lower than the enemy (the enemy goes before the player uses sketch) the skill learned would be whatever skill the enemy most recently used was- not the fire skill.

I've tried combining the change skill script call with a variable but the problem I had with that was I couldn't figure out how to save the last skill ID the enemy used as a variable. RPG Maker MZ has the ability to set a variable to "Last Skill ID Used" but, if the player goes last, this also includes the skill ID that the party used. Also, I could only get this to activate at the end of an entire turn, not just an enemy's.


If anyone has any ideas on how to emulate this skill in RPG Maker MZ, please let me know!
Thank you for reading!
That would require a plugin, so I'm moving this thread.

I've moved this thread to JS Plugin Requests. Thank you.

a plugin is probably the best way, but it can also be done without if you start at the other end.

first, define twelve variables as "last skill used by monster/actor index#".
then in every skill you add code to set the user's variable to the skill ID before executing the damage formula.
after that you can check these variables when the other skill is used.

the problem here is that the code to identify the skill user and reference a variable is rather complex. It can be done but it is usually easier to have a plugin add a variable to battlers and automate everything.
Maybe creating a skill with a common effect. Using if statements that indicate that if enemy using x skill, actor uses x skill. But like stated it can get messy fast depending how many skills you have.
You also try out mv plugin for materia to see if it works. If it does, one of the functions on there might help with the issue. Like the counter materia can be adjusted to counter with same skill used

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-sketch-skill-from-pokemon-in-rpg-maker-mz.135990/