Checking actor on Yanfly's auto passive stats

Hey fellow makers,


If you're acquainted with Yanfly's auto-passive states, you know it's possible to define some conditions. But there's no one that checks for the actor whose passive state is being applied. It's possible to achieve the same effect by replicating the same passive state and to set these different (really the same) passive state to each actor. However, if i have like 8 actors and 10 passive states, that's 80 states just to differentiate each actor.


I don't know if i'm breaking a rule here by posting someone else's code, but if i am i apologize beforehand


DataManager.getPassiveConditionParam = function(string) {
    string = string.toUpperCase();
    var text = 'user.';
    if (['HP'].contains(string)) text += 'hp';
    if (['MP', 'SP'].contains(string)) text += 'mp';
    if (['TP'].contains(string)) text += 'tp';
    if (['ATK'].contains(string)) text += 'param(2)';
    if (['DEF'].contains(string)) text += 'param(3)';
    if (['MAT', 'INT'].contains(string)) text += 'param(4)';
    if (['MDF', 'RES'].contains(string)) text += 'param(5)';
    if (['AGI'].contains(string)) text += 'param(6)';
    if (['LUK'].contains(string)) text += 'param(7)';
    if (['MAX HP', 'MAXHP'].contains(string)) text += 'mhp';
    if (['MAX MP', 'MAX SP', 'MAXMP', 'MAXSP'].contains(string)) text += 'mmp';
    if (string.match(/VARIABLE[ ](\d+)/i)) {
      text = '$gameVariables.value(' + parseInt(RegExp.$1) + ')';
    }
    return text;
};




This code part is from the script (v 1.07) where it does the eval checking on custom conditions. I guess it's possible to add an actor checking in there but i'm still pretty newbie on rpg maker mv scripting.

Original thread: https://forums.rpgmakerweb.com/threads/checking-actor-on-yanflys-auto-passive-stats.63166/