I've seen this in Trickster's RTAB and I am currently using cogwheel's RTAB and would like to know if it could be integrated somehow. What this does is that whenever a person gets attacked, their turn would be canceled out and their ATB bar would have to fill up again. Being in conjunction with the skill time system which would cancel out their turn in their duration of casting the skill.
Code:
#==============================================================================
# â—â— Action Timer
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 1.1
# Date 5/30/07
# Goto rmxp.org for updates/support/bug reports
#------------------------------------------------------------------------------
# This script is an addon for the CTB, ATB, or my RTAB script. It improves the
# Built-In Version of Action Timer and allows actions to be interrupted when
# Attacked. (Note you need the most recent version of either CTB ATB or RTAB for
# this script to function correctly)
#==============================================================================
#--------------------------------------------------------------------------
# Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Action Timer', 'Trickster', 1.1, '5/30/07')
#--------------------------------------------------------------------------
# Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2, 3, 4])
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Action Timer')
module Action_Timer
#--------------------------------------------------------------------------
# * Interruption
# - What is an Interruption?
# - Example
# proc {|battler, damage| damage > 0} means any damage > 0
# Will cause an interruption.
# - Syntax A Proc Object
#--------------------------------------------------------------------------
Interruption = proc {|battler, damage| damage > 0}
#--------------------------------------------------------------------------
# * Interruption Effect
# - Effect of Interruption
# - 0: no loss of at 1: lose action at 2: lose all at
# - Note use -1 if not using a Timer Battle System
#--------------------------------------------------------------------------
Effect = 2
#--------------------------------------------------------------------------
# * Interruption Weapons
# - Can be interrupted when using a weapon?
# - Syntax weapon_id => true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Weapons = {}
#--------------------------------------------------------------------------
# * Interruption Weapons Default
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Weapons.default = true
#--------------------------------------------------------------------------
# * Interruption Enemies
# - Can a enemies attack be interrupted?
# - Syntax enemy_id => true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Enemies = {}
#--------------------------------------------------------------------------
# * Interruption Enemies Default
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Enemies.default = true
#--------------------------------------------------------------------------
# * Interruption Skills
# - Can be interrupted when using a skill?
# - Syntax skill_id => true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Skills = {}
#--------------------------------------------------------------------------
# * Interruption Skills Default
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Skills.default = true
#--------------------------------------------------------------------------
# * Interruption Items
# - Can be interrupted when using a item?
# - Syntax item_id => true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Items = {}
#--------------------------------------------------------------------------
# * Interruption Items Default
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Items.default = true
#--------------------------------------------------------------------------
# * Interruption Defend
# - Can be interrupted when defending?
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Defend = true
#--------------------------------------------------------------------------
# * Interruption Escape
# - Can be interrupted when escaping?
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Escape = true
#--------------------------------------------------------------------------
# * Interruption Other
# - Can be interrupted when ????
# - Syntax true: can be interrupted false: otherwise
#--------------------------------------------------------------------------
Other = true
end
class Scene_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :active_battler
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias_method :trick_timer_battle_update_phase4_step5, :update_phase4_step5
def update_phase4_step5
# The Usual
trick_timer_battle_update_phase4_step5
# Run Through Target Battlers
@target_battlers.each do |battler|
# Get Battler Damage
damage = battler.damage.to_i
# Get Interrupted Flag
interrupted = Action_Timer::Interruption.call(battler, damage)
# If Damage is not a number set to false
interrupted = false unless battler.damage.is_a?(Numeric)
# Skip if not interrupted
next unless interrupted
# Setup reset flag
reset = true
# If Attacking
if battler.current_action.is_a_attack?
# If Battler is a Game Actor
if battler.is_a?(Game_Actor)
# Run Through All Weapon Ids
battler.weapon_ids.each do |weapon_id|
# And Reset Flag from Weapon
reset &&= Action_Timer::Weapons[weapon_id]
end
# Else it is an Enemy
else
# Get Reset Flag
reset = Action_Timer::Enemies[battler.id]
end
# If Using a Skill
elsif battler.current_action.is_a_skill?
# Get Skill Id
skill_id = @active_battler.current_action.skill_id
# Get Reset Flag
reset = Action_Timer::Skills[skill_id]
# If Defending
elsif battler.current_action.is_a_defend?
# Get Reset Flag
reset = Action_Timer::Defend
# If Using an Item
elsif battler.current_action.is_a_item?
# Get Item Id
item_id = @active_battler.current_action.item_id
# Get Reset Flag
reset = Action_Timer::Items[item_id]
# If Attempt to Escape
elsif battler.current_action.is_a_escape?
# Get Reset Flag
reset = Action_Timer::Escape
# If ????
else
# Get Reset Flag
reset = Action_Timer::Other
end
# Skip Unless Resetting
next unless reset
# Clear Action
battler.current_action.clear
# Branch by Effect
case Action_Timer::Effect
when 0 # No loss of At
# Set Wait to 0
battler.wait = 0
# Reinitialize At Values
initialize_at
when 1 # Lose Action At
# Run Action Cost
phase4_action_cost(battler)
# Set Wait to 0
battler.wait = 0
# Reinitialize At Values
initialize_at
when 2 # Lose All
# Reset At
battler.reset_at
# Reinitialize At Values
initialize_at
end
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end