Nevermind, here's the script.
I think it's not compatible with Tankentai, but I hope you can rearrange it...
CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud counterattack script v 1.0
# # -free use, just credit
# # -free customization, however, posting on RRR the modified version is
# # mandatory
# # -you can find me on www.rpgrevoultion.com
#=#============================================================================
#==============================================================================
#==============================================================================
# ** Constants
#==============================================================================
COUNTERATTACK_ENEMY_ID = [] #id of enemies counter attacking by default
COUNTERATTACK_WEAPON_ID = [] #id of weapons triggering counters
COUNTERATTACK_ARMOR_ID = [] #id of armors triggering counters
COUNTERATTACK_STATUS_ID = [] #id of status triggering counters
COUNTERATTACK_HERO_ID = [] #id of heroes counter attacking by default
#==============================================================================
# ** Game_BattleAction
#==============================================================================
class Game_BattleAction
attr_accessor :counter
#--------------------------------------------------------------------------
# * aliases
#--------------------------------------------------------------------------
alias joz3_counterattack_initialize initialize
alias joz3_counterattack_clear clear
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
joz3_counterattack_initialize
@counter = false
end
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
def clear
joz3_counterattack_clear
@counter = false
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Store_Action
#--------------------------------------------------------------------------
def store_action
@backup_action = self.current_action
end
#--------------------------------------------------------------------------
# * Restore_Action
#--------------------------------------------------------------------------
def restore_action
if @backup_action != nil
@current_action = @backup_action
end
end
#--------------------------------------------------------------------------
# * Prepare Counterattack
#--------------------------------------------------------------------------
def prepare_counterattack(index)
store_action
@current_action.kind = 0
@current_action.basic = 0
@current_action.target_index = index
@current_action.counter = true
end
#--------------------------------------------------------------------------
# * Can_Counterattack?
#--------------------------------------------------------------------------
def can_counterattack?
#hp check
if self.hp0?
return false
end
#input check
if !self.inputable?
return false
end
#status check
for id in COUNTERATTACK_STATUS_ID
if self.state?(id)
return true
end
end
return false
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Can_Counterattack?
#--------------------------------------------------------------------------
def can_counterattack?
#hero check
if COUNTERATTACK_HERO_ID.include?(self.id)
return true
end
#weapon check
if COUNTERATTACK_WEAPON_ID.include?(@weapon_id)
return true
end
#armor check
if COUNTERATTACK_ARMOR_ID.include?(@armor1_id) or
COUNTERATTACK_ARMOR_ID.include?(@armor2_id) or
COUNTERATTACK_ARMOR_ID.include?(@armor3_id) or
COUNTERATTACK_ARMOR_ID.include?(@armor4_id)
return true
end
super
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Can_Counterattack?
#--------------------------------------------------------------------------
def can_counterattack?
#id check
if COUNTERATTACK_ENEMY_ID.include?(self.id)
return true
end
super
end
end
#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (main phase step 3 : animation for action performer)
#--------------------------------------------------------------------------
def update_phase4_step3
# Animation for action performer (if ID is 0, then white flash)
if @active_battler.current_action.counter
@help_window.set_text(@active_battler.name + ": Counter Attack!", 1)
end
if @animation1_id == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
# Shift to step 4
@phase4_step = 4
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
def update_phase4_step4
# Animation for target
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
if @active_battler.current_action.kind == 0 and
@active_battler.current_action.basic == 0 and
@active_battler.current_action.counter == false
target = @target_battlers[0]
if target.can_counterattack?
target.prepare_counterattack(@active_battler.index)
@counterattack_flag = true
end
end
# Animation has at least 8 frames, regardless of its length
@wait_count = 8
# Shift to step 5
@phase4_step = 5
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
def update_phase4_step5
# Hide help window
@help_window.visible = false
# Refresh status window
@status_window.refresh
# Display damage
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
end
# Shift to step 6
@phase4_step = 6
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 6 : refresh)
#--------------------------------------------------------------------------
def update_phase4_step6
# Clear battler being forced into action
if @counterattack_flag
counter_update
return
end
if @active_battler.current_action.counter
@active_battler.restore_action
@active_battler.current_action.counter = false
end
$game_temp.forcing_battler = nil
# If common event ID is valid
if @common_event_id > 0
# Set up event
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# Shift to step 1
@phase4_step = 1
end
#--------------------------------------------------------------------------
# * Counter Update
#--------------------------------------------------------------------------
def counter_update
@counterattack_flag = false
# Initialize animation ID and common event ID
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# Shift from head of actionless battlers
@active_battler = @target_battlers[0]
# If already removed from battle
# Natural removal of states
@active_battler.remove_states_auto
# Refresh status window
@status_window.refresh
# Shift to step 2
@phase4_step = 2
end
end
HOW TO USE:Just set the constants...
e.g.
COUNTERATTACK_ENEMY_ID = [1,3,7] #id of enemies counter attacking by default
COUNTERATTACK_WEAPON_ID = [2,12] #id of weapons triggering counters
COUNTERATTACK_ARMOR_ID = [10,14] #id of armors triggering counters
COUNTERATTACK_STATUS_ID = [1,6] #id of status triggering counters
COUNTERATTACK_HERO_ID = [9] #id of heroes counter attacking by default
Ask for troubleshooting anytime.
Jens