The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: Dark_falcao on September 12, 2009, 04:53:05 PM

Title: Script Fog effects on map! V1.0
Post by: Dark_falcao on September 12, 2009, 04:53:05 PM
                               Fog Effect 1.0 Falcao Script

Introduction:

Are you tire of those monotone maps? here i bring you the solution!!
This script allow you show Fog Effects on map,

Features

- Fog effects graphics on map
- Fog zoom
- Fog Scrool X or Y
- Others features

Instructions

Copy and paste the script to your project, and then inport the fog graphics to the folder Pictures


Call the script using the following command

$game_map.fog("Fog Name", Opacity, Zoom , Scroll_x, Scroll_y)

Example: using standar configuration
$game_map.fog("sombra2",50,2,1,1)
 
Fog Graphics must be in folder Pictures


Script:

Code: [Select]
#====================================================================#
#  #*****************#           Fog effect V1.0 Falcao script       #
#  #*** By Falcao ***#           Allow fog effects graphics on map   #
#  #*****************#                                               #
#         RMVX                   Instalation: Copy and paste the     #  
# makerpalace.onlinegoo.com      script to your porject              #  
#====================================================================#

#--------------------------------------------------------------------
# * How to use
#
# Call the script using the following command
#
# $game_map.fog("Fog Name", Opacity, Zoom , Scroll_x, Scroll_y)
#
# Example: using standar configuration
# $game_map.fog("sombra2",50,2,1,1)
#
# Fog Graphics must be in folder Pictures
#
# Author notes:
# This script can be used in comercial or non-comercial games
# Credits to Falcao
#
#---------------------------------------------------------------------

module Falcao

# Scrool fog graphics whith the screen change (true or false)  
DinamicScroll = true

end

class Game_Map
  attr_accessor :fog_name                
  attr_accessor :fog_opacity              
  attr_accessor :fog_zoom                
  attr_accessor :fog_sx                  
  attr_accessor :fog_sy                  
  attr_reader   :fog_ox                  
  attr_reader   :fog_oy
  alias falcaofogSini initialize
  def initialize
    @fog_start = true
    falcaofogSini
  end
  alias falcao_setup setup
  def setup(map_id)
    falcao_setup(map_id)
    setup_fog
  end
  def setup_fog
    if @fog_start
      @fog_name = ""
      @fog_opacity = 0
      @fog_zoom = 0
      @fog_sx = 0
      @fog_sy = 0
      @fog_ox = 0
      @fog_oy = 0
      @fog_start = false
    end
  end
  alias falcaofog_update update
  def update
    falcaofog_update
    update_fog
  end
  def update_fog
    @fog_ox -= @fog_sx / 8.0
    @fog_oy -= @fog_sy / 8.0
  end
  def fog(name,opacity,zoom,scroll_x,scroll_y)
    @fog_name = name
    @fog_opacity = opacity
    @fog_zoom = zoom
    @fog_sx = scroll_x
    @fog_sy = scroll_y
  end
end

class Spriteset_Map
  alias falcaofogini initialize
  def initialize
    create_fog
    falcaofogini
  end
  def create_fog
    @fog = Plane.new(@viewport1)
    @fog.z = 3000
  end
  alias falcaofog_dispose dispose
  def dispose
    falcaofog_dispose
    dispose_fog
  end
  def dispose_fog
    @fog.dispose
  end
  alias falcaofogSupdate update
  def update
    falcaofogSupdate
    update_fog
  end
  def update_fog
    if @fog_name != $game_map.fog_name
      @fog_name = $game_map.fog_name
      if @fog.bitmap != nil
        @fog.bitmap.dispose
        @fog.bitmap = nil
      end
      if @fog_name != ""
        @fog.bitmap = Cache.picture(@fog_name)
      end
      Graphics.frame_reset
    end
    @fog.zoom_x = $game_map.fog_zoom
    @fog.zoom_y = $game_map.fog_zoom
    @fog.opacity = $game_map.fog_opacity
    if Falcao::DinamicScroll == true
      @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
      @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
    else
      @fog.ox =  4 + $game_map.fog_ox
      @fog.oy =  4 + $game_map.fog_oy
    end
  end
end



Here a example Fog graphic ready to use

Import to Picture Folder

Spoiler for:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi627.photobucket.com%2Falbums%2Ftt357%2Ffalcao99%2FSombra2.png&hash=f5552b9096ef2da2d30ec26ffa18462263bd3ff9)


Demo

Demo include Fog Pack!!

http://www.mediafire.com/download.php?jazxmndknyl


Credits

By FaLcao

This script can be used in comercial or non-comercial games


Screens

Spoiler for:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi627.photobucket.com%2Falbums%2Ftt357%2Ffalcao99%2FFog1.png&hash=71822e3f0d76724f5212258eb19249a078db0fd7)


Spoiler for:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi627.photobucket.com%2Falbums%2Ftt357%2Ffalcao99%2FFog2.png&hash=54a28ad17bde8c91d75dcc0bad2d18b3802b42e5)


Title: Re: Script Fog effects on map! V1.0
Post by: modern algebra on September 12, 2009, 04:55:25 PM
This looks very nice. I don't know why Fogs were taken out after XP
Title: Re: Script Fog effects on map! V1.0
Post by: Stunner on May 14, 2010, 10:23:40 AM
Can you toogle off the fog?  ???
Title: Re: Script Fog effects on map! V1.0
Post by: TheLeader13 on July 17, 2010, 05:51:45 PM
Sorry for bump, but yeah, is there a way to turn off the fog?
Title: Re: Script Fog effects on map! V1.0
Post by: cozziekuns on July 17, 2010, 05:56:01 PM
I'm guessing you could make a blank fog and just use:

$game_map.fog("Fog Name", Opacity, Zoom , Scroll_x, Scroll_y)
Title: Re: Script Fog effects on map! V1.0
Post by: Wiimeiser on July 18, 2010, 03:56:54 AM
Set zoom to 0