MV Using "Origin" w/o using "Origin"...Possible?

Ok, I've been plagued w/ compatibility issues due to LTBS, so origin and stateOrigin(), which is from Yanfly's plugins, don't work for me. So I'm looking for an alternative to get the same functionality but w/o using origin. Is this possible? I really need this functionality, or else DoTs don't work, nor would utility scaling of any kind...😔

This is what I found in YEP_BuffsStatesCore.js:
JavaScript:
Game_BattlerBase.prototype.stateOrigin = function(stateId) {
    if (this._stateOrigin === undefined) this._stateOrigin = {};
    if (!this._stateOrigin[stateId]) return this;
    var arr = this._stateOrigin[stateId];
    if (arr[0] === 0) return $gameActors.actor(arr[1]);
    if (arr[0] === 1) return $gameTroop.members()[arr[1]];
    return this;
};

Game_BattlerBase.prototype.setStateOrigin = function(stateId, battler) {
    if (this._stateOrigin === undefined) this._stateOrigin = {};
    if (!$gameParty.inBattle()) return;
    if (!battler) {
      var battler = BattleManager._subject;
      if (!battler) return;
    }
    if (battler.isActor()) {
      var arr = [0, battler._actorId];
    } else {
      var arr = [1, battler.index()];
    }
    this._stateOrigin[stateId] = arr;
};

Game_BattlerBase.prototype.clearStateOrigin = function(stateId) {
    if (this._stateOrigin === undefined) this._stateOrigin = {};
    this._stateOrigin[stateId] = undefined;
};

Game_BattlerBase.prototype.clearEnemyStateOrigins = function() {
    var length = $dataStates.length;
    for (var i = 0; i < length; ++i) {
      if (this._stateOrigin === undefined) this._stateOrigin = {};
      if (this._stateOrigin[i] === undefined) continue;
      var data = this._stateOrigin[i];
      if (data[0] === 1) this.clearStateOrigin(i);
    }
};
What could be the reason for LTBS not acknowledging this block of code? I've already played w/ plugin order to no avail. That doesn't seem to be the issue anyway since all other functions of BuffStatesCore work fine. If I can't get LTBS to use Yanfly's origin stuff, I need an alternative to get the same functionality, whether it's by v[ ] or other means. Please let me know if you guys have any ideas, thx!
Since the origin is not defined, I'd say the problem is that the function to set the origin is never called.

If we look at BuffStatesCore, we can see that it should be set when a state is applied:

Code:
Yanfly.BSC.Game_Battler_addState = Game_Battler.prototype.addState;
Game_Battler.prototype.addState = function(stateId) {
    var addable = this.isStateAddable(stateId);
    Yanfly.BSC.Game_Battler_addState.call(this, stateId);
    if (addable) {
      this.setStateOrigin(stateId);
      this.addStateEffects(stateId);
    }
};
This code is an alias of the addState function, after it adds the state, it sets the origin. I'd say the problem is that LeTBS probably overwrites the addState function, instead of aliasing it, or aliases it without calling the alias, effectively ignoring any changes other plugins have made to it. To correct this, you'd have to search the plugin for Game_Battler.prototype.addState and see exactly what it's doing in there, and then combine that function with the above function from BSC.

Or maybe I'm wrong and the problem is actually the isStateAddable function messing up. You could try setting that to true instead of calling the function and see if that makes a difference too. I'd bet on the first one, though.
Oh, I think your right! At least that's what it seems like:
JavaScript:
Game_Interpreter.prototype.interpretLeTBS_AddState = function (args) {
    var entity = this.readEntityForLeTBS(args[0]);
    var id = Number(args[1]);
    if (entity && id) {
        entity.battler().addState(id);
        if (args.join().toLowerCase().includes("showpopup"))
            entity.addPopup();
    } else {
        return false;
    }
    return {};
};
Lol "addstate" only shows up twice in ~12k lines of code, while "stateadd" isn't found at all (non case-sensitive search).

Edit: I did find this in there though, which is at least part of "Game_Battler":
JavaScript:
Lecode.S_TBS.oldGameBattler_addNewState = Game_Battler.prototype.addNewState;
Game_Battler.prototype.addNewState = function (stateId) {
    Lecode.S_TBS.oldGameBattler_addNewState.call(this, stateId);
    if (LeUtilities.isScene("Scene_Battle") && Lecode.S_TBS.commandOn) {
        var state = $dataStates[stateId];
        var entity = BattleManagerTBS.getEntityByBattler(this);
        if (entity)
            entity.onNewState(state);
    }
};
Should I just stick the following onto it?
if (this.isStateAddable(stateId)) { this.setStateOrigin(stateId); this.addStateEffects(stateId); }
Or maybe just this.setStateOrigin(stateId); since the state's effects are already being applied?

Original thread: https://forums.rpgmakerweb.com/threads/using-origin-w-o-using-origin-possible.130252/