ezmash

Passage Modding (runtime) (VX Ace)

Sep 11th, 2013
401
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #========================================================================
  2. # Passage Modding (runtime)
  3. # Version 1.03 (2014.07.19)
  4. #========================================================================
  5. # Author: Shaz
  6. #------------------------------------------------------------------------
  7. # This script uses previously saved passage settings in preference to
  8. # the default map/tileset passabilities.
  9. #------------------------------------------------------------------------
  10. # Changelog:
  11. # 2013.09.12  1.0  Initial release
  12. # 2013.09.12  1.01 Tweaked Game_Map.check_passage processing
  13. # 2013.12.21  1.02 Fixed issue with passages being read from compressed game
  14. # 2014.07.19  1.03 Fixed issue with vehicles going anywhere on map
  15. #------------------------------------------------------------------------
  16. # To install:
  17. # Install into Materials section in your project's script editor below
  18. # all other scripts
  19. #------------------------------------------------------------------------
  20. # To use:
  21. # This will only affect maps where you have previously modified the
  22. # passage settings using the corresponding setup script.
  23. # If passage settings were modified for the current map, those will be
  24. # used instead of the default map passages.  If passage settings for the
  25. # current map have not been modified, the defaults will be used.
  26. #------------------------------------------------------------------------
  27. # Compatibility:
  28. # This script may have compatibility issues with other scripts that:
  29. # - modify the Game_Map.check_passage method
  30. # - modify player movement and collision
  31. # - modify the map during runtime (such as tile swapping scripts)
  32. #------------------------------------------------------------------------
  33. # Terms:
  34. # Free for commercial and non-commercial use
  35. #------------------------------------------------------------------------
  36. # Credit:
  37. # - Shaz
  38. #========================================================================
  39.  
  40. module DataManager
  41.   class << self
  42.     alias shaz_passage_mod_runtime_load_normal_database load_normal_database
  43.   end
  44.  
  45.   def self.load_normal_database
  46.     shaz_passage_mod_runtime_load_normal_database
  47.     begin
  48.       $data_passages = load_data("Data/Passages.rvdata2")
  49.     rescue
  50.       $data_passages = {}
  51.     end
  52.   end
  53. end
  54.  
  55.  
  56. class Game_Map
  57.   alias shaz_passage_mod_runtime_check_passage_original check_passage
  58.   def check_passage(x, y, bit)
  59.     if $data_passages.has_key?(@map_id)
  60.       return $data_passages[$game_map.map_id][x,y] & bit == 0
  61.     else
  62.       shaz_passage_mod_runtime_check_passage_original(x, y, bit)
  63.     end
  64.   end
  65.   def boat_passable?(x, y)
  66.     shaz_passage_mod_runtime_check_passage_original(x, y, 0x0200)
  67.   end
  68.   def ship_passable?(x, y)
  69.     shaz_passage_mod_runtime_check_passage_original(x, y, 0x0400)
  70.   end
  71.   def airship_land_ok?(x, y)
  72.     shaz_passage_mod_runtime_check_passage_original(x, y, 0x0800) && shaz_passage_mod_runtime_check_passage_original(x, y, 0x0f)
  73.   end
  74. end
RAW Paste Data