terça-feira, 10 de março de 2015

Script de Fog na Batalha V1.0
#==============================================================================
#
# ◘ YangFly Coding Ace - Ace Battle Fog(or whatever you wanna call this) 
# -- Last Updated: 2015.03.02
# -- Level: Easy
# -- Requires: n/a
# -- Compatibility: Highly
# -- Lag Created: Aulmost Nothing
#==============================================================================

$imported = {} if $imported.nil?
$imported["YCA-BattleFog"] = true

#==============================================================================
# ◘ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#  2015.03.02 => Started Script and Finished
#==============================================================================
# ◘ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#  If a Switch is on, the fog will be enabled.
#  You can set the X speed and Y speed by 2 variables.
#  The Fog can be changed in-game by calling: changebfog("x")
#  Where x = The name of the Fog in the "Fogs" folder inside the "Graphics"
#  folder.(You need to create Dat Folder...)
#==============================================================================
# ◘ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#  Ya knows how to do this already, right?
#  But it won't hurt to tell again, Place this below everything and above
#  main and blablabla...
#==============================================================================
# ◘ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#  This Scripts Overwrites Nothing so, it's Highly compatible.
#==============================================================================

module YCA
  module Battle_fog
     Default_Z = 2  # Z value of Dat Fog
     FogSwitch = 58 # Switch to turn on Fog
     XSpeedVar = 61 # Variable of the X speed
     YSpeedVar = 62 # Variable of the Y speed
  end
end

#--------------------------------------------------------------------------
# Edits should stop here unless ya know what u doing.
# But don't worry it won't cause computer damage, incontinence, 
# explosion of user's head, coma, death, and/or halitosis. ;3
#--------------------------------------------------------------------------


module Cache
  #--------------------------------------------------------------------------
  # New Method: self.fogs
  #--------------------------------------------------------------------------  
  def self.fogs(filename)
    load_bitmap("Graphics/Fogs/", filename)
  end
end



class Game_System
  #--------------------------------------------------------------------------
  # New Public instance Variable: @battlefog
  #--------------------------------------------------------------------------
  attr_accessor :battlefog
  #--------------------------------------------------------------------------
  # Alias: initialize
  #--------------------------------------------------------------------------
  alias yca_bfog_gamesystem_intialize initialize
  def initialize
    yca_bfog_gamesystem_intialize
    @battlefog = ""
  end
  
end

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # Alias: start
  #--------------------------------------------------------------------------
  alias yca_bfog_start start
  def start
    yca_bfog_start
    if $game_switches[YCA::Battle_fog::FogSwitch]
      create_bfog
    end
  end 
  #--------------------------------------------------------------------------
  # New Method: create_bfog
  #--------------------------------------------------------------------------  
  def create_bfog
    @bfog = Plane.new
    @bfog.bitmap = Cache.fogs($game_system.battlefog)
    @bfog.z = YCA::Battle_fog::Default_Z
  end
  #--------------------------------------------------------------------------
  # New Method: move_bfog
  #--------------------------------------------------------------------------  
  def move_bfog
    @bfog.ox += $game_variables[YCA::Battle_fog::XSpeedVar]
    @bfog.oy += $game_variables[YCA::Battle_fog::YSpeedVar]
  end
  #--------------------------------------------------------------------------
  # New Method: dispose_bfog
  #--------------------------------------------------------------------------  
  def dispose_bfog
    @bfog.bitmap.dispose
    @bfog.dispose
  end
  #--------------------------------------------------------------------------
  # Alias: update_basic
  #--------------------------------------------------------------------------
  alias yca_bfog_updatebasic update_basic
  def update_basic
    yca_bfog_updatebasic
    if $game_switches[YCA::Battle_fog::FogSwitch]
      move_bfog
    end
  end  
  #--------------------------------------------------------------------------
  # Alias: terminate
  #-------------------------------------------------------------------------- 
  alias yca_bfog_terminate terminate
  def terminate
    yca_bfog_terminate
    if $game_switches[YCA::Battle_fog::FogSwitch]
      dispose_bfog
    end
  end  
  
end

class Game_Interpreter
  def changebfog(name)
    $game_system.battlefog = name
  end
end

Nenhum comentário:

Postar um comentário