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.

Try to make own menu option

Started by atiebatie99, March 09, 2010, 06:49:08 PM

0 Members and 1 Guest are viewing this topic.

atiebatie99

I need help with this I try to found it out by my self but no results.
I just was playing around with it for a reason but that's top secret ;D
[spoiler]#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @status_window = Window_MenuStatus.new(160, 0) # LOOK HERE  how do i know what numbers
  end                                                                               # Come after it?
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = "Start"
    s3 = Vocab::ShopCancel
    @command_window = Window_Command.new(300, [s1, s3], 2)
    @command_window.y = 0
    if $game_temp.shop_purchase_only
      @command_window.draw_item(1, false)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 1  # Start
        Sound.play_decision
        $scene = Scene_Map.new
      when 0  # Quit
        start_actor_selection #LINE 63
      end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @status_window.active = true
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @status_window.active = false
    @status_window.index = -1
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when 1  # skill
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        $scene = Scene_Status.new(@status_window.index)
        end
      end
    end
  end
end
end
end[/spoiler]
I get the error: Script "menu editting" line 63: NameError occurred.
Undefined local variable or method 'start_actor_selection' for #<Scene_MenuOption:0x17c3718>
My work isn't really good because I'm just 14
year
My English isn't really good because I'm from Netherlands

Deity

Hi.
Like the error says. You use the method "start_actor_selection" but you don't defined this method.
I think you copied some party from the "Scene_Menu" so I would copy the missing method also.

    @status_window = Window_MenuStatus.new(160, 0) # LOOK HERE  how do i know what numbers Come after it?
Do you mean (160,0) ?
Just look at the class you want to call and you'll find out.
Look at "initialize" and after this method are the needed parameter. In this case the x and y coordinate.

Deity
Greetings
DigiDeity


├Work┤
├Contact┤


cozziekuns

Like Deity said, it was because your start_actor_selection was undefined. This is because your start_actor_selection was below your update_command_action. Or at least I think it's like that. Anyways, try this script.

[spoiler]
#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @status_window = Window_MenuStatus.new(160, 0) # LOOK HERE  how do i know what numbers
  end                                                                               # Come after it?
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    dispose_command_window
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = "Start"
    s3 = Vocab::ShopCancel
    @command_window = Window_Command.new(300, [s1, s3], 2)
    @command_window.y = 0
    if $game_temp.shop_purchase_only
      @command_window.draw_item(1, false)
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @status_window.active = true
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 1  # Start
        Sound.play_decision
        $scene = Scene_Map.new
      when 0  # Quit
        start_actor_selection #LINE 63
      end
    end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @status_window.active = false
    @status_window.index = -1
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when 1  # skill
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        $scene = Scene_Status.new(@status_window.index)
        end
      end
    end
  end
end

[/spoiler]

Also, your start_actor_selection didn't have an end. When you define things, you should always put an end at the end of your code. Hope this helps!