UltimaForum

Skrypty [VX] - Info Przedmiotu w Menu

Ayene - Wto 02 Lut, 2010 17:15
Temat postu: Info Przedmiotu w Menu

Szczurek - Sro 03 Lut, 2010 00:39

Ayene, jesteś wielka !
Sprawdzę kompatybilność z innymi skryptami i jak coś, napiszę, z czym się kłóci.
Kwestia teraz, skąd brać obrazki :D ?

bionicl - Sro 03 Lut, 2010 12:24

Szczurek, poszukaj na tej stronie: http://diablo.phx.pl/czytaj/przedmioty-elitarne
Agumon - Sro 03 Lut, 2010 13:17

Ej a mam pytanko a da się ten opis dłuższy zrobić czy nie????
bionicl - Sro 03 Lut, 2010 13:25

To w całym projekcie za pomocą jakiś skryptów zmień wielkość czcionki-więcej się zmieści...

[ Dodano: Sro 03 Lut, 2010 14:27 ]
A mam jedno pytanie:
Czy dało by się zrobić tak, aby w tej górnej ramce pokazywało coś w stylu: "Aby zobaczyć szczegóły kliknij shift", bo przecież info o przedmiocie będzie w tym okienku ze skryptu...

Agumon - Sro 03 Lut, 2010 14:43

Aha nie no spoko... :-D A dało by się tak bez tych obrazków tylko sam taki długi opis???
bionicl - Sro 03 Lut, 2010 14:59

NeruS, teraz tak na serio:
Wklej sobie tan skrypt a będziesz miała napisy mniejsze (dużo mniejsze :mrgreen: , zresztą sama zobaczysz) Wklej skrypt, który już nie pamiętam kogo był, ale wklej to zobaczysz...
Spoiler:


#===============================================================================
# Nazwa: Custom Message System
# Autor: nieznany
# Tłumaczenie: Marcin (www.ultimateam.pl)
#
#===============================================================================
# Kod: Efrekt:
# \w[x] czeka X frames (60 frames = 1 sekunda).
#
# \nb[x] Tworzy okno z imieniem x. lewa strona
# \nbl[x] Tworzy okno z imieniem x. lewa strona
# \nbu[x] Tworzy okno z imieniem x. lewa strona
# \rnb[x] Tworzy okno z imieniem x. prawa strona
# \rnbl[x] Tworzy okno z imieniem x. prawa strona
# \rnbu[x] Tworzy okno z imieniem x. prawa strona
# \nbu Zamyka okno z imieniem.
#
# \fn[x] Zmienia czcionkę na x.
# \fs[x] Zmienia czcionkę na rozmiar X
# \fb Zmienia czcionkę na pogrubioną
# \fi Zmienia czcionkę na kursywę
# \fh Zmienia czcionkę na zaciemnioną
#
# \ac[x] czyta klasę aktora o id X
# \as[x] czyta subklasę aktora o id X. Potrzebny skrypt subklasy (nie wiem co to takiegp)
# \ax[x] czyta klasę aktora o id X. Potrzebny skrypt subklasy
# \af[x] zamiena twarze postaci
# \af[x:y] zamienia twarze postaci (lepiej przetestuj)
#
# \pn[x] czyta imie postaci w x miejscu w drużycie.
# \pc[x] czyta klase postaci w x miejscu w drużycie
# \ps[x] czyta subklase postaci w x miejscu w drużycie
# \px[x] czyta kombinację klass postaci w x miejscu w drużycie
# \pf[x] zamienia twarz z twarzą postaci w x miejscu w drużycie
# \pf[x:y] to co wyżej (przetestuj sobie)
#
# \nc[x] czyta nazwe klasy o ID x
# \ni[x] czyta nazwe itemu o ID x
# \nw[x] czyta nazwe broni o ID x
# \na[x] czyta nazwe pancerza o ID x
# \ns[x] czyta nazwe skilla o ID x
# \nt[x] czyta nazwe state (chyba chodzi o status) o ID x
#
# \i[x] wtyka ikonkę o ID x do wiadomości
# \ii[x] czyta nazwe itemu o ID x i wstawia jego ikonkę
# \iw[x] czyta broni itemu o ID x i wstawia jego ikonkę
# \ia[x] to co wyżej tylko chodzi o pancerz
# \is[x] a tutaj skill
# \it[x] no i status
#
#===============================================================================
#===============================================================================
# Credits:
# Woratana for reference on stringing multiple message text.
# Modern Algebra for reference on a few misc methods.
#===============================================================================

$imported = {} if $imported == nil
$imported["CustomMessageSystem"] = true

module YE
module MESSAGE

# Numer zmiennej (variable) jeżeli ustawimy jej wartość na np: 5 to wiadomości będą miały
# 5 linijek, możemy to zmienić w każdym momencie gry
ROW_VARIABLE = 14

# szerokość ikonek
ICON_WIDTH = 24

# Ustawienia okna imienia
NAME_WINDOW_X = 20 # Adjusts X position offset from Message Window.
NAME_WINDOW_Y = 25 # Adjusts Y position offset from Message Window.
NAME_WINDOW_W = 20 # Adjusts extra width added to the Name Window.
NAME_WINDOW_H = 40 # Adjusts the height of the Name Window.
NAME_COLOUR = 6 # Default colour used for name box.

# Chcesz oglądać okno imienia w wiadomości w skóre (tak - true, nie - false)
NAME_WINDOW_SHOW_BACK = true

# Zmienia ustawienia w całej grze.
FONT_NAME = ["Comic Sans MS", "Arial", "Courier New"]
FONT_SIZE = 1
FONT_BOLD = true
FONT_ITALIC = false
FONT_SHADOW = false


end # MESSAGE
end # YE
#~~~~~~~~~~~~~~DALEJ NIE TŁUMACZYŁEM
#===============================================================================
# How to Use: Lunatic Mode
#===============================================================================
#
# This portion is for those who know how to script.
#
# \X[x] or \X[x:y] or \X[x:y:z]
# These let you create your own custom tags. If you use the first tag, there is
# one case for the "custom_convert" definition to return. If you use the second
# tag, there will be two cases for you to select from. And likewise, if there's
# three tags, then the z case will also be taken into account of.
#
#===============================================================================

class Window_Message < Window_Selectable

def custom_convert(x_case, y_case = 0, z_case = 0)
text = ""
case x_case
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own custom converted tags.
#---------------------------------------------------------------------------
when 1 # Show the full name of the actor.
case y_case # This is the extra case for the actor.
when 1
text = "\\n[1] von Xiguel"
when 2
text = "Michelle \\n[2]"
when 3
text = "\\n[3] Manfred"
when 4
text = "\\n[4] Fernaeus"
end

when 2 # Show how much gold the party has.
text = $game_party.gold

when 3 # Show party's max level
text = $game_party.max_level

#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------""
end
return text
end

end # Window_Message

#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================

Font.default_size = YE::MESSAGE::FONT_SIZE
Font.default_name = YE::MESSAGE::FONT_NAME
Font.default_bold = YE::MESSAGE::FONT_BOLD
Font.default_italic = YE::MESSAGE::FONT_ITALIC
Font.default_shadow = YE::MESSAGE::FONT_SHADOW

#===============================================================================
# Window_Message
#===============================================================================

class Window_Message < Window_Selectable

#--------------------------------------------------------------------------
# alias initialize
#--------------------------------------------------------------------------
alias initialize_cms initialize unless $@
def initialize
initialize_cms
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
@max_rows = (var <= 0) ? 4 : var
nheight = YE::MESSAGE::NAME_WINDOW_H
@name_window = Window_Base.new(YE::MESSAGE::NAME_WINDOW_X, 0, 100, nheight)
@name_text = Window_Base.new(YE::MESSAGE::NAME_WINDOW_X, 0, 100, 56)
@name_window.openness = 0
@name_text.openness = 0
@name_text.opacity = 0
@name_window.z = self.z + 1
@name_text.z = @name_window.z + 1
@name_window_lock = false
end

#--------------------------------------------------------------------------
# alias dispose
#--------------------------------------------------------------------------
alias dispose_cms dispose unless $@
def dispose
dispose_cms
@name_window.dispose if @name_window != nil
@name_text.dispose if @name_text != nil
end

#--------------------------------------------------------------------------
# close
#--------------------------------------------------------------------------
def close
super
@name_window.close
@name_text.close
@name_window_lock = false
end

#--------------------------------------------------------------------------
# alias update
#--------------------------------------------------------------------------
alias update_cms update unless $@
def update
@name_window.update
@name_text.update
refresh_size
update_cms
end

#--------------------------------------------------------------------------
# refresh_size
#--------------------------------------------------------------------------
def refresh_size
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
@max_rows = (var <= 0) ? 4 : var
calc_height = @max_rows * 24 + 32
if self.height != calc_height
self.height = calc_height
create_contents
end
end

#--------------------------------------------------------------------------
# overwrite reset_window
#--------------------------------------------------------------------------
def reset_window
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
@background = $game_message.background
@position = $game_message.position
self.opacity = (@background == 0) ? 255 : 0
case @position
when 0 # Top
self.y = 0
@gold_window.y = 360
when 1 # Middle
self.y = (Graphics.height - wheight) / 2
@gold_window.y = 0
when 2 # Bottom
self.y = (Graphics.height - wheight)
@gold_window.y = 0
end
end

#--------------------------------------------------------------------------
# overwrite convert_special_characters
#--------------------------------------------------------------------------
def convert_special_characters
@name_window_open = false
#-------------------------------------------------------------
# Lunatic REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\X\[(\d+)\]/i) {
custom_convert($1.to_i) }
@text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
custom_convert($1.to_i, $2.to_i) }
@text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
custom_convert($1.to_i, $2.to_i, $3.to_i) }

#-------------------------------------------------------------
# Default REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
@text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
@text.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
@text.gsub!(/\\C\[(\d+)\]/i) { "\x01{#{$1}}" }
@text.gsub!(/\\G/i) { "\x02" }
@text.gsub!(/\\\./) { "\x03" }
@text.gsub!(/\\\|/) { "\x04" }
@text.gsub!(/\\!/) { "\x05" }
@text.gsub!(/\\>/) { "\x06" }
@text.gsub!(/\\</) { "\x07" }
@text.gsub!(/\\\^/) { "\x08" }
@text.gsub!(/\\\\/) { "\\" }

#-------------------------------------------------------------
# New REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\W\[(\d+)\]/i) { "\x09{#{$1}}" }
@text.gsub!(/\\I\[(\d+)\]/i) { "\x10{#{$1}}" }
@text.gsub!(/\\FS\[(\d+)\]/i) { "\x11{#{$1}}" }
@text.gsub!(/\\FN\[(.*?)\]/i) { "\x12{#{$1}}" }
@text.gsub!(/\\FB/i) { "\x13" }
@text.gsub!(/\\FI/i) { "\x14" }
@text.gsub!(/\\FH/i) { "\x15" }

#-------------------------------------------------------------
# Automatic Actor REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\AN\[(\d+)\]/i) {
if $game_actors[$1.to_i] != nil
$game_actors[$1.to_i].name
else
""
end }
@text.gsub!(/\\AC\[(\d+)\]/i) {
if $game_actors[$1.to_i] != nil
$game_actors[$1.to_i].class.name
else
""
end }
@text.gsub!(/\\AS\[(\d+)\]/i) {
if $imported["SubclassSelectionSystem"] and
$game_actors[$1.to_i] != nil and
$game_actors[$1.to_i].subclass != nil
$game_actors[$1.to_i].subclass.name
else
""
end }
@text.gsub!(/\\AX\[(\d+)\]/i) {
combination_class($game_actors[$1.to_i]) }
@text.gsub!(/\\AF\[(\d+)\]/i) {
if $game_actors[$1.to_i] != nil
$game_message.face_name = $game_actors[$1.to_i].face_name
$game_message.face_index = $game_actors[$1.to_i].face_index
end
"" }
@text.gsub!(/\\AF\[(\d+):(\d+)\]/i) {
if $game_actors[$1.to_i] != nil
$game_message.face_name = $game_actors[$1.to_i].face_name
$game_message.face_index = $2.to_i
end
"" }

#-------------------------------------------------------------
# Automatic Party REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\PN\[(\d+)\]/i) {
if $game_party.members[$1.to_i] != nil
$game_party.members[$1.to_i].name
else
""
end }
@text.gsub!(/\\PC\[(\d+)\]/i) {
if $game_party.members[$1.to_i] != nil
$game_party.members[$1.to_i].class.name
else
""
end }
@text.gsub!(/\\PS\[(\d+)\]/i) {
if $imported["SubclassSelectionSystem"] and
$game_party.members[$1.to_i] != nil and
$game_party.members[$1.to_i].subclass != nil
$game_party.members[$1.to_i].subclass.name
else
""
end }
@text.gsub!(/\\PX\[(\d+)\]/i) {
combination_class($game_party.members[$1.to_i]) }
@text.gsub!(/\\PF\[(\d+)\]/i) {
if $game_party.members[$1.to_i] != nil
$game_message.face_name = $game_party.members[$1.to_i].face_name
$game_message.face_index = $game_party.members[$1.to_i].face_index
end
"" }
@text.gsub!(/\\PF\[(\d+):(\d+)\]/i) {
if $game_party.members[$1.to_i] != nil
$game_message.face_name = $game_party.members[$1.to_i].face_name
$game_message.face_index = $2.to_i
end
"" }

#-------------------------------------------------------------
# Auto Class, Item, Weapon, and Armour REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\NC\[(\d+)\]/i) {
$data_classes[$1.to_i].name }
@text.gsub!(/\\NI\[(\d+)\]/i) {
$data_items[$1.to_i].name }
@text.gsub!(/\\NW\[(\d+)\]/i) {
$data_weapons[$1.to_i].name }
@text.gsub!(/\\NA\[(\d+)\]/i) {
$data_armors[$1.to_i].name }
@text.gsub!(/\\NS\[(\d+)\]/i) {
$data_skills[$1.to_i].name }
@text.gsub!(/\\NT\[(\d+)\]/i) {
$data_states[$1.to_i].name }
@text.gsub!(/\\II\[(\d+)\]/i) {
"\x10{#{$data_items[$1.to_i].icon_index}}" +
"#{$data_items[$1.to_i].name}"}
@text.gsub!(/\\IW\[(\d+)\]/i) {
"\x10{#{$data_weapons[$1.to_i].icon_index}}" +
"#{$data_weapons[$1.to_i].name}"}
@text.gsub!(/\\IA\[(\d+)\]/i) {
"\x10{#{$data_armors[$1.to_i].icon_index}}" +
"#{$data_armors[$1.to_i].name}"}
@text.gsub!(/\\IS\[(\d+)\]/i) {
"\x10{#{$data_skills[$1.to_i].icon_index}}" +
"#{$data_skills[$1.to_i].name}"}
@text.gsub!(/\\IT\[(\d+)\]/i) {
"\x10{#{$data_states[$1.to_i].icon_index}}" +
"#{$data_states[$1.to_i].name}"}

#-------------------------------------------------------------
# Name box REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\NB\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
end
"" }
@text.gsub!(/\\NBL\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
@name_window_lock = true
end
"" }
@text.gsub!(/\\NBU\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
@name_window_lock = false
end
"" }
@text.gsub!(/\\NBU/i) {
@name_window.close
@name_text.close
@name_window_lock = false
"" }
@text.gsub!(/\\RNB\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
end
"" }
@text.gsub!(/\\RNBL\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
@name_window_lock = true
end
"" }
@text.gsub!(/\\RNBU\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
@name_window_lock = false
end
"" }

# Close the Name Window
unless @name_window_lock
@name_window.close if !@name_window_open
@name_text.close if !@name_window_open
end
end

#--------------------------------------------------------------------------
# overwrite update_message
#--------------------------------------------------------------------------
def update_message
loop do
text_height = [contents.font.size + (contents.font.size / 5), WLH].max
c = @text.slice!(/./m) # Get next text character
case c
#----------------------------------------------------------------------
# Default Cases
#----------------------------------------------------------------------
when nil # There is no text that must be drawn
finish_message # Finish update
break
when "\x00" # New line
new_line
if @line_count >= @max_rows # If line count is maximum
unless @text.empty? # If there is more
self.pause = true # Insert number input
break
end
end
when "\x01" # \C[n] (text character color change)
@text.sub!(/\{(\d+)\}/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (gold display)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (wait 1/4 second)
@wait_count = 15
break
when "\x04" # \| (wait 1 second)
@wait_count = 60
break
when "\x05" # \! (Wait for input)
self.pause = true
break
when "\x06" # \> (Fast display ON)
@line_show_fast = true
when "\x07" # \< (Fast display OFF)
@line_show_fast = false
when "\x08" # \^ (No wait for input)
@pause_skip = true

#----------------------------------------------------------------------
# New Cases
#----------------------------------------------------------------------
when "\x09" # \| Wait x frames
@text.sub!(/\{(\d+)\}/, "")
@wait_count = $1.to_i
break
when "\x10" # \i Draws icon ID x
@text.sub!(/\{(\d+)\}/, "")
icon = $1.to_i
icon_width = (24 - YE::MESSAGE::ICON_WIDTH) / 2
draw_icon(icon, @contents_x - icon_width, @contents_y)
@contents_x += YE::MESSAGE::ICON_WIDTH
when "\x11" # \fs Font Size Change
@text.sub!(/\{(\d+)\}/, "")
size = $1.to_i
if size <= 0 # If 0, revert back to the default font size.
size = Font.default_size
end
contents.font.size = size
text_height = [size + (size / 5), WLH].max
when "\x12" # \fs Font Name Change
@text.sub!(/\{(.*?)\}/, "")
name = $1.to_s
if name == "0" # If 0, revert back to the default font.
name = Font.default_name
end
contents.font.name = name
when "\x13" # \fb Font bold
contents.font.bold = contents.font.bold ? false : true
when "\x14" # \fi Font italic
contents.font.italic = contents.font.italic ? false : true
when "\x15" # \fi Font shadowed
contents.font.shadow = contents.font.shadow ? false : true

#----------------------------------------------------------------------
# Finish Up
#----------------------------------------------------------------------
else # Normal text character
contents.draw_text(@contents_x, @contents_y, 40, text_height, c)
c_width = contents.text_size(c).width
@contents_x += c_width
end
break unless @show_fast or @line_show_fast
end
end

#--------------------------------------------------------------------------
# alias new_page
#--------------------------------------------------------------------------
alias new_page_cms new_page unless $@
def new_page
new_page_cms
contents.font.name = Font.default_name
contents.font.size = Font.default_size
contents.font.bold = Font.default_bold
contents.font.italic = Font.default_italic
contents.font.shadow = Font.default_shadow
end

#--------------------------------------------------------------------------
# combination_class
#--------------------------------------------------------------------------
def combination_class(actor)
return "" if actor == nil
class1 = actor.class.name
return class1 unless $imported["SubclassSelectionSystem"]
return class1 if actor.subclass == nil
class2 = actor.subclass.name
text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, class1, class2)
return text unless YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
if YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL.include?(text)
text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL[text]
end
return text
end

#--------------------------------------------------------------------------
# refresh_name_box
#--------------------------------------------------------------------------
def refresh_name_box(name, side = 0)
return if $game_temp.in_battle
font_colour = YE::MESSAGE::NAME_COLOUR
font_name = Font.default_name
font_size = Font.default_size
font_bold = Font.default_bold
font_italic = Font.default_italic
font_shadow = Font.default_shadow
icon = 0
name_width = 0
#---Convert Special Characters
name = name.gsub(/\x01\{(\d+)\}/i) {
font_colour = $1.to_i
""}
name = name.gsub(/\x09\{(\d+)\}/i) {""}
name = name.gsub(/\x10\{(\d+)\}/i) {
icon = $1.to_i
name_width += YE::MESSAGE::ICON_WIDTH
""}
name = name.gsub(/\x11\{(\d+)\}/i) {
font_size = $1.to_i
""}
name = name.gsub(/\x12\{(.*?)\}/i) {
font_name = $1.to_s
""}
name = name.gsub(/\x13/i) {
font_bold = true
""}
name = name.gsub(/\x14/i) {
font_italic = true
""}
name = name.gsub(/\x15/i) {
font_shadow = true
""}
#---Convert Special Characters
@name_text.contents.font.name = font_name
@name_text.contents.font.size = font_size
@name_text.contents.font.bold = font_bold
@name_text.contents.font.italic = font_italic
@name_text.contents.font.shadow = font_shadow
name_width += @name_text.contents.text_size(name).width
name_width += YE::MESSAGE::NAME_WINDOW_W
@name_window.width = name_width + 40
@name_text.width = @name_window.width
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
position = $game_message.position
case position
when 0
@name_window.y = self.height - YE::MESSAGE::NAME_WINDOW_H
@name_window.y += YE::MESSAGE::NAME_WINDOW_Y
when 1
@name_window.y = (Graphics.height - wheight) / 2
@name_window.y -= YE::MESSAGE::NAME_WINDOW_Y
when 2
@name_window.y = (Graphics.height - wheight)
@name_window.y -= YE::MESSAGE::NAME_WINDOW_Y
end
offset = (@name_text.height - @name_window.height) / 2
@name_text.y = @name_window.y - offset
if YE::MESSAGE::NAME_WINDOW_SHOW_BACK and $game_message.background == 0
@name_window.opacity = 255
else
@name_window.opacity = 0
end
if side == 0
@name_window.x = YE::MESSAGE::NAME_WINDOW_X
else
@name_window.x = Graphics.width - YE::MESSAGE::NAME_WINDOW_X
@name_window.x -= @name_window.width
end
@name_text.x = @name_window.x
@name_window.create_contents
@name_text.create_contents
txh = [font_size + (font_size / 5), WLH].max
@name_text.contents.font.color = text_color(font_colour)
@name_text.contents.font.name = font_name
@name_text.contents.font.size = font_size
@name_text.contents.font.bold = font_bold
@name_text.contents.font.italic = font_italic
@name_text.contents.font.shadow = font_shadow
if icon > 0
iw = YE::MESSAGE::ICON_WIDTH
@name_text.draw_icon(icon, YE::MESSAGE::NAME_WINDOW_W / 2, 0)
@name_text.contents.draw_text(iw, 0, name_width + 8 - iw, txh, name, 1)
else
@name_text.contents.draw_text(0, 0, name_width + 8, txh, name, 1)
end
@name_window.open
@name_text.open
@name_window_open = true
end

end # Window_Message

#===============================================================================
# Game_Interpreter
#===============================================================================

class Game_Interpreter

#--------------------------------------------------------------------------
# overwrite Show Text
#--------------------------------------------------------------------------
def command_101
unless $game_message.busy
$game_message.face_name = @params[0]
$game_message.face_index = @params[1]
$game_message.background = @params[2]
$game_message.position = @params[3]
flow = true
loop {
if @list[@index].code == 101 and meet_stringing_conditions and flow
@index += 1
else
break
end
flow = @row_check
while @list[@index].code == 401 and meet_stringing_conditions
$game_message.texts.push(@list[@index].parameters[0])
@index += 1
end }
if @list[@index].code == 102 # Show choices
setup_choices(@list[@index].parameters)
elsif @list[@index].code == 103 # Number input processing
setup_num_input(@list[@index].parameters)
end
set_message_waiting # Set to message wait state
end
return false
end

#--------------------------------------------------------------------------
# overwrite setup_choices
#--------------------------------------------------------------------------
def setup_choices(params)
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
rows = (var <= 0) ? 4 : var
if $game_message.texts.size <= rows - params[0].size
$game_message.choice_start = $game_message.texts.size
$game_message.choice_max = params[0].size
for s in params[0]
$game_message.texts.push(s)
end
$game_message.choice_cancel_type = params[1]
$game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
@index += 1
end
end

#--------------------------------------------------------------------------
# meet_stringing_conditions
#--------------------------------------------------------------------------
def meet_stringing_conditions
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
rows = (var <= 0) ? 4 : var
@row_check = (rows > 4) ? true : false
return true if rows > $game_message.texts.size
return false
end

end # Game_Interpreter

#===============================================================================
#
# END OF FILE
#
#===============================================================================


Ayene - Czw 04 Lut, 2010 19:37

Zmodyfikowałam nieco skrypt z pierwszego posta. Między innymi można wyłączyć obrazki i dodać na dole legendę.
bionicl - Czw 04 Lut, 2010 19:42

My tyle "pytań" :) zadajemy, a Ayene zawsze nam da "all i one" .Dzięki...
Szczurek - Czw 04 Lut, 2010 21:30

Ha ! A ja znalazłem "kłótnię" :)
Nie współpracuje ze skryptem limitowanego ekwipunku niejakiego Modern Algebry ;]
Przy wyjściu z okna ekwipunku wywala coś z "dispose".
Warto by dopracować, jak coś, mogę podrzucić w.w. skrypt ;)


@EDIT
Oto skrypt Modern Algebry:
Spoiler:

Kod:
#==============================================================================
#  Limited Inventory
#  Version: 1.1c
#  Author: modern algebra
#  Date: September 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#    This script allows you to set an inventory limit to how many item slots
#   your inventory can hold. It allows some items to be stackable, and you can
#   also set items to be undiscardable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Place this script above Main and below other custom scripts.
#
#    To set a number of the default conditions for this script, please see the
#   Editable Regions at 53, 84, and 109. Be sure to read the comments next to
#   each consant to see what it does.
#
#    To set an item as non-discardable, put this command into its note box:
#
#      \NONDISCARD
#
#    To set an item to have a stack size different from the default, use this
#   command in its note box:
#
#      \STACKMAX[x]
#
#   where x is and integer and the new maximum stack size for that item.
#
#    To resize the party inventory in-game, say after an event where the get a
#   new backpack or whatever, then all you need to do is put this code into a
#   call script:
#
#      resize_inventory (x)
#   
#   where x is an integer and the new number of slots in the party inventory.
#==============================================================================

#==============================================================================
# *** Vocab
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants  - MA_LOOT_LABEL, MA_COMMAND_DISCARD, MA_COMMAND_EXCHANGE,
#                   MA_AMOUNT_PREFIX, MA_COMMAND_USE, MA_COMMAND_DESTROY,
#                   MA_WARNING_LABEL, MA_WARNING_YES, MA_WARNING_NO
#==============================================================================

module Vocab
  #==========================================================================
  # * Constants
  #==========================================================================
  #//////////////////////////////////////////////////////////////////////////
  # EDITABLE REGION
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  MA_AMOUNT_PREFIX = "x"           # Prefix before item amount in each stack
  MA_LOOT_LABEL = "Zdobycz"           # Label for Discard Pile items
  MA_COMMAND_DISCARD = "Wyrzuć"   # Command to discard items
  MA_COMMAND_EXCHANGE = "Wymień" # Command to switch loot item with party item
  MA_COMMAND_TAKE = "Weź"         # Command to take from Loot pile
  MA_COMMAND_USE = "Użyj"           # Command to Use an item
  MA_COMMAND_DESTROY = "Zniszcz"   # Command to completely destroy item
  # Question printed when deciding whether or not to leave inventory when loot
  # still has items in it
  MA_WARNING_LABEL = "#{MA_COMMAND_DESTROY} all items in #{MA_LOOT_LABEL}?"
  MA_WARNING_YES = "Tak"           # Command to Leave inventory when warned
  MA_WARNING_NO = "Nie"             # Command to stay in inventory when warned.
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  # END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////
end

#==============================================================================
# *** Sound
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants  - MA_DISCARD_SE, MA_EXCHANGE_SE, MA_TAKE_SE, MA_DESTROY_SE
#==============================================================================

module Sound
  #==========================================================================
  # * Constants
  #==========================================================================
  #//////////////////////////////////////////////////////////////////////////
  # EDITABLE REGION
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  MA_DISCARD_SE = "Move"   # SE played when discarding item from inventory
  MA_EXCHANGE_SE = "Move"  # SE played when switching loot item for party item
  MA_TAKE_SE = "Equip"     # SE played when taking item from loot
  MA_DESTROY_SE = "Close1" # SE played when destroying item from loot
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  # END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////
end

#==============================================================================
# *** RPG
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants  - MA_DEFAULT_STACK_AMOUNT, MA_DEFAULT_INVENTORY_SIZE,
#                   MA_EMPTYSLOTS_ICON_ID, MA_WARN_WINDOW
#    modified class - BaseItem
#==============================================================================

module RPG
  #==========================================================================
  # * Constants
  #==========================================================================
  #//////////////////////////////////////////////////////////////////////////
  # EDITABLE REGION
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  MA_DEFAULT_STACK_AMOUNT = 1    # The default maximum stack amount for items
  MA_DEFAULT_INVENTORY_SIZE = 18 # The default maximum slot number for inventory
  MA_EMPTYSLOTS_ICON_ID = 144    # The icon for empty slots
  MA_WARN_WINDOW = true          # Warn before leaving inventory with items in loot?
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  # END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////
  #==========================================================================
  # ** BaseItem
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new methods - ma_stack_amount, ma_discardable?
  #==========================================================================
  class BaseItem
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Stack Amount
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def ma_stack_amount
      return self.note[/\\STACKMAX\[(\d+)\]/i] != nil ? $1.to_i : RPG::MA_DEFAULT_STACK_AMOUNT
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Non-Discardable
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def ma_discardable?
      return self.note[/\\NONDISCARD/i] == nil
    end
  end
end

#==============================================================================
# ** Game Temp
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new public instance variables - slots_to_discard
#==============================================================================

class Game_Temp
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :slots_to_discard # A Game_LimitedInventory object
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias algmod_grafikal009_init_tmp_lim_inventory_94n6 initialize
  def initialize
    # Run Original method
    algmod_grafikal009_init_tmp_lim_inventory_94n6
    # Create Inventory object
    @slots_to_discard = Game_LimitedInventory.new (-1)
  end
end

#==============================================================================
# ** Game LimInvSlot
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class holds the data on a single slot of the inventory
#==============================================================================

class Game_LimInvSlot
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :item_type # The type of item held in this slot
  attr_reader   :item_id   # The ID of the item currently held
  attr_reader   :amount    # The number of items this slot holds
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    @item_type = -1
    @item_id = 0
    @amount = 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Item
  #    n         : the amount to add
  #    item_type : the type of item being added
  #    item_id   : the ID of item being added
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_item (n, item_type = -1, item_id = 0)
    # Set item if that is sent through
    if item_type != -1
      @item_type = item_type
      @item_id = item_id
    end
    x = space_left
    # Check amount
    if n > x
      # If more given than can fit
      @amount += x
      return n - x
    else
      # If the n given will fit
      @amount += n
      return 0
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Item
  #    n : the amount to remove
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_item (n)
    @amount -= n
    if @amount <= 0
      n = -1*@amount
      # Delete item from this slot
      @item_type = -1
      @item_id = 0
      @amount = 0
      return n
    end
    return 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item
    return case @item_type
    when -1 then nil                    # No item stored
    when 0 then $data_items[@item_id]   # Item
    when 1 then $data_weapons[@item_id] # Weapon
    when 2 then $data_armors[@item_id]  # Armour
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Space Left
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def space_left
    return 1 if item == nil
    return item.ma_stack_amount - @amount
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Equal?
  #    other : another Game_LimInvSlot
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def == (other)
    return false if !other.is_a? (Game_LimInvSlot)
    return false if other.item_type != @item_type
    return false if other.item_id != @item_id
    return false if other.amount != @amount
    return super (other)
  end
end

#==============================================================================
# ** Game_LimitedInventory
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This is an array to store the party's inventory
#==============================================================================

class Game_LimitedInventory
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :max_size # The maximum number of slots. If -1, infinite.
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #    size : the number of slots available
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (size)
    @max_size = size
    clear
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear
    @items = []
    @weapons = []
    @armors = []
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Resize
  #    size : the number of slots available
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def resize (size)
    old_size = slots.size
    # If new size is smaller
    if size < old_size
      # Save discarded items
      index = slots.size - 1
      while slots.size > @max_size
        slot = slots[index]
        if slot.item.ma_discardable?
          type, id, n = slot.item_type, slot.item_id, slot.amount
          # Discard additional slots
          remove_item (type, id, n)
          $game_temp.slots_to_discard.add_item (type, id, n)
        else
          index -= 1
        end
        break if index < 0
      end
    end
    @max_size = size
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Add Item
  #    type : the type of item being added
  #    id   : the ID of item being added
  #    n    : the amount to add
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def add_item (type, id, n = 1)
    array = case type
    when 0 then @items
    when 1 then @weapons
    when 2 then @armors
    end
    sort_index = 0
    # Go through all slots
    array.each { |slot|
      # If you can place the item in this slot
      if slot.item_id == id
        n = slot.add_item (n, type, id)
        break if n == 0
        sort_index += 1
      elsif slot.item_id < id
        sort_index += 1
      else
        break
      end
    }
    if n > 0
      # If there are empty slots
      while @max_size == -1 || ((@items.size + @weapons.size + @armors.size) < @max_size)
        slot = Game_LimInvSlot.new
        n = slot.add_item (n, type, id)
        array.insert (sort_index, slot)
        sort_index += 1
        break if n == 0
      end
    end
    return n
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Remove Item
  #    type : the type of item being removed
  #    id   : the ID of item being removed
  #    n    : the amount to remove
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def remove_item (type, id, n = 1)
    array = case type
    when 0 then @items
    when 1 then @weapons
    when 2 then @armors
    end
    # Go through all slots in reverse order
    array.reverse.each { |slot|
      # If this slot has the right item in it, remove from this slot
      if slot.item_type == type && slot.item_id == id
        n = slot.remove_item (n)
        array.delete (slot) if slot.amount == 0
        break if n == 0
      end
    }
    return n
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Item Slots
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def slots
    return @items + @weapons + @armors
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check Space
  #    item : an RPG::Item, RPG::Weapon, or RPG::Armor object
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def enough_space? (slot)
    return true if @max_size == -1 || slots.size < @max_size
    # Check array for other instances of the item
    array = [@items, @weapons, @armors][slot.item_type]
    array.each { |i|
      if i.item_id > slot.item_id
        break
      elsif i.item_id == slot.item_id
        return true if i.space_left < slot.item.ma_stack_amount
      end
    }
    return false
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Equals?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def == (other)
    return false unless other.is_a? (Game_LimitedInventory)
    return false if @max_size != other.max_size
    return false if slots != other.slots
    return super (other)
  end
end

#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - change_equip
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 change_equip
  def change_equip (*args)
    # Run Original Method
    mdrnalgbra_gkl009_invlimits_cng_eqp_82h4 (*args)
    # Since you gain items before you lose them, check if item is Loot when it
    # could be in Party inventory
    if !$game_temp.slots_to_discard.slots.empty?
      # Take as many from loot as possible
      $game_temp.slots_to_discard.slots.reverse.each { |slot|
        break unless $game_party.limit_inventory.enough_space? (slot)
        item, type, id, n = slot.item, slot.item_type, slot.item_id, slot.amount
        $game_party.gain_item (item, n)
        $game_temp.slots_to_discard.remove_item (type, id, n)
      }
    end
  end
end

#==============================================================================
# ** Game Party
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new instance variable - limit_inventory
#    aliased methods - initialize, gain_item
#==============================================================================

class Game_Party
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_reader   :limit_inventory # A Game_LimitedInventory object
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_lm_inv_grafkal_init_4n56 initialize
  def initialize
    # Run Original method
    modlg_lm_inv_grafkal_init_4n56
    # Create Inventory object
    @limit_inventory = Game_LimitedInventory.new (RPG::MA_DEFAULT_INVENTORY_SIZE)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Gain Items (or lose)
  #     item          : Item
  #     n             : Number
  #     include_equip : Include equipped items
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias drnlgbr_grafikal_limited_inventory_gn_itm_94n6 gain_item
  def gain_item(item, n, include_equip = false)
    # Run Original method
    drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (item, n, include_equip)
    if item != nil
      type = item.is_a? (RPG::Item) ? 0 : item.is_a? (RPG::Weapon) ? 1 : 2
      # Gain or lose item depending on everything.
      if n > 0
        n2 = @limit_inventory.add_item (type, item.id, n)
        n -= n2
        # If it is a nondiscardable item and you cannot hold all of them
        if !item.ma_discardable?
          while n2 > 0
            # Find first nondiscardable item in the inventory
            for i in 0...@limit_inventory.slots.size
              slot = @limit_inventory.slots[i]
              if slot.item.ma_discardable?
                l_type, id = slot.item_type, slot.item_id
                # Find smallest slot of that item
                while l_type == slot.item_type && id == slot.item_id
                  i += 1
                  slot = @limit_inventory.slots[i]
                end
                l_item, l_n = @limit_inventory.slots[i - 1].item, @limit_inventory.slots[i - 1].amount
                break
              end
            end
            # Remove that item from inventory
            lose_item (l_item, l_n)
            $game_temp.slots_to_discard.add_item (l_type, id, l_n)
            n3 = @limit_inventory.add_item (type, item.id, n2)
            n -= n3
            n2 = n3
          end
        end
      else
        n2 = @limit_inventory.remove_item (type, item.id, -1*n)
        n += n2
        n2 *= -1
      end
    end
    return if item == nil
    # Send rest to loot
    if n2 > 0
      $game_temp.slots_to_discard.add_item (type, item.id, n2)
    elsif n2 < 0
      $game_temp.slots_to_discard.remove_item (type, item.id, -1*n2)
    end
  end
end

#==============================================================================
# ** Game Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - command_end
#    new method - resize_inventory
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Resize Inventory
  #    new_size : the size you now want the inventory to be
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def resize_inventory (new_size)
    $game_party.limit_inventory.resize (new_size)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Command End
  #``````````````````````````````````````````````````````````````````````````
  #  If there are items in $game_temp.loot, open up the inventory
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_grid_inventory_open_inventory_end_command command_end
  def command_end
    # Run Original Method
    modalg_grid_inventory_open_inventory_end_command
    unless $game_temp.slots_to_discard.slots.empty?
      $scene = Scene_Item.new
    end
  end
end

#==============================================================================
# ** Window Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    overwritten methods - draw_item, item_rect
#    aliased method - item, refresh, dispose, top_row=
#==============================================================================

class Window_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalg_gral9_ivntlim_rfrsh_2n45 refresh
  def refresh (inventory = $game_party.limit_inventory, columns = @column_max)
    if self.is_a? (Window_EquipItem)
      mdrnalg_gral9_ivntlim_rfrsh_2n45
      return
    end
    @is_loot = inventory == $game_temp.slots_to_discard
    @spacing = 32
    @data = []
    @empty_sprites.each { |sprite| sprite.dispose } unless @empty_sprites == nil
    @empty_sprites = []
    @column_max = columns
    for slot in inventory.slots
      next unless include?(slot.item)
      @data.push(slot)
      if slot.item.is_a?(RPG::Item) and slot.item_id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @item_max = inventory.max_size == -1 ? @data.size : inventory.max_size
    create_contents
    # Calculate number of empty slots to draw
    empty_slots = (inventory.max_size == -1 || !$scene.is_a? (Scene_Item)) ? 0 : inventory.max_size - inventory.slots.size
    @wlh = (self.contents.height * @column_max) / ([@data.size + empty_slots, 1].max)
    @wlh = @wlh > 32 ? 32 : @wlh < WLH ? WLH : @wlh
    for i in 0...@data.size
      draw_item(i)
    end
    sprite_viewport = Viewport.new (self.x + 16, self.y + 16, self.width - 32, self.height - 32)
    viewport_adjusted = false
    for i in @data.size...empty_slots + @data.size
      rect = item_rect (i)
      if rect.y + rect.height > page_row_max*@wlh && !viewport_adjusted
        sprite_viewport.rect.height = rect.y
        viewport_adjusted = true
      end
      sprite = Sprite_Base.new (sprite_viewport)
      sprite.x, sprite.y = rect.x, rect.y
      sprite.visible = self.visible
      sprite.blend_type = 2
      empty_bmp = Bitmap.new (rect.width, rect.height) if empty_bmp == nil
      sprite.bitmap = empty_bmp.dup
      sprite.bitmap.fill_rect (0, 1, rect.width, rect.height - 2, Color.new (127, 127, 127, 105))
      @empty_sprites.push (sprite)
    end
    empty_bmp.dispose unless empty_bmp == nil
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Item Rect
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_rect (index)
    wlh = @wlh == nil ? WLH : @wlh
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (contents.width + @spacing) / @column_max - @spacing
    rect.height = wlh
    rect.x = index % @column_max * (rect.width + @spacing)
    rect.y = index / @column_max * wlh
    return rect
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Top Row
  #     row : row shown on top
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def top_row=(row)
    old_oy = self.oy
    super (row)
    @empty_sprites.each { |sprite| sprite.y -= (self.oy - old_oy) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Draw Item
  #     index : item number
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 draw_item
  def draw_item(index)
    if self.is_a? (Window_EquipItem)
      mdrnalgbr_rfl009_limitedinvntry_drwitm_2hd4 (index)
      return
    end
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index].item
    if item != nil
      n = @data[index].amount
      enabled = @is_loot ? true : enable?(item)
      rect.width -= 4
      y = rect.y + ((rect.height - WLH) / 2)
      draw_item_name(item, rect.x, y, enabled)
      self.contents.draw_text(rect, sprintf("#{Vocab::MA_AMOUNT_PREFIX}%2d", n), 2) unless n < 2
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_grfkl_lim_nvtry_item_8rn item
  def item
    return ma_grfkl_lim_nvtry_item_8rn if self.is_a? (Window_EquipItem)
    return ma_grfkl_lim_nvtry_item_8rn == nil ? nil : ma_grfkl_lim_nvtry_item_8rn.item
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Sprite Disposal
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def dispose
    super
    @empty_sprites.each { |sprite| sprite.dispose } unless self.is_a? (Window_EquipItem)
  end
end

#==============================================================================
# ** Window_EmptyCount
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window displays the number of free slots in the inventory.
#==============================================================================

class Window_EmptyCount < Window_Base
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #     inventory : a Game_LimitedInventory object
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize (inventory = $game_party.limit_inventory)
    super(Graphics.width - 128, 0, 128, WLH + 32)
    self.opacity = 0
    refresh (inventory)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #     inv : a Game_LimitedInventory object
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh (inv)
    self.contents.clear
    # Draw Icon
    empty_slots = inv.max_size == -1 ? "8" : (inv.max_size - inv.slots.size).to_s
    tw = self.contents.text_size (empty_slots).width
    self.contents.draw_text (0, 0, 96, WLH, empty_slots, 2)
    draw_icon (RPG::MA_EMPTYSLOTS_ICON_ID, 68 - tw, 0)
  end
end

#==============================================================================
# ** Window_InvCommand
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This is a Window_Command, specialized to allow for frequent resetting of the
# commands
#==============================================================================

class Window_InvCommand < Window_Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Reset Commands
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def reset_commands (commands)
    @commands = commands
    @item_max = commands.size
    row_max = (commands.size + @column_max - 1) / @column_max
    self.height = (row_max*WLH) + 32
    self.create_contents
    refresh
  end
end

#==============================================================================
# ** Window Warning
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This window checks before destroying slot items
#==============================================================================

class Window_Warning < Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    x = (Graphics.width - 256) / 2
    y = (Graphics.height - (32 + 2*WLH)) / 2
    super (x, y, 256, 32 + 2*WLH)
    @item_max = 2
    @column_max = 2
    @index = 1
    create_contents
    # Draw Warning Label
    self.contents.draw_text (0, 0, contents.width, WLH, Vocab::MA_WARNING_LABEL, 1)
    # Draw Yes and No Options
    index = 0
    [Vocab::MA_WARNING_YES, Vocab::MA_WARNING_NO].each { |command|
      rect = item_rect (index)
      self.contents.draw_text (rect, command, 1)
      index += 1
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get rectangle for displaying items
  #     index : item number
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = (self.contents.width / 4) - 10
    rect.height = WLH
    rect.x = rect.width + (index*(20 + rect.width))
    rect.y = WLH
    return rect
  end
end

#==============================================================================
# ** Scene Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - return_scene
#==============================================================================

class Scene_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Return Scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4 return_scene
  def return_scene
    if $game_temp.slots_to_discard.slots.empty?
      rnalbr_grafikal009_invlimits_rtrn_scn_eqp_4wk4
    else
      $scene = Scene_Item.new
    end
  end
end

#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - battle_end
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * End Battle
  #     result : Results (0: win, 1: escape, 2:lose)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mrnagbr_gkal009_vntrylim_bttlend_5dm4 battle_end
  def battle_end(result)
    # Run original Method
    mrnagbr_gkal009_vntrylim_bttlend_5dm4 (result)
    if !$game_temp.slots_to_discard.slots.empty? && !$scene.is_a? (Scene_Gameover)
      $scene = Scene_Item.new
    end
  end
end

#==============================================================================
# ** Scene Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - start, terminate
#==============================================================================

class Scene_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start processing
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start
    super
    create_menu_background
    @activated_frame = false
    @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @help_window = Window_Help.new
    @help_window.width = Graphics.width
    @help_window.viewport = @viewport
    wlh = Window_Base::WLH
    @item_window = Window_Item.new(0, 32 + wlh, Graphics.width, Graphics.height - 32 - wlh)
    @item_window.help_window = @help_window
    @item_window.active = false
    @item_window.viewport = @viewport
    @active_window = @item_window
    @target_window = Window_MenuStatus.new(0, 0)
    @target_window.x = Graphics.width - @target_window.width
    @target_window.height = Graphics.height
    @target_window.z = 150
    hide_target_window
    # Create Empty Counter
    @emptycount_window = Window_EmptyCount.new
    @emptycount_window.viewport = @viewport
    # Create Loot Window
    wdth = Graphics.width / 2
    hght = Graphics.height - 64 - 2*wlh
    @loot_window = Window_Item.new (wdth, 64 + (2*wlh), wdth, hght)
    @loot_window.index = -1
    @loot_window.viewport = @viewport
    # Create Loot Label Window
    @lootlabel_window = Window_Base.new (wdth, 32 + wlh, wdth, 32 + wlh)
    @lootlabel_window.visible = false
    @lootlabel_window.contents.font.color = @lootlabel_window.system_color
    @lootlabel_window.contents.draw_text (0, 0, 240, wlh, Vocab::MA_LOOT_LABEL, 1)
    @lootlabel_window.viewport = @viewport
    commands = [Vocab::MA_COMMAND_USE, Vocab::MA_COMMAND_DISCARD]
    @command_window = Window_InvCommand.new (160, commands)
    @command_window.visible = false
    @command_window.active = 0
    @loot_window.active = false
    # If no loot, hide the window
    if $game_temp.slots_to_discard.slots.empty?
      @loot_window.visible = false
      @loot_window.refresh ($game_temp.slots_to_discard, 1)
      @overloaded_initially = false
    else
      show_loot
      @overloaded_initially = true
    end
    @last_index = $game_party.last_item_id
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Return Scene
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malg_grfk_inventoy_lmt_rtrnscn_1h45 return_scene
  def return_scene
    # If Still items left in Loot
    if RPG::MA_WARN_WINDOW && !$game_temp.slots_to_discard.slots.empty?
      # Give warning
      @warning_window = Window_Warning.new
      return
    end
    if @overloaded_initially
      $scene = Scene_Map.new
    else
      # Run Original Method
      malg_grfk_inventoy_lmt_rtrnscn_1h45
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Show Target Window
  #     right : Right justification flag (if false, left justification)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def show_target_window(right)
    right = @loot_window.visible ? @active_window == @item_window : right
    @item_window.active = false
    width_remain = Graphics.width - @target_window.width
    @target_window.x = right ? width_remain : 0
    @target_window.visible = true
    @target_window.active = true
    if right
      @viewport.rect.set(0, 0, width_remain, @target_window.height)
      @viewport.ox = 0
    else
      @viewport.rect.set(@target_window.width, 0, width_remain, @target_window.height)
      @viewport.ox = @target_window.width
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Hide Target Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def hide_target_window
    @item_window.active = true
    @target_window.visible = false
    @target_window.active = false
    @viewport.rect.set(0, 0, Graphics.width, Graphics.height)
    @viewport.ox = 0
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Termination processing
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdlg_graf009_invlimit_trmnte_itemscene_5bd3 terminate
  def terminate (*args)
    # Run Original Method
    mdlg_graf009_invlimit_trmnte_itemscene_5bd3 (*args)
    # Dispose of new windows
    @emptycount_window.dispose
    @loot_window.dispose
    @lootlabel_window.dispose
    @command_window.dispose
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Frame
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malg_gfl009_limitedinventory_upt_2h45 update
  def update
    # If Warning Window Active
    if @warning_window != nil
      update_warning_window
      return
    end
    malg_gfl009_limitedinventory_upt_2h45
    @loot_window.update
    @command_window.update
    if @activated_frame
      @activated_frame = false
      return
    end
    if @loot_window.active
      update_item_selection
    elsif @command_window.active
      update_command_selection
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Item Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias moal_rfkl9_invntr_limit_upditmselect_1hr4 update_item_selection
  def update_item_selection
    @command_window.visible = false if @command_window.visible
    # Switch between windows by pressing Left or Right
    if @loot_window.visible && (Input.trigger? (Input::LEFT) || Input.trigger? (Input::RIGHT))
      Sound.play_cursor
      @active_window.index = -1
      loot_window_active = @loot_window.active
      @active_window.active = false
      @active_window = loot_window_active ? @item_window : @loot_window
      @active_window.active = true
      @active_window.index = 0
      @activated_frame = true
    end
    # IF ESC pressed
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      # If exchanging
      if @loot_window.index > -1 && @item_window.active
        slot = @active_window.ma_grfkl_lim_nvtry_item_8rn
        slot2 = @loot_window.ma_grfkl_lim_nvtry_item_8rn
        type, id, n = slot2.item_type, slot2.item_id, slot2.amount
        if slot != nil
          if !slot.item.ma_discardable? # Undiscardable Item
            Sound.play_buzzer
            return
          else
            type2, id2, n2 = slot.item_type, slot.item_id, slot.amount
            $game_temp.slots_to_discard.add_item (type2, id2, n2)
            $game_party.limit_inventory.remove_item (type2, id2, n2)
          end
        end
        $game_party.limit_inventory.add_item (type, id, n)
        $game_temp.slots_to_discard.remove_item (type, id, n)
        RPG::SE.new (Sound::MA_EXCHANGE_SE).play
        check_to_hide_loot
        @loot_window.active = false
        @loot_window.index = -1
      else # If selecting
        item = @active_window.item
        if item != nil && (@loot_window.active || item.ma_discardable? || $game_party.item_can_use? (item))
          Sound.play_decision
          @active_window = @loot_window.active ? @loot_window : @item_window
          start_command_window
        else
          Sound.play_buzzer
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Command
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_command_selection
    removed_from_loot = false
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # Deactivate Command Window
      @command_window.active = false
      @command_window.index = -1
      @command_window.visible = false
      # Reactivat previous Window
      @active_window.active = true
    elsif Input.trigger?(Input::C)
      if @active_window == @item_window
        case @command_window.index
        when 0 # Use
          moal_rfkl9_invntr_limit_upditmselect_1hr4
          @command_window.active = false if $game_party.item_can_use?(@item) && @item.scope != 0
        when 1 # Discard
          # Get slot
          slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
          unless slot.item.ma_discardable?
            Sound.play_buzzer
            return
          end
          type, id, n = slot.item_type, slot.item_id, slot.amount
          # Discard additional slots
          $game_party.limit_inventory.remove_item (type, id, n)
          $game_temp.slots_to_discard.add_item (type, id, n)
          # Deactivate Command Window
          @command_window.active = false
          @command_window.index = -1
          @command_window.visible = false
          # Reactivate previous Window
          if @loot_window.visible
            @item_window.refresh ($game_party.limit_inventory, 1)
            @loot_window.refresh ($game_temp.slots_to_discard, 1)
          else
            show_loot
          end
          @item_window.active = true
          RPG::SE.new (Sound::MA_DISCARD_SE).play
        end
        @emptycount_window.refresh ($game_party.limit_inventory)
      else # Called from Loot Window
        slot = @loot_window.ma_grfkl_lim_nvtry_item_8rn
        # Get slot stats
        type, id, n = slot.item_type, slot.item_id, slot.amount
        case @command_window.index
        when 0 # Take
          # If inventory has empty spaces
          if $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn)
            # Remove from loot and add to Inventory
            n2 = $game_party.limit_inventory.add_item (type, id, n)
            $game_temp.slots_to_discard.remove_item (type, id, n - n2)
            RPG::SE.new (Sound::MA_TAKE_SE).play
            removed_from_loot = true
          else
            Sound.play_buzzer
          end
        when 1 # Exchange
          # Deactivate Command Window
          @command_window.visible = false
          @command_window.active = false
          # Activate Item Window
          @item_window.active = true
          @item_window.index = 0
          @active_window = @item_window
          Sound.play_decision
        when 2 # Destroy
          $game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*n)
          $game_temp.slots_to_discard.remove_item (type, id, n)
          RPG::SE.new (Sound::MA_DESTROY_SE).play
          removed_from_loot = true
        end
        if removed_from_loot
          @command_window.active = false
          @command_window.visible = false
          check_to_hide_loot
        end
      end
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Warning
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def update_warning_window
    @warning_window.update
    if Input.trigger? (Input::B)
      # Play Cancel SE
      Sound.play_cancel
      # Dispose Warning
      @warning_window.dispose
      @warning_window = nil
    elsif Input.trigger? (Input::C)
      # Play Decision SE
      Sound.play_decision
      # When Yes
      if @warning_window.index == 0
        # End Scene
        clear_loot_slots
        return_scene
      end
      @warning_window.dispose
      @warning_window = nil
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Use Item (apply effects to non-ally targets)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_grkl_liminv_ustmnntrgt_2hb4 use_item_nontarget
  def use_item_nontarget
    # Get last instance of this item in the inventory.
    id = @item_window.index
    while id == @item_window.index
      @item_window.index += 1
      id += 1 if @item == @item_window.item
    end
    @item_window.index -= 1
    modalg_grkl_liminv_ustmnntrgt_2hb4
    $game_party.last_item_id = @item_window.index
    # Refresh Item Window if that slot is now empty
    if @item_window.item == nil
      @item_window.refresh
      @emptycount_window.refresh ($game_party.limit_inventory)
      hide_target_window
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Show Loot
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def show_loot
    @loot_window.refresh ($game_temp.slots_to_discard, 1)
    @loot_window.update
    @loot_window.visible = true
    @lootlabel_window.visible = true
    @item_window.width = Graphics.width / 2
    @item_window.refresh ($game_party.limit_inventory, 1)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Check to Hide Loot
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def check_to_hide_loot
    @loot_window.refresh ($game_temp.slots_to_discard, 1)
    @emptycount_window.refresh ($game_party.limit_inventory)
    # If there are no more items in loot
    if $game_temp.slots_to_discard.slots.size == 0
      # Hide Loot Window
      @loot_window.visible = false
      @loot_window.active = false
      @loot_window.index = -1
      @lootlabel_window.visible = false
      @item_window.width = Graphics.width
      @item_window.index = 0
      @item_window.refresh ($game_party.limit_inventory, 2)
      @item_window.active = true
      @active_window = @item_window
    else
      @item_window.refresh ($game_party.limit_inventory, 1)
      @loot_window.active = true
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Command Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def start_command_window
    # Set command window based on which window it is called from
    if @item_window.active
      @command_window.reset_commands ([Vocab::MA_COMMAND_USE, Vocab::MA_COMMAND_DISCARD])
      item = @item_window.item
      @command_window.draw_item (0, false) unless $game_party.item_can_use? (item)
      @command_window.draw_item (1, false) unless item.ma_discardable?
    elsif @loot_window.active
      cmnds = [Vocab::MA_COMMAND_TAKE, Vocab::MA_COMMAND_EXCHANGE, Vocab::MA_COMMAND_DESTROY]
      @command_window.reset_commands (cmnds)
      @command_window.draw_item (0, $game_party.limit_inventory.enough_space? (@loot_window.ma_grfkl_lim_nvtry_item_8rn))
    end
    rect = @active_window.item_rect (@active_window.index)
    x = @active_window.x + 16 + rect.x
    if x < (Graphics.width / 2)
      x += rect.width
    else
      x -= @command_window.width
    end
    @command_window.x = x
    # Get y coordinate
    y = @active_window.y + 16 + rect.y - ((@command_window.height - rect.height) / 2)
    y = (y + @command_window.height) > Graphics.height ? (Graphics.height - @command_window.height) : y
    @command_window.y = y < @active_window.y ? @active_window.y : y
    @command_window.index = 0
    @command_window.visible = true
    @command_window.active = true
    # Deactivate last window
    @active_window.active = false
    @activated_frame = true
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear Loot Slots
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def clear_loot_slots
    # Destroy all items in Loot
    unless $game_temp.slots_to_discard.slots.empty?
      # Update Party Hash and remove items
      $game_temp.slots_to_discard.slots.each { |slot|
        $game_party.drnlgbr_grafikal_limited_inventory_gn_itm_94n6 (slot.item, -1*slot.amount)
      }
      RPG::SE.new (Sound::MA_DESTROY_SE).play
      $game_temp.slots_to_discard.clear
    end
  end
end


Ayene - Czw 04 Lut, 2010 21:57

To nie jest kwestia dopracowania skryptu, tylko po prostu kompatybilności. Modern algebra również zmienia Scene_Item i Window_Item, dlatego się kłócą. Co najwyżej skrypt modern algebry można przerobić, by też wyświetlało okienko z informacją.
Szczurek - Czw 04 Lut, 2010 22:59

Czemu w takim razie wszystko jest ok, dopóki nie chcę wyjść z Menu przedmiotów ? Wszystko wyświetla się poprawnie, dopiero po naciśnięciu ESC buguje. Wydawałoby się, że jeśli wszystko wyświetla się poprawnie, to będą współpracować. Możesz podpowiedzieć w takim razie, co i gdzie po zmieniać ?
bionicl - Pią 05 Lut, 2010 00:01

Ja, to nawet bez tego co ty dałeś Szczurek, Mam taki błąd. Wszystko dobrze, klikam esc, BŁĄD! Nie wiem dlaczego...
Ayene - Pią 05 Lut, 2010 00:42

bionicl, jaki błąd wyskakuje, o jakiej treści? W której linijce?

Szczurek, trzeba dodać poszczególne okna i definicje w Scene_Item w skrypcie modern algebry. Zobaczymy, jak jutro znajdę trochę czasu i nie będę miała 39 st. gorączki to spróbuję je dostosować.

bionicl - Pią 05 Lut, 2010 11:20


Ayene - Pią 05 Lut, 2010 13:00

bionicl, a sprawdzałeś w czystym projekcie, czy skrypt działa? I czy jesteś pewien, że poprawnie skopiowałeś i wkleiłeś skrypt? Pytam tylko dlatego, że u mnie działa bez zastrzeżeń.
bionicl - Pią 05 Lut, 2010 13:20

W czystym działa...
Ayene - Pią 05 Lut, 2010 14:16

A masz jakiś skrypt w swoim projekcie, który zmienia Przedmioty w Menu? Widocznie skrypt ten jest bliżej Main, nadpisuje definicje w Scene_Item, przez co nie może usunąć okienek, które nie zostały zaimplementowane w def Start.
Szczurek - Pią 05 Lut, 2010 15:54

Ayene napisał/a:
jak jutro znajdę trochę czasu i nie będę miała 39 st. gorączki to spróbuję je dostosować.


Byłbym bardzo wdzięczny, bo ja nawet nie próbuję, bo jak narazie Ruby nie ujawnia żadnego pokrewieństwa logicznego z bardziej znanymi mi językami programowania :D
Poza tym Ty napewno zrobisz to 1000 razy optymalniej, mnie, nawet jeśli się uda, to skrypt utyje o 10 tys linijek :lol2:

Ayene - Czw 11 Lut, 2010 20:45

Cóż, próbowałam, ale nie udało mi się połączyć skryptów. W pierwszym momencie zastosowałam po prostu aliasy, ale nie zadziałało (wszystko ładnie wyświetlało, tylko okno potwierdzenia nie wyskakiwało). Niestety ale skrypt modern algebry jest dla mnie zupełnie nieczytelny. Zmiany jakie wprowadza kolejno odwołują się do nowych definicji a te do nowych - według mnie niepotrzebnych - zmiennych przez co, po pewnym czasie krążąc po skrypcie, człowiek się gubi i musi zaczynać od początku. Wiele fragmentów się powiela, nie ma jakiejś takiej spójności jak u innych twórców. Dlatego pasuję. Przykro mi, że nie mogę pomóc.
Szczurek - Czw 11 Lut, 2010 21:38

No trudno, doceniam, że próbowałaś :)
Wygląda na to, że muszę przemyśleć, co się grze bardziej przyda, niestety skrypt modern algebry narazie prowadzi, bo bez niego system depozytu nie ma większego sensu :)

Agumon - Czw 25 Lut, 2010 20:20

Ej a ja mam pytanko...
Dało by sie dać np obrazek 300x200 ????
Bo jak ja daje tomi go z 300x200 robi 200x200...
Pomoże ktoś???

Ayene - Czw 25 Lut, 2010 21:46

Zmień (linijka 28):
Kod:
SZEROKOSC_OKNA = 280

na
Kod:
SZEROKOSC_OKNA = 340


Następnie zmień (linijka 226 i 227):
Kod:
x = (240 - bitmap.width) / 2
self.contents.blt(x, 40, bitmap, Rect.new(0, 0, 240, 360), opacity)

na
Kod:
x = (Ayene::SZEROKOSC_OKNA - 32 - bitmap.width) / 2
self.contents.blt(x, 40, bitmap, Rect.new(0, 0, Ayene::SZEROKOSC_OKNA, 360), opacity)


Po czym zmień (linijka 229):
Kod:
tx = (240 - cx) / 2

na
Kod:
tx = (Ayene::SZEROKOSC_OKNA - 32 - cx) / 2


Powered by phpBB modified by Przemo © 2003 phpBB Group