Advertisement
roninator2

MOG - Battle Command Fix

Dec 6th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.71 KB | None | 0 0
  1. class Window_ActorCommand < Window_Command
  2.  
  3.   def refresh
  4.         return if @actor == nil
  5.         if battle_hud_ex_position?
  6.         self.viewport = nil
  7.     return if @actor.index == nil # roninator2 added for removing actor in battle
  8.         @bex = [$game_temp.hud_pos[@actor.index][0] + MOG_BATTLE_HUD_EX::ACTOR_COMMAND_POSITION[0] - (self.window_width / 2),
  9.         $game_temp.hud_pos[@actor.index][1] + MOG_BATTLE_HUD_EX::ACTOR_COMMAND_POSITION[1] - @stwh[1] ]
  10.         end
  11.         clear_command_list ; make_command_list ; create_contents
  12.         contents.clear
  13.         self.index = 0 if self.index > @list.size
  14.         set_window_position
  15.         refresh_layout_bt if @actor_old != @actor
  16.         dispose_sprite_command if @actor_old != @actor
  17.         @actor_old = @actor ; refresh_layout_bt; create_sprite_icons ; draw_all_items
  18.         set_slide_effect
  19.         update_sprite_battle_command  
  20.   end
  21.  
  22.   def update_command_name
  23.     return if @sprite_command_name == nil || @sprite_command_name.disposed?
  24.     refresh_command_name if @old_name_index != self.index  
  25.     @sprite_command_name.visible = @sprite_commands[0].visible  
  26.   end
  27.    
  28.   def update_battle_command(bc_sprite,index)
  29.     return if bc_sprite.disposed? # roninator2 added for error with Ring Commands
  30.         bc_sprite.visible = bc_visible?
  31.         update_bc_zoom_effect(bc_sprite,index)
  32.         update_bc_slide_effect(bc_sprite,index)
  33.         update_ring_position(bc_sprite,index) if COMMAND_TYPE == 4
  34.   end
  35.    
  36.   def create_sprite_icons
  37.         return if ![2,3,4].include?(COMMAND_TYPE)
  38.         @sprite_commands = [] ;  @sprite_zoom_phase = [] ; @sprite_command_org = []
  39.         @sprite_command_cwh = []
  40.         for index in 0...@list.size
  41.             @sprite_commands.push(Sprite.new)
  42.             if CUSTOM_ICONS_COMMANDS
  43.                 bitmap = Cache.battle_hud("Com_" + @list[0][:name].to_s)
  44.                 @sprite_commands[index].bitmap = Bitmap.new(bitmap.width,bitmap.height)
  45.             else
  46.                 @sprite_commands[index].bitmap = Bitmap.new(24,24)
  47.             end  
  48.             @sprite_commands[index].z = self.z - 1
  49.             @sprite_commands[index].opacity = 255
  50.             @sprite_commands[index].angle = COMMAND_ICON_ANGLE
  51.             @sprite_zoom_phase[index] = 0 ; @sprite_command_org[index] = [0,0]
  52.             @sprite_command_cwh[index] = [0,0]
  53.             refresh_sprite_command(index)
  54.         end
  55.         if COMMAND_TYPE == 4
  56.             refresh_layout_bt # roninator2 added for adding actor in battle
  57.             @sprite_commands[index].x = DEFAULT_COMMAND_POSITION[0] + @nxy[0] + @bex[0]
  58.             @sprite_commands[index].y = DEFAULT_COMMAND_POSITION[1] + @nxy[1] + @bex[1]
  59.             @layout_bt.ox = @layout_bt.bitmap.width / 2
  60.             @layout_bt.oy = @layout_bt.bitmap.height / 2
  61.         end        
  62.         create_sprite_command_name
  63.         @layout_bt.x = @sprite_command_org[0][0] + LAYOUT_POSITION[0]
  64.         @layout_bt.y = @sprite_command_org[0][1] + LAYOUT_POSITION[1]
  65.         @layout_bt_org = [@layout_bt.x,@layout_bt.y]
  66.   end
  67.  
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement