Hide the actor status window while displaying the window for giving an item to an actor?

Sorry if the title sounds strange, I'll try to explain myself clearly.

Basically, in combat, when giving an item, the status window continues to be displayed while the other window for selecting actors is generated.

Although I was able to make it look like there was only one window by placing the actor selection window in the same position, the problem is that the actor selection bar, which you can see in the photo, is still there, so when you select another actor, this happens.

1758675014999.png


(Here, using Mikhael, I'm going to give Gabrieru an item, and as you can see, there are two selection edges.)
Basically, the selection of the main actor remains unchanged, while the other selection to choose an actor to give an item to remains unchanged, which can be confusing.
I need to know if there is any way to clear the selection of the main actor while performing this action of using an item on an actor.
Got the script?
I'm using an Earthbound-style battle script, but it's been heavily edited, so I think it's best to share my scripts.rvdata2.
I'm sorry but trying to playtest it is a real headache. Can't you zip just the specific script? Otherwise, the test game will keep throwing error after error message. :S
I'm sorry but trying to playtest it is a real headache. Can't you zip just the specific script? Otherwise, the test game will keep throwing error after error message. :S
Ok!
here is:

Ruby:
#==============================================================================
# ** Earthbound-Ish Battle Core
#------------------------------------------------------------------------------
# Version: 1.0
# Author: cozziekuns
# Date: February 17, 2013
#==============================================================================
# Description:
#------------------------------------------------------------------------------
# This script attempts to mimic the battle system of the Earthbound/Mother
# series; most notably Earthbound and Earthbound 2 (Mother 2 and 3).
#==============================================================================
# Instructions:
#------------------------------------------------------------------------------
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials. Edit the modules to your liking.
#==============================================================================

#==============================================================================
# ** Cozziekuns
#==============================================================================

module Cozziekuns
 
  module Earthboundish
    
    ActorIcons ={
      # Command Name => IconID
      "Atacar" => 528,
      "Magia" => 535,
      "Especial" => 530,
      "Defender" => 531,
      "Objeto" => 529,
      "Escapar" => 534,
    }
    
  end
 
end

include Cozziekuns

#==============================================================================
# ** Sprite Battler
#==============================================================================

class Sprite_Battler

  alias coz_ebish_spbtlr_update_effect update_effect
  def update_effect(*args)
    update_select_whiten if @effect_type == :select_white
    if @battler.sprite_effect_type == :select_white_to_normal
      revert_to_normal
      @battler.sprite_effect_type = nil
    end
    coz_ebish_spbtlr_update_effect(*args)
  end

  def update_select_whiten
    self.color.set(255, 255, 255, 0)
    self.color.alpha = 128
  end
 
end

#==============================================================================
# ** Window_ActorCommand
#==============================================================================

class Window_ActorCommand

  def visible_line_number
    return 2
  end

  def col_max
    return 3
  end

#~   def contents_height
#~     item_height
#~   end

#~   def top_col
#~     ox / (item_width + spacing)
#~   end

#~   def top_col=(col)
#~     col = 0 if col < 0
#~     col = col_max - 1 if col > col_max - 1
#~     self.ox = col * (item_width + spacing)
#~   end

#~   def bottom_col
#~     top_col + col_max - 1
#~   end

#~   def bottom_col=(col)
#~     self.top_col = col - (col_max - 1)
#~   end

#~   def ensure_cursor_visible
#~     self.top_col = index if index < top_col
#~     self.bottom_col = index if index > bottom_col
#~   end

#~   def item_rect(index)
#~     rect = super
#~     rect.x = index * (item_width + spacing)
#~     rect.y = 0
#~     rect
#~   end

  def window_width
    Graphics.width - 234
  end
 
  def window_height
    Graphics.height - 344
  end
 
  def open
    @help_window.open
    super
  end
 
  def close
    @help_window.close
    super
  end
 
  def update
    super
    @help_window.update
  end
 
  def draw_item(index)
    rect = item_rect_for_text(index)
    x = rect.x + rect.width / 2 - 12
    y = item_rect_for_text(index).y
    draw_text(rect.x + 28, rect.y, 92, line_height, command_name(index), 0)
    draw_icon(Earthboundish::ActorIcons[command_name(index)], x + -40, y, command_enabled?(index))
  end
 
  alias coz_ebish_waccmd_make_command_list make_command_list
  def make_command_list(*args)
    coz_ebish_waccmd_make_command_list(*args)
    add_escape_command
  end
 
  def add_escape_command
    add_command(Vocab::escape, :escape, BattleManager.can_escape?)
  end
 
  def update_help
    @help_window.set_text(command_name(index))
  end
 
end

#==============================================================================
# ** Window_BattleStatus
#==============================================================================

class Window_BattleStatus
 
  [:basic_area_rect, :gauge_area_rect].each { |method|
    define_method(method) { |index|
      rect = item_rect(index)
      rect
    }
  }
 
  def col_max
    $game_party.members.size
  end
 
  def window_width
    Graphics.width / ( 4 / $game_party.members.size.to_f )
  end
 
  def window_height
    fitting_height($data_system.opt_display_tp ? 5 : 4)
  end
 
  def item_width
    (window_width - standard_padding * 2) / $game_party.members.size
  end
 
  def item_height
    (window_height - standard_padding * 5.5)
  end
 
  def draw_basic_area(rect, actor)
    draw_actor_name(actor, rect.x, rect.y, rect.width)
    draw_actor_icons(actor, rect.x + 84, rect.y + -1)
  end

  def draw_gauge_area_with_tp(rect, actor)
    draw_gauge_area_without_tp(rect, actor)
    draw_actor_tp(actor, rect.x + 4, rect.y + 54, rect.width - 8)
  end

  def draw_gauge_area_without_tp(rect, actor)
    draw_actor_hp(actor, rect.x + 4, rect.y + 16, rect.width - 8)
    draw_actor_mp(actor, rect.x + 4, rect.y + 34, rect.width - 8)
  end
 
  def draw_actor_name(actor, x, y, width = 112)
    change_color(hp_color(actor))
    draw_text(x + -25, y + -2, width, line_height, actor.name, 1)
  end
 
  alias coz_ebish_wbtlsts_item_rect item_rect
  def item_rect(index, *args)
    rect = coz_ebish_wbtlsts_item_rect(index, *args)
    rect.x = index % col_max * item_width
    rect
  end
 
  def update
    super
    update_position
  end
 
  def update_position
    self.x = 120
    self.y = 52
  end
 
end

#==============================================================================
# ** Window_BattleActor
#==============================================================================

class Window_BattleActor
 
  def update_position
    self.x = -8
  end
 
end

#==============================================================================
# ** Window_BattleEnemy
#==============================================================================

class Window_BattleEnemy
 
  def cursor_left(wrap)
    select((index - 1 + item_max) % item_max)
  end
 
  def cursor_right(wrap)
    select((index + 1) % item_max)
  end
 
  def cursor_up(wrap)
    cursor_left(true)
  end
 
  def cursor_down(wrap)
    cursor_right(true)
  end

  def show
    select(0)
    self
  end
 
  def update_help
    @help_window.set_text(enemy.name)
  end

end

#==============================================================================
# ** Window_BattleSkill + Window_BattleItem
#==============================================================================

[:Window_BattleSkill, :Window_BattleItem].each { |klass|
  Object.const_get(klass).send(:define_method, :show) {
    select_last
    super()
  }
  Object.const_get(klass).send(:define_method, :hide) { super() }
}

#==============================================================================
# ** Window_ActorHelp
#==============================================================================

class Window_ActorHelp < Window_Help
 
  def initialize
    super(-1)
    self.openness = 0
    update_position
  end
 
  def update_position
    self.x = Graphics.width - 224
    self.width = 224
    create_contents
  end
 
  def refresh
    contents.clear
    draw_text(4, 0, 224 - standard_padding * 2, line_height, @text, 1)
  end
 
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
 
  def start_party_command_selection
    unless scene_changing?
      @status_window.open
      @status_window.refresh
      if BattleManager.input_start
        next_command
        start_actor_command_selection
      else
        @party_command_window.deactivate
        turn_start
      end
    end
  end
 
  def create_actor_command_window
    @actor_command_window = Window_ActorCommand.new
    @actor_command_window.set_handler(:attack, method(:command_attack))
    @actor_command_window.set_handler(:skill,  method(:command_skill))
    @actor_command_window.set_handler(:guard,  method(:command_guard))
    @actor_command_window.set_handler(:item,   method(:command_item))
    @actor_command_window.set_handler(:escape, method(:command_escape))
    @actor_command_window.set_handler(:cancel, method(:prior_command))
    @actor_command_window.help_window = Window_ActorHelp.new
  end
 
  def create_help_window
    @help_window = Window_Help.new(1)
    @help_window.visible = false
  end
 
  alias coz_ebish_scbtl_create_enemy_window create_enemy_window
  def create_enemy_window(*args)
    coz_ebish_scbtl_create_enemy_window(*args)
    @enemy_window.help_window = @actor_command_window.help_window
  end
 
  alias coz_ebish_scbtl_update_basic update_basic
  def update_basic(*args)
    old_enemy = @enemy_window.active ? @enemy_window.enemy : nil
    coz_ebish_scbtl_update_basic(*args)
    update_enemy_whiten(old_enemy)
  end
 
  def update_enemy_whiten(old_enemy)
    if !@enemy_window.active or old_enemy != @enemy_window.enemy
      old_enemy.sprite_effect_type = :select_white_to_normal if old_enemy && !old_enemy.dead?
    end
    @enemy_window.enemy.sprite_effect_type = :select_white if @enemy_window.active
  end
 
  def update_info_viewport
    move_info_viewport(128)
  end

end

Here is a addon:

Ruby:
#==============================================================================
# Earthbound-Ish Battle Core Fix
#------------------------------------------------------------------------------
# Version: 1.0
# Author: Yoroiookami
# Date: September 08, 2024
#==============================================================================
# This script fixes an issue with battles freezing when an enemy with different
# index than 0 is selected.
#
# Paste this script into its own slot in the Script Editor, below the original
# script.
#==============================================================================
 
 
 
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  alias yoroiookami_on_action_end on_action_end
  def on_action_end
    yoroiookami_on_action_end
    $game_troop.alive_members.each do |enemy|
      if enemy
        if !SceneManager.scene.sprite_battler(enemy).color_is_normal?
          enemy.sprite_effect_type = :select_white_to_normal
        end
      end
    end
  end
end
 
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  def sprite_battler(battler)
    @spriteset.battler_sprites.find { |sprite| sprite.battler == battler }
  end
 
  def update_enemy_whiten(old_enemy)
    if @enemy_window.enemy && @enemy_window.active
      @enemy_window.enemy.sprite_effect_type = :select_white
    end
    use_tissue_on_enemies
  end
 
  def use_tissue_on_enemies
    $game_troop.alive_members.each do |enemy|
      if enemy && sprite_battler(enemy).last_effect_type === :select_white
        if @enemy_window.active && @enemy_window.enemy
          if enemy.index != @enemy_window.enemy.index && !sprite_battler(enemy).color_is_normal?
            enemy.sprite_effect_type = :select_white_to_normal
          end
        end
        if !@enemy_window.active && !sprite_battler(enemy).color_is_normal?
           enemy.sprite_effect_type = :select_white_to_normal
         end
       end
    end
  end
end
 
#==============================================================================
# Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
  attr_accessor :last_effect_type
 
  def color_is_normal?
    color = self.color
    color.red == 0 && color.green == 0 && color.blue == 0 && color.alpha == 0
  end
 
  alias yoroiookami_start_effect start_effect
  def start_effect(effect_type)
    @last_effect_type = effect_type
    case effect_type
    when :select_white
      @effect_duration = 16
      @battler_visible = true
    when :select_white_to_normal
      @effect_duration = 1
      @battler_visible = true
      revert_to_normal
    end
    yoroiookami_start_effect(effect_type)
  end
 
  alias yoroiookami_update_effect update_effect
  def update_effect
    yoroiookami_update_effect
    if @effect_duration >= 0
      case @effect_type
      when :select_white
        update_select_whiten
      when :select_white_to_normal
        @effect_type = nil
        @effect_duration == 0
      end
    end
  end
end
I'm sorry but trying to playtest it is a real headache. Can't you zip just the specific script? Otherwise, the test game will keep throwing error after error message. :S
1758691368849.png

In addition to this being a test, you can see the previous window, so a solution would be to delete this window while selecting the actor to give the item to, and when this is finished, the window returns
My first impression is that keeping two status windows is a bug you created.
To make the blinking selection box to disappear, you need to call this:

Ruby:
@status_window.unselect

Of course, that will only help you if you now WHEN you should use it. If the partially hidden window, needs to go away temporarily, go hide it.

Ruby:
@status_window.hide

If that extra window is not the real status window, just replace @status_window with the actual variable that holds that window object.
Try adding these three methods to the Earthbound battle core under scene_battle
Start_party_command_selection shown to just indicate to you that it is in scene_battle.
The three methods can go at the bottom or you can make it another script, just add an end to it and remove the party_command_selection I'm showing. Options...
Spoiler: hide battle status
Ruby:
class Scene_Battle
 
  def start_party_command_selection
    unless scene_changing?
      @status_window.open
      @status_window.refresh
      if BattleManager.input_start
        next_command
        start_actor_command_selection
      else
        @party_command_window.deactivate
        turn_start
      end
    end
  end
 
  alias :r2_actor_select_hide_status   :select_actor_selection
  def select_actor_selection
    r2_actor_select_hide_status
    @status_window.hide
  end
 
  alias :r2_actor_ok_hide_status   :on_actor_ok
  def on_actor_ok
    @status_window.show
    r2_actor_ok_hide_status
  end
 
  alias :r2_actor_cancel_hide_status   :on_actor_cancel
  def on_actor_cancel
    r2_actor_cancel_hide_status
    @status_window.show
  end
Try adding these three methods to the Earthbound battle core under scene_battle
Start_party_command_selection shown to just indicate to you that it is in scene_battle.
The three methods can go at the bottom or you can make it another script, just add an end to it and remove the party_command_selection I'm showing. Options...
Spoiler: hide battle status
Ruby:
class Scene_Battle
 
  def start_party_command_selection
    unless scene_changing?
      @status_window.open
      @status_window.refresh
      if BattleManager.input_start
        next_command
        start_actor_command_selection
      else
        @party_command_window.deactivate
        turn_start
      end
    end
  end
 
  alias :r2_actor_select_hide_status   :select_actor_selection
  def select_actor_selection
    r2_actor_select_hide_status
    @status_window.hide
  end
 
  alias :r2_actor_ok_hide_status   :on_actor_ok
  def on_actor_ok
    @status_window.show
    r2_actor_ok_hide_status
  end
 
  alias :r2_actor_cancel_hide_status   :on_actor_cancel
  def on_actor_cancel
    r2_actor_cancel_hide_status
    @status_window.show
  end
My first impression is that keeping two status windows is a bug you created.
To make the blinking selection box to disappear, you need to call this:

Ruby:
@status_window.unselect

Of course, that will only help you if you now WHEN you should use it. If the partially hidden window, needs to go away temporarily, go hide it.

Ruby:
@status_window.hide

If that extra window is not the real status window, just replace @status_window with the actual variable that holds that window object.
That worked!

Thank you both so much for your help!

Original thread: https://forums.rpgmakerweb.com/threads/hide-the-actor-status-window-while-displaying-the-window-for-giving-an-item-to-an-actor.180267/