Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Found an issue, not sure what causes it, but it goes away when I turn off the Press Turn script.

I'm trying to make a skill that triggers a special effect if the target isn't guarding,

Using (target.isGuard()) in a notetag triggers the effect, but for some reason this variable always returns false when I attempt it with Press Turn active. Any idea what could be causing that?

(+1)

Any clue about this? It definitely seems to be something with Press Turn because the attack works fine when I disable Press Turn

I'll look into it. Maybe not soon but eventually. 

I've looked into it. I'm sorry but I haven't gotten a clue. Why would you put target.isGuard() in a note, though?

(+1)

I'm making a skill that triggers a secondary effect if the target isn't guarding. I tried checking for the guard state but that *also* doesn't seem to do anything with this plugin active.

This is all with Yanfly's main plugins, right? You're a coder, too, right? If so, please try to find the problem by yourself, too. My plugin is open-sourced and for this type of reason, too. 

(+1)

Doing some debugging and I think the issue might lie with YEP Battle Core, but I'm not sure what, I tried disabling every plugin except for it and I noticed guarding doesn't expire with it active. I don't know why that would cause a secondary issue when combined with your plugin, but I'm willing to bet that's the cause.

(+1)

So I think the issue is that "PressTurnBattleSystem_removeStatesAuto.call(battler, 2);" is in the wrong location, it's being removed before the enemy move, when it should be called at the beginning of the player turn. I'm trying to find the best place to put it, but I have the skill working aside from the fact that the guard doesn't get removed after the turn starts.

Okay, I managed to fix it! Want me to include the code here so future versions can include it? It changes the Guard status to be removed at the beginning of the next allied turn instead of at the end of the allied turn.

I see that you are indeed a fellow programmer! Yes, please include the code. Thanks!

(+1)

Code to remove guard from allies at the beginning of allied turn (replaces same function)

BattleManager.MakeAllyTurns = function () {
    for (const battler of $gameTroop.members().concat($gameParty.members())) {
        battler.removeState(2);
    }
    pressTurnBattle.allyBattlersTurns = $gameParty.aliveMembers().length - stunnedAlies();
    pressTurnBattle.allyBattlersTurnsCheck = pressTurnBattle.allyBattlersTurns;
    if (pressTurnParams.BasedOnAmountOfTeamsMembers === "true") {
        pressTurnBattle.allyBattlersTurnsMax = pressTurnBattle.allyBattlersTurns * Number(pressTurnParams.MaxTurnsPerBattler);
    }
    else pressTurnBattle.allyBattlersTurnsMax = Number(pressTurnParams.MaxTeamsTurns);
}


and then to remove the guard status if they use another skill i added to the startaction function


var BattleManager_startAction_Mine = BattleManager.startAction;
BattleManager.startAction = function () {
    BattleManager_startAction_Mine.call(this);
    if(this._action.item().skillId != $dataSkills[this._action.subject().guardSkillId()]){
       this._action.subject().removeState(2);
    }
    if(!this._action.item().note.includes("<Don't lose turn>")) { pressTurnBattle.turnIndex++;}
    if (pressTurnBattle.alliesTurns){
    if(!this._action.item().note.includes("<Don't skip turn>")) {
        pressTurnBattle.allyBattlersTurns--;
        pressTurnBattle.gainedTurn = false;
    }
    if (pressTurnBattle.turnIndex === $gameParty.aliveMembers().length){ pressTurnBattle.turnIndex = 0;}
    BattleManager.drawPressIcons();
}
    else {
        pressTurnBattle.enemyBattlersTurns--;
        if (pressTurnBattle.turnIndex === $gameTroop.aliveMembers().length) pressTurnBattle.turnIndex = 0;
    }
}