Checking the ID of the currently selected actor?

Hi there.
I'm currently making a small tweak to the critical damage formula that scales off the level of the currently attacking actor. But I cannot work out the script call for the life of me. The code is currently:
Code:
Math.floor((damage * 1.5) * Math.log($gameActors.actor(1).level) + 1 );
but that only scales off the level of the first actor's level. I've tried "this.actor().level" and so on but they don't seem to work.

What's the function I'm missing?
Are you directly editing a method in the original code, or is this being done through a plugin? If being done through a plugin, which one?
Are you directly editing a method in the original code, or is this being done through a plugin? If being done through a plugin, which one?
It's an edit of the original code but being done through a very small plugin.
As in I've just copied the applyCritical function and swapped the damage formula.
Ah, then you can just use 'this.subject()' to nab the current Actor.
Ah, then you can just use 'this.subject()' to nab the current Actor.
Hey that works perfectly.
Thanks for the help!
Also, if you only want that critical value to work for actors and not enemies -- because subject() also handles enemies, too -- use 'this._subjectActorId > 0' in the check.
Also, if you only want that critical value to work for actors and not enemies -- because subject() also handles enemies, too -- use 'this._subjectActorId > 0' in the check.
Duly noted. I noticed that when an enemy wiped out an entire party in one hit. Code has since been corrected. Thanks again for the help!

EDIT: For future reference, what are some other script calls I can use? A subjectActorId check doesn't appear to work with SumRndmDde's HUD maker.
To check if it's an actor, you can also use:
Code:
this.subject().isActor()
which will be true if it's an actor and false if it isn't.

It's exactly equivalent to the suggestion above, but is more clear if you look at it months from now to remember what it's doing.

EDIT: For future reference, what are some other script calls I can use?

One place to find all possible calls is https://kinoar.github.io/rmmv-doc-web

It can be confusing at first, especially if you haven't read documentation of that type before. The key is that you have to know what "this" actually is, which depends on context. There's more to it, but basically "this" is not a constant thing, it represents what the current object or context is.

In your example, "this" refers to a Game_Action. You could find this out by looking for the function you mentioned "applyCritical" and notice it's owned by Game_Action. Then in the documentation above go to the Game_Action page and you can see all the properties and methods you can use on "this" (it helps to know what a property and method is, of course).
One place to find all possible calls is https://kinoar.github.io/rmmv-doc-web

Thanks! I've since found the check I need and it's
Code:
BattleManager.actor().actorId()
if anybody else reading this thread wanted to know.

Original thread: https://forums.rpgmakerweb.com/threads/checking-the-id-of-the-currently-selected-actor.113003/