Here is the script that is the problem
#===============================================================================
#===============================================================================
# BATTLER
#===============================================================================
#===============================================================================
#===============================================================================
# SENSOR
#===============================================================================
module XRXS_EnemySensor
#--------------------------------------------------------------------------
# Update Sensor
#--------------------------------------------------------------------------
def update_sensor
if self.battler != nil and self.battler.is_a?(Game_Enemy)
enemy_sensor = XAS_BA_ENEMY::ENEMY_SENSOR[self.battler.id]
end
if enemy_sensor != nil
@sensor_range = enemy_sensor
else
@sensor_range = $game_variables[XAS_BA_ENEMY::DEFAULT_ENEMY_SENSOR_VARIABLE_ID]
end
if self.battler != nil and (self.knockbacking? or
self.battler.xas_states_stop == true or
self.battler.xas_states_sleep == true or
self.battler.hp == 0 or
self.throw_on == true)
@sensor_range = -1
end
distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
enable = (distance <= @sensor_range)
key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
last_enable = $game_self_switches[key]
last_enable = false if last_enable == nil
if enable != last_enable
$game_self_switches[key] = enable
$game_map.need_refresh = true
end
end
end
#===============================================================================
# Game_Event
#===============================================================================
class Game_Event < Game_Character
include XRXS_EnemySensor
end
#===============================================================================
# Game_Player
#===============================================================================
class Game_Player < Game_Character
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# Battler
#--------------------------------------------------------------------------
def battler
return $game_party.actors[0]
end
#--------------------------------------------------------------------------
# Defeat Process
#--------------------------------------------------------------------------
def defeat_process
super
if XAS_BA::AUTOGAMEOVER == true
$scene = Scene_Gameover.new rescue nil if self.collapse_done
else
$game_switches[XAS_BA::GAMEOVER_SWITCH_ID] = true
$game_map.refresh
end
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias xrxs64c_update update
def update
xrxs64c_update
self.battler.remove_states_auto if self.battler != nil
if self.collapse_done
self.collapse_done = false
@xrxs64c_defeat_done = false
end
end
end
#===============================================================================
# Game Event
#===============================================================================
class Game_Event < Game_Character
include XRXS_BattlerAttachment
#--------------------------------------------------------------------------
# Battler
#--------------------------------------------------------------------------
def battler
return @battler
end
#--------------------------------------------------------------------------
# Refresh
#--------------------------------------------------------------------------
alias xrxs64c_refresh refresh
def refresh
xrxs64c_refresh
self.battler_recheck
end
#--------------------------------------------------------------------------
# Battler Recheck
#--------------------------------------------------------------------------
def battler_recheck
return if @battler != nil
if @page == nil
return
end
@enemy_id = 0
for page in @event.pages.reverse
condition = page.condition
if condition.variable_valid and
condition.variable_id == XAS_BA::ENEMY_ID_VARIABLE_ID and
(!condition.switch1_valid or $game_switches[condition.switch1_id]) and
(!condition.switch2_valid or $game_switches[condition.switch2_id])
@enemy_id = condition.variable_value
break
end
end
if @enemy_id == 0
return
end
troop_id = -1
member_index = -1
for troop in $data_troops
next if troop == nil
for enemy in troop.members
if enemy.enemy_id == @enemy_id
troop_id = $data_troops.index(troop)
member_index = troop.members.index(enemy)
break
end
end
end
if troop_id != -1 and member_index != -1
@battler = Game_Enemy.new(troop_id, member_index)
end
end
#--------------------------------------------------------------------------
# Enemy Id
#--------------------------------------------------------------------------
def enemy_id
self.battler
return @enemy_id
end
#--------------------------------------------------------------------------
# Treasure Dispose
#--------------------------------------------------------------------------
def treasure_dispose
if self.battler == nil and self.is_a?(Game_Event)
for pg in @event.pages
if pg.condition.variable_id == 10000 and
pg.condition.variable_value > 0
pg.condition.variable_value -= 1
if pg.condition.variable_value < 100
self.zoom_x -= 0.01 if self.zoom_x > 0.01
end
elsif pg.condition.variable_id == 10000 and
pg.condition.variable_value == 0
$game_map.remove_token(self)
end
end
end
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias xrxs64c_update update
def update
if @collapse_wait_count.to_i > 0
@collapse_wait_count -= 1
if @collapse_wait_count == 0
@collapse_wait_count = nil
$game_map.remove_token(self)
end
return
end
treasure_dispose
update_sensor
xrxs64c_update
if self.battler != nil
self.battler.remove_states_auto
end
if self.collapse_duration.to_i > 0
@through = true
end
if self.collapse_done
@opacity = 0
@collapse_wait_count = 32
return
end
end
#--------------------------------------------------------------------------
# Hit Reaction ON
#--------------------------------------------------------------------------
def hit_reaction_on
self.hit_reaction = true
end
#--------------------------------------------------------------------------
# Hit Reaction Off
#--------------------------------------------------------------------------
def hit_reaction_off
self.hit_reaction = false
end
#--------------------------------------------------------------------------
# Hp Hit Reaction
#--------------------------------------------------------------------------
def hp_hit_reaction(on)
lowhp = self.battler.maxhp * XAS_BA_ENEMY::LOWHP / 100
if self.battler.hp > lowhp
self.hit_reaction = on
else
if on == true
self.hit_reaction = false
else
self.hit_reaction = true
end
end
end
#--------------------------------------------------------------------------
# Hero Level Hit Reaction
#--------------------------------------------------------------------------
def hero_level_hit_reaction(level,on)
actor = $game_party.actors[0]
if actor.level >= level
self.hit_reaction = on
else
if on == true
self.hit_reaction = false
else
self.hit_reaction = true
end
end
end
#--------------------------------------------------------------------------
# Shield Enable!
#--------------------------------------------------------------------------
def shield_enable!
@shield_disable = nil
end
#--------------------------------------------------------------------------
# Shield Disable!
#--------------------------------------------------------------------------
def shield_disable!
@shield_disable = true
end
#--------------------------------------------------------------------------
# LowHP Shield
#--------------------------------------------------------------------------
def lowhp_shield(on)
lowhp = self.battler.maxhp * XAS_BA_ENEMY::LOWHP / 100
if on == true
@shield_disable = true
elsif on == false
@shield_disable = nil
end
end
#--------------------------------------------------------------------------
# Hero HP Shield
#--------------------------------------------------------------------------
def hp_shield(on)
lowhp = self.battler.maxhp * XAS_BA_ENEMY::LOWHP / 100
if self.battler.hp > lowhp
if on == true
@shield_disable = nil
else
@shield_disable = true
end
else
if on == true
@shield_disable = true
else
@shield_disable = nil
end
end
end
#--------------------------------------------------------------------------
# Hero Level Shield
#--------------------------------------------------------------------------
def hero_level_shield(level,on)
actor = $game_party.actors[0]
if actor.level >= level
if on == true
@shield_disable = nil
else
@shield_disable = true
end
else
if on == true
@shield_disable = true
else
@shield_disable = nil
end
end
end
#--------------------------------------------------------------------------
# Shield Directions
#--------------------------------------------------------------------------
def shield_directions
set = @shield_disable ? [] : XAS_BA_ENEMY::SHILED_DIRECTIONS[self.enemy_id]
set = [] if set == nil
return set
end
#--------------------------------------------------------------------------
# Shield Actions
#--------------------------------------------------------------------------
def shield_actions
set = XAS_BA_ENEMY::SHILED_ACTIONS[self.enemy_id]
set = [] if set == nil
return set
end
#--------------------------------------------------------------------------
# Knock Back Disable
#--------------------------------------------------------------------------
def knock_back_disable
return XAS_BA_ENEMY::KNOCK_BACK_DISABLES.include?(self.enemy_id)
end
#--------------------------------------------------------------------------
# Body Size
#--------------------------------------------------------------------------
def body_size
return XAS_BA_ENEMY::BODY_SQUARE[self.enemy_id].to_i
end
#--------------------------------------------------------------------------
# Defeat Process
#--------------------------------------------------------------------------
def defeat_process
super
enemy_defeat_process(self.battler)
enemy_defeat_animation = XAS_BA_ENEMY::DEF_ANI[enemy_id]
if XAS_BA_ENEMY::DEF_ANI[enemy_id] != nil and not
terrain_tag == XAS::FALL_TERRAIN
self.animation_id = enemy_defeat_animation
end
end
end
#===============================================================================
# Game Event
#===============================================================================
class Game_Event < Game_Character
attr_reader :collision_attack
#--------------------------------------------------------------------------
# Img Act Exist?
#--------------------------------------------------------------------------
def img_act_exist?
RPG::Cache.character(@page.graphic.character_name + "_Act" , @page.graphic.character_hue) rescue return false
end
#--------------------------------------------------------------------------
# Attack ON
#--------------------------------------------------------------------------
def attack_on
if self.battler.is_a?(Game_Enemy) and
(self.battler.states.include?(XAS::MUTE_ID) or
self.battler.states.include?(XAS::SEALATTACK_ID))
@collision_attack = false
self.battler.damage = XAS::SEALED_TEXT
self.battler.damage_pop = true
return false
end
@collision_attack = true
self.animation_id = self.battler.animation1_id
if img_act_exist?
@character_name = @page.graphic.character_name + "_Act"
end
end
#--------------------------------------------------------------------------
# Attack Off
#--------------------------------------------------------------------------
def attack_off
@collision_attack = false
@character_name = @page.graphic.character_name
end
end
#===============================================================================
# Game_Player
#===============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# Check Event Trigger Touch
#--------------------------------------------------------------------------
alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
def check_event_trigger_touch(x, y)
xrxs64c_check_event_trigger_touch(x, y)
if $game_system.map_interpreter.running?
return
end
for event in $game_map.events.values
next unless event.collision_attack
unless [1,2].include?(event.trigger)
if event.battler != nil and event.x == x and event.y == y
$game_player.attack_effect(event)
end
end
end
end
end
#===============================================================================
# Game_Event
#===============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# Check Event Trigger Touch
#--------------------------------------------------------------------------
alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
def check_event_trigger_touch(x, y)
xrxs64c_check_event_trigger_touch(x, y)
if $game_system.map_interpreter.running?
return
end
return unless self.collision_attack
if self.battler != nil and x == $game_player.x and y == $game_player.y
$game_player.attack_effect(self)
end
end
end
#===============================================================================
# XAS_BA_BATTLEEVENT_NONPREEMPT
#===============================================================================
module XAS_BA_BATTLEEVENT_NONPREEMPT
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
return if self.battler != nil and $game_system.map_interpreter.running?
super
end
end
#===============================================================================
# Game_Event
#===============================================================================
class Game_Event < Game_Character
include XAS_BA_BATTLEEVENT_NONPREEMPT
end
#===============================================================================
# Sprite_Character
#===============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias xrxs64c_update update
def update
if @battler == nil
@battler = @character.battler
end
xrxs64c_update
if @battler == nil or @_collapse_duration > 0 or
@character.collapse_done
return
end
if @battler.hiblink_duration.is_a?(Numeric)
if XAS_BA::BLINK_ON == true
@character.opacity = (@character.opacity + 70) % 190 + 40
end
if XAS_ABS_SETUP::BATTLER_SHAKE_EFFECT == true and @character.knockbacking?
self.x = @character.screen_x + rand(5)
end
@battler.hiblink_duration -= 1
if @battler.hiblink_duration <= 0
@battler.hiblink_duration = nil
@character.opacity = 255
end
end
end
end
#===============================================================================
# Game_Character
#===============================================================================
class Game_Character
#--------------------------------------------------------------------------
# Blow
#--------------------------------------------------------------------------
def blow(d, power = 1)
@knock_back_prespeed = @move_speed if @knock_back_prespeed == nil
if self.knock_back_disable and (self.battler.xas_states_sleep == true or
self.battler.xas_states_stop == true)
@move_speed = XAS_BA::KNOCK_BACK_SPEED
end
return if self.knock_back_disable
power.times do
if passable?(self.x, self.y, d)
@x += ([3,6,9].include?(d) ? 1 : [1,4,7].include?(d) ? -1 : 0)
@y += ([1,2,3].include?(d) ? 1 : [7,8,9].include?(d) ? -1 : 0)
end
end
if self.battler.is_a?(Game_Enemy)
enemy_knock_duration = XAS_BA_ENEMY::INVICIBLE_DURATION_ENEMY[enemy_id]
if enemy_knock_duration != nil
@knock_back_duration = enemy_knock_duration
else
@knock_back_duration = XAS_BA_ENEMY::DEFAULT_INVICIBLE_DURATION_ENEMY
end
else
@knock_back_duration = XAS_BA::KNOCK_BACK_DURATION_HERO
end
@move_speed = XAS_BA::KNOCK_BACK_SPEED
end
#--------------------------------------------------------------------------
# Hit Image Check
#--------------------------------------------------------------------------
def hit_image_check
if self.battler.is_a?(Game_Enemy)
@collision_attack = false
if img_hit_enemy_exist? and not
self.battler.xas_states_stop == true
@character_name = @page.graphic.character_name + "_Hit"
end
else
if img_hit_actor_exist?(@actor) and not
self.battler.xas_states_stop == true
@character_name = @actor.character_name + "_Hit"
end
end
end
#--------------------------------------------------------------------------
# Fall Effect Update
#--------------------------------------------------------------------------
def fall_effect_update
unless moving? or jumping? or
self.is_a?(Game_Player)
if terrain_tag == XAS::FALL_TERRAIN and
terrain_tag != nil and
fall_check?(@x, @y, @direction) and
@fall_safe_time == 0 and
self.through == false
if @erased == false
for event in $game_map.events.values
self.animation_id = XAS::FALL_ANIMATION_ID
end
self.erase
end
end
end
if terrain_tag == XAS::SLIP_TERRAIN and @through == false and
fall_check2?(@x, @y, @direction)
unless self.is_a?(Game_Player) and
$game_system.fly == true
jump(0,0) unless jumping?
@y += 1
end
end
end
#--------------------------------------------------------------------------
# knockbacking?
#--------------------------------------------------------------------------
def knockbacking?
return @knock_back_duration != nil
end
#--------------------------------------------------------------------------
# Collapsing?
#--------------------------------------------------------------------------
def collapsing?
return self.collapse_duration.to_i > 0
end
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
alias xrxs64c_nb_update update
def update
@stop_count = -1 if self.knockbacking? or self.dead?
@fall_safe_time -= 1 if @fall_safe_time > 0
xrxs64c_nb_update
throw_update
fall_effect_update
if self.knockbacking?
hit_image_check
@pattern = 0
unless self.battler.xas_states_stop == true or
self.battler.xas_states_sleep == true or
self.dead?
@knock_back_duration -= 1
end
if @knock_back_duration <= 0
unless self.erased == true
if self.battler.is_a?(Game_Enemy)
@character_name = @page.graphic.character_name
else
@character_name = @actor.character_name
end
end
@knock_back_duration = nil
@move_speed = @knock_back_prespeed
@knock_back_prespeed = nil
end
return
end
end
end
#===============================================================================
# XAS_DamageStop
#===============================================================================
module XAS_DamageStop
#--------------------------------------------------------------------------
# Actiong?
#--------------------------------------------------------------------------
def acting?
return (super or self.knockbacking? or self.collapsing?)
end
end
#===============================================================================
# Game_Player
#===============================================================================
class Game_Player < Game_Character
include XAS_DamageStop
end
#===============================================================================
# Game_Event
#===============================================================================
class Game_Event < Game_Character
include XAS_DamageStop
end
#===============================================================================
# module RPG
#===============================================================================
module RPG
class Sprite < ::Sprite
#--------------------------------------------------------------------------
# Dispose Animation
#--------------------------------------------------------------------------
def dispose_animation
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
end
end
#===============================================================================
# Game_Map
#===============================================================================
class Game_Map
#--------------------------------------------------------------------------
# Starting?
#--------------------------------------------------------------------------
def starting?
if $game_system.map_interpreter.running?
return true
end
for event in $game_map.events.values
return true if event.starting
end
return false
end
end
#===============================================================================
# class Interpreter
#===============================================================================
module XAS_ACTION
#--------------------------------------------------------------------------
# Xas Z Shoot Bullet
#--------------------------------------------------------------------------
alias xas_z_shoot_bullet shoot_bullet
def shoot_bullet(action_id)
bullet_token = xas_z_shoot_bullet(action_id)
return bullet_token
end
end
#===============================================================================
# Sprite_Battler Fix
#===============================================================================
class Sprite_Battler < RPG::Sprite
alias xas_damage_update update
#--------------------------------------------------------------------------
# Update
#--------------------------------------------------------------------------
def update
super
if @battler_visible
if @battler.damage_pop
damage(@battler.damage, @battler.critical,@battler.state,@battler.item)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
end
xas_damage_update
end
end