Io ho uno script per il menu degli oggetti. Avevo già provato a modificarlo ma qualcosa andava storto e non andava.
Qualcuno può modificare questo script facendolo funzionare per le skill?
#====================
# Script Scene_Menu divisa per categorie ultima modifica 28/04/2006
# www.rpgshrine.altervista.org
# Script by Tio. Special thanks to RagnarokM
#====================
#=========================================================
# - Window_Item modificata da RagnarokM
#------------------------------------------------------------------------------
# E' la finestra che mostra la lista di oggetti posseduti sullo schermo
# degli oggetti e della battaglia
#=========================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
self.index = -1
self.active = false
self.visible = false
@column_max = 1
refresh
# Durante una finestra si muove al centro dello schermo e diventa
# translucente
if $game_temp.in_battle
self.y = 64
self.height = 256
end
end
#--------------------------------------------------------------------------
# - Acquisizione di un oggetto
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Aggiunta di un oggetto
for i in 1...$data_items.size
# Controllo se l'oggetto è utilizzabile.
# Se lo è lo inserisco nela lista degli oggetti che è possibile utilizzare.
oggetto = $data_items[i]
if (oggetto.occasion == 0) or (oggetto.occasion == 1) or (oggetto.occasion == 2)
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# Se il numero degli oggetti è 0, verrà creato un bitmap e tutti
# gli oggetti verranno disegnati
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Disegna un oggetto
# index : Numero dell'oggetto
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.font.name = "Arial"
self.contents.font.size = 24
x = 4 + index % 1 * (288 + 32)
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Aggiornamento del testo di aiuto
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#====================================================
# - Window_KeyItem Creata da RagnarokM
#------------------------------------------------------------------------------
# E' la finestra che mostra la lista di oggetti chiave posseduti nella schermata
# degli oggetti.
#====================================================
class Window_KeyItem < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
@column_max = 1
self.index = -1
self.active = false
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# - Acquisizione di un oggetto
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Aggiunta di un oggetto
for i in 1...$data_items.size
oggetto = $data_items[i]
# Controllo se l'oggetto è utilizzabile.
# Se non lo è inserisco nella lista degli oggetti chiave.
if oggetto.occasion == 3
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# Se il numero degli oggetti è 0, verrà creato un bitmap e tutti
# gli oggetti verranno disegnati
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Disegna un oggetto
# index : Numero dell'oggetto
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
self.contents.font.color = disabled_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
x = 4 + index % 1 * (288 + 32)
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Aggiornamento del testo di aiuto
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#============================================================
# - Window_Target
#------------------------------------------------------------------------------
# E' lo schermo degli oggetti e delle abilità ed è la finestra dalla quale
# si sceglie il personaggio da usare
#============================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 416)
self.index = 0
self.active = false
self.z += 10
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 24
@item_max = $game_party.actors.size
refresh
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 95
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 10, y + 75)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x + 20, y + 32)
draw_actor_state(actor, x + 20, y + 64)
draw_actor_hp(actor, x + 152, y + 32)
draw_actor_sp(actor, x + 152, y + 64)
end
end
#--------------------------------------------------------------------------
# - Aggiornamento del rettangolo del cursore
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 95, self.width - 32, 96)
end
end
end
#================================================================
# - Window_Weapon
#------------------------------------------------------------------------------
# E' la finestra che mostra la lista di oggetti posseduti sullo schermo
# degli oggetti e della battaglia
#================================================================
class Window_Weapon < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
self.index = -1
self.active = false
self.visible = false
@column_max = 1
refresh
# Durante una finestra si muove al centro dello schermo e diventa
# translucente
if $game_temp.in_battle
self.y = 64
self.height = 256
end
end
#--------------------------------------------------------------------------
# - Acquisizione di un oggetto
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Aggiunta di un oggetto
# Vengono anche aggiunti un'arma e uno scudo se è possibile,
# eccetto durante una battaglia
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
end
# Se il numero degli oggetti è 0, verrà creato un bitmap e tutti
# gli oggetti verranno disegnati
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Disegna un oggetto
# index : Numero dell'oggetto
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.weapon_number(item.id)
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.font.name = "Arial"
self.contents.font.size = 24
x = 4 + index % 1 * (288 + 32)
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Aggiornamento del testo di aiuto
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#=================================================================
# - Window_Armor
#------------------------------------------------------------------------------
# E' la finestra che mostra la lista di oggetti posseduti sullo schermo
# degli oggetti e della battaglia
#=================================================================
class Window_Armor < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 64, 320, 416)
self.index = -1
self.active = false
self.visible = false
@column_max = 1
refresh
# Durante una finestra si muove al centro dello schermo e diventa
# translucente
if $game_temp.in_battle
self.y = 64
self.height = 256
end
end
#--------------------------------------------------------------------------
# - Acquisizione di un oggetto
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Vengono anche aggiunti un'arma e uno scudo se è possibile,
# eccetto durante una battaglia
unless $game_temp.in_battle
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# Se il numero degli oggetti è 0, verrà creato un bitmap e tutti
# gli oggetti verranno disegnati
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# - Disegna un oggetto
# index : Numero dell'oggetto
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.armor_number(item.id)
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.font.name = "Arial"
self.contents.font.size = 24
x = 4 + index % 1 * (288 + 32)
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Aggiornamento del testo di aiuto
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#===================================================================
# - Scene_Item
#------------------------------------------------------------------------------
# Scena degli oggetti
#===================================================================
class Scene_Item
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# - Processo Principale
#--------------------------------------------------------------------------
def main
s1 = $data_system.words.item
s2 = "Armi"
s3 = "Armature"
s4 = "Rarità"
@command_window = Window_Command.new(160, [s1, s2, s3, s4,])
@command_window.index = @menu_index
@command_window.x = 240
@command_window.y = 120
@command_window.index = 0
@command_window.z = 200
@command_window.active = true
@dummy_window = Window_Base.new(0, 64, 320, 416)
@weapon_window = Window_Weapon.new
@armor_window = Window_Armor.new
@keyItem_window = Window_KeyItem.new
@item_window = Window_Item.new
# Creazione finestra d'aiuto
@help_window = Window_Help.new
@item_window.help_window = @help_window
@keyItem_window.help_window = @help_window
@armor_window.help_window = @help_window
@weapon_window.help_window = @help_window
# Creazione finestra dell'obiettivo
@target_window = Window_Target.new
@target_window.x = 320
@target_window.y = 64
@target_window.index = -1
# Fade
Graphics.transition
# Loop Principale
loop do
# Aggiornamento Grafica
Graphics.update
# Aggiornamento Input
Input.update
# Aggiornamento Frame
update
# Quando cambia la scena blocca il loop
if $scene != self
break
end
end
# Preparazione Fade
Graphics.freeze
# Eliminazione Finestre
@help_window.dispose
@item_window.dispose
@target_window.dispose
@weapon_window.dispose
@armor_window.dispose
@keyItem_window.dispose
@dummy_window.dispose
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def update
# Aggiornamento Finestre
@help_window.update
@item_window.update
@target_window.update
@command_window.update
@weapon_window.update
@armor_window.update
@keyItem_window.update
if @command_window.active
update_command
return
end
# Chiama update_item se è attiva la finestra degli oggetti
if @item_window.active
update_item
return
end
if @weapon_window.active
update_weapon
return
end
if @armor_window.active
update_armor
return
end
if @keyItem_window.active
update_KeyItem
return
end
# Chiama update_target se è attiva la finestra dell'obiettivo
if @target_window.active
update_target
return
end
end
# Quando è attiva la finestra dei comandi
def update_command
# Quando B è premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Torna al menu
@command_window.visible = false
@command_window.active = false
$scene = Scene_Menu.new (0)
return
end
# Quando C è premuto
if Input.trigger?(Input::C)
@command_window.visible = false
@command_window.active = false
# Scelta del comando da eseguire
case @command_window.index
when 0 # Oggetti
# Suona SE Azione
$game_system.se_play($data_system.decision_se)
# Vai alla scena degli oggetti
@item_window.visible = true
@item_window.active = true
@item_window.index = 0
when 1 #Armi
# Suona SE Azione
$game_system.se_play($data_system.decision_se)
@weapon_window.visible = true
@weapon_window.active = true
@weapon_window.index = 0
when 2 # Armature
# Suona SE Azione
$game_system.se_play($data_system.decision_se)
@armor_window.visible = true
@armor_window.active = true
@armor_window.index = 0
when 3 # Rarità
# Suona SE Azione
$game_system.se_play($data_system.decision_se)
@keyItem_window.visible = true
@keyItem_window.active = true
@keyItem_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# - Aggiornamento Frame (Quando è attiva la finestra degli oggetti)
#--------------------------------------------------------------------------
def update_item
# Quando B è premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Torna al menu
@command_window.index = @command_window.index
@command_window.active = true
@command_window.visible = true
@item_window.active = false
@item_window.visible = false
@item_window.index = -1
# Cancella il testo d'aiuto
@help_window.set_text("")
@dummy_window.visible = true
return
end
# Quando C è premuto
if Input.trigger?(Input::C)
# Acquisizione dei dati selezionati
@item = @item_window.item
# Quando l'oggetto è un'arma o un'armatura
unless @item.is_a?(RPG::Item)
# Suona SE Azione Impossibile
$game_system.se_play($data_system.buzzer_se)
return
end
# Quando l'oggetto non può essere usato
unless $game_party.item_can_use?(@item.id)
# Suona SE Azione Impossibile
$game_system.se_play($data_system.buzzer_se)
return
end
# Suona SE Azione
$game_system.se_play($data_system.decision_se)
# Controlla l'obiettivo dell'oggetto
if @item.scope >= 3
# La finestra dell'obiettivo viene attivata
@item_window.active = false
@target_window.active = true
# Setta il cursore in base all'obiettivo
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# Quando l'obiettivo non sono gli eroi
else
# Quando c'è un evento comune
if @item.common_event_id > 0
# Chiama l'evento comune
$game_temp.common_event_id = @item.common_event_id
# Suona SE dell'oggetto
$game_system.se_play(@item.menu_se)
# Se l'oggetto si consuma
if @item.consumable
# Elimina un oggetto
$game_party.lose_item(@item.id, 1)
# Aggiorna la finestra degli oggetti
@item_window.draw_item(@item_window.index)
end
# Torna alla mappa
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# - Aggiornamento Frame (Quando è attiva la finestra delle armi)
#--------------------------------------------------------------------------
def update_weapon
# Quando B è premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Torna al menu
@command_window.index = @command_window.index
@command_window.active = true
@command_window.visible = true
@weapon_window.active = false
@weapon_window.visible = false
@weapon_window.index = -1
# Cancella il testo d'aiuto
@help_window.set_text("")
@dummy_window.visible = true
return
end
end
#--------------------------------------------------------------------------
# - Aggiornamento Frame (Quando è attiva la finestra delle armature)
#--------------------------------------------------------------------------
def update_armor
# Quando B è premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Torna al menu
@command_window.index = @command_window.index
@command_window.active = true
@command_window.visible = true
@armor_window.active = false
@armor_window.visible = false
@armor_window.index = -1
# Cancella il testo d'aiuto
@help_window.set_text("")
@dummy_window.visible = true
return
end
end
#--------------------------------------------------------------------------
# - Aggiornamento Frame (Quando è attiva la finestra delle armi)
#--------------------------------------------------------------------------
def update_KeyItem
# Quando B è premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Torna al menu
@command_window.index = @command_window.index
@command_window.active = true
@command_window.visible = true
@keyItem_window.active = false
@keyItem_window.visible = false
@keyItem_window.index = -1
@dummy_window.visible = true
# Cancella il testo d'aiuto
@help_window.set_text("")
return
end
end
#--------------------------------------------------------------------------
# - Aggiornamento Frame (Quando è attiva la finestra dell'obiettivo)
#--------------------------------------------------------------------------
def update_target
# Quando B è Premuto
if Input.trigger?(Input::B)
# Suona SE Annulla
$game_system.se_play($data_system.cancel_se)
# Quando l'oggetto non può essere usato
unless $game_party.item_can_use?(@item.id)
# Aggiornamento finestra degli oggetti
@item_window.refresh
end
# Eliminazione finestra dell'obiettivo
@item_window.active = true
@target_window.active = false
@target_window.index = -1
return
end
# Quando c è premuto
if Input.trigger?(Input::C)
# Quando un oggetto è finito
if $game_party.item_number(@item.id) == 0
# Suona SE Azione Impossibile
$game_system.se_play($data_system.buzzer_se)
return
end
# Quando l'obiettivo sono tutti gli eroi
if @target_window.index == -1
# L'effetto dell'oggetto colpisce tutti gli eroi
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# Quando l'obiettivo è un eroe
if @target_window.index >= 0
# L'effetto dell'oggetto colpisce l'eroe selezionato
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# Quando l'oggetto viene usato
if used
# Suona SE dell'oggetto
$game_system.se_play(@item.menu_se)
# Se l'oggetto si consuma
if @item.consumable
# Elimina un oggetto
$game_party.lose_item(@item.id, 1)
# Aggiorna la finestra degli oggetti
@item_window.draw_item(@item_window.index)
end
# Aggiorna la finestra dell'obiettivo
@target_window.refresh
# Se gli eroi muoiono
if $game_party.all_dead?
# Vai al gameover
$scene = Scene_Gameover.new
return
end
# Se c'è un evento comune
if @item.common_event_id > 0
# Chiama l'evento comune
$game_temp.common_event_id = @item.common_event_id
# Torna alla mappa
$scene = Scene_Map.new
return
end
end
# Se l'oggetto non è stato usato
unless used
# Suona SE Azione Impossibile
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Question
Peco92
Io ho uno script per il menu degli oggetti. Avevo già provato a modificarlo ma qualcosa andava storto e non andava.
Qualcuno può modificare questo script facendolo funzionare per le skill?
#==================== # Script Scene_Menu divisa per categorie ultima modifica 28/04/2006 # www.rpgshrine.altervista.org # Script by Tio. Special thanks to RagnarokM #==================== #========================================================= # - Window_Item modificata da RagnarokM #------------------------------------------------------------------------------ # E' la finestra che mostra la lista di oggetti posseduti sullo schermo # degli oggetti e della battaglia #========================================================= class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 64, 320, 416) self.index = -1 self.active = false self.visible = false @column_max = 1 refresh # Durante una finestra si muove al centro dello schermo e diventa # translucente if $game_temp.in_battle self.y = 64 self.height = 256 end end #-------------------------------------------------------------------------- # - Acquisizione di un oggetto #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Aggiunta di un oggetto for i in 1...$data_items.size # Controllo se l'oggetto è utilizzabile. # Se lo è lo inserisco nela lista degli oggetti che è possibile utilizzare. oggetto = $data_items[i] if (oggetto.occasion == 0) or (oggetto.occasion == 1) or (oggetto.occasion == 2) if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end end # Se il numero degli oggetti è 0, verrà creato un bitmap e tutti # gli oggetti verranno disegnati @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # - Disegna un oggetto # index : Numero dell'oggetto #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] number = $game_party.item_number(item.id) if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.font.name = "Arial" self.contents.font.size = 24 x = 4 + index % 1 * (288 + 32) y = index * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # - Aggiornamento del testo di aiuto #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #==================================================== # - Window_KeyItem Creata da RagnarokM #------------------------------------------------------------------------------ # E' la finestra che mostra la lista di oggetti chiave posseduti nella schermata # degli oggetti. #==================================================== class Window_KeyItem < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 64, 320, 416) @column_max = 1 self.index = -1 self.active = false self.visible = false refresh end #-------------------------------------------------------------------------- # - Acquisizione di un oggetto #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Aggiunta di un oggetto for i in 1...$data_items.size oggetto = $data_items[i] # Controllo se l'oggetto è utilizzabile. # Se non lo è inserisco nella lista degli oggetti chiave. if oggetto.occasion == 3 if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end end # Se il numero degli oggetti è 0, verrà creato un bitmap e tutti # gli oggetti verranno disegnati @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # - Disegna un oggetto # index : Numero dell'oggetto #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] number = $game_party.item_number(item.id) self.contents.font.color = disabled_color self.contents.font.name = "Arial" self.contents.font.size = 24 x = 4 + index % 1 * (288 + 32) y = index * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # - Aggiornamento del testo di aiuto #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================ # - Window_Target #------------------------------------------------------------------------------ # E' lo schermo degli oggetti e delle abilità ed è la finestra dalla quale # si sceglie il personaggio da usare #============================================================ class Window_Target < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 0, 320, 416) self.index = 0 self.active = false self.z += 10 self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Arial" self.contents.font.size = 24 @item_max = $game_party.actors.size refresh end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...$game_party.actors.size x = 4 y = i * 95 actor = $game_party.actors[i] draw_actor_graphic(actor, x + 10, y + 75) draw_actor_name(actor, x, y) draw_actor_class(actor, x + 144, y) draw_actor_level(actor, x + 20, y + 32) draw_actor_state(actor, x + 20, y + 64) draw_actor_hp(actor, x + 152, y + 32) draw_actor_sp(actor, x + 152, y + 64) end end #-------------------------------------------------------------------------- # - Aggiornamento del rettangolo del cursore #-------------------------------------------------------------------------- def update_cursor_rect if @index < 0 self.cursor_rect.empty else self.cursor_rect.set(0, @index * 95, self.width - 32, 96) end end end #================================================================ # - Window_Weapon #------------------------------------------------------------------------------ # E' la finestra che mostra la lista di oggetti posseduti sullo schermo # degli oggetti e della battaglia #================================================================ class Window_Weapon < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 64, 320, 416) self.index = -1 self.active = false self.visible = false @column_max = 1 refresh # Durante una finestra si muove al centro dello schermo e diventa # translucente if $game_temp.in_battle self.y = 64 self.height = 256 end end #-------------------------------------------------------------------------- # - Acquisizione di un oggetto #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Aggiunta di un oggetto # Vengono anche aggiunti un'arma e uno scudo se è possibile, # eccetto durante una battaglia unless $game_temp.in_battle for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end end # Se il numero degli oggetti è 0, verrà creato un bitmap e tutti # gli oggetti verranno disegnati @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # - Disegna un oggetto # index : Numero dell'oggetto #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] number = $game_party.weapon_number(item.id) if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.font.name = "Arial" self.contents.font.size = 24 x = 4 + index % 1 * (288 + 32) y = index * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # - Aggiornamento del testo di aiuto #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #================================================================= # - Window_Armor #------------------------------------------------------------------------------ # E' la finestra che mostra la lista di oggetti posseduti sullo schermo # degli oggetti e della battaglia #================================================================= class Window_Armor < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 64, 320, 416) self.index = -1 self.active = false self.visible = false @column_max = 1 refresh # Durante una finestra si muove al centro dello schermo e diventa # translucente if $game_temp.in_battle self.y = 64 self.height = 256 end end #-------------------------------------------------------------------------- # - Acquisizione di un oggetto #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Vengono anche aggiunti un'arma e uno scudo se è possibile, # eccetto durante una battaglia unless $game_temp.in_battle for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end end # Se il numero degli oggetti è 0, verrà creato un bitmap e tutti # gli oggetti verranno disegnati @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # - Disegna un oggetto # index : Numero dell'oggetto #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] number = $game_party.armor_number(item.id) if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end self.contents.font.name = "Arial" self.contents.font.size = 24 x = 4 + index % 1 * (288 + 32) y = index * 32 rect = Rect.new(x, y, self.width / @column_max - 32, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # - Aggiornamento del testo di aiuto #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #=================================================================== # - Scene_Item #------------------------------------------------------------------------------ # Scena degli oggetti #=================================================================== class Scene_Item def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # - Processo Principale #-------------------------------------------------------------------------- def main s1 = $data_system.words.item s2 = "Armi" s3 = "Armature" s4 = "Rarità" @command_window = Window_Command.new(160, [s1, s2, s3, s4,]) @command_window.index = @menu_index @command_window.x = 240 @command_window.y = 120 @command_window.index = 0 @command_window.z = 200 @command_window.active = true @dummy_window = Window_Base.new(0, 64, 320, 416) @weapon_window = Window_Weapon.new @armor_window = Window_Armor.new @keyItem_window = Window_KeyItem.new @item_window = Window_Item.new # Creazione finestra d'aiuto @help_window = Window_Help.new @item_window.help_window = @help_window @keyItem_window.help_window = @help_window @armor_window.help_window = @help_window @weapon_window.help_window = @help_window # Creazione finestra dell'obiettivo @target_window = Window_Target.new @target_window.x = 320 @target_window.y = 64 @target_window.index = -1 # Fade Graphics.transition # Loop Principale loop do # Aggiornamento Grafica Graphics.update # Aggiornamento Input Input.update # Aggiornamento Frame update # Quando cambia la scena blocca il loop if $scene != self break end end # Preparazione Fade Graphics.freeze # Eliminazione Finestre @help_window.dispose @item_window.dispose @target_window.dispose @weapon_window.dispose @armor_window.dispose @keyItem_window.dispose @dummy_window.dispose end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def update # Aggiornamento Finestre @help_window.update @item_window.update @target_window.update @command_window.update @weapon_window.update @armor_window.update @keyItem_window.update if @command_window.active update_command return end # Chiama update_item se è attiva la finestra degli oggetti if @item_window.active update_item return end if @weapon_window.active update_weapon return end if @armor_window.active update_armor return end if @keyItem_window.active update_KeyItem return end # Chiama update_target se è attiva la finestra dell'obiettivo if @target_window.active update_target return end end # Quando è attiva la finestra dei comandi def update_command # Quando B è premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Torna al menu @command_window.visible = false @command_window.active = false $scene = Scene_Menu.new (0) return end # Quando C è premuto if Input.trigger?(Input::C) @command_window.visible = false @command_window.active = false # Scelta del comando da eseguire case @command_window.index when 0 # Oggetti # Suona SE Azione $game_system.se_play($data_system.decision_se) # Vai alla scena degli oggetti @item_window.visible = true @item_window.active = true @item_window.index = 0 when 1 #Armi # Suona SE Azione $game_system.se_play($data_system.decision_se) @weapon_window.visible = true @weapon_window.active = true @weapon_window.index = 0 when 2 # Armature # Suona SE Azione $game_system.se_play($data_system.decision_se) @armor_window.visible = true @armor_window.active = true @armor_window.index = 0 when 3 # Rarità # Suona SE Azione $game_system.se_play($data_system.decision_se) @keyItem_window.visible = true @keyItem_window.active = true @keyItem_window.index = 0 end end end #-------------------------------------------------------------------------- # - Aggiornamento Frame (Quando è attiva la finestra degli oggetti) #-------------------------------------------------------------------------- def update_item # Quando B è premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Torna al menu @command_window.index = @command_window.index @command_window.active = true @command_window.visible = true @item_window.active = false @item_window.visible = false @item_window.index = -1 # Cancella il testo d'aiuto @help_window.set_text("") @dummy_window.visible = true return end # Quando C è premuto if Input.trigger?(Input::C) # Acquisizione dei dati selezionati @item = @item_window.item # Quando l'oggetto è un'arma o un'armatura unless @item.is_a?(RPG::Item) # Suona SE Azione Impossibile $game_system.se_play($data_system.buzzer_se) return end # Quando l'oggetto non può essere usato unless $game_party.item_can_use?(@item.id) # Suona SE Azione Impossibile $game_system.se_play($data_system.buzzer_se) return end # Suona SE Azione $game_system.se_play($data_system.decision_se) # Controlla l'obiettivo dell'oggetto if @item.scope >= 3 # La finestra dell'obiettivo viene attivata @item_window.active = false @target_window.active = true # Setta il cursore in base all'obiettivo if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end # Quando l'obiettivo non sono gli eroi else # Quando c'è un evento comune if @item.common_event_id > 0 # Chiama l'evento comune $game_temp.common_event_id = @item.common_event_id # Suona SE dell'oggetto $game_system.se_play(@item.menu_se) # Se l'oggetto si consuma if @item.consumable # Elimina un oggetto $game_party.lose_item(@item.id, 1) # Aggiorna la finestra degli oggetti @item_window.draw_item(@item_window.index) end # Torna alla mappa $scene = Scene_Map.new return end end return end end #-------------------------------------------------------------------------- # - Aggiornamento Frame (Quando è attiva la finestra delle armi) #-------------------------------------------------------------------------- def update_weapon # Quando B è premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Torna al menu @command_window.index = @command_window.index @command_window.active = true @command_window.visible = true @weapon_window.active = false @weapon_window.visible = false @weapon_window.index = -1 # Cancella il testo d'aiuto @help_window.set_text("") @dummy_window.visible = true return end end #-------------------------------------------------------------------------- # - Aggiornamento Frame (Quando è attiva la finestra delle armature) #-------------------------------------------------------------------------- def update_armor # Quando B è premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Torna al menu @command_window.index = @command_window.index @command_window.active = true @command_window.visible = true @armor_window.active = false @armor_window.visible = false @armor_window.index = -1 # Cancella il testo d'aiuto @help_window.set_text("") @dummy_window.visible = true return end end #-------------------------------------------------------------------------- # - Aggiornamento Frame (Quando è attiva la finestra delle armi) #-------------------------------------------------------------------------- def update_KeyItem # Quando B è premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Torna al menu @command_window.index = @command_window.index @command_window.active = true @command_window.visible = true @keyItem_window.active = false @keyItem_window.visible = false @keyItem_window.index = -1 @dummy_window.visible = true # Cancella il testo d'aiuto @help_window.set_text("") return end end #-------------------------------------------------------------------------- # - Aggiornamento Frame (Quando è attiva la finestra dell'obiettivo) #-------------------------------------------------------------------------- def update_target # Quando B è Premuto if Input.trigger?(Input::B) # Suona SE Annulla $game_system.se_play($data_system.cancel_se) # Quando l'oggetto non può essere usato unless $game_party.item_can_use?(@item.id) # Aggiornamento finestra degli oggetti @item_window.refresh end # Eliminazione finestra dell'obiettivo @item_window.active = true @target_window.active = false @target_window.index = -1 return end # Quando c è premuto if Input.trigger?(Input::C) # Quando un oggetto è finito if $game_party.item_number(@item.id) == 0 # Suona SE Azione Impossibile $game_system.se_play($data_system.buzzer_se) return end # Quando l'obiettivo sono tutti gli eroi if @target_window.index == -1 # L'effetto dell'oggetto colpisce tutti gli eroi used = false for i in $game_party.actors used |= i.item_effect(@item) end end # Quando l'obiettivo è un eroe if @target_window.index >= 0 # L'effetto dell'oggetto colpisce l'eroe selezionato target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # Quando l'oggetto viene usato if used # Suona SE dell'oggetto $game_system.se_play(@item.menu_se) # Se l'oggetto si consuma if @item.consumable # Elimina un oggetto $game_party.lose_item(@item.id, 1) # Aggiorna la finestra degli oggetti @item_window.draw_item(@item_window.index) end # Aggiorna la finestra dell'obiettivo @target_window.refresh # Se gli eroi muoiono if $game_party.all_dead? # Vai al gameover $scene = Scene_Gameover.new return end # Se c'è un evento comune if @item.common_event_id > 0 # Chiama l'evento comune $game_temp.common_event_id = @item.common_event_id # Torna alla mappa $scene = Scene_Map.new return end end # Se l'oggetto non è stato usato unless used # Suona SE Azione Impossibile $game_system.se_play($data_system.buzzer_se) end return end end endGrazieee!!! biggrin.gif
Edited by Peco92I progetto:///II progetto:
Blades of The Spirits///The secret of fairy world
completamento 1%///completamento 10%
http://www.ff-fan.com/chartest/banners/vincent.jpg
Link to comment
Share on other sites
14 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now