Advertisement
Narzew

Map Tileset Changer v 3.00

May 6th, 2013
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.42 KB | None | 0 0
  1. #==========================================================
  2. #**Map Tileset Changer during the game
  3. #**Author: Narzew
  4. #**Release Date: 06.05.13
  5. #**Version: 3.00
  6. #==========================================================
  7. #**Version Listing:
  8. #**Version 1.00 : 01.04.12 : Basic Release
  9. #**Version 2.00 : 28.04.12 : Compatibilty patch
  10. #**Version 3.00 : 06.05.13 : Added helpers to change tileset in one line
  11. #**Get latest script here: https://pastebin.com/bWmhyygL
  12. #==========================================================
  13. #**License:
  14. #**Creative Commons Share-Alike (CC-SA)
  15. #**Use free, but give credit to author
  16. #**Please don't share script in clear form. Share link to pastebin.
  17. #**Modify free, but give credit to author
  18. #**If you modify the script, please attribute your work to narzew@gmail.com
  19. #**Do not sell this script
  20. #**Do not change license of the modified script
  21. #**Do not sell modified script
  22. #**Do not made commercial games with this script if you don't have
  23. #**original author permission
  24. #==========================================================
  25. #**For scripters:
  26. #**+ = added
  27. #**- = removed
  28. #** ! = rewrited
  29. #** *= aliased
  30. #==========================================================
  31. #** Game_Map::setup*
  32. #** Scene_Map::refresh+
  33. #** Engine Module new
  34. #** Engine.mtc_preconfigure+
  35. #** Engine.mtc_enable+
  36. #** Engine.mtc_disable+
  37. #** Engine.change_tileset+
  38. #** Engine.change_tileset_id+
  39. #==========================================================
  40. #**Instructions :
  41. #**Select the tileset ID and type : Engine.change_tileset(x), where x is the ID
  42. #**of the tileset.
  43. #**If you use custom protect system, you should look at line 121.
  44. #==========================================================
  45. #**Method Listing:
  46. #**Engine.mtc_preconfigure : required to work variable pre-configuration
  47. #**Engine.mtc_enable : enables the script
  48. #**Engine.mtc_disable : disables the script
  49. #**Engine.change_tileset(x) : changes the tileset to x (int)
  50. #**Engine.change_tileset_id(x) : same as change_tileset
  51. #==========================================================
  52.  
  53. #==========================================================
  54. #**Script
  55. #==========================================================
  56.  
  57. #==========================================================
  58. #**Game_Map class
  59. #==========================================================
  60.  
  61. class Game_Map
  62.  
  63.   #==========================================================
  64.   #**Game_Map::setup rewrite
  65.   #==========================================================
  66.  
  67.   alias mtc_setup setup
  68.   def setup(map_id)
  69.     mtc_setup(map_id)
  70.     if $mtc_script_working
  71.       tileset = $data_tilesets[$mtc_tileset_id] if $mtc_script_working
  72.     else
  73.       tileset = $data_tilesets[@map.tileset_id]
  74.     end
  75.     @tileset_name = tileset.tileset_name
  76.     @autotile_names = tileset.autotile_names
  77.     @panorama_name = tileset.panorama_name
  78.     @panorama_hue = tileset.panorama_hue
  79.     @fog_name = tileset.fog_name
  80.     @fog_hue = tileset.fog_hue
  81.     @fog_opacity = tileset.fog_opacity
  82.     @fog_blend_type = tileset.fog_blend_type
  83.     @fog_zoom = tileset.fog_zoom
  84.     @fog_sx = tileset.fog_sx
  85.     @fog_sy = tileset.fog_sy
  86.     @battleback_name = tileset.battleback_name
  87.     @passages = tileset.passages
  88.     @priorities = tileset.priorities
  89.     @terrain_tags = tileset.terrain_tags
  90.   end
  91.  
  92. end
  93.  
  94. #==========================================================
  95. #**Scene_Map class
  96. #==========================================================
  97.  
  98. class Scene_Map
  99.  
  100.   #==========================================================
  101.   #**refresh
  102.   #==========================================================
  103.  
  104.   def refresh
  105.     @spriteset = Spriteset_Map.new
  106.   end
  107.  
  108. end
  109.  
  110. #==========================================================
  111. #**module Engine
  112. #==========================================================
  113.  
  114. module Engine
  115.  
  116.   #==========================================================
  117.   #**mtc_preconfigure
  118.   #==========================================================
  119.  
  120.   def self.mtc_preconfigure
  121.     $data_map_infos = load_data('Data/MapInfos.rxdata')
  122.     $mtc_tileset_id = 1
  123.     $mtc_script_working = false
  124.     $actual_map = 1 if $actual_map == nil
  125.   end
  126.  
  127.   #==========================================================
  128.   #**mtc_enable
  129.   #==========================================================
  130.  
  131.   def self.mtc_enable
  132.     $mtc_script_working = true
  133.   end
  134.  
  135.   #==========================================================
  136.   #**mtc_disable
  137.   #==========================================================
  138.  
  139.   def self.mtc_disable
  140.     $mtc_script_working = false
  141.     $game_map.setup($game_map.map_id)
  142.     $scene.refresh
  143.     $game_player.moveto($game_player.x,$game_player.y)
  144.   end
  145.  
  146.   #==========================================================
  147.   #**change_tileset
  148.   #==========================================================
  149.  
  150.   def self.change_tileset(x,n=false)
  151.     $mtc_tileset_id = x
  152.     Engine.mtc_enable
  153.     $game_map.setup($game_map.map_id)
  154.     $scene.refresh
  155.     $game_player.moveto($game_player.x,$game_player.y)
  156.   end
  157.  
  158.   #==========================================================
  159.   #**change_tileset_id
  160.   #==========================================================
  161.  
  162.   def self.change_tileset_id(x)
  163.     Engine.change_tileset(x)
  164.   end
  165.  
  166. end
  167.  
  168. begin
  169.   Engine.mtc_preconfigure
  170. rescue
  171.   print "Failed to load Narzew\'s Tileset Changer Script!"
  172.   exit
  173. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement