#============================================================================== # # ▼ 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 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 # 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 # -------------------------------------------------------------------------- Stella_Quotes = [ ["Actor28_ex",3,"Haha... Sorry...","true"], ["Actor28_ex",3,"Did you see that? Did you see that I shot" + "\nthree bullets in single shot?","true"], ["Actor28_ex",3,"Ha. Bull's eye!","true"], ["",4,"Fuuhh.... That was so close...","hp_rate <= 0.5"], ["",7,"Darn. That one almost messed my hair...","true"], ["",1,"Did you hear me? I told you, \nheads down!","true"], ["",7,"So, do you dare to challenge a \nmarksman like me again?", "true"], ] # -------------------------------------------------------------------------- Stella_Level = [ ["Actor28_ex",3,"I got better aim, better shot...","true"], ] # -------------------------------------------------------------------------- Stella_Drops = [ ["",1,"That's MINE!!","true"], ["Actor28_ex",3,"Hey! That's golds!","true"], ["Actor28_ex",3,"Wah... Health Potion!", "$game_temp.drops.include?($data_items[1])"], ["Actor28_ex",2,"Wow! We got a bunch of these!", "$game_temp.drops.size > 2"], ] # -------------------------------------------------------------------------- Lunar_Quotes = [ ["",0,"You're ten years too early to \nchallenge me.","hp_rate > 0.5"], ["",7,"Was that magic... awesome?","true"], ["",5,"Whoever created this place, he \nmust be nuts...", "hp_rate <= 0.45"], ["",3,"Good thing that I'm here...","true"], ] Lunar_Level = [ ["",7,"Experience is the best mentor.","true"], ] Lunar_Drops = [ ["",3,"Get them already, then...","true"], ["",7,"Health Potion,\\. not bad", "$game_temp.drops.include?($data_items[1])"], ] # -------------------------------------------------------------------------- Soleil_Quotes = [ ["Actor63_ex",0,"Haha. Not bad!","true"], ["Actor63_ex",4,"Woi, Stella.\. Mind if you don't \naim it to my back again?","true"], ["Actor63_ex",6,"Hah, is that all?","$game_troop.turn_count <= 2"], ["Actor63_ex",3,"I've got used with dungeons like \nthis one.", "true"], ["",1,"C'mon, Lunar! Did you even heal me?","hp_rate <= 0.5"], ["",1,"C'mon! Who's next?!","hp_rate > 0.5"], ["",0,"Not bad....","true"], ["",7,"Good game, well played....","true"], ] Soleil_Level = [ ["",7,"The deeper this place, the more \ninteresting it is.","true"], ] Soleil_Drops = [ ["",3,"Shut up! Let me take these.","true"], ["",7,"Well, not bad...","true"], ["",6,"Well\\..\\..\\.. nothing. Nothing.", "$game_temp.drops.empty?"], ["Actor63_ex",2,"You reap what you killed. Bleh!", "$game_temp.drops.size >= 2"], ] # -------------------------------------------------------------------------- # Regular expression to read notetags. Do not touch if you don't have any # idea about it. # -------------------------------------------------------------------------- WinQuoteREGX = //i LevelQuoteREGX = //i DropsQuoteREGX = //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