#==============================================================================
#
# ▼ Yanfly Engine Ace - Dynamic Victory Aftermath (Addon)
# -- Level: Normal, Hard
# -- Requires: YEA - Victory Aftermath
#
#------------------------------------------------------------------------------
#
# Edited by : TheoAllen
# Version : 1.0
# Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
# (English Documentation)
#
#==============================================================================
$imported = {} if $imported.nil?
if $imported["YEA-VictoryAftermath"]
$imported[:Theo_DynamicYEA_VA] = true
#==============================================================================
=begin
Introduction :
It is an addon to Yanfly Victory Aftermath. So you could change the actor's
quote dynamically. Such as changing faceset or some quotes that only appears
on a certain condition.
How to use :
Put this script below Yanfly Victory Aftermath
These are notetag you could use
<win: Constant>
<level: Constant>
<drops: Constant>
Constant is a constanta name you define below this editable area. The
explanation is written down below
=end
#=============================================================================
# Editable region
#=============================================================================
module TLZ # <-- Do not touch at all cost!
# --------------------------------------------------------------------------
# Time wait in frame before victory aftermath is displayed. I'm doing this
# is for displaying victory pose sequence for my battle system
# --------------------------------------------------------------------------
Wait = 160
# ==========================================================================
# Here the explanations of making new quotes
# Format :
# --------------------------------------------------------------------------
# Quote = [
# ["face_name", face_index, "text","condition"],
# ]
#
# Explanation :
# Quote >> Constanta name you call it in notetag. The first letter have to
# be capitalized. For example, you add the Ralph_Win, then the
# notetag parameter would be <win: Ralph_Win>
# face_name >> Faceset name that will be used. Just leave it empty if you
# want to use the currently used actor faceset
# face_index >> Faceset index. From the top-left corner till bottom right
# corner is around 0 - 7
# text >> Texts which will be displayed in victory aftermath. Add \n if
# you want to separate the line
# condition >> Script eval condition. If you want to display the quote
# despite in any conditions, just write "true"
# ==========================================================================
# --------------------------------------------------------------------------
# Please note that these sample quotes are based from my game. So make your
# own then
# --------------------------------------------------------------------------
Ren_Quotes = [
["Ren_ex",7,"Cóż, to było do przewidzenia","true"],
["Ren_ex",7,"Nie było z wami najmniejszego problemu.","true"],
["Ren_ex",0,"Pomyślicie wpierw następnym razem...\nNo, może jednak nie!","true"],
["",5,"Uh...Może chroń mnie następnym razem.","hp_rate <= 0.25"],
["",0,"Niczym się nie różnicie od nieruchomego celu.","true"],
["",0,"Wystarczy jeden strzał i po kłopocie.","true"],
]
# --------------------------------------------------------------------------
Ren_Level = [
["Ren_ex",7,"Teraz nie będziecie dla mnie problemem.","true"],
]
# --------------------------------------------------------------------------
Ren_Drops = [
["Ren_ex",7,"Nic nadzwyczajnego.","true"],
["",6,"Czasem trzeba się cieszyć z tego co się ma.",
"$game_temp.drops.size == 0"],
["Ren_ex",2,"Ugh...szlam!",
"$game_temp.drops.include?($data_items[44])"],
["Ren_ex",7,"Podziękujecie mi za łupy potem.",
"$game_temp.drops.size > 2"],
]
# --------------------------------------------------------------------------
Leya_Quotes = [
["Leya_ex",1,"Proszę was, już jako (były) adept \nwas przewyższam.","hp_rate > 0.5"],
["Leya_ex",3,"Widzieliście moją cudowną magię?","true"],
["",5,"Warto byłoby się czasem skupić bardziej \nna obronie niż ataku",
"hp_rate <= 0.25"],
["",3,"Widzicie, dobrze że z wami byłam.","true"],
]
Leya_Level = [
["",7,"Doświadczenie to najlepszy nauczyciel.","true"],
]
Leya_Drops = [
["Leya_ex",3,"Z pewnością można to dobrze sprzedać.",
"$game_temp.drops.size >= 1"],
["Leya_ex",4,"Mikstura zawsze się przyda.",
"$game_temp.drops.include?($data_items[1])"],
["",7,"Najwyraźniej nic ciekawego nie ma... \nco za strata.",
"$game_temp.drops.empty?"],
]
# --------------------------------------------------------------------------
Hitori_Quotes = [
["Hitori_ex",3,"Cóż, nie było tak ciężko, czyż nie?","true"],
["Hitori_ex",3,"Główny aktor schodzi ze sceny.","true"],
["",3,"Ruszajmy dalej lepiej.","$game_troop.turn_count <= 2"],
["",3,"Bywałam w takiej walce",
"true"],
["",0,"Już zgłodniałem po tej walce!","hp_rate <= 0.5"],
["",0,"Tylko na tyle was stać?!","hp_rate > 0.5"],
["",3,"Całkiem, całkiem.","true"],
]
Hitori_Level = [
["",0,"Pokaże wam teraz co potrafię!.","true"],
]
Hitori_Drops = [
["",0,"Poprzedniemu właścicielowi nie bedzie to \njuż potrzebne.",
"$game_temp.drops.size != 0"],
["Hitori_ex",3,"Możecie mi podziękować później.",
"$game_temp.drops.size != 0"],
["Hitori_ex",6,"Cóż, obejdzie się bez tego.",
"$game_temp.drops.empty?"],
["Hitori_ex",4,"Każda zdobycz ma zawsze jakąś wartość.",
"$game_temp.drops.size == 1"],
]
# --------------------------------------------------------------------------
# Regular expression to read notetags. Do not touch if you don't have any
# idea about it.
# --------------------------------------------------------------------------
WinQuoteREGX = /<win\s*:\s*(.+)>/i
LevelQuoteREGX = /<level\s*:\s*(.+)>/i
DropsQuoteREGX = /<drops\s*:\s*(.+)>/i
# --------------------------------------------------------------------------
end
# ============================================================================
# End of editable region. Editing below this point is your own risk.
# ============================================================================
class RPG::Actor
attr_accessor :tlz_win
attr_accessor :tlz_level
attr_accessor :tlz_drops
def load_actor_quotes
note.split(/[\r\n]+/).each do |line|
case line
when TLZ::WinQuoteREGX
@tlz_win = $1.to_s
when TLZ::LevelQuoteREGX
@tlz_level = $1.to_s
when TLZ::DropsQuoteREGX
@tlz_drops = $1.to_s
end
end
end
end
class << DataManager
alias yea_va_tlz_load_db load_database
def load_database
yea_va_tlz_load_db
load_tlz_va_quotes
end
def load_tlz_va_quotes
$data_actors.compact.each do |actor|
actor.load_actor_quotes
end
end
end
class Game_Temp
attr_accessor :drops
alias yea_va_tlz_init initialize
def initialize
yea_va_tlz_init
@drops = []
end
end
class Game_Actor < Game_Battler
def tlz_win_quotes
ary = eval("TLZ::#{actor.tlz_win}").select do |quote|
eval(quote[3])
end
return ary[rand(ary.size)]
end
def tlz_level_quotes
ary = eval("TLZ::#{actor.tlz_level}").select do |quote|
eval(quote[3])
end
return ary[rand(ary.size)]
end
def tlz_drops_quotes
ary = eval("TLZ::#{actor.tlz_drops}").select do |quote|
eval(quote[3])
end
return ary[rand(ary.size)]
end
def win_type_defined?(type)
case type
when :win
return !actor.tlz_win.nil?
when :level
return !actor.tlz_level.nil?
when :drops
return !actor.tlz_drops.nil?
end
end
def tlz_victory_quotes(type)
case type
when :win
return tlz_win_quotes
when :level
return tlz_level_quotes
when :drops
return tlz_drops_quotes
end
end
end
class << BattleManager
alias yea_va_tlz_set_victory_text set_victory_text
def set_victory_text(actor, type)
return yea_va_tlz_set_victory_text(actor, type) unless
actor.win_type_defined?(type)
return tlz_va_text(actor, type)
end
def tlz_va_text(actor, type)
array = actor.tlz_victory_quotes(type)
text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
text += array[2]
text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
$game_message.face_name = (array[0].empty? ? actor.face_name : array[0])
$game_message.face_index = array[1]
$game_message.add(text)
wait_for_message
end
alias tlz_display_exp display_exp
def display_exp
SceneManager.scene.va_wait(TLZ::Wait)
tlz_display_exp
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_drop_items
#--------------------------------------------------------------------------
def gain_drop_items
drops = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
drops.push(item)
end
$game_temp.drops = drops
SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
set_victory_text(@victory_actor, :drops)
wait_for_message
end
end
class Scene_Battle
def va_wait(dur)
dur.times do
if Input.trigger?(:C)
Input.update
break
end
update_basic
end
end
end
end