RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

World Map as a Picture

Started by FruitBodyWash, November 11, 2007, 03:49:43 PM

0 Members and 1 Guest are viewing this topic.

FruitBodyWash

I found this script while browsing for resources, and couldn't find it here. Figured maybe someone would like to use it, I know I do. :) but, since it isn't mine, I won't be able to answer any questions, I'm just now working out the answers to my own questions.  but, if you'd like feel free to try it out.

I found it here http://www.rpgrevolution.com/script/rgss/5/

it has the script and demo for its use there as well.  Enjoy, and remebmer to thank whoever it was that made this :)

#==============================================================================
# World Map Script
# by arevulopapo (rmxp.pl)
# Jul 13th 2007
#
# Updates:
# - Music volumes for map and airship added Jul 17th 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
  attr_accessor :map_volume
  attr_accessor :airship_volume
  attr_accessor :birds_graphic
  attr_accessor :birds_switch 
  #--------------------------------------------------------------------------
  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 = "ff6 terra"               # Map BGM located in the "Audio/BGM" folder.
    @map_volume = 100                    # Change the volume of map's BGM
    @map_airship_bgm = "046-Positive04"  # Airship BGM located in the "Audio/BGM" folder.
    @airship_volume = 100                # Change the volume ofairship's BGM
    @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).
    @birds_graphic = "birds"             # Graphic for the birds, "Pictures" folder.
    @birds_switch = true                 # Turn this ON if you want the birds on a map, OFF if you don't.
    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
[\code]
it was reccomended to put into two different sections, not sure why, but this is how it was presented to me.

[code]


#==============================================================================
#==============================================================================
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, $game_system.airship_volume, 100)
    else
      Audio.bgm_play("Audio/BGM/" + $game_system.map_bgm, $game_system.map_volume, 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
[/code]

"Keep smiling, it makes people wonder what you're up to."

OK, so what's the speed of dark?
What happens if you get scared half to death twice?

Since there's a duck-billed platapus, is there just a plain platapus? If so... what does that look like?

Acezon


firerain

Quote from: celebi269 on December 15, 2007, 04:16:53 AM
wew. ill try it. :hurr: :hurr: :shoop:
That post fucking failed.

Also, nice script.