But,some of them don't work together,and I'm able to find a way to dodge the problem,but not fix it,but lets see,I'll make which scripts are confusing,by line numbers
of course.
1-50 lines of script : Not very confusing
51-125 lines of script : Confusing by a little bit
126-210 lines of script : Confusing
211-400 lines of script : Compilcated
401-600 lines of script : Not easy at all for a beginner.
601+ lines of script : Woah there!
Second one
#==============================================================================
# +++ MOG - Simple Anti Lag (V2.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Sistema de antilag. Basicamente faz com que o sistema não atualize os eventos
# fora da tela.
#==============================================================================
# Para forçar um evento atualizar fora da tela coloque este comentário no
# evento.
#
# <Force Update>
#
#==============================================================================
# Para desativar ou ativar o sistema de antilag use o comando abaixo
#
# $game_system.anti_lag = true
#
#==============================================================================
# NOTA - Este script não funciona em mapas com efeito LOOP.
#
#==============================================================================
# ● Version History
#==============================================================================
# 2.1 - Compatibilidade com resoluções maiores que o padrão.
#==============================================================================
module MOG_ANTI_LAG
#Area que será atualizada fora da tela.
UPDATE_OUT_SCREEN_RANGE = 3
end
$imported = {} if $imported.nil?
$imported[:mog_anti_lag] = true
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :anti_lag
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_initialize initialize
def initialize
@anti_lag = true
mog_antilag_initialize
end
end
#==============================================================================
# ■ Game CharacterBase
#==============================================================================
class Game_CharacterBase
attr_accessor :force_update
attr_accessor :can_update
#--------------------------------------------------------------------------
# ● Init Public Members
#--------------------------------------------------------------------------
alias mog_antilag_init_public_members init_public_members
def init_public_members
mog_antilag_init_public_members
@force_update = false ; @can_update = true
end
end
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_initialize initialize
def initialize(map_id, event)
mog_anti_lag_initialize(map_id, event)
anti_lag_initial_setup
end
#--------------------------------------------------------------------------
# ● Setup Page Setting
#--------------------------------------------------------------------------
alias mog_antilag_setup_page_settings setup_page_settings
def setup_page_settings
mog_antilag_setup_page_settings
set_force_update
end
#--------------------------------------------------------------------------
# ● Set Force Update
#--------------------------------------------------------------------------
def set_force_update
return if @list == nil
for command in @list
if command.code == 108
@force_update = true if command.parameters[0] =~ /<Force Update>/
end
end
end
#--------------------------------------------------------------------------
# ● Anti Lag Initial Setup
#--------------------------------------------------------------------------
def anti_lag_initial_setup
@can_update = true, rg = [(Graphics.width / 32) - 1, (Graphics.height / 32) - 1]
@loop_map = ($game_map.loop_horizontal? or $game_map.loop_vertical?) ? true : false
out_screen = MOG_ANTI_LAG::UPDATE_OUT_SCREEN_RANGE
@antilag_range = [-out_screen, rg[0] + out_screen,rg[1] + out_screen]
end
#--------------------------------------------------------------------------
# ● Anti Lag Force Update
#--------------------------------------------------------------------------
def antilag_force_update?
return true if !$game_system.anti_lag
return true if @loop_map
return true if @force_update
return true if @trigger != nil and @trigger >= 3
return true if anti_lag_event_on_screen?
return false
end
#--------------------------------------------------------------------------
# ● Anti Lag Event On Screen?
#--------------------------------------------------------------------------
def anti_lag_event_on_screen?
distance_x = @x - ($game_map.display_x).truncate
distance_y = @y - ($game_map.display_y).truncate
if distance_x.between?(@antilag_range[0], @antilag_range[1]) and
distance_y.between?(@antilag_range[0], @antilag_range[2])
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_anti_lag_update update
def update
@can_update = antilag_force_update?
return if !@can_update
mog_anti_lag_update
end
end
#==============================================================================
# ■ Sprite Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● Check Can Update Sprite
#--------------------------------------------------------------------------
def check_can_update_sprite
reset_sprite_effects if (self.visible and [email protected]_update)
self.visible = @character.can_update
@balloon_sprite.visible = self.visible if @balloon_sprite != nil
end
#--------------------------------------------------------------------------
# ● Reset Sprite Effects
#--------------------------------------------------------------------------
def reset_sprite_effects
dispose_animation ; dispose_balloon
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_anti_lag_update update
def update
if @character.is_a?(Game_Event)
check_can_update_sprite
return if !self.visible
end
mog_anti_lag_update
end
end
----------------------------------------------------------------------------------------------
of course.
1-50 lines of script : Not very confusing
51-125 lines of script : Confusing by a little bit
126-210 lines of script : Confusing
211-400 lines of script : Compilcated
401-600 lines of script : Not easy at all for a beginner.
601+ lines of script : Woah there!
Ok.I will throw them in now. Also i will help you figure them out to work.
First one#==============================================================================
#==============================================================================
# +++ MOG - Anti Animation Lag (v1.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Este script remove as travadas (Lag) relacionadas ao dispose de uma animação.
#==============================================================================
#==============================================================================
# Durante a execução do jogo o Rpg Maker VX ACE leva um tempo considerável para
# ler ou apagar (Dispose) um arquivo. (Imagem, som ou video)
# O que acaba acarretando pequenas travadas durante o jogo, efeito perceptível
# ao usar arquivos relativamente pesados. (Arquivos de animações.)
#==============================================================================
# NOTA - Este script não elimina as travadas relacionadas ao tempo de leitura
# de uma animação, apenas ao tempo relacionado para apagar uma animação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_anti_animation_lag] = true
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :animation_garbage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_initialize initialize
def initialize
@animation_garbage = []
mog_anti_lag_animation_initialize
end
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :anti_lag_animation
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_animation_initialize initialize
def initialize
@anti_lag_animation = true
mog_antilag_animation_initialize
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● Call
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_call call
def call(scene_class)
mog_anti_lag_animation_call(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Goto
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_goto goto
def goto(scene_class)
mog_anti_lag_animation_goto(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_setup setup
def setup(map_id)
SceneManager.dispose_animation_garbage
mog_anti_lag_animation_setup(map_id)
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_terminate terminate
def terminate
mog_anti_lag_animation_terminate
SceneManager.dispose_animation_garbage
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_dispose_animation dispose_animation
def dispose_animation
if $game_system.anti_lag_animation
execute_animation_garbage
return
end
mog_anti_lag_animation_dispose_animation
end
#--------------------------------------------------------------------------
# ● Execute Animation Garbage
#--------------------------------------------------------------------------
def execute_animation_garbage
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil ; @animation = nil
end
@ani_bitmap1 = nil ; @ani_bitmap2 = nil
end
end
-------------------------------
# +++ MOG - Anti Animation Lag (v1.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Este script remove as travadas (Lag) relacionadas ao dispose de uma animação.
#==============================================================================
#==============================================================================
# Durante a execução do jogo o Rpg Maker VX ACE leva um tempo considerável para
# ler ou apagar (Dispose) um arquivo. (Imagem, som ou video)
# O que acaba acarretando pequenas travadas durante o jogo, efeito perceptível
# ao usar arquivos relativamente pesados. (Arquivos de animações.)
#==============================================================================
# NOTA - Este script não elimina as travadas relacionadas ao tempo de leitura
# de uma animação, apenas ao tempo relacionado para apagar uma animação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_anti_animation_lag] = true
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :animation_garbage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_initialize initialize
def initialize
@animation_garbage = []
mog_anti_lag_animation_initialize
end
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :anti_lag_animation
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_animation_initialize initialize
def initialize
@anti_lag_animation = true
mog_antilag_animation_initialize
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● Call
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_call call
def call(scene_class)
mog_anti_lag_animation_call(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Goto
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_goto goto
def goto(scene_class)
mog_anti_lag_animation_goto(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_setup setup
def setup(map_id)
SceneManager.dispose_animation_garbage
mog_anti_lag_animation_setup(map_id)
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_terminate terminate
def terminate
mog_anti_lag_animation_terminate
SceneManager.dispose_animation_garbage
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_dispose_animation dispose_animation
def dispose_animation
if $game_system.anti_lag_animation
execute_animation_garbage
return
end
mog_anti_lag_animation_dispose_animation
end
#--------------------------------------------------------------------------
# ● Execute Animation Garbage
#--------------------------------------------------------------------------
def execute_animation_garbage
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil ; @animation = nil
end
@ani_bitmap1 = nil ; @ani_bitmap2 = nil
end
end
-------------------------------
First one#==============================================================================
#==============================================================================
# +++ MOG - Anti Animation Lag (v1.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Este script remove as travadas (Lag) relacionadas ao dispose de uma animação.
#==============================================================================
#==============================================================================
# Durante a execução do jogo o Rpg Maker VX ACE leva um tempo considerável para
# ler ou apagar (Dispose) um arquivo. (Imagem, som ou video)
# O que acaba acarretando pequenas travadas durante o jogo, efeito perceptível
# ao usar arquivos relativamente pesados. (Arquivos de animações.)
#==============================================================================
# NOTA - Este script não elimina as travadas relacionadas ao tempo de leitura
# de uma animação, apenas ao tempo relacionado para apagar uma animação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_anti_animation_lag] = true
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :animation_garbage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_initialize initialize
def initialize
@animation_garbage = []
mog_anti_lag_animation_initialize
end
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :anti_lag_animation
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_animation_initialize initialize
def initialize
@anti_lag_animation = true
mog_antilag_animation_initialize
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● Call
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_call call
def call(scene_class)
mog_anti_lag_animation_call(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Goto
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_goto goto
def goto(scene_class)
mog_anti_lag_animation_goto(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_setup setup
def setup(map_id)
SceneManager.dispose_animation_garbage
mog_anti_lag_animation_setup(map_id)
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_terminate terminate
def terminate
mog_anti_lag_animation_terminate
SceneManager.dispose_animation_garbage
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_dispose_animation dispose_animation
def dispose_animation
if $game_system.anti_lag_animation
execute_animation_garbage
return
end
mog_anti_lag_animation_dispose_animation
end
#--------------------------------------------------------------------------
# ● Execute Animation Garbage
#--------------------------------------------------------------------------
def execute_animation_garbage
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil ; @animation = nil
end
@ani_bitmap1 = nil ; @ani_bitmap2 = nil
end
end
-------------------------------
# +++ MOG - Anti Animation Lag (v1.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Este script remove as travadas (Lag) relacionadas ao dispose de uma animação.
#==============================================================================
#==============================================================================
# Durante a execução do jogo o Rpg Maker VX ACE leva um tempo considerável para
# ler ou apagar (Dispose) um arquivo. (Imagem, som ou video)
# O que acaba acarretando pequenas travadas durante o jogo, efeito perceptível
# ao usar arquivos relativamente pesados. (Arquivos de animações.)
#==============================================================================
# NOTA - Este script não elimina as travadas relacionadas ao tempo de leitura
# de uma animação, apenas ao tempo relacionado para apagar uma animação.
#==============================================================================
$imported = {} if $imported.nil?
$imported[:mog_anti_animation_lag] = true
#===============================================================================
# ■ Game_Temp
#===============================================================================
class Game_Temp
attr_accessor :animation_garbage
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_initialize initialize
def initialize
@animation_garbage = []
mog_anti_lag_animation_initialize
end
end
#===============================================================================
# ■ Game System
#===============================================================================
class Game_System
attr_accessor :anti_lag_animation
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_animation_initialize initialize
def initialize
@anti_lag_animation = true
mog_antilag_animation_initialize
end
end
#===============================================================================
# ■ SceneManager
#===============================================================================
class << SceneManager
#--------------------------------------------------------------------------
# ● Call
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_call call
def call(scene_class)
mog_anti_lag_animation_call(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Goto
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_goto goto
def goto(scene_class)
mog_anti_lag_animation_goto(scene_class)
dispose_animation_garbage
end
#--------------------------------------------------------------------------
# ● Dispose Animation Garbage
#--------------------------------------------------------------------------
def dispose_animation_garbage
return if $game_temp.animation_garbage == nil
for animation in $game_temp.animation_garbage
animation.dispose
end
$game_temp.animation_garbage = nil
end
end
#==============================================================================
# ■ Game Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_setup setup
def setup(map_id)
SceneManager.dispose_animation_garbage
mog_anti_lag_animation_setup(map_id)
end
end
#==============================================================================
# ■ Scene Base
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# ● Terminate
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_terminate terminate
def terminate
mog_anti_lag_animation_terminate
SceneManager.dispose_animation_garbage
end
end
#==============================================================================
# ■ Sprite Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# ● Dispose Animation
#--------------------------------------------------------------------------
alias mog_anti_lag_animation_dispose_animation dispose_animation
def dispose_animation
if $game_system.anti_lag_animation
execute_animation_garbage
return
end
mog_anti_lag_animation_dispose_animation
end
#--------------------------------------------------------------------------
# ● Execute Animation Garbage
#--------------------------------------------------------------------------
def execute_animation_garbage
$game_temp.animation_garbage = [] if $game_temp.animation_garbage == nil
if @ani_bitmap1
@@_reference_count[@ani_bitmap1] -= 1
if @@_reference_count[@ani_bitmap1] == 0
$game_temp.animation_garbage.push(@ani_bitmap1)
end
end
if @ani_bitmap2
@@_reference_count[@ani_bitmap2] -= 1
if @@_reference_count[@ani_bitmap2] == 0
$game_temp.animation_garbage.push(@ani_bitmap2)
end
end
if @ani_sprites
@ani_sprites.each {|sprite| sprite.dispose }
@ani_sprites = nil ; @animation = nil
end
@ani_bitmap1 = nil ; @ani_bitmap2 = nil
end
end
-------------------------------
Second one
#==============================================================================
# +++ MOG - Simple Anti Lag (V2.1) +++
#==============================================================================
# By Moghunter
# https://atelierrgss.wordpress.com/
#==============================================================================
# Sistema de antilag. Basicamente faz com que o sistema não atualize os eventos
# fora da tela.
#==============================================================================
# Para forçar um evento atualizar fora da tela coloque este comentário no
# evento.
#
# <Force Update>
#
#==============================================================================
# Para desativar ou ativar o sistema de antilag use o comando abaixo
#
# $game_system.anti_lag = true
#
#==============================================================================
# NOTA - Este script não funciona em mapas com efeito LOOP.
#
#==============================================================================
# ● Version History
#==============================================================================
# 2.1 - Compatibilidade com resoluções maiores que o padrão.
#==============================================================================
module MOG_ANTI_LAG
#Area que será atualizada fora da tela.
UPDATE_OUT_SCREEN_RANGE = 3
end
$imported = {} if $imported.nil?
$imported[:mog_anti_lag] = true
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :anti_lag
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_antilag_initialize initialize
def initialize
@anti_lag = true
mog_antilag_initialize
end
end
#==============================================================================
# ■ Game CharacterBase
#==============================================================================
class Game_CharacterBase
attr_accessor :force_update
attr_accessor :can_update
#--------------------------------------------------------------------------
# ● Init Public Members
#--------------------------------------------------------------------------
alias mog_antilag_init_public_members init_public_members
def init_public_members
mog_antilag_init_public_members
@force_update = false ; @can_update = true
end
end
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_anti_lag_initialize initialize
def initialize(map_id, event)
mog_anti_lag_initialize(map_id, event)
anti_lag_initial_setup
end
#--------------------------------------------------------------------------
# ● Setup Page Setting
#--------------------------------------------------------------------------
alias mog_antilag_setup_page_settings setup_page_settings
def setup_page_settings
mog_antilag_setup_page_settings
set_force_update
end
#--------------------------------------------------------------------------
# ● Set Force Update
#--------------------------------------------------------------------------
def set_force_update
return if @list == nil
for command in @list
if command.code == 108
@force_update = true if command.parameters[0] =~ /<Force Update>/
end
end
end
#--------------------------------------------------------------------------
# ● Anti Lag Initial Setup
#--------------------------------------------------------------------------
def anti_lag_initial_setup
@can_update = true, rg = [(Graphics.width / 32) - 1, (Graphics.height / 32) - 1]
@loop_map = ($game_map.loop_horizontal? or $game_map.loop_vertical?) ? true : false
out_screen = MOG_ANTI_LAG::UPDATE_OUT_SCREEN_RANGE
@antilag_range = [-out_screen, rg[0] + out_screen,rg[1] + out_screen]
end
#--------------------------------------------------------------------------
# ● Anti Lag Force Update
#--------------------------------------------------------------------------
def antilag_force_update?
return true if !$game_system.anti_lag
return true if @loop_map
return true if @force_update
return true if @trigger != nil and @trigger >= 3
return true if anti_lag_event_on_screen?
return false
end
#--------------------------------------------------------------------------
# ● Anti Lag Event On Screen?
#--------------------------------------------------------------------------
def anti_lag_event_on_screen?
distance_x = @x - ($game_map.display_x).truncate
distance_y = @y - ($game_map.display_y).truncate
if distance_x.between?(@antilag_range[0], @antilag_range[1]) and
distance_y.between?(@antilag_range[0], @antilag_range[2])
return true
end
return false
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_anti_lag_update update
def update
@can_update = antilag_force_update?
return if !@can_update
mog_anti_lag_update
end
end
#==============================================================================
# ■ Sprite Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● Check Can Update Sprite
#--------------------------------------------------------------------------
def check_can_update_sprite
reset_sprite_effects if (self.visible and [email protected]_update)
self.visible = @character.can_update
@balloon_sprite.visible = self.visible if @balloon_sprite != nil
end
#--------------------------------------------------------------------------
# ● Reset Sprite Effects
#--------------------------------------------------------------------------
def reset_sprite_effects
dispose_animation ; dispose_balloon
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_anti_lag_update update
def update
if @character.is_a?(Game_Event)
check_can_update_sprite
return if !self.visible
end
mog_anti_lag_update
end
end
----------------------------------------------------------------------------------------------