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

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
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...:kaosigh:

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!
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
781
Reaction score
492
First Language
English
Primarily Uses
RMMV
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.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
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?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,447
Members
137,820
Latest member
georg09byron
Top