RPG maker VX


Unirse al foro, es rápido y fácil

RPG maker VX
RPG maker VX
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.
Últimos temas
» Script de menu
por maxi Jue 04 Dic 2014, 1:44 pm

» Ayuda intro animado!!!
por maxi Miér 03 Dic 2014, 9:41 pm

» ayuda con este engin
por maxi Miér 03 Dic 2014, 8:42 am

» Hud de Vida 100% Personalizable - Engine Sencillo! Sin Scripts :)
por davidaikago Jue 20 Nov 2014, 10:58 am

» Ultimate parallax control by:GDS [ace]
por arellano Miér 08 Oct 2014, 8:28 pm

» Script Touhou (animated) Map name (v1.4)
por davidaikago Miér 08 Oct 2014, 2:09 pm

» tutorial puerta nueva
por davidaikago Miér 08 Oct 2014, 9:08 am

» cámara de fotos
por davidaikago Miér 08 Oct 2014, 9:05 am

» Imperial Action System II Demo
por davidaikago Miér 08 Oct 2014, 8:47 am

» VE Batalla animada [ACE]
por FhierusIV Jue 18 Sep 2014, 10:57 am

» Nuevo Reglamento del Foro [Vigente desde Septiembre 2014]
por maxi Miér 17 Sep 2014, 8:37 am

» MOG|Animated Title
por Souta21 Mar 09 Sep 2014, 7:24 pm

» Tutorial Engine - Cambiar Character al Equipar Objeto
por maxi Lun 21 Jul 2014, 10:19 am

» Script de climas
por gambasoxd Sáb 19 Jul 2014, 8:58 am

» Script de contraseña(codigo) para abrir un cofre
por rpgame Jue 03 Jul 2014, 6:03 pm

¿Quién está en línea?
En total hay 1 usuario en línea: 0 Registrados, 0 Ocultos y 1 Invitado

Ninguno

[ Ver toda la lista ]


El record de usuarios en línea fue de 117 durante el Mar 09 Ago 2011, 3:39 pm

Antilag VX

3 participantes

Ir abajo

Antilag VX Empty Antilag VX

Mensaje por elfi Dom 07 Feb 2010, 7:48 pm

Pos un antilag de muchos que hay.

Código:
#==============================================================================
# A N T I L A G    V X
#------------------------------------------------------------------------------
#  Autor: Andrew McKellar (Anaryu) (anmckell@gmail.com)
#
#  Versión: 1.2e
#
#  1.2 5 de Marzo 4:15pm EST: Implementado feedback de (Zeriab) y otras ideas
#    para actualizar sprites/eventos que están fuera de pantalla/proceso
#    paralelo. También añadida actualización para eventos fuera de pantalla
#    que tienen una ruta de movimiento específica.
#  1.2a 6 de Marzo 5:09am EST: Cambiado on_screen para usar el módulo Graphics
#    en vez de valores estáticos. (Zeriab)
#  1.2b 7 de Marzo 12:36am EST: Cambios en Game_Player para usar funciones
#    estándar en vez de especiales. Cambiado empty array check para usar
#    proper empty?
#  1.2c 10 de Marzo 10:13pm EST: Actualizados los eventos que usan un tile y
#    un chara en múltiples páginas para ser dibujados correctamente
#    como sprites. (eugene)
#  1.2d 14 de Marzo 4:12am EST: Arreglados errores con vehículos, pasabilidad,
#    y aterrizaje de barco volador.
#  1.2e 18 de Marzo 1:47am EST: Arreglados errores con la pasabilidad y los
#    gráficos de tileset en eventos de múltiples páginas.
#
#  Este script modifica funciones de fondo, sólo scripts de bajo-nivel o
#  modificaciones de mapa deberían crear conflictos.
#
#  Por favor, da crédito si lo usas, no es necesario pedir permiso para
#  proyectos de uso comercial.
#==============================================================================

# Si es true, esto permitirá al sistema ignorar todos los eventos que están
# fuera de pantalla a menos que añadas "DOUPDATE" a su nombre. (Eventos
# con DOUPDATE siempre se actualizarán)
#
# Si es false, esto significará que el sistema SIEMPRE actualizará CADA EVENTO
# del mapa - esto sólo debería usarse si experimentas problemas extraños
# de compatibilidad debido a algún script personalizado. Es mejor poner
# la etiqueta DOUPDATE en eventos que hacen algo especial o tienen ajustes
# particulares que no funcionan si esta etiqueta está activa.

ALLOW_SCREEN_IGNORE = true

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles maps. It includes scrolling and passage determination
# functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Map
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader  :pmap
 attr_reader  :emap
 attr_accessor :etilemap
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias :pre_antilag_setup    :setup
 def setup(map_id)
  # Run normal initialize
  pre_antilag_setup(map_id)
  # Add events to map
  @emap = {}
  for event in @events.values
    if not event.ignore_location
      loc = event.x.to_s + "_" + event.y.to_s
      @emap[loc] = [] if @emap[loc] == nil
      @emap[loc].push(event.id)
    end
  end
  # Create the passability map
  @pmap = Table.new($game_map.width, $game_map.height)
  for i in 0...$game_map.width
    for j in 0...$game_map.height
      passable?(i,j) ? pass = 1 : pass = 0
      @pmap[i,j] = pass
    end
  end
 end
 #--------------------------------------------------------------------------
 # * Clear Event location
 #--------------------------------------------------------------------------
 def clear_event_loc(event)
  # Add the event into the @emap hash
  loc = event.x.to_s + "_" + event.y.to_s
  if @emap[loc] != nil
    @emap[loc].delete(event.id)
    # Clean up after ourselves
    @emap.delete(loc) if @emap[loc].empty?
  end
 end
 #--------------------------------------------------------------------------
 # * Set Event location
 #--------------------------------------------------------------------------
 def set_event_loc(event)
  # Add the event into the @emap hash
  loc = event.x.to_s + "_" + event.y.to_s
  @emap[loc] = [] if @emap[loc] == nil
  @emap[loc].push(event.id)
 end
 #--------------------------------------------------------------------------
 # * Get array of event at designated coordinates
 #    x : x-coordinate
 #    y : y-coordinate
 #--------------------------------------------------------------------------
 alias :pre_antilag_events_xy  :events_xy
 def events_xy(x, y)
  # Grab the events from the hash
  loc = x.to_s + "_" + y.to_s
  event_ids = @emap[loc]
  # Use the IDs to build an array of events
  events = []
  if event_ids != nil
    for id in event_ids
      if id == 0
        events.push($game_player)
      else
        events.push(@events[id])
      end
    end
  end
  # Return this array for the passability to use
  return events
 end
 #--------------------------------------------------------------------------
 # * Determine if Passable
 #    x    : x coordinate
 #    y    : y coordinate
 #    flag : The impassable bit to be looked up
 #            (normally 0x01, only changed for vehicles)
 #--------------------------------------------------------------------------
 alias :pre_antilag_passable?    :passable?
 def passable?(x, y, flag = 0x01)
  for event in events_xy(x, y)            # events with matching coordinates
    next if event.tile_id == 0            # graphics are not tiled
    next if event.priority_type > 0      # not [Below characters]
    next if event.through                # pass-through state
    pass = @passages[event.tile_id]      # get passable attribute
    next if pass & 0x10 == 0x10          # *: Does not affect passage
    return true if pass & flag == 0x00    # o: Passable
    return false if pass & flag == flag  # x: Impassable
  end
  for i in [2, 1, 0]                      # in order from on top of layer
    tile_id = @map.data[x, y, i]          # get tile ID
    return false if tile_id == nil        # failed to get tile: Impassable
    pass = @passages[tile_id]            # get passable attribute
    next if pass & 0x10 == 0x10          # *: Does not affect passage
    return true if pass & flag == 0x00    # o: Passable
    return false if pass & flag == flag  # x: Impassable
  end
  if @etilemap != nil
    for i in [2, 1, 0]                      # in order from on top of layer
      tile_id = @etilemap[x, y, i]          # get tile ID
      return false if tile_id == nil        # failed to get tile: Impassable
      pass = @passages[tile_id]            # get passable attribute
      next if pass & 0x10 == 0x10          # *: Does not affect passage
      return true if pass & flag == 0x00    # o: Passable
      return false if pass & flag == flag  # x: Impassable
    end
  end
  return false                            # Impassable
 end
end

#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader  :ignore_update
 attr_reader  :ignore_sprite
 attr_reader  :ignore_location
 attr_reader  :force_update
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias :pre_antilag_initialize    :initialize
 def initialize
  # Run normal initialize
  pre_antilag_initialize
  # Set our ignore flag based on our event name
  @ignore_update = false
  @ignore_sprite = false
  @ignore_location = false
  @force_update = false
 end
 #--------------------------------------------------------------------------
 # * On Screen
 #--------------------------------------------------------------------------
 def on_screen
  x_range = ((@real_x <= ($game_map.display_x + ((Graphics.width + 32) * 8))) and (@real_x >= ($game_map.display_x - 256)))
  y_range = ((@real_y <= ($game_map.display_y + ((Graphics.height + 32) * 8))) and (@real_y >= ($game_map.display_y - 256)))
  if x_range and y_range
    return true
  end
  return false
 end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader  :id
 attr_reader  :original_forced_update
 #--------------------------------------------------------------------------
 # * Object Initialization
 #    map_id : map ID
 #    event  : event (RPG::Event)
 #--------------------------------------------------------------------------
 alias :pre_antilag_event_initialize    :initialize
 def initialize(map_id, event)
  # Run normal initialize
  pre_antilag_event_initialize(map_id, event)
  # Set our ignore flag based on our event name
  decide_ignore
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 alias :pre_antilag_update    :update
 def update
  # Only run update if @ignore_update is false
  if update?
    pre_antilag_update
  end
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update?
  # Check our logic and return if we should update
  ignore = ((not @ignore_update) and (on_screen and ALLOW_SCREEN_IGNORE))
  return (@force_update or ignore or @move_route_forcing)
 end
 #--------------------------------------------------------------------------
 # * Event page setup
 #--------------------------------------------------------------------------
 alias :pre_antilag_setup  :setup
 def setup(new_page)
  # Run normal setup
  pre_antilag_setup(new_page)
  # Set our forced flag if we're running as a parallel process now
  # if not, set it to our "default" set during the decide_ignore function
  if @trigger == 4 or @trigger == 3
    @force_update = true
  else
    @force_update = @original_force_update
  end
 end
 #--------------------------------------------------------------------------
 # * Decide if Ignorable for Updates or Sprites
 #--------------------------------------------------------------------------
 def decide_ignore
  # Not ignore by default
  @ignore_location = true
  @ignore_sprite = true
  @ignore_update = false
  @original_force_update = false
  # Decide if we should ignore ourselves or not
  if @event.name == "IGNORE"
    @ignore_update = true
  elsif @event.pages.size == 1
    if @list != nil
      if @list.size == 1
        if @character_name == "" or @tile_id != 0
          @ignore_update = true
        end
      end
    end
  end
  # Check if we'll ever need a sprite
  tiles = []
  for page in @event.pages
    # Check for single-tile events
    if page.graphic.tile_id != 0
      tiles.push(page.graphic.tile_id) if not tiles.include?(page.graphic.tile_id)
      if page.priority_type == 2 or tiles.size > 1 or @event.pages.size > 1
        @ignore_sprite = false
        @ignore_location = false
      end
    end
    # Check for character graphic instead
    if page.graphic.character_name != ""
      @ignore_sprite = false
      @ignore_location = false
    end
    # Check all pages for code to run
    if page.list.size > 1
      for item in page.list
        if item.code != 108
          @ignore_location = false
        end
      end
    end
  end
  # Check to see if we have any tiles and a no initial page
  if @list == nil and tiles.size > 0
    @ignore_sprite = false
    @ignore_location = false
  end
  # Force tags
  if @event.name.include?("DOSPRITE")
    @ignore_sprite = false
  end
  if @event.name.include?("DOLOC")
    @ignore_location = false
  end
  if @event.name.include?("DOUPDATE")
    @ignore_update = false
    @force_update = true
    @original_force_update = true
  end
 end
 #--------------------------------------------------------------------------
 # * Move Functions
 #--------------------------------------------------------------------------
 alias :pre_antilag_move_down    :move_down
 def move_down(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_down(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_left    :move_left
 def move_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_right    :move_right
 def move_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_right(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_up    :move_up
 def move_up(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_up(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_lower_left    :move_lower_left
 def move_lower_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_lower_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_upper_left    :move_upper_left
 def move_upper_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_upper_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_lower_right    :move_lower_right
 def move_lower_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_lower_right(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_upper_right    :move_upper_right
 def move_upper_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_upper_right(turn_ok)
  $game_map.set_event_loc(self)
 end
end


#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles maps. It includes event starting determinants and map
# scrolling functions. The instance of this class is referenced by $game_map.
#==============================================================================

class Game_Player < Game_Character
 #--------------------------------------------------------------------------
 # * Priority Type
 #--------------------------------------------------------------------------
 def priority_type
  return 1
 end
 #--------------------------------------------------------------------------
 # * Triggers
 #--------------------------------------------------------------------------
 def trigger
  return -1
 end
 #--------------------------------------------------------------------------
 # * Triggers
 #--------------------------------------------------------------------------
 def triggers
  return []
 end
 #--------------------------------------------------------------------------
 # * Triggers
 #--------------------------------------------------------------------------
 def id
  return 0
 end
 #--------------------------------------------------------------------------
 # * Triggers
 #--------------------------------------------------------------------------
 def tile_id
  return 0
 end
 #--------------------------------------------------------------------------
 # * Determine if Airship can Land
 #    x : x-coordinate
 #    y : y-coordinate
 #--------------------------------------------------------------------------
 alias :pre_antilag_airship_land_ok?  :airship_land_ok?
 def airship_land_ok?(x, y)
  unless $game_map.airship_land_ok?(x, y)
    return false    # The tile passable attribute is unlandable
  end
  # Check all events to ensure only the player is there
  for event in $game_map.events_xy(x, y)
    if event != $game_player
      return false
    end
  end
  return true      # Can land
 end
 #--------------------------------------------------------------------------
 # * Move Functions
 #--------------------------------------------------------------------------
 alias :pre_antilag_move_down    :move_down
 def move_down(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_down(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_left    :move_left
 def move_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_right    :move_right
 def move_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_right(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_up    :move_up
 def move_up(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_up(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_lower_left    :move_lower_left
 def move_lower_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_lower_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_upper_left    :move_upper_left
 def move_upper_left(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_upper_left(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_lower_right    :move_lower_right
 def move_lower_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_lower_right(turn_ok)
  $game_map.set_event_loc(self)
 end
 alias :pre_antilag_move_upper_right    :move_upper_right
 def move_upper_right(turn_ok = true)
  $game_map.clear_event_loc(self)
  pre_antilag_move_upper_right(turn_ok)
  $game_map.set_event_loc(self)
 end
end

#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
#  This class brings together map screen sprites, tilemaps, etc. It's used
# within the Scene_Map class.
#==============================================================================

class Spriteset_Map
 #--------------------------------------------------------------------------
 # * Create Character Sprite
 #--------------------------------------------------------------------------
 alias :pre_antilag_create_characters    :create_characters
 def create_characters
  @character_sprites = []
  for i in $game_map.events.keys.sort
    unless $game_map.events[i].ignore_sprite
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites.push(sprite)
    end
  end
  for vehicle in $game_map.vehicles
    sprite = Sprite_Character.new(@viewport1, vehicle)
    @character_sprites.push(sprite)
  end
  @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
 end
 #--------------------------------------------------------------------------
 # * Create Tilemap
 #--------------------------------------------------------------------------
 alias :pre_antilag_create_tilemap  :create_tilemap
 def create_tilemap
  # Normal tilemap creation
  pre_antilag_create_tilemap
  # Add the new tilemap!
  @etilemap = Tilemap.new(@viewport1)
  @etilemap.bitmaps[0] = Cache.system("TileA1")
  @etilemap.bitmaps[1] = Cache.system("TileA2")
  @etilemap.bitmaps[2] = Cache.system("TileA3")
  @etilemap.bitmaps[3] = Cache.system("TileA4")
  @etilemap.bitmaps[4] = Cache.system("TileA5")
  @etilemap.bitmaps[5] = Cache.system("TileB")
  @etilemap.bitmaps[6] = Cache.system("TileC")
  @etilemap.bitmaps[7] = Cache.system("TileD")
  @etilemap.bitmaps[8] = Cache.system("TileE")
  emap = Table.new($game_map.data.xsize, $game_map.data.ysize, 3)
  # Add only events that are not "above" character
  for event in $game_map.events.values
    if event.tile_id > 0 and event.priority_type < 2 and event.ignore_sprite
      emap[event.x, event.y, 1] = event.tile_id
    end
  end
  @etilemap.map_data = emap
  $game_map.etilemap = emap
 end
 #--------------------------------------------------------------------------
 # * Dispose of Tilemap
 #--------------------------------------------------------------------------
 alias :pre_antilag_dispose_tilemap    :dispose_tilemap
 def dispose_tilemap
  # Normal dispose
  pre_antilag_dispose_tilemap
  # Dispose of new event tilemap
  @etilemap.dispose
 end
 #--------------------------------------------------------------------------
 # * Update Tilemap
 #--------------------------------------------------------------------------
 alias :pre_antilag_update_tilemap  :update_tilemap
 def update_tilemap
  # Normal update
  pre_antilag_update_tilemap
  # Work with new event tilemap
  @etilemap.ox = $game_map.display_x / 8
  @etilemap.oy = $game_map.display_y / 8
  @etilemap.update
 end
 #--------------------------------------------------------------------------
 # * Update Character Sprite
 #--------------------------------------------------------------------------
 alias :pre_antilag_update_characters  :update_characters
 def update_characters
  for sprite in @character_sprites
    sprite.update if sprite.character.on_screen
  end
 end
end
elfi
elfi
30
30

Masculino

Edad 43

Cantidad de envíos 36

Maker Cash 62

Reputación 14


Volver arriba Ir abajo

Antilag VX Empty Re: Antilag VX

Mensaje por edddiego Vie 17 Sep 2010, 4:36 pm

borrado
edddiego
edddiego
220
220

Masculino

Edad 32

Cantidad de envíos 261

Maker Cash 346

Reputación 21


Volver arriba Ir abajo

Antilag VX Empty Re: Antilag VX

Mensaje por Antoni.Manu Sáb 18 Sep 2010, 1:37 am

¿Que es Antilag?
avatar
Antoni.Manu
220
220

Masculino

Edad 24

Cantidad de envíos 298

Maker Cash 252

Reputación 13


Extras
Sobre mí::

Volver arriba Ir abajo

Antilag VX Empty Re: Antilag VX

Mensaje por Contenido patrocinado


Contenido patrocinado


Volver arriba Ir abajo

Volver arriba

- Temas similares

 
Permisos de este foro:
No puedes responder a temas en este foro.