BDR Sweep v1.0

BDR Sweep Version: 1.0 for RMVX
By: Fustel

Introduction
Remember the FF6 underground river, or any river that sweeps you past nearly unreachable treaseures ??
With this script, you can easily create such rivers, even aerial air currents, without overloading your maps withe events. Furthermore, ther is NO EVENT at all to achieve this. Just mapping.

Features
  • Create 'Sweep Maps' for each method of transport for any map you want.
  • Define is a single input move is allowed between 2 sweep move for each method of transport
  • The above properties are hierachized, so that a more detailed definition replaces a more generic. The levels of definition are
    • Default: used by all methods (feet, ship, boat, airship)
      • Air: used when aboard the airship
      • Sea: used when at sea (boat or ship)
        • Boat: used when abooard the boat
        • Ship: used when abooard the ship
  • Define the 'Sweep Tiles' you will put on the 'Sweep Maps'. The default are the four arrowed tiles at the bottom loft.

Screenshots
None worth it Show
The purpose of this script is about moving. No static image could be of any help


Demo
Open the chest Show
http://www.mediafire.com/file/hljzmmdjhy1/BDR%20Sweep%20-%20%20v1.0.zip

Try and get the chest using various vehicles... or even your feets


Script
  1. #==============================================================================
  2. # ** BDR Sweep
  3. #------------------------------------------------------------------------------
  4. #  © Fustel, 2010
  5. #  14/04/10
  6. #  Version 1.0
  7. #------------------------------------------------------------------------------
  8. #  VERSION HISTORY:
  9. #   - 1.0 (14/04/10), Initial release
  10. #-------------------------------------------------------------------------------
  11. #  INSTRUCTIONS:
  12. #   - Install the 'BDR Tile v1.1' script
  13. #   - Place this script in the 'Materials' section
  14. #   - Set the following parameters in the BDR::Sweep module:
  15. #     - Fille the following hash to link sweep maps to real maps
  16. #       - Maps : default sweep maps
  17. #       - Maps_Boat : sweep maps when on boat
  18. #       - Maps_Ship : sweep maps when on ship
  19. #       - Maps_Sea  : sweep maps when at sea (boat or ship)
  20. #       - Maps_Air  : sweep maps when on airship
  21. #     - Allow a single input move between 2 sweep, or not (true, false, nil)
  22. #       - MOVE_BETWEEN : input move allowed between 2 sweeps
  23. #       - MOVE_BETWEEN_BOAT : input move allowed between 2 sweeps when in boar
  24. #       - MOVE_BETWEEN_SHIP : input move allowed between 2 sweeps when in ship
  25. #       - MOVE_BETWEEN_SEA : input move allowed between 2 sweeps when at sea (in boat or ship)
  26. #       - MOVE_BETWEEN_AIR : input move allowed between 2 sweeps when in airship
  27. #     - Select the sweeping tiles in the hash:
  28. #       - Tiles
  29. #------------------------------------------------------------------------------
  30. # NOTES
  31. #   The 'move between sweep' and 'sweep maps' properties are hierarchicaly organized.
  32. #     From a default level, they become more precise. If a more precise level is
  33. #     defined, it replaces the more general level. These levels are:
  34. #     - Default (MOVE_BETWEEN & Maps)
  35. #       - in Airship (MOVE_BETWEEN_AIR & Maps_Air)
  36. #       - at Sea (MOVE_BETWEEN_SEA & Maps_Sea)
  37. #         - in Boat (MOVE_BETWEEN_BOAT & Maps_Boat)
  38. #         - in Ship (MOVE_BETWEEN_SHIP & Maps_Ship)
  39. #------------------------------------------------------------------------------
  40.  
  41. module BDR
  42.   module Sweep
  43.  
  44.     # Maps are used in the folling prioty, if they do exist:
  45.     # if the Hero is:
  46.     #   - on foor: Maps
  47.     #   - on Boat: Maps_Boat, Maps_Sea, Maps
  48.     #   - on Ship: Maps_Ship, Maps_Sea, Maps
  49.     #   - on Airship: Maps_Air, Maps
  50.     #---------------------------------------
  51.  
  52.     # key = real map ID
  53.     # data = ID of map containing directional tiles
  54.     #----------------------------------------------
  55.     Maps = {}       # default for all
  56.     Maps_Boat = {}  # specific for boat
  57.     Maps_Ship = {}  # specific for ship
  58.     Maps_Sea = {}   # default for both boat & ship
  59.     Maps_Air = {}   # specific for airship
  60.  
  61.     Maps[ 1] = 5
  62.     Maps_Boat[ 1] = 4
  63.     Maps_Sea[ 1] = 2
  64.     Maps_Air[ 1] = 3
  65.  
  66.     # Use the same pririty as Maps
  67.     # Allows key input between forced moves
  68.     #--------------------------------------
  69.     MOVE_BETWEEN = true
  70.     MOVE_BETWEEN_BOAT = nil
  71.     MOVE_BETWEEN_SHIP = nil
  72.     MOVE_BETWEEN_SEA = nil
  73.     MOVE_BETWEEN_AIR = false
  74.  
  75.     # key = tile ID as returned by BDR::Tile::id
  76.     #         ( [ col, row] in tile panel A)
  77.     # data = direction (1=S, 2=W, 3=E, 4=N)
  78.     #
  79.     # Those are the arrow tiles at the bottom-left
  80.     #---------------------------------------------
  81.     Tiles = {}
  82.     Tiles[ [ 0, 31]] = 1
  83.     Tiles[ [ 1, 31]] = 4
  84.     Tiles[ [ 2, 31]] = 2
  85.     Tiles[ [ 3, 31]] = 3
  86.   end
  87. end
  88.  
  89.  
  90. class Game_Map
  91.   attr_reader :bdr_sweep_map
  92.   attr_reader :bdr_sweep_map_boat
  93.   attr_reader :bdr_sweep_map_ship
  94.   attr_reader :bdr_sweep_map_sea
  95.   attr_reader :bdr_sweep_map_air
  96.  
  97.   alias bdr_sweep_initialize initialize
  98.   def initialize
  99.     @bdr_sweep_map = nil
  100.     @bdr_sweep_map_boat = nil
  101.     @bdr_sweep_map_ship = nil
  102.     @bdr_sweep_map_sea = nil
  103.     @bdr_sweep_map_air = nil
  104.     bdr_sweep_initialize
  105.   end
  106.  
  107.   alias bdr_sweep_setup setup
  108.   def setup( map_id)
  109.     bdr_sweep_setup( map_id)
  110.  
  111.     m = BDR::Sweep::Maps[ map_id]
  112.     @bdr_sweep_map = m != nil ? load_data( sprintf( "Data/Map%03d.rvdata", m)) : nil
  113.  
  114.     m = BDR::Sweep::Maps_Boat[ map_id]
  115.     @bdr_sweep_map_boat = m != nil ? load_data( sprintf( "Data/Map%03d.rvdata", m)) : nil
  116.  
  117.     m = BDR::Sweep::Maps_Ship[ map_id]
  118.     @bdr_sweep_map_ship = m != nil ? load_data( sprintf( "Data/Map%03d.rvdata", m)) : nil
  119.  
  120.     m = BDR::Sweep::Maps_Sea[ map_id]
  121.     @bdr_sweep_map_sea = m != nil ? load_data( sprintf( "Data/Map%03d.rvdata", m)) : nil
  122.  
  123.     m = BDR::Sweep::Maps_Air[ map_id]
  124.     @bdr_sweep_map_air = m != nil ? load_data( sprintf( "Data/Map%03d.rvdata", m)) : nil
  125.   end
  126. end
  127.  
  128. class Game_Player < Game_Character
  129.   alias bdr_sweep_initialize initialize
  130.   def initialize
  131.     @bdr_sweep_map = nil
  132.     @bdr_sweep_mode = 1    # 1=move_by_input, 2=move_by_sweep
  133.     bdr_sweep_initialize
  134.   end
  135.  
  136.   alias bdr_sweep_move_by_input move_by_input
  137.   def move_by_input
  138.     return unless movable?
  139.     return if $game_map.interpreter.running?
  140.  
  141.     # deterimine map ans move_by_input autorization acording to vehicle
  142.     #------------------------------------------------------------------
  143.     bdr_sweep_map_select
  144.     bdr_sweep_move_batween = ( BDR::Sweep::MOVE_BETWEEN == nil ? false : BDR::Sweep::MOVE_BETWEEN)
  145.     case @vehicle_type
  146.       when 0:      # on boat
  147.         bdr_sweep_move_batween = BDR::Sweep::MOVE_BETWEEN_SEA  if BDR::Sweep::MOVE_BETWEEN_SEA != nil
  148.         bdr_sweep_move_batween = BDR::Sweep::MOVE_BETWEEN_BOAT if BDR::Sweep::MOVE_BETWEEN_BOAT != nil
  149.       when 1:      # on ship
  150.         bdr_sweep_move_batween = BDR::Sweep::MOVE_BETWEEN_SEA  if BDR::Sweep::MOVE_BETWEEN_SEA != nil
  151.         bdr_sweep_move_batween = BDR::Sweep::MOVE_BETWEEN_SHIP if BDR::Sweep::MOVE_BETWEEN_SHIP != nil
  152.       when 2:      # on airship
  153.         bdr_sweep_move_batween = BDR::Sweep::MOVE_BETWEEN_AIR  if BDR::Sweep::MOVE_BETWEEN_AIR != nil
  154.     end
  155.  
  156.     if @bdr_sweep_map == nil                                              # no sweep map
  157.       @bdr_sweep_mode = 1
  158.       bdr_sweep_move_by_input
  159.     elsif BDR::Sweep::Tiles[ @bdr_sweep_map.tile_id( @x, @y)] == nil      # not on a sweeping tile
  160.       @bdr_sweep_mode = 1
  161.       bdr_sweep_move_by_input
  162.     elsif @bdr_sweep_mode == 1                                            # last move was by input
  163.       @bdr_sweep_mode = 2
  164.       bdr_sweep_move_by_sweep
  165.     elsif @bdr_sweep_mode == 2                                            # last move was by sweeping
  166.       @bdr_sweep_mode = 1
  167.       if bdr_sweep_move_batween
  168.         bdr_sweep_move_by_input
  169.       else
  170.         bdr_sweep_move_by_sweep
  171.       end
  172.     end
  173.   end
  174.  
  175.   def bdr_sweep_move_by_sweep
  176.     case BDR::Sweep::Tiles[ @bdr_sweep_map.tile_id( @x, @y)]
  177.       when 1: move_down
  178.       when 2: move_left
  179.       when 3: move_right
  180.       when 4: move_up
  181.     end
  182.   end
  183.  
  184.   def bdr_sweep_map_select
  185.     @bdr_sweep_map = $game_map.bdr_sweep_map
  186.     case @vehicle_type
  187.       when 0:      # on boat
  188.         @bdr_sweep_map = $game_map.bdr_sweep_map_sea  if $game_map.bdr_sweep_map_sea != nil
  189.         @bdr_sweep_map = $game_map.bdr_sweep_map_boat if $game_map.bdr_sweep_map_boat != nil
  190.       when 1:      # on ship
  191.         @bdr_sweep_map = $game_map.bdr_sweep_map_sea  if $game_map.bdr_sweep_map_sea != nil
  192.         @bdr_sweep_map = $game_map.bdr_sweep_map_ship if $game_map.bdr_sweep_map_ship != nil
  193.       when 2:      # on airship
  194.         @bdr_sweep_map = $game_map.bdr_sweep_map_air  if $game_map.bdr_sweep_map_air != nil
  195.     end
  196.   end
  197. end
Expand to see the code.


Instructions
  • Install 'BDR Tile v1.1', found here: http://www.hbgames.org/forums/viewtopic.php?f=11&t=70440
  • Copy the script in the 'Materials' section
  • Set the following constants in the BDR::Sweep module to define if a single input move is allowed between 2 sweep moves. These constants are hierachized as explained above. They can be set to: true (input move allowed), false (input move diallowed), or nil (use more global definition or false for the default definition). These constants are:
    • MOVE_BETWEEN : default
    • MOVE_BETWEEN_AIR : for airship
    • MOVE_BETWEEN_SEA : at sea
    • MOVE_BETWEEN_BOAT : for boat
    • MOVE_BETWEEN_SHIP : for ship
  • Create 'Sweep Maps' the same size of the real map it is attached to. Fill it with the tiles defined in the BDR::Sweep::Tiles hash. When the Hero is at the same position of one of these tiles in the main map, he is swept in the according direction.
  • Fill the following hash in the BDR::Sweep module to link 'Sweep Maps' with real maps
    • their structure is
      • the key is the real map ID
      • the data is the 'Sweep Map' ID
    • these hash are
      • Maps : default
      • Maps_Air : for airship
      • Maps_Sea : at sea
      • Maps_Boat : for boat
      • Maps_Ship : for ship

FAQ

Compatibility
No issue known.

Credits and Thanks
All done by myself

Author's Notes
If you have any trouble, look thoroughly at the demo, and do not hesitate to ask the silly question.

Terms and Conditions
You may not use this in a commercial game without my explicit permission.
You may not post this script anywhere without my explict permission.
You must give me credit.
Interesting script... and you actually made one I didn't do before :p (acually, I don't think it's ever been attempted without events)
Again, though, my advice to switch to tile placement-based setup instead of manual assignment. Also, you spelled bdr_sweep_move_batween wrong :p (oh, and your method and module names are undistinctive :p )
Uh !!! A misspelling !!! Please tell me where it is (once more, I am near-blind, and have some difficulty finding that kind of things...).

And if you ask, I am more and more considering this kind of mapping option for a new version 'BDR Height'. It will be easier to indicate more height feature, and I'll more features for a future 'BDR ...'
bdr_sweep_move_batween should be bdr_sweep_move_between ^^ (however, it's not critical for the script)
BlueScope wrote:
bdr_sweep_move_batween should be bdr_sweep_move_between ^^ (however, it's not critical for the script)

Ok, I've found if. Not critical YET... but could have cost a lot of time debugging a future version (if there ever is one...).
Next reincarnation, I change the eyes... :shades:

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=70517