[RMVX ACE] LEVEL SELECT

Posts

Pages: 1
oddRABBIT
I feel bored. How odd.
1979
Exactly what it sounds like. I'm asking for a script for selecting a level, or the only town in-game. Like, a Megaman game, with the level selects. Except it expand, starting with four levels available, then revealing one new level for each level beaten, and then once more, before the town is replaced with the final level.
I think you can do this with a command window and a level select scene.

I haven't tested this, but it should work.

class Window_LevelSelect < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
    update_placement
    select_symbol(-1) # Auto-select the last symbol in the list (the newest level)
    self.openness = 0
    open
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Update Window Position
  #--------------------------------------------------------------------------
  def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height * 1.6 - height) / 2
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command("Level 1",     :lv1)
    add_command("Level 2",     :lv2) if $game_variables[100] >= 1 # Assuming that variable 100 is used as a progress tracker
    add_command("Level 3",     :lv3) if $game_variables[100] >= 2 # Assuming that variable 100 is used as a progress tracker
    add_command("Level 4",     :lv4) if $game_variables[100] >= 3 # Assuming that variable 100 is used as a progress tracker
    add_command("Final Level", :lv5) if $game_variables[100] >= 4 # Assuming that variable 100 is used as a progress tracker
  end
end

class Scene_LevelSelect < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    mak_lvl_sel
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def mak_lvl_sel
    @cc = Window_LevelSelect.new
    @cc.set_handler(:lv1, method(:goto_lv1))
    @cc.set_handler(:lv2, method(:goto_lv2))
    @cc.set_handler(:lv3, method(:goto_lv3))
    @cc.set_handler(:lv4, method(:goto_lv4))
    @cc.set_handler(:lv5, method(:goto_lv5))
  end
  #--------------------------------------------------------------------------
  # * Transfer Player (I assume that each Level starts at a specific map)
  #--------------------------------------------------------------------------
  def transfer(map_id, x, y, d=2, fade_type=0)
    #d = direction (2,4,6,8 => down, left, right, up)
    #fade_type = (0,1,2 => normal, white, none)
    $game_player.reserve_transfer(map_id, x, y, d)
    $game_temp.fade_type = fade_type
    $game_player.perform_transfer
  end
  #--------------------------------------------------------------------------
  # * Handle Level Selection Stuff
  # ~ Direction and Fade Type are optional here...
  #--------------------------------------------------------------------------
  def goto_lv1
    transfer(1, 0, 0)
  end
  
  def goto_lv2
    transfer(2, 0, 0)
  end
  
  def goto_lv3
    transfer(3, 0, 0)
  end
  
  def goto_lv4
    transfer(4, 0, 0)
  end
  
  def goto_lv5
    transfer(5, 0, 0)
  end
end

This script creates a Scene that allows the player to choose the level from a list, then transfers the player to a map based on the selection.

Edit: Why can't I hide code inside Hide tags?????
SunflowerGames
The most beautiful user on RMN!
13323

Couldn't you just do this through an event?

Though you need a script to make the window / choice larger, which Yanfly has.

Edit:

Then use control switches after you beat a level to make it available for repeat.
Pages: 1