MV Help with a new Counter Skill

I will explain it as a player not as a developer.
The user launches a barrier on allies that reduces damage to X element. but if in that same turn they are hit by an ability of that element, the actor who cast that ability counterattacks the enemy that used the ability of element X.

Everything is perfect but I don't know how to take the index of the opponent who used the ability, does anyone know how to achieve this?
using any plugins?
Yep battle Plugins, BuffStateCore, SkillCore, ElementCore,... and more, i found target.index and I managed to do it using States for.
so, you solved the issue?

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-new-counter-skill.133554/