Unlimited Fogs Version: 1.5
Based on version 1.2 by game_guy
Introduction
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!
Do be aware, the fogs applied with this script only appear after the field map(s) have been entered. As fast as it may be, only those fogs that are attached to tileets are created simultaneously. Fortunately,this script is only a supplement, able to work in tandem with the default system.
Features
Unlimited Fogs on Any Map
Change Fog's properties at any time
Easy to use script calls
Does not replace the existing fog system
Fog addition system functional with parallel processes (new v 1.4)
Missing fog files no longer crash the game (new v 1.3)
Fogs restore when exiting menu or loading saves (new v 1.5)
Script
Enjoy
Code:
#==============================================================================
# Unlimited Fogs
# -------------------------------------------------------------------------
# by DerVVulfman (February 26, 2024)
# Version 1.5
# Based on Unlimited Maps v 1.2 by game_guy
# RGSS / RPGMaker XP
#==============================================================================
#
# INTRODUCTION:
# =============
#
# 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!
#
# Do be aware, the fogs applied with this script only appear after the field
# map(s) have been entered. As fast as it may be, only those fogs that are
# attached to tileets are created simultaneously. Fortunately,this script is
# only a supplement, able to work in tandem with the default system.
#
#
#------------------------------------------------------------------------------
#
# FEATURES:
# =========
#
# * Unlimited Fogs on Any Map
# * Change Fog's properties at any time
# * Easy to use script calls
# * Does not replace the existing fog system
# * Fog addition system functional with parallel processes (new v 1.4)
# * Missing fog files no longer crash the game (new v 1.3)
# * Fogs restore when exiting menu or loading saves (new v 1.5)
#
#
#------------------------------------------------------------------------------
#
# INSTRUCTIONS:
# =============
# Paste below Scene_Debug and above main. If used with any other script that
# alters the environment, place Unlimited Maps below them in order to take
# advantage of its custom script calls.
#
# As there isn't anything to configure, let's get onto the script calls!
#
#
#------------------------------------------------------------------------------
#
# SCRIPT CALLS:
# =============
#
# Adding a fog:
# -------------
# This command adds a fog, defining its graphic and inserting it into the
# fogs array. Speed, depth and other factors are optional. This does not
# add or set default RPGMaker XP fog settings, but only that from this
# script.
#
# syntax: add_fog( index, file, [,z [,scroll_x [,scroll_y [,opacity
# [,zoom [,blend [,hue]]]]]]] )
#
# * index - The index/ID of the fog in the array, used to keep track of the
# fogs on screen (more on this later)
# * file - The filename for the fog read from your Graphics\Fogs folder
# * z - (Optional) The z-Depth of the defined fog. This is used for
# layering/overlapping. (Default: 3000)
# * scroll_x - (Optional) The fog's Horizontal scrolling speed. (Default: 0)
# * scroll_y - (Optional) The fog's Vertical scrolling speed. (Default: 0)
# * opacity - (Optional) Opacity of the fog in a 0-255 range. (Default: 64)
# * zoom - (Optional) Zoom level for the fog. (Default: 1.0)
# * blend - (Optional) The fog's blending mode in a 0-2 range:
# (0: Normal, 1: Add, 2: Subtract). (Default: 0)
# * hue - (Optional) Hue for the fog in a 0-360 range. (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_fox(1, "001-Fog01") - Works because all parameters after
# has a default value.
#
# This script call simply adds a fog with the set parameters.
#
# NOTE: Safeguards were put in place to ensure that this call may be
# used within a parallel process. Its execution is delayed until
# the current field map generated and actively displayed.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * * *
#
# Removing a fog:
# ---------------
# This script call simply removes a fog defined by this script. It does not
# erase/remove fogs defined by the default RPGMaker XP fog system.
#
# syntax: remove_fog( index )
#
# * index - The index/ID of the fog in the array, used to keep track of the
# fogs on screen. This is the index for the fog defined within
# the 'add_fog' command (above).
#
# ALERT: The field map must already be generated before use. Do not use
# within a parallel process unless adequate time has passed to
# generate/display the current map.
#
# ALERT: Deleting fogs may be based on index, but may also have a cascading
# effect. By that, deleting fog 1 may also delete fog 2, 3, 4...*
# However, deleting fog 4 will not delete fogs 1, 2, 3. Consider
# that when designing fogs that delete on cue.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * * *
#
# Retrieve a fog:
# ---------------
# This script returns the actual fog data so you can edit the fog's individual
# properties.
#
# syntax: returned = fogs( index )
#
# * returned - The actual fog data retrieved
# * index - The index/ID of the fog in the array, used to keep track of the
# fogs on screen. This is the index for the fog defined within
# the 'add_fog' command (above).
#
# Example: fog = fogs(1)
# fog.scroll_x = 2
# fog.scroll_y = 2
#
# The above example acquires the fog at index "1", and sets the scroll
# speeds for x and y directions to '2'.
#
# ALERT: The field map must already be generated before use. Do not use
# within a parallel process unless adequate time has passed to
# generate/display the current map.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# * * *
#
# Test Fog Existence:
# -------------------
# This script returns whether a fog exists in the array based upon the index
# position specified.
#
# syntax: returned = fogs?( index )
#
# * returned - If the fog exists (true/false)
# * index - The index/ID of the fog in the array, used to keep track of the
# fogs on screen. This is the index for the fog defined within
# the 'add_fog' command (above).
#
# Example: is_valid = fogs?(3)
# fog.scroll_x = 2
# fog.scroll_y = 2
#
# The above example acquires the fog at index "3", and stores the result
# into a variable named 'is_valid'. This value of this ariable will thus
# be either be true or false as a result.
#
# ALERT: The field map must already be generated before use. Do not use
# within a parallel process unless adequate time has passed to
# generate/display the current map.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#
#------------------------------------------------------------------------------
#
# FOG PROPERTIES:
# ===============
#
# These are the following properties and methods you can use when editing the
# individual fogs.
#
# * visible - Whether fog is visible or not (true/false)
# * opacity - Opacity of the fog. (0 to 255)
# * z - Z index or altitude 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: Normal, 1: Add, 2: Subtract).
# * filename - Filename of the fog: (new_file [, hue])
# + new_file = New fog file. (the .png extension not needed)
# + hue = Hue for new fog. (Default: 0 in 0-360 range)
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# The z-Depth property is the altitude level of the fog. The lower the value,
# the lower the altitude of the fog. And with that, you can set some fogs to
# overlap one another. But not only that, these fogs may apppear above and/or
# below certain graphic layers. Below are noted z-Depth settings:
#
# z-Depth Result
# -------------- ------
# -1001 or lower Any depth from here or below are drawn below even the tile-
# set's panorama layer. Technically, they would only be visi-
# sible if the panorama graphic had some transparencies.
#
# -1000 to -1 These depths draw the fog below the ground level, but above
# the tileset's panorama.
#
# 0 to 32 Fogs with Z-Depths in this range will draw over all tileset
# objects that have no priority level (the numbered stars).
# The Player sprite & map events that are not meant as ground
# effects (pits, trap tiles, etc) are not covered by the fogs.
#
# 564 on up Fogs with Z-depths from 560 on up will draw over all tileset
# objects, the player and most nominally sized events. Events
# that have individual frame heights beyond 64px would appear
# uncovered by fog when near the bottom of the screen. So its
# advised to have a larger setting.
#
# 999 or lower Fogs with z-Depths here or lower will appear below normally
# defined weather effects made with RPGMaker XP.
#
# 1000 or above Fogs with z-Depths from here on up will appear over weather
# effects created with RPGMaker XP.
#
# 2999 or lower Fogs with z-Depths from here or below appear below the de-
# default RPGMaker XP fog layer.
#
# 3000 or above Fogs with z-Depths from here on up appear over the default
# RPGMaker XP fog layer.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Fogs cannot be drawn over 'Pictures' as pictures are placed within a separate
# viewport than tiles, sprites, fogs... etc.
#
#
#------------------------------------------------------------------------------
#
# PARALLEL PROCESSES:
# ===================
#
# As this system does not perform direct edits to the Spriteset_Map class, all
# custom fogs and their subsequent properties can only be applied after the
# field map is already generated. However, parallel processes may operate so
# quickly that the script calls from Multiple Fogs may not function, and could
# generate errors.
#
# Of the commands built within, only the 'add_fog' command has a built-in pro-
# tection feature, allowing it to work within parallel processes without worry
# of system crash. It does so by pausing the actual actions from executing un-
# til the field map is generated
#
# The other commands however do not gain this protection. Of these commands,
# the fogs(index) command is the most affected. This because the name of the
# command was identical to the name of the fogs array this script attaches to
# the Spriteset_Map class.
#
# However unprotected, these script calls may be employed within those events
# set as a parallel process that executes immediately. One need only place a
# simple 1-frame wait command be placed and executed before the script calls.
#
# Example:
# List of Event Commands:
# ┌───────────────────────────────────────────
# │ @>Script: add_fog(1, "001-Fog01", 3200)
# │ @>Wait: 1 frame(s)
# │ @>Script: fogs(1).opacity = 240
# │ : : fogs(1).hue = 60
# │ @>Erase Event
# │ @>
# │
#
# The above example functions safely, even if it is a parallel process that is
# executed at the very start of a map. The 'add_fog' command protected by its
# built-in safeguards, and the following 'fogs' entries only performed after a
# wait command that need only give a 1-frame delay.
#
#
#------------------------------------------------------------------------------
#
# FINAL NOTES:
# ============
#
# That's about it. This script does not replace the default fog system built
# into the default scripts, but creates a secondary fog system that may be
# used in tandem.
#
# Due take warning that the more fogs you add, the more lag you'll probable
# run into. Adding an extra two or three shouldn't hurt too much though. ;)
#
#
#==============================================================================
#
# VERSION HISTORY:
# ================
#
# Ver MM/DD/YYYY - Changes
# --- ---------- --------------------
# 1.0 - 04/09/2012 - Original Release
# 1.1 - 04/09/2012 - Corrected a typo in the script
# 1.2 - 10/12/2013 - Rewrite & new params for Heretic's Cloud Altitude support
# 1.3 - 02/25/2024 - Update to prevent crashing and allow parallel process use
# 1.4 - 02/26/2024 - Update for key commands incapable of protections
# 1.5 - 03/08/2024 - Included Heretic's fog-retention code
#
#
#==============================================================================
#
# COMPATABILITY:
# ==============
#
# Designed for RPGMaker XP. Compatible with the default scripts and scripts
# that do not adversely alter the fog system.
#
#
#==============================================================================
#
# CREDITS AND TERMS:
# ==================
#
# Initial version by game_guy
# LiTTleDRAgo for the original idea
# Heretic for stand-alone fog retention code. Restores fogs when exiting menus
# DerVVulfman for rewriting comments, fixing system to permit parallel process
# functionality and updating the Fog Cache system to prevent crashes if no file
# exists.
#
# Free for use, even in commercial scripts. Due credit to all involved is
# the only requirement.
#
#
#==============================================================================
#==============================================================================
# ** RPG::Cache
#------------------------------------------------------------------------------
# The module that loads each of RPGXP's graphic formats, creates a Bitmap
# object, and retains it.
#==============================================================================
module RPG::Cache
#------------------------------------------------------------------------
# * Fogs
# filename : filename of the cached bitmap
# hue : hue of the cached bitmap
#------------------------------------------------------------------------
def self.fog(filename, hue=0)
begin
self.load_bitmap("Graphics/Fogs/", filename, hue)
rescue
self.load_bitmap("Graphics/Fogs/", "", hue)
end
end
end
#==============================================================================
# ** UFogs_Structure
#------------------------------------------------------------------------------
# This is the data class that defines the structure for unlimited fogs.
#==============================================================================
class UFogs_Structure
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :file # Fog filename
attr_accessor :index # Index of individual fog
attr_accessor :z # Z-Depth / Altitude of fog
attr_accessor :scroll_x # Horizontal scrolling
attr_accessor :scroll_y # Vertical scrolling
attr_accessor :opacity # Fog opacity
attr_accessor :zoom # Fog magnification
attr_accessor :blend # Fog blend style
attr_accessor :hue # Fog hue
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :fogs_settings # Holds settings for Unlimited Fogs
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias gg_fogs_init_game_system_lat initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
# Perform the original method
gg_fogs_init_game_system_lat
#
# Create an array for the unlimited fog settings
# Permites their ability to be recorded in game saves
@fogs_settings = []
#
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias gg_fogs_setup_game_map_lat setup
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
def setup(map_id)
#
# Perform the original method
gg_fogs_setup_game_map_lat(map_id)
#
# Clears the unlimited fog settings on each new map
$game_system.fogs_settings = []
#
end
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias gg_fogs_init_spriteset_map_lat initialize
alias gg_fogs_update_spriteset_map_lat update
alias gg_fogs_dispose_spriteset_map_lat dispose
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#
# Create the multiple fogs array
@fogs = []
#
# Perform the original method
gg_fogs_init_spriteset_map_lat
#
# Check each Fogs to make sure they all exist
for fog in $game_system.fogs_settings
#
# Skip if not a valid 'unlimited' fog
next unless (fog and not @fogs[fog.index])
#
# Duplicate the fog structure
cfg = fog.clone
#
# Retrieve content about selected fog
index = cfg.index
file = cfg.file
z = cfg.z
scroll_x = cfg.scroll_x
scroll_y = cfg.scroll_y
opacity = cfg.opacity
zoom = cfg.zoom
blend = cfg.blend
hue = cfg.hue
#
# Reload the fog with the retrieved fog data
add_fog(index, file, z, scroll_x, scroll_y, opacity, zoom, blend, hue)
#
end
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Cycle through and update all fogs
@fogs.each {|fog| fog.update if fog != nil }
#
# Perform the original method
gg_fogs_update_spriteset_map_lat
#
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
#
# Cycle through and dispose all fogs
@fogs.each {|fog| fog.dispose if fog != nil }
#
# Perform the original method
gg_fogs_dispose_spriteset_map_lat
#
end
#--------------------------------------------------------------------------
# * Get fog by index
# index : index of fog
#--------------------------------------------------------------------------
def fogs(index)
#
# Set the fog to an empty plane if no fog exists for the index position
@fogs[index] = ScrollPlane.new(@viewport1, index) if @fogs[index].nil?
#
# Return the fog at the index position
return @fogs[index]
#
end
#--------------------------------------------------------------------------
# * Determine if fog exists
# index : index of fog
#--------------------------------------------------------------------------
def fogs?(index)
#
# Return false if no fog exists at the index position
return false if @fogs[index].nil?
#
# Return true
return true
#
end
#--------------------------------------------------------------------------
# * Add Fog
# index : index of defined fog
# file : fog file name
# z : fog z-depth
# ox : fog graphic x-origin
# oy : fog graphic y-origin
# opacity : fog opacity level (0-255)
# zoom : fog zoom rate
# blend : fog blending method
# hue : fog hue (0 to 360)
#--------------------------------------------------------------------------
def add_fog(index, file, z = 3000, scroll_x = 0, scroll_y = 0, opacity = 64,
zoom = 1.0, blend = 0, hue = 0)
#
# Erase previous fog at index
remove_fog(index)
#
# Create the new fog object from ScrollPlane
fog = ScrollPlane.new(@viewport1, index)
#
# Set the individual settings to the fog object
fog.bitmap = RPG::Cache.fog(file, hue)
fog.z = z
fog.blend_type = blend
fog.opacity = opacity
fog.zoom = zoom
fog.scroll_x = scroll_x
fog.scroll_y = scroll_y
@fogs[index] = fog
#
# Obtain the structure data object for ths current fog
cfg = $game_system.fogs_settings[index]
#
# Set the settings within the current fog's data object
cfg.file = file
cfg.z = z
cfg.scroll_x = scroll_x
cfg.scroll_y = scroll_y
cfg.opacity = opacity
cfg.zoom = zoom
cfg.blend = blend
cfg.hue = hue
#
end
#--------------------------------------------------------------------------
# * Remove Fog
# index : index of fog
#--------------------------------------------------------------------------
def remove_fog(index)
#
# Exit if no fog at index position
return if @fogs[index].nil?
#
# Dispose of fog
@fogs[index].dispose
@fogs[index] = nil
#
# Remove from Stored Settings
$game_system.fogs_settings.delete_at(index)
#
end
end
#==============================================================================
# ** ScrollPlane
#------------------------------------------------------------------------------
# This creates a specialized scrolling plane class. Inheriting from the Plane
# class itself, it generates special sprites that tile bitmap patterns across
# the entire screen, and are used to display panoramas and fogs.
#==============================================================================
class ScrollPlane < Plane
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil, index = nil)
#
# Inherit from the Plane Superclass
super(viewport)
#
# Establish startup values
@scroll_x = 0
@scroll_y = 0
@real_ox = 0
@real_oy = 0
@index = index
#
# Create Struct to store in Game System for each Fog
cfg = UFogs_Structure.new
#
# Save each Setting in Struct
cfg.index = @index
#
# Put Struct into Game Settings by Index
$game_system.fogs_settings[@index] = cfg
#
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Manage fog scrolling
@real_ox -= @scroll_x / 8.0
@real_oy -= @scroll_y / 8.0
#
# Update fog plane
self.ox = $game_map.display_x / 4 + @real_ox
self.oy = $game_map.display_y / 4 + @real_oy
#
#
end
#--------------------------------------------------------------------------
# * Get current spriteset for map
#--------------------------------------------------------------------------
def spriteset
#
# Get current spriteset if in the field map
return $scene.spriteset if $scene.is_a?(Scene_Map)
#
# Return non-existence
return nil
#
end
#------------------------------------------------------------------------
# * Fog Filename
# filename : filename of the fog bitmap
# hue : hue of the fog bitmap
#------------------------------------------------------------------------
def filename(filename, hue = 0)
#
self.bitmap = RPG::Cache.fog(filename, hue)
#
end
#------------------------------------------------------------------------
# * Set Filename
# value : filename of the fog bitmap
#------------------------------------------------------------------------
def file=(value)
#
# Acquire hue from fog settings
hue = $game_system.fogs_settings[@index].hue
#
# Apply filename value to fog settings
$game_system.fogs_settings[@index].file = value
#
# Reload the fog with the supplied name and loaded hue settings
self.bitmap = RPG::Cache.fog(value, hue)
#
end
#------------------------------------------------------------------------
# * Set z-Depth
# value : z-Depth of fog
#------------------------------------------------------------------------
def z=(value)
#
# Apply z-depth value to fog settings
$game_system.fogs_settings[@index].z = value
#
# Pass the value into the the Superclass's z-Depth method
super(value)
#
end
#------------------------------------------------------------------------
# * Set Horizontal Scroll
# value : degree of scroll
#------------------------------------------------------------------------
def scroll_x=(value)
#
# Apply horizontal scrolling value to fog settings
$game_system.fogs_settings[@index].scroll_x = value
#
# Update the current horizontal scroll value
@scroll_x = value
#
end
#------------------------------------------------------------------------
# * Set Vertical Scroll
# value : degree of scroll
#------------------------------------------------------------------------
def scroll_y=(value)
#
# Apply vertical scrolling value to fog settings
$game_system.fogs_settings[@index].scroll_y = value
#
# Update the current vertical scroll value
@scroll_y = value
#
end
#------------------------------------------------------------------------
# * Set Opacity
# value : opacity level of fog
#------------------------------------------------------------------------
def opacity=(value)
#
# Apply opacity value to fog settings
$game_system.fogs_settings[@index].opacity = value
#
# Pass the value into the the Superclass's opacity method
super(value)
#
end
#------------------------------------------------------------------------
# * Set Zoom
# value : degree of zoom
#------------------------------------------------------------------------
def zoom=(value)
#
# Apply magnification value to fog settings
$game_system.fogs_settings[@index].zoom = value
#
# Update the zoom magnification
self.zoom_x = value
self.zoom_y = value
#
end
#------------------------------------------------------------------------
# * Set Opacity
# value : opacity level of fog
#------------------------------------------------------------------------
def blend=(value)
#
# Apply blend style value to fog settings
$game_system.fogs_settings[@index].blend = value
#
# Update image blend style
self.blend_type = value
#
end
#------------------------------------------------------------------------
# * Set Hue
# value : hue shift of the fog bitmap
#------------------------------------------------------------------------
def hue=(value)
#
# Acquire filename from fog settings
file = $game_system.fogs_settings[@index].file
#
# Apply hue shift value to fog settings
$game_system.fogs_settings[@index].hue = value
#
# Reload the fog with the loaded name and supplied hue settings
self.bitmap = RPG::Cache.fog(file, value)
#
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Class Variables
#--------------------------------------------------------------------------
@@fog_cmd = []
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias dvv_parallel_process_permitting_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
#
# Perform execution of spriteset command
execute_spriteset
#
# Perform the original method
dvv_parallel_process_permitting_update
#
end
#--------------------------------------------------------------------------
# * Perform execution of spriteset command
#--------------------------------------------------------------------------
def execute_spriteset
#
# Exit if no spriteset and/or no fog command
return if spriteset.nil?
return if @@fog_cmd == []
#
# Execute spriteset command with stored value
spriteset.add_fog(@@fog_cmd[0], @@fog_cmd[1], @@fog_cmd[2], @@fog_cmd[3],
@@fog_cmd[4],@@fog_cmd[5], @@fog_cmd[6],@@fog_cmd[7], @@fog_cmd[8])
#
# Clear fog command class variable
@@fog_cmd = []
#
end
#--------------------------------------------------------------------------
# * Get current spriteset for map
#--------------------------------------------------------------------------
def spriteset
#
# Get current spriteset if in the field map
return $scene.spriteset if $scene.is_a?(Scene_Map)
#
# Return non-existence
return nil
#
end
#--------------------------------------------------------------------------
# * Add Fog
# index : index of defined fog
# file : fog file name
# z : fog z-depth
# ox : fog graphic x-origin
# oy : fog graphic y-origin
# opacity : fog opacity level (0-255)
# zoom : fog zoom rate
# blend : fog blending method
# hue : fog hue (0 to 360)
#--------------------------------------------------------------------------
def add_fog(index, file, z = 3000, ox = 0, oy = 0, opacity = 64, zoom = 1.0,
blend = 0, hue = 0)
#
# Store contents of command into class variable for execution
@@fog_cmd = [ index, file, z, ox, oy, opacity, zoom, blend, hue ]
#
end
#--------------------------------------------------------------------------
# * Remove Fog
# index : index of fog
#--------------------------------------------------------------------------
def remove_fog(index)
#
# Immediately remove defined fog from spriteset
spriteset.remove_fog(index)
#
end
#--------------------------------------------------------------------------
# * Get fog by index
# index : index of fog
#--------------------------------------------------------------------------
def fogs(index)
#
# Immediately fog parameters into spriteset
return spriteset.fogs(index)
#
end
#--------------------------------------------------------------------------
# * Determine if fog exists
# index : index of fog
#--------------------------------------------------------------------------
def fogs?(index)
#
# Immediately execute test for fog in current spriteset
return spriteset.fogs?(index)
#
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :spriteset # spriteset
end
Instructions
Paste below Scene_Debug and above main. If used with any other script that alters the environment, place Unlimited Maps below them in order to take advantage of its custom script calls.
As there isn't anything to configure, let's get onto the script calls!
Compatibility
Designed for RPGMaker XP. Compatible with the default scripts and scripts that do not adversely alter the fog system.
Credits and Thanks
Initial version by game_guy
LiTTleDRAgo for the original idea
Heretic for the Fog-Backup system
Terms and Conditions
Free for use, even in commercial scripts. Due credit to all involved is the only requirement.
This update fixes an issue with the assistance of code created by Heretic. This code provided a backup of all fogs created by the system and restored the fogs when you exited the menu and/or loaded a saved game.
Until then, the fogs would merely vanish upon entering the main menu, for them not to be present anymore. But now, that issue is no longer the case.
Also, the instructions now include general information on the z-depths (or altitudes) you may set fogs, if you want them above the generated weather, above the default fog layer, or if below the tileset or even below the default panorama itself.
Hey DerVVulfman, I think the script is really cool and very useful for using multiple fogs! However, I found a small bug. I’m not sure if it’s actually a bug, but when I create a slightly larger map and walk around, then open the menu and return to the map, the fog positions don’t quite line up correctly.
I can show you an example in a GIF to demonstrate the bug and see if it’s normal: https://ibb.co/Thy7CG6 (Sorry, I'm not sure if I'm allowed to post this link.) P.S. The GIF has German text, but you don’t need to pay attention to it. :)