Save-Point
Boat script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+------ Forum: New Functionality/Features Scripts (https://www.save-point.org/forum-99.html)
+------ Thread: Boat script (/thread-6687.html)



Boat script - cypherzero - 03-01-2005

Boat script
by cypherzero
Mar 1 2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Apologies if this has been said already, but if you're like me and like to start from the ground up, here's a very good starting point for a boat script:

In Game_Map goto line 234
Change the for... i loop so that it matches the following:
(I've also included some of the surrounding code to help locate where this should go, don't bother with this! New sections are commented MJR:)
Code:
# When priority 0 is the other than that,
        elsif @priorities[event.tile_id] == 0
          # Transit success
          return true
        end
      end
    end
    # From on the layer is inspected in order the loop
    for i in [2, 1, 0]
      # Tile ID acquisition
      tile_id = data[x, y, i]
      # Failure of tile ID
      if tile_id == nil
        return false  #fail
      #MJR: When terrain = 1 and player is not in boat
      elsif ($game_temp.isinboat == 0) and (@terrain_tags[tile_id] == 1)
        return false
      #MJR
      elsif ($game_temp.isinboat == 1) && (@terrain_tags[tile_id] != 1) && (i == 0) then
        return false
      # When the obstacle bit is set,
      elsif @passages[tile_id] & bit != 0
        return false
      # When the obstacle bit of all directions is set,
      elsif @passages[tile_id] & 0x0f == 0x0f
        return false
      # When priority 0 is the other than that,
      elsif @priorities[tile_id] == 0
        return true Â�  #success
      end
    end
    # 通行å?¯
  return true
  end
  #--------------------------------------------------------------------------
  # â—? 茂ã?¿åˆ¤å®š
  #  x  : X 座標
  #  y  : Y 座標
  #--------------------------------------------------------------------------
  def bush?(x, y)


Now goto the database and make some tiles of terrain type 2 (water chips might be a good idea)
You will also have to set them to PASSABLE (unlike in RM2K where boats would traverse impassable chips)

Now draw some water on the map in the BOTTOM LAYER.

Create two events:
One which contains the code:
Code:
$game_temp.isinboat = 0


And the other:
Code:
$game_temp.isinboat = 1


You might have to use CTRL (to walk through walls etc) before you refine these events.

You should be able to walk on water (but not on land) when $game_temp.isinboat = 1, and you should only be able to walk on land when $game_temp.isinboat = 0.

A car script can be created even more easily in a similar manner.

After testing these out, you can create a better boat by adding change player graphic and move player events. But like I said before, this makes a good starting point.