How do I check, who get's hit by skill?

What I want to do basically, is if actor 1 hits monster with skill "attack" for example, it should increase Variable 1.

If Actor 2 hits the monster with skill "attack" it should increase Variable 2.

The same should be possible otherwise. If monster hits Actor 1 with "attack", Variable 3 should be increased.

Or if monster hits Actor 2 with "attack", Variable 3 should get increased. 

I guess you will get the point with these examples. Tried to use $game_actor[1] as conditional branch, but didn't worked.
Because actor 1 & 2 is in battle the same time, which makes it hard to seperate them.
It's not that the variables doesn't work, but both variables get increased, if one actor get's it, or an actor hits a monster. :/

Spoiler
The same way I did it with $game_actor[1], $game_actor[2].
I hope I don't want to do the impossible again. 😀 (\s/)
That has nothing to do with variables but with switches - and since it's an common event (probably attached to a skill), it gets called only at the end of the turn, not at the moment the skill is used.


You can either try to fix when which switch is triggered or most probably you'll have to move that code into the skill's damage formula box.
I actually had to do something similar for a game I'm working on now, and I managed to piece this much together from other threads.  It seems you can manipulate variables from right inside a skill's damage formula box, using semicolons to separate different things you're doing.  So, to raise a variable by one:

v[x] += 1; ACTUAL DAMAGE FORMULA HERE

This might not be quite what you need though, since it would trigger every time you attack, regardless of whether the attack actually hits.  Maybe someone else can finish this thought by showing how to make it conditional?  Depending on what the mechanic's end goal is, there might be a way to fill in the blanks with eventing.  Just offering what I can, here. :|
@Andar:
Thank you, it is actually enough, it get's counted after the battle ends. 😉
I somehow get the guess it will only be a 100% possible with scripts. :/
Because I really don't know how to write it, if a monster attacks actor 1 or 2. 
 

v[x] += 1; ACTUAL DAMAGE FORMULA HERE
I didn't even know that a semicolon seperates stuff in damage formular. 😳
I actually don't mind about hit or miss, it only should ask if it's performed at all. 😀

There is only one question still left, if a character performs an attack, I can simply make more then one attack, so the character specific variables get triggered.
But how will I do it, if a monster hits actor 1 or 2?
Because Actor 1 has variable 1, Actor 2 Variable 2. 😳 (\s/)
There is only one question still left, if a character performs an attack, I can simply make more then one attack, so the character specific variables get triggered.

But how will I do it, if a monster hits actor 1 or 2?

Because Actor 1 has variable 1, Actor 2 Variable 2. 😳 (\s/)
Hmm... I thought I had a solution for this, but it really is more complicated than it seems.  In the monster's skill, you could use:

v[x] = b.id;

This would set variable #x to the id of the skill's target (that being "b"), which should be the character that was attacked.  You could then increment different variables using conditional branches based on which id was recorded.  The problem is that, even though you could write out the code in the damage formula (if v[x] == 1; v[1] += 1; if v[x] == 2; v[2] +=1; AND SO ON....), you'd probably hit the 100-character-limit built into the formula box, let alone having room for the actual damage formula.  It also wouldn't work with AoE skills, but that issue is the same for actors.

I don't know, maybe you can figure something out with these ideas. 🤔
Thank you so very much, I will at least try to. 😀
And it gave me a lot of ideas actually, I will try them all out and will see what happen. 😉

If nothing works, well then, I need to use it as overall experience and the player needs to decide which character he/she want's to level up. 😀
I'm actually happy to try it out with the 2 character version, I wouldn't even want to think about, how complex it would be with the 36 character version. 😳 (\s/)

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-check-who-gets-hit-by-skill.42403/