#=========================================================================
#=========================================================================
# Tornado Quest Book porting VX Ace del Porting VX (NON UFFICIALE)
# Versione 1.0
# Autore: Storm
# Tradotto da: Superspammer
# http://rpgxpultimate.darkbb.com
#
# NON USARE LO SCRIPT! FUNZIONAMENTO NON GARANTITO!!!!!!!!
#
# Istruzioni per l'uso:
# Incollare lo script sopra Main e sotto Materials.
#
# Usare SceneManager.call(Scene_QuestBook) per chiamare il libro.
#
# Usare $game_party.add_quest(id) per aggiungere una missione.
#
# Usare $game_party.delete_quest(id) per eliminare una missione.
#
# Usare $game_party.finish_quest(id) per finire una missione.
#
# Use $game_party.unfinish_quest(id) per impostare una missione come non-finita.
#
# Nel condition branch (ramo condizioni), inserire questo script: $game_party.quest_complete?(id)
# per controllare se la missione è stata completata.
#
# Opzioni:
# Possibilità di cambiare il nome del quest book.
# Opacità configurabile.
# Colori missioni complete personalizzabile.
# Colori missioni incomplete personalizzabile.
# Auto-rimpiazzamento testo.
# 10 Rimpiazzamenti configurabili.
#
# Compatibilità:
# La maggior parte degli script. Sovrascrivendo il metodo draw_item di
# Window_Command è meglio metterlo sopra altri script che agiscono
# sullo stesso metodo, sperando che non lo sovrascrivano anch'essi
#
# Crediti E Ringraziamenti:
# Storm - Per averlo creato.
# Game_Guy - Per avermi insegnato come usare le Array.
# Superspammer - Per averlo tradotto.
# giver - Per la conversione al VX. (Fatta su "richiesta" di Ichika Strize)
# Ichika Strize - Per il Testing e gli Screen della versione VX.
#===========================================================================
#===========================================================================
module TNDqb
#=========================================================================
# START CONFIG
#=========================================================================
#============================== General Config ===========================
# General Config.
#=========================================================================
QB_Name = "Libro Missioni" # Nome del quest Book
Author_Name = "Autore" # Nome Autore
Title_Name = "Titolo" # Nome del Titolo
Reward_Name = "Ricompensa" # Nome della ricompensa
Status_Name = "Status" # Status
Complete = "Completata" # Nome delle missioni complete
Incomplete = "Non completata." # Nome delle missioni incomplete.
Unknown = "???" # Nome sconosciuto
Opacity = 200 # Opacità della finestra (200 è quella base del VX)
Screen = 1 # (0 = nero, 1 = screenshot mappa, "nome immagine tra virgolette" = picture)
Cmp_Color = Color.new(0, 255, 0, 255) # Colore missioni Complete
Incmp_Color = Color.new(255, 0, 0, 255) # Colore missioni Incomplete
Return = -1
# Imposta la Scena di Ritorno quando si esce dal QuestBook premendo ESC
# se messa a -1 torna alla Mappa, altrimenti torna al Menù con l'indice
# indicato selezionato nella lista dei comandi (il primo vale 0, il
# secondo 1, il terzo 2, e così via . . . Di base dovrebbe essere la
# posizione del comando del menù per aprire il QuestBook (es. 3 se è il
# quarto comando della lista)
#================================ Ignore Part ============================
# Ignorare la sezione qui sotto.
#=========================================================================
Quest = []
#============================ Replacement Config =========================
# Rimpiazzamenti, questi sono i testi che verranno auto ripiazzati.
#
# Replace = ["segnaposto testo","testo sostitutivo"]
# NOTA BENE: Il massimo dei rimpiazzamenti è 10. I Rimpiazzamenti non possono essere aggiunti o eliminati.
# Cannot include {nome0}, {nome1}, {nome2}, ..., {nomeN} (vedi sotto)
# Si consiglia di includere i segnaposto tra parentesi graffe
#
# Completed Replacements: (Do not add)
# {nomeNNN} = Nome dell'attore che si trova nella posizione NNN del party
# es. per far apparire il nome del primo personaggio nel party bisogna
# inserire il segnaposto {nome0}
#=========================================================================
Replace1 = ["{s}","Ciao!"]
Replace2 = ["",""]
Replace3 = ["",""]
Replace4 = ["",""]
Replace5 = ["",""]
Replace6 = ["",""]
Replace7 = ["",""]
Replace8 = ["",""]
Replace9 = ["",""]
Replace10 = ["",""]
#=============================== Configurazione Missioni =================
# Configura le missioni qui.
#
# Quest[id] = ["Titolo","Nome dell'autore","testo","ricompensa"]
#=========================================================================
#PART 1
Quest[0] = ["Saluti e Baci","Tizio","Tizio vuole che il party vada al suo paese e dire alla mamma {s}", "Cesta di Mele"]
Quest[1] = ["Completa Il Mini-Quest","Computer Di Ben","Dai Alla Signora Robot ciò che vuole","Nulla"]
Quest[2] = ["Esplora la montagna","Tom","Tom ha chiesto a {nome0} di esplorare la montagna.","Qualcosa"]
Quest[3] = ["Ammazza Ratti","Contadino","George, il contadino, vuole che venga liberato il proprio granaio dai ratti che lo infestano","Un Vecchio Libro"]
#=========================================================================
# END CONFIG
#=========================================================================
end
#====================
# Game_Party
#====================
class Game_Party < Game_Unit
attr_accessor :quest
attr_accessor :qComplete
alias tnd_qb_init initialize unless $@
def initialize
set_questbook
tnd_qb_init
end
def set_questbook
@quest = []
@qComplete = []
end
def add_quest(id)
msg = TNDqb::Quest[id]
return if msg == nil
unless @quest.include?(id)
@qComplete.delete(id)
@quest.push(id)
end
end
def delete_quest(id)
msg = TNDqb::Quest[id]
return if msg == nil
if @quest.include?(id)
@qComplete.delete(id)
@quest.delete(id)
end
end
def finish_quest(id)
msg = TNDqb::Quest[id]
return if msg == nil
if @quest.include?(id)
@qComplete.push(id) unless @qComplete.include?(id)
end
end
def unfinish_quest(id)
msg = TNDqb::Quest[id]
return if msg == nil
if @qComplete.include?(id)
@quest.push(id) unless @quest.include?(id)
@qComplete.delete(id)
end
end
def quest_complete?(id)
return false if id == nil
msg = TNDqb::Quest[id]
return false if msg == nil
return @qComplete.include?(id)
end
end
#====================
# Bitmap
#====================
class Bitmap
def format_text(text, width)
words = text.split(' ')
return words if words.size == 1
result, current_text = [], words.shift
words.each_index {|i|
if self.text_size("#{current_text} #{words[i]}").width > width
result.push(current_text)
current_text = words[i]
else
current_text = "#{current_text} #{words[i]}"
end
result.push(current_text) if i >= words.size - 1}
return result
end
end
#====================
# Window_QuestTitle
#====================
class Window_QuestTitle < Window_Base
def initialize
super(0, -8, 544, 56)
self.back_opacity = TNDqb::Opacity
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 22
cx = contents.text_size(TNDqb::QB_Name).width
self.contents.draw_text(0, 0, cx, 24, TNDqb::QB_Name)
end
end
#====================
# Window_QuestMain
#====================
class Window_QuestMain < Window_Base
def initialize
super(24, 76, 336, 268)
self.back_opacity = TNDqb::Opacity
refresh
end
def refresh
return if @quest_id == nil
msg = TNDqb::Quest[@quest_id]
return if msg == nil
self.contents.clear
self.contents.font.size = Font.default_size - 2
t = self.contents.text_size(TNDqb::Title_Name+": ").width
t2 = self.contents.text_size(TNDqb::Author_Name+": ").width
t3 = self.contents.text_size(TNDqb::Reward_Name+": ").width
t4 = self.contents.text_size(TNDqb::Status_Name+": ").width
tw = self.width - 32
self.contents.font.color = system_color
self.contents.draw_text(0, 0, tw, 24, TNDqb::Title_Name+": ")
self.contents.draw_text(0, 24, tw, 24, TNDqb::Author_Name+": ")
self.contents.draw_text(0, 186, tw, 24, TNDqb::Reward_Name+": ")
self.contents.draw_text(0, 210, tw, 24, TNDqb::Status_Name+": ")
self.contents.font.color = normal_color
self.contents.draw_text(t, 0, tw, 24, msg[0])
self.contents.draw_text(t2, 24, tw, 24, msg[1])
@text = msg[2]
@text = @text.gsub(TNDqb::Replace1[0], TNDqb::Replace1[1])
@text = @text.gsub(TNDqb::Replace2[0], TNDqb::Replace2[1])
@text = @text.gsub(TNDqb::Replace3[0], TNDqb::Replace3[1])
@text = @text.gsub(TNDqb::Replace4[0], TNDqb::Replace4[1])
@text = @text.gsub(TNDqb::Replace5[0], TNDqb::Replace5[1])
@text = @text.gsub(TNDqb::Replace6[0], TNDqb::Replace6[1])
@text = @text.gsub(TNDqb::Replace7[0], TNDqb::Replace7[1])
@text = @text.gsub(TNDqb::Replace8[0], TNDqb::Replace8[1])
@text = @text.gsub(TNDqb::Replace9[0], TNDqb::Replace9[1])
@text = @text.gsub(TNDqb::Replace10[0], TNDqb::Replace10[1])
for i in 0...$game_party.members.size
actor = $game_party.members[i]
@text = @text.gsub("{nome"+i.to_s+"}", actor.name)
end
draw_msg(@text, 0, 48)
if $game_party.quest_complete?(@quest_id)
self.contents.draw_text(t3, 186, tw, 24, msg[3])
self.contents.font.color = TNDqb::Cmp_Color
self.contents.draw_text(t4, 210, tw, 24, TNDqb::Complete)
else
self.contents.draw_text(t3, 186, tw, 24, TNDqb::Unknown)
self.contents.font.color = TNDqb::Incmp_Color
self.contents.draw_text(t4, 210, tw, 24, TNDqb::Incomplete)
end
end
def draw_msg(msg, x, y)
text = self.contents.format_text(msg, 304)
text.each_index {|i|self.contents.draw_text(x, y + i*24, 304, 24, text[i])}
end
def set_quest(id)
return if @quest_id == id
@quest_id = id
refresh
end
end
#====================
# Window_QuestCommand
#====================
class Window_QuestCommand < Window_Command
def initialize(window_width, msg)
@window_width = window_width
@msg = msg
super(0, 0)
end
def window_width
@window_width
end
def make_command_list
for msg in @msg
add_command(msg, :selected)
end
end
def draw_item(index, enabled = true, color = normal_color)
change_color(color, enabled)
draw_text(item_rect_for_text(index), command_name(index), alignment)
end
end
#====================
# Scene_QuestBook
#====================
class Scene_QuestBook < Scene_Base
def main
if TNDqb::Screen.is_a?(Integer)
create_background if TNDqb::Screen == 1
elsif (TNDqb::Screen).is_a?(String)
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.picture(TNDqb::Screen)
end
#Command window setup
@quest = $game_party.quest
create_command_window
#Make main windows
@title = Window_QuestTitle.new
@main = Window_QuestMain.new
Graphics.transition
loop do
Graphics.update
Input.update
#Update windows and inputs
inputUpdate
update
#Break if scene is not Scene_QuestBook
unless SceneManager.scene_is?(Scene_QuestBook)
break
end
end
Graphics.freeze
#Dispose windows
dispose_background unless (TNDqb::Screen.is_a?(Integer) and TNDqb::Screen == 0)
@command_window.dispose
@title.dispose
@main.dispose
end
def create_command_window
@msg = []
@quest.each {|i|
@msg.push(TNDqb::Quest[i][0])
}
@msg = [""] if @msg.size < 1
#Create command window
@command_window = Window_QuestCommand.new(160, @msg)
@command_window.x = 384
@command_window.back_opacity = TNDqb::Opacity
@command_window.height = 360
@command_window.y = 52
j = 0
@quest.each{|i|
if $game_party.quest_complete?(i)
@command_window.draw_item(j, true, TNDqb::Cmp_Color)
end
j += 1}
end
def inputUpdate
if Input.trigger?(Input::B)
#Play Cancel SE
Sound.play_cancel
#Return to set scene
if TNDqb::Return > -1
SceneManager.call(Scene_Menu)
else
SceneManager.call(Scene_Map)
end
elsif Input.trigger?(Input::C)
#Play Decision SE
Sound.play_ok
#Refresh quest data
@main.set_quest(@quest[@command_window.index])
#Goto command_refresh
end
end
def update
#Updates
@command_window.update
@title.update
@main.update
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
def dispose_background
if @background_sprite != nil
@background_sprite.bitmap = nil
@background_sprite = nil
elsif @menuback_sprite!= nil
@menuback_sprite.bitmap = nil
@menuback_sprite = nil
end
end
end
#====================
# Scene_Menu
#====================
class Scene_Menu < Scene_MenuBase
alias qs_create_command_window create_command_window
def create_command_window
qs_create_command_window
@command_window.set_handler(:quest, method(:command_quest))
end
def command_quest
SceneManager.call(Scene_QuestBook)
end
end
#====================
# Window_MenuCommand
#====================
class Window_MenuCommand < Window_Command
def make_command_list
add_main_commands
add_formation_command
add_original_commands
add_quest_command
add_save_command
add_game_end_command
end
def add_quest_command
add_command("Quest", :quest)
end
end