Game Freezing in Battle

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Welp, so begins a new project and so begins a new series of annoying bugs that make me regret ever considering Game Design as a hobby...

Today's tyrant? Freezing.

I've been trying to figure this out for the last few hours and I'm at a total loss. Essentially, my game keeps freezing during battle (but the music continues playing) and so far it seems to be when a status effect is applied (either to an enemy OR ally) or an enemy is killed by an ability that targets "3 random enemies".

I'm not sure if any of the above are specifically causing the bug because I have applied/received status effects and used multi-hit attacks numerous times without having the freeze occur. It just seems to suddenly decide that one of those things is a problem because the freeze always happens when one of those things occurs, but I counted over 10 times Poison was applied over the course of me playing before finally it froze the game. If it was the status itself I could understand, but the fact I've been poisoned tons of times, but only a select few actually freeze the game is what baffles me. It's not just poison either. I have a character who can inflict Paralysis and sometimes the game is frozen after they successfully do that, however they have also used it numerous times with no issue. Same with the '3 random enemies attacks'. Most times it works, other times the game will freeze after the final hit (though seemingly only if the enemy dies).

I've tried removing and re-ordering my scripts one at a time but none of them fixed the problem and no amount of Googling seems to hold an answer.

My scripts are (in order):
- MOG_Battle_Hud_EX
- No Junk Boxes (Don't Know Author)
- Yanfly Instant Cast
- MOG_Damage_Popup
- Yanfly_Message
- Party Selector (Peridot)
- Yanfly Anti-Fail
- Minimum Damage Script (Don't Know Author)

As I mentioned though I have already removed most if not all of these and tested the game and the issue still prevails. Every time I think I've found the rogue script because the game hasn't frozen in a while, the game will freeze to prove a point...

I'm at a point where I'm about ready to quit RPGMaker for good because I'm sick of these stupid out-of-nowhere glitches that I can't figure out. I've wasted 4 hours on this already that I could've been putting into anything else and honestly it's soul destroying. If anyone can shed any light on this at all it would be much appreciated.

Sorry for the depressing tone, I'm just really done with, well, everything right now.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Freezing during battle seems strangely familiar to me (not that it's happened to me, but I'm sure I've read a thread about it).

Turn off ALL of your scripts and play for long enough that you're confident the issue isn't happening. Then turn them on one by one, repeating the test play each time.

You've got a number of battle scripts there by different authors - could be that there's an incompatibility there that only shows up under certain circumstances (amount of damage, for example).
 

Psykai

Veteran
Veteran
Joined
Dec 8, 2017
Messages
104
Reaction score
4
First Language
English
Primarily Uses
RMVXA
Thanks for the response and sorry it took so long to reply!

The rogue script turned out to be one I forgot to list that makes enemies flash whilst selecting them. Apparently it's incompatible with a lot of stuff and causes games to freeze when enemies are killed out of ID order, which explains why it happened on my multi-hit attacks because they target random enemies.

I'm relieved it wasn't anything major but also annoyed because there's no way to tell which enemy you're selecting now and I'd really rather not use a battle cursor.

As a list ditch effort, I'll share the script and see if anyone can figure out why it's causing the game to freeze:
Code:
#==============================================================================
#    Flash Selected Enemy
#    Version: 1.0.0
#    Author: modern algebra (rmrk.net)
#    Date: July 18, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#   
#    This script will flash the battler of any enemy currently selected when
#   the player is targetting.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#   
#    Paste this script into its own slot in the Script Editor, above Main but
#   below Materials.
#
#    This script is designed to work with the DBS and may be incompatible with
#   other battle scripts.
#
#    This script is completely plug & play, and without modification the
#   selected enemy will whiten. If you want to change the colour to which it
#   flashes, the duration of the flash, or the time between flashes, then go to
#   the editable region starting at line 30 and change those three options.
#==============================================================================

$imported ||= {}
$imported[:"FlashSelectedEnemy 1.0.0"] = true

#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#    BEGIN Editable Region
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FSE_REST_FRAMES = 4        # Number of frames between flashes
FSE_FLASH_DURATION = 24    # Number of frames for each flash to complete
FSE_FLASH_COLOUR = [255,255,255] # Colour of the flash, format: [red, green, blue]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#    END Editable Region
#//////////////////////////////////////////////////////////////////////////////

#==============================================================================
# ** Sprite Battler
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - start_effect; update_effect
#    new method - update_fse_flash
#==============================================================================

class Sprite_Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_strteffct_7fk9 start_effect
  def start_effect(effect_type, *args, &block)
    if effect_type == :fse_flash
      @effect_duration = FSE_FLASH_DURATION
      @fse_flash_mod = 320 / FSE_FLASH_DURATION
      @battler_visible = true
    end
    ma_fse_strteffct_7fk9(effect_type, *args, &block)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Effect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_updeffct_9hv2 update_effect
  def update_effect(*args, &block)
    # If playing an FSE flash
    if @effect_duration > 0 && @effect_type == :fse_flash
      update_fse_flash
    end
    # Stop effect if set to stop
    if @battler.sprite_effect_type == :fse_revert_to_normal
      revert_to_normal
      @battler.sprite_effect_type = nil
    end
    ma_fse_updeffct_9hv2(*args, &block) # Run Original Method
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Flash
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_fse_flash
    self.color.set(*FSE_FLASH_COLOUR)
    if @effect_duration > (FSE_FLASH_DURATION / 2)
      self.color.alpha = (FSE_FLASH_DURATION - @effect_duration) * @fse_flash_mod
    else
      self.color.alpha = @effect_duration * @fse_flash_mod
    end
  end
end

#==============================================================================
# ** Scene_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - select_enemy_selection; update
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Enemy Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_strtenemyselect_3hk9 select_enemy_selection
  def select_enemy_selection(*args, &block)
    ma_fse_strtenemyselect_3hk9(*args, &block)
    @fse_effect_frames = FSE_FLASH_DURATION
    @fse_flash_frames = 0 # Initialize blink count
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Frame Update
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_fse_udat_8hz5 update
  def update(*args, &block)
    old_enemy = @enemy_window.active ? @enemy_window.enemy : nil
    ma_fse_udat_8hz5(*args, &block)
    if !@enemy_window.active || old_enemy != @enemy_window.enemy # If cursor moves
      # Set the flash to the newly selected enemy
      old_enemy.sprite_effect_type = :fse_revert_to_normal if old_enemy && !old_enemy.dead?
      @fse_flash_frames = 0
    end
    if @enemy_window.active
      if @fse_flash_frames <= 0
        @fse_flash_frames = @fse_effect_frames + FSE_REST_FRAMES
        @enemy_window.enemy.sprite_effect_type = :fse_flash
      end
      @fse_flash_frames -= 1
    end
  end
end
If not, could anyone suggest a script that would perform the same function? It would be much appreciated.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,111
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
you should post a link to the original script rather than pasting it into your post.

I can't see anything in there that would make it incompatible with anything at all. Unless you have another script that overwrites some of those methods rather than aliasing them. It does look at the enemy window, so if you have a script that lets you select enemies via the battle scene rather than in a window, they might be incompatible.

Modern Algebra is still around - why don't you send him a pm and ask if there's a newer version?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,261
First Language
English
Primarily Uses
RMVXA
You also got some Mog and Yanfly battle scripts together. Those traditionally do not work together, as they overwrite the same function. You will probably have to either go all Mog or all Yanfly scripts for your battle system for it to work well.
 

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

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,048
Messages
1,018,543
Members
137,834
Latest member
EverNoir
Top