TheoAllen

Theo - Non-RPG Actor Biography

Jul 14th, 2013
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.29 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Non-RPG Actor Biography
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_NonRPGBioGraphy] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2013.07.14 - Finished script
  12. # =============================================================================
  13. =begin
  14.  
  15.   Perkenalan :
  16.   Script ini merubah menu status untuk game yang bertema non-RPG (no level,
  17.   no exp, no stats)
  18.  
  19.   Cara penggunaan :
  20.   Pasang script ini dibawah material namun diatas main
  21.  
  22.   Actor biography dibagi menjadi 2. Yaitu biografi atas, dan bawah.
  23.   Untuk penggunaan tag biografi, gunakan pada note actor kek gini
  24.  
  25.   Biografi atas (maksimal 4 baris)
  26.   <bio1>
  27.   fullname : Eric Hakon
  28.   info lain : Tambahin sendiri
  29.   </bio1>
  30.  
  31.   Biografi bawah (maksimal 6 baris)
  32.   <bio2>
  33.   Biografi :
  34.   Line 1 disini
  35.   Line 2 disini
  36.   Line 3 disini
  37.   Fave Quote :
  38.   United we stand
  39.   </bio2>
  40.  
  41.   Kamu bebas nambahin info apa aja yang ada disana. Jika text dipisah dengan
  42.   titik dua (:) maka kata sebelumnya akan ditulis dengan warna biru / system
  43.  
  44.   Terms of use :
  45.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  46.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  47.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  48.  
  49. =end
  50. # =============================================================================
  51. # Tidak ada konfigurasi
  52. # =============================================================================
  53. class << DataManager
  54.  
  55.   alias pre_load_bio_db load_database
  56.   def load_database
  57.     pre_load_bio_db
  58.     load_actor_biography
  59.   end
  60.  
  61.   def load_actor_biography
  62.     $data_actors.compact.each do |actor|
  63.       actor.load_biography
  64.     end
  65.   end
  66.  
  67. end
  68.  
  69. class RPG::Actor < RPG::BaseItem
  70.   attr_accessor :bio1
  71.   attr_accessor :bio2
  72.  
  73.   BIO1_REG_ON   = /<(?:BIO1|bio1)>/i
  74.   BIO1_REG_OFF  = /<\/(?:BIO1|bio1)>/i
  75.   BIO2_REG_ON   = /<(?:BIO2|bio2)>/i
  76.   BIO2_REG_OFF  = /<\/(?:BIO2|bio2)>/i
  77.  
  78.   def load_biography
  79.     @bio1 = []
  80.     @bio2 = []
  81.     read_bio1 = false
  82.     read_bio2 = false
  83.     self.note.split(/[\r\n]+/).each do |line|
  84.       case line
  85.       when BIO1_REG_ON
  86.         read_bio1 = true
  87.       when BIO2_REG_ON
  88.         read_bio2 = true
  89.       when BIO1_REG_OFF
  90.         read_bio1 = false
  91.       when BIO2_REG_OFF
  92.         read_bio2 = false
  93.       else
  94.         @bio1.push(line) if read_bio1
  95.         @bio2.push(line) if read_bio2
  96.       end
  97.     end
  98.   end
  99.  
  100. end
  101.  
  102. class Game_Actor < Game_Battler
  103.  
  104.   def bio1
  105.     $data_actors[id].bio1
  106.   end
  107.  
  108.   def bio2
  109.     $data_actors[id].bio2
  110.   end
  111.  
  112. end
  113.  
  114. class Window_Status < Window_Selectable
  115.   BIO_REGEXP = /(.*):(.*)/i
  116.  
  117.   def draw_block2(y)
  118.     draw_actor_face(@actor, 8, y)
  119.     draw_basic_info(136, y)
  120.   end
  121.  
  122.   def draw_block3(y)
  123.     draw_bio2(20, y)
  124.   end
  125.  
  126.   def draw_basic_info(x,y)
  127.     ypos = y
  128.     @actor.bio1.each do |bio|
  129.       case bio
  130.       when BIO_REGEXP
  131.         text = bio.split(/:/)
  132.         size = text_size(text[0]).width
  133.         change_color(system_color)
  134.         draw_text(x,ypos,contents.width,line_height,text[0]+":")
  135.         change_color(normal_color)
  136.         draw_text(x+size,ypos,contents.width,line_height,text[1])
  137.       else
  138.         change_color(normal_color)
  139.         draw_text(x,ypos,contents.width,line_height,bio)
  140.       end
  141.       ypos += line_height
  142.     end
  143.   end
  144.  
  145.   def draw_bio2(x,y)
  146.     ypos = y
  147.     @actor.bio2.each do |bio|
  148.       case bio
  149.       when BIO_REGEXP
  150.         text = bio.split(/:/)
  151.         size = text_size(text[0]).width
  152.         change_color(system_color)
  153.         draw_text(x,ypos,contents.width,line_height,text[0]+":")
  154.         change_color(normal_color)
  155.         draw_text(x+size,ypos,contents.width,line_height,text[1])
  156.       else
  157.         change_color(normal_color)
  158.         draw_text(x,ypos,contents.width,line_height,bio)
  159.       end
  160.       ypos += line_height
  161.     end
  162.   end
  163.  
  164. end
Advertisement
Add Comment
Please, Sign In to add comment