Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- #
- # ▼ 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
- # (This script documentation is written in informal indonesian language)
- #
- #==============================================================================
- $imported = {} if $imported.nil?
- if $imported["YEA-VictoryAftermath"]
- $imported[:Theo_DynamicYEA_VA] = true
- #==============================================================================
- =begin
- Perkenalan :
- Script ini adalah addon untuk yanfly victory aftermath. Dimana kamu bisa
- mengganti quote actor secara dinamis. Seperti mengganti face atau beberapa
- kutipan hanya bisa muncul di saat-saat tertentu.
- Cara penggunaan :
- Berikut adalah notetag yang bisa digunain.
- <win: constant>
- <level: constant>
- <drops: constant>
- contants adalah nama konstanta yang kamu definisikan dibawah. Keterangannya
- silahkan dibaca sendiri dibawah sana
- =end
- #=============================================================================
- # Editable region
- #=============================================================================
- module TLZ # <-- jangan disentuh
- # --------------------------------------------------------------------------
- # Waktu untuk nunggu berapa frame sebelum window victory aftermath
- # dimunculkan
- # --------------------------------------------------------------------------
- Wait = 160
- # ==========================================================================
- # Setelah keterangan ini, adalah tempat kamu ngebikin custom quote buat
- # karakter-karaktermu entar. Dan inget, settingannya rada ribet.
- # Format penulisan :
- # --------------------------------------------------------------------------
- # Quote = [
- # ["face_name", face_index, "text","kondisi"],
- # ]
- #
- # Keterangan :
- # Quote >> Nama konstanta yang akan kamu berikan pada notetag. Harus diawali
- # dengan huruf besar. Semisal kamu menulisnya adalah Ralph_Win,
- # nanti dalam notetag, kamu harus menuliskannya <win: Ralph_Win>
- # face_name >> Nama faceset yang akan digunakan. Kosongkan jika kamu mau
- # make faceset yang sekarang sedang dipake actor kamu.
- # face_index >> Index faceset. Dari pojok kiri atas sampai kanan bawah
- # adalah 0 - 7
- # text >> Texts yang akan jadi tulisan dalam victory aftermath
- # kondisi >> Kondisi yang akan dievaluasi secara script. Tulis "true" jika
- # kamu ingin texts kamu selalu muncul di berbagai kondisi apapun
- # ==========================================================================
- # --------------------------------------------------------------------------
- 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 buat baca notetag. Kalo ga ngerti ga usah diedit-edit
- # --------------------------------------------------------------------------
- WinQuoteREGX = /<win\s*:\s*(.+)>/i
- LevelQuoteREGX = /<level\s*:\s*(.+)>/i
- DropsQuoteREGX = /<drops\s*:\s*(.+)>/i
- # --------------------------------------------------------------------------
- end
- # ============================================================================
- # End of editable region
- # ============================================================================
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement