Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Auto-Unequip Tools for Falcao's Pearl ABS Liquid v3
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.3
- # * Updated: 18/11/2016
- # * Requires: Falcao's Pearl ABS Liquid v3
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (06/01/2016)
- # - Initial release.
- # * Version 1.1 (12/05/2016)
- # - Fixed the ammo display for auto-unequipped tools.
- # * Version 1.2 (10/08/2016)
- # - Item tools did not unequip if another tool caused the party to lose the
- # item (by assigning an item cost for that tool). This is fixed now.
- # * Version 1.3 (18/11/2016)
- # - Fixed a bug with unequipping tools.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * Tools which can not be used due to insufficient item or variable
- # requirements can be unequipped automatically with this script.
- # Note that the player will NOT be able to equip any of these tools after it
- # is unequipped automatically until the player got enough item/variable to
- # use them again!
- # * The variable requirement mentioned above is from another ABS addon I made,
- # but it is not necessary for this script to work!
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this scipt below the last script from Falcao's Pearl ABS Liquid v3
- # script series but above Main!
- # * If you are using my Tool Variable Usage for Falcao's ABS script, you must
- # put this one below that one!
- # * If you are using my Tool Cycler Addon for Falcao's ABS, you must put this
- # script below that one!
- # * You can do an optional edit in the "Pearl Item Pop Up" script. This edit
- # will prevent the item gain popup when the tool is automatically equipped
- # due to this script. It's kinda annoying and looks bad to see that popup
- # everytime the tool is unequipped automatically.
- #
- # Anyway, here is what you need to do:
- # Right at the start, after the settings part, you will see this method:
- #
- #~ alias falcaopearl_itempop_gain gain_item
- #~ def gain_item(item, amount, include_equip = false)
- #~ if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
- #~ if amount > 0
- #~ $game_system.item_object = [item, amount]
- #~ RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
- #~ end
- #~ end
- #~ falcaopearl_itempop_gain(item, amount, include_equip = false)
- #~ end
- #
- # Replace that whole definition with the one below:
- #
- #~ alias falcaopearl_itempop_gain gain_item
- #~ def gain_item(item, amount, include_equip = false)
- #~ unless $game_system.disable_item_pop == true
- #~ if !item_container(item.class).nil? && SceneManager.scene_is?(Scene_Map)
- #~ if amount > 0
- #~ $game_system.item_object = [item, amount]
- #~ RPG::SE.new(PearlItemPop::ItemSe, 80).play rescue nil
- #~ end
- #~ end
- #~ end
- #~ falcaopearl_itempop_gain(item, amount, include_equip = false)
- #~ end
- #
- # I couldn't just overwrite it, because that would make compatibility issues
- # with many scripts, and I could not alias it in any way, because the popup
- # mechanic is already in it, so that would be called no matter how I alias it.
- #
- # Simply copy the above method, and paste it over the old method, deleting
- # the old one in the process. After this, select the copied method and press
- # CTRL+Q while it's highlighted to remove the comment sings from it.
- # Do NOT remove the comment signs from this header!
- #
- # I hope this little copy/paste job won't be hard to do for anyone. :P
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * No known incompatibilities.
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthABSToolAutoUnequip"] = true
- #===============================================================================
- # No settings! O.o
- #===============================================================================
- unless $imported && $imported["SixthABSToolCycler"]
- class Game_System
- attr_accessor :disable_item_pop
- alias disable_pop_switch9974 initialize
- def initialize
- @disable_item_pop = false
- disable_pop_switch9974
- end
- end
- end
- class Game_Actor < Game_Battler
- def unequip_tool(item)
- $game_system.disable_item_pop = true
- change_equip(0, nil) if item == equips[0]
- change_equip(1, nil) if item == equips[1]
- @assigned_item = nil if @assigned_item && item.id == @assigned_item.id
- @assigned_item2 = nil if @assigned_item2 && item.id == @assigned_item2.id
- @assigned_skill = nil if @assigned_skill && item.id == @assigned_skill.id
- @assigned_skill2 = nil if @assigned_skill2 && item.id == @assigned_skill2.id
- @assigned_skill3 = nil if @assigned_skill3 && item.id == @assigned_skill3.id
- @assigned_skill4 = nil if @assigned_skill4 && item.id == @assigned_skill4.id
- $game_system.disable_item_pop = false
- end
- end
- class Game_CharacterBase
- alias auto_unequip8753 load_abs_tool
- def load_abs_tool(item)
- auto_unequip8753(item)
- if battler.is_a?(Game_Actor) && item
- if $imported && $imported["SixthABSToolVariables"]
- if item.var_req != 0 && $game_variables[item.var_req] <= 0
- $game_party.members.each {|mem| mem.unequip_tool(item)}
- if SceneManager.scene_is?(Scene_Map)
- SceneManager.scene.spriteset.pearl_tool_sprite.refresh_texts
- end
- end
- end
- if PearlKernel.tool_itemcost && PearlKernel.tool_itemcost != 0
- if $game_party.item_number($data_items[PearlKernel.tool_itemcost]) <= 0
- $game_party.members.each {|mem|
- mem.unequip_tool(item)
- mem.unequip_tool($data_items[PearlKernel.tool_itemcost])
- }
- if SceneManager.scene_is?(Scene_Map)
- SceneManager.scene.spriteset.pearl_tool_sprite.refresh_texts
- end
- end
- end
- if item.is_a?(RPG::Item)
- if item.consumable && $game_party.item_number(item) <= 0
- $game_party.members.each {|mem| mem.unequip_tool(item)}
- if SceneManager.scene_is?(Scene_Map)
- SceneManager.scene.spriteset.pearl_tool_sprite.refresh_texts
- end
- end
- end
- end
- end
- end
- class Spriteset_Map
- attr_accessor :pearl_tool_sprite
- end
- class Scene_Map < Scene_Base
- attr_reader :spriteset
- end
- class Scene_QuickTool < Scene_MenuBase
- alias disable_unusable_tools6653 perform_item_ok
- def perform_item_ok
- return if @items_w.item.nil?
- icst = @items_w.item.tool_data("Tool Item Cost = ")
- if icst && icst > 0 && $game_party.item_number($data_items[icst]) <= 0
- Sound.play_buzzer; return
- end
- if $imported && $imported["SixthABSToolVariables"]
- if @items_w.item.var_req != 0 && $game_variables[@items_w.item.var_req] <= 0
- Sound.play_buzzer; return
- end
- end
- disable_unusable_tools6653
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement