Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: Wto 02 Lut, 2010 17:15
Info Przedmiotu w Menu
~ Info Przedmiotu w Menu [VX] ~
Krótki opis
Skrypt powstał na zamówienie. Wyświetla Info o przedmiocie w Inwentarzu po wciśnięciu SHIFT (patrz screenshot).
Opis przedmiotu:
Żeby tekst opisu przeszedł sam do kolejnej linijki, należy w jego treści wpisać \|
Czyli opis:
Kod:
Legendarny miecz o niezniszczalnym\|ostrzu
wyświetli się następująco:
Kod:
Legendarny miecz o niezniszczalnym
ostrzu
Autor skryptu
Ayene
Kompatybilność
Tylko VX
Skrypt
Spoiler:
Kod:
#-----------------------------------------------------------------
# Info Przedmiotu w Menu
# By Ayene
# Publikacja: 02.02.2010
# Wersja: 1.1
#-----------------------------------------------------------------
# Instalacja: Umieść skrypt nad Main. Do poprawnego działania wymagane jest także
# umieszczenie w folderze Graphics/Pictures obrazków png o nazwach odpowiadających
# nazwom przedmiotów w bazie danych. Optymalny wymiar obrazów to max 200 x 150 px.
# Przykładowo:
# By wyświetlić przedmiot Potion należy w folderze zamieścić plik Potion.png
#-----------------------------------------------------------------
# Info wyświetla się po wciśnięciu SHIFT.
#-----------------------------------------------------------------
# KONFIGURACJA
module Ayene
# Włącza / wyłącza obrazki w Info
OBRAZKI = true # true / false
# Wyświetla okno na dole z krótką legendą
DOLNE_OKNO = true # true / false
# Szerokość okna Info - zaleca się nie większe niż 544 nie mniejsze niż 33
SZEROKOSC_OKNA = 280
# Opis przedmiotu (zakładka Items w Bazie danych)
ITEM_INFO = { # ID => "Opis przedmiotu",
0 => "???", # tekst, dla reszty niezadeklarowanych przedmiotów
1 => "Odkryty przez szalonego\|naukowca. Nigdy nie jest\|wiadome, czy zadziała.",
3 => "Czy coś tam się właśnie\|poruszyło?",
7 => " ",
15 => " " # <- bez przecinka
} # <-- Nie usuwać
# Opis broni (zakładka Weapons w Bazie danych)
WEAPON_INFO = { # ID => "Opis broni",
0 => "???", # tekst, dla reszty niezadeklarowanych broni
6 => " ",
12 => " ",
15 => " ",
17 => " ",
22 => "Według legendy należał\|do szlachetnej rasy Elfów.\|Szkoda że tylko one mogą\|z tego korzystać.",
23 => " "# <- bez przecinka
} # <-- Nie usuwać
# Opis pancerza (zakładka Armors w Bazie danych)
ARMOR_INFO = { # ID => "Opis pancerza",
0 => "???", # tekst, dla reszty niezadeklarowanych pancerzy
5 => "",
10 => "",
13 => "Nie wygląda schludnie.\|Jest trochę poniszczona.",
17 => "Zbroja została zrobiona\|z najwyższej klasy stopu.",
18 => " " # <- bez przecinka
} # <-- Nie usuwać
end
# KONIEC KONFIGURACJI
#-----------------------------------------------------------------
# Scene_Item
#-----------------------------------------------------------------
class Scene_Item < Scene_Base
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
if Ayene::DOLNE_OKNO
@item_window = Window_Item.new(0, 56, 544, 304)
@lower_window = Window_Help.new
@lower_window.viewport = @viewport
@lower_window.y = 360
@lower_window.set_text(Ayene::TRESC_LEGENDY, 1)
else
@item_window = Window_Item.new(0, 56, 544, 360)
end
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@info_window = Window_Item_Info.new (0, 0)
@item = @item_window.item
if @item != nil
@info_window.refresh(@item, @item.id)
else
@info_window.delete
end
@target_window = Window_MenuStatus_Item.new(0, 0)
hide_target_window
end
alias ayene_scene_item_terminate terminate
def terminate
@info_window.dispose
@lower_window.dispose if Ayene::DOLNE_OKNO
ayene_scene_item_terminate
end
def update
super
update_menu_background
@help_window.update
@item_window.update
@target_window.update
@info_window.update
@lower_window.update if Ayene::DOLNE_OKNO
if @item_window.active
update_item_selection
@item = @item_window.item
if @item != nil
@info_window.refresh(@item, @item.id)
else
@info_window.delete
end
elsif @target_window.active
update_target_selection
elsif @info_window.active
update_info_window
end
end
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::A) and @item != nil
Sound.play_decision
show_info_window(@item_window.index % 2 == 0)
end
end
def update_info_window
if Input.trigger?(Input::B) or Input.trigger?(Input::A)
Sound.play_cancel
hide_info_window
end
end
def show_info_window(right)
@item_window.active = false
width_remain = 544 - @info_window.width
@info_window.x = right ? width_remain : 0
@info_window.active = true
@info_window.visible = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@info_window.width, 0, width_remain, 416)
@viewport.ox = @info_window.width
end
end
def hide_info_window
@item_window.active = true
@item_window.visible = true
@info_window.active = false
@info_window.visible = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
end
#-----------------------------------------------------------------
# Window_MenuStatus_Item
#-----------------------------------------------------------------
class Window_MenuStatus_Item < Window_Selectable
def initialize(x, y)
super(x, y, 280, 416)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.members.size
for actor in $game_party.members
draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
x = 100
y = actor.index * 96 - 2
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 88, y)
draw_actor_state(actor, x, y + WLH * 3)
draw_actor_hp(actor, x, y + WLH * 1)
draw_actor_mp(actor, x, y + WLH * 2)
end
end
def update_cursor
if @index < 0
self.cursor_rect.empty
elsif @index < @item_max
self.cursor_rect.set(0, @index * 96, contents.width, 96)
elsif @index >= 100
self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
else
self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
end
end
end
#-----------------------------------------------------------------
# Window_Item_Info
#-----------------------------------------------------------------
class Window_Item_Info < Window_Base
def initialize(x, y)
super(x, y, Ayene::SZEROKOSC_OKNA, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = false
self.visible = false
end
def refresh(item, id)
self.contents.clear
@id = id
@item = item
last_font_size = self.contents.font.size
if Ayene::OBRAZKI
bitmap = Cache.picture(@item.name)
x = (Ayene::SZEROKOSC_OKNA - 32 - bitmap.width) / 2
self.contents.blt(x, 40, bitmap, Rect.new(0, 0, Ayene::SZEROKOSC_OKNA, 360), opacity)
end
cx = contents.text_size(@item.name).width
tx = (Ayene::SZEROKOSC_OKNA - 32 - cx) / 2
self.contents.font.size = 22
self.contents.font.color = system_color
self.contents.draw_text(tx, 0, 200, WLH, @item.name)
self.contents.font.size = last_font_size
if Ayene::OBRAZKI
y = 200
else
y = 40
end
self.contents.draw_text(60, y, 100, WLH, @item.price.to_s + " " + $data_system.terms.gold)
case @item
when RPG::Item
self.contents.draw_text(60, y + WLH * 1, 100, WLH, "Przedmiot")
if Ayene::ITEM_INFO[@item.id].nil?
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::ITEM_INFO[0])
else
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::ITEM_INFO[@item.id])
end
case @item.scope
when 0
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Brak")
when 1, 2, 3, 4
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Jeden Przeciwnik")
when 5
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Dwóch Przeciwników")
when 6
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Trzech Przeciwników")
when 7
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Jeden Sojusznik")
when 8
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Wszyscy Sojusznicy")
when 9
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Jeden Nieżywy")
when 10
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Wszyscy Nieżywi")
when 11
self.contents.draw_text(60, y + WLH * 2, 200, WLH, "Użytkownik")
end
self.contents.font.color = normal_color
self.contents.draw_text(0, y + WLH * 2, 60, WLH, "Cel:")
self.contents.font.color = system_color
when RPG::Weapon
self.contents.draw_text(60, y + WLH * 1, 100, WLH, "Broń")
if Ayene::WEAPON_INFO[@item.id].nil?
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::WEAPON_INFO[0])
else
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::WEAPON_INFO[@item.id])
end
when RPG::Armor
self.contents.draw_text(60, y + WLH * 1, 100, WLH, "Pancerz")
if Ayene::ARMOR_INFO[@item.id].nil?
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::ARMOR_INFO[0])
else
draw_info_text(0, y + WLH * 3, 280, WLH, Ayene::ARMOR_INFO[@item.id])
end
end
self.contents.font.color = normal_color
self.contents.draw_text(0, y, 60, WLH, "Cena:")
self.contents.draw_text(0, y + WLH * 1, 60, WLH, "Typ:")
end
def delete
self.contents.clear
end
end
#-----------------------------------------------------------------
# Window_Base
#-----------------------------------------------------------------
class Window_Base < Window
def draw_info_text(x, y, width, height, text)
text_info = text.split(/\|/)
for i in 0...text_info.size
self.contents.draw_text( x, y + i * WLH, width, WLH, text_info[i])
break if (y + i * WLH) > (self.height - WLH)
end
end
end
Dodatki
Skrypt wymaga umieszczenia w folderze Graphics/Pictures obrazków png o nazwach odpowiadających nazwom przedmiotów w bazie danych. Optymalny wymiar obrazów to max 200 x 150 px.
Demo
Screenshot
Spoiler:
Instrukcja
1. Wklej skrypt nad "Main" w Edytorze Skryptu.
2. Reszta instrukcji znajduje się w treści skryptu.
Ayene, jesteś wielka !
Sprawdzę kompatybilność z innymi skryptami i jak coś, napiszę, z czym się kłóci.
Kwestia teraz, skąd brać obrazki :D ?
________________________ Embrace your dreams... And... whatever happens... protect your honor...
Interesuje Cię moja gra ? Dowiedz się więcej TUTAJ lub na FORUM GRY
Pomógł: 1 raz Dołączył: 06 Gru 2009 Posty: 99 Skąd: z Huty Mińskiej
Wysłany: 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...
________________________ Gość, podoba ci się moja gra? ;)
Pomógł: 1 raz Dołączył: 06 Gru 2009 Posty: 99 Skąd: z Huty Mińskiej
Wysłany: 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 , 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.
#===============================================================================
#--------------------------------------------------------------------------
# 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
#-------------------------------------------------------------
# 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
#--------------------------------------------------------------------------
# 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
#
#===============================================================================
________________________ Gość, podoba ci się moja gra? ;)
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.
#==============================================================================
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
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.
#==============================================================================
#==============================================================================
# ** Window_InvCommand
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This is a Window_Command, specialized to allow for frequent resetting of the
# commands
#==============================================================================
#==============================================================================
# ** 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
________________________ Embrace your dreams... And... whatever happens... protect your honor...
Interesuje Cię moja gra ? Dowiedz się więcej TUTAJ lub na FORUM GRY
Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: 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ą.
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ć ?
________________________ Embrace your dreams... And... whatever happens... protect your honor...
Interesuje Cię moja gra ? Dowiedz się więcej TUTAJ lub na FORUM GRY
Pomogła: 232 razy Dołączyła: 18 Wrz 2007 Posty: 2424
Wysłany: 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ć.
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum