Jump to content
Sign in to follow this  
b133d_4_u

Swimming Script

Recommended Posts

What do you want to happen if there players party consists of multiple member, and only one of them can swim? If you don't have multiple actors or if you want your party to be able to swim as long as your party leader can swim, this should work:

 

 

 

class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Determine if Map is Passable
  #--------------------------------------------------------------------------
  def map_passable?(x, y, d)
    case @vehicle_type
    when :boat
      $game_map.boat_passable?(x, y)
    when :ship
      $game_map.ship_passable?(x, y)
    when :airship
      true
    else    
      (can_swim?(x,y) ? true : super)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if Actor can Swim
  #--------------------------------------------------------------------------
  def can_swim?(x,y)
    #                     Actor ID                            Terrain Tag
    $game_party.leader.id == ID && $game_map.terrain_tag(x, y) == TAG
  end  
end

 

 

 

You have to tell the game what's water and what isn't, by giving water tiles a terrain tag in the database. Then change ID and TAG to the Sahagin actors ID and to the water terrain tag. Dont forget that you shouldnt use this terrain tag for anything else, only to mark water tiles.

Btw, while playing around with this, I noticed that also making the watertiles "bush" tiles makes for a nice visual effect, but that's your choiche

Edited by pencilcase27

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×