adiktuzmiko

BattleBack Seasons EX v1.0

May 22nd, 2013
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.61 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # BattleBack_Seasons + EX v1.0
  4. # by AdiktuzMiko
  5. # --- Date Created: 18/01/2013
  6. # --- Last Date Updated: 18/01/2013
  7. # --- Level: Easy
  8. # Requires: n/a
  9. #
  10. # Basically, this allows you to have different battlebacks in one map
  11. # depending on seasons. You can also have different battleback sets per
  12. # region on a single map.
  13. #
  14. # Take note that this doesn't work on Battle Test.
  15. #
  16. #==============================================================================
  17.  
  18. #==============================================================================
  19. # Aliased methods:
  20. #
  21. # battleback1_bitmap, battleback2_bitmap (both belongs to Spriteset_Battle)
  22. #==============================================================================
  23.  
  24. #==============================================================================
  25. # How To Install:
  26. #
  27. # Just put this anywhere before main and you're good to go.
  28. #==============================================================================
  29.  
  30. #==============================================================================
  31. # Compatibility:
  32. #
  33. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  34. # it will run with RPG Maker VX without adjusting.
  35. #
  36. # As for compatibility with other scripts, it's compatible with YEA scripts.
  37. # I don't know for other scripts though. Though I don't think it would be
  38. # incompatible with other scripts unless they overwrite the battleback creation
  39. # at the start too.
  40. #
  41. # I don't think that this is compatible with my BattleBack_EX script.
  42. #
  43. #==============================================================================
  44.  
  45. #==============================================================================
  46. # How To Use:
  47. #
  48. # 1)Set the game variable that sets the season
  49. # 2)Create a battleback set at the BATTLEBACKSEASON_1 Hash, format is:
  50. #   Key => [Season1,Season2 and so on...],
  51. # 3)Do the same for BATTLEBACKSEASON_2 Hash
  52. #   *BATTLEBACKSEASON_1 = the set of BattleBack1 images
  53. #   *BATTLEBACKSEASON_2 = the set of BattleBack2 images
  54. # 3)Set the battleback set to be used by maps via the SEASONMAP Hash, format is:
  55. #   MapID => Key
  56. #
  57. # So now, if the value of the variable linked to SEASON_VAR is 1, it will use
  58. # the battleback for Season1 and so on
  59. #
  60. # For the EX mode:
  61. #
  62. # Set the corresponding keys for each region of maps via the BATTLEBACKEX Hash,
  63. # format is:
  64. #
  65. # MapID => {RegionID = Key, RegionID = Key and so on}
  66. #
  67. # Maps not registered in the EX Hash will use the default registered battleback
  68. # set for that map via the SEASONMAP. Same goes for regions of a map that is not
  69. # registered.
  70. #
  71. #==============================================================================
  72.  
  73. #==============================================================================
  74. # Explanation of Sample Settings:
  75. #
  76. # SEASON_VAR is set to 16, this means that season will be determined by
  77. # Game Variable number 16
  78. #
  79. # For BATTLEBACKSEASON_1, there are two specified battleback sets
  80. # the first one, containing a different battleback for each of the four
  81. # basic seasons. The second one though has the same battleback for all the
  82. # seasons, this is to be used to show how the EX mode works.
  83. #
  84. # For BATTLEBACKSEASON_2, the same keys of battleback sets are registered
  85. # I used null/nil battlebacks for this sample
  86. #
  87. # For SEASONMAP, we specify the battleback set that each map uses. Here we
  88. # link map number 14 to the Forest battleback set
  89. #
  90. # For BATTLEBACKEX, we registered map number 14 which means we plan to have
  91. # different battleback sets for the different regions of that single map.
  92. # We set region 3 to use the Forest2 battleback set. This means that
  93. # if you enter a batlle in map 14 in a position that belongs to region 3,
  94. # the game will use the Forest2 battleback set rather than the Forest
  95. # battleback set that is used by all other positions on that map.
  96. #
  97. #==============================================================================
  98.  
  99.  
  100. module BattleBack_Season
  101.  
  102.   SEASON_VAR = 16
  103.  
  104.   BATTLEBACKSEASON_1 = {
  105.  
  106.   "Forest" => ["ForestWinter","ForestSpring","ForestSummer","ForestFall"],
  107.   "Forest2" => ["ForestFall","ForestFall","ForestFall","ForestFall"],
  108.  
  109.   } #Do not remove
  110.  
  111.   BATTLEBACKSEASON_2 = {
  112.  
  113.   "Forest" => ["","","",""],
  114.   "Forest2" => ["","","",""],
  115.  
  116.   }
  117.  
  118.   SEASONMAP = {
  119.  
  120.   14 => "Forest",
  121.  
  122.   }
  123.  
  124.   BATTLEBACKEX = {
  125.  
  126.   14 => {3 => "Forest2",},
  127.  
  128.   } #Do not remove
  129.  
  130. end #BattleBack_Season
  131.  
  132. #==============================================================================
  133. # Do not touch anything below this line unless you know what you are doing.
  134. #==============================================================================
  135.  
  136. class Spriteset_Battle
  137.  
  138.   alias battleback1_bitmap_seasons battleback1_bitmap
  139.   def battleback1_bitmap
  140.     if $BTEST #without this it bugs during battle test
  141.       battleback1_bitmap_seasons
  142.     else
  143.       id = $game_map.map_id
  144.       region = $game_map.region_id($game_player.x,$game_player.y)
  145.       if BattleBack_Season::BATTLEBACKEX[id] != nil then
  146.         if BattleBack_Season::BATTLEBACKEX[id][region] != nil then
  147.           season = BattleBack_Season::BATTLEBACKEX[id][region]
  148.         else
  149.           season = BattleBack_Season::SEASONMAP[id]
  150.         end
  151.       else
  152.         season = BattleBack_Season::SEASONMAP[id]
  153.       end
  154.       if season != nil then
  155.         Cache.battleback1(BattleBack_Season::BATTLEBACKSEASON_1[season][$game_variables[BattleBack_Season::SEASON_VAR] - 1])
  156.       elsif battleback1_name
  157.         Cache.battleback1(battleback1_name)
  158.       else
  159.         create_blurry_background_bitmap
  160.       end
  161.     end
  162.   end
  163.  
  164.   alias battleback2_bitmap_seasons battleback2_bitmap
  165.   def battleback2_bitmap
  166.     if $BTEST #without this it bugs during battle test
  167.       battleback2_bitmap_seasons
  168.     else
  169.       id = $game_map.map_id
  170.       region = $game_map.region_id($game_player.x,$game_player.y)
  171.       if BattleBack_Season::BATTLEBACKEX[id] != nil then
  172.         if BattleBack_Season::BATTLEBACKEX[id][region] != nil then
  173.           season = BattleBack_Season::BATTLEBACKEX[id][region]
  174.         else
  175.           season = BattleBack_Season::SEASONMAP[id]
  176.         end
  177.       else
  178.         season = BattleBack_Season::SEASONMAP[id]
  179.       end
  180.       if season != nil then
  181.         Cache.battleback1(BattleBack_Season::BATTLEBACKSEASON_2[season][$game_variables[BattleBack_Season::SEASON_VAR] - 1])
  182.       elsif battleback2_name
  183.         Cache.battleback2(battleback2_name)
  184.       else
  185.         create_blurry_background_bitmap
  186.       end
  187.     end
  188.   end
  189.  
  190. end #Spriteset_Battle
Advertisement
Add Comment
Please, Sign In to add comment