Lighting Effects with Additional Fogs
This script automatically loads additional light maps and shadow maps for every map for which proper pictures are present if the "Fogs" folder. Those maps act like fogs, but still let us use the normal fog. Detailed instructions are in the script, but if you'll have some questions regarding the functioning of the script post them in here.
Script:
Screen:
http://kushi.nazwa.pl/ar/rgss/images/leaf.jpg[/img]
Demo:
http://kushi.nazwa.pl/ar/rgss/demos/leaf.exe
Credits to Ludzix for the idea, and to me for bringing it to life
Compatibility issues not yet known.
This script automatically loads additional light maps and shadow maps for every map for which proper pictures are present if the "Fogs" folder. Those maps act like fogs, but still let us use the normal fog. Detailed instructions are in the script, but if you'll have some questions regarding the functioning of the script post them in here.
Script:
Code:
#=============================================================================
# ** Lighting Effects with Additional Fogs
#
# ** coded by arevulopapo, concept by Ludzix
# Jul 8th 2007
#=============================================================================
# This script automatically sets a light map and a shadow map for every game map
# if required files are present in the fogs folder. For shadow maps the file must
# be named sID.png, where ID is the Map ID. For example: for map with ID of 3
# the file should be named s3.png (only .png files are accepted for shadow maps).
# For light maps the file can be in either .png, .jpg or .bmp format. The name
# of the light map file must include the type of blending in which the file will
# be displayed over the game map. General file name is lID b_TYPE.EXT, where
# ID is the Map ID, TYPE is the blending type (0 - normal, 1 - additive,
# 2 - substractive) and EXT is of the extensions mentioned above.
# For game map No. 3, and additive blending the file should be named as follows:
# l3 b_1.jpg (the SPACE between Map ID and blending is required).
# Both maps are displayed over the tilemap/events and under the fog.
#=============================================================================
class Spriteset_Map
alias ssm_initialize initialize
alias ssm_dispose dispose
alias ssm_update update
def initialize
@shadow_layer = Sprite.new
@shadow_layer.z = 2900
@lighting_layer = Sprite.new
@lighting_layer.z = 2950
ssm_initialize
end
def dispose
@shadow_layer.dispose
@lighting_layer.dispose
ssm_dispose
end
def update
shadow = "Graphics/Fogs/s" + $game_map.map_id.to_s
light = "Graphics/Fogs/l" + $game_map.map_id.to_s
if FileTest.exist?(shadow + ".png")
@shadow_layer.bitmap = RPG::Cache.fog("s" + $game_map.map_id.to_s, 0)
else
@shadow_layer.bitmap = nil
end
if FileTest.exist?(light + " b_0.png") or FileTest.exist?(light + " b_0.jpg") or FileTest.exist?(light + " b_0.bmp")
@lighting_layer.bitmap = RPG::Cache.fog("l" + $game_map.map_id.to_s, 0)
@lighting_layer.blend_type = 0
elsif FileTest.exist?(light + " b_1.png") or FileTest.exist?(light + " b_1.jpg") or FileTest.exist?(light + " b_1.bmp")
@lighting_layer.bitmap = RPG::Cache.fog("l" + $game_map.map_id.to_s + " b_1", 0)
@lighting_layer.blend_type = 1
elsif FileTest.exist?(light + " b_2.png") or FileTest.exist?(light + " b_2.jpg") or FileTest.exist?(light + " b_2.bmp")
@lighting_layer.bitmap = RPG::Cache.fog("l" + $game_map.map_id.to_s + " b_2", 0)
@lighting_layer.blend_type = 2
else
@lighting_layer.bitmap = nil
end
@shadow_layer.ox = $game_map.display_x / 4
@shadow_layer.oy = $game_map.display_y / 4
@lighting_layer.ox = $game_map.display_x / 4
@lighting_layer.oy = $game_map.display_y / 4
ssm_update
end
end
Screen:
http://kushi.nazwa.pl/ar/rgss/images/leaf.jpg[/img]
Demo:
http://kushi.nazwa.pl/ar/rgss/demos/leaf.exe
Credits to Ludzix for the idea, and to me for bringing it to life
Compatibility issues not yet known.