neutale

VX style BattleLog+

Jun 21st, 2019
726
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 12.45 KB | None | 0 0
  1. =begin
  2.  
  3. RGSS3 VX style BattleLog+ Ver.1.001 mo-to 2017/07/21
  4.  
  5. TKOOL COOL
  6. http://mototkool.blog.fc2.com/
  7.  
  8. ★Usage★
  9. Paste this script above Main.
  10.  
  11. You can adjust the customization in various ways.
  12. If you want something simple as VX battle, set all booleans to false.
  13.  
  14. ★Overview★
  15. Changes battlelog in battle to VX style.
  16.  
  17. ★Note★
  18. Display will always be below if you align the text display
  19. in middle / upper in a battle event.
  20. The message background is only transparent.
  21.  
  22. ★Update history★
  23. ver.0.01 Released with basics
  24. ver.1.00 Added more customizations
  25.      Gold position during battle
  26.      
  27. ver.1.001 Code rewritten similar to MV counterpart
  28.      Applicable to high resolution change
  29. =end
  30.  
  31. #==============================================================================
  32. # ★ Customizations
  33. #==============================================================================
  34. module MOTO
  35.    
  36. SIMPLE_STATUS_WINDOW = true #true:Simple status display at the top | false: None
  37.   #↓Only when you select true in above customization
  38.   TP_GAGE = true  #true:Display TP gauge | false: None
  39.  
  40. PARTY_COMMAND_RIGHT = true #true:Display party commands on the right | false: Default
  41.    
  42. ACTOR_COMMAND_LEFT = false #true:Display actor command on the left | false: Default
  43.  
  44.  
  45. end
  46.  
  47. #==============================================================================
  48. # ☆ Window_Battle_Message
  49. #------------------------------------------------------------------------------
  50. #  A fixed, transparent message window for displaying text during battle.
  51. #==============================================================================
  52. class Window_Battle_Message < Window_Message
  53.   #--------------------------------------------------------------------------
  54.   # ☆ Object initialization
  55.   #--------------------------------------------------------------------------
  56.   def initialize
  57.     super
  58.     self.x = 0
  59.     self.y = Graphics.height - height
  60.     self.z = 210
  61.     self.opacity = 0
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ☆ Fix window background transparency
  65.   #--------------------------------------------------------------------------
  66.   def update_background
  67.     self.opacity = 0
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ☆ Fixed message window and gold window position
  71.   #--------------------------------------------------------------------------
  72.   def update_placement
  73.     @gold_window.x = 0
  74.     @gold_window.y = (Graphics.height - height) - @gold_window.height
  75.   end
  76. end
  77.  
  78. #==============================================================================
  79. # ☆ Window_Simple_Status
  80. #==============================================================================
  81. #  This is a simplified status window that displays at the top during battle.
  82. #==============================================================================
  83. class Window_Simple_Status < Window_Selectable
  84.   #--------------------------------------------------------------------------
  85.   # ☆ Object initialization
  86.   #--------------------------------------------------------------------------
  87.   def initialize
  88.     width = self.window_width
  89.     width = 0 if $game_party.members.size == 0
  90.     hight = MOTO::TP_GAGE ? fitting_height(4) : fitting_height(3)
  91.     super(0, 0, width, hight)
  92.     self.openness = 0
  93.     refresh
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● Get window width
  97.   #--------------------------------------------------------------------------
  98.   def window_width
  99.     return Graphics.width / 4 * item_max
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● Max column digits
  103.   #--------------------------------------------------------------------------
  104.   def col_max
  105.     return 4
  106.   end  
  107.   #--------------------------------------------------------------------------
  108.   # ● Number of items max
  109.   #--------------------------------------------------------------------------
  110.   def item_max
  111.     return $game_party.battle_members.size
  112.   end  
  113.   #--------------------------------------------------------------------------
  114.   # ● Draw item
  115.   #--------------------------------------------------------------------------
  116.   def draw_item(index)
  117.     actor = $game_party.members[index]
  118.     rect = item_rect(index)
  119.     x = rect.x
  120.     y = rect.y
  121.     width = rect.width - (spacing / 2)
  122.     if MOTO::TP_GAGE
  123.       draw_actor_simple_status(actor, x, y, width)
  124.     else
  125.       draw_actor_simple_status_notp(actor, x, y, width)
  126.     end    
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● Simple status drawing
  130.   #--------------------------------------------------------------------------
  131.   def draw_actor_simple_status(actor, x, y, width)
  132.     draw_actor_name(actor, x, y)
  133.     draw_actor_hp(actor, x, y + line_height * 1, width)
  134.     draw_actor_mp(actor, x, y + line_height * 2, width)
  135.     draw_actor_tp(actor, x, y + line_height * 3, width)
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● Simple status drawing (without TP)
  139.   #--------------------------------------------------------------------------
  140.   def draw_actor_simple_status_notp(actor, x, y, width)
  141.     draw_actor_name(actor, x, y)
  142.     draw_actor_hp(actor, x, y + line_height * 1, width)
  143.     draw_actor_mp(actor, x, y + line_height * 2, width)
  144.   end  
  145.   #--------------------------------------------------------------------------
  146.   # ● Get rectangle to draw the item
  147.   #--------------------------------------------------------------------------
  148.   def item_rect(index)
  149.     rect = Rect.new
  150.     col_max = item_max
  151.     rect.width = (window_width / item_max) - ((4 - item_max) * 4)
  152.     rect.height = item_height
  153.     rect.x = index % col_max * (rect.width - spacing / 8 )
  154.     rect.y = 0
  155.     return rect
  156.   end  
  157. end
  158.  
  159. class Window_BattleLog < Window_Selectable
  160.   #--------------------------------------------------------------------------
  161.   # ● Object initialization * Redefinition
  162.   #--------------------------------------------------------------------------
  163.   def initialize
  164.     super(0, Graphics.height - window_height, window_width, window_height)
  165.     self.z = 200
  166.     @lines = []
  167.     @num_wait = 0
  168.     create_back_bitmap
  169.     create_back_sprite
  170.     refresh
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● Maximum number of lines ※ Redefined
  174.   #--------------------------------------------------------------------------
  175.   def max_line_number
  176.     return 4
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● Get background opacity ※ Redefined
  180.   #--------------------------------------------------------------------------
  181.   def back_opacity
  182.     return 0
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ○ Line drawing * Alias definition
  186.   #--------------------------------------------------------------------------
  187.   alias ori_moto_draw_line draw_line
  188.   def draw_line(line_number)
  189.     self.open
  190.     ori_moto_draw_line(line_number)
  191.   end
  192. end
  193.  
  194.  
  195. class Scene_Battle < Scene_Base
  196.   #--------------------------------------------------------------------------
  197.   # ○ Create all windows * Alias definition
  198.   #--------------------------------------------------------------------------
  199.   alias ori_moto_create_all_windows create_all_windows
  200.   def create_all_windows
  201.     ori_moto_create_all_windows
  202.    
  203.     create_simple_status_window
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● Create message window ※ Redefine
  207.   #--------------------------------------------------------------------------
  208.   def create_message_window
  209.     @message_window = Window_Battle_Message.new
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ☆ Create simple status window
  213.   #--------------------------------------------------------------------------
  214.   def create_simple_status_window
  215.     @simple_status_window = Window_Simple_Status.new
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● Frame update ※ Redefined
  219.   #--------------------------------------------------------------------------
  220.   def update
  221.     super
  222.     if BattleManager.in_turn?
  223.       @log_window.open
  224.       process_event
  225.       process_action
  226.     end
  227.     BattleManager.judge_win_loss
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ○ Create party command window ※ Alias definition
  231.   #--------------------------------------------------------------------------
  232.   alias oro_moto_create_party_command_window create_party_command_window
  233.   def create_party_command_window
  234.     oro_moto_create_party_command_window
  235.  
  236.     @party_command_window.x = Graphics.width if MOTO::PARTY_COMMAND_RIGHT
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ○ Create actor command window * Define alias
  240.   #--------------------------------------------------------------------------
  241.   alias oro_moto_create_actor_command_window create_actor_command_window
  242.   def create_actor_command_window
  243.     oro_moto_create_actor_command_window
  244.  
  245.     @actor_command_window.x -= Graphics.width if MOTO::ACTOR_COMMAND_LEFT
  246.    
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● Update info display viewport ※ Redefined
  250.   #--------------------------------------------------------------------------
  251.   def update_info_viewport
  252.     i = MOTO::PARTY_COMMAND_RIGHT ? 128 : 0
  253.     j = MOTO::ACTOR_COMMAND_LEFT ? 0 : 128
  254.     move_info_viewport(i)   if @party_command_window.active
  255.     move_info_viewport(j) if @actor_command_window.active
  256.     move_info_viewport(64)  if BattleManager.in_turn?
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ○ Update status window ※ Alias definition
  260.   #--------------------------------------------------------------------------
  261.   alias ori_moto_refresh_status refresh_status
  262.   def refresh_status
  263.     ori_moto_refresh_status
  264.     @simple_status_window.refresh
  265.   end
  266.   #--------------------------------------------------------------------------
  267.   # ○ Battle start ※ Alias definition
  268.   #--------------------------------------------------------------------------
  269.   alias ori_moto_battle_start battle_start
  270.   def battle_start
  271.     ori_moto_battle_start
  272.     @log_window.close
  273.   end
  274.   #--------------------------------------------------------------------------
  275.   # ○ Turn start * Alias definition
  276.   #--------------------------------------------------------------------------
  277.   alias ori_moto_turn_start turn_start
  278.   def turn_start
  279.     @status_window.close
  280.     @simple_status_window.open if MOTO::SIMPLE_STATUS_WINDOW
  281.     ori_moto_turn_start
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ● Turn end * Redefined
  285.   #--------------------------------------------------------------------------
  286.   def turn_end
  287.     all_battle_members.each do |battler|
  288.       battler.on_turn_end
  289.       refresh_status
  290.       @log_window.display_auto_affected_status(battler)
  291.       @log_window.wait_and_clear
  292.     end
  293.     BattleManager.turn_end
  294.     process_event
  295.     @log_window.close
  296.     @simple_status_window.close if MOTO::SIMPLE_STATUS_WINDOW
  297.     start_party_command_selection
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● Processing action ※ Redefined
  301.   #--------------------------------------------------------------------------
  302.   def process_action
  303.     return if scene_changing?
  304.     if !@subject || !@subject.current_action
  305.       @subject = BattleManager.next_subject
  306.     end
  307.     return turn_end unless @subject
  308.     if @subject.current_action
  309.       @subject.current_action.prepare
  310.       if @subject.current_action.valid?
  311.         execute_action
  312.       end
  313.       @subject.remove_current_action
  314.     end
  315.     process_action_end unless @subject.current_action
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ○ Command [escape] ※ alias definition
  319.   #--------------------------------------------------------------------------
  320.   alias ori_moto_command_escape command_escape
  321.   def command_escape
  322.     @log_window.open
  323.     ori_moto_command_escape
  324.   end
  325. end
Advertisement
Add Comment
Please, Sign In to add comment