Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MAP MENU
#1
MAP MENU
by Artofmin
Beta 1.2
1 December 2009

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.


Intro
This script let player open a map from item menu (by default) and browse the list of location from the map menu and transfer player to the desire location.

Features
  • View Map and Transfer/Teleport player.
  • Show selectable location.
  • Show Current Location map id/name.
  • Add and Remove location.
  • Auto detect/get map id in database (display it in the Location List).
  • Screen flashes/fade when transferring/teleporting.
New Features Beta 1.2 By Fox536
  • Easier and efficient way to add map/location for teleporting (in script).
  • Unknown location will not be display (can be change). This will make your game more realistic and unpredictable.
  • The scroll down list/selectable (location list) is hidden (it will only scroll down/select to the available/known location list). Can be change.
  • ADD and REMOVE location list with easy call script.
Screenshots (Old screenshots. Download the new Beta 1.2 for more info)

[Image: mapmenuscr1.jpg]

[Image: mapmenuscr2.jpg]
The highlighted areas (cyan) indicate the same name of the map database and Location List (in the Map Menu).

[Image: mapmenuscr3.jpg]
  1. Location List (I’ve set the maximum index to 20). List of the map are display here.
  2. The map image display area. You can change the size (using graphic editing program) so it fill up to the bottom.
  3. A window that show current map name.
  4. This is merely an image editing (done with photoshop).
  5. The RED OUTLINE display the selected location (done with photoshop).
The Demo Beta 1.2update (click here)

The Script
Code:
###############################################################################
# Map Menu (View map & transfer player) Beta 1.2                              #
###############################################################################
# Edited by Artofmin                                                          #
# Beta Released Date: 11 October 2009 (Beta 1.0)                              #
# Date Update: 1 December 2009                                                #
#=============================================================================#
# Beta 1.2                                                                    #
# Originally updated/edited by: Fox536                                        #
# Date: 30 November 2009                                                      #
#=============================================================================#
# Intro:                                                                      #
# To use item 029: Map as a map (view map etc).                               #
# This script is base from Moghunter’s MOG_Character Select Screen V1.1.      #
# http://atelier-rgss.com/Index.html). I’ve edit it so it can be use for      #
# viewing Map, Location List, Current Location and Transfer player.           #
#=============================================================================#
# Credits:                                                                    #
#                                                                             #
# Moghunter                     = I use the MOG_Character Select Screen V1.1  #
#                                 as reference.                               #
#                                                                             #
# Fox536   (Creation Asylum)    = Making this script more user friendly and   #
#                                 solved things/feature that I would never    #
#                                 figured out.                                #
#                                                                             #
# Sid Meier’s Civilization III  = currently use its map graphic as sample.    #
#=============================================================================#
# Thanks:                                                                     #
#                                                                             #
# Khattar  (Creation Asylum)    = I’ve read his post about player transfer &  #
#                                 some tutorial.                              #
# GubiD    (Creation Asylum)    = I’ve read his post about transfer script.   #
#=============================================================================#
# Note:                                                                       #
# Don’t have to credit me. I edited/implemented this script as practice.      #
# BTW, I’m NOT a scripter, if you have any problem with this script…well,     #
# I’ll try to help. If you’re a scripter, feel free to edit this script.      #
# This script is free (commercial or non commercial).                         #
#                                                                             #
# If you’re using this script, please CREDITS to:                             #
# Fox536   (Creation Asylum)                                                  #
#                                                                             #
# Fox536: I did minor edits to the script but it still runs completely        #
# the same in game... just made edits to make it easier for game creation.    #
#                                                                             #
###############################################################################

# MAP_PLACES[Map ID] = [true, Map ID, Player X, Player Y, Player Direction}
MAP_PLACES = {}
MAP_PLACES[1] = [true, 1,  9, 13, 8]
MAP_PLACES[2] = [true, 2,  9,  1, 2]
MAP_PLACES[3] = [true, 3, 18,  5, 4]
MAP_PLACES[4] = [true, 4,  9, 12, 8]
MAP_PLACES[5] = [true, 5,  2,  8, 6]

# to add a map use
# $game_temp.add_map(x)
# to remove a map use
# $game_temp.remove_map(x)

###################
# Window Location # Create the Current Location window.
###################
class Window_Location < Window_Base
  ###################
  #   initialize    #
  ###################
  def initialize
    super(0, 0, 160, 76)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 15
    refresh
  end
  ###################
  #     refresh     #
  ###################
  def refresh
    self.contents.clear
    data = load_data("Data/MapInfos.rxdata")
    self.contents.font.color = system_color
    self.contents.draw_text(0, -8, 120, 32, "Current Location", 3)
    self.contents.font.color = normal_color
    self.contents.draw_text(0, 18, 140, 32,data[$game_map.map_id].name, 3)
  end
end

###############
# Window List # Create the Location List window.
###############
class Window_List < Window_Base
  ###################
  #   initialize    #
  ###################
  def initialize
    super(0, 0, 160, 404)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 15
    refresh
  end
  ###################
  #     Refresh     #
  ###################
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, -10, 150, 32, "Location List", 3)
  end
end

###############
# Win Maplist # Create the Location List index.
###############
class Win_Maplist < Window_Selectable
  ###################
  #   initialize    #
  ###################
  def initialize
    super(0, 32, 160, 372)
    @column_max = 1
    self.opacity = 0
    refresh    
    self.index = 1
    self.visible = false
  end
  ###################
  #      item       #
  ###################
  def item
    return @data[self.index]
  end
  ###################
  #     refresh     #
  ###################
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @item_max = $game_temp.map_size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = "Arial"
      self.contents.font.size = 15
      self.contents.clear
      data = load_data("Data/MapInfos.rxdata")
      self.contents.font.color = normal_color
      # Display Location Name
      for i in 0...$game_temp.map_size
        if $game_temp.map_check($game_temp.tele_maps[i]) == true
          self.contents.draw_text(4, 32*i, 150, 32, data[$game_temp.tele_maps[i]].name, 3)
        else
          self.contents.draw_text(4, 32*i, 150, 32, "???", 3)  
        end
      end
      
    end
  end
end

################# This is the main script.
# Scene_Maplist # Call using “$scene = Scene_Maplist.new”
################# (without “”).
class Scene_Maplist
  ###################
  #      main       #
  ###################
  def main
    # Display Current Location Window
    @window_location = Window_Location.new
    @window_location.y = 404
    @window_location.x = 0
    # Display Location List Window
    @window_list = Window_List.new
    @window_list.y = 0
    @window_list.x = 0
    # Display Map Menu System
    @command_window = Win_Maplist.new
    @command_window.back_opacity = 0
    @command_window.visible = true
    @command_window.index = 0
    @maplist_back = Sprite.new
    @maplist_back.bitmap = RPG::Cache.picture("mp_menu0")
    @maplist_back.opacity = 255
    @maplist_sel = Sprite.new
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @maplist_back.dispose
    @maplist_sel.dispose
    @window_location.dispose
    @window_list.dispose
    $game_map.autoplay
    $game_map.update
  end
  ###################
  #     update      #
  ###################
  def update
    @command_window.update    
    @maplist_sel.opacity += 10
    # Display Location Picture/Image  
    if $game_temp.map_check($game_temp.tele_maps[@command_window.index]) == true
      @maplist_sel.bitmap = RPG::Cache.picture(sprintf("Map%03d", $game_temp.tele_maps[@command_window.index])) rescue @a = 1
    end
    if Input.trigger?(Input::B)
      Audio.se_play("Audio/SE/003-System03", 80,100)
      $scene = Scene_Item.new
    end    
    if Input.trigger?(Input::C)
      Audio.se_play("Audio/SE/007-System07", 80,100)
      case @command_window.index
      # Transfer the Player  
      when 0..4
        if $game_temp.map_check($game_temp.tele_maps[@command_window.index]) == true
          $game_screen.start_flash(Color.new(0, 0, 0, 255), 30)    
          $game_temp.player_transferring  = MAP_PLACES[$game_temp.tele_maps[@command_window.index]][0]
          $game_temp.player_new_map_id    = MAP_PLACES[$game_temp.tele_maps[@command_window.index]][1]
          $game_temp.player_new_x         = MAP_PLACES[$game_temp.tele_maps[@command_window.index]][2]
          $game_temp.player_new_y         = MAP_PLACES[$game_temp.tele_maps[@command_window.index]][3]
          $game_temp.player_new_direction = MAP_PLACES[$game_temp.tele_maps[@command_window.index]][4]
          $scene = Scene_Map.new
        end
      end
    end
  end
end


#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================

# use this to add a map to the array
# $game_temp.add_map(x)
# use this to check if the map has been added
# $game_temp.map_check(x)
# use this to check the size of the array
# $game_temp.map_size

class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :availible_maps_tele     # maps the player can teleport to
  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias map_tele_initialize initialize
  ###################
  #   initialize    # Adds the variable to the game_temp class
  ###################
  def initialize
    map_tele_initialize
    @availible_maps_tele = []
  end
  ###################
  #    add_map      # Adds the map to the teleport list and sorts
  ###################
  def add_map(x)
    unless map_check(x)
      @availible_maps_tele += [x]
      @availible_maps_tele.sort!
    end
  end
  ###################
  #   remove_map    # Removes the map from the teleport list and sorts
  ###################
  def remove_map(x)
    if map_check(x)
      @availible_maps_tele -= [x]
      @availible_maps_tele.sort!
    end
  end
  ###################
  #    map_check    # Checks the teleport list for the map id
  ###################
  def map_check(x=0)
    return @availible_maps_tele.include?(x)
  end
  ###################
  #    map_size     # Checks the amount of maps availiable to teleport to
  ###################
  def map_size
    return [@availible_maps_tele.size, 0].max
  end
  ###################
  #    tele_maps    # Returns the array of map_ids:@availible_maps_tele
  ###################
  def tele_maps
    return @availible_maps_tele
  end
end


Instructions
Place the script ABOVE Main.
Download and play the Demo for more info.

Compatibility
Unknown

Credits & Thanks:
Moghunter (http://atelier-rgss.com/Index.html).
Fox536...Making this script more user friendly and solved things/feature that I would never figured out.
Sid Meier’s Civilization III
Khattar & GubiD …it was due to their post (about player transferring script & tutorial) I’m able to edit/implement this script.

Author's Notes
No need to credit me…feel free to edit or upgrade it.
This script is free (commercial or non commercial).

If you’re using this script, please CREDITS to:
Fox536
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  FFTA Shop Menu Chrono Cry 0 2,117 04-25-2007, 01:00 PM
Last Post: Chrono Cry
  Cutscene Menu sasuke89 0 2,014 01-02-2007, 01:00 PM
Last Post: sasuke89
  Crystals Menu Leon Blade 0 2,138 12-24-2006, 01:00 PM
Last Post: Leon Blade
  Leon's Options Menu Leon Westbrooke 0 2,320 11-13-2006, 01:00 PM
Last Post: Leon Westbrooke



Users browsing this thread: