common event call in Menu

Discussion in 'RGSS2 Script Requests' started by T_TJoker, Feb 8, 2018.

  1. T_TJoker

    T_TJoker Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMVX
    Hi,

    not sure if any one can help me,
    but im looking for a script for rpgvx that allows players to call a common event through the Menu.

    looking forward working with you
     
    Last edited: Feb 11, 2018
    #1
  2. mlogan

    mlogan Global Moderators Global Mod

    Messages:
    13,837
    Likes Received:
    7,638
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV

    I've moved this thread to Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #2
    T_TJoker likes this.
  3. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    It can be a little complex to use, but Yanfly's Main Menu Manager lets you do this.
    Fortunately, if you scroll down on that page, there's a complete example of how exactly to set it up.
     
    #3
    Canini and T_TJoker like this.
  4. T_TJoker

    T_TJoker Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMVX
    I didn't expect to get so fast a respond, im vary thankfully for that :3

    but im using rpgvx. im sorry i didn't write it on the thread.
    Hope i didn't waste so much time for you.
     
    #4
  5. Llareian

    Llareian Jack of All Trades, Master of None Veteran

    Messages:
    603
    Likes Received:
    1,400
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @T_TJoker oops, sorry. This is in JS Plugin Requests so I thought it was MV. If you go to your original post and hit "Report" you can request the mods move it to the correct RGSS script forum. :)
     
    #5
    T_TJoker likes this.
  6. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,926
    Likes Received:
    10,640
    First Language:
    English
    Primarily Uses:
    RMVXA

    I've moved this thread to RGSS2 Script Requesta. Please be sure to post your threads in the correct forum next time. Thank you.

     
    #6
  7. T_TJoker

    T_TJoker Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMVX
    I figured out to call common event from the standard menu

    Code:
    class Scene_Menu
      #--------------------------------------------------------------------------
      # * Create Command Window
      #--------------------------------------------------------------------------
      def create_command_window
        s1 = Vocab::item
        s2 = Vocab::skill
        s3 = Vocab::equip
        s4 = Vocab::status
        s5 = "event with Tee"
        s6 = Vocab::save
        s7 = Vocab::game_end
        @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
        @command_window.index = @menu_index
        if $game_party.members.size == 0          # If number of party members is 0
          @command_window.draw_item(0, false)     # Disable item
          @command_window.draw_item(1, false)     # Disable skill
          @command_window.draw_item(2, false)     # Disable equipment
          @command_window.draw_item(3, false)     # Disable status
        end
        if $game_system.save_disabled             # If save is forbidden
          @command_window.draw_item(5, false)     # Disable save
        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)
          if $game_party.members.size == 0 and @command_window.index < 5
            Sound.play_buzzer
            return
          elsif $game_system.save_disabled and @command_window.index == 5
            Sound.play_buzzer
            return
          end
          Sound.play_decision
          case @command_window.index
          when 0      # Item
            $scene = Scene_Item.new
          when 1,2,3  # Skill, equipment, status
            start_actor_selection
          when 4      # Common Event
            Sound.play_use_item
            $game_temp.common_event_id = 1
            $scene = Scene_Map.new
          when 5      # Save
            $scene = Scene_File.new(true, false, false)
          when 6      # End Game
            $scene = Scene_End.new
          end
        end
      end
    end
    to bad i use Sky Script Revolution : Main Menu :blink:
    i don't find the original side where i found the script, so i just gonna post the script here

    Code:
    #===========================================================================
    #
    # Sky Script Revolution : Main Menu (SSR) (SSR/MM)
    # Version 1.0
    # September 28, 2011 Started
    # September 28, 2011 Completed
    #
    #===========================================================================
    #
    # What is Sky Script Revolution (SSR)?
    #    It is a revamp of Sky's previous scripts.
    # Is that all?
    #    No, that is only the beginning. Look for
    #    New Scripts as well. Also look forward to
    #    the reopenning of script request hall soon.
    # What kind of scripts are you planning?
    #    I am starting to get into battle system
    #    scripting so look for edits.
    # Are you supporting old scripts?
    #    Some scripts don't need revamping as they
    #    work beautifully, so I will update those
    #    scripts.
    #
    #===========================================================================
    #
    # Features :
    #    Version 1.0 - September 28, 2011
    #       - Setup your menu anyway you want
    #       - Set it up easily.
    #       - Learning curve minimal even moreso if you used My Scene Menu Edit.
    #       - Add Remove and/or Disable Menu Options during actual gameplay.
    #          * The order they come in after adding is up to you as well.
    #
    #===========================================================================
    #
    # Credit
    # Sky00Valentine :creator and editor
    #      Jasonater :unintentionally requesting
    #         Yanfly :used a method of coding, makes things neat...
    #
    #===========================================================================
    #
    # Terms of Use
    # ------------
    #
    #     Crediting Rpgmakervx.net is the only thing I ask.
    #     However feel free to credit Sky00Valentine if you
    #     see fit.
    #
    #===========================================================================
    #
    # Future improvement
    # ------------------
    #  
    #    - Unknown
    #
    #===========================================================================
    #
    # Instructions & Installation
    # ---------------------------
    # - plug & play
    #
    # - First things first
    #    edit @menu hash in the Main_Menu module.
    #      to do this you can edit an existing one such as
    #                  :equips => ["Equip","Scene_Equip.new",true],
    #
    #      or you can add a new one like this.
    #                  :name => [Display_Name,Scene,Actor_select],
    #          1. name means a name you want to use so you know what command you are
    #             adding or editing later.
    #          2. Display_Name means what do you want it to say when you see this
    #             on the main menu.
    #          3. Scene is where you want to go if this option is selected on the
    #             menu. Usually scripts you have will let you know how to do this
    #            
    #                EXAMPLE  The script SSR Party Management Tells you to use
    #                   Scene_Party.new
    #          4. Actor_select means do you want to select a character before
    #             going to the next scene. Usually this is used so you can
    #             look at a specific party member first. Like if I wanted
    #             to go equip something but only to my 3rd character I can
    #             select the character before going to the next scene.
    #    
    #   Thats it for that section
    #
    # - Now Edit @commands
    #      by default Commands has 3 values in it.  :item  :equips, :end(Excluding Demo)
    #    
    #         what that means is that only those three options will appear in the
    #         menu if we open it at the beginning of the game. And they will be
    #         in that order on the menu.
    #    
    #      So edit it with all commands you want to start off with in your game
    #      and order them the way you want them ordered.
    #
    #         You could put all your commands in if you want.  But if you want
    #         to use some of the added features you may not want to.
    #
    # - Extra Features
    #  
    #     Here are the script commands for the extra features.
    #
    #        1. add_button(:name)
    #            just as when you edited the @menu hash name is the
    #            name of the Menu option you used.
    #          
    #               add_button(:status) would work.  By default
    #               it would add the menu option "Status" to the bottom
    #               of the menu after :end.
    #
    #        2. add_button(:name,index)
    #             just as above name works the same way.
    #            
    #             index can be considered where you want to add the option.
    #             If you want the option to be first then make index 0.
    #             For anything else if you want it after the 3rd option
    #             make index 3.
    #
    #             *Note This option may come in handy if you remove any
    #              menu options during gameply.
    #
    #        3. remove_button(:name)
    #             just as above name works the same way.
    #             this will remove the menu option from the menu.
    #            
    #             *As noted above this otption can work with add_button(:name,index)
    #                In depth (You can remove an option from the menu instead
    #                          of disabling it as well only allow certain
    #                          options to appear only at certain times. Like maybe
    #                          only on certain maps.)
    #
    #        4. disable_command(:name)
    #             just as above name works the same way.
    #             this will disable the menu option and grey it out when
    #             you look at the main menu.
    #
    #        5. enable_command(:name)
    #             just as above name works the same way.
    #             this will reenable the menu option when you look at the main
    #             menu.
    #
    #===========================================================================
    
    $imported = {} if $imported == nil
    $imported["SSRMainMenu"] = true
    
    module Sky
      module Main_Menu
       
        GAME_SAVE = "Speichern"  #What you want the Save Command to say
        GAME_END = "Optionen"    #What you want the exit menu Command to say.
    
        @menu = { #include all possible buttons even if you don't start with them
                  #in game you can make them available later.
        # :name => [Name,Scene,I want the actor selection to pop up(true/false)],
       
        # :item(the item menu) => ["Items"(I want it to say this in the menu),
        # "Scene_Item.new"(This is the script line command),
        # false(I do not need to select an actor before continuing to the menu.)
       
          :item => ["Tasche","Scene_Item.new",false],
        :skills => ["Fähigkeiten","Scene_Skill.new",true],
        :equips => ["Ausrüstung","Scene_Equip.new",true],
        :status => ["Status","Scene_Status.new",true],
          :save => [GAME_SAVE,"Scene_File.new(true,false,false)",false],
           :end => [GAME_END,"Scene_End.new",false],
         #:party is an example. If you have my Party Management script or
         #possibly another party script you could use it if you so wished.
        }
       
        @commands = [:item,:skills,:equips,:status,:save,:end,] #Be sure to place them in order
    #                                                   and adding/leaving out any
    #                                                   options you may or may not
    #                                                   want.
       
       
    #------------------------------------------------------------------------
    # No Editing past this line unless you know what your doing.
    #------------------------------------------------------------------------
    
        @disabled = []
       
        @total_information = [@commands,@disabled]
       
        def self.menu
          return @menu
        end
       
        def self.commands
          return @commands
        end
       
        def self.disabled
          return @disabled
        end
           
        def self.save_info
          @total_information = [@commands,@disabled]
          $game_system.menu = @total_information
        end
       
        def self.load_info
           @commands = $game_system.menu[0]
           @disabled = $game_system.menu[1]
        end
       
      def load_save_data(slot_id)
        file_name = make_filename(slot_id)
          @total_information = [@commands,@disabled]
          $game_system.menu = @total_information
        end
    
        def self.disable(item)
          unless @disabled.include?(item)
            @disabled.push(item)
          end
        end
       
        def self.enable(item)
          @disabled.delete(item) if @disabled.include?(item)
        end
       
        def self.add(item)
          @commands.push(item)
        end
       
        def self.remove(item)
          @commands.delete(item) if @commands.include?(item)
          enable(item)
        end
       
        def self.insert(item,index)
          @commands.insert(index,item)
        end
      end
    end
    
    class Scene_Menu
     
      def initialize(menu_index = 0)
        @menu_index = [(Sky::Main_Menu.commands.size - 1),menu_index].min
      end
     
      def create_command_window
        menu_options = []
        for i in Sky::Main_Menu.commands
          menu_options.push(Sky::Main_Menu.menu[i][0])
        end
        @command_window = Window_Command.new(160,menu_options)
        @command_window.index = @menu_index
        if $game_party.members.size == 0
          for i in 0...menu_options.size
            unless Sky::Main_Menu.commands[i] == :end
              @command_window.draw_item(i,false)
            end
          end
        end
        for i in 0...menu_options.size
          if Sky::Main_Menu.disabled.include?(Sky::Main_Menu.commands[i])
            @command_window.draw_item(i,false)
          end
        end
        if $game_system.save_disabled            
          @command_window.draw_item(Sky::Main_Menu.commands.index(:save), false) if Sky::Main_Menu.commands.include?(:save)
        end
      end
    
      def update_command_selection
        if Input.trigger?(Input::B )
          Sound.play_cancel
          $scene = Scene_Map.new
        elsif Input.trigger?(Input::C)
          if $game_party.members.size == 0 and @command_window.index < 4
            Sound.play_buzzer
            return
          elsif $game_system.save_disabled and @command_window.index == 4
            Sound.play_buzzer
            return
          end
          case Sky::Main_Menu.commands[@command_window.index]
          when Sky::Main_Menu.commands[@command_window.index]
            if Sky::Main_Menu.disabled.include?(Sky::Main_Menu.commands[@command_window.index])
              Sound.play_buzzer
            elsif Sky::Main_Menu.menu[Sky::Main_Menu.commands[@command_window.index]][2]
              Sound.play_decision
              start_actor_selection
            else
              Sound.play_decision
              $scene = eval(Sky::Main_Menu.menu[Sky::Main_Menu.commands[@command_window.index]][1])
            end
          end
        end
      end
     
      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 Sky::Main_Menu.commands[@command_window.index]
          when Sky::Main_Menu.commands[@command_window.index]
            $scene = eval(Sky::Main_Menu.menu[Sky::Main_Menu.commands[@command_window.index]][1].to_s + "(#{@status_window.index})")
          end
        end
      end
    end
    
    class Game_Interpreter
      def add_button(command, index = -1)
        unless Sky::Main_Menu.commands.include?(command)
          if index == -1
            Sky::Main_Menu.add(command)
          else
            Sky::Main_Menu.insert(command,[[index,0].max,Sky::Main_Menu.commands.size - 1].min)
          end
          Sky::Main_Menu.save_info
        end
      end
     
      def disable_command(command)
        Sky::Main_Menu.disable(command)
        Sky::Main_Menu.save_info
      end
     
      def remove_button(command)
        Sky::Main_Menu.remove(command)
        Sky::Main_Menu.save_info
      end
    end
    
    class Game_System
      attr_accessor :menu
     
      alias ssr_mm_initialize initialize
      def initialize
        @menu = []
        ssr_mm_initialize
      end
    end
    
    class Scene_File
      alias ssr_mm_read_s_data read_save_data
      def load_save_data(slot_id)
        file_name = make_filename(slot_id)
      end
    end
     
    Last edited: Feb 11, 2018
    #7
    Canini likes this.
  8. T_TJoker

    T_TJoker Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    German
    Primarily Uses:
    RMVX
    alright, i finally did it :D
    ride a script what is capable for Sky Script Revolution
    Thank you awry one! :)
     
    #8
  9. Canini

    Canini Veteran Veteran

    Messages:
    980
    Likes Received:
    651
    First Language:
    Swedish
    Nice work! Thanks for sharing even though you solved the problem yourself (from an existing script granted, but still).
     
    #9

Share This Page