CyberForte

DoW Battle bgs

Oct 10th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.68 KB | None | 0 0
  1. #******************************************************************************
  2. # Display Background Based on Area *
  3. # Ver 1.02 by Diakonos *
  4. # Based on Battle Backgrounds by Synthesize *
  5. #******************************************************************************
  6.  
  7. class Game_Player < Game_Character
  8. def which_area_in
  9. for area in $data_areas.values
  10. return area.id if in_area?(area)
  11. end
  12. return 1
  13. end
  14.  
  15.  
  16. def which_area_name
  17. for area in $data_areas.values
  18. return area.name if in_area?(area)
  19. end
  20. return "grasslands"
  21. # Setting this changes what background displays when you are not in an area
  22. end
  23.  
  24. end
  25.  
  26. module SynBattleB
  27. # Place your battle backgrounds in the 'Pictures' folder (Graphics/Pictures)
  28. # Format = {area_id => "Background File Name"}
  29. # You only need to fill this in if
  30. # If you want to add a background, don't forget to put a comma after each one
  31. Battle_background =
  32. {
  33. 1 => "grassland", #if Use_VX_BG is true this field will be
  34. #ignored and default VX BG will be used.
  35. 2 => "forest",
  36. 3 => "town forest",
  37. 4 => "room 4",
  38. 5 => "Swamp",
  39. 6 => "Forest"
  40. }
  41. #-----------------------------------------------------------------------------
  42. #You only need to fill this area in if "Use_Area_Name=true" otherwise use above.
  43. # Format = {area_name => "Background File Name"}
  44. # Using area name is really the best, because background is not based on
  45. # area_id but rather area_name.
  46. # (i.e. multiple areas_ids can share the same background)
  47. Battle_area_name_background =
  48. {
  49. "grassland" => "grassland",
  50. "forest" => "forest",
  51. "town forest" => "town forest",
  52. "room 4" => "room 4",
  53. "dungeon" => "dungeon",
  54. "fort inside" => "fort inside",
  55. "dungeon 3" => "dungeon 3",
  56. "room 7" => "room 7",
  57. "dungeon 2" => "dungeon 2",
  58. "desert" => "desert",
  59. "town desert" => "town desert",
  60. "tower outside" => "tower outside",
  61. "room 2" => "room 2",
  62. "space" => "space",
  63. "beach" => "beach",
  64. "forest deep" => "forest deep",
  65. "ruins" => "ruins",
  66. "bridge" => "bridge",
  67. "river" => "river",
  68. "castle evil" => "castle evil",
  69. "snow" => "snow",
  70. "cave" => "cave",
  71. "town village" => "town village",
  72. "town shop" => "town shop",
  73. "room 3" => "room 3",
  74. "heaven" => "heaven",
  75. "heaven inside" => "heaven inside",
  76. "mine" => "mine",
  77. "cave lava" => "cave lava",
  78. "cave ice" => "cave ice",
  79. "town post" => "town post",
  80. "throneroom" => "throneroom",
  81. "mountain" => "mountain",
  82. "port" => "port",
  83. "castletown" => "castletown",
  84. "castle evil 2" => "castle evil 2",
  85. "room 6" => "room 6",
  86. "ship" => "ship",
  87. "ship inside" => "ship inside"
  88. }
  89.  
  90.  
  91. #If true, uses area name to set background instead of id#
  92. #You can use either method, but using Area name is pretty cool.
  93. Use_Area_Name = true
  94.  
  95. # Create the large shadow battlefloor?
  96. Create_battlefloor = false
  97.  
  98. # If you want you can use the standard VX background as slot #1
  99. Use_VX_BG = false
  100. end
  101.  
  102. #-------------------------------------------------------------------------------
  103. # Spriteset_Battle
  104. #-------------------------------------------------------------------------------
  105. class Spriteset_Battle
  106. alias syn_create_battlefloor create_battlefloor unless $@
  107. #-----------------------------------------------------------------------------
  108. # Default VX Background
  109. #-----------------------------------------------------------------------------
  110. def def_battle_back_diakonos
  111. source = $game_temp.background_bitmap
  112. bitmap = Bitmap.new(640, 480)
  113. bitmap.stretch_blt(bitmap.rect, source, source.rect)
  114. bitmap.radial_blur(90, 12)
  115. @battleback_sprite = Sprite.new(@viewport1)
  116. @battleback_sprite.bitmap = bitmap
  117. @battleback_sprite.ox = 320
  118. @battleback_sprite.oy = 240  
  119. @battleback_sprite.x = 272
  120. @battleback_sprite.y = 176      
  121. @battleback_sprite.wave_amp = 8
  122. @battleback_sprite.wave_length = 240
  123. @battleback_sprite.wave_speed = 120
  124. end
  125.  
  126. #---------------------------------------------------------------------------
  127. # Battle Background based on either Area Name or Area ID
  128. #---------------------------------------------------------------------------
  129. def area_battle_back_diakonos
  130. if SynBattleB::Use_Area_Name == false then
  131. # Error Check, if any error don't crash, but display VX default background
  132. if SynBattleB::Battle_background[$game_player.which_area_in]==nil then
  133. def_battle_back_diakonos
  134. else
  135. image = SynBattleB::Battle_background[$game_player.which_area_in]
  136. @battleback_sprite = Sprite.new(@viewport1)
  137. @battleback_sprite.bitmap = Cache.picture(image)
  138. end
  139.  
  140. else
  141. # Error Check, if any error don't crash, but display VX default background
  142. if SynBattleB::Battle_area_name_background[$game_player.which_area_name]==nil then
  143. def_battle_back_diakonos
  144. else
  145. image = SynBattleB::Battle_area_name_background[$game_player.which_area_name]
  146. @battleback_sprite = Sprite.new(@viewport1)
  147. @battleback_sprite.bitmap = Cache.picture(image)
  148. end
  149.  
  150. end
  151.  
  152. end
  153.  
  154.  
  155. #-----------------------------------------------------------------------------
  156. # Create Battleback
  157. #-----------------------------------------------------------------------------
  158. def create_battleback
  159.  
  160.  
  161. if SynBattleB::Use_VX_BG == true and $game_player.which_area_in==1 then
  162. #Checks if Use_VX_BG is true and if you are in area #1, if so it will
  163. #display the standard VX swirly background. If not, it uses a picture.
  164. def_battle_back_diakonos
  165. else
  166. #Run Display Picture Subroutine
  167. area_battle_back_diakonos
  168. end
  169.  
  170. end
  171.  
  172. def create_battlefloor
  173. @battlefloor_sprite = Sprite.new(@viewport1)
  174. syn_create_battlefloor if SynBattleB::Create_battlefloor == true
  175. end
  176. end
  177.  
  178. #******************************************************************************
  179. # Display Background Based on Area *
  180. # Ver 1.02 by Diakonos *
  181. # Based on Battle Backgrounds by Synthesize *
  182. #******************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment