Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Battle Inventory
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.1
- # * Updated: 19/01/2019
- # * Requires: IMP1's Storage Boxes
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (19/01/2019)
- # - Initial release.
- # * Version 1.1 (19/01/2019)
- # - Fixed an issue with item usability in battle.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This script will designate a box from IMP1's script to be a storage for
- # "battle supplies". The player can only use items from this box during the
- # battle.
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this script between Materials and Main!
- #-------------------------------------------------------------------------------
- # * < 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["SixthBBox"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module BattleBox
- #-----------------------------------------------------------------------------
- # Battle Inventory Settings
- #-----------------------------------------------------------------------------
- # You have 5 little settings here, so lets get started...
- #
- # :id => box_id,
- # The ID of the box you want to use for the battle inventory.
- #
- # :show => true/false/switch_id,
- # This will let you add a new command to the main menu.
- # The new command will open the battle inventory and will let the player place
- # or take items to/from it.
- # You can set it to true, and it will always be enabled.
- # Setting it to false will disable this feature, in which case the rest of
- # the setting options here won't do anything.
- # You can also set it to a switch ID, in which case the command will be shown
- # when that switch is turned ON, and it will be hidden when that switch is
- # turned OFF.
- # You can also use methods and code strings for this, but I won't detail that
- # here. It requires coding knowledge to do that, so if you have some, just
- # check the code and you should be able to figure it out how to do this on
- # your own. :P
- #
- # :enable => true/false/switch_id,
- # Similar to the previous option, this one lets you enable or disable the new
- # command.
- # You can setup this the same way as the previous setting option.
- #
- # :name => "command name",
- # This will be the name of the new command. Must be a string!
- #
- # :index => command_index,
- # This will decide where the new command will appear on the command list.
- # 0 means it will be the first command, 1 will be the second command, and so
- # on.
- # You can also use negative numbers to setup the place from the last command
- # instead. In this case, -1 is the last command, -2 is the second last, and
- # so on.
- #
- # That's it, I guess.
- #-----------------------------------------------------------------------------
- Data = {
- :id => 2, # Battle box ID.
- :show => true, # Show battle box menu command?
- :enable => true, # Enable battle box menu command?
- :name => "Battle Supplies", # Menu command name
- :index => 1, # Menu command index
- }
- end
- #===============================================================================
- # End of settings! Editing anything below may lead to... you know it, right? o.o
- #===============================================================================
- class Game_Battler < Game_BattlerBase
- alias battle_use0027 consume_item
- def consume_item(it)
- if SceneManager.scene_is?(Scene_Battle) || $game_party.in_battle
- if it.is_a?(RPG::Item) && it.consumable
- $game_boxes.remove_item(it, 1, BattleBox::Data[:id], false)
- end
- else
- battle_use0027(it)
- end
- end
- end
- class Game_Party < Game_Unit
- alias bbox_patch0071 has_item?
- def has_item?(it, eq = false)
- if SceneManager.scene_is?(Scene_Battle) || $game_party.in_battle
- box = $game_boxes.box(BattleBox::Data[:id])
- return (box[it] || 0) > 0
- else
- return bbox_patch0071(it,eq)
- end
- end
- end
- class Window_BattleItem < Window_ItemList
- def make_item_list
- box = $game_boxes.box(BattleBox::Data[:id])
- @data = box.keys.select {|it| include?(it)}
- @data.push(nil) if include?(nil)
- end
- def draw_item_number(rect, it)
- tx = sprintf(":%2d", $game_boxes.box(BattleBox::Data[:id])[it])
- draw_text(rect, tx, 2)
- end
- end
- class Window_MenuCommand < Window_Command
- alias add_bbox_cmd1232 make_command_list
- def make_command_list
- add_bbox_cmd1232
- return unless cond?(BattleBox::Data[:show])
- cmd = {
- :name => BattleBox::Data[:name], :symbol=> :bbox,
- :enabled => cond?(BattleBox::Data[:enable]), :ext => nil
- }
- @list.insert(BattleBox::Data[:index],cmd)
- end
- def cond?(dt)
- case dt
- when Integer; return $game_switches[dt]
- when Symbol; return send(dt)
- when Array; return send(*dt)
- when String; return eval(dt)
- else; return dt
- end
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias add_bbox_cmd9826 create_command_window
- def create_command_window
- add_bbox_cmd9826
- @command_window.set_handler(:bbox, method(:bbox_menu))
- end
- def bbox_menu
- SceneManager.call(Scene_ItemStorage)
- SceneManager.scene.prepare(BattleBox::Data[:id])
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement