In battle dialogue only after attacking.

I've been messing with common events and skills all day so i figured i'd enlist some of your help. I'm trying to make it so that a character will go through a script of dialogue but only when the character attacks. i dont want the story to progress if for example the player guards or waits a turn. Thanks in advance.
Add this to your damage formula and then use the switch X to trigger the dialogue using a troop event. It is not perfect as it will not trigger if you miss the attack, but it is the closest thing you can do without using scripts, at least as far as I know.
Code:
$game_switches[X]=true if a==$game_actors[Y]
IMPORTANT NOTICE
Damage should go AFTER that in the formula. If you put damage before that, the skill is no longer going to deal any damage.
Add this to your damage formula and then use the switch X to trigger the dialogue using a troop event. It is not perfect as it will not trigger if you miss the attack, but it is the closest thing you can do without using scripts, at least as far as I know.
Code:
$game_switches[X]=true if a==$game_actors[Y]
IMPORTANT NOTICE
Damage should go AFTER that in the formula. If you put damage before that, the skill is no longer going to deal any damage.

Thanks much! What is the Y variable meant to be used for?

EDIT:
Thanks much! What is the Y variable meant to be used for?

also (sorry for the double reply) could you show me how you would use this in the actual editor? I keep getting a syntax error that says "expecting $end", Thanks in advance.
It is not a variable, it represents the ID of your actor. I assumed that you only want it to happen when a certain actor attacks since you wrote using the singular form. If you want it to happen for any actor use
Code:
a.actor?
Instead of
Code:
a==$game_actors[X]

It is possible that you have to use the following notation:
Code:
if condition_goes_here; $game_switches[X] =  true; end; formula_goes_here

"condition" is one of the two mentioned above, just pick the most appropriate one.

centaur66, please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.


I've merged your two posts together this time. In the future, if you want to add something please use the 'Edit' button to do so.
It is not a variable, it represents the ID of your actor. I assumed that you only want it to happen when a certain actor attacks since you wrote using the singular form. If you want it to happen for any actor use
Code:
a.actor?
Instead of
Code:
a==$game_actors[X]

It is possible that you have to use the following notation:
Code:
if condition_goes_here; $game_switches[X] =  true; end; formula_goes_here

"condition" is one of the two mentioned above, just pick the most appropriate one.
This is the error message that comes up when i try to use it in battle. I'm not quite sure what to change, thanks again for your help.

NEVERMIND!! i just adjusted a few things, i didnt need the zeros before the x and y numbers. Thank you so much for your help.
If your query is fully resolved, please Report your post and ask for the thread to be closed. Mods might not see a post, but they will see a Report.

Original thread: https://forums.rpgmakerweb.com/threads/in-battle-dialogue-only-after-attacking.111494/