Advertisement
neutale

VX style BattleLog+ 1.01

Jul 9th, 2019
577
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.54 KB | None | 0 0
  1. =begin
  2.  
  3. RGSS3 VX style BattleLog+ Ver.1.01 mo-to 2012/02/07
  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. ver.1.01  Status window size change
  27.      You can customize the coordinates for status and transparency.
  28.      
  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.  
  39.   TP_GAGE = true  #true:Display TP gauge | false: None
  40.   SIMPLE_STATUS_X = 0 #status X coordinate
  41.   SIMPLE_STATUS_Y = 0 #status Y coordinate
  42.   OPACITY = 200 #status transparency (0-255, 0 = transparent)
  43.  
  44. PARTY_COMMAND_RIGHT = true #true:Display party commands on the right | false: Default
  45.    
  46. ACTOR_COMMAND_LEFT = false #true:Display actor command on the left | false: Default
  47.  
  48. end
  49.  
  50. #==============================================================================
  51. # ☆ Window_Battle_Message
  52. #------------------------------------------------------------------------------
  53. #  A fixed, transparent message window for displaying text during battle.
  54. #==============================================================================
  55. class Window_Battle_Message < Window_Message
  56.   #--------------------------------------------------------------------------
  57.   # ☆ Object initialization
  58.   #--------------------------------------------------------------------------
  59.   def initialize
  60.     super
  61.     self.x = 0
  62.     self.y = Graphics.height - height
  63.     self.z = 210
  64.     self.opacity = 0
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ☆ Fix window background transparency
  68.   #--------------------------------------------------------------------------
  69.   def update_background
  70.     self.opacity = 0
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ☆ Fixed message window and gold window position
  74.   #--------------------------------------------------------------------------
  75.   def update_placement
  76.     @gold_window.x = 0
  77.     @gold_window.y = (Graphics.height - height) - @gold_window.height
  78.   end
  79. end
  80.  
  81. #==============================================================================
  82. # ☆ Window_Simple_Status
  83. #==============================================================================
  84. #  This is a simplified status window that displays at the top during battle.
  85. #==============================================================================
  86. class Window_Simple_Status < Window_Base
  87.   #--------------------------------------------------------------------------
  88.   # ☆ Object initialization
  89.   #--------------------------------------------------------------------------
  90.   def initialize
  91.     x = MOTO::SIMPLE_STATUS_X
  92.     y = MOTO::SIMPLE_STATUS_Y
  93.     width = $game_party.members.size * 136
  94.     width = 136 if $game_party.members.size == 0
  95.     hight = MOTO::TP_GAGE ? 96 : 81
  96.     super(x, y, width, hight)
  97.     self.openness = 0
  98.     self.opacity = MOTO::OPACITY
  99.     refresh
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ☆ Create contents
  103.   #--------------------------------------------------------------------------
  104.   def create_contents
  105.     self.contents.dispose
  106.     self.contents = Bitmap.new((512 / 8 * $game_party.members.size), height - 32)
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ☆ Refresh 1
  110.   #--------------------------------------------------------------------------
  111.   def refresh
  112.     create_contents
  113.     draw_contents
  114.     width_refresh
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ☆ Draw contents
  118.   #--------------------------------------------------------------------------
  119.   def draw_contents
  120.     self.contents.clear
  121.     return if $game_party.members.size == 0
  122.     for i in 0...$game_party.members.size
  123.       actor = $game_party.members[i]
  124.       actor_x = i * 512 / 8
  125.       contents.font.size = 18
  126.       draw_actor_name(actor, actor_x, 0, 56)
  127.       draw_actor_hp(actor, actor_x, 14, 62)
  128.       draw_actor_mp(actor, actor_x, 28, 62)
  129.       draw_actor_tp(actor, actor_x, 42, 62) if MOTO::TP_GAGE
  130.     end
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ☆ Width refresh
  134.   #--------------------------------------------------------------------------
  135.   def width_refresh
  136.     self.width = self.contents.width + 32
  137.   end
  138. end
  139.  
  140. class Window_BattleLog < Window_Selectable
  141.   #--------------------------------------------------------------------------
  142.   # ● Object initialization * Redefinition
  143.   #--------------------------------------------------------------------------
  144.   def initialize
  145.     super(0, 295, window_width, window_height)
  146.     self.z = 200
  147.     @lines = []
  148.     @num_wait = 0
  149.     create_back_bitmap
  150.     create_back_sprite
  151.     refresh
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● Max lines * Redefinition
  155.   #--------------------------------------------------------------------------
  156.   def max_line_number
  157.     return 4
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   # ● Opacity ※ Redefined
  161.   #--------------------------------------------------------------------------
  162.   def back_opacity
  163.     return 0
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ○ Line drawing * Alias
  167.   #--------------------------------------------------------------------------
  168.   alias ori_moto_draw_line draw_line
  169.   def draw_line(line_number)
  170.     self.open
  171.     ori_moto_draw_line(line_number)
  172.   end
  173. end
  174.  
  175.  
  176. class Scene_Battle < Scene_Base
  177.   #--------------------------------------------------------------------------
  178.   # ○ Create all windows * Alias definition
  179.   #--------------------------------------------------------------------------
  180.   alias ori_moto_create_all_windows create_all_windows
  181.   def create_all_windows
  182.     ori_moto_create_all_windows
  183.    
  184.     create_simple_status_window
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● Create message window ※ Redefine
  188.   #--------------------------------------------------------------------------
  189.   def create_message_window
  190.     @message_window = Window_Battle_Message.new
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ☆ Create simple status window
  194.   #--------------------------------------------------------------------------
  195.   def create_simple_status_window
  196.     @simple_status_window = Window_Simple_Status.new
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● Frame update ※ Redefined
  200.   #--------------------------------------------------------------------------
  201.   def update
  202.     super
  203.     if BattleManager.in_turn?
  204.       @log_window.open
  205.       process_event
  206.       process_action
  207.     end
  208.     BattleManager.judge_win_loss
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ Create party command window ※ Alias definition
  212.   #--------------------------------------------------------------------------
  213.   alias oro_moto_create_party_command_window create_party_command_window
  214.   def create_party_command_window
  215.     oro_moto_create_party_command_window
  216.  
  217.     @party_command_window.x = Graphics.width if MOTO::PARTY_COMMAND_RIGHT
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ○ Create actor command window * Define alias
  221.   #--------------------------------------------------------------------------
  222.   alias oro_moto_create_actor_command_window create_actor_command_window
  223.   def create_actor_command_window
  224.     oro_moto_create_actor_command_window
  225.  
  226.     @actor_command_window.x -= Graphics.width if MOTO::ACTOR_COMMAND_LEFT
  227.    
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● Update info display viewport ※ Redefined
  231.   #--------------------------------------------------------------------------
  232.   def update_info_viewport
  233.     n = MOTO::PARTY_COMMAND_RIGHT ? 128 : 0
  234.     m = MOTO::ACTOR_COMMAND_LEFT ? 0 : 128
  235.     move_info_viewport(n)   if @party_command_window.active
  236.     move_info_viewport(m) if @actor_command_window.active
  237.     move_info_viewport(64)  if BattleManager.in_turn?
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # ○ Update status window ※ Alias definition
  241.   #--------------------------------------------------------------------------
  242.   alias ori_moto_refresh_status refresh_status
  243.   def refresh_status
  244.     ori_moto_refresh_status
  245.     @simple_status_window.refresh
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ○ Turn start * Alias definition
  249.   #--------------------------------------------------------------------------
  250.   alias ori_moto_battle_start battle_start
  251.   def battle_start
  252.     ori_moto_battle_start
  253.     @log_window.close
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ Battle start ※ Alias definition
  257.   #--------------------------------------------------------------------------
  258.   alias ori_moto_turn_start turn_start
  259.   def turn_start
  260.     @status_window.close
  261.     @simple_status_window.open if MOTO::SIMPLE_STATUS_WINDOW
  262.     ori_moto_turn_start
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # ● Turn end * Redefined
  266.   #--------------------------------------------------------------------------
  267.   def turn_end
  268.     all_battle_members.each do |battler|
  269.       battler.on_turn_end
  270.       refresh_status
  271.       @log_window.display_auto_affected_status(battler)
  272.       @log_window.wait_and_clear
  273.     end
  274.     BattleManager.turn_end
  275.     process_event
  276.     @log_window.close
  277.     @simple_status_window.close if MOTO::SIMPLE_STATUS_WINDOW
  278.     start_party_command_selection
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● Processing action ※ Redefined
  282.   #--------------------------------------------------------------------------
  283.   def process_action
  284.     return if scene_changing?
  285.     if !@subject || !@subject.current_action
  286.       @subject = BattleManager.next_subject
  287.     end
  288.     return turn_end unless @subject
  289.     if @subject.current_action
  290.       @subject.current_action.prepare
  291.       if @subject.current_action.valid?
  292.         execute_action
  293.       end
  294.       @subject.remove_current_action
  295.     end
  296.     process_action_end unless @subject.current_action
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ○ Command [escape] ※ alias definition
  300.   #--------------------------------------------------------------------------
  301.   alias ori_moto_command_escape command_escape
  302.   def command_escape
  303.     @log_window.open
  304.     ori_moto_command_escape
  305.   end
  306. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement