How do i activate a Common Event when an actor manages to land a critical hit?

The idea is pretty simple, Activating a common event when a party member does critical hit damage to the enemy.

And also the opposite: Activating a different common event when an ENEMY does critical hit damage to a party member.

i'm struggling with this and i have no idea how to code

(My idea is that when an crit happens, it will have the chance to show an animation and a gab window which i think is pretty cool.)

Btw if there is an alternative to it that triggers another common event with an WEAKNESS damage i would also like to know
AS.png


action effect
if target.result().critical
common event: x
View attachment 297048

action effect
if target.result().critical
common event: x
I really appreciate the help, this kinda works... but you see:

The game has skills that can be used by both enemies and actors, and i need to specify WHO got crit'd
so if i use "common event: x" on crit, which shows a gab window, then it would be the same message for actors and enemies and it will just not fit right.

so yeah...

User crits enemy = Common Event A
Enemy crits user = Common Event B
Just put another check for the target then. I'm working with names in my game:

action effect
if (target.name() === 'Name')
if target.result().critical
common event: x

Now this gets more complicated if you want a code that just works off of enemies and actors alike since the enemies are different everytime. There may be an eval you could potentially use, but that's above my paygrade I'm afraid.
Just put another check for the target then. I'm working with names in my game:

action effect
if (target.name() === 'Name')
if target.result().critical
common event: x

Now this gets more complicated if you want a code that just works off of enemies and actors alike since the enemies are different everytime. There may be an eval you could potentially use, but that's above my paygrade I'm afraid.

I think i understand! This could work, but i don't know the objects, so in this case what would be the alternative in action sequence of

"if target has this name" ( if (target.name() === 'Name'))

for "if target is a partymember"?

i think that'll fix the problem 100%
user.isActor() and user.isEnemy() can be used to determine what kind of battler the user of the skill is
I would honestly just copy the skill and use the copy for the enemies only. That way each can have their own checks. But as I said, This scripting stuff is above my paygrade. There are plenty people here who know better tho.

Perhaps @ATT_Turan can help out.
You can make separate skills for actor and enemy and eliminate the need to action sequence the entire thing - just stick one Skill Core notetag in there.

Or you can do what Robro said:
Code:
if user.isActor()
    stuff for a common event
else
    stuff for the enemy common event
end
You can make separate skills for actor and enemy and eliminate the need to action sequence the entire thing - just stick one Skill Core notetag in there.

Or you can do what Robro said:
Code:
if user.isActor()
    stuff for a common event
else
    stuff for the enemy common event
end
This.

This Worked.

And it's perfect. Thank you all, i have no requests left.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-activate-a-common-event-when-an-actor-manages-to-land-a-critical-hit.166389/