Ventwig

VTS-Nova Battle Display

Dec 29th, 2012
1,254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 18.95 KB | None | 0 0
  1. #============================================================================
  2. #Nova Battle Display VTS
  3. #By Ventwig
  4. #Version 1.05 - January 1 2012
  5. #For RPGMaker VX Ace
  6. #=============================================================================
  7. # Description:
  8. # This script changes the display in-battle.
  9. # The command windows are changed to a horizontal display, while faces and
  10. # bars are displayed to the left. When that actor is selected, their bars
  11. # grow, so you know where you're looking! The skill selection window
  12. # is edited, too. See for yourself!
  13. #==============================================================================
  14. # Compatability:
  15. #  Probably highly incompatible with things because of the amount of
  16. #  things I re-wrote in the battle scene. Ask me for compatability patches!
  17. #  Works with Jet's Sideview/efeberk's behind-view patch
  18. #  Works with Neo Gauge Ultimate Ace
  19. #===============================================================================
  20. # Instructions: Put in materials, above main. Almost Plug and Play
  21. #==============================================================================
  22. # Please give Credit to Ventwig if you would like to use one of my scripts!
  23. # Use it commericial or non-commercial, and feel free to tell me if you're using
  24. # it commercially!
  25. # You may edit my scripts, just don't claim as your own!
  26. #===============================================================================
  27. # NOTES:
  28. # Recommended with Jet's Simple Sideview "Behind View" patch by efeberk
  29. # The overall effect together is simple and amazing in my opinion.
  30. # These are my recommended settings:
  31. #   FIELD_POS = [175, 350]
  32. #   FIELD_SPACING = [80, 0]
  33. #############################################################################
  34. #Customization
  35. #############################################################################
  36. module NEOBT_VTS
  37.   #This is probably the biggest customization option.
  38.   #Determines whether or not TP bars will be drawn. T/F
  39.   USE_TP = true
  40. end
  41.  
  42. #=============================================================================
  43. # NO TOUCHEY! DA REST IS MAIIIIIIIIIIIIIIIIIIINNNEEEEE!
  44. #=============================================================================
  45.  
  46. class Game_Party < Game_Unit
  47.   #--------------------------------------------------------------------------
  48.   # * Get Maximum Number of Battle Members
  49.   #--------------------------------------------------------------------------
  50.   def max_battle_members
  51.     return 3
  52.   end
  53. end
  54.  
  55.  
  56. class Window_BattleStatus < Window_Selectable  
  57.   #--------------------------------------------------------------------------
  58.   # * Starts Up The Window
  59.   #--------------------------------------------------------------------------
  60.   def initialize
  61.     #Draws window
  62.     super(0,0,545,500)
  63.     self.z = 0
  64.     self.opacity = 0
  65.     @x, @y = 5, 50
  66.     @party_size = $game_party.all_members.size
  67.     battle_hud
  68.     @long_index = self.index
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # * Draws The HUD
  72.   #--------------------------------------------------------------------------
  73.   def battle_hud
  74.     if $game_party.all_members.size >0
  75.       @actor = $game_party.members[0]
  76.       @actor_hp = @actor.hp
  77.       @actor_mp = @actor.mp
  78.       @actor_tp = @actor.tp
  79.       draw_actor_face(@actor, @x+10, @y-10, enabled = true)
  80.       draw_actor_icons(@actor, @x+15, @y-10+10)
  81.       if self.index == 0
  82.         if NEOBT_VTS::USE_TP == true
  83.           draw_actor_tp(@actor, @x+80, @y-10+45,80)
  84.         end
  85.         draw_actor_hp(@actor, @x+20, @y-10+65,150)
  86.         draw_actor_mp(@actor, @x+20, @y-10+80,150)
  87.       else
  88.         if NEOBT_VTS::USE_TP == true
  89.           draw_actor_tp(@actor, @x+80, @y-10+45,50)
  90.         end
  91.         draw_actor_hp(@actor, @x+20, @y-10+65)
  92.         draw_actor_mp(@actor, @x+20, @y-10+80)
  93.       end
  94.     end
  95.     if $game_party.all_members.size >1
  96.       @actor2 = $game_party.members[1]
  97.       @actor2_hp = @actor2.hp
  98.       @actor2_mp = @actor2.mp
  99.       @actor2_tp = @actor2.tp
  100.       draw_actor_face(@actor2, @x+10, @y-10+125, enabled = true)
  101.       draw_actor_icons(@actor2, @x+15, @y-10+10+125)
  102.       if self.index == 1
  103.         if NEOBT_VTS::USE_TP == true
  104.           draw_actor_tp(@actor2, @x+80, @y-10+45+125,80)
  105.         end
  106.         draw_actor_hp(@actor2, @x+20, @y-10+65+125,150)
  107.         draw_actor_mp(@actor2, @x+20, @y-10+80+125,150)
  108.       else
  109.         if NEOBT_VTS::USE_TP == true
  110.           draw_actor_tp(@actor2, @x+80, @y-10+45+125,50)
  111.         end
  112.         draw_actor_hp(@actor2, @x+20, @y-10+65+125)
  113.         draw_actor_mp(@actor2, @x+20, @y-10+80+125)
  114.       end
  115.     end
  116.     if $game_party.all_members.size >2
  117.       @actor3 = $game_party.members[2]
  118.       @actor3_hp = @actor3.hp
  119.       @actor3_mp = @actor3.mp
  120.       @actor3_tp = @actor3.tp
  121.       draw_actor_face(@actor3, @x+10, @y-10+250, enabled = true)
  122.       draw_actor_icons(@actor3, @x+15, @y-10+10+250)
  123.       if self.index == 2
  124.         if NEOBT_VTS::USE_TP == true
  125.           draw_actor_tp(@actor3, @x+80, @y-10+45+250,80)
  126.         end
  127.         draw_actor_hp(@actor3, @x+20, @y-10+65+250,150)
  128.         draw_actor_mp(@actor3, @x+20, @y-10+80+250,150)
  129.       else
  130.         if NEOBT_VTS::USE_TP == true
  131.           draw_actor_tp(@actor3, @x+80, @y-10+45+250,50)
  132.         end
  133.         draw_actor_hp(@actor3, @x+20, @y-10+65+250)
  134.         draw_actor_mp(@actor3, @x+20, @y-10+80+250)
  135.       end
  136.     end
  137.   end
  138.  
  139.   #--------------------------------------------------------------------------
  140.   # * Edits Sizing of the Selection Box
  141.   #--------------------------------------------------------------------------
  142.   def item_rect(index)
  143.     rect = Rect.new
  144.     rect.width = 0#200
  145.     rect.height = 0#100
  146.     rect.x = 0#10
  147.     rect.y = 0#40 + index / col_max * 125
  148.     rect
  149.   end
  150.  
  151.  
  152.   #--------------------------------------------------------------------------
  153.   # * Refresh/Redraw
  154.   #--------------------------------------------------------------------------  
  155.   def refresh
  156.     contents.clear
  157.     battle_hud
  158.     @party_size = $game_party.all_members.size
  159.     @long_index = self.index
  160.   end    
  161.  
  162.   #--------------------------------------------------------------------------
  163.   # * Updates (Tells when to refresh)
  164.   #--------------------------------------------------------------------------
  165.   def update
  166.     super
  167.     if @party_size != $game_party.all_members.size
  168.       refresh
  169.     end
  170.     if @party_size > 0
  171.       if $game_party.members[0].hp != @actor_hp  or $game_party.members[0].mp != @actor_mp or $game_party.members[0].tp != @actor_tp
  172.         refresh
  173.       end
  174.     end
  175.     if @party_size > 1
  176.       if $game_party.members[1].hp != @actor2_hp or $game_party.members[1].mp != @actor2_mp or $game_party.members[1].tp != @actor2_tp
  177.         refresh
  178.       end
  179.     end  
  180.     if @party_size > 2
  181.       if $game_party.members[2].hp != @actor3_hp or $game_party.members[2].mp != @actor3_mp or $game_party.members[2].tp != @actor3_tp
  182.         refresh
  183.       end
  184.     end
  185.     if self.index != @long_index
  186.       refresh
  187.     end
  188.   end
  189. end  
  190.  
  191. class Window_BattleActor < Window_BattleStatus
  192.   #--------------------------------------------------------------------------
  193.   # * Shows the Window
  194.   #--------------------------------------------------------------------------
  195.   def show
  196.     if @info_viewport
  197.       width_remain = Graphics.width - width
  198.       self.arrows_visible = false
  199.       self.opacity = 255
  200.       self.x = 0#-23+210
  201.       self.y = 73
  202.       self.z = 150
  203.       self.width = Graphics.width/2
  204.       self.height = Graphics.height - 70-50
  205.       @info_viewport.rect.width = width_remain
  206.       select(0)
  207.     end
  208.     super
  209.   end
  210.  
  211.   #--------------------------------------------------------------------------
  212.   # * Draws the HUD
  213.   #--------------------------------------------------------------------------
  214.   def battle_hud
  215.     if $game_party.all_members.size >0
  216.       @actor = $game_party.members[0]
  217.       @actor_hp = @actor.hp
  218.       @actor_mp = @actor.mp
  219.       @actor_tp = @actor.tp
  220.       draw_actor_name(@actor, @x+10, @y-30)
  221.       if self.index == 0
  222.         draw_actor_hp(@actor, @x+20, @y-30+25,150)
  223.         draw_actor_mp(@actor, @x+20, @y-30+40,150)
  224.       else
  225.         draw_actor_hp(@actor, @x+20, @y-30+25)
  226.         draw_actor_mp(@actor, @x+20, @y-30+40)
  227.       end
  228.     end
  229.     if $game_party.all_members.size >1
  230.       @actor2 = $game_party.members[1]
  231.       @actor2_hp = @actor2.hp
  232.       @actor2_mp = @actor2.mp
  233.       @actor2_tp = @actor2.tp
  234.       draw_actor_name(@actor2, @x+10, @y-30+75)
  235.       if self.index == 1
  236.         draw_actor_hp(@actor2, @x+20, @y-30+25+75,150)
  237.         draw_actor_mp(@actor2, @x+20, @y-30+40+75,150)
  238.       else
  239.         draw_actor_hp(@actor2, @x+20, @y-30+25+75)
  240.         draw_actor_mp(@actor2, @x+20, @y-30+40+75)
  241.       end
  242.     end
  243.     if $game_party.all_members.size >2
  244.       @actor3 = $game_party.members[2]
  245.       @actor3_hp = @actor3.hp
  246.       @actor3_mp = @actor3.mp
  247.       @actor3_tp = @actor3.tp
  248.       draw_actor_name(@actor3, @x+10, @y-30+150)
  249.       if self.index == 2
  250.         draw_actor_hp(@actor3, @x+20, @y-30+25+150,150)
  251.         draw_actor_mp(@actor3, @x+20, @y-30+40+150,150)
  252.       else
  253.         draw_actor_hp(@actor3, @x+20, @y-30+25+150)
  254.         draw_actor_mp(@actor3, @x+20, @y-30+40+150)
  255.       end
  256.     end
  257.   end
  258.   def item_rect(index)
  259.     rect = Rect.new
  260.     rect.width = 0#200
  261.     rect.height = 0#70
  262.     rect.x = 0#10
  263.     rect.y = 0#40 + index / col_max *
  264.     rect
  265.   end
  266. end
  267.  
  268. class Window_SkillList < Window_Selectable
  269.   #--------------------------------------------------------------------------
  270.   # * Sets to 1 Row Per Column
  271.   #--------------------------------------------------------------------------
  272.   def col_max
  273.     return 1
  274.   end
  275. end
  276. class Window_ItemList < Window_Selectable
  277.   #--------------------------------------------------------------------------
  278.   # * Sets to 1 Row Per Column
  279.   #--------------------------------------------------------------------------
  280.   def col_max
  281.     return 1
  282.   end
  283. end
  284.  
  285. class Window_BattleEnemy < Window_Selectable
  286.   #--------------------------------------------------------------------------
  287.   # * Shows the Window
  288.   #--------------------------------------------------------------------------
  289.   def show
  290.     if @info_viewport
  291.       width_remain = Graphics.width - width
  292.       self.arrows_visible = false
  293.       self.opacity = 255
  294.       self.x = 0#-23+210
  295.       self.y = 73
  296.       self.z = 150
  297.       self.width = Graphics.width/2
  298.       self.height = Graphics.height - 70-50
  299.       @info_viewport.rect.width = width_remain
  300.       select(0)
  301.     end
  302.     super
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # * Sets to 1 Row Per Column
  306.   #--------------------------------------------------------------------------
  307.   def col_max
  308.     return 1
  309.   end
  310. end
  311.  
  312.  
  313. class Window_PartyHorzCommand < Window_HorzCommand
  314.   #--------------------------------------------------------------------------
  315.   # * Object Initialization
  316.   #--------------------------------------------------------------------------
  317.   def initialize(window_width)
  318.     @window_width = window_width
  319.     super(0, 0)
  320.   end
  321.   #--------------------------------------------------------------------------
  322.   # * Get Window Width
  323.   #--------------------------------------------------------------------------
  324.   def window_width
  325.     @window_width
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # * Get Digit Count
  329.   #--------------------------------------------------------------------------
  330.   def col_max
  331.     return 2
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # * Create Command List
  335.   #--------------------------------------------------------------------------
  336.   def make_command_list
  337.     add_command(Vocab::fight,  :fight)
  338.     add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # * Setup
  342.   #--------------------------------------------------------------------------
  343.   def setup
  344.     clear_command_list
  345.     make_command_list
  346.     refresh
  347.     select(0)
  348.     activate
  349.     open
  350.   end
  351. end
  352. #====================================================================
  353. #====================================================================
  354. class Window_ActorHorzCommand < Window_HorzCommand
  355.   #--------------------------------------------------------------------------
  356.   # * Object Initialization
  357.   #--------------------------------------------------------------------------
  358.   def initialize(window_width)
  359.     @window_width = window_width
  360.     super(0, 0)
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # * Get Window Width
  364.   #--------------------------------------------------------------------------
  365.   def window_width
  366.     @window_width
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # * Get Digit Count
  370.   #--------------------------------------------------------------------------
  371.   def col_max
  372.     return 4
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # * Create Command List
  376.   #--------------------------------------------------------------------------
  377.   def make_command_list
  378.     return unless @actor
  379.     add_attack_command
  380.     add_skill_commands
  381.     add_guard_command
  382.     add_item_command
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # * Add Attack Command to List
  386.   #--------------------------------------------------------------------------
  387.   def add_attack_command
  388.     add_command(Vocab::attack, :attack, @actor.attack_usable?)
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # * Add Skill Command to List
  392.   #--------------------------------------------------------------------------
  393.   def add_skill_commands
  394.     @actor.added_skill_types.sort.each do |stype_id|
  395.       name = $data_system.skill_types[stype_id]
  396.       add_command(name, :skill, true, stype_id)
  397.     end
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * Add Guard Command to List
  401.   #--------------------------------------------------------------------------
  402.   def add_guard_command
  403.     add_command(Vocab::guard, :guard, @actor.guard_usable?)
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # * Add Item Command to List
  407.   #--------------------------------------------------------------------------
  408.   def add_item_command
  409.     add_command(Vocab::item, :item)
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # * Setup
  413.   #--------------------------------------------------------------------------
  414.   def setup(actor)
  415.     @actor = actor
  416.     clear_command_list
  417.     make_command_list
  418.     refresh
  419.     select(0)
  420.     activate
  421.     open
  422.   end
  423. end
  424.  
  425. #====================================================================
  426. #====================================================================
  427. #====================================================================
  428.  
  429. class Scene_Battle < Scene_Base
  430.   #--------------------------------------------------------------------------
  431.   # * Get Maximum Number of Battle Members
  432.   #--------------------------------------------------------------------------
  433.   alias neobt_vts_status_create_status_window create_status_window
  434.   def create_status_window
  435.     neobt_vts_status_create_status_window
  436.     create_info_viewport
  437.     @status_window = Window_BattleStatus.new
  438.     @status_window.x = 128
  439.   end  
  440.  
  441.   #--------------------------------------------------------------------------
  442.   # * Edits and Adds both viewports
  443.   #--------------------------------------------------------------------------
  444.   def create_info_viewport
  445.     @info_viewport = Viewport.new
  446.     @info_viewport.rect.y = Graphics.height - 48
  447.     @info_viewport.rect.height = Graphics.height
  448.     @info_viewport.z = 100
  449.     @info_viewport.ox = 0
  450.    
  451.     @sinfo_viewport = Viewport.new
  452.     @sinfo_viewport.rect.x = -150
  453.     @sinfo_viewport.rect.y = -40
  454.     @sinfo_viewport.rect.height = Graphics.height
  455.     @sinfo_viewport.z = 100
  456.     @sinfo_viewport.ox = 0
  457.     @status_window.viewport = @sinfo_viewport
  458.   end
  459.  
  460.   #--------------------------------------------------------------------------
  461.   # * Removes The Viewport Movements
  462.   #--------------------------------------------------------------------------
  463.   def update_info_viewport
  464.   end
  465.  
  466.   #--------------------------------------------------------------------------
  467.   # * Edits Party Command Window
  468.   #--------------------------------------------------------------------------
  469.   def create_party_command_window
  470.     @party_command_window = Window_PartyHorzCommand.new(Graphics.width)
  471.     @party_command_window.x = 0
  472.     @party_command_window.height = 48
  473.     @party_command_window.y = Graphics.height - 48
  474.     @party_command_window.width = @status_window.width
  475.     @party_command_window.set_handler(:fight,  method(:command_fight))
  476.     @party_command_window.set_handler(:escape, method(:command_escape))
  477.     @party_command_window.unselect
  478.   end
  479.  
  480.   #--------------------------------------------------------------------------
  481.   # * Edits Actor Command Window
  482.   #--------------------------------------------------------------------------
  483.   def create_actor_command_window
  484.     @actor_command_window = Window_ActorHorzCommand.new(Graphics.width)
  485.     @actor_command_window.x = 0
  486.     @actor_command_window.height = 48
  487.     @actor_command_window.y = Graphics.height - 48
  488.     @actor_command_window.width = @status_window.width
  489.     @actor_command_window.set_handler(:attack, method(:command_attack))
  490.     @actor_command_window.set_handler(:skill,  method(:command_skill))
  491.     @actor_command_window.set_handler(:guard,  method(:command_guard))
  492.     @actor_command_window.set_handler(:item,   method(:command_item))
  493.     @actor_command_window.set_handler(:cancel, method(:prior_command))
  494.   end
  495.  
  496.   #--------------------------------------------------------------------------
  497.   # * Moves Skill Window
  498.   #--------------------------------------------------------------------------
  499.   alias neobt_vts_create_skill_window create_skill_window
  500.   def create_skill_window
  501.     neobt_vts_create_skill_window
  502.     @skill_window.x = Graphics.width/2
  503.     @skill_window.width = Graphics.width/2
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # * Moves Item Window
  507.   #--------------------------------------------------------------------------
  508.   alias neobt_vts_create_item_window create_item_window
  509.   def create_item_window
  510.     neobt_vts_create_item_window
  511.     @item_window.x = Graphics.width/2
  512.     @item_window.width = Graphics.width/2
  513.   end
  514.  
  515. end
  516.   #########################################################################
  517.   #End Of Script                                                          #
  518.   #########################################################################
Advertisement
Add Comment
Please, Sign In to add comment