Advertisement
richter_h

expect this

Apr 30th, 2014
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.42 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Dynamic Victory Aftermath (Addon)
  4. # -- Level: Normal, Hard
  5. # -- Requires: YEA - Victory Aftermath
  6. #
  7. #------------------------------------------------------------------------------
  8. #
  9. # Edited by : TheoAllen
  10. # Version : 1.0
  11. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  12. # (This script documentation is written in informal indonesian language)
  13. #
  14. #==============================================================================
  15. $imported = {} if $imported.nil?
  16. if $imported["YEA-VictoryAftermath"]
  17. $imported[:Theo_DynamicYEA_VA] = true
  18. #==============================================================================
  19. =begin
  20.  
  21.   Perkenalan :
  22.   Script ini adalah addon untuk yanfly victory aftermath. Dimana kamu bisa
  23.   mengganti quote actor secara dinamis. Seperti mengganti face atau beberapa
  24.   kutipan hanya bisa muncul di saat-saat tertentu.
  25.  
  26.   Cara penggunaan :
  27.   Berikut adalah notetag yang bisa digunain.
  28.  
  29.   <win: constant>
  30.   <level: constant>
  31.   <drops: constant>
  32.  
  33.   contants adalah nama konstanta yang kamu definisikan dibawah. Keterangannya
  34.   silahkan dibaca sendiri dibawah sana
  35.  
  36. =end
  37. #=============================================================================
  38. # Editable region
  39. #=============================================================================
  40. module TLZ # <-- jangan disentuh
  41.  
  42.   # --------------------------------------------------------------------------
  43.   # Waktu untuk nunggu berapa frame sebelum window victory aftermath
  44.   # dimunculkan
  45.   # --------------------------------------------------------------------------
  46.   Wait = 160
  47.  
  48.   # ==========================================================================
  49.   # Setelah keterangan ini, adalah tempat kamu ngebikin custom quote buat
  50.   # karakter-karaktermu entar. Dan inget, settingannya rada ribet.
  51.   # Format penulisan :
  52.   # --------------------------------------------------------------------------
  53.   # Quote = [
  54.   # ["face_name", face_index, "text","kondisi"],
  55.   # ]
  56.   #
  57.   # Keterangan :
  58.   # Quote >> Nama konstanta yang akan kamu berikan pada notetag. Harus diawali
  59.   #          dengan huruf besar. Semisal kamu menulisnya adalah Ralph_Win,
  60.   #          nanti dalam notetag, kamu harus menuliskannya <win: Ralph_Win>
  61.   # face_name >> Nama faceset yang akan digunakan. Kosongkan jika kamu mau
  62.   #              make faceset yang sekarang sedang dipake actor kamu.
  63.   # face_index >> Index faceset. Dari pojok kiri atas sampai kanan bawah
  64.   #               adalah 0 - 7
  65.   # text >> Texts yang akan jadi tulisan dalam victory aftermath
  66.   # kondisi >> Kondisi yang akan dievaluasi secara script. Tulis "true" jika
  67.   #            kamu ingin texts kamu selalu muncul di berbagai kondisi apapun
  68.   # ==========================================================================
  69.  
  70.   # --------------------------------------------------------------------------
  71.  
  72.   Stella_Quotes = [
  73.   ["Actor28_ex",3,"Haha... Sorry...","true"],
  74.   ["Actor28_ex",3,"Did you see that? Did you see that I shot" +
  75.     "\nthree bullets in single shot?","true"],
  76.   ["Actor28_ex",3,"Ha. Bull's eye!","true"],
  77.   ["",4,"Fuuhh.... That was so close...","hp_rate <= 0.5"],
  78.   ["",7,"Darn. That one almost messed my hair...","true"],
  79.   ["",1,"Did you hear me? I told you, \nheads down!","true"],
  80.   ["",7,"So, do you dare to challenge a \nmarksman like me again?", "true"],
  81.   ]
  82.  
  83.   # --------------------------------------------------------------------------
  84.  
  85.   Stella_Level = [
  86.   ["Actor28_ex",3,"I got better aim, better shot...","true"],
  87.   ]
  88.  
  89.   # --------------------------------------------------------------------------
  90.  
  91.   Stella_Drops = [
  92.   ["",1,"That's MINE!!","true"],
  93.   ["Actor28_ex",3,"Hey! That's golds!","true"],
  94.   ["Actor28_ex",3,"Wah... Health Potion!",
  95.     "$game_temp.drops.include?($data_items[1])"],
  96.   ["Actor28_ex",2,"Wow! We got a bunch of these!",
  97.     "$game_temp.drops.size > 2"],
  98.   ]
  99.  
  100.   # --------------------------------------------------------------------------
  101.  
  102.   Lunar_Quotes = [
  103.   ["",0,"You're ten years too early to \nchallenge me.","hp_rate > 0.5"],
  104.   ["",7,"Was that magic... awesome?","true"],
  105.   ["",5,"Whoever created this place, he \nmust be nuts...",
  106.     "hp_rate <= 0.45"],
  107.   ["",3,"Good thing that I'm here...","true"],
  108.   ]
  109.  
  110.   Lunar_Level = [
  111.   ["",7,"Experience is the best mentor.","true"],
  112.   ]
  113.  
  114.   Lunar_Drops = [
  115.   ["",3,"Get them already, then...","true"],
  116.   ["",7,"Health Potion,\\. not bad",
  117.     "$game_temp.drops.include?($data_items[1])"],
  118.   ]
  119.  
  120.   # --------------------------------------------------------------------------
  121.  
  122.   Soleil_Quotes = [
  123.   ["Actor63_ex",0,"Haha. Not bad!","true"],
  124.   ["Actor63_ex",4,"Woi, Stella.\. Mind if you don't \naim it to my back again?","true"],
  125.   ["Actor63_ex",6,"Hah, is that all?","$game_troop.turn_count <= 2"],
  126.   ["Actor63_ex",3,"I've got used with dungeons like \nthis one.",
  127.     "true"],
  128.   ["",1,"C'mon, Lunar! Did you even heal me?","hp_rate <= 0.5"],
  129.   ["",1,"C'mon! Who's next?!","hp_rate > 0.5"],
  130.   ["",0,"Not bad....","true"],
  131.   ["",7,"Good game, well played....","true"],
  132.   ]
  133.  
  134.   Soleil_Level = [
  135.   ["",7,"The deeper this place, the more \ninteresting it is.","true"],
  136.   ]
  137.  
  138.   Soleil_Drops = [
  139.   ["",3,"Shut up! Let me take these.","true"],
  140.   ["",7,"Well, not bad...","true"],
  141.   ["",6,"Well\\..\\..\\.. nothing. Nothing.",
  142.     "$game_temp.drops.empty?"],
  143.   ["Actor63_ex",2,"You reap what you killed. Bleh!",
  144.     "$game_temp.drops.size >= 2"],
  145.   ]
  146.  
  147.   # --------------------------------------------------------------------------
  148.   # Regular expression buat baca notetag. Kalo ga ngerti ga usah diedit-edit
  149.   # --------------------------------------------------------------------------
  150.   WinQuoteREGX    = /<win\s*:\s*(.+)>/i
  151.   LevelQuoteREGX  = /<level\s*:\s*(.+)>/i
  152.   DropsQuoteREGX  = /<drops\s*:\s*(.+)>/i
  153.   # --------------------------------------------------------------------------
  154.  
  155. end
  156. # ============================================================================
  157. # End of editable region
  158. # ============================================================================
  159. class RPG::Actor
  160.   attr_accessor :tlz_win
  161.   attr_accessor :tlz_level
  162.   attr_accessor :tlz_drops
  163.  
  164.   def load_actor_quotes
  165.     note.split(/[\r\n]+/).each do |line|
  166.       case line
  167.       when TLZ::WinQuoteREGX
  168.         @tlz_win = $1.to_s
  169.       when TLZ::LevelQuoteREGX
  170.         @tlz_level = $1.to_s
  171.       when TLZ::DropsQuoteREGX
  172.         @tlz_drops = $1.to_s
  173.       end
  174.     end
  175.   end
  176.  
  177. end
  178.  
  179. class << DataManager
  180.  
  181.   alias yea_va_tlz_load_db load_database
  182.   def load_database
  183.     yea_va_tlz_load_db
  184.     load_tlz_va_quotes
  185.   end
  186.  
  187.   def load_tlz_va_quotes
  188.     $data_actors.compact.each do |actor|
  189.       actor.load_actor_quotes
  190.     end
  191.   end
  192.  
  193. end
  194.  
  195. class Game_Temp
  196.   attr_accessor :drops
  197.  
  198.   alias yea_va_tlz_init initialize
  199.   def initialize
  200.     yea_va_tlz_init
  201.     @drops = []
  202.   end
  203.  
  204. end
  205.  
  206. class Game_Actor < Game_Battler
  207.  
  208.   def tlz_win_quotes
  209.     ary = eval("TLZ::#{actor.tlz_win}").select do |quote|
  210.       eval(quote[3])
  211.     end
  212.     return ary[rand(ary.size)]
  213.   end
  214.  
  215.   def tlz_level_quotes
  216.     ary = eval("TLZ::#{actor.tlz_level}").select do |quote|
  217.       eval(quote[3])
  218.     end
  219.     return ary[rand(ary.size)]
  220.   end
  221.  
  222.   def tlz_drops_quotes
  223.     ary = eval("TLZ::#{actor.tlz_drops}").select do |quote|
  224.       eval(quote[3])
  225.     end
  226.     return ary[rand(ary.size)]
  227.   end
  228.  
  229.   def win_type_defined?(type)
  230.     case type
  231.     when :win
  232.       return !actor.tlz_win.nil?
  233.     when :level
  234.       return !actor.tlz_level.nil?
  235.     when :drops
  236.       return !actor.tlz_drops.nil?
  237.     end
  238.   end
  239.  
  240.   def tlz_victory_quotes(type)
  241.     case type
  242.     when :win
  243.       return tlz_win_quotes
  244.     when :level
  245.       return tlz_level_quotes
  246.     when :drops
  247.       return tlz_drops_quotes
  248.     end
  249.   end
  250.  
  251. end
  252.  
  253. class << BattleManager
  254.  
  255.   alias yea_va_tlz_set_victory_text set_victory_text
  256.   def set_victory_text(actor, type)
  257.     return yea_va_tlz_set_victory_text(actor, type) unless
  258.       actor.win_type_defined?(type)
  259.     return tlz_va_text(actor, type)
  260.   end
  261.  
  262.   def tlz_va_text(actor, type)
  263.     array = actor.tlz_victory_quotes(type)
  264.     text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
  265.     text += array[2]
  266.     text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
  267.     $game_message.face_name = (array[0].empty? ? actor.face_name : array[0])
  268.     $game_message.face_index = array[1]
  269.     $game_message.add(text)
  270.     wait_for_message
  271.   end
  272.  
  273.   alias tlz_display_exp display_exp
  274.   def display_exp
  275.     SceneManager.scene.va_wait(TLZ::Wait)
  276.     tlz_display_exp
  277.   end
  278.  
  279.   #--------------------------------------------------------------------------
  280.   # overwrite method: self.gain_drop_items
  281.   #--------------------------------------------------------------------------
  282.   def gain_drop_items
  283.     drops = []
  284.     $game_troop.make_drop_items.each do |item|
  285.       $game_party.gain_item(item, 1)
  286.       drops.push(item)
  287.     end
  288.     $game_temp.drops = drops
  289.     SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
  290.     set_victory_text(@victory_actor, :drops)
  291.     wait_for_message
  292.   end
  293.  
  294. end
  295.  
  296. class Scene_Battle
  297.  
  298.   def va_wait(dur)
  299.     dur.times do
  300.       if Input.trigger?(:C)
  301.         Input.update
  302.         break
  303.       end
  304.       update_basic
  305.     end
  306.   end
  307.  
  308. end
  309.  
  310. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement