#=============================================================================== # # Yanfly Engine RD - Variable Controlled Backdrops # Last Date Updated: 2009.05.23 # 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. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.05.23 - Fixed a mist layer disposing problem. # o 2009.05.21 - Provided an option to set starting backdrops. # o 2009.05.17 - Finished resource pack. # o 2009.05.16 - Started script and finished. #=============================================================================== # Instructions #=============================================================================== # # The instructions are relatively simple, but you cannot neglect them. # # - Download Backdrops from Pockethouse.com and unzip it to your Graphics folder # into your "Parallaxes" folder. # - Bind BATTLE_SHADOW to a switch. By default, it's 70. # - Bind the following to variables # COVER_OPAQUE - Default 96 - Adjusts the mist opacity for LAYER_COVER # LAYER_COVER - Default 97 - Sets the fog that covers enemies. Dynamic. # LAYER_FRONT - Default 98 - Front background layer. Static. # LAYER_MIDDLE - Default 99 - Middle background layer. Dynamic. # LAYER_BACK - Default 100 - Back background layer. Dynamic. # # Change the variables in your event editor to reflect the backdrop you want to # see in battle. Toggle the BATTLE_SHADOW 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 # - Alias: Spriteset_Battle: create_battleback, create_battlefloor, # - Alias: Spriteset_Battle: update_battleback, dispose_battleback # #=============================================================================== $imported = {} if $imported == nil $imported["VariableControlledBackdrops"] = true module YE module EVENT module SWITCH # If this switch is true, then the ground shadow will appear in battle. # If it is off, then the shadow doesn't appear at all. BATTLE_SHADOW = 70 end module VARIABLE # These are the variables that will be used to decide which backdrops # will be used for battle. COVER_OPAQUE = 96 # This adjusts opacity for cover fog. LAYER_COVER = 97 # This covers enemies. Dynamic LAYER_FRONT = 98 # This is the front layer background. Static. LAYER_MIDDLE = 99 # This is the middle layer. Dynamic. LAYER_BACK = 100 # This is the final layer. Dynamic. # This hash determines the rate and direction the backdrops go. # wx - Wait this number of frames before increasing dx # wy - Wait this number of frames before increasing dy # dx - Rate the plane moves horizontally right. Negative for left. # dy - Rate the plane moves horizontally up. Negative for down. BACKDROP_HASH ={ # ID => [wx, wy, dx, dy, 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, dx, dy, Backdrop Name] 200 => [10, 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, dx, dy, 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"], } end # VARIABLE end # EVENT module TOOLS # 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, Cover Opacity, Cover # Layer, Front Layer, Middle Layer, and Back Layer. STARTING_BACKDROPS = [false, 0, 0, 101, 200, 304] # This will adjust how you would like the backdrops to appear when battle # testing. Same ordering as above. BTEST_BACKDROPS = [false, 0, 0, 136, 0, 0] end end #YE #=============================================================================== # 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. #=============================================================================== #=============================================================================== # Spriteset_Battle #=============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # alias create_battleback #-------------------------------------------------------------------------- alias create_battleback_vcb create_battleback unless $@ def create_battleback @new_backdrop = false v0 = $game_variables[YE::EVENT::VARIABLE::LAYER_COVER] v1 = $game_variables[YE::EVENT::VARIABLE::LAYER_FRONT] v2 = $game_variables[YE::EVENT::VARIABLE::LAYER_MIDDLE] v3 = $game_variables[YE::EVENT::VARIABLE::LAYER_BACK] @new_backdrop = true if YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v1) @new_backdrop = true if YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v2) @new_backdrop = true if YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v3) v0 = 0 unless YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v0) v1 = 0 unless YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v1) v2 = 0 unless YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v2) v3 = 0 unless YE::EVENT::VARIABLE::BACKDROP_HASH.include?(v3) if @new_backdrop create_backdrop(v0, v1, v2, v3) else create_battleback_vcb end end #-------------------------------------------------------------------------- # create backdrop #-------------------------------------------------------------------------- def create_backdrop(v0, v1, v2, v3) @b3x = 0; @b3y = 0; @b2x = 0; @b2y = 0; @b0x = 0; @b0y = 0 unless v3 <= 0 narray = YE::EVENT::VARIABLE::BACKDROP_HASH[v3] @b3y_rate = narray[0] @b3x_rate = narray[1] @b3dx = narray[2] @b3dy = narray[3] @battleback3_sprite = Plane.new @battleback3_sprite.bitmap = Cache.parallax(narray[4]) @battleback3_sprite.z = -100 end unless v2 <= 0 narray = YE::EVENT::VARIABLE::BACKDROP_HASH[v2] @b2y_rate = narray[0] @b2x_rate = narray[1] @b2dx = narray[2] @b2dy = narray[3] @battleback2_sprite = Plane.new @battleback2_sprite.bitmap = Cache.parallax(narray[4]) @battleback2_sprite.z = -2 end unless v1 <= 0 narray = YE::EVENT::VARIABLE::BACKDROP_HASH[v1] bd_front = narray[4] @battleback_sprite = Sprite.new(@viewport1) @battleback_sprite.bitmap = Cache.parallax(bd_front) bw = @battleback_sprite.width if bw > 544 @battleback_sprite.x = (544 - bw) / 2 end @battleback_sprite.z = -1 else @battleback_sprite = Sprite.new(@viewport1) end unless v0 <= 0 narray = YE::EVENT::VARIABLE::BACKDROP_HASH[v0] @b0y_rate = narray[0] @b0x_rate = narray[1] @b0dx = narray[2] @b0dy = narray[3] @battleback0_sprite = Plane.new @battleback0_sprite.bitmap = Cache.parallax(narray[4]) op = $game_variables[YE::EVENT::VARIABLE::COVER_OPAQUE] op = [[op, 255].min, 0].max @battleback0_sprite.opacity = op end end #-------------------------------------------------------------------------- # alias create_battlefloor #-------------------------------------------------------------------------- alias create_battlefloor_vcb create_battlefloor unless $@ def create_battlefloor if $game_switches[YE::EVENT::SWITCH::BATTLE_SHADOW] create_battlefloor_vcb else @battlefloor_sprite = Sprite.new(@viewport1) end end #-------------------------------------------------------------------------- # alias dispose_battleback_bitmap #-------------------------------------------------------------------------- alias dispose_battleback_bitmap_vcb dispose_battleback_bitmap unless $@ def dispose_battleback_bitmap dispose_battleback_bitmap_vcb @battleback2_sprite.bitmap.dispose if @battleback2_sprite != nil @battleback3_sprite.bitmap.dispose if @battleback3_sprite != nil end #-------------------------------------------------------------------------- # alias dispose_battleback #-------------------------------------------------------------------------- alias dispose_battleback_vcb dispose_battleback unless $@ def dispose_battleback dispose_battleback_vcb @battleback0_sprite.dispose if @battleback0_sprite != nil @battleback2_sprite.dispose if @battleback2_sprite != nil @battleback3_sprite.dispose if @battleback3_sprite != nil end #-------------------------------------------------------------------------- # alias update_battleback #-------------------------------------------------------------------------- alias update_battleback_vcb update_battleback unless $@ def update_battleback update_battleback_vcb #--- if @battleback0_sprite != nil @b0x += 1 if @b0x_rate > 0 @b0y += 1 if @b0y_rate > 0 if @b0x > @b0x_rate @battleback0_sprite.ox += @b0dx @b0x = 0 end if @b0y > @b0y_rate @battleback0_sprite.oy += @b0dy @b0y = 0 end end #--- if @battleback2_sprite != nil @b2x += 1 if @b2x_rate > 0 @b2y += 1 if @b2y_rate > 0 if @b2x > @b2x_rate @battleback2_sprite.ox += @b2dx @b2x = 0 end if @b2y > @b2y_rate @battleback2_sprite.oy += @b2dy @b2y = 0 end end #--- if @battleback3_sprite != nil @b3x += 1 if @b3x_rate > 0 @b3y += 1 if @b3y_rate > 0 if @b3x > @b3x_rate @battleback3_sprite.ox += @b3dx @b3x = 0 end if @b3y > @b3y_rate @battleback3_sprite.oy += @b3dy @b3y = 0 end end #--- end end #=============================================================================== # Scene Title #=============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # alias create game objects #-------------------------------------------------------------------------- alias create_game_objects_vcb create_game_objects unless $@ def create_game_objects create_game_objects_vcb if $BTEST narray = YE::TOOLS::BTEST_BACKDROPS else narray = YE::TOOLS::STARTING_BACKDROPS end $game_switches[YE::EVENT::SWITCH::BATTLE_SHADOW] = narray[0] $game_variables[YE::EVENT::VARIABLE::COVER_OPAQUE] = narray[1] $game_variables[YE::EVENT::VARIABLE::LAYER_COVER] = narray[2] $game_variables[YE::EVENT::VARIABLE::LAYER_FRONT] = narray[3] $game_variables[YE::EVENT::VARIABLE::LAYER_MIDDLE] = narray[4] $game_variables[YE::EVENT::VARIABLE::LAYER_BACK] = narray[5] end end # Scene_Title #=============================================================================== # # END OF FILE # #===============================================================================