#=============================================================================== # # Yanfly Engine Zealous - Variable Backdrops # Last Date Updated: 2010.02.07 # Level: Normal # # One of the greatest things to come out of RPG Maker 2003 that didn't appear in # any of its successors was moving backdrops during battle. There was a front # layer and then a back layer and it broke the monotony of a static background. # This script lets you recreate all of that with ease and control it with ease. # Just change a variable value inside the event editor and you'll receive the # listed backdrop found in the hash within this script. # # Also now, when a backdrop variable changes during battle, its graphic will # update and show the newer backdrop. This allows for interesting battles where # scenes are constantly shifting and whatnot. # #=============================================================================== # Updates # ----------------------------------------------------------------------------- # o 2010.02.07 - Started Script and Finished. #=============================================================================== # Instructions # ----------------------------------------------------------------------------- # To install this script, open up your script editor and copy/paste this script # to an open slot below ▼ Materials but above ▼ Main. Remember to save. # # - Download Backdrops from Pockethouse.com and unzip it to your Graphics folder # into your "Parallaxes" folder. # - Bind BATTLE_SHADOW_SWITCH to a switch. By default, it's 60. # - Bind the following to variables # VARIABLE_MIST_OPACITY - Default 56 - Adjusts the mist opacity. # VARIABLE_MIST_IMAGE - Default 57 - Sets the fog that covers enemies. # VARIABLE_FRONT_IMAGE - Default 58 - Front background layer. # VARIABLE_MIDDLE_IMAGE - Default 59 - Middle background layer. # VARIABLE_BACK_IMAGE - Default 60 - Back background layer. # # Change the variables in your event editor to reflect the backdrop you want to # see in battle. Toggle the BATTLE_SHADOW_SWITCH switch if you want to hide/show # the floor shadow inbattle. Adjust the hashes down below if you want to add # more backdrops to your game. # #=============================================================================== # Compatibility # ----------------------------------------------------------------------------- # - Works With: Nearly everything that doesn't affect backdrops. # ----------------------------------------------------------------------------- # Note: This script may not work with former Yanfly Engine ReDux scripts. # Use Yanfly Engine Zealous scripts to work with this if available. #=============================================================================== $imported = {} if $imported == nil $imported["VariableBackdrops"] = true module YEZ module BACKDROP # This switch enables and disables the ground battle shadow behind enemies. # If the switch is on, the battle shadow appears. If the switch is off, # it will disappear. BATTLE_SHADOW_SWITCH = 60 # These variables determine the individual backdrops adjusted for their # individual layers. There's four images that can be shown at once. VARIABLE_MIST_OPACITY = 56 VARIABLE_MIST_IMAGE = 57 VARIABLE_FRONT_IMAGE = 58 VARIABLE_MIDDLE_IMAGE = 59 VARIABLE_BACK_IMAGE = 60 # This hash determines the images and settings used for backdrops. # wx - Wait this number of frames before increasing dx # wy - Wait this number of frames before increasing dy # ox - Rate the plane moves horizontally right. Negative for left. # oy - Rate the plane moves horizontally up. Negative for down. BACKDROP_HASH ={ # ID => [wx, wy, ox, oy, Backdrop Name] 100 => [ 0, 0, 0, 0, "inner"], 101 => [ 0, 0, 0, 0, "grassland"], 102 => [ 0, 0, 0, 0, "woods"], 103 => [ 0, 0, 0, 0, "forest"], 104 => [ 0, 0, 0, 0, "mountain"], 105 => [ 0, 0, 0, 0, "beach"], 106 => [ 0, 0, 0, 0, "desert"], 107 => [ 0, 0, 0, 0, "swamp"], 108 => [ 0, 0, 0, 0, "snow"], 109 => [ 0, 0, 0, 0, "castletown"], 110 => [ 0, 0, 0, 0, "porttown"], 111 => [ 0, 0, 0, 0, "posttown"], 112 => [ 0, 0, 0, 0, "foresttown"], 113 => [ 0, 0, 0, 0, "minetown"], 114 => [ 0, 0, 0, 0, "deserttown"], 115 => [ 0, 0, 0, 0, "snowtown"], 116 => [ 0, 0, 0, 0, "farmvillage"], 117 => [ 0, 0, 0, 0, "castleoutside"], 118 => [ 0, 0, 0, 0, "castlethrone"], 119 => [ 0, 0, 0, 0, "castledungeon"], 120 => [ 0, 0, 0, 0, "churchoutside"], 121 => [ 0, 0, 0, 0, "churchinner"], 122 => [ 0, 0, 0, 0, "shipoutside"], 123 => [ 0, 0, 0, 0, "shipinside"], 124 => [ 0, 0, 0, 0, "heaven"], 125 => [ 0, 0, 0, 0, "heaveninner"], 126 => [ 0, 0, 0, 0, "bridge"], 127 => [ 0, 0, 0, 0, "ruins"], 128 => [ 0, 0, 0, 0, "shop"], 129 => [ 0, 0, 0, 0, "fort"], 130 => [ 0, 0, 0, 0, "fortinner"], 131 => [ 0, 0, 0, 0, "tower"], 132 => [ 0, 0, 0, 0, "evilcastle"], 133 => [ 0, 0, 0, 0, "towerinner"], 134 => [ 0, 0, 0, 0, "dungeonentrance"], 135 => [ 0, 0, 0, 0, "cave"], 136 => [ 0, 0, 0, 0, "magma"], 137 => [ 0, 0, 0, 0, "icecave"], 138 => [ 0, 0, 0, 0, "watercave"], 139 => [ 0, 0, 0, 0, "mine"], 140 => [ 0, 0, 0, 0, "sewer"], 141 => [ 0, 0, 0, 0, "innerbody"], 142 => [ 0, 0, 0, 0, "darkspace"], # ID => [wx, wy, ox, oy, Backdrop Name] 200 => [ 5, 5, 1, 1, "cloudswhite"], 201 => [ 5, 5, 1, 1, "cloudsgrey"], 202 => [ 5, 10, -1, -1, "cloudsblack"], 203 => [10, 5, 1, 1, "cloudsblue"], 204 => [ 5, 5, -1, 1, "cloudspurple"], 205 => [ 5, 10, 1, -1, "cloudsred"], 206 => [10, 5, -1, 1, "cloudsorange"], 207 => [ 5, 5, 1, 1, "cloudsyellow"], 208 => [ 5, 10, 1, -1, "cloudsgreen"], # ID => [wx, wy, ox, oy, Backdrop Name] 300 => [ 0, 0, 0, 0, "sun"], 301 => [ 0, 0, 0, 0, "cloudy"], 302 => [ 0, 0, 0, 0, "sunset"], 303 => [ 0, 0, 0, 0, "nightsky"], 304 => [ 0, 0, 0, 0, "mountains"], 305 => [ 0, 0, 0, 0, "ocean"], 306 => [ 0, 0, 0, 0, "weird"], 307 => [ 0, 0, 0, 0, "earth"], 308 => [ 0, 0, 0, 0, "moon"], 309 => [ 0, 0, 0, 0, "redstar"], 310 => [ 0, 0, 0, 0, "galaxy"], } # Do not remove this. # This will let you set how you would like your backdrops to appear when # you start a new game. In the order of Battle Shadow, Mist Opacity, Mist # Layer, Front Layer, Middle Layer, and Back Layer. STARTING_BACKDROPS = [false, 0, 0, 101, 200, 310] # This will adjust how you would like the backdrops to appear when battle # testing. Same ordering as above. BTEST_BACKDROPS = [false, 0, 0, 101, 200, 304] end # BACKDROP end # YEZ #=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #=============================================================================== #=============================================================================== # Game_Interpreter #=============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # alias method: command_121 switches #-------------------------------------------------------------------------- alias command_121_vb command_121 unless $@ def command_121 result = command_121_vb if $game_temp.in_battle and $scene.is_a?(Scene_Battle) if @params[0] == YEZ::BACKDROP::BATTLE_SHADOW_SWITCH $scene.spriteset.create_battlefloor end end return result end #-------------------------------------------------------------------------- # alias method: command_122 variables #-------------------------------------------------------------------------- alias command_122_vb command_122 unless $@ def command_122 result = command_122_vb if $game_temp.in_battle and $scene.is_a?(Scene_Battle) n = $game_variables[@params[0]] case @params[0] when YEZ::BACKDROP::VARIABLE_MIST_IMAGE $scene.spriteset.create_backdrop(n, nil, nil, nil) when YEZ::BACKDROP::VARIABLE_FRONT_IMAGE $scene.spriteset.create_backdrop(nil, n, nil, nil) when YEZ::BACKDROP::VARIABLE_MIDDLE_IMAGE $scene.spriteset.create_backdrop(nil, nil, n, nil) when YEZ::BACKDROP::VARIABLE_BACK_IMAGE $scene.spriteset.create_backdrop(nil, nil, nil, n) end end return result end end # Game_Interpreter #=============================================================================== # Spriteset_Battle #=============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # alias method: create_battleback #-------------------------------------------------------------------------- alias create_battleback_vb create_battleback unless $@ def create_battleback new_backdrop = false v0 = $game_variables[YEZ::BACKDROP::VARIABLE_MIST_IMAGE] v1 = $game_variables[YEZ::BACKDROP::VARIABLE_FRONT_IMAGE] v2 = $game_variables[YEZ::BACKDROP::VARIABLE_MIDDLE_IMAGE] v3 = $game_variables[YEZ::BACKDROP::VARIABLE_BACK_IMAGE] new_backdrop = true if YEZ::BACKDROP::BACKDROP_HASH.include?(v1) new_backdrop = true if YEZ::BACKDROP::BACKDROP_HASH.include?(v2) new_backdrop = true if YEZ::BACKDROP::BACKDROP_HASH.include?(v3) v0 = 0 unless YEZ::BACKDROP::BACKDROP_HASH.include?(v0) v1 = 0 unless YEZ::BACKDROP::BACKDROP_HASH.include?(v1) v2 = 0 unless YEZ::BACKDROP::BACKDROP_HASH.include?(v2) v3 = 0 unless YEZ::BACKDROP::BACKDROP_HASH.include?(v3) if new_backdrop create_backdrop(v0, v1, v2, v3) else create_battleback_vb end end #-------------------------------------------------------------------------- # alias method: create_battlefloor #-------------------------------------------------------------------------- alias create_battlefloor_vb create_battlefloor unless $@ def create_battlefloor @battlefloor_sprite.dispose if @battlefloor_sprite != nil if $game_switches[YEZ::BACKDROP::BATTLE_SHADOW_SWITCH] create_battlefloor_vb else @battlefloor_sprite = Sprite.new(@viewport1) end end #-------------------------------------------------------------------------- # new method: create_backdrop #-------------------------------------------------------------------------- def create_backdrop(v0 = nil, v1 = nil, v2 = nil, v3 = nil) @backdrop_data = {} if @backdrop_data == nil @backdrop_counter = {} if @backdrop_counter == nil if v3 != nil and v3 != 0 array = YEZ::BACKDROP::BACKDROP_HASH[v3] @backdrop_counter[:b3_x] = 0 @backdrop_counter[:b3_y] = 0 @backdrop_data[:b3_wx] = array[0] @backdrop_data[:b3_wy] = array[1] @backdrop_data[:b3_ox] = array[2] @backdrop_data[:b3_oy] = array[2] @battleback3_sprite.dispose if @battleback3_sprite != nil @battleback3_sprite = Plane.new @battleback3_sprite.bitmap = Cache.parallax(array[4]) @battleback3_sprite.z = -100 elsif v3 == 0 @battleback3_sprite.dispose if @battleback3_sprite != nil @battleback3_sprite = nil end if v2 != nil and v2 != 0 array = YEZ::BACKDROP::BACKDROP_HASH[v2] @backdrop_counter[:b2_x] = 0 @backdrop_counter[:b2_y] = 0 @backdrop_data[:b2_wx] = array[0] @backdrop_data[:b2_wy] = array[1] @backdrop_data[:b2_ox] = array[2] @backdrop_data[:b2_oy] = array[2] @battleback2_sprite.dispose if @battleback2_sprite != nil @battleback2_sprite = Plane.new @battleback2_sprite.bitmap = Cache.parallax(array[4]) @battleback2_sprite.z = -99 elsif v2 == 0 @battleback2_sprite.dispose if @battleback2_sprite != nil @battleback2_sprite = nil end if v1 != nil and v1 != 0 array = YEZ::BACKDROP::BACKDROP_HASH[v1] @backdrop_counter[:b1_x] = 0 @backdrop_counter[:b1_y] = 0 @backdrop_data[:b1_wx] = array[0] @backdrop_data[:b1_wy] = array[1] @backdrop_data[:b1_ox] = array[2] @backdrop_data[:b1_oy] = array[2] @battleback_sprite.dispose if @battleback_sprite != nil @battleback_sprite = Plane.new @battleback_sprite.bitmap = Cache.parallax(array[4]) @battleback_sprite.z = -98 if @battleback_sprite.bitmap.width > Graphics.width @battleback_sprite.ox = (@battleback_sprite.bitmap.width - Graphics.width)/2 end @battleback_sprite.oy = @battleback_sprite.bitmap.height - Graphics.height elsif v1 == 0 @battleback_sprite = Sprite.new(@viewport1) end if v0 != nil and v0 != 0 array = YEZ::BACKDROP::BACKDROP_HASH[v0] @backdrop_counter[:b0_x] = 0 @backdrop_counter[:b0_y] = 0 @backdrop_data[:b0_wx] = array[0] @backdrop_data[:b0_wy] = array[1] @backdrop_data[:b0_ox] = array[2] @backdrop_data[:b0_oy] = array[2] @battleback0_sprite.dispose if @battleback0_sprite != nil @battleback0_sprite = Plane.new @battleback0_sprite.bitmap = Cache.parallax(array[4]) op = $game_variables[YEZ::BACKDROP::VARIABLE_MIST_OPACITY] op = [[op, 255].min, 0].max @battleback0_sprite.opacity = op elsif v0 == 0 @battleback0_sprite.dispose if @battleback0_sprite != nil @battleback0_sprite = nil end end #-------------------------------------------------------------------------- # alias method: dispose_battleback_bitmap #-------------------------------------------------------------------------- alias dispose_battleback_bitmap_vb dispose_battleback_bitmap unless $@ def dispose_battleback_bitmap @battleback3_sprite.bitmap.dispose if @battleback3_sprite != nil @battleback2_sprite.bitmap.dispose if @battleback2_sprite != nil dispose_battleback_bitmap_vb @battleback0_sprite.bitmap.dispose if @battleback0_sprite != nil end #-------------------------------------------------------------------------- # alias method: dispose_battleback #-------------------------------------------------------------------------- alias dispose_battleback_vb dispose_battleback unless $@ def dispose_battleback @battleback3_sprite.dispose if @battleback3_sprite != nil @battleback2_sprite.dispose if @battleback2_sprite != nil dispose_battleback_vb @battleback0_sprite.dispose if @battleback0_sprite != nil end #-------------------------------------------------------------------------- # alias method: update_battleback #-------------------------------------------------------------------------- alias update_battleback_vb update_battleback unless $@ def update_battleback if @battleback0_sprite != nil and @battleback0_sprite.is_a?(Plane) @backdrop_counter[:b0_x] += 1 if @backdrop_data[:b0_wx] > 0 @backdrop_counter[:b0_y] += 1 if @backdrop_data[:b0_wy] > 0 if @backdrop_counter[:b0_x] > @backdrop_data[:b0_wx] @battleback0_sprite.ox += @backdrop_data[:b0_ox] @backdrop_counter[:b0_x] = 0 end if @backdrop_counter[:b0_y] > @backdrop_data[:b0_wy] @battleback0_sprite.oy += @backdrop_data[:b0_oy] @backdrop_counter[:b0_y] = 0 end end #--- if @battleback_sprite != nil and @battleback_sprite.is_a?(Plane) @backdrop_counter[:b1_x] += 1 if @backdrop_data[:b1_wx] > 0 @backdrop_counter[:b1_y] += 1 if @backdrop_data[:b1_wy] > 0 if @backdrop_counter[:b1_x] > @backdrop_data[:b1_wx] @battleback_sprite.ox += @backdrop_data[:b1_ox] @backdrop_counter[:b1_x] = 0 end if @backdrop_counter[:b1_y] > @backdrop_data[:b1_wy] @battleback_sprite.oy += @backdrop_data[:b1_oy] @backdrop_counter[:b1_y] = 0 end end #--- if @battleback2_sprite != nil and @battleback2_sprite.is_a?(Plane) @backdrop_counter[:b2_x] += 1 if @backdrop_data[:b2_wx] > 0 @backdrop_counter[:b2_y] += 1 if @backdrop_data[:b2_wy] > 0 if @backdrop_counter[:b2_x] > @backdrop_data[:b2_wx] @battleback2_sprite.ox += @backdrop_data[:b2_ox] @backdrop_counter[:b2_x] = 0 end if @backdrop_counter[:b2_y] > @backdrop_data[:b2_wy] @battleback2_sprite.oy += @backdrop_data[:b2_oy] @backdrop_counter[:b2_y] = 0 end end #--- if @battleback3_sprite != nil and @battleback3_sprite.is_a?(Plane) @backdrop_counter[:b3_x] += 1 if @backdrop_data[:b3_wx] > 0 @backdrop_counter[:b3_y] += 1 if @backdrop_data[:b3_wy] > 0 if @backdrop_counter[:b3_x] > @backdrop_data[:b3_wx] @battleback3_sprite.ox += @backdrop_data[:b3_ox] @backdrop_counter[:b3_x] = 0 end if @backdrop_counter[:b3_y] > @backdrop_data[:b3_wy] @battleback3_sprite.oy += @backdrop_data[:b3_oy] @backdrop_counter[:b3_y] = 0 end end #--- return if @battleback_sprite.is_a?(Plane) update_battleback_vb end end # Spriteset_Battle #=============================================================================== # Scene_Battle #=============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # alias method: create_game_objects #-------------------------------------------------------------------------- alias create_game_objects_vb create_game_objects unless $@ def create_game_objects create_game_objects_vb if $BTEST array = YEZ::BACKDROP::BTEST_BACKDROPS else array = YEZ::BACKDROP::STARTING_BACKDROPS end $game_switches[YEZ::BACKDROP::BATTLE_SHADOW_SWITCH] = array[0] $game_variables[YEZ::BACKDROP::VARIABLE_MIST_OPACITY] = array[1] $game_variables[YEZ::BACKDROP::VARIABLE_MIST_IMAGE] = array[2] $game_variables[YEZ::BACKDROP::VARIABLE_FRONT_IMAGE] = array[3] $game_variables[YEZ::BACKDROP::VARIABLE_MIDDLE_IMAGE] = array[4] $game_variables[YEZ::BACKDROP::VARIABLE_BACK_IMAGE] = array[5] end end # Scene_Title #=============================================================================== # Scene_Battle #=============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :spriteset end # Scene_Battle #=============================================================================== # # END OF FILE # #===============================================================================