Script to check if User of a skill is an actor

I want a skill to have a different effect if the user is actor. I used the script ''a.isActor()'' in my common even but it is not
working.

Does someone know how to solve this?

Thanks
I'm not sure what you're asking. But if that's what I'm thinking, it's pretty interesting.
It would be in the case to verify if it is an enemy in the battle or one of the party members.

If you only need the command it is possible, but changing the skill according to this condition is more complex.

The question has already been answered a few times:

But the example below explains how to use "Condition" in the formula:
(a._actorId)?/*Actor Action*/:/*Enemy Action*/;

Cure Skill - Example:
JavaScript:
(a._actorId)?alert("Actor"):alert("Enymy");200 + a.mat

And please, if you need to go to the @Wavelength post and like it. 🙂 👍
It will demonstrate that even after some time his support still helped someone else.

Good luck
So if I want the skill to give an item to my party when the actor uses the skill and i DON'T want the skill to give an item when the enemy uses it, i should write the skill forumla like this?

(a._actorId)? $gameSwitches.setValue([30], true):$gameSwitches.setValue([30], false);200 + a.mat

If the user of the skill is an actor, it will trigger a switch that allows the common event of the skill to give an item, if it is an enemy, nothing happens.


Edit: It seems to work in the formula but when I try to use it in a condition branch, it doesn,t work
You can carry out the common event directly:
JavaScript:
if(a._actorId){$gameTemp.reserveCommonEvent(1)}200 + a.mat

Or itemGain:
$gameParty.gainItem($dataItems[itemId], n);

Example, gain 99 potions:
JavaScript:
if(a._actorId){$gameParty.gainItem($dataItems[5], 99)}200 + a.mat

Edit:
Edit: It seems to work in the formula but when I try to use it in a condition branch, it doesn,t work

This a is a local variable, that is, it belongs to the Javascript "function" in file rpg_objects.js:
JavaScript:
Game_Action.prototype.evalDamageFormula = function(target) {
    try {
        var item = this.item();
        var a = this.subject(); //Here
        var b = target;
        var v = $gameVariables._data;
        var sign = ([3, 4].contains(item.damage.type) ? -1 : 1);
        var value = Math.max(eval(item.damage.formula), 0) * sign;
        if (isNaN(value)) value = 0;
        return value;
    } catch (e) {
        return 0;
    }
};

Tip: hover your mouse cursor over the field and a brief explanation with examples will appear:
RMMV_Tip-Formula.png
Thank you, my problem is solved now!

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/script-to-check-if-user-of-a-skill-is-an-actor.141045/