enemies react to specific actions (namely, guarding)

Hello! New RPGMaker MV user here, have owned it for quite a while but didn't get around to making a game with it as an engine until recently, have been enjoying it a lot but ran into an issue.

I'm sure this is probably something that's been answered before but I couldn't quite figure out how to do it nor find answers on the subject, so apologies on that.

I want to include an action where if the player guards, the enemy simply doesn't attack, and instead says a specific line. To be more specific:

For this battle, the player can choose to either attack or guard. If they attack, I want the enemy to hit strongly enough to kill them instantly, punishing them for attacking ( for story reasons ). If they defend, I want the enemy to instead make a comment on this, and refrain from attacking entirely.

Is there a way to make this possible, or any tips for some sort of work around?

Thank you so much for taking the time to read this, and doubley so if you have any help or comments on the matter!
Could you turn on a switch or set a state with the attack skill, then if that switch is on or the enemy has that state, do a force action, or show the text otherwise?
I want to include an action where if the player guards, the enemy simply doesn't attack, and instead says a specific line.
For a full on AI change, that can be complicated, but this sounds like a 1v1 thing where the player only has two choices; Attack or Guard. One kind of hacky way to solve this is to instead base what the enemy does on how much HP they have. If they aren't missing any, then the player logically didn't attack.

For other things, you can 'build' a more complicated AI with a custom skill. Call it something like "Pondering", make it the only skill the enemy can use, and all that skill does is call a Common Event. In there, you can set up Conditional Branches. In this case, you can see if the player has the Guard State. If they do, a message pops up. Otherwise, you Force Action to make the enemy use a skill (even Attack!) that will kill them for their action.

Either way, actually checking if the player Attack'd is harder than checking for guarding. As Shaz pointed out, you'd want the Attack to trigger a switch or otherwise tell the game it happened.
You could probably do it using conditions such as if enemy HP is 100% attack, else use the talk/whatever ability.

1615498172362.png


Edit: Or for a cleaner approach, give the enemy one ability to act as a sort of stub that calls a common event. This common event checks the player for the guard state. If present, force action talk. else, force action attack

Original thread: https://forums.rpgmakerweb.com/threads/enemies-react-to-specific-actions-namely-guarding.134303/