I am using Yanfly's Instant Cast script. Only one character has Instant, and that is only for a range of items. To achieve that, an additional script was required.
I am also using Troop Events (typically for boss fights) where, for example, a variable is keeping track of the boss's HP and when it reaches a certain point or lower, there is a Force Action. This can also happen if the troop event introduces an additional enemy after the battle scene has started.
Independently, both of these elements work smoothly and give no cause for concern. It is when they are used in conjunction that a problem occurs.
For example, the character throws a healing potion on someone. This happens immediately and then the Troop Event, of whatever type, occurs. At that point the player has a problem because this happens:

The individual actor faces and their HP/MP/TP bars vanish.
They can be brought back again by pressing ESC and the HUD appears as normal and you can then select the battle actions in the usual way. You can, if you're confident enough, select the actions successfully without the visual prompts, so it is not that battle commands have stopped working, it is just the HUD.
Can anyone suggest what is happening and a way to resolve it?
Thanks.
Code:
#=============================================================
# Moogle_X given on rpgmakerweb.com forum 29 July 2015
# Enables Yanfly's Instant Cast script to apply to using an item
# as the instant action.
# Restricts to one instant action per turn.
# Restricts to one actor ID at line #60
# Put below Yanfly's Instant Cast script.
#===========================================================
class Game_Actor < Game_Battler
attr_accessor :already_instant
alias moogle_setup_instant setup
def setup(actor_id)
moogle_setup_instant(actor_id)
@already_instant = false
end
#--------------------------------------------------------------------------
# * Processing at Start of Battle
#--------------------------------------------------------------------------
def on_battle_start
super
@already_instant = false
end
#--------------------------------------------------------------------------
# * Processing at End of Battle
#--------------------------------------------------------------------------
def on_battle_end
super
@already_instant = false
end
#--------------------------------------------------------------------------
# * Processing at End of Turn
#--------------------------------------------------------------------------
def on_turn_end
super
@already_instant = false
end
end # Game_Actor
#==============================================================================
# ¡ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# new method: instant_action?
#--------------------------------------------------------------------------
def instant_action?
return false if BattleManager.actor.nil?
return false if BattleManager.actor.input.nil?
action = BattleManager.actor.input.item
if action.is_a?(RPG::Item)
return false if BattleManager.actor.id != 3 # <= CHANGE THIS TO ACTOR ID.
end
return false if action.nil?
return false if BattleManager.actor.already_instant == true
return action.instant
end
#--------------------------------------------------------------------------
# new method: perform_instant_action
#--------------------------------------------------------------------------
def perform_instant_action
hide_instant_action_windows
@subject = BattleManager.actor
@subject.check_instant_action
if @subject.current_action.valid?
execute_action
@subject.already_instant = true
end
process_event
loop do
@subject.remove_current_action
break if $game_troop.all_dead?
break unless @subject.current_action
@subject.current_action.prepare
execute_action if @subject.current_action.valid?
end
process_action_end
@subject.make_actions
@subject.restore_instant_action
@subject = nil
show_instant_action_windows
end
end
I am also using Troop Events (typically for boss fights) where, for example, a variable is keeping track of the boss's HP and when it reaches a certain point or lower, there is a Force Action. This can also happen if the troop event introduces an additional enemy after the battle scene has started.
Independently, both of these elements work smoothly and give no cause for concern. It is when they are used in conjunction that a problem occurs.
For example, the character throws a healing potion on someone. This happens immediately and then the Troop Event, of whatever type, occurs. At that point the player has a problem because this happens:

The individual actor faces and their HP/MP/TP bars vanish.
They can be brought back again by pressing ESC and the HUD appears as normal and you can then select the battle actions in the usual way. You can, if you're confident enough, select the actions successfully without the visual prompts, so it is not that battle commands have stopped working, it is just the HUD.
Can anyone suggest what is happening and a way to resolve it?
Thanks.
