YEP Battle Engine: State/Buff turn counter won't go down.

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Had an issue with my game where turns/states won't expire themselves, and states like poison do not have any effect. After testing with various plugins both on and off, apparently, this is caused by YEP Battle engine.

I'm checking for compatibility, but has anyone encountered this problem? The plugin has been updated to 1.45.

Edit: It's not a compatibility issue, the plugin does this even if it's the only one turned on.
 
Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Off the top of my head I can think of three possible causes:

1: Using an ATB or CTB system (and maybe STB?) Those do turns in a different way and they might be messing with it. If you are using those can you let us know please?

2: Maybe states don't work right without the newest version of Buff/States Core? Maybe try adding that to your project and seeing what happens.

3: Yanfly messed up the math. We can't ignore that possibility as this happened in ACE with two of their scripts and never got fixed officially (I had to patch both of them to fix those bugs). I do recall their ACE Battle Core has the bug where the turn count was added improperly, messing up your troop patterns in some pretty severe ways. I think I had it go from turn 2 to turn 3 to turn 6 to turn 8 in 4 turns due to that bug until I found a patch for it.
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Not using ATB or CTB, and the plugin does this even if it's the only one turned on. So I don't think it's an issue with Buff/States core.

I'm not an advanced programer, but I have fixed plugins before so I'll take a look at the plugin and see if it handles states in an odd way.
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Perhaps the issue is in the core Javascript files? Glad to know I'm not the only one with this issue at least.

I'm off to bed since I need to be at work early tomorrow, so I'll see what I can do if something isn't resolved by tomorrow afternoon in my timezone.
 

Titanhex

Do-It-All
Veteran
Joined
Jan 3, 2013
Messages
577
Reaction score
216
First Language
English
Primarily Uses
N/A
I see you're also having the same issue.

Here's a copy of my project file, with the [audio] and folders deleted. Just add the default audio and img folder from a new project into it and you should be able to try it out.

The only plugin is "YEP Battle Engine Core" and this problem still happens with the addition of other plugins. [Such as Buffs & States Core]

I had my buddy download my file, and he said the states didn't go down on his end.
He created his own project folder, added the YEP Battle Engine Core to it, and said he didn't have the bug.
He then sent me the file, and the file was bugged after I got it.

So there's something odd being done to the file when it's ran on my computer, and it's irreversible.

Currently, it seems the "Cannot Move" restriction on states causes them not to be removed or change how many turns are on the state.

I was having the Poison bug earlier, but it doesn't seem to be happening anymore. So that's a plus.

Try it yourself, if you want to see it in action. Perhaps someone else can trouble shoot it and tell us what is causing this on our ends. Thanks.

Here are the steps I took to replicate it, though you may not have the same issues on your end:

1. Made a new Project file.
2. Put the YEP_BattleEngineCore into my plugin folder of JS folder.
3. Added the Plugin and turned it on.
4. Changed the Sleep state to 1 turn, unticked Remove by Damage, made sure Restriction was "Cannot Move".
5. Made it so I had a 100% chance to inflict Sleep on enemies with the Hero (or any other) class. (Or low chance for enemies to Sleep if you want)
6. Watch while enemies never have Sleep get removed and it stays on permanently. The turn counter for it to go down never goes down.

Here is some things I tried:
  1. Creating a new Project Folder.
  2. Clean Reinstall of RPG Maker MV, including uninstalling and deleting the "steamapps/RPG Maker MV" folder.
  3. Copying old JS files from Patch 1.5.2
  4. Copying a working project from someone else, only to have it break when I try it.
However, I implore you try these solutions on your own, incase you find a solution in these steps.[/audio]
 

Attachments

Last edited:

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Actually, I found a potential solution. Using an older version of the plugin.
As a standalone, a Yanfly Battle Core Engine 1.17 handles status effects fine. Unfortunately, it's not up to date enough to run other Yanfly plugins I need.

So if anyone has an archive of various versions of Yanfly's plugins, I would like to have access to something more recent.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Do you have your states set to actor's turn? If so then the problem is the actor doesn't get a turn due to the cannot move restriction. That's why it is not working. I'm not sure how to fix that short of use end of turn instead for your states.
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
Do you have your states set to actor's turn? If so then the problem is the actor doesn't get a turn due to the cannot move restriction. That's why it is not working. I'm not sure how to fix that short of use end of turn instead for your states.
Except that none of the states I'm using restrict movement.
And that I also mention it's also affecting states.
And that I also mentioned that it's causing states like poison to have no effect. :p
I don't think that is the problem.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Hmmm...check the end of turn code then. I know there is supposed to be code called to reduce the states set to end of turn by 1, odds are it is missing in the Core. May have to copy/paste the code from the original files and put it in the Yanfly Engine to fix it.
 

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
That was indeed the case. I found the source of the error.

The code in Version 1.45:

Game_Battler.prototype.onTurnEnd = function() {
this.clearResult();
if (BattleManager.isTurnBased()) {
this.regenerateAll();
} else if (BattleManager.isTickBased() && !BattleManager.isTurnEnd()) {
this.regenerateAll();
}
this.removeStatesAuto(2);
};

The code I replaced it with from Version 1.17:

Game_Battler.prototype.onTurnEnd = function() {
this.clearResult();
this.regenerateAll();
if (!BattleManager.timeBasedStates()) this.updateStateTurns();
if (!BattleManager.timeBasedBuffs()) this.updateBuffTurns();
this.removeStatesAuto(2);
};


And for now, it has fixed the problem. I'll wait to see if there are any unintended side effects before considering the case solved, but please try this out @Titanhex
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
From what little I know of JavaScript, it should work as long as you are not using a tick based system (ATB or CTB). No idea how come Yanfly left out the code to adjust state turns. Anyone know how to reach them so they get this fixed, as that is a pretty serious bug to creep in,
 

Titanhex

Do-It-All
Veteran
Joined
Jan 3, 2013
Messages
577
Reaction score
216
First Language
English
Primarily Uses
N/A
Yea that's a major bug. Unfortunately only Patreons can reach Yanfly. You would have to hope the Patreons let him know.

Also, that fix works, but only for Turn End. Action End is still bugged. But this at least gives me a work-around.

I am curious, why didn't you go with:

Code:
Game_Battler.prototype.onTurnEnd = function() {
    this.clearResult();
    if (BattleManager.isTurnBased()) {
      this.regenerateAll();
      this.updateBuffTurns();
      this.updateStateTurns();
    } else if (BattleManager.isTickBased() && !BattleManager.isTurnEnd()) {
      this.regenerateAll();
      this.updateBuffTurns();
      this.updateStateTurns();
    }
    this.removeStatesAuto(2);
};
It retains the functionality of the old code's ability to update turns while being inclusive of the new code. However it does count down tick based abilities at double rate.

There is a chance that Yanfly was relying on an old piece of 1.5.2 processing that was changed in 1.6.

I can see that these two pieces of code were included in the regenerateAll function.
Code:
      this.updateBuffTurns();
      this.updateStateTurns();
t's a mystery to me if this is related or not.

EDIT: Above ^
 
Last edited:

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
2,982
Reaction score
1,129
First Language
Yes
Primarily Uses
RM2k
I'm not an expert at coding, I just know the basics so I can make simple edits like above.
Code:
Game_Battler.prototype.onTurnEnd = function() {
    this.clearResult();
    if (BattleManager.isTurnBased()) {
      this.regenerateAll();
      this.updateBuffTurns();
      this.updateStateTurns();
    } else if (BattleManager.isTickBased() && !BattleManager.isTurnEnd()) {
      this.regenerateAll();
      this.updateBuffTurns();
      this.updateStateTurns();
    }
    this.removeStatesAuto(2);
};
Unfortently, this code you suggested doesn't work. However, removing the two lines mentioned in the regerateAll command does prevent turns from counting down by 2 with the 1.17 code, which I was just about to mention.
 

Titanhex

Do-It-All
Veteran
Joined
Jan 3, 2013
Messages
577
Reaction score
216
First Language
English
Primarily Uses
N/A
Yea my code is acting weird when I make edits, fixing itself in weird ways and doing odd things. The problem is fixed for On Turn States but still bugged for Action End States.
Tick based system set to true counts down states in the same way that On Turn states do.

That's currently what I'm looking at with my scripting fix attempts.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
@Titanhex : What I think you'll need to look at is the fact that if the state is set to action end and it is set to do not move, the engine sees it as they didn't get an action so it doesn't decrease the counter. Maybe see if there is a way to force it to still decrease the counter even if they don't get a turn?

Just an idea to look at, as I seem to recall hitting this issue in ACE too.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,086
Reaction score
1,507
First Language
EN
Primarily Uses
RMMZ
The latest version of Battle Engine Core seems to be working fine for me. Looks like it still calls state/buff turn updates from the regenerateAll method, so long as the "Timed States" parameter (intended for tick-based battle systems) is false. If it's set to true, I imagine that would cause the behaviour you're seeing. Maybe worth double-checking?
 

Titanhex

Do-It-All
Veteran
Joined
Jan 3, 2013
Messages
577
Reaction score
216
First Language
English
Primarily Uses
N/A
@caethyril
I can see that these two pieces of code were included in the regenerateAll function.
Code:
this.updateBuffTurns();
this.updateStateTurns();
We already addressed that it was indeed included in the regenerateAll() part, but that we still had the issue.

Have you fully updated your MV project to version 1.6?
You would have to either download the update, or update through Steam, (Actually, can you confirm which you use to update?) and then update your project with the 1.6 files by copying the js files from the base template to your project folder to replace them. (don't replace plugin settings js)

With that, I'm curious if anyone who is running these steps to duplicate, can you confirm whether you're using Steam or the stand-alone program? Perhaps it's related to that.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,086
Reaction score
1,507
First Language
EN
Primarily Uses
RMMZ
We already addressed that it was indeed included in the regenerateAll() part, but that we still had the issue.

Have you fully updated your MV project to version 1.6?
Ah, sorry, I missed that.

Yes, this was testing on a new 1.6 project. I updated via Steam by opting out of all "betas", created a new project, removed all plugins, added and enabled Yanfly's latest version of Battle Engine Core, added the attack state Poison +100% trait to bats, set Poison to expire after 1 turn at turn end, then saved the project. Then upon battle testing everything worked as you would expect, poison applying when the bats hit and being removed at the appropriate time. I've just re-tested with variations: 50% apply chance, a 2 turn duration, and action end removal timing...all combinations worked as expected.

For diagnostic purposes, since you say it happens even with only BEC in a 1.6 project, can you try loading this small plugin after BEC? Just save it as a .js file in your project's js/plugins folder. All it does is print a few pieces of data to the console, such as whether the game thinks the battle has reached turn end or not. Press F8 in-game to open the console.
Code:
if (!Imported.YEP_BattleEngineCore) throw new Error('Battle Engine Core not found!');

console.log('updateStateTurnTiming: ' + Game_BattlerBase.prototype.updateStateTurnTiming);

_Game_BattlerBase_updateStateTurnTiming = Game_BattlerBase.prototype.updateStateTurnTiming;
Game_BattlerBase.prototype.updateStateTurnTiming = function(timing) {
	console.log('updateStateTurnTiming...');
	console.log('Timing is: ' + timing, 'Is updateTurns being bypassed? ' + this.isBypassUpdateTurns());
	_Game_BattlerBase_updateStateTurnTiming.call(this, timing);
};

_Game_Battler_regenerateAll = Game_Battler.prototype.regenerateAll;
Game_Battler.prototype.regenerateAll = function() {
	console.log('regenerateAll...');
	console.log('Are states/buffs time-based? ' + BattleManager.timeBasedStates() + ' ' + BattleManager.timeBasedBuffs());
	_Game_Battler_regenerateAll.call(this);
};

_Game_Battler_onTurnEnd = Game_Battler.prototype.onTurnEnd;
Game_Battler.prototype.onTurnEnd = function() {
	console.log('onTurnEnd...');
	console.log('Not turn end? ' + !BattleManager.isTurnEnd());
	_Game_Battler_onTurnEnd.call(this);
};
Basically, if you see any red text (errors) or 'true' statements (should all be false) in the console during battle test, that's a red flag. =P

Two more questions, as well: what platform are you on (Windows, Mac, Linux?) and are you running any Moment-scoped troop events in your test projects?
 

Titanhex

Do-It-All
Veteran
Joined
Jan 3, 2013
Messages
577
Reaction score
216
First Language
English
Primarily Uses
N/A
@caethyril
Well, my issue is with the Cannot Move restriction. Cannot Move seems to be causing the issue for me.
Poison, however, does not cause me any issues.

I run Windows, and have no troop events at all.

I'll try to install this debug plugin. However, 1.6 somehow removed my developer console and I haven't been able to get it back.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

It's Saturday already. Last Saturday felt just like yesterday. o_o
I really need to stop adding more levels to this thing already...
My computer is now on the dead list. Parts and Services stopped two days ago for this type.
someone help my thread has been silent since the initial post I just wanna make a goddamn game
People3_6 and People3_7 added!

Forum statistics

Threads
105,842
Messages
1,016,909
Members
137,547
Latest member
OYeh
Top