Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Menu World Map

  This is my first script  ;D
I made a menu edit to have a world map built in. Here is the code for the menu. Just replace the scene_menu script with it.
Code:
#==============================================================================
#====================Editited=by=Random=Pictures=Inc===========================
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "World Map"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 250
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 340
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 430
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # world map
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_World_Map.new
      when 5  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 6  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
#---------------------------------------------------------------------
# Scene_World_Map-----------------------------------------------------
#---------------------------------------------------------------------
class Scene_World_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#call the window
@window = Window_World_Map.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@window.dispose
end
#--------------------------------------------------------------------------
#----Frame Update----------------------------------------------------------
#--------------------------------------------------------------------------
def update
# Update windows
@window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Menu screen
$scene = Scene_Menu.new(4)
return
end
end
end
#--------------------------------------------------
#----Window_World_Map------------------------------
#--------------------------------------------------
class Window_World_Map < Window_Base

#----------------------------------------------------------------------
#----Object Initialization 
#---------------------------------------------------------------------- 
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end 
#--------------------------------------------------------------------------
#----Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear

# Shows the picture on the window 
@bitmap = RPG::Cache.picture("World Map")# Name of picture
self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 255)
end
end
#==============================================================================
   
  !!!!IMPORTANT!!!! For this to work, you have to have a picture called World Map in your in the games pictures file.
   Feel free to use, just please give credit to Random Pictures Inc for editing 
   the script. TY
    Lines 297 to 293 must be deleted.
Also, for this code to work as best as possible you need to make 2 very small changes to the scene_save and scene_end scripts.
Find line 50 and 33 of the scene_save script where it should say
Code:
          $scene = Scene_Menu.new(4)
The last number, 4, should be changed to a 5 so it looks like this
Code:
$scene = Scene_Menu.new(5)
Then, under the scene_end script on line 56 where it should say
Code:
$scene = Scene_Menu.new(5)
change the 5 to a 6 so it looks like this
Code:
$scene = Scene_Menu.new(6)
The script should run fine, just follow the instructions at the very bottom of it.  ;D ;D
If there is any problem with it, or you just like it, tell me . Thanks

Screen Shots
http://i271.photobucket.com/albums/jj12 ... dmap-1.jpg[/img]
http://i271.photobucket.com/albums/jj12 ... e/menu.jpg[/img]
 
#==============================================================================
   
  !!!!IMPORTANT!!!! For this to work, you have to have an item called World Map
   Feel free to use, just please give credit to Random Pictures Inc for editing
   the script. TY
    Lines 297 to 293 must be deleted.
I have 2 questions: Why put the instructions at the bottom of the script? And why not just comment them out?

Other than that, good job.
 
what do you mean by you need an item called world map. doeas that mean that i have to have an item in my inventory called world map
 

Taylor

Sponsor

Now you just need to add a position indicator.
I made a world map script myself. I'll be interested to see how you achieve the position indicator.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top