Turn Based Conditions De-sync Through Stun

Status
Not open for further replies.

Filly Breeze

Villager
Member
Joined
Aug 4, 2017
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
I think this may sound complicated, but I'm running a battle that sets states that will change the attack pattern of the troops. It's set so that every 3 turns, the enemies will be given the New Attack state, (in this case, Fire) and then the following turn of every 3rd turn, the state will be removed. If I run it normally, it works as intended. They'll always use Fire every 3rd turn, and only every 3rd turn.

Here's the problem. The enemies also have a Stun attack, which will make my characters unable to move for 1 turn. When that happens, it completely desyncs the pattern of the turn conditions. For example, the enemies will start using Fire on the 3rd and 4th turn. 5th turn, they'll use their normal attacks, 6th, 7th, and 8th turn they'll use Fire, and so on with that kind of desync.

The reason I use states is because the attack pattern will only be applied on specific formations. I don't really wanna remove their Stun attacks because I plan to use patterns like these in the future. I get the feeling it's a problem with how the Battle Engine registers each turn, but I have no idea what. Anyone know how to fix that issue?

For reference, I am using Yanfly's Battle Engine v1.22 and Core Engine v1.09.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Its probably deeper than just the stun attack. Yanfly Battle Core has a known issue in that it doesn't count turns right due to when it counts when the turn begins. Try giving a boss attacks to do on turn 1, then a new attack on turn 2, and a new attack on turn 3, then count what turn you really are on. You'll probably only see the attack on turn 2 and attack on turn 3.

I don't remember how to fix it though off the top of my head. May post more in a minute.
 

Filly Breeze

Villager
Member
Joined
Aug 4, 2017
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
I tested the battle with a state that protects from Stun to see how the pattern works. Without Stun being a problem, the enemies consistently use Fire on every 3rd turn. So turn 3, turn 6, turn 9, and so on.

I also tested it by applying a permanent Stun, aka Paralysis, at the start of the battle to see how the pattern goes if the player is unable to act. This desyncs the condition for whatever reason. It plays the first turn condition on the 3rd turn, then the second turn condition on the 5th, then plays the first condition on the 6th turn again, then second condition on the 8th, repeating that pattern. Basically, the enemies use Fire on the 3rd and 4th turn, then use normal attacks on the 5th turn.

Here's how the 2 conditions look right now to make that attack pattern:

 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Here is the fix for the turn count problem that I use.
Code:
#By default, enemy actions are determined at the start
#of the round but before the turn counter is increased.
#This means that any monster's turn-specific actions
#actually execute one turn late, so actions set to
#happen on round 1 won't happen until round 2.
#This snippet fixes that. Needs YBE fix as well
#credit Lone Wolf
module BattleManager
  def self.input_start
    if @phase != :input
      @phase = :input
      $game_troop.increase_turn
      $game_party.make_actions
      $game_troop.make_actions
      clear_actor
    end
    return !@surprise && $game_party.inputable?
  end
  def self.turn_start
    @phase = :turn
    clear_actor
    make_action_orders
  end
end
 

Filly Breeze

Villager
Member
Joined
Aug 4, 2017
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Here is the fix for the turn count problem that I use.
Code:
#By default, enemy actions are determined at the start
#of the round but before the turn counter is increased.
#This means that any monster's turn-specific actions
#actually execute one turn late, so actions set to
#happen on round 1 won't happen until round 2.
#This snippet fixes that. Needs YBE fix as well
#credit Lone Wolf
module BattleManager
  def self.input_start
    if @phase != :input
      @phase = :input
      $game_troop.increase_turn
      $game_party.make_actions
      $game_troop.make_actions
      clear_actor
    end
    return !@surprise && $game_party.inputable?
  end
  def self.turn_start
    @phase = :turn
    clear_actor
    make_action_orders
  end
end

What is YBE Fix?

I tried putting the code you gave me in the Materials and now the turn system is completely broken. After the first turn, all actions are skipped, even the ones the players execute without any battle conditions.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Sorry, forgot about the other fix as well.

First off, though, the snippet I already gave you needs to be above all Yanfly's battle scripts in order to work.
Then somewhere underneath the Battle Engine, you need this second snippet.
Code:
#Fixes the bug on when turns are updated
#This should mean that skill ratings and
#turn settings work more accurately.
#This snippet is for Yanfly's Battle Engine
#It must be inserted below YBE. Needs main
#fix as well.
#Credit Lone Wolf for the original and
#bgillisp for his correction to it.
module BattleManager
 
  def self.input_start
    if @phase != :input
      @phase = :input
      $game_troop.increase_turn
      $game_party.make_actions
      $game_troop.make_actions
      clear_actor
    end
    
    return !@surprise && $game_party.inputable?
  end

  def self.turn_start
    @phase = :turn
    clear_actor
    @performed_battlers = []
    make_action_orders
  end

end
 

Filly Breeze

Villager
Member
Joined
Aug 4, 2017
Messages
5
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Okay... this is odd. So I tried doing what you said and placed the first snippet above the Battle Engine (Top of the Materials Section) and the second snippet below the Battle Engine. (Bottom of the Materials)

That didn't seem to change anything. The desync issue I already had is still present. I tried removing the second snippet entirely, and what that did was very odd. It reversed the desync issue. When players are unable to move, the turn count registers normally. Enemies are using Fire on the 3rd turn as expected. But when the players ARE able to move normally, it desyncs the turn count. Enemies use Fire on 3rd and 4th turn, then use normal attacks on the 5th.

Not sure if I did something wrong there. What I'm looking for now is to just make it so that the turn numbers stay in sync when the character is able to act and not able to act.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Using a pirated version of the engine will always introduce weird problems.

[mod]Closing[/mod]
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,990
Members
137,562
Latest member
tamedeathman
Top