Hi, folks.
I want the category window in Galv's Multiple Storage Containers to be removed. Is there a way to do this?
Greetings,
Tw0Face
I want the category window in Galv's Multiple Storage Containers to be removed. Is there a way to do this?
Code:
#------------------------------------------------------------------------------#
# Galv's Multiple Storage Containers
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.6
#------------------------------------------------------------------------------#
# 2015-10-22 - Version 1.6 - fixed take all bug missed
# 2015-10-21 - Version 1.5 - fixed a bug in "take all" and item limits
# 2013-01-20 - Version 1.4 - fixed a "take all" bug in a dangerous container
# 2013-01-17 - Version 1.3 - take all command added
# taking/adding items can change a variable and
# be displayed in the scene with custom text.
# added chance to be caught stealing allowing
# actors and equips to modify that chance.
# 2012-10-24 - Version 1.2 - changing alias names for compatibility.
# 2012-10-24 - Version 1.1 - forgot to alias game_temp initialize method... fixed
# 2012-10-23 - Version 1.0 - release
#------------------------------------------------------------------------------#
# Allows you to make any event a storage container and able to add or remove
# items from it. Populate your containers any time you choose with script calls.
#
# Each container has a status - colored text of your choice that displays at
# the bottom of the screen with a variable. Adding or taking items from the
# container can increase or decrease this variable how you see fit. Can also
# set a % chance the player will be caught if he tries to steal. When this
# happens, the scene closes and a switch is turned on - you use conditional
# branches to determine what happens. (The switch could even be for all people
# to attack you!)
#
#------------------------------------------------------------------------------#
#
# INSTRUCTIONS:
# To set up an event as a container:
#
# 1. use the 'c_add' script call to populate containers with items
# you want in there. You choose how you want to do this. In my demo I chose to
# add items to containers when the player searched them (and use a self switch
# to make sure they don't keep getting free items). You could populate your
# containers at any point you like, though.
#
# 2. add the open_container("name") script command.
#
# That's all there is to it unless you look at the c_status script call, you
# can make each container act a bit differently.
#
#------------------------------------------------------------------------------#
# Script calls to use:
#------------------------------------------------------------------------------#
#
# open_container("name") # Opens event container
# # Uses "name" in scene.
#
# c_add("type", item_id, amount, event_id, map_id) # Adds item to container.
#
# c_rem("type", item_id, amount, event_id, map_id) # removes item from container
#
# c_count("type", id, event_id, map_id) # counts certain item in
# # container. Use in condition
# # branches and variables.
#
# c_status("text",color,take_rep,give_rep,caught_chance)
#
# # Changes the container status.
# # All containers opened after this call will have this status (So you could
# # set it for a location or set it before each container opens - see below)
#
#------------------------------------------------------------------------------#
# EXPLAINATION:
# type this can be "weapon", "armor" or "item"
# item_id the ID of the item/armor/weapon you want to add
# amount the number of the item/armor/weapon/gold you want to remove
# event_id the event ID of the container you want to add items to. Set this
# to 0 to add an item to the event the script call is in.
# map_id the ID of the map the container you want is on. Make this 0 if you
# want to refer to the same map as the script call was made.
#
# EXAMPLE OF USE:
# c_add("item",2,3,5,4) # adds an item to event 5 on map 4
# c_add("weapon",2,3,0,0) # adds a weapon to the same event as the call
# c_rem("armor",3,6,10,2) # removes armor from event 10 on map 2
# c_count("item",1,5,1) # counts item ID 1 stored in event 5 on map 1
# c_status("Safe",4,-10,5,8) # shows "Safe" in blue(4) at the bottom
# # -10 rep for each item taken.
# # +5 rep for each item put.
# # 8% chance each time you take to get caught
# # You cant 'take all' when there's a chance to
# # get caught in a container.
#------------------------------------------------------------------------------#
# Note tag for ARMORS, WEAPONS and ACTORS
#------------------------------------------------------------------------------#
#
# <take_mod: x> # increases or decreases the % chance to be caught when
# # stealing if one of these things have the note tag.
#
# # Ideas for use: Actors that are thieves, 'thief glove' or 'lockpick'
# # accessories.
#
#------------------------------------------------------------------------------#
# Note tag for ARMORS, WEAPONS and ITEMS
#------------------------------------------------------------------------------#
#
# <take_value: x> # increases or decreases the amount of rep you gain or
# # lose by this number. This is to make more expensive or
# # rarer items have a bigger effect on rep when taking or
# # adding them to containers. In the c_status script call,
# # if it is 0 to rep change, this will not add/take from it
#
# # Ideas for use: Treasure hunting. Gain more rep for taking a higher value
# # item from a chest. Just be sure you don't set it up so that they can
# # manipulate their rep by adding and taking items.
#
#------------------------------------------------------------------------------#
# I recommend downloading the demo to see how to set up container events as
# this got a bit complicated with adding features.
#
# More setup options further down.
#------------------------------------------------------------------------------#
($imported ||= {})["Galvs_Item_Containers"] = true
module Galv_Container
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
# COMMAND LIST VOCAB
REMOVE = "Remove"
STORE = "Store"
CANCEL = "Cancel"
# OTHER VOCAB
IN_STORAGE = "In Container"
IN_INVENTORY = "In Inventory"
TAKE_TEXT = "Remove how many?"
STORE_TEXT = "Store how many?"
TAKE_ALL = "A: Take All" # Text displayed bottom left
REP = "Reputation" # Text displayed in the bottom right
# Make this "" to not use it.
REP_VAR = 1 # Variable displayed after the REP text. This is the variable
# that can change when you take or put things into a container
# Make this 0 to not use.
# OTHER OPTIONS
SE = ["Equip2", 90, 100] # Sound effect when storing/removing an item
STORE_PRICELESS = true # Items worth 0 can be stored? true or false
STORE_KEY = true # Key items can be stored? true or false
C_SE = ["Buzzer1", 90, 100] # Sound effect when caught stealing
C_SWITCH = 2 # Switch is turned ON when you are caught
# PARTY LIMITS
# NOTE: These limits set to 0 will use the default limits. In theory this will
# be compatible with a limit breaker script by leaving them at 0. Or you can
# set the party limits below to whatever you like.
MAX_ITEMS = 10 # Max items your PARTY can carry.
# This will overwrite the default limit.
# 0 means do not use this.
TAKE_ONLY_SWITCH = 1 # Switch ID. Turn ON to only allow taking from all
# containers. Switch OFF to allow both again.
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
end
class Game_Temp
attr_accessor :contents
attr_accessor :container_name
alias galv_container_initialize initialize
def initialize
galv_container_initialize
@contents = []
@container_name = ""
end
end # Game_Temp
class RPG::BaseItem
def take_mod
if @take_mod.nil?
if @note =~ /<take_mod: (.*)>/i
@take_mod = $1.to_i
else
@take_mod = 0
end
end
@take_mod
end
def take_value
if @take_value.nil?
if @note =~ /<take_value: (.*)>/i
@take_value = $1.to_i
else
@take_value = 0
end
end
@take_value
end
end
class Scene_Container < Scene_MenuBase
def start
super
check_storage_exists
create_help_window
create_name_window
create_info_window
create_command_window
create_dummy_window
create_number_window
create_status_window
create_category_window
create_take_window
create_give_window
end
def check_storage_exists
if $game_party.container[$game_temp.contents].nil?
$game_party.container[$game_temp.contents] = {}
end
return @btn_active = false if danger_box?
@btn_active = true if !$game_party.container[$game_temp.contents].empty?
end
def danger_box?
$game_party.container_status[4] > 0
end
def update
super
check_key
end
def check_key
if Input.trigger?(:X)
if @btn_active
take_all
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# Create Windows
#--------------------------------------------------------------------------
def create_name_window
@name_window = Window_ContainerName.new
@name_window.viewport = @viewport
@name_window.x = Graphics.width - @name_window.width
@name_window.y = @help_window.height
end
def create_info_window
@info_window = Window_Info.new
@info_window.viewport = @viewport
@info_window.x = 0
@info_window.y = Graphics.height - @info_window.height
end
def create_command_window
@command_window = Window_ContainerCommand.new(@name_window.x)
@command_window.viewport = @viewport
@command_window.y = @help_window.height
@command_window.set_handler(:give, method(:command_give))
@command_window.set_handler(:take, method(:command_take))
@command_window.set_handler(:cancel, method(:return_scene))
end
def create_dummy_window
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy - @name_window.height
@dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
@dummy_window.viewport = @viewport
@dummy_window.hide
end
def create_number_window
wy = @dummy_window.y
wh = @dummy_window.height
@number_window = Window_ContainerNumber.new(0, wy, wh)
@number_window.viewport = @viewport
@number_window.hide
@number_window.set_handler(:ok, method(:on_number_ok))
@number_window.set_handler(:cancel, method(:on_number_cancel))
end
def create_status_window
wx = @number_window.width
wy = @dummy_window.y
ww = Graphics.width - wx
wh = @dummy_window.height
@status_window = Window_ContainerItems.new(wx, wy, ww, wh)
@status_window.viewport = @viewport
@status_window.hide
end
def create_category_window
@category_window = Window_ItemCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = @dummy_window.y
@category_window.hide.deactivate
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:on_category_cancel))
end
def create_give_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy - @name_window.height
@give_window = Window_ContainerGive.new(0, wy, Graphics.width, wh)
@give_window.viewport = @viewport
@give_window.help_window = @help_window
@give_window.hide
@give_window.set_handler(:ok, method(:on_give_ok))
@give_window.set_handler(:cancel, method(:on_give_cancel))
@category_window.item_window = @give_window
end
def create_take_window
wy = @command_window.y + @command_window.height
wh = Graphics.height - wy - @name_window.height
@take_window = Window_ContainerTake.new(0, wy, Graphics.width, wh)
@take_window.viewport = @viewport
@take_window.help_window = @help_window
@take_window.set_handler(:ok, method(:on_take_ok))
@take_window.set_handler(:cancel, method(:on_take_cancel))
@category_window.item_window = @take_window
end
#--------------------------------------------------------------------------
# * Activate Windows
#--------------------------------------------------------------------------
def activate_give_window
@category_window.show
@give_window.refresh
@give_window.show.activate
@status_window.hide
end
def activate_take_window
@take_window.select(0)
@take_window.refresh
@take_window.show.activate
@status_window.hide
end
def btn_activate
return btn_deactivate if danger_box?
return btn_deactivate if $game_party.container[$game_temp.contents].empty?
@info_window.refresh(true)
@btn_active = true
end
def btn_deactivate
@info_window.refresh(false)
@btn_active = false
end
#--------------------------------------------------------------------------
# HANDLER METHODS
#--------------------------------------------------------------------------
def on_category_ok
activate_give_window
@give_window.select(0)
btn_deactivate
end
def on_category_cancel
@command_window.activate
@take_window.show
@take_window.refresh
@category_window.hide
@give_window.hide
btn_activate
end
def command_give
@take_window.hide
@category_window.show.activate
@give_window.show
@give_window.unselect
@give_window.refresh
btn_deactivate
end
def on_give_ok
@item = @give_window.item
if @item.nil?
RPG::SE.stop
Sound.play_buzzer
@give_window.activate
@give_window.refresh
return
else
@status_window.item = @item
@category_window.hide
@give_window.hide
@number_window.set(@item, max_give, @command_window.current_symbol)
@number_window.show.activate
@status_window.show
btn_deactivate
end
end
def on_give_cancel
@give_window.unselect
@category_window.activate
@status_window.item = nil
@help_window.clear
end
def command_take
activate_take_window
@take_window.show
@take_window.refresh
btn_activate
end
def on_take_ok
btn_deactivate
@item = @take_window.item
if @item.nil? || $game_party.container[$game_temp.contents].empty? || $game_party.item_number(@item) == $game_party.max_item_number(@item)
RPG::SE.stop
Sound.play_buzzer
@take_window.activate
@take_window.refresh
return
elsif
@item = @take_window.item
@status_window.item = @item
@take_window.hide
@number_window.set(@item, max_take, @command_window.current_symbol)
@number_window.show.activate
@status_window.show
end
end
def on_take_cancel
@take_window.unselect
@command_window.activate
@take_window.show
@status_window.item = nil
@help_window.clear
end
def on_number_ok
RPG::SE.new(Galv_Container::SE[0], Galv_Container::SE[1], Galv_Container::SE[2]).play
case @command_window.current_symbol
when :take
do_take(@number_window.number)
btn_activate
when :give
do_give(@number_window.number)
btn_deactivate
end
end_number_input
@status_window.refresh
end
def on_number_cancel
Sound.play_cancel
end_number_input
end
def end_number_input
@number_window.hide
case @command_window.current_symbol
when :take
activate_take_window
btn_activate
when :give
activate_give_window
end
end
#--------------------------------------------------------------------------
# * Giving and taking methods
#--------------------------------------------------------------------------
def max_take
if $game_party.container[$game_temp.contents][@item] > $game_party.max_item_number(@item) - $game_party.item_number(@item)
$game_party.max_item_number(@item) - $game_party.item_number(@item)
else
$game_party.container[$game_temp.contents][@item]
end
end
def max_give
$game_party.item_number(@item)
end
def do_give(number)
$game_party.lose_item(@item, number)
if $game_party.container[$game_temp.contents][@item].nil?
$game_party.container[$game_temp.contents][@item] = number
else
$game_party.container[$game_temp.contents][@item] += number
end
get_take_value(3)
$game_variables[Galv_Container::REP_VAR] += ($game_party.container_status[3] + @take_value) * number
end
def do_take(number)
check_capture
return if @item.nil?
$game_party.gain_item(@item, number)
$game_party.container[$game_temp.contents][@item] -= number
$game_party.container[$game_temp.contents].delete(@item) if $game_party.container[$game_temp.contents][@item] <= 0
if $game_party.container[$game_temp.contents].empty?
@take_window.activate
end
get_take_value(2)
$game_variables[Galv_Container::REP_VAR] += ($game_party.container_status[2] + @take_value) * number
end
def take_all
return Sound.play_buzzer if $game_party.container[$game_temp.contents].empty? ||
max_of_items
RPG::SE.new(Galv_Container::SE[0], Galv_Container::SE[1], Galv_Container::SE[2]).play
$game_party.container[$game_temp.contents].each do |i|
if i[1] > $game_party.max_item_number(i[0]) - $game_party.item_number(i[0])
# if no. items in chest taken is greater than max allowed - inventory
number = $game_party.max_item_number(i[0]) - $game_party.item_number(i[0])
p number
else
number = i[1]# - $game_party.item_number(i[0])
end
#p number
$game_party.gain_item(i[0], number)
i[1] -= number
$game_party.container[$game_temp.contents][i[0]] -= number
$game_party.container[$game_temp.contents].delete(i[0]) if i[1] <= 0
@item = i[0]
get_take_value(2)
$game_variables[Galv_Container::REP_VAR] += ($game_party.container_status[2] + @take_value) * number
end
btn_activate
@take_window.refresh
end
def max_of_items
# if all items in box are maxed, return true
$game_party.container[$game_temp.contents].each { |i|
return false if $game_party.item_number(i[0]) < $game_party.max_item_number(i[0])
}
return true
end
def get_take_value(pos)
return @take_value = 0 if @item.nil?
if $game_party.container_status[pos] == 0
@take_value = 0
elsif $game_party.container_status[pos] > 0
@take_value = @item.take_value
else $game_party.container_status[pos] < 0
@take_value = [email hidden]_value
end
end
def check_capture
a = rand(100)
chance = $game_party.container_status[4] + actor_mod + equip_mod
if a < chance
RPG::SE.new(Galv_Container::C_SE[0], Galv_Container::C_SE[1], Galv_Container::C_SE[2]).play
$game_switches[Galv_Container::C_SWITCH] = true
SceneManager.goto(Scene_Map)
end
end
def equip_mod
equip_mod = 0
$game_party.members.each do |m|
m.equips.each do |eq|
next if eq.nil?
equip_mod += eq.take_mod
end
end
return equip_mod
end
def actor_mod
actor_mod = 0
$game_party.members.each do |m|
actor_mod += $data_actors[m.id].take_mod
end
return actor_mod
end
end # Scene_Container < Scene_MenuBase
#------------------------------------------------------------------------------#
# Window Container Name
#------------------------------------------------------------------------------#
class Window_ContainerName < Window_Base
def initialize
super(0, 0, window_width, fitting_height(1))
refresh
end
def window_width
return 180
end
def refresh
contents.clear
c_name = convert_escape_characters($game_temp.container_name)
draw_text(x - 10, y, window_width, line_height, c_name,1)
end
def open
refresh
super
end
end
#------------------------------------------------------------------------------#
# Window Info
#------------------------------------------------------------------------------#
class Window_Info < Window_Base
def initialize
super(0, 0, Graphics.width, fitting_height(1))
@btn_state = true if !$game_party.container[$game_temp.contents].empty?
@btn_state = false if $game_party.container_status[4] > 0
refresh(@btn_state)
end
def refresh(btn)
@btn_state = btn
contents.clear
draw_texts
end
def draw_texts
change_color(normal_color, @btn_state)
draw_text(0, 0, contents.width, line_height, Galv_Container::TAKE_ALL, 0)
change_color(text_color($game_party.container_status[1]))
draw_text(0, 0, contents.width, line_height, $game_party.container_status[0], 1)
if Galv_Container::REP_VAR <= 0
repvar = ""
else
repvar = $game_variables[Galv_Container::REP_VAR]
end
change_color(normal_color)
draw_text(0, 0, contents.width, line_height, Galv_Container::REP + " " + repvar.to_s, 2)
end
end
#------------------------------------------------------------------------------#
# Window Stored Items
#------------------------------------------------------------------------------#
class Window_StoreList < Window_Selectable
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
def category=(category)
return if @category == category
@category = category
refresh
self.oy = 0
end
def col_max
return 2
end
def item_max
@data ? @data.size : 1
end
def item
@data && index >= 0 ? @data[index] : nil
end
def current_item_enabled?
enable?(@data[index])
end
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
item.is_a?(RPG::Weapon)
when :armor
item.is_a?(RPG::Armor)
when :key_item
item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
def enable?(item)
$game_party.container[$game_temp.contents].has_key?(item)
end
def make_item_list
@data = $game_party.container[$game_temp.contents].keys {|item| include?(item) }
@data.push(nil) if include?(nil)
end
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
draw_item_number(rect, item)
end
end
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.container[$game_temp.contents][item]), 2)
end
def update_help
@help_window.set_item(item)
end
def refresh
make_item_list
create_contents
draw_all_items
end
end # Window_StoreList < Window_Selectable
#------------------------------------------------------------------------------#
# Window Stored Item amount
#------------------------------------------------------------------------------#
class Window_ContainerNumber < Window_Selectable
attr_reader :number
def initialize(x, y, height)
super(x, y, window_width, height)
@item = nil
@max = 1
@number = 1
end
def window_width
return 304
end
def set(item, max, cmd)
@item = item
@max = max
@number = 1
@cmd = cmd
refresh
end
def refresh
contents.clear
draw_item_name(@item, 0, item_y)
draw_number
draw_how_many
end
def draw_number
change_color(normal_color)
draw_text(cursor_x - 28, item_y, 22, line_height, "×")
draw_text(cursor_x, item_y, cursor_width - 4, line_height, @number, 2)
end
def item_y
contents_height / 2 - line_height * 3 / 2
end
def cursor_width
figures * 10 + 12
end
def cursor_x
contents_width - cursor_width - 4
end
def figures
return 2
end
def update
super
if active
last_number = @number
update_number
if @number != last_number
Sound.play_cursor
refresh
end
end
end
def update_number
change_number(1) if Input.repeat?(:RIGHT)
change_number(-1) if Input.repeat?(:LEFT)
change_number(10) if Input.repeat?(:UP)
change_number(-10) if Input.repeat?(:DOWN)
end
def change_number(amount)
@number = [[@number + amount, @max].min, 1].max
end
def update_cursor
cursor_rect.set(cursor_x, item_y, cursor_width, line_height)
end
def draw_how_many
change_color(system_color)
case @cmd
when :take
draw_text(4, 4, contents.width, line_height, Galv_Container::TAKE_TEXT)
when :give
draw_text(4, 4, contents.width, line_height, Galv_Container::STORE_TEXT)
end
change_color(normal_color)
end
end # Window_ContainerNumber < Window_Selectable
#------------------------------------------------------------------------------#
# Window Store Item Status
#------------------------------------------------------------------------------#
class Window_ContainerItems < Window_Base
def initialize(x, y, width, height)
super(x, y, width, height)
@item = nil
@page_index = 0
refresh
end
def refresh
contents.clear
draw_possession(4, 0)
draw_stored(4, line_height)
draw_equip_info(4, line_height * 2) if @item.is_a?(RPG::EquipItem)
end
def item=(item)
@item = item
refresh
end
def draw_possession(x, y)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change_color(system_color)
draw_text(rect, Galv_Container::IN_INVENTORY)
change_color(normal_color)
draw_text(rect, $game_party.item_number(@item), 2)
end
def draw_stored(x, y)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change_color(system_color)
draw_text(rect, Galv_Container::IN_STORAGE)
change_color(normal_color)
stored_amount = $game_party.container[$game_temp.contents][@item]
stored_amount = 0 if stored_amount.nil?
draw_text(rect, stored_amount, 2)
end
def draw_equip_info(x, y)
status_members.each_with_index do |actor, i|
draw_actor_equip_info(x, y + line_height * (i * 2.4), actor)
end
end
def status_members
$game_party.members[@page_index * page_size, page_size]
end
def page_size
return 4
end
def page_max
($game_party.members.size + page_size - 1) / page_size
end
def draw_actor_equip_info(x, y, actor)
enabled = actor.equippable?(@item)
change_color(normal_color, enabled)
draw_text(x, y, 112, line_height, actor.name)
item1 = current_equipped_item(actor, @item.etype_id)
draw_actor_param_change(x, y, actor, item1) if enabled
draw_item_name(item1, x, y + line_height, enabled)
end
def draw_actor_param_change(x, y, actor, item1)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change = @item.params[param_id] - (item1 ? item1.params[param_id] : 0)
change_color(param_change_color(change))
draw_text(rect, sprintf("%+d", change), 2)
end
def param_id
@item.is_a?(RPG::Weapon) ? 2 : 3
end
def current_equipped_item(actor, etype_id)
list = []
actor.equip_slots.each_with_index do |slot_etype_id, i|
list.push(actor.equips[i]) if slot_etype_id == etype_id
end
list.min_by {|item| item ? item.params[param_id] : 0 }
end
def update
super
update_page
end
def update_page
if visible && Input.trigger?(:A) && page_max > 1
@page_index = (@page_index + 1) % page_max
refresh
end
end
end # Window_ContainerItems < Window_Base
#------------------------------------------------------------------------------#
# Window Give Item
#------------------------------------------------------------------------------#
class Window_ContainerGive < Window_ItemList
def initialize(x, y, width, height)
super(x, y, width, height)
end
def current_item_enabled?
enable?(@data[index])
end
def enable?(item)
if item.is_a?(RPG::Item)
return false if item.key_item? && !Galv_Container::STORE_KEY
end
if Galv_Container::STORE_PRICELESS
true
else
item && item.price > 0
end
end
end # Window_ContainerGive < Window_ItemList
#------------------------------------------------------------------------------#
# Window Take Item
#------------------------------------------------------------------------------#
class Window_ContainerTake < Window_StoreList
def initialize(x, y, width, height)
super(x, y, width, height)
end
def current_item_enabled?
enable?(@data[index])
end
def enable?(item)
$game_party.container[$game_temp.contents][item] != 0 && $game_party.item_number(item) < $game_party.max_item_number(@item)
end
end # Window_ContainerTake < Window_StoreList
#------------------------------------------------------------------------------#
# Window Command
#------------------------------------------------------------------------------#
class Window_ContainerCommand < Window_HorzCommand
def initialize(window_width)
@window_width = window_width
super(0, 0)
end
def window_width
@window_width
end
def col_max
return 2 if $game_switches[Galv_Container::TAKE_ONLY_SWITCH]
return 3
end
def make_command_list
add_command(Galv_Container::REMOVE, :take)
add_command(Galv_Container::STORE, :give) if !$game_switches[Galv_Container::TAKE_ONLY_SWITCH]
add_command(Galv_Container::CANCEL, :cancel)
end
end # Window_ContainerCommand < Window_HorzCommand
#------------------------------------------------------------------------------#
# Game Party Additions
#------------------------------------------------------------------------------#
class Game_Party < Game_Unit
attr_accessor :container
attr_accessor :container_status
alias galv_mcontatiners_initialize initialize
def initialize
galv_mcontatiners_initialize
init_containers
end
def init_containers
@container_status = ["",0,0,0,0] # text,color,take_rep,give_rep,catch_chance
@container = {}
end
alias galv_container_max_item_number max_item_number
def max_item_number(item)
return Galv_Container::MAX_ITEMS if Galv_Container::MAX_ITEMS > 0
return 99 if item.nil?
galv_container_max_item_number(item)
end
end # Game_Party < Game_Unit
class Game_Interpreter
def c_add(type, id, amount, event_id, map_id)
if event_id <= 0
add_where = @event_id
else
add_where = event_id
end
if map_id <= 0
add_where_map = $game_map.map_id
else
add_where_map = map_id
end
$game_temp.contents = [add_where, add_where_map]
if $game_party.container[$game_temp.contents].nil?
$game_party.container[$game_temp.contents] = {}
end
case type
when "weapon"
@item = $data_weapons[id]
when "item"
@item = $data_items[id]
when "armor"
@item = $data_armors[id]
end
if $game_party.container[$game_temp.contents][@item].nil?
$game_party.container[$game_temp.contents][@item] = amount
else
$game_party.container[$game_temp.contents][@item] += amount
end
end
def c_rem(type, id, amount, event_id, map_id)
if event_id <= 0
rem_where = @event_id
else
rem_where = event_id
end
if map_id <= 0
rem_where_map = $game_map.map_id
else
rem_where_map = map_id
end
$game_temp.contents = [rem_where, rem_where_map]
if $game_party.container[$game_temp.contents].nil?
$game_party.container[$game_temp.contents] = {}
end
case type
when "weapon"
@item = $data_weapons[id]
when "item"
@item = $data_items[id]
when "armor"
@item = $data_armors[id]
end
return if $game_party.container[$game_temp.contents][@item].nil?
if $game_party.container[$game_temp.contents][@item] <= amount
$game_party.container[$game_temp.contents].delete(@item)
else
$game_party.container[$game_temp.contents][@item] -= amount
end
end
def c_count(type, id, event_id, map_id)
if event_id <= 0
container_id = @event_id
else
container_id = event_id
end
if map_id <= 0
container_id_map = $game_map.map_id
else
container_id_map = map_id
end
$game_temp.contents = [container_id, container_id_map]
if $game_party.container[$game_temp.contents].nil?
$game_party.container[$game_temp.contents] = {}
end
case type
when "weapon"
@item = $data_weapons[id]
when "item"
@item = $data_items[id]
when "armor"
@item = $data_armors[id]
end
return 0 if $game_party.container[$game_temp.contents][@item].nil?
$game_party.container[$game_temp.contents][@item]
end
def c_status(text,color,take_rep,give_rep,catch_chance)
$game_party.container_status = [text,color,take_rep,give_rep,catch_chance]
end
def c_empty?(event_id,map_id)
!$game_party.container[[event_id,map_id]].nil? &&
$game_party.container[[event_id,map_id]].empty?
end
def open_container(name)
$game_temp.container_name = name
$game_temp.contents = [@event_id, $game_map.map_id]
SceneManager.call(Scene_Container)
wait(1)
end
end # Game_Interpreter
Greetings,
Tw0Face