Restrict the use of a menu option for one actor with a common event

Discussion in 'RGSS3 Script Requests' started by FAGC54, Jul 12, 2018.

Thread Status:
Not open for further replies.
  1. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Hello everyone!
    I want what the tittle says. I will explain better anyways.
    Scripts i'm using:


    So, the problem is this, i'm using the Class System to change classes when an actor equips an item (Armor), for this, the script from Hime calls a common event and changes the class. What i want to do is also restrict the actor that equiped the item to use the class menu option until the item is unequiped (again a common event using Hime's script)

    Can someone make a script to lock an actor the access to the Class System scene and unlock it again whit a script from a common event?
     
    Last edited: Jul 16, 2018
    #1
  2. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    BUMP!
     
    #2
  3. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    BUMP!
     
    #3
  4. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    476
    Likes Received:
    341
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    Okay, I haven't tested this with Galv's Menu Themes, because I don't have the demo, but give this a try:
    Code:
    =begin
    #==============================================================================#
    #   AMN YEA Class System addon
    #   Version 1.01
    #   Author: AMoonlessNight
    #   Date: 20 Jul 2018
    #   Latest: 20 Jul 2018
    #==============================================================================#
    #   UPDATE LOG
    #------------------------------------------------------------------------------#
    # 20 Jul 2018 - created the script
    #==============================================================================#
    #   TERMS OF USE
    #------------------------------------------------------------------------------#
    # - Please credit AMoonlessNight or A-Moonless-Night
    # - Free for non-commercial use
    # - Please follow Yanfly's terms and conditions for the original script
    # - I'd love to see your game if you end up using one of my scripts
    #==============================================================================#
    
    Requested by FAGC54
    
    This script makes it so that you can set certain armours to not let the actor
    access the Class Change scene.
    
    Use the following in a weapon or armour's notes:
    
    <no_class_change>
    
    This will make it so that if an actor has that item equipped, they will not be
    able to access the Class Change scene in the menu.
     
    =end
    
    #==============================================================================
    #  Please do not edit below this point unless you know what you are doing.
    #==============================================================================
    
    if !$imported["YEA-ClassSystem"]
      msg = "                                      IMPORTANT:\n"
      msg += "            YEA Class System script add-on by A-Moonless-Night\n"
      msg += " \n"
      msg += "This script requires Yanfly's Class System script.\n"
      msg += "Please download it from https://yanflychannel.wordpress.com/rmvxa/"
      msgbox(msg)
      exit
    end
    
    class RPG::EquipItem < RPG::BaseItem
      attr_reader :class_change
     
      def amn_loadnotetag_no_class_change
        @class_change = true
        self.note.split(/[\r\n]+/).each { |line|
        case line
        when /<no[-_ ]+class[-_ ]+change>/i
          @class_change = false
        end
        }
      end
     
      def class_change?
        return @class_change
      end
    
    end
    
    class << DataManager
    
      alias amn_classsystem_datamanager_loaddatabase load_database
      def load_database
        amn_classsystem_datamanager_loaddatabase
        load_notetags_classchange_addon
      end
    
      def load_notetags_classchange_addon
        groups = [$data_weapons, $data_armors]
        for group in groups
          for obj in group
            next if obj.nil?
            obj.amn_loadnotetag_no_class_change
          end
        end
      end
     
    end
    
    class Game_Actor < Game_Battler
     
      def has_no_class_change_equips?
        equips.each { |eq| next if eq.nil?; return false if !eq.class_change? }
        return true
      end
     
    end
    
    class Game_Party < Game_Unit
     
      def menu_members
        members.select {|member| member.has_no_class_change_equips? }
      end
     
      def menu_member_actor
        $game_actors[@menu_actor_id] || menu_members[0]
      end
    
      def menu_member_actor_next
        index = menu_members.index(menu_member_actor) || -1
        index = (index + 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    
      def menu_member_actor_prev
        index = menu_members.index(menu_member_actor) || 1
        index = (index + menu_members.size - 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    end
    
    class Scene_Menu < Scene_MenuBase
    
    if !$imported["Galv_Menu_Themes"]
      alias amn_classsystem_scenemenu_onpersonalok on_personal_ok
      def on_personal_ok
        case @command_window.current_symbol
        when :class
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          scene_menu_on_personal_ok_cs
        end
      end
    end
    
    if $imported["Galv_Menu_Themes"]
      alias amn_classsystem_galv_scenemenu_customonpersonalok custom_on_personal_ok
      def custom_on_personal_ok(symbol)
        if symbol == :class
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          amn_classsystem_galv_scenemenu_customonpersonalok
        end
      end
    end
    
    end
    
    class Scene_Class < Scene_MenuBase
     
      def next_actor
        @actor = $game_party.menu_member_actor_next
        on_actor_change
      end
    
      def prev_actor
        @actor = $game_party.menu_member_actor_prev
        on_actor_change
      end
     
    end
     
    #4
    FAGC54 likes this.
  5. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I just tested it, sorry, didn't work. u.u
     
    #5
  6. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    476
    Likes Received:
    341
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    Here you go, should work now:
    Code:
    =begin
    #==============================================================================#
    #   AMN YEA Class System addon
    #   Version 1.02
    #   Author: AMoonlessNight
    #   Date: 20 Jul 2018
    #   Latest: 21 Jul 2018
    #==============================================================================#
    #   UPDATE LOG
    #------------------------------------------------------------------------------#
    # 20 Jul 2018 - created the script
    # 21 Jul 2018 - changed symbol used for Galv's Menu Themes Engine
    #==============================================================================#
    #   TERMS OF USE
    #------------------------------------------------------------------------------#
    # - Please credit AMoonlessNight or A-Moonless-Night
    # - Free for non-commercial use
    # - Please follow Yanfly's terms and conditions for the original script
    # - I'd love to see your game if you end up using one of my scripts
    #==============================================================================#
    
    Requested by FAGC54
    
    This script makes it so that you can set certain armours to not let the actor
    access the Class Change scene.
    
    Use the following in a weapon or armour's notes:
    
    <no_class_change>
    
    This will make it so that if an actor has that item equipped, they will not be
    able to access the Class Change scene in the menu.
     
    If you are using Galv's Menu Themes Engine, use the symbol :class_scene, e.g.:
    # ["Menu Text", :command_type, :Scene, switch1, switch2, help txt, icon]
      ["Class",     :sel, :class_scene,  0, 0, "Change your character's class",121],
     
    If you have other scripts that overwrite the following methods, place them before
    this script.
    
    class Scene_Menu < Scene_MenuBase
    def custom_symbol(symbol)
    def custom_on_command_ok(symbol)
    def custom_on_personal_ok(symbol)
    def custom_on_personal_cancel(symbol)
     
    =end
    
    #==============================================================================
    #  Please do not edit below this point unless you know what you are doing.
    #==============================================================================
    
    if !$imported["YEA-ClassSystem"]
      msg = "                                      IMPORTANT:\n"
      msg += "            YEA Class System script add-on by A-Moonless-Night\n"
      msg += " \n"
      msg += "This script requires Yanfly's Class System script.\n"
      msg += "Please download it from https://yanflychannel.wordpress.com/rmvxa/"
      msgbox(msg)
      exit
    end
    
    class RPG::EquipItem < RPG::BaseItem
      attr_reader :class_change
     
      def amn_loadnotetag_no_class_change
        @class_change = true
        self.note.split(/[\r\n]+/).each { |line|
        case line
        when /<no[-_ ]+class[-_ ]+change>/i
          @class_change = false
        end
        }
      end
     
      def class_change?
        return @class_change
      end
    
    end
    
    class << DataManager
    
      alias amn_classsystem_datamanager_loaddatabase load_database
      def load_database
        amn_classsystem_datamanager_loaddatabase
        load_notetags_classchange_addon
      end
    
      def load_notetags_classchange_addon
        groups = [$data_weapons, $data_armors]
        for group in groups
          for obj in group
            next if obj.nil?
            obj.amn_loadnotetag_no_class_change
          end
        end
      end
     
    end
    
    class Game_Actor < Game_Battler
     
      def has_no_class_change_equips?
        equips.each { |eq| next if eq.nil?; return false if !eq.class_change? }
        return true
      end
     
    end
    
    class Game_Party < Game_Unit
     
      def menu_members
        members.select {|member| member.has_no_class_change_equips? }
      end
     
      def menu_member_actor
        $game_actors[@menu_actor_id] || menu_members[0]
      end
    
      def menu_member_actor_next
        index = menu_members.index(menu_member_actor) || -1
        index = (index + 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    
      def menu_member_actor_prev
        index = menu_members.index(menu_member_actor) || 1
        index = (index + menu_members.size - 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    end
    
    class Scene_Menu < Scene_MenuBase
    
    if !$imported["Galv_Menu_Themes"]
      alias amn_classsystem_scenemenu_onpersonalok on_personal_ok
      def on_personal_ok
        case @command_window.current_symbol
        when :class
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          scene_menu_on_personal_ok_cs
        end
      end
    end
    
    if $imported["Galv_Menu_Themes"]
     
      alias amn_classsystem_galv_scenemenu_customsymbol custom_symbol
      def custom_symbol(symbol)
        case symbol
        when :class_scene
          return true
        end
        amn_classsystem_galv_scenemenu_customsymbol
      end
     
      alias amn_classsystem_galv_scenemenu_customonpersonalok custom_on_personal_ok
      def custom_on_personal_ok(symbol)
        if symbol == :class_scene
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          amn_classsystem_galv_scenemenu_customonpersonalok
        end
      end
    end
    
    end
    
    class Scene_Class < Scene_MenuBase
     
      def next_actor
        @actor = $game_party.menu_member_actor_next
        on_actor_change
      end
    
      def prev_actor
        @actor = $game_party.menu_member_actor_prev
        on_actor_change
      end
     
    end

    If you have other scripts that add custom commands into Galv's menu, make sure they're before this one.
     
    #6
    FAGC54 likes this.
  7. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I'm getting this error message:
    [​IMG]

    I never understood what this error was about.

    Sorry about that, i had the older script too.

    I changed the symbol :Scene_Class for :class_scene as the instructions said, and gave me an error about the symbol :class_scene. changed it back in galv's script, and the other two in your script, but didn't work.
     
    Last edited: Jul 21, 2018
    #7
  8. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    476
    Likes Received:
    341
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    What other scripts do you have that change the menu scene?
     
    #8
    FAGC54 likes this.
  9. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,509
    Likes Received:
    321
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    I tried this in the galv's menu theme demo and could not get the class command to show up.
    How is that part done.
    However,
    I commented out the galv's menu theme parts in the script and the next actor part and added in a classcommand part and got it to work for other games like how I would want it.
    The scene comes up, but if you have the weapon/armor equipped with the code then the commands do not show up.
    Code:
    =begin
    #==============================================================================#
    #   AMN YEA Class System addon
    #   Version 1.02
    #   Author: AMoonlessNight
    #   Date: 20 Jul 2018
    #   Latest: 21 Jul 2018
    #==============================================================================#
    #   UPDATE LOG
    #------------------------------------------------------------------------------#
    # 20 Jul 2018 - created the script
    # 21 Jul 2018 - changed symbol used for Galv's Menu Themes Engine
    #==============================================================================#
    #   TERMS OF USE
    #------------------------------------------------------------------------------#
    # - Please credit AMoonlessNight or A-Moonless-Night
    # - Free for non-commercial use
    # - Please follow Yanfly's terms and conditions for the original script
    # - I'd love to see your game if you end up using one of my scripts
    #==============================================================================#
    
    Requested by FAGC54
    
    This script makes it so that you can set certain armours to not let the actor
    access the Class Change scene.
    
    Use the following in a weapon or armour's notes:
    
    <no_class_change>
    
    This will make it so that if an actor has that item equipped, they will not be
    able to access the Class Change scene in the menu.
     
    If you are using Galv's Menu Themes Engine, use the symbol :class_scene, e.g.:
    # ["Menu Text", :command_type, :Scene, switch1, switch2, help txt, icon]
      ["Class",     :sel, :class_scene,  0, 0, "Change your character's class",121],
     
    If you have other scripts that overwrite the following methods, place them before
    this script.
    
    class Scene_Menu < Scene_MenuBase
    def custom_symbol(symbol)
    def custom_on_command_ok(symbol)
    def custom_on_personal_ok(symbol)
    def custom_on_personal_cancel(symbol)
     
    =end
    
    #==============================================================================
    #  Please do not edit below this point unless you know what you are doing.
    #==============================================================================
    
    if !$imported["YEA-ClassSystem"]
      msg = "                                      IMPORTANT:\n"
      msg += "            YEA Class System script add-on by A-Moonless-Night\n"
      msg += " \n"
      msg += "This script requires Yanfly's Class System script.\n"
      msg += "Please download it from https://yanflychannel.wordpress.com/rmvxa/"
      msgbox(msg)
      exit
    end
    
    class RPG::EquipItem < RPG::BaseItem
      attr_reader :class_change
     
      def amn_loadnotetag_no_class_change
        @class_change = true
        self.note.split(/[\r\n]+/).each { |line|
        case line
        when /<no[-_ ]+class[-_ ]+change>/i
          @class_change = false
        end
        }
      end
     
      def class_change?
        return @class_change
      end
    
    end
    
    class << DataManager
    
      alias amn_classsystem_datamanager_loaddatabase load_database
      def load_database
        amn_classsystem_datamanager_loaddatabase
        load_notetags_classchange_addon
      end
    
      def load_notetags_classchange_addon
        groups = [$data_weapons, $data_armors]
        for group in groups
          for obj in group
            next if obj.nil?
            obj.amn_loadnotetag_no_class_change
          end
        end
      end
     
    end
    
    class Game_Actor < Game_Battler
     
      def has_no_class_change_equips?
        equips.each { |eq| next if eq.nil?; return false if !eq.class_change? }
        return true
      end
     
    end
    
    class Game_Party < Game_Unit
     
      def menu_members
        members.select {|member| member.has_no_class_change_equips? }
      end
     
      def menu_member_actor
        $game_actors[@menu_actor_id] || menu_members[0]
      end
    
      def menu_member_actor_next
        index = menu_members.index(menu_member_actor) || -1
        index = (index + 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    
      def menu_member_actor_prev
        index = menu_members.index(menu_member_actor) || 1
        index = (index + menu_members.size - 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    end
    
    #~ class Scene_Menu < Scene_MenuBase
    
    #~ if !$imported["Galv_Menu_Themes"]
    #~   alias amn_classsystem_scenemenu_onpersonalok on_personal_ok
    #~   def on_personal_ok
    #~     case @command_window.current_symbol
    #~     when :class
    #~       $game_party.menu_actor = $game_party.members[@status_window.index]
    #~       if $game_party.menu_actor.has_no_class_change_equips?
    #~         SceneManager.call(Scene_Class)
    #~       else
    #~         Sound.play_buzzer
    #~         @status_window.activate
    #~       end
    #~     else
    #~       scene_menu_on_personal_ok_cs
    #~     end
    #~   end
    #~ end
    
    #~ if $imported["Galv_Menu_Themes"]
    #~ 
    #~   alias amn_classsystem_galv_scenemenu_customsymbol custom_symbol
    #~   def custom_symbol(symbol)
    #~     case symbol
    #~     when :class_scene
    #~       return true
    #~     end
    #~     amn_classsystem_galv_scenemenu_customsymbol
    #~   end
    #~ 
    #~   alias amn_classsystem_galv_scenemenu_customonpersonalok custom_on_personal_ok
    #~   def custom_on_personal_ok(symbol)
    #~     if symbol == :class_scene
    #~       $game_party.menu_actor = $game_party.members[@status_window.index]
    #~       if $game_party.menu_actor.has_no_class_change_equips?
    #~         SceneManager.call(Scene_Class)
    #~       else
    #~         Sound.play_buzzer
    #~         @status_window.activate
    #~       end
    #~     else
    #~       amn_classsystem_galv_scenemenu_customonpersonalok
    #~     end
    #~   end
    #~ end
    
    #~ end
    
    #~ class Scene_Class < Scene_MenuBase
    #~ 
    #~   def next_actor
    #~     @actor = $game_party.menu_member_actor_next
    #~     on_actor_change
    #~   end
    
    #~   def prev_actor
    #~     @actor = $game_party.menu_member_actor_prev
    #~     on_actor_change
    #~   end
    #~ 
    #~ end
    
    class Window_ClassCommand < Window_Command
    
        def make_command_list
        return if @actor.nil?
        return if !$game_party.menu_actor.has_no_class_change_equips?
        for command in YEA::CLASS_SYSTEM::COMMANDS
          case command[0]
          when :primary
            next unless Switch.primary_show
            add_command(command[1], command[0], Switch.primary_enable)
          when :subclass
            next unless Switch.subclass_show
            add_command(command[1], command[0], Switch.subclass_enable)
          when :learn_skill
            next unless $imported["YEA-LearnSkillEngine"]
            add_learn_skill_command
          else
            process_custom_command(command)
          end
        end
        if !$game_temp.scene_class_index.nil?
          select($game_temp.scene_class_index)
          self.oy = $game_temp.scene_class_oy
        end
        $game_temp.scene_class_index = nil
        $game_temp.scene_class_oy = nil
      end
    end
    
    
     
    #9
    FAGC54 likes this.
  10. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    476
    Likes Received:
    341
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    Ah, that's right. Rather than doing that, it should work if you comment out these lines in Yanfly's Class script:
    Code:
    #~ class Scene_Menu < Scene_MenuBase
    #~   
    #~   #--------------------------------------------------------------------------
    #~   # alias method: create_command_window
    #~   #--------------------------------------------------------------------------
    #~   alias scene_menu_create_command_window_cs create_command_window
    #~   def create_command_window
    #~     scene_menu_create_command_window_cs
    #~     @command_window.set_handler(:class, method(:command_personal))
    #~   end
    #~   
    #~   #--------------------------------------------------------------------------
    #~   # alias method: on_personal_ok
    #~   #--------------------------------------------------------------------------
    #~   alias scene_menu_on_personal_ok_cs on_personal_ok
    #~   def on_personal_ok
    #~     case @command_window.current_symbol
    #~     when :class
    #~       SceneManager.call(Scene_Class)
    #~     else
    #~       scene_menu_on_personal_ok_cs
    #~     end
    #~   end
    #~   
    #~ end # Scene_Menu
    That's because Galv's script takes the display name you enter and makes a symbol out of it, which links back to Yanfly's script.

    In my script, I made it so that if you try to select the actor in the menu scene, it'll play the buzzer sound and not let you. Then if you enter the Class scene with a different actor, you won't be able to access the actor with the <no_class_change> equipment.
     
    #10
    FAGC54 likes this.
  11. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    It works perfect now!!!!!!!
    Thank you very much guys, you helped me a lot! You're the best!
    This thread can be closed due to beign solved.
     
    #11
  12. A-Moonless-Night

    A-Moonless-Night WINTER IS COMING Veteran

    Messages:
    476
    Likes Received:
    341
    Location:
    New Zealand
    First Language:
    English
    Primarily Uses:
    RMVXA
    Oops, forgot something. Replace the code with this:
    Code:
    =begin
    #==============================================================================#
    #   AMN YEA Class System addon
    #   Version 1.03
    #   Author: AMoonlessNight
    #   Date: 20 Jul 2018
    #   Latest: 22 Jul 2018
    #==============================================================================#
    #   UPDATE LOG
    #------------------------------------------------------------------------------#
    # 20 Jul 2018 - created the script
    # 21 Jul 2018 - changed symbol used for Galv's Menu Themes Engine
    # 22 Jul 2018 - overwrote alias methods for Scene Menu from YEA Class System
    #==============================================================================#
    #   TERMS OF USE
    #------------------------------------------------------------------------------#
    # - Please credit AMoonlessNight or A-Moonless-Night
    # - Free for non-commercial use
    # - Please follow Yanfly's terms and conditions for the original script
    # - I'd love to see your game if you end up using one of my scripts
    #==============================================================================#
    
    Requested by FAGC54
    
    This script makes it so that you can set certain armours to not let the actor
    access the Class Change scene.
    
    Use the following in a weapon or armour's notes:
    
    <no_class_change>
    
    This will make it so that if an actor has that item equipped, they will not be
    able to access the Class Change scene in the menu.
    
    If you are using Galv's Menu Themes Engine, use the symbol :class_scene, e.g.:
    # ["Menu Text", :command_type, :Scene, switch1, switch2, help txt, icon]
      ["Class",     :sel, :class_scene,  0, 0, "Change your character's class",121],
     
    If you have other scripts that overwrite the following methods, place them before
    this script.
    
    class Scene_Menu < Scene_MenuBase
    def custom_symbol(symbol)
    def custom_on_command_ok(symbol)
    def custom_on_personal_ok(symbol)
    def custom_on_personal_cancel(symbol)
    
    =end
    
    #==============================================================================
    #  Please do not edit below this point unless you know what you are doing.
    #==============================================================================
    
    if !$imported["YEA-ClassSystem"]
      msg = "                                      IMPORTANT:\n"
      msg += "            YEA Class System script add-on by A-Moonless-Night\n"
      msg += " \n"
      msg += "This script requires Yanfly's Class System script.\n"
      msg += "Please download it from https://yanflychannel.wordpress.com/rmvxa/"
      msgbox(msg)
      exit
    end
    
    class RPG::EquipItem < RPG::BaseItem
      attr_reader :class_change
     
      def amn_loadnotetag_no_class_change
        @class_change = true
        self.note.split(/[\r\n]+/).each { |line|
        case line
        when /<no[-_ ]+class[-_ ]+change>/i
          @class_change = false
        end
        } 
      end
     
      def class_change?
        return @class_change
      end
    
    end
    
    class << DataManager
    
      alias amn_classsystem_datamanager_loaddatabase load_database
      def load_database
        amn_classsystem_datamanager_loaddatabase
        load_notetags_classchange_addon
      end
    
      def load_notetags_classchange_addon
        groups = [$data_weapons, $data_armors]
        for group in groups
          for obj in group
            next if obj.nil?
            obj.amn_loadnotetag_no_class_change
          end
        end
      end
     
    end
    
    class Game_Actor < Game_Battler
     
      def has_no_class_change_equips?
        equips.each { |eq| next if eq.nil?; return false if !eq.class_change? }
        return true
      end
     
    end
    
    class Game_Party < Game_Unit
     
      def menu_members 
        members.select {|member| member.has_no_class_change_equips? } 
      end
     
      def menu_member_actor
        $game_actors[@menu_actor_id] || menu_members[0]
      end
    
      def menu_member_actor_next
        index = menu_members.index(menu_member_actor) || -1
        index = (index + 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    
      def menu_member_actor_prev
        index = menu_members.index(menu_member_actor) || 1
        index = (index + menu_members.size - 1) % menu_members.size
        self.menu_actor = menu_members[index]
      end
    end
    
    class Scene_Menu < Scene_MenuBase
    
    if !$imported["Galv_Menu_Themes"]
      alias amn_classsystem_scenemenu_onpersonalok on_personal_ok
      def on_personal_ok
        case @command_window.current_symbol
        when :class
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          scene_menu_on_personal_ok_cs
        end
      end
    end
    
    if $imported["Galv_Menu_Themes"]
     
      # Overwrite YEA create command window so the :class symbol is not made
      alias amn_yeaclass_scenemenu_createcommandwind  create_command_window
      def create_command_window
        scene_menu_create_command_window_cs
      end
     
      # Overwrite YEA on personal OK so everything functions as per original script
      alias amn_yeaclass_scenemenu_onpersonalok  on_personal_ok
      def on_personal_ok
        scene_menu_on_personal_ok_cs
      end
    
    
      alias amn_classsystem_galv_scenemenu_customsymbol custom_symbol
      def custom_symbol(symbol)
        case symbol 
        when :class_scene
          return true
        end
        amn_classsystem_galv_scenemenu_customsymbol(symbol)
      end
     
      alias amn_classsystem_galv_scenemenu_customonpersonalok custom_on_personal_ok
      def custom_on_personal_ok(symbol)
        if symbol == :class_scene
          $game_party.menu_actor = $game_party.members[@status_window.index]
          if $game_party.menu_actor.has_no_class_change_equips?
            SceneManager.call(Scene_Class)
          else
            Sound.play_buzzer
            @status_window.activate
          end
        else
          amn_classsystem_galv_scenemenu_customonpersonalok(symbol)
        end
      end
    end
    
    end
    
    class Scene_Class < Scene_MenuBase
     
      def next_actor
        @actor = $game_party.menu_member_actor_next
        on_actor_change
      end
    
      def prev_actor
        @actor = $game_party.menu_member_actor_prev
        on_actor_change
      end
     
    end
    

    Un-comment those lines I originally said to comment out in Yanfly's script; I've included a method to overwrite that.

    If everything is working as is, you can report your original post to get a mod to close it.
     
    #12
  13. FAGC54

    FAGC54 What was that variable for? Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    dotNET Productions
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    With the previous code, the class change scene in the actor didn't had the "change class" text (it was transparent) and played the buzzer sound whenever i tried to select it. Perfect outcome, less the missing text situation.
    With this new code, the class change text appears and lets me change class, and also plays the buzzer sound.

    So, im sticking to the previous code. It works fine for me. Thank you very much again.
     
    #13
  14. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,159
    Likes Received:
    10,314
    First Language:
    English
    Primarily Uses:
    RMVXA

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #14
Thread Status:
Not open for further replies.

Share This Page