RPG Maker Heaven

RPG Maker Forum since 2011. Make yourself a home.
 
HomeHome  PortalPortal  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Share | 
 

 VX - Deplete Lag Increase Script

View previous topic View next topic Go down 
AuthorMessage
avatar
descending_gate
Active Member
Active Member

Posts : 80
Points : 147
Join date : 2011-10-23
Age : 25

PostSubject: VX - Deplete Lag Increase Script   Tue Oct 25, 2011 4:24 am

Janrae's Deplete Lag Increase for PixelArt Script
Authors Janrae Mendoza
Version: 1.0

Introduction

Do you remember the times when you have so many animations on your map then it lags for a while? Massive animations on the map or any event that happens inside the map or sprite range will make a small lag. ABS based games such as PRABS causes lag when many animation happens on the screen. Here is the script to make it go away like flash! =)

Features

  • Decreases lag increase when so many animations happen on the map.
    This makes Smooth animation for ABS based games, like that of PRABS.
    Detects the sprite movement when it is located on the programmed sensor.
    Animation on map moves faster and better than before to save game movement.


Screenshot:


Spoiler:
 

DEMO: You can check out for the demo here: http://www.mediafire.com/?e9z9nmbsqa19zh9

SCRIPT (For those who need fast test Very Happy ):

Code:

#==============================================================================#
#
 Deplete Lag Increase for PixelArt
# Author: Janrae Mendoza
# Compatibility: RPG Maker VX
# Date of Creation: July 2011
# Features: For a better pixel art game on VX (as it says on the
product) and
# decrease event lagging (which happens when many animation are shown on
 map.
#==============================================================================#

module
 JMGS
 module PixelArt
  ENABLED = true #set to true to work, false not to work.
 
  #  Range of Sprite of Map.
  MAP_SPRITE_UPDATE_RANGE = 80
 end
end

#==============================================================================#
#
 Pixel Art
if JMGS::PixelArt::ENABLED
#==============================================================================#

$imported
 = {} if $imported == nil
$imported["PixelArt"] = true

#==============================================================================#
#
 Calls out for the Graphics System
#==============================================================================#

module
 Graphics
  unless method_defined?(:resize_screen_JMGS_PixelArt)
  class << Graphics
    alias resize_screen_JMGS_PixelArt resize_screen
  end
  def self.resize_screen(width, height)
    resize_screen_JMGS_PixelArt(width, height)

    if $game_temp != nil
      $game_temp.setup_lightening_value
    end
  end
  end
end

#==============================================================================#
#
 Template
#==============================================================================#

class
 Game_Temp
#==============================================================================#
#
 Instance
#==============================================================================#

  attr_accessor :valid_common_event_check
  attr_reader  :display_center_x       
  attr_reader  :display_center_y       
  attr_reader  :map_sprite_update_width 
  attr_reader  :map_sprite_update_height

  alias initialize_JMGS_PixelArt initialize
  def initialize
    initialize_JMGS_PixelArt

    @valid_common_event_check = true

    setup_lightening_value
  end
#==============================================================================#
#
 Value
#==============================================================================#

  def setup_lightening_value
    @display_center_x = Graphics.width / 2
    @display_center_y = Graphics.height / 2
    @map_sprite_update_width = Graphics.width *
      JMGS::PixelArt::MAP_SPRITE_UPDATE_RANGE / 100
    @map_sprite_update_height = Graphics.height *
      JMGS::PixelArt::MAP_SPRITE_UPDATE_RANGE / 100
  end
end

#==============================================================================#
#
 Switch
#==============================================================================#

class
 Game_Switches

  alias indexer_equal_JMGS_PixelArt []=
  def []=(switch_id, value)
    indexer_equal_JMGS_PixelArt(switch_id, value)

    $game_temp.valid_common_event_check = true
  end
end

#==============================================================================#
#
 Game Map
#==============================================================================#

class
 Game_Map

  alias setup_JMGS_PixelArt setup
  def setup(map_id)
    setup_JMGS_PixelArt(map_id)

    update_valid_common_event_list
  end
 
  def update_valid_common_event_list
    @valid_common_events = {}
#==============================================================================#
#
 Processing through game switches...
#==============================================================================#


    @common_events.each { |event_id, event|
      if event.trigger == 2 && $game_switches[event.switch_id]
        @valid_common_events[event_id] = event
      end
    }
    $game_temp.valid_common_event_check = false
  end

  def update_events
    for event in @events.values
      event.update
    end
    if $game_temp.valid_common_event_check
      update_valid_common_event_list
    end
    for common_event in @valid_common_events.values
      common_event.update
    end
  end
end


class Game_Interpreter
  @@_auto_start_common_event_list = nil

  alias clear_JMGS_PixelArt clear
  def clear
    clear_JMGS_PixelArt

    if @@_auto_start_common_event_list == nil
      create_auto_start_common_event_list
    end
  end
 
  def create_auto_start_common_event_list
    @@_auto_start_common_event_list = []
    $data_common_events.compact.each { |event|
      # insert event to table if autostarting
      @@_auto_start_common_event_list << event if event.trigger ==
 1
    }
  end
 
  def setup_starting_event
    if $game_map.need_refresh           
      $game_map.refresh
    end
    if $game_temp.common_event_id > 0   
      setup($data_common_events[$game_temp.common_event_id].list)
      $game_temp.common_event_id = 0
      return
    end
    for event in $game_map.events.values 
      if event.starting                 
        event.clear_starting             
        setup(event.list, event.id)     
        return
      end
    end
    for event in @@_auto_start_common_event_list
      if $game_switches[event.switch_id] 
        setup(event.list)               
      end
    end
  end
end


class Sprite_Character < Sprite_Base
  def within_update_range?
    sx = @character.screen_x - $game_temp.display_center_x
    sy = @character.screen_y - $game_temp.display_center_y
    return (sx.abs <= $game_temp.map_sprite_update_width &&
      sy.abs <= $game_temp.map_sprite_update_height)
  end
end

class Spriteset_Map

  def update_characters
    for sprite in @character_sprites
      sprite.update if sprite.within_update_range?
    end
  end
end

#==============================================================================
#
 ** Scene_Map
#==============================================================================

class
 Scene_Map < Scene_Base
 
#--------------------------------------------------------------------------

  # * Frame Update
 
#--------------------------------------------------------------------------

  def update
    super
    $game_map.interpreter.update     
    $game_map.update                 
    $game_player.update             
    $game_system.update             
    @spriteset.update               
    @message_window.update           
    unless $game_message.visible     
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      if $game_temp.next_scene != nil 
        update_scene_change         
      end
    end
  end
end

end # this will work if mode ENABLED is ON.

#==============================================================================#
#
 END of Script
#==============================================================================#

Compatibility

Compatible for RPG Maker VX. Effective for the following:

PRABS
Front Battle System - with many animations
VTP

So far, this is compatible to all kinds of system for VX.
Back to top Go down
View user profile
avatar
rgangsta
Active Member
Active Member

Posts : 89
Points : 114
Join date : 2011-10-23
Age : 24
Location : New York

PostSubject: Re: VX - Deplete Lag Increase Script   Tue Oct 25, 2011 1:32 pm

I could kiss you right now! This script is like magic. I've been looking everywhere for an ati-lag script that's compatible with Yggdrasil ABS. The other anti-lags doesn't allow the weapon sprites to appear. But this...is...awesome. I can see the weapon sprites and it reduces the lag tremendously.
Thanks. Very Happy
Back to top Go down
View user profile
avatar
Jungle_Boy
Active Member
Active Member

Posts : 80
Points : 117
Join date : 2011-10-23
Age : 105
Location : Australia

PostSubject: Re: VX - Deplete Lag Increase Script   Tue Oct 25, 2011 2:35 pm

Looks nice and something that'll help my game! Might have to try this one out Very Happy
Back to top Go down
View user profile http://www.youtube.com/chewyvx
avatar
descending_gate
Active Member
Active Member

Posts : 80
Points : 147
Join date : 2011-10-23
Age : 25

PostSubject: Re: VX - Deplete Lag Increase Script   Tue Oct 25, 2011 4:22 pm

Thank you so much, glad it helped you Smile)
Back to top Go down
View user profile

Maniak
Guest


PostSubject: Re: VX - Deplete Lag Increase Script   Sun Dec 18, 2011 3:30 am

I am using YGGDRASIL and whenever i attack someone the HUD freezes and the damage numbers seem to stay on screen
Back to top Go down

Sponsored content



PostSubject: Re: VX - Deplete Lag Increase Script   

Back to top Go down
 

VX - Deplete Lag Increase Script

View previous topic View next topic Back to top 

 Similar topics

-
» Chess Script
» Autohotkey script for melee barbarian
» Awesome (FREE) gun script!
» Gun Movement Script? Tutorial #2
» Walking Animation Script(Help)
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
RPG Maker Heaven :: Topic Graveyard :: Random old topics-