Zetu

SAS Style v1.03

Jul 4th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.83 KB | None | 0 0
  1. #=========================================================================#
  2. # Scrolling Actor Sytle Menu (Requested by new)  v1.03                    #
  3. # * THIS ADD-ON REQUIRES the Script "Z-Systems Neo Menu System" by Zetu * #
  4. #=========================================================================#
  5. module Z_Systems
  6.   module NeoMenu
  7.     PARAMETERS = [ #State definitions for parameters
  8.       ['ATK',  'actor.atk'],
  9.       ['DEF',  'actor.def'],
  10.       ['INT',  'actor.spi'],
  11.       ['AGI',  'actor.agi'],
  12.       ['HIT',  '"#{actor.hit}%"'],
  13.       ['EVA',  '"#{actor.eva}%"'],
  14.       ['CRIT', 'actor.cri']]
  15.    
  16.     #This was for a request.  Leave as false.
  17.     DRAWEP = false
  18.     EP = ['actor.ep', 'actor.maxep']
  19.   end
  20. end
  21.  
  22. class Scene_Menu < Scene_Base
  23.  
  24.   alias nms_ucs update_command_selection
  25.   def update_command_selection
  26.     if Input.trigger?(Input::R)
  27.       @status_window.next_actor
  28.       return
  29.     elsif Input.trigger?(Input::L)
  30.       @status_window.previous_actor
  31.       return
  32.     end
  33.     nms_ucs
  34.   end
  35.  
  36.   def start_actor_selection
  37.     script = Z6::MENU_ITEMS[@command_window.index][2]
  38.     script = script.sub('@status_window.index', '@status_window.actor_id')
  39.     eval(script)
  40.   end
  41.  
  42. end
  43.  
  44. class Window_MenuStatus < Window_Selectable
  45.  
  46.   def refresh
  47.     self.contents.clear
  48.     @item_max = $game_party.members.size
  49.     actor     = $game_party.members[actor_id]
  50.     prevactor = $game_party.members[previous_actor_id]
  51.     nextactor = $game_party.members[next_actor_id]
  52.     draw_frame(129, 0, 98, 98, text_color(14))
  53.     draw_actor_face(actor, 130, 1, 96)
  54.     draw_actor_face(prevactor, 40, 6, 84)
  55.     draw_actor_face(nextactor, 232, 6, 84)
  56.     draw_actor_name(actor, 2, 96)
  57.     draw_actor_class(actor, 186, 96)
  58.     draw_actor_level(actor, 90, 96)
  59.     draw_actor_state(actor, 184, 144)
  60.     draw_actor_hp(actor, 2, 118, 166)
  61.     draw_actor_mp(actor, 2, 142, 166)
  62.     draw_actor_xp(actor, 184, 118, 168)
  63.     draw_actor_ep(actor, 184, 142, 168) if Z_Systems::NeoMenu::DRAWEP
  64.     neo_draw_params(0, 168)
  65.     neo_draw_equips(156, 168)
  66.   end
  67.  
  68.   def neo_draw_params(x, y)
  69.     actor = $game_party.members[actor_id]
  70.     for parameter in Z_Systems::NeoMenu::PARAMETERS
  71.       self.contents.font.color = system_color
  72.       self.contents.draw_text(x, y, 96, WLH, parameter[0])
  73.       self.contents.font.color = normal_color
  74.       stat = eval(parameter[1])
  75.       self.contents.draw_text(x+70, y, 52, WLH, stat, 2)
  76.       y += WLH
  77.     end
  78.   end
  79.  
  80.   def neo_draw_equips(x, y)
  81.     actor = $game_party.members[actor_id]
  82.     self.contents.font.color = system_color
  83.     self.contents.draw_text(x, y, 216, WLH, "Equipment")
  84.     data = []
  85.     for item in actor.equips do data.push(item) end
  86.     for i in 0...data.size
  87.       draw_item_name(data[i], x, y + WLH * (i + 1))
  88.     end
  89.   end
  90.  
  91.   def next_actor
  92.     @actor_index = next_actor_id
  93.     refresh
  94.   end
  95.  
  96.   def previous_actor
  97.     @actor_index = previous_actor_id
  98.     refresh
  99.   end
  100.  
  101.   def actor_id
  102.     @actor_index ||= 0
  103.     return @actor_index
  104.   end
  105.  
  106.   def next_actor_id
  107.     id = actor_id + 1
  108.     if id >= $game_party.members.size
  109.       id -= $game_party.members.size
  110.     end
  111.     return id
  112.   end
  113.  
  114.   def previous_actor_id
  115.     id = actor_id - 1
  116.     id += $game_party.members.size if id < 0
  117.     return id
  118.   end
  119.  
  120.   def update_cursor
  121.     return
  122.   end
  123.  
  124.   def draw_frame(x, y, width, height, color = normal_color)
  125.     self.contents.fill_rect(x, y, 1, height, color)
  126.     self.contents.fill_rect(x, y, width, 1, color)
  127.     self.contents.fill_rect(x + width - 1, y, 1, height, color)
  128.     self.contents.fill_rect(x, y + height - 1, width, 1, color)
  129.   end
  130.  
  131. end
  132.  
  133. class Window_Base < Window
  134.  
  135.   def draw_actor_xp(actor, x, y, width = 120)
  136.     draw_actor_xp_gauge(actor, x, y, width)
  137.     self.contents.font.color = system_color
  138.     self.contents.draw_text(x, y, 30, WLH, "XP")
  139.     self.contents.font.color = normal_color
  140.     last_font_size = self.contents.font.size
  141.     if width < 120
  142.       self.contents.draw_text(x + 32, y, width - 32, WLH, actor.exp_til, 2)
  143.     else
  144.       self.contents.font.color = normal_color
  145.       text = actor.exp_til.to_s + " / " + actor.exp_max.to_s
  146.       text = actor.level == 99 ? "-------" : text
  147.       self.contents.draw_text(x + 32, y, width - 32, WLH, text, 2)
  148.     end
  149.   end
  150.   def draw_actor_xp_gauge(actor, x, y, width = 120)
  151.     gw = actor.exp_max != 0 ? width * actor.exp_til / actor.exp_max : width
  152.     gc1 = text_color(16)
  153.     gc2 = text_color(22)
  154.     self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
  155.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  156.   end
  157.  
  158. end
  159.  
  160. class Game_Actor < Game_Battler
  161.   def exp_til
  162.     return (@exp - @exp_list[@level])
  163.   end
  164.   def exp_max
  165.     return 0 if @level == 99
  166.     return @exp_list[@level+1] - @exp_list[@level]
  167.   end
  168. end
Add Comment
Please, Sign In to add comment