World map script

World Map by arevulopapo

Introduction

This script lets you make a world map from pictures.

Features
  • The map is loopable.
  • Airship and boat objects included.
  • Different encounters for every region of the map.
  • Smaller player's sprite and pixelmovement.

Screenshots

Player on map:
http://images25.fotosik.pl/25/946dbbe7af06ca1d.jpg[/img]
http://img116.imageshack.us/img116/1269/mapscr1mg3.jpg

Player on a boat:
http://images27.fotosik.pl/25/51aa0c0375af0ff0.jpg[/img]
http://img105.imageshack.us/img105/2452/mapscr2hn7.jpg

Player on an airship:
http://images28.fotosik.pl/25/39efe49be225a84b.jpg[/img]
http://img392.imageshack.us/img392/649/mapscr3tv7.jpg

Demo
http://rapidshare.com/files/42695786/World_Map.rar
http://www.megaupload.com/?d=6TE0VX04

Script
Section 1 Spoiler
#==============================================================================
# World Map Script
# by arevulopapo (rmxp.pl)
# Jul 13th 2007
#
# Overview:
# This script lets you create a world map with pictures. It has built in boat
# and airship vehicles. It also allows to set different encouters (troops and
# battlebacks) for any region of the map. Also, you're able to create waypoints
# with different names displayed in a window, and, if you desire, with graphics
# (also animated). Waypoints are what transfers the player to game maps.
#
# Installation:
# Paste this section (Instructions/Settings) over the "Main", and the "World Map"
# section right under this one.
#
# General information:
# The picture of a map should be named "map.jpg" and located in the "Pictures"
# folder. Passability map (white - passable land, blue - water, black - unpassable)
# should be named "map_pass.png". Encounter map should be named "map_enc.png".
# Colors on the encounter map, and troops/backdrops assigned to them are defined
# below.
# To enter a world map from a game map call a script as follows:
# $game_system.map_coords = [x, y]
# $scene = scene_World_Map.new
# The x, y are coordinates at which the player will appear on the world map.
#
# Waypoint settings:
  WAYPOINTS = [] # This is an array for waypoints. Don't touch it!
# You add new waypoints by pasting a line of code like this:
# WAYPOINTS << [x, y, enterable, data, "name", "picture", frames, speed]
# The parameters are as follows:
# x, y      - Coordinates of the waypoint on the map.
# enterable - Set to true if a waypoint leads to some location, or false if it doesn't.
# data      - This is an array of game map ID, and position of a player on that map,
#             these are used when a waypoint is enterable, and has been entered from
#             the world map. The structure is like this: [map_id, map_x, map_y].
# "name"    - This is the name that will be displayed in the window if a player is
#             close to the waypoint. If the name is "" - the window won't open.
# "picture" - Filename of the picture for the waypoint. If "" no graphic will be displayed.
# frames    - If the waypoint is animated insert the frames number of the graphic.
#             The frames should be in one row (see exaples in the "Pictures" folder).
# speed     - Speed od animation between multiple frames.
#
# Exaple waypoints present on map:
  WAYPOINTS << [690, 470, true, [1,9,13], "Mountain Path", "", 1, 10]
  WAYPOINTS << [979, 640, false, [], "Obelisk", "obelisk.png", 1, 10]
  WAYPOINTS << [800, 800, false, [], "", "flowers.png", 4, 10]
#
# Encounter settings:
  ENCOUNTER_TERRAINS = [] # This is an array for encounters. Don't touch it!
# Add new terrains by pasting the following code:
# ENCOUNTER_TERRAINS << [color, troops, "back"]
# The parameters are as follows:
# color     - A color on the "map_enc.png", defined as Color.new(red,green,blue).
# troops    - Array of troops possible to encounter. Examples: [1], [2,5,30], etc.
# "back"    - Filename of the battle backgroun from the "Battlebacks" folder.
# Example encouter terrains present in this demo:
  ENCOUNTER_TERRAINS << [Color.new(0,128,0), [1,2,3], "002-Woods01"]
  ENCOUNTER_TERRAINS << [Color.new(0,255,0), [10,12,31], "001-Grassland01"]
  ENCOUNTER_TERRAINS << [Color.new(0,255,255), [11,22,32], "006-Desert01"]
  ENCOUNTER_TERRAINS << [Color.new(255,0,255), [25,26,28], "041-EvilCastle01"]
#
# Other settings:
# The rest is set up in the Game_System class, located below. Each parameter
# to set up is commented.
#==============================================================================
# **  Edit to Game_System class. Setup here.
#==============================================================================
class Game_System
  attr_accessor :on_map
  attr_accessor :map_coords
  attr_accessor :airship_coords
  attr_accessor :airship_switch
  attr_accessor :boat_coords
  attr_accessor :boat_switch
  attr_accessor :map_sprite_scale
  attr_accessor :map_bgm
  attr_accessor :map_airship_bgm
  attr_accessor :battle_interval
  attr_accessor :battle_steps
  attr_accessor :map_fog
  attr_accessor :map_speeds
  attr_accessor :fog_scale
  #--------------------------------------------------------------------------
  alias game_sys_initialize initialize
  #--------------------------------------------------------------------------
  def initialize
    @on_map = false
    @map_coords = [1024, 512]            # Position on the map. Usually it's changed each time when entering a world map.
    @airship_switch = false
    @airship_coords = [1741,285]         # Position of the airship on the map.
    @boat_switch = false
    @boat_coords = [316,1639]            # Position of the boat on the map.
    @map_sprite_scale = 0.5              # Scale of the player's sprite
    @map_bgm = "Final Fantasy 9 - Terra" # Map BGM located in the "Audio/BGM" folder.
    @map_airship_bgm = "ff6 terra"       # Airship BGM located in the "Audio/BGM" folder.
    @battle_interval = 100               # Steps between battles. Are randomized to a degree.
    @battle_steps = 0
    @map_fog = "002-Clouds01"            # Filename of the fog for the map ("Fogs" folder).
    @map_speeds = [2, 10, 4]             # Speeds of [player, airship, boat] on the map.
    @fog_scale = 5                       # Scale of the fog (NOTE).
    game_sys_initialize
    #--------------------------------------------------------------------------
    # NOTE:
    # The fog picture should have dimensions, that multiplied by the fog_scale
    # would equal the size of the map. Otherwise some errors may occur, when
    # traveling "around the world".
    #--------------------------------------------------------------------------
  end
  #--------------------------------------------------------------------------
end
Expand to see the code.

Section 2 Spoiler
#==============================================================================
#==============================================================================
class Bitmap
  #--------------------------------------------------------------------------
  def draw_dot(x, y, color=Color.new(255,255,255))
    self.set_pixel(x, y, color)
    self.set_pixel(x + 1, y, color)
    self.set_pixel(x - 1, y, color)
    self.set_pixel(x, y + 1, color)
    self.set_pixel(x, y - 1, color)
  end
  #--------------------------------------------------------------------------
  def draw_gradient_fog(color=Color.new(200,220,250))
    for i in 0..192
      self.fill_rect(0, i, 640, 1, Color.new(color.red, color.green, color.blue, 192-i))#255 - i*(255.00/192.00)))
    end
  end
  #--------------------------------------------------------------------------
end 

#==============================================================================
#==============================================================================
class Window_Waypoint_Name < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(320, 0, 256, 52)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh(text = "")
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 224, 20, text.to_s, 1)
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Waypoint < Sprite
  #--------------------------------------------------------------------------
  attr_reader :name
  attr_reader :enterable
  attr_reader :data
  #--------------------------------------------------------------------------
  def initialize(viewport, x=0, y=0, enterable=false, data=[1,1,1], name="Town", sprite="", frames=1, speed=1)
    @viewport = viewport
    @enterable = enterable
    @data = data
    @name = name
    @frames = frames
    @speed = speed
    @pattern = 0
    super(@viewport)
    self.bitmap = RPG::Cache.picture(sprite)
    self.x = x
    self.y = y
    self.ox =  self.bitmap.width / frames / 2
    self.oy = self.bitmap.height
    self.opacity = 2 * self.y
    sx = @pattern * self.bitmap.width / @frames
    self.src_rect.set(sx, 0, self.bitmap.width / @frames, self.bitmap.height)
  end
  #--------------------------------------------------------------------------
  def update
    self.z = 100 + self.y
    #return if @frames == 1
    self.opacity = 2 * self.y
    @pattern = (@pattern + 1) % @frames if Graphics.frame_count % @speed == 0
    sx = @pattern * self.bitmap.width / @frames
    self.src_rect.set(sx, 0, self.bitmap.width / @frames, self.bitmap.height)
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Player_Object < Sprite
  #--------------------------------------------------------------------------
  def initialize(viewport, directions = 4, frames = 4)
    @viewport = viewport
    @directions = directions
    @frames = frames
    @pattern = 0
    super(@viewport)
    self.bitmap = RPG::Cache.character($game_party.actors[0].character_name, $game_party.actors[0].character_hue)
    self.zoom_x = $game_system.map_sprite_scale
    self.zoom_y = $game_system.map_sprite_scale
    self.ox =  self.bitmap.width / @frames / 2
    self.oy = self.bitmap.height / @directions
    sx = @pattern * self.bitmap.width / @frames
    sy = (Input.dir8 == 2 ? 0 : Input.dir8 == 8 ? 3 : Input.dir8 == 4 ? 1 : Input.dir8 == 6 ? 2 : 0)
    @temp_sy = sy
    sy *= self.bitmap.height / @directions
    self.src_rect.set(sx, sy, self.bitmap.width / @frames, self.bitmap.height / @directions)
  end
  #--------------------------------------------------------------------------
  def update
    self.z = 100 + self.y
    #return if @frames == 1
    @pattern = (@pattern + 1) % @frames if (Graphics.frame_count % 5 == 0 and Input.dir8 != 0)
    @pattern = 0 if Input.dir8 == 0
    sx = @pattern * self.bitmap.width / @frames
    sy = (Input.dir8 == 2 ? 0 : Input.dir8 == 8 ? 3 : Input.dir8 == 4 ? 1 : Input.dir8 == 6 ? 2 : @temp_sy)
    @temp_sy = sy
    sy *= self.bitmap.height / @directions
    self.src_rect.set(sx, sy, self.bitmap.width / @frames, self.bitmap.height / @directions)
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Vehicle_Object < Sprite
  #--------------------------------------------------------------------------
  def initialize(viewport, bitmap="", directions = 4, frames = 4, shift=0)
    @viewport = viewport
    @directions = directions
    @frames = frames
    @shift = shift
    @pattern = 0
    super(@viewport)
    self.bitmap = RPG::Cache.character(bitmap, 0)
    self.ox =  self.bitmap.width / @frames / 2
    self.oy = self.bitmap.height / @directions - @shift
    @sx = @pattern * self.bitmap.width / @frames
    @sy = 0
    @temp_sy = @sy
    @sy *= self.bitmap.height / @directions
    self.src_rect.set(0, 0, self.bitmap.width / @frames, self.bitmap.height / @directions)
  end
  #--------------------------------------------------------------------------
  def update
    self.z = 100 + self.y
    @pattern = (@pattern + 1) % @frames if (Graphics.frame_count % 10 == 0)
    @sx = @pattern * self.bitmap.width / @frames
    self.src_rect.set(@sx, @sy * self.bitmap.height / @directions, self.bitmap.width / @frames, self.bitmap.height / @directions)
  end
  #--------------------------------------------------------------------------
  def direction_update
    @sy = (Input.dir8 == 2 ? 0 : Input.dir8 == 8 ? 3 : Input.dir8 == 4 ? 1 : Input.dir8 == 6 ? 2 : @temp_sy)
    @temp_sy = @sy
  end
  #--------------------------------------------------------------------------
  def direction
    case @sy
    when 0
      return 2
    when 3
      return 8
    when 1
      return 4
    when 2
      return 6
    end
  end
 
end

#==============================================================================
#==============================================================================
class Scene_Menu
  #--------------------------------------------------------------------------
  alias menu_update_comm update_command
  #--------------------------------------------------------------------------
  def update_command
    menu_update_comm
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      if $game_system.on_map == true
        $scene = Scene_World_Map.new
        return
      else
        $scene = Scene_Map.new
      return
      end
    end
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  def battle_end(result)
    $game_temp.in_battle = false
    $game_party.clear_actions
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    $game_troop.enemies.clear
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
    if $game_system.on_map == true
      $scene = Scene_World_Map.new
    else
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  alias load_on_dec on_decision
  #--------------------------------------------------------------------------
  def on_decision(filename)
    load_on_dec(filename)
    if $game_system.on_map == true
      $scene = Scene_World_Map.new
    else
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
#==============================================================================
class Scene_World_Map
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  #--------------------------------------------------------------------------
  def main
   
    $game_system.on_map = true
    #$game_system.battle_steps = 0
   
    @battle_interval = $game_system.battle_interval * (50 + rand(100)) / 100
    @viewport = Viewport.new(0,0,640,480)
    if $game_system.airship_switch
      @map_speed = $game_system.map_speeds[1]
    elsif $game_system.boat_switch
      @map_speed = $game_system.map_speeds[2]
    else
      @map_speed = $game_system.map_speeds[0]
    end
    @delay = 0
    @last_press = 2
   
    @map_pass = Plane.new(@viewport)
    @map_pass.bitmap = RPG::Cache.picture("map_pass.png")
   
    @map_enc = Plane.new(@viewport)
    @map_enc.bitmap = RPG::Cache.picture("map_enc.png")

    @map = Plane.new(@viewport)
    @map.bitmap = RPG::Cache.picture("map.jpg")
   
    if $game_system.airship_switch
      Audio.bgm_play("Audio/BGM/" + $game_system.map_airship_bgm, 100, 100)
    else
      Audio.bgm_play("Audio/BGM/" + $game_system.map_bgm, 100, 100)
    end
    #--------------------------------------------------------------------------
    # Create an array for towns, villages, etc.
    #--------------------------------------------------------------------------
    @waypoints = []
    for i in 0..WAYPOINTS.size - 1
      w = WAYPOINTS[i]
      @waypoints << Waypoint.new(@viewport, w[0], w[1], w[2], w[3], w[4], w[5], w[6], w[7])
    end
   
    @popup = Window_Waypoint_Name.new
    @popup.width = 0
    @popup.z = 2000
   
    @player = Player_Object.new(@viewport)
    @player.x = $game_system.map_coords[0]
    @player.y = $game_system.map_coords[1]
   
    @airship = Vehicle_Object.new(@viewport, "Airship")
    @airship.x = $game_system.airship_coords[0]
    @airship.y = $game_system.airship_coords[1]
   
    @boat = Vehicle_Object.new(@viewport, "boat", 4, 4, 24)
    @boat.x = $game_system.boat_coords[0]
    @boat.y = $game_system.boat_coords[1]
   
    @viewport.ox = @player.x - 320
    @viewport.oy = @player.y - 200
   
    @fog = Sprite.new
    @fog.z = 1000
    @fog.bitmap = Bitmap.new(640,480)
    @fog.bitmap.draw_gradient_fog(Color.new(128,200,255))
   
    @clouds = Plane.new(@viewport)
    @clouds.bitmap = RPG::Cache.fog($game_system.map_fog, 0)
    @clouds.zoom_x = $game_system.fog_scale
    @clouds.zoom_y = $game_system.fog_scale
    @clouds.blend_type = 2
    @clouds.opacity = 64
    @clouds.z = 9999
   
    Graphics.transition(20, "Graphics/Transitions/020-Flat01")
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @popup.dispose
    @map.bitmap.dispose
    @map.dispose
    @map_pass.bitmap.dispose
    @map_pass.dispose
    @map_enc.bitmap.dispose
    @map_enc.dispose
    dispose_waypoints
    @fog.bitmap.dispose
    @fog.dispose
    @player.dispose
    @airship.dispose
    @boat.dispose
  end
  #--------------------------------------------------------------------------
  # ** Update shit :>
  #--------------------------------------------------------------------------
  def update
   
    @player.update
    @airship.direction_update if $game_system.airship_switch
    @airship.update
    @boat.direction_update if $game_system.boat_switch
    @boat.update
    @delay -= 1 unless @delay == 0
    @clouds.ox += 2
    @clouds.oy += 1 #if Graphics.frame_count % 2 == 0
   
    if $game_system.airship_switch or $game_system.boat_switch
      @player.opacity = 0
    else
      @player.opacity = 255
    end
   
    update_waypoints
    update_vehicles
   
    if $game_system.battle_steps >= @battle_interval and not $game_system.airship_switch
      check_for_battle
    end
   
    if Input.trigger?(Input::B)
      call_menu
    end
    #--------------------------------------------------------------------------
    # Exit airship.
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::C) and $game_system.airship_switch and @delay == 0
      if @map_pass.bitmap.get_pixel(@player.x, @player.y) == Color.new(255,255,255)
        @delay = 5
        $game_system.airship_switch = false
        @map_speed = $game_system.map_speeds[0]
        Audio.bgm_play("Audio/BGM/"+$game_system.map_bgm, 100, 100)
      end
    end
    #--------------------------------------------------------------------------
    # Exit boat.
    #--------------------------------------------------------------------------
    if Input.trigger?(Input::C) and $game_system.boat_switch and @delay == 0
      if passable?(@boat.direction, true)
        @delay = 5
        $game_system.boat_switch = false
        x_mod = (@boat.direction == 2 ? 0 : @boat.direction == 8 ? 0 : @boat.direction == 4 ? -1 : @boat.direction == 6 ? 1 : 0)
        y_mod = (@boat.direction == 2 ? 1 : @boat.direction == 8 ? -1 : @boat.direction == 4 ? 0 : @boat.direction == 6 ? 0 : 0)
        @player.x = @boat.x + x_mod * 8 * @map_speed
        @player.y = @boat.y + y_mod * 8 * @map_speed
        @map_speed = $game_system.map_speeds[0]
      end
    end
   
    if Input.dir8
      x_mod = (Input.dir8 == 2 ? 0 : Input.dir8 == 8 ? 0 : Input.dir8 == 1 ? -1 : Input.dir8 == 4 ? -1 : Input.dir8 == 7 ? -1 : Input.dir8 == 3 ? 1 : Input.dir8 == 6 ? 1 : Input.dir8 == 9 ? 1 : 0)
      y_mod = (Input.dir8 == 2 ? 1 : Input.dir8 == 8 ? -1 : Input.dir8 == 1 ? 1 : Input.dir8 == 4 ? 0 : Input.dir8 == 7 ? -1 : Input.dir8 == 3 ? 1 : Input.dir8 == 6 ? 0 : Input.dir8 == 9 ? -1 : 0)
      if passable?(Input.dir8) or ($DEBUG and Input.press?(Input::CTRL))
        $game_system.battle_steps += 1 if x_mod != 0 or x_mod != 0 and not $game_system.airship_switch
        @player.x += x_mod * @map_speed
        @player.y += y_mod * @map_speed
        @player.x %= @map.bitmap.width
        @player.y %= @map.bitmap.height
        if $game_system.airship_switch
          @airship.x += x_mod * @map_speed
          @airship.y += y_mod * @map_speed
          @airship.x %= @map.bitmap.width
          @airship.y %= @map.bitmap.height
        end
        if $game_system.boat_switch
          @boat.x += x_mod * @map_speed
          @boat.y += y_mod * @map_speed
          @boat.x %= @map.bitmap.width
          @boat.y %= @map.bitmap.height
        end
      end
    end
    @viewport.ox = @player.x - 320
    @viewport.oy = @player.y - 200
  end
  #--------------------------------------------------------------------------
  # ** Call menu.
  #--------------------------------------------------------------------------
  def call_menu
    $game_system.se_play($data_system.cancel_se)
    $game_system.map_coords = [@player.x, @player.y]
    $game_system.airship_coords = [@airship.x, @airship.y]
    $game_system.boat_coords = [@boat.x, @boat.y]
    $scene = Scene_Menu.new
  end
  #--------------------------------------------------------------------------
  # ** Check if player is close to a waypoint.
  #--------------------------------------------------------------------------
  def update_waypoints
    @waypoints.each_with_index{|w,i|
      w.update
      if Math.sqrt((w.x - @player.x)**2 + (w.y - @player.y)**2) <= 32
        if Input.trigger?(Input::C) and w.enterable and not $game_system.airship_switch
          $game_system.on_map = false
          $game_map.setup(w.data[0])
          $game_player.moveto(w.data[1], w.data[2])
          $game_player.refresh
          $game_map.autoplay
          $game_map.update
          $game_system.airship_coords = [@airship.x, @airship.y]
          $game_system.boat_coords = [@boat.x, @boat.y]
          $scene = Scene_Map.new
        end
        if w.name != ""
          (@popup.width += 16 and @popup.x -= 8) unless @popup.width == 256
          @popup.refresh(w.name)
          @popup.opacity = 160
        end
      else
       
      end
    }
    in_range = []
    @waypoints.each{|w|
      if Math.sqrt((w.x - @player.x)**2 + (w.y - @player.y)**2) <= 32
        in_range << w
      end
      }
    if in_range.size == 0
      (@popup.width -= 32 and @popup.x += 16) unless @popup.width == 0
    end
  end
  #--------------------------------------------------------------------------
  # ** Check if player is close to a vehicle.
  #--------------------------------------------------------------------------
  def update_vehicles
    if Math.sqrt((@player.x - @airship.x)**2 + (@player.y - @airship.y)**2) <= 32
      if Input.trigger?(Input::C) and not $game_system.airship_switch and @delay == 0
        @delay = 5
        @player.x = @airship.x
        @player.y = @airship.y
        $game_system.airship_switch = true
        Audio.bgm_play("Audio/BGM/"+$game_system.map_airship_bgm, 100, 100) if $game_system.map_airship_bgm != ""
        @map_speed = $game_system.map_speeds[1]
      end
    elsif Math.sqrt((@player.x - @boat.x)**2 + (@player.y - @boat.y)**2) <= 32
      if Input.trigger?(Input::C) and not $game_system.boat_switch and @delay == 0
        @delay = 5
        @player.x = @boat.x
        @player.y = @boat.y
        $game_system.boat_switch = true
        @map_speed = $game_system.map_speeds[2]
      end
    end
  end
  #--------------------------------------------------------------------------
  # ** Dispose waypoints.
  #--------------------------------------------------------------------------
  def dispose_waypoints
    @waypoints.delete_if{ |m|
      m.dispose
      true
    }
  end
  #--------------------------------------------------------------------------
  # ** Determine if the terrain one step in front of the player is passable.
  #--------------------------------------------------------------------------
  def passable?(direction=0, boat_override=false)
    passable_color = Color.new(255,255,255)
    speed = @map_speed
    if $game_system.boat_switch
      passable_color = Color.new(0,0,255)
      speed = 8*$game_system.map_speeds[2]
    end
    if $game_system.airship_switch
      return true
    end
    if boat_override == true
      passable_color = Color.new(255,255,255)
    end
   
    case direction
    when 0
      return true if @map_pass.bitmap.get_pixel((@player.x) % @map_pass.bitmap.width, (@player.y) % @map_pass.bitmap.height) == passable_color
    when 1
      return true if @map_pass.bitmap.get_pixel((@player.x - @map_speed) % @map_pass.bitmap.width, (@player.y + speed) % @map_pass.bitmap.height) == passable_color
    when 2
      return true if @map_pass.bitmap.get_pixel((@player.x) % @map_pass.bitmap.width, (@player.y + speed) % @map_pass.bitmap.height) == passable_color
    when 3
      return true if @map_pass.bitmap.get_pixel((@player.x + speed) % @map_pass.bitmap.width, (@player.y + speed) % @map_pass.bitmap.height) == passable_color
    when 4
      return true if @map_pass.bitmap.get_pixel((@player.x - speed) % @map_pass.bitmap.width, (@player.y) % @map_pass.bitmap.height) == passable_color
    when 6
      return true if @map_pass.bitmap.get_pixel((@player.x + speed) % @map_pass.bitmap.width, (@player.y) % @map_pass.bitmap.height) == passable_color
    when 7
      return true if @map_pass.bitmap.get_pixel((@player.x - speed) % @map_pass.bitmap.width, (@player.y - speed) % @map_pass.bitmap.height) == passable_color
    when 8
      return true if @map_pass.bitmap.get_pixel((@player.x) % @map_pass.bitmap.width, (@player.y - speed) % @map_pass.bitmap.height) == passable_color
    when 9
      return true if @map_pass.bitmap.get_pixel((@player.x + speed) % @map_pass.bitmap.width, (@player.y - speed) % @map_pass.bitmap.height) == passable_color
    end
  end
  #--------------------------------------------------------------------------
  # ** When battle steps reached, call for battle if possible.
  #--------------------------------------------------------------------------
  def check_for_battle
    ENCOUNTER_TERRAINS.each{|e|
      if @map_enc.bitmap.get_pixel(@player.x, @player.y) == e[0]
          troop = e[1][rand(e[1].size)]
          backdrop = e[2]
          call_battle(troop, backdrop) if troop != 0
          @battle_interval = $game_system.battle_interval * (50 + rand(100)) / 100
      end
    }
  end
  #--------------------------------------------------------------------------
  # ** Setup battle.
  #--------------------------------------------------------------------------
  def call_battle(troop = 1, backdrop = "")
   
    $game_system.battle_steps = 0
    $game_temp.battle_calling = false
    $game_temp.menu_calling = false
    $game_temp.menu_beep = false
    $game_player.make_encounter_count
    $game_temp.map_bgm = $game_system.playing_bgm
    $game_system.bgm_stop
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
   
    $game_temp.battle_troop_id = troop
    $game_map.battleback_name = backdrop
    $game_system.map_coords = [@player.x, @player.y]
    $game_system.airship_coords = [@airship.x, @airship.y]
    $game_system.boat_coords = [@boat.x, @boat.y]
    $scene = Scene_Battle.new
  end
  #--------------------------------------------------------------------------
end
Expand to see the code.


Instructions
In the script.

FAQ
None yet.

Compatibility
No SDK. May require some edits if custom Battle/Menu/Save/Load system were used.

Credits and Thanks
Credits - arevulopapo,
Thanks to ccoa and Lene for some sprites.

Author's Notes
Forgive those crappy mountains :p

Terms and Conditions
Contact me for commercial use, otherwise it's free (with credits).
This is...spectacular. Really.
Both the effect and the easyness of use, are great. It isn't laggy at all...

Really. Great.
Wow that looks good :)
Can you make a merge for the SDK?
Sorry, I don't do SDK scripts. Though I won't mind if someone else edits it to work.
Glad you like the script :)
i like that it is?t SDK ( hate the SDK as hell )..

The Script is wonderful.
Can you Add effects like Ground-Fog.. Fog.. and Birds
Then it?ll be perfect ^^

And a little Question:

The Worldmap.. What?s the maximum size?
Thanks :) There's no maximun size. Just make it reasonable so you PC can handle it with lag (but still, it can be pretty big). The fog is already there - just need to change the picture (however the change of the speed is hard now - I should fix it soon, so you can set that speed in the beginning).
The birds are a nice idea. Tell me how would you see them working?
I think I did something wrong...if something very obvious is left out of the instructions, i missed it. my event that should send the party to the world map doesnt do anything. can you please help?
Here's a screenshot how the event should look like:
http://img516.imageshack.us/img516/82/evdp2.png
I tried this out, and I'm using it in my game. It's amazing =D
This script is simply amazing, although it looks difficult to customise. Is there not some way of making the overworld map a map?
thanks, i just had the script copied in the event wrong, and now it works perfectly. :)
Because Birds:

If you?re in the near of a forest, a couple of birds can fly outside... ( Best if the suer is able to choose where birds can fly out.. Citys.. forests..etc )

Or a group of birds can fly from one end of the screen to another ( coords are random ).

Another Idea is: Animated Worldmap picture ( Because of Water or Waterfalls to end the Map ). User can choose frames.
Now, this is the kind of scripts I like to see. Well done.
@Granas3 REMIXED: Possibly yes, but it would mean making the script almost from scratch. Besides, reverting from the normal map engine was one of the targets when I was making this script.
@Sir Lord Biowulve: I'd rather go with the second option for the birds (flying at random coords). I guess they could fade in/out, not to be present on the map all the time.
The animated pictures could be nice, but I'm not sure if it wouldn't lag. Redrawing such a big picture every frame (or every few frames) could be really painful for rmxp engine.

Thanks for all the replies : )
Wow, awesome script, and I like your world map. What program do I need use to make maps like that?
Photoshop or GIMP I suppose. Glad you like it : )
looks awesome! I used the demo, and this would be perfect for my game. But, I seem to running into a problem... :s when i step on the teleport event in my own game (which i had at first misscopied, all better now) it hangs up, then gives me the message "Script is hanging" and closes out. I tried everything I could think of to figure out what was happening. I tried lowering my map size, importing all the pictures, bmgs, charas, etc. that you used in your game (in case it was trying to find something that I didn't have) but it still gives me the "Script Haning" I was wondering if you could offer any suggestions. Thanks :)
Hi. I can't think of anythin else causing it but the size of the map. Can you tell me how big is it? And maybe send it to me (via PM maybe) so I could test it myself.

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