Is there a way to make enemy record inputs?

I want to mix up combat a little by having a sort of parry system. If you use the same move 3 times in a row the enemy will parry it as you've gotten predictable. I wanted to do something like this for individual moves too, say you've been using your super strong move, the first time it hits, the second time it hits, but the third time the enemy has gotten familiar with it and they have a chance to dodge it or something.

Essentially what I'm saying is I want to know if there is a way to have a sort of memory box for an enemy (specific enemies) that places player inputs in it, if 3 of the same are in a row it triggers a variable or event, same if 3 inputs marked with being strong or something. I have no knowledge of programming or coding so I'm not sure if this is like a very complex thing.

To go further into detail this is supposed to be for single one on one encounters as I thought that recording inputs from up to 4 different party members would be very complicated.

to provide a further example of how I'm thinking this will work from a non coding mind:
the battle starts, it's one on one, this enemy has a secret memory box.
your first attack is recorded, your second attack is recorded, if you select the input a third time a flag or event triggers causing an event to happen, this can be skipped if you just select a different input.

If someone can help out that'd be very cool. If not it'll have to make due with workshopping something else.

If I can achieve this through a plug-in that's great too!
Suppose you could use action sequencing and have a variable for each move, then a conditional branch within the sequence that let's the attack miss on the third use. Have other moves reset the variables for all other moves.

Probably also possible with states somehow or something, but this is what I got on top of my head.
You could do this with applying and stacking states to an enemy every time you attacked, but you'd have to have a state for every attack.
You could do it pretty easily with Yanfly's Buffs and States Core and Auto Passive States - only requires one state in the database.

You put that state on all of your enemies as a passive state, then give it these notetags:
Code:
<Custom React Effect>
if (this.isSkill())
{
// Initialize the tracking of hits and skill it was last hit by, if necessary
    target.skillsHit = target.skillsHit || [];
    target.lastHit = target.lastHit || 0;
// Initialize tracking of this skill if necessary
    target.skillsHit[this.item().id] = target.skillsHit[this.item().id] || 0;
// Add another hit to this skill
    target.skillsHit[this.item().id]++;
// If this skill is not the same as the last skill the enemy was hit by, clear the hits of the last skill
    if (target.lastHit != this.item().id)
        target.skillsHit[target.lastHit] = 0;
// Otherwise, if this is the third time in a row hitting the enemy with this skill, make it do no damage
    else if (target.skillsHit[this.item().id] == 3)
        value = 0;
// Store this as the last skill the enemy was hit by
    target.lastHit = this.item().id;
}
</Custom React Effect>

This is the most simplistic version of what you described, where the third hit in a row from the same thing will do no damage. If you want it to do something different, call an event or something, then the last line of code would get modified.
You could do it pretty easily with Yanfly's Buffs and States Core and Auto Passive States - only requires one state in the database.

You put that state on all of your enemies as a passive state, then give it these notetags:
Code:
<Custom React Effect>
if (this.isSkill())
{
// Initialize the tracking of hits and skill it was last hit by, if necessary
    target.skillsHit = target.skillsHit || [];
    target.lastHit = target.lastHit || 0;
// Initialize tracking of this skill if necessary
    target.skillsHit[this.item().id] = target.skillsHit[this.item().id] || 0;
// Add another hit to this skill
    target.skillsHit[this.item().id]++;
// If this skill is not the same as the last skill the enemy was hit by, clear the hits of the last skill
    if (target.lastHit != this.item().id)
        target.skillsHit[target.lastHit] = 0;
// Otherwise, if this is the third time in a row hitting the enemy with this skill, make it do no damage
    else if (target.skillsHit[this.item().id] == 3)
        value = 0;
// Store this as the last skill the enemy was hit by
    target.lastHit = this.item().id;
}
</Custom React Effect>

This is the most simplistic version of what you described, where the third hit in a row from the same thing will do no damage. If you want it to do something different, call an event or something, then the last line of code would get modified.
You could do this with applying and stacking states to an enemy every time you attacked, but you'd have to have a state for every attack.
Suppose you could use action sequencing and have a variable for each move, then a conditional branch within the sequence that let's the attack miss on the third use. Have other moves reset the variables for all other moves.

Probably also possible with states somehow or something, but this is what I got on top of my head.
Wow!, Yall replied much faster than I thought! I thought I'd have to wait a day or something before I got a reply here.

I'm gonna test out your methods tomorrow, I'm glad to see the RPGM community is way more active than I thought!

You could do it pretty easily with Yanfly's Buffs and States Core and Auto Passive States - only requires one state in the database.

You put that state on all of your enemies as a passive state, then give it these notetags:
Code:
<Custom React Effect>
if (this.isSkill())
{
// Initialize the tracking of hits and skill it was last hit by, if necessary
    target.skillsHit = target.skillsHit || [];
    target.lastHit = target.lastHit || 0;
// Initialize tracking of this skill if necessary
    target.skillsHit[this.item().id] = target.skillsHit[this.item().id] || 0;
// Add another hit to this skill
    target.skillsHit[this.item().id]++;
// If this skill is not the same as the last skill the enemy was hit by, clear the hits of the last skill
    if (target.lastHit != this.item().id)
        target.skillsHit[target.lastHit] = 0;
// Otherwise, if this is the third time in a row hitting the enemy with this skill, make it do no damage
    else if (target.skillsHit[this.item().id] == 3)
        value = 0;
// Store this as the last skill the enemy was hit by
    target.lastHit = this.item().id;
}
</Custom React Effect>

This is the most simplistic version of what you described, where the third hit in a row from the same thing will do no damage. If you want it to do something different, call an event or something, then the last line of code would get modified.
Yes, in it's most basic state I'd like it just to work as a sort dodge, but ideally I could work up from that adding a trigger for events would spice things say you customize it per enemy.

Thanks a bunch I'll be sure to test it out and prod around after college tomorrow!
You could do it pretty easily with Yanfly's Buffs and States Core and Auto Passive States - only requires one state in the database.

You put that state on all of your enemies as a passive state, then give it these notetags:
Code:
<Custom React Effect>
if (this.isSkill())
{
// Initialize the tracking of hits and skill it was last hit by, if necessary
    target.skillsHit = target.skillsHit || [];
    target.lastHit = target.lastHit || 0;
// Initialize tracking of this skill if necessary
    target.skillsHit[this.item().id] = target.skillsHit[this.item().id] || 0;
// Add another hit to this skill
    target.skillsHit[this.item().id]++;
// If this skill is not the same as the last skill the enemy was hit by, clear the hits of the last skill
    if (target.lastHit != this.item().id)
        target.skillsHit[target.lastHit] = 0;
// Otherwise, if this is the third time in a row hitting the enemy with this skill, make it do no damage
    else if (target.skillsHit[this.item().id] == 3)
        value = 0;
// Store this as the last skill the enemy was hit by
    target.lastHit = this.item().id;
}
</Custom React Effect>

This is the most simplistic version of what you described, where the third hit in a row from the same thing will do no damage. If you want it to do something different, call an event or something, then the last line of code would get modified.
It works perfectly! It seemed to have a hiccup the first time I tried it where it parried on the second hit after the switch up of moves but it hasn't happened again. I may just have a case of I forgot or something tho.

Ideally I want to have it play an effect and some text after a parry, but I assume that can just come from playing an event which I don't really know how to do and I don't have the time to poke around right now (it's late) I plan to be able to configure how many hits it takes for enemies to parry too. (little gobbo might take 5 hits to parry than the demon lord and such)

Lastly I want enemies to be able to target specific skills individually as in say record how many times any skill has been used regardless of their order of action.
EX: Spark > Spark > Punch > Punch > Kick > Spark (Parried) > Punch (Parried)

Thank you very much tho!
Ideally I want to have it play an effect and some text after a parry
Look at the pinned thread with script calls for MV and find the code to do the things. Or Google "rpg maker mv blah blah script call" and find threads with the code posted.

If you want more than one thing to be done on the "parry," you'll need to enclose the multiple commands in braces { }

I plan to be able to configure how many hits it takes for enemies to parry too.
Then you just make multiple versions of the state with different numbers in the conditional.

Lastly I want enemies to be able to target specific skills individually as in say record how many times any skill has been used regardless of their order of action.
I mean...you can, but that's not how you described your request in the first place, or I would've given you that code.
If you use the same move 3 times in a row
...
your first attack is recorded, your second attack is recorded, if you select the input a third time a flag or event triggers

But I documented every line of the code I gave you, so just delete the part that sets the tracking to 0 if it's a different skill from last time.

Code:
// If this is the third time EVER hitting the enemy with this skill, make it do no damage
    if (target.skillsHit[this.item().id] == 3)
        value = 0;

And then you could delete all of the lines pertaining to lastHit if it's no longer how you want the state to want.
Look at the pinned thread with script calls for MV and find the code to do the things. Or Google "rpg maker mv blah blah script call" and find threads with the code posted.

If you want more than one thing to be done on the "parry," you'll need to enclose the multiple commands in braces { }
Alright I will!

I mean...you can, but that's not how you described your request in the first place, or I would've given you that code.
100% correct, I wanted to make sure something like this was even possible so I only described the most simple one I could think of.

But I documented every line of the code I gave you, so just delete the part that sets the tracking to 0 if it's a different skill from last time.
Yes, and I’m very thankful for that!

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-make-enemy-record-inputs.171855/