I'm unsure whether to post this here or not, move it if i'm in the wrong section.
-The Script is using the default battle system-The script i want some help with is a script that wasn't made on this forum.
It is a script that breaks down an enemy battlers into four pictures and moves between them to make them animated.
The problem is that, this script seems to be causing some major lagg whenever you use events in the battles(Tint screen, animations, message winows) and the lagg becomes more intense depening on how many party members you have.
This is the script:
#==============================================================================
# ** Night_Runner's Animated Enemies.
#------------------------------------------------------------------------------
# History:
# Date Created: 29/Aug/10
# Created for: MarkHest
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=44674
#
# Description:
# This script is designed to animate the enemy battlers in the default
# RMXP battle system.
#
# How to Install:
# Copy this entire script, go into your game, along the top select Tools >>
# Script Editor. Along the left scroll to the bottom, right click on Main,
# and select insert. Paste this code in the window on the right.
#
# Customization:
# The enemy sprite will be split into 4 frames by default (as deined
# by line 37) and will stay on that frame for 20 frames by default
# (as defined by line 38).
#==============================================================================
#==============================================================================
# ** Scene_Battler
#------------------------------------------------------------------------------
# Edited to give enemies a animated battle stance.
#==============================================================================
class Sprite_Battler
#--------------------------------------------------------------------------
# * Invariables
#--------------------------------------------------------------------------
FRAMES = 4
FRAMES_PER_FRAME = 20
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias_method :nr_anime_update, :update unless $@
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update(*args)
# Run the original update
return_value = nr_anime_update(*args)
# If the enemy is a enemy
if @battler.is_a?(Game_Enemy)
# Check to see if the animation needs updating
if @nr_x.nil? or (@nr_x != (Graphics.frame_count.to_i % (FRAMES * FRAMES_PER_FRAME)) / FRAMES_PER_FRAME)
# Set the x offsef for the animation
@nr_x = (Graphics.frame_count.to_i % (FRAMES * FRAMES_PER_FRAME)) / FRAMES_PER_FRAME
# Get the original battler
src_bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
# Reset the dimension
@width = src_bitmap.width / FRAMES
self.ox = @width / 2
# Get a rectangle around the bitmap
src_rect = Rect.new(@nr_x * @width, 0, @width, src_bitmap.height)
# Transfer the bitmap to the self.bitmap
self.bitmap.clear
self.bitmap = Bitmap.new(@width, src_bitmap.height)
self.bitmap.blt(0, 0, src_bitmap, src_rect)
# Dispose the src_bitmap
src_bitmap.dispose
end
end
end
end
#==============================================================================
# End of Script.
#==============================================================================
if you want to try it, use one of my battlers i use in my game, saving you the trouble of making one yourself (Not that you have to, but to demonstrate)
My question is. What chould be causing so much lagg and is there a way to fix it or reduce it?
(Someone mentioned in a feedback message about my game that he/she experienced a lot of lagg in battles, suposedly even when no events were in effect)