Check for Actor ID when using a skill

I've been scouring the threads and can't seem to find an answer for this.
It feels simple, and maybe I'm missing something obvious.

What I want to know is how to check for which Actor is currently casting the current skill (Any Skill).

Preferably, I'd like to know how to save an Actor ID who casts a skill to a variable.

Thanks!
that depends on when you want to check that, and which battlesystem (if not default) you're using.

The problem you're overloking is that "skill use" in itself can happen in several different context options, and if it is in battle then the timing is especially important. some solutions for example only work when the skills hit a target, not when it misses and so on.

So please tell us more as for what mechanic you want to use this info, and we will tell you if what you're planning is possible by default, with simple javascript code or only by a special plugin written exactly for this.
I believe you could do this in the damage formula:

$gameVariables.setValue(variableId, a._actorId); normal damage formula here

Replace variableId with the variable you want to set. Important to note is that Enemies don't have Actor IDs, so you will need more complex Javascript if you are trying to do this in a skill that can be used by Enemies.

I believe that should work, but if it doesn't, we may need to move your thread over to Learning Javascript to get you the right code line. Just @ me in your post so I can do it for you.
@Wavelength the damage formula is only executed when the skill hits, not if it misses.
That is the reason why I asked for more info about this instead of just giving that solution as it doesn't work under all conditions.
@Wavelength the damage formula is only executed when the skill hits, not if it misses.
That is the reason why I asked for more info about this instead of just giving that solution as it doesn't work under all conditions.
Very good point. There could be situations you'd still want to store the info even if the skill doesn't connect.

One possible solution to that would be using a <Before Eval> notetag with Yanfly's Skill Core Plugin installed. You can then place the code I gave you inside that notetag, except that you will need to write user._actorId instead of a._actorId .

@Oats I recommend giving us more info about where you want to use this skill, and how you want to use this Actor ID information, as @Andar requested, as any given solution we recommend might or might not work for your specific needs.
Holy crap! I was missing the "enter into NoteTag" part of the equation with Yanfly's Skill Core Plugin.
Well, also I was not sure which variable had the Actor ID.
I did a quick test, and it seems to be working!

I used the Skill Core Plugin <Before Eval> Tags and the damage formula with user._actorid

Thanks @Wavelength, and Thanks @Andar for pointing out my missing info.
I should have put that in.

Basically I wanted to check the user of the skill in battle, regardless of hit or miss.
The purpose is to throw up a picture on screen which is dependent on the user of the skill.

Oats
One other question regarding the <Before Eval> Tags
Am I correct in understanding that any code within these tags should run before the spell is cast?
I tried to put in a Common Event and it appears to be running after the skill animation and skill is applied.
Am I missing something? Here's is my code:

Spoiler: Code:
<Before Eval>

$gameVariables.setValue(141, user._actorId);

$gameTemp.reserveCommonEvent(248);

</Before Eval>

Thanks,
Oats
reserveCommonEvent(248);
see that command?
You do not run the common event, you put it in a stack ("reserve processing for it") to be run when the engine has time and sequence to check for common events.
And by default, all common events activated by skills are run at the end of the turn, no matter when you activate them.

By default there is no way around that, but I think yanfly added a command to specify when a common event is to be run inside an action sequence. please check his documentation for that.
I more or less got it working but I am now using Yanfly's Battle engine core and Action Pack Sequences
I'm using the <setup action> tags to get the Variable and Common event running before the skill animation.
But now the Skill message is not coming up. Is it automatically removed when using the Battle Core Plugins?
I can't find a way to put it back, or even how to add a message through the plugin.

Here's the code in the NoteTag:
Spoiler: Code
<setup action>
eval: $gameVariables.setValue(141, user._actorId);
eval: $gameTemp.reserveCommonEvent(248);
</setup action>

Oats

Original thread: https://forums.rpgmakerweb.com/threads/check-for-actor-id-when-using-a-skill.111182/