New account registration is temporarily disabled.

[RGSS] [RMVX ACE] HELP WITH EDITING A SCRIPT

Posts

Pages: 1
Hi,
this is a request for a friend of mine, i don't use VXA (because it bl0ws - just kidding there :P ) so i'm no good with this thing: my friend, she is making a horror-like game with one character and she has a custom menu made for one character party (it's by dark paladin, don't know if you know) and another script that integrates a item-weight limit function with discard option. so far so good.
now what she needs is a combine-item function to combine two items into one, we found a script over the internet which works, tho it calls a different menu with many function she doesn't need (in her menu she only has common items and key item slots, so we don't need to have the weapons/armor/whatelse optio), she would like the "combine item script" to operate in the item list that already exists in the regular menu;

what i have done so far is remove the "Discard" option (we don't want the player to be able to discard items) and i put the "Combine" option in its place, but since i suck at scriptin (as i said, im not much into xp or vx/a tools) i can't do much else by myself;

now here are the script involved with my modifications (where added):

Scene_Combine script - this has NOT been touched by me:
=begin
===============================================================================
Scene_Combine by efeberk
Version: RGSS3
===============================================================================
This script will allow to combine two items and generate a new item from
combined items. The scene is similiar with item_window. Actually you can use
Scene_Combine instead of Scene_Item because there is an option named "Use" that
allows you to use items. Why you need Item scene?

Example : You have 1 potion and 1 stimulant. Combine them and generate a new
Ultra stimulant.
--------------------------------------------------------------------------------

How to open Scene_Combine:

SceneManager.call(Scene_Combine)

Note : This script works on Items, Weapons and Armors
=end

module EFE
COMBINE_BUTTON = "Combine"
USE_BUTTON = "Use"
SUCCESS = "Items have been combined succesfully"

#Item name will be colored when you select an item in the list.
SELECTED_COLOR = 14


COMBINATIONS = [

#[[item1, :type], [item2, :type], [result, :type]],
#[[item1, :type], [item2, :type], [result, :type]],
[[1, :item],[2, :weapon], [3, :armor]],
[[8, :item],[9, :item], [3, :armor]]

]
end

#==============================================================================
# ** Window_ItemKategory
#------------------------------------------------------------------------------
# This window is for selecting a category of normal items and equipment
# on the item screen or shop screen.
#==============================================================================

class Window_ItemKategory < Window_HorzCommand
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
Graphics.width
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 4
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::item, :item)
add_command(Vocab::weapon, :weapon)
add_command(Vocab::armor, :armor)
add_command(Vocab::key_item, :key_item)
end
#--------------------------------------------------------------------------
# * Set Item Window
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end


class Window_ItemListe < Window_Selectable

attr_reader :accepted_items
attr_reader :combining

def initialize(x, y, width, height)
super
@combining = false
@accepted_items = []
@category = :none
@data = []
end

def combining=(combine)
@combining = combine
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 draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
draw_text(x + 24, y, width, line_height, item.name)
end

def enable?(item)
return true if @combining
$game_party.usable?(item)
end

def make_item_list
@data = $game_party.all_items.select {|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
k = [item.id, :item] if item.is_a?(RPG::Item)
k = [item.id, :weapon] if item.is_a?(RPG::Weapon)
k = [item.id, :armor] if item.is_a?(RPG::Armor)
change_color(normal_color, enable?(item))
change_color(text_color(EFE::SELECTED_COLOR), enable?(item)) if @accepted_items.include?(k)
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.item_number(item)), 2)
end

def update_help
@help_window.set_item(item)
end

def refresh
make_item_list
create_contents
draw_all_items
end
end


class Window_AcceptCombination < Window_HorzCommand

def initialize(x, y)
super(x, y)
self.z = 0
end

def window_width
return Graphics.width
end

def col_max
return 2
end

def make_command_list
add_command(EFE::COMBINE_BUTTON, :combine)
add_command(EFE::USE_BUTTON, :use)
end
end

class Scene_Combine < Scene_ItemBase

def start
super
create_help_window
create_options_window
create_category_window
create_item_window
end

def create_options_window
@options_window = Window_AcceptCombination.new(0, @help_window.y + @help_window.height)
@options_window.set_handler(:combine, method(:combine_ok))
@options_window.set_handler(:use, method(:use_ok))
@options_window.set_handler(:cancel, method(:return_scene))
end

def combine_ok
@item_window.combining = true
@combine = true
@category_window.item_window = @item_window
@options_window.deactivate.unselect
@category_window.activate.select(0)
end

def use_ok
@item_window.combining = false
@category_window.item_window = @item_window
@options_window.deactivate.unselect
@category_window.activate.select(0)
end

def create_category_window
@category_window = Window_ItemKategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = @help_window.height + @options_window.height
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:on_category_cancel))
end

def create_item_window
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
@item_window = Window_ItemListe.new(0, wy, Graphics.width, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@category_window.deactivate.unselect
end

def on_category_ok
@item_window.activate
@item_window.select_last
end

def on_category_cancel
@item_window.deactivate.unselect
@item_window.accepted_items.clear
@category_window.deactivate.unselect
@options_window.activate.select(0)
end

def on_item_ok
k = [@item_window.item.id, :item] if @item_window.item.is_a?(RPG::Item)
k = [@item_window.item.id, :weapon] if @item_window.item.is_a?(RPG::Weapon)
k = [@item_window.item.id, :armor] if @item_window.item.is_a?(RPG::Armor)
if !@item_window.combining
@options_window.deactivate
$game_party.last_item.object = item
determine_item
else
if @item_window.accepted_items.include?(k)
@item_window.accepted_items.delete(k)
else
@item_window.accepted_items.push(k)
end
if @item_window.accepted_items.size == 2
check_combinations(@item_window.accepted_items[0], @item_window.accepted_items[1])
@item_window.refresh
else
@item_window.refresh
@item_window.activate
end
end
end

def check_combinations(id1, id2)
EFE::COMBINATIONS.each {|i|
if (id1 == i[0] || id1 == i[1]) && (id2 == i[0] || id2 == i[1])
@combineitem1 = $data_items[i[0][0]] if i[0][1] == :item
@combineitem1 = $data_weapons[i[0][0]] if i[0][1] == :weapon
@combineitem1 = $data_armors[i[0][0]] if i[0][1] == :armor
@combineitem2 = $data_items[i[1][0]] if i[1][1] == :item
@combineitem2 = $data_weapons[i[1][0]] if i[1][1] == :weapon
@combineitem2 = $data_armors[i[1][0]] if i[1][1] == :armor
@resultitem = $data_items[i[2][0]] if i[2][1] == :item
@resultitem = $data_weapons[i[2][0]] if i[2][1] == :weapon
@resultitem = $data_armors[i[2][0]] if i[2][1] == :armor
@item_window.accepted_items.clear
@item_window.refresh
@item_window.activate
$game_party.lose_item(@combineitem1, 1)
$game_party.lose_item(@combineitem2, 1)
$game_party.gain_item(@resultitem, 1)
messagebox(EFE::SUCCESS, 400)
return
end
}
@item_window.accepted_items.clear
@item_window.refresh
@item_window.activate
end

def on_item_cancel
@item_window.unselect
@category_window.activate
end

def play_se_for_item
Sound.play_use_item
end

def use_item
super
@item_window.redraw_current_item
end
end

=begin
===============================================================================
MessageBox by efeberk
Version: RGSS3
===============================================================================
This script will allow to open a new messagebox window only with a text.
--------------------------------------------------------------------------------

Call MessageBox in Script:

messagebox(text, width)

width : width of the window

=end

class Window_MessageBox < Window_Base

def initialize(x, y, text, width)
super(x, y, width, fitting_height(1))
refresh(text)
end


def refresh(text)
draw_text(0, 0, contents_width, line_height, text, 1)
end

end

class Scene_MessageBox < Scene_Base

def start
super
create_message_window
create_background
end

def prepare(text, width)
@text = text
@width = width
end

def update
super
if Input.repeat?(:B) || Input.repeat?(:C)
SceneManager.return
end
end

def create_message_window
@message_window = Window_MessageBox.new(0, 0, @text, @width)
@message_window.width = @width
@message_window.x = (Graphics.width / 2) - (@message_window.width / 2)
@message_window.y = (Graphics.height / 2) - (@message_window.height / 2)
end

def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(100, 100, 100, 128)
end
end

def messagebox(text, width)
SceneManager.call(Scene_MessageBox)
SceneManager.scene.prepare(text, width)
end

this is the item weight script that has some modification by me:


#=======================================================
# Lune Item Weight
# Author : Raizen
# Script Function:
# The scripts adds the function of items having weight on the game,
# Basically all item have weights and they can only be carried if below the limit
#=======================================================


module Lune_Weight
#=============================================================================#
#========================= General Settings ==============================#
#=============================================================================#

# To configure a weight for an item, go to Database,
# Inside the notetags after choosing an item or equipe, put the following.
# <weight n> where n is the weight value,
# Example an item weighting 60,
# <weight 60>

# In case there are no notetags on the Item, the script will
# choose a default value which is:

Default = 0

# Receive even if over weight?
# To prevent from the actor receiving important itens through the game,
# you can allow the player to receive itens even if they are over the
# weight limit.
Receive = false
# If false, you need to know how to event the important itens, putting
# conditions so that importat itens are not left out without being received.

# In case they are over the weight limit, you can lock the character movement.
Travar = false

# Below the variables that you can use to make the event conditions:

# Choose a variable to receive the value of amount of weight carried.
Var_C = 8
# Choose a variable to receive the value of amount of the weight limit.
Var_M = 9
# With both variables you can event the conditions of receiving items or even
# event conditions considering the weight carried and limit.

LimiteB = "" # Configure if you are using Lune Item Vault (My vault script)
# to have no limite, LimiteB = ""
#=============================================================================#
#===================== Limit Weight Configuration ========================#
#=============================================================================#

# Maximum amount of weight carried,
# to configure the weight limit, you can put a variable value, a constant value
# or strength value.
# To put the main actor strength value => :for1
# To put the sum of actors strength value => :all_for
# To be the main actor level => :lvl1
# To be the sum of all actors level => :all_lvl
# To be a variable => :var
# To be a constant => :fix


# Exemple Carry_Limit = lvl1 will make only the strength of the
# first actor to be put in the formula.
Carry_Limit = :var

# Now you need to configure the formula of the weight limit,
# Exemple, if I want to the limit be 2 times all the party members strength

# def self.weight_formula(at)
# at * 2
# end

# at is the value of the atribute, and the multiply by 2 to get the total limit.

# In case its a variable or a constant number, just put the
# variable number, or the constant number.

# Exemple:

# def self.weight_formula(at)
# 20
# end

# The limit will be variable 20, ou if chosen a constant, will be 20.


def self.weight_formula(at)
9
end

module EFE #edit by ghost
#~ COMBINE_BUTTON = "Combina" #edit by ghost - removed, no need for this
#~ USE_BUTTON = " " #edit by ghost - removed, no need for this
SUCCESS = "Hai ottenuto un nuovo Oggetto." #edit by ghost
#Item name will be colored when you select an item in the list.
SELECTED_COLOR = 14

COMBINATIONS = [

#[[item1, :type], [item2, :type], [result, :type]],
#[[item_id, :item], [item_id, :item], [item_id, :item]],
[[12, :item],[13, :item], [14, :item]],

]
end

#===================== Vocabulary Settings ==========================#
# To Vocab, always put the text between commas '', or "".
# Weight name,
PS = ' lbs'

# Vocab on menu and shop
# Weight:
Peso = '• PESO:'

#Carrying =
Carregando = '• TOT:'

# If Lune Vault System included
# Vault =
Bau = '-unused ' #edit by ghost - removed, no need for this

# Vocabulary on item window

# Use =
Usar = 'Usa'
# Combine =
Combinar = 'Combina' #edit by ghost
# Dispose =
Descartar = 'Scarta' #remove


#=============================================================================#
#========================== Here starts the script ===========================#
#=============================================================================#

#--------------------------------------------------------------------------
# * Calculo do limite de peso
#--------------------------------------------------------------------------
def self.weight_limit
return unless $game_party.members[0]
case Carry_Limit
when :for1
weight = weight_formula($game_party.members[0].param(2))
when :all_for
weight = 0
for members in 0...$game_party.members.size - 1
weight += weight_formula($game_party.members[members].param(2))
end
when :lvl1
weight = weight_formula($game_party.members[0].level)
when :all_lvl
weight = 0
for members in 0...$game_party.members.size - 1
weight += weight_formula($game_party.members[members].level)
end
when :fix
weight = weight_formula(0)
when :var
weight = $game_variables[weight_formula(0)]
end
$game_variables[Var_M] = weight
weight
end
end



#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Esta classe gerencia o grupo. Contém informações sobre dinheiro, itens.
# A instância desta classe é referenciada por $game_party.
#==============================================================================

class Game_Party < Game_Unit
alias :lune_weight_gain :gain_item
#--------------------------------------------------------------------------
# * Quantidade de itens carregados mais os itens equipados
#--------------------------------------------------------------------------
def carried_items
@all_carried_items = 0
all_items.each {|item| get_weight(item)}
for i in 0...4
members.each {|actor| @all_carried_items += calc_weight(actor.equips[i], 1)}
end
$game_variables[Lune_Weight::Var_C] = @all_carried_items
@all_carried_items
end
#--------------------------------------------------------------------------
# * Calculo do peso de um item no inventário
#--------------------------------------------------------------------------
def get_weight(item)
if item.note =~ /<weight (.*)>/i
@all_carried_items += $1.to_i * item_number(item)
else
@all_carried_items += Lune_Weight::Default * item_number(item)
end
end
#--------------------------------------------------------------------------
# * Calculo do peso de um item relativo a quantidade
#--------------------------------------------------------------------------
def calc_weight(item, amount)
return 0 unless item
if item.note =~ /<weight (.*)>/i
carried_itens = $1.to_i * amount
else
carried_itens = Lune_Weight::Default * amount
end
carried_itens
end
#--------------------------------------------------------------------------
# * Acrescentar item (redução)
# item : item
# amount : quantia alterada
# include_equip : incluir itens equipados
#--------------------------------------------------------------------------
def gain_item(item, amount, include_equip = false)
if Lune_Weight::Receive
lune_weight_gain(item, amount, include_equip = false)
return
end
return if item == nil
weight = calc_weight(item, amount) + carried_items
while weight > Lune_Weight.weight_limit
amount -= 1
weight = calc_weight(item, amount) + carried_items
return if amount == 0
end
lune_weight_gain(item, amount, include_equip = false)
end
end

#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
# Esta classe executa o processamento da tela de loja.
#==============================================================================

class Scene_Shop < Scene_MenuBase
alias :lune_max_buy :max_buy
#--------------------------------------------------------------------------
# * Aquisição do número máximo disponível para compra
#--------------------------------------------------------------------------
def max_buy
max = lune_max_buy
weight = $game_party.calc_weight(@item, max) + $game_party.carried_items
while weight > Lune_Weight.weight_limit && max > 0
max -= 1
weight = $game_party.calc_weight(@item, max) + $game_party.carried_items
end
max
end
#--------------------------------------------------------------------------
# * Criação da janela de ajuda.
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_Weight_Help.new
@help_window.viewport = @viewport
@get_item_num = $game_party.carried_items
end
#--------------------------------------------------------------------------
# * Atualização da janela de peso
#--------------------------------------------------------------------------
def update
super
if @get_item_num != $game_party.carried_items
@help_window.refresh
@get_item_num = $game_party.carried_items
end
end
end

#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
# Esta janela exibe bens compráveis na tela de loja.
#==============================================================================

class Window_ShopBuy < Window_Selectable
alias :lune_enable_item :enable?
#--------------------------------------------------------------------------
# * Definição de habilitação do item
# item : item
#--------------------------------------------------------------------------
def enable?(item)
return false if $game_party.calc_weight(item, 1) + $game_party.carried_items > Lune_Weight.weight_limit
lune_enable_item(item)
end
end


#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# Esta janela exibe explicação de habilidades e itens e outras informações.
#==============================================================================

class Window_Weight_Help < Window_Base
include Lune_Weight
#--------------------------------------------------------------------------
# * Inicialização do objeto
# line_number : número de linhas
#--------------------------------------------------------------------------
def initialize(line_number = 2, bau = false)
@bau = bau
super(0, 0, Graphics.width, fitting_height(line_number))
self.windowskin = Cache.system("Window-2")
end
#--------------------------------------------------------------------------
# * Configuração de texto
# text : texto
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
@text = text
refresh
end
end
def on_bau(bau = false)
@bau = bau
end
#--------------------------------------------------------------------------
# * Limpeza
#--------------------------------------------------------------------------
def clear
set_text(" ")
end
#--------------------------------------------------------------------------
# * Definição de item
# item : habilidades, itens, etc.
#--------------------------------------------------------------------------
def set_item(item)
@item = item
set_text(item ? item.description : "")
end
#--------------------------------------------------------------------------
# * Renovação
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(4, 0, @text)
if @item
text = Peso + $game_party.calc_weight(@item,1).to_s + PS
draw_text(515, 0, 200, line_height, text, 0)
#~ if @bau == true
#~ LimiteB == "" ? text_lim = "????" : text_lim = LimiteB
#~ text = Bau + $game_party.items_on_vault.to_s + "/" + text_lim.to_s + PS
#~ else
text = Carregando + $game_party.carried_items.to_s + "/" + Lune_Weight.weight_limit.to_s + PS
end
draw_text(- 25, line_height, Graphics.width, line_height, text, 2)
end
end
#~ end


#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# Esta classe gerencia o jogador.
# A instância desta classe é referenciada por $game_player.
#==============================================================================

class Game_Player < Game_Character
alias :lune_move_by :move_by_input
#--------------------------------------------------------------------------
# * Processamento de movimento através de pressionar tecla
#--------------------------------------------------------------------------
def move_by_input
return if Lune_Weight::Travar && $game_party.carried_items > Lune_Weight.weight_limit
lune_move_by
end
end


#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# Esta classe executa o processamento da tela de item.
#==============================================================================
class Scene_Item < Scene_ItemBase
alias raizen_combine_start start
def start
raizen_combine_start
@combine_item = Window_Item_Combine.new
@combine_item.viewport = @viewport
@combine_item.set_handler(:use, method(:command_use))
#~ @combine_item.set_handler(:discard, method(:command_discard)) #no need
@combine_item.set_handler(:combine, method(:command_combine)) #edit by ghost
end
def on_item_ok
if item == nil
@item_window.activate
return
end
if @combine_item.close?
@combine_item.open
@combine_item.activate
else
determine_item
end
end

def update
super
if @number_window and @number_window.nitens == true
@number_window.nitens = false
@combine_item.close
@item_window.refresh
@help_window.refresh
@item_window.activate
end
if Input.trigger?(:B) and !@combine_item.close?
Sound.play_cancel
if @number_window and !@number_window.close?
@number_window.close
@combine_item.activate
else
@combine_item.close
@item_window.activate
end
end
end
def command_use
determine_item
end

#~ def command_discard
#~ if @number_window and !@number_window.close?
#~ @combine_item.activate
#~ return
#~ end
#~ @number_window = Window_NumberInputInner.new(Window_Base.new(0,0,0,0), item, @item_window.index)
#~ @number_window.viewport = @viewport
#~ @number_window.start
#~ end
def create_help_window
@help_window = Window_Weight_Help.new
@help_window.viewport = @viewport
end
end

def command_combine #edit by ghost
# integrare la combinazione di oggetti # edit by ghost
end #edit by ghost

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# Esta janela exibe os parâmetros dos membros do grupo na tela de menu.
#==============================================================================

class Window_Item_Combine < Window_Command
include Lune_Weight
#--------------------------------------------------------------------------
# * Inicialização do objeto
#--------------------------------------------------------------------------
def initialize
super(0, 0)
self.z = 9999
self.x = (Graphics.width / 2) - (window_width / 2)
self.y = Graphics.height / 2
self.openness = 0
end
#--------------------------------------------------------------------------
# * Aquisição da largura da janela
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Criação da lista de comandos
#--------------------------------------------------------------------------
def make_command_list
add_main_commands

end
#--------------------------------------------------------------------------
# * Adição dos comandos principais
#--------------------------------------------------------------------------
def add_main_commands
add_command(Usar, :use, true)
add_command(Combinar, :combine, true) #edit by ghost
#~ add_command(Descartar, :discard, true)
end
end




#==============================================================================
# ** Scene_ItemBase
#------------------------------------------------------------------------------
# Esta é a superclasse das classes que executam as telas de itens e
# habilidades.
#==============================================================================

class Scene_ItemBase < Scene_MenuBase
def determine_item
@combine_item.close
if item.is_a?(RPG::Item) and item.for_friend?
show_sub_window(@actor_window)
@actor_window.select_for_item(item)
else
item.is_a?(RPG::Item) ? use_item : Sound.play_buzzer
activate_item_window
end
end
end

#==============================================================================
# ** Window_NumberInputInner
#------------------------------------------------------------------------------
# Esta janela é utilizada para o comando de eventos [Armazenar Número]
#==============================================================================

class Window_NumberInputInner < Window_NumberInput
attr_accessor :nitens
def initialize(message_window, item, index_2)
@index_2 = index_2
@item = item
@get_lost_itens = 0
super(message_window)
end
#--------------------------------------------------------------------------
# * Inicialização do processo
#--------------------------------------------------------------------------
def start
@digits_max = 2
@number = @get_lost_itens
@number = [[@number, 0].max, 10 ** @digits_max - 1].min
@index = 0
update_placement
create_contents
refresh
open
activate
end
#--------------------------------------------------------------------------
# * Atualização da posição da janela
#--------------------------------------------------------------------------
def update_placement
self.width = @digits_max * 20 + padding * 2
self.height = fitting_height(1)
self.x = (Graphics.width - width) / 2
self.y = Graphics.height/2 - height
self.z = 150
end

#--------------------------------------------------------------------------
# * Definição de resultado ao pressionar o botão de confirmação
#--------------------------------------------------------------------------
def process_ok
Sound.play_ok
number = $game_party.item_number(@item)
if @number <= number
make_icon
end
deactivate
@nitens = true
close
end
def make_icon
@nitens = true
$game_party.lose_item(@item, @number)
end
end

#==============================================================================
# ** Window_ItemList
#------------------------------------------------------------------------------
# Esta janela exibe a lista de itens possuidos na tela de itens.
#==============================================================================

class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# * Definição de habilitação do item
# item : item
#--------------------------------------------------------------------------
def enable?(item)
true
end
end

$lune_weight_script = true

and, if needed, this is the single-character menu:


###############################################################################
# Dark Paladin Single Character Menu v1.2
# Platform: VX Ace
# Author: Dark Paladin
# Description: A menu system for a single Character.
# Terms of use: You MAY use this script for your Non-commercial Projects.
# You MAY use this script for Commercial projects without my permission.
# Credit is appreciated but not needed.
# This script requires: N/A Cachext Included
###############################################################################
#==============================================================================
# CONFIG AREA
#==============================================================================

module DKP_Menu_Config
Enable_Background = true # true/false Use Background?
Menu_Background = "Menu" # Set the name of the background pic
# Place Image in "Graphics/DPmenu/Main/" Or change it in the cachext module.
Status_Opacity = 0 # Status Window Opacity
Help_Opacity = 0 # Item Help Window Opacity
Item_Opacity = 0 # Item Window Opacity
Command_Opacity = 0 # Command Window Opacity
CategoryW_Opacity = 0 # Category Window Opacity
end

module Cachext
#--------------------------------------------------------------------------
# DKP Cachext
# Do not edit unless you really know what your doing!
# Platform: VX Ace
# Author: Dark paladin
# Description: Module for menu background.
# -------------------------------------------------------------------------
#--------------------------------------------------------------------------
# *Graphics
#--------------------------------------------------------------------------
#You can edit the stuff in purple between the "" to change folder location.
#--------------------------------------------------------------------------
# *Menu Graphics Folder
#--------------------------------------------------------------------------
def self.dpmenu(filename)# You can change the Folder names here for background image.
load_bitmap("Graphics/DPmenu/Main/", filename)
end
#==============================================================================
# END CONFIG AREA
#==============================================================================
#--------------------------------------------------------------------------
# * Load Bitmap
#--------------------------------------------------------------------------
def self.load_bitmap(folder_name, filename, hue = 0)
@cachext ||= {}
if filename.empty?
empty_bitmap
elsif hue == 0
normal_bitmap(folder_name + filename)
else
hue_changed_bitmap(folder_name + filename, hue)
end
end
#--------------------------------------------------------------------------
# * Create Empty Bitmap
#--------------------------------------------------------------------------
def self.empty_bitmap
Bitmap.new(32, 32)
end
#--------------------------------------------------------------------------
# * Create/Get Normal Bitmap
#--------------------------------------------------------------------------
def self.normal_bitmap(path)
@cachext = Bitmap.new(path) unless include?(path)
@cachext
end
#--------------------------------------------------------------------------
# * Create/Get Hue-Changed Bitmap
#--------------------------------------------------------------------------
def self.hue_changed_bitmap(path, hue)
key =
unless include?(key)
@cachext = normal_bitmap(path).clone
@cachext.hue_change(hue)
end
@cachext
end
#--------------------------------------------------------------------------
# * Check Cache Existence
#--------------------------------------------------------------------------
def self.include?(key)
@cachext && !@cachext.disposed?
end
#--------------------------------------------------------------------------
# * Clear Cache
#--------------------------------------------------------------------------
def self.clear
@cachext ||= {}
@cachext.clear
GC.start
end
end

#==============================================================================
# ** Window_ItemCategory
#------------------------------------------------------------------------------
# This window is for selecting a category of normal items and equipment
# on the item screen or shop screen.
#==============================================================================
class Window_ItemCategory < Window_HorzCommand
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
244
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::item, :item)
add_command(Vocab::key_item, :key_item)
end
#--------------------------------------------------------------------------
# * Set Item Window
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :pending_index # Pending position (for formation)
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y)
super(0, 0, 640, 480)
@pending_index = -1
self.opacity = Status_Opacity
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 300
end
#--------------------------------------------------------------------------
# * Get Window Height
#--------------------------------------------------------------------------
def window_height
return 370
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
return 1
end
#--------------------------------------------------------------------------
# * Get Item Height
#--------------------------------------------------------------------------
def item_height
(height - standard_padding * 2) / 4
end
#--------------------------------------------------------------------------
# Simple Status
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 200)
draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
draw_text(x, y, 0, line_height, Vocab::hp_a)
#~ draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
#~ hp_color(actor), normal_color)
end
def draw_actor_name(actor, x, y, width = 140)
change_color(hp_color(actor))
draw_text(x, y, width / 2, line_height, actor.name)
end
def draw_actor_simple_status(actor, x, y)
draw_actor_name(actor, 461, 65) #188, 25
draw_actor_icons(actor, 0, y + line_height * 8)
draw_actor_hp(actor, 7, 60)
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.members
enabled = $game_party.battle_members.include?(actor)
rect = item_rect(index)
draw_item_background(index)
draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
end
#--------------------------------------------------------------------------
# * Draw Background for Item
#--------------------------------------------------------------------------
def draw_item_background(index)
if index == @pending_index
contents.fill_rect(item_rect(index), pending_color)
end
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
super
$game_party.menu_actor = $game_party.members
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select($game_party.menu_actor.index || 0)
end
#--------------------------------------------------------------------------
# * Set Pending Position (for Formation)
#--------------------------------------------------------------------------
def pending_index=(index)
last_pending_index = @pending_index
@pending_index = index
redraw_item(@pending_index)
redraw_item(last_pending_index)
end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================

class DKPWindow_Help < Window_Base
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(line_number = 4)
super(0, 0, 244, fitting_height(line_number))
self.opacity = Help_Opacity
end
#--------------------------------------------------------------------------
# * Set Text
#--------------------------------------------------------------------------
def set_text(text)
if text != @text
@text = text
refresh
end
end
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
def clear
set_text("")
end
#--------------------------------------------------------------------------
# * Set Item
# item : Skills and items etc.
#--------------------------------------------------------------------------
def set_item(item)
set_text(item ? item.description : "")
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_text_ex(0, 0, word_wrapping(@text))
end
#--------------------------------------------------------------------------
# * Word Wrap
#--------------------------------------------------------------------------
def word_wrapping(text, pos = 0)
current_text_position = 0
for i in 0..(text.length - 1)
if text == "\n"
current_text_position = 0
next
end
current_text_position += contents.text_size(text).width
if (pos + current_text_position) >= (contents.width)
current_element = i
while(text != " ")
break if current_element == 0
current_element -= 1
end
temp_text = ""
for j in 0..(text.length - 1)
temp_text += text
temp_text += "\n" if j == current_element
end
text = temp_text
i = current_element
current_text_position = 0
end
end
return text
end
end
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
# This window displays the party's gold.
#==============================================================================

class Window_Gold < Window_Base
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
self.opacity = 0
self.z = 1000
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
end
#--------------------------------------------------------------------------
# * Get Party Gold
#--------------------------------------------------------------------------
def value
$game_party.gold
end
#~ #--------------------------------------------------------------------------
#~ # Get Currency Unit
#~ #--------------------------------------------------------------------------
def currency_unit
Vocab::currency_unit
end
#~ #--------------------------------------------------------------------------
#~ # * Open Window
#~ #--------------------------------------------------------------------------
def open
refresh
super
end
end
class Window_ItemList < Window_Selectable
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data =
self.opacity = Item_Opacity
end
#--------------------------------------------------------------------------
# * Set Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 1
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data : nil
end
#--------------------------------------------------------------------------
# * Get Activation State of Selection Item
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data)
end
#--------------------------------------------------------------------------
# * Include in Item List?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item) && !item.key_item?
when :key_item
item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# * Display in Enabled State?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data
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
#--------------------------------------------------------------------------
# * Draw Number of Items
#--------------------------------------------------------------------------
def draw_item_number(rect, item)
draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Command
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Initialize Command Selection Position (Class Method)
#--------------------------------------------------------------------------
def self.init_command_position
@@last_command_symbol = nil
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 3
end
#--------------------------------------------------------------------------
# * Get Spacing for Items Arranged Side by Side
#--------------------------------------------------------------------------
def spacing
return 100
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height- 47)
activate
select_last
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 640 #544
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
return 1
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
add_save_command
add_game_end_command
end
#--------------------------------------------------------------------------
# * Add Main Commands to List
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::item, :item, main_commands_enabled)
end
#--------------------------------------------------------------------------
# * Add Save to Command List
#--------------------------------------------------------------------------
def add_save_command
add_command(Vocab::save, :save, save_enabled)
end
#--------------------------------------------------------------------------
# * Add Exit Game to Command List
#--------------------------------------------------------------------------
def add_game_end_command
add_command(Vocab::game_end, :game_end)
end
#--------------------------------------------------------------------------
# * Get Activation State of Main Commands
#--------------------------------------------------------------------------
def main_commands_enabled
$game_party.exists
end
#--------------------------------------------------------------------------
# * Get Activation State of Save
#--------------------------------------------------------------------------
def save_enabled
!$game_system.save_disabled
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select_symbol(@@last_command_symbol)
end
end


class Game_Interpreter
def command_351
return if $game_party.in_battle
SceneManager.call(Scene_Item)
Window_MenuCommand::init_command_position
Fiber.yield
end
end
class Scene_Map < Scene_Base
def call_menu
SceneManager.call(Scene_Item)
Window_MenuCommand::init_command_position
end
end


#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_ItemBase
include DKP_Menu_Config
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_help_window
create_status_window
if Enable_Background != false then create_Image_Background end
#~ create_gold_window
create_command_window
create_category_window
create_item_window
#@category_window.deactivate
end
#--------------------------------------------------------------------------
# * Create Category Window
#--------------------------------------------------------------------------
def create_category_window
@category_window = Window_ItemCategory.new
@category_window.viewport = @viewport
@category_window.help_window = @help_window
@category_window.y = 120
@category_window.opacity = CategoryW_Opacity
@category_window.set_handler(:ok, method(:on_category_ok))
@category_window.set_handler(:cancel, method(:return_item))
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
@item_window = Window_ItemList.new(0, 170, 244, 270)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@category_window.item_window = @item_window
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_MenuCommand.new
@command_window.opacity = Command_Opacity
@command_window.set_handler(:item, method(:command_item))
@command_window.set_handler(:save, method(:command_save))
@command_window.set_handler(:game_end, method(:command_game_end))
@command_window.set_handler(:cancel, method(:return_scene))
end
#--------------------------------------------------------------------------
# * Deactivate category
#--------------------------------------------------------------------------
def return_item
@category_window.deactivate
@command_window.activate
@command_window.select_last
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_save
SceneManager.call(Scene_Save)
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_game_end
SceneManager.call(Scene_End)
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command_item
@category_window.activate
@command_window.deactivate
end
#--------------------------------------------------------------------------
# * Create Gold Window
#--------------------------------------------------------------------------
#~ def create_gold_window
#~ @gold_window = Window_Gold.new
#~ @gold_window.x = Graphics.width - @gold_window.width
#~ @gold_window.y = Graphics.height - 100
#~ end
#--------------------------------------------------------------------------
# * Create Background Image
#--------------------------------------------------------------------------
def create_Image_Background
bitmap = Cachext.dpmenu(Menu_Background)
@background_sprite.bitmap = bitmap
end
#--------------------------------------------------------------------------
# * Create Status Window
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_MenuStatus.new(244, 0)
end
#--------------------------------------------------------------------------
# * Create Help Window
#--------------------------------------------------------------------------
def create_help_window
@help_window = DKPWindow_Help.new
@help_window.viewport = @viewport
end
#--------------------------------------------------------------------------
# * Category
#--------------------------------------------------------------------------
def on_category_ok
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def on_item_ok
$game_party.last_item.object = item
determine_item
end
def determine_item
if item.for_friend?
show_sub_window(@actor_window)
@actor_window.select_for_item(item)
else
use_item
activate_item_window
end
end
def cursor_left?
@item_window.index % 1 == 0
end
def show_sub_window(window)
width_remain = Graphics.width - window.width
window.x = cursor_left? ? width_remain : 0
@viewport.rect.x = @viewport.ox = cursor_left? ? 0 : window.width
@viewport.rect.width = width_remain
window.show.activate
end
#--------------------------------------------------------------------------
# * Item
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
@category_window.activate
end
#--------------------------------------------------------------------------
# * Play SE When Using Item
#--------------------------------------------------------------------------
def play_se_for_item
Sound.play_use_item
end
#--------------------------------------------------------------------------
# * Use Item
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
end
end


these are all free to use script (for non-commercial project at least, so we're good).

so in short what we would need is:

1- combine items to work in the same menu without opening a new one;
2- if possibile, when items are stacked the weight doesn't add;

thanks in advance to whoever can help :)
Pages: 1