¡Bienvenido a Universo Maker!
¿Es esta la primera vez que visitas el foro? Si es así te recomendamos que te registres para tener completo acceso a todas las áreas y secciones del foro, así también podrás participar activamente en la comunidad. Si ya tienes una cuenta, conectate cuanto antes.
Iniciar Sesión Registrarme

No estás conectado. Conéctate o registrate

Ver el tema anterior Ver el tema siguiente Ir abajo Mensaje [Página 1 de 1.]

#1 [RPG Maker XP] Unlimited Fog el Miér Nov 07, 2012 3:22 pm

Razor

avatar
Autor: Game_guy
Versión: 1.1
Descripción: Este script te permite utilizar gráficos de niebla ilimitados en tu proyecto.


Características



  • Mas de una fog.
  • Fácil de usar.
  • Fácil de llamar.
  • Configuración de todos los aspectos del gráfico.


Instrucciones



  • Coloque el script arriba de la estancia Main.


Script



Código:

#===============================================================================
# Unlimited Fogs
# Version 1.1
# Author game_guy
#-------------------------------------------------------------------------------
# Intro:
# Ever need more than one fog for a map? Maybe more than two fogs? With this
# unique script, you can have unlimited fogs on one map! And with a few
# easy script calls, you can customize every aspect of a fog at anytime!
#
# Features:
# Unlimited Fogs on Any Map
# Change Fog's properties at any time
# Easy to use script calls
#
# Instructions:
# There is nothing to configure so lets get onto the script calls!
#-------------------------------------------------------------------------------
# add_fog(index, file, [z, scroll_x, scroll_y, opacity, zoom, blend, hue])
#  index    - This is to keep track of the fogs on screen (more on this later)
#  file    - Filename for the fog
#  z        - The z index of the fog. This is used for layering. (Default: 3000)
#  scroll_x - Horizontal scrolling speed for the fog. (Default: 0)
#  scroll_y - Vertical scrolling speed for the fog. (Default: 0)
#  opacity  - Opacity level for the fog. (Default: 64)
#  zoom    - Zoom level for the fog. (Default: 1.0)
#  blend    - Blend type for the fog. (Default: 0)
#  hue      - Hue for the fog. (Default: 0)
#
#  Note: When using this script call, the parameters with default values don't
#        need to be set when calling it.
#        e.g. add_fog(1, "001-Fog01") - Works because all parameters after
#        has a default value.
# This script call simply adds a fog with the set parameters.
#-------------------------------------------------------------------------------
# remove_fog(index)
#  index - Remember the index we set in "add_fog"? Put the same number in here
#          to remove it.
#
# This script call simply removes a fog.
#-------------------------------------------------------------------------------
# fogs(index)
#  index - The index we used to create our original fog.
#
# This handy script call returns the actual fog so you can edit individual
# properties. For example:
#  fog = fogs(1)
#  fog.scroll_x = 2
#  fog.scroll_y = 2
# This grabs the fog at index "1" and sets the scroll speed for x and y.
# (See below for all the properties/methods you can use)
#-------------------------------------------------------------------------------
# Fog Properties:
# These are the following properties/methods you can use when editing
# individual fogs.
#  visible    = Whether fog is visible or not (true/false)
#  opacity    = Opacity of the fog. (0 to 255)
#  z          = Z index of the fog.
#  scroll_x  = Horizontal scroll speed.
#  scroll_y  = Vertical scroll speed.
#  zoom_x    = Horizontal zoom factor.
#  zoom_y    = Vertical zoom factor.
#  blend_type = Blend mode for fog. (0, 1, or 2)
#  filename(new_file, [hue])
#    -new_file = New fog file.
#    -hue      = Hue for new fog. (Default: 0)
#-------------------------------------------------------------------------------
# Thats about it. Due take warning that the more fogs you add, the more
# probable lag you'll run into. Adding an extra two or three shouldn't hurt too
# much though. ;)
#
# Compatibility:
# Not tested with SDK.
# Should be compatible with everything.
#
# Credits:
# game_guy ~ For making the script.
# LiTTleDRAgo ~ For the original idea.
#===============================================================================
class Spriteset_Map
 
  alias gg_fogs_init_spriteset_map_lat initialize
  def initialize
    @fogs = []
    gg_fogs_init_spriteset_map_lat
  end
 
  alias gg_fogs_update_spriteset_map_lat update
  def update
    @fogs.each {|fog| fog.update if fog != nil }
    gg_fogs_update_spriteset_map_lat
  end
 
  alias gg_fogs_dispose_spriteset_map_lat dispose
  def dispose
    @fogs.each {|fog| fog.dispose if fog != nil }
    gg_fogs_dispose_spriteset_map_lat
  end
 
  def fogs(n)
    if @fogs[n] == nil
      @fogs[n] = ScrollPlane.new(@viewport1)
    end
    return @fogs[n]
  end
 
  def add_fog(index, file, z = 3000, ox = 0, oy = 0, opacity = 64, zoom = 1.0, blend = 0, hue = 0)
    remove_fog(index)
    fog = ScrollPlane.new(@viewport1)
    fog.bitmap = RPG::Cache.fog(file, hue)
    fog.z = z
    fog.blend_type = blend
    fog.opacity = opacity
    fog.zoom_x = zoom
    fog.zoom_y = zoom
    fog.scroll_x = ox
    fog.scroll_y = oy
    @fogs[index] = fog
  end
 
  def remove_fog(index)
    if (@fogs[index] != nil)
      @fogs[index].dispose
      @fogs[index] = nil
    end
  end
 
end

class ScrollPlane < Plane
 
  attr_accessor :scroll_x
  attr_accessor :scroll_y
 
  def initialize(viewport = nil)
    super(viewport)
    @scroll_x = 0
    @scroll_y = 0
  end
 
  def update
    self.ox = $game_map.display_x / 4 + @scroll_x
    self.oy = $game_map.display_y / 4 + @scroll_y
  end
 
  def filename(file, hue = 0)
    self.bitmap = RPG::Cache.fog(file, hue)
  end
 
end

class Interpreter
 
  def spriteset
    return $scene.spriteset if $scene.is_a?(Scene_Map)
    return nil
  end
 
  def add_fog(index, file, z = 3000, ox = 0, oy = 0, opacity = 64, zoom = 1.0, blend = 0, hue = 0)
    spriteset.add_fog(index, file, z, ox, oy, opacity, zoom, blend, hue)
  end
 
  def remove_fog(index)
    spriteset.remove_fog(index)
  end
 
  def fogs(n)
    return spriteset.fogs(n)
  end
 
end

class Scene_Map
  attr_accessor :spriteset
end

Un Saludo
Out.-





Todos mis aportes por Mediafire tienen contraseña, esa es: www.universomaker.net
Esto es para evitar plagio, asegúrense de copiar y pegar la contraseña.

Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

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