Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

ATOA ACBS Skill Reflect: Bug when en enemy dies

Folks, im using ATOA ACBS battle script with the reflect addon for the RPG XP.
But theres a problem.
Whenever en enemy makes a skill which is reflected to himself and when he dies, the game freezes when I want to attack the next enemy.

Its hard for me to tell it in words since Im a german.
So I've uploaded a demo where you will understand immediately.

Basicially you have to this. Just attack the enemy again and again. When a enemy will use a fire skill it will be reflected and kill him, then just continue to attack another enemy. It wont happen because the game will freeze.

Anyone knows the answer to my problem?
Heres the demo:
https://workupload.com/file/DvSbVNm
 
1. You are very fast.
2. I have the same idea but as I looked at the text, I couldnt see any bug. But Im also not a scriper.
Im going to post the code of the script here for people who dont want to download anything.

#==============================================================================
# Skill Reflect
# By Atoa
#==============================================================================
# The battler with the effect of reflect status will have all magical skills
# targeted on him reflected to the uses.
# All skills with the status 'Atk_f' = 0 are considered Magics.
#
# This script must be above all other skills scripts.
#==============================================================================

module Atoa
# Do not remove these lines
Reflection_State = {}
Ignore_Reflect_Magics = {}
# Do not remove these lines

# If true, actions reflected alway return to the user
# If false, actions reflected will be targeted on the opposite party
Reflect_Bounce_User = true

# Skills that ignores Reflect effect.Habilidades que ignoram o efeito Refletir.
Ignore_Reflect_Magics[290] = [17]
Ignore_Reflect_Magics[910] = [17]
Ignore_Reflect_Magics[998] = [17]
Ignore_Reflect_Magics[997] = [17]
# Ignore_Reflect_Magics[Skill_ID] = [States]
# Skill_ID = ID of the skills
# States = IDs of the reflect states ignored

# Reflection_State[state_id] = {type =>[user_dmg, target_dmg, reflect_rate, anim_id]}
# state_id = ID of the state
# type = type of damage reflected
# user_dmg = % of damage recived by action user
# target_dmg = % of damage recived by targets
# reflect_rate = reflection success rate
# amim_id = animation id shown when reflect
Reflection_State[17] = {'Magic' => [11505, 0,100, 134]}
Reflection_State[18] = {'Physic' => [1150, 0, 70, 400]}
Reflection_State[19] = {'Magic' => [0, 0, 100, 405]}
Reflection_State[20] = {'Physic' => [0, 0, 100, 405]}
#Reflection_State[18] = {'Physic' => [50, 0, 100, 104]}
#Reflection_State[19] = {'Magic' => [0, 0, 100, 105]}
#Reflection_State[20] = {'Physic' => [0, 0, 100, 106]}
#Reflection_State[25] = {'Magic' => [50, 50, 50, 103], 'Physic' => [50, 50, 50, 104]}

end

#==============================================================================
# ** Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Reflect'] = true

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :reflected
attr_accessor :reflects
attr_accessor :reflection
attr_accessor :reflect_set
attr_accessor :eek:ld_targets
attr_accessor :new_targets
attr_accessor :reflect_times
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_skillreflect initialize
def initialize
initialize_skillreflect
@reflect_times = 1
@old_targets = []
@new_targets = []
end
#--------------------------------------------------------------------------
# * Check Reflection
# action : action
#--------------------------------------------------------------------------
def check_reflection(action = nil)
for reflect in Reflection_State.keys
if @states.include?(reflect) and reflected_action(action, Reflection_State[reflect])
reflection = Reflection_State[reflect].dup
return reflection if action_magic(action) and (rand(100) <= reflection['Magic'][2])
return reflection if action_physical(action)and (rand(100) <= reflection['Physic'][2])
end
end
return nil
end
#--------------------------------------------------------------------------
# * Reflected action flag
# action : action
#--------------------------------------------------------------------------
def reflected_action(action, reflect)
return true if action_magic(action) and reflect.include?('Magic')
return true if action_physical(action) and reflect.include?('Physic')
return false
end
#--------------------------------------------------------------------------
# * Magic action flag
# action : action
#--------------------------------------------------------------------------
def action_magic(action)
return true if action.is_a?(RPG::Skill) and action.magic?
return false
end
#--------------------------------------------------------------------------
# * Physical action flag
# action : action
#--------------------------------------------------------------------------
def action_physical(action)
return true if action.is_a?(RPG::Skill) and not action.magic?
return true if action.nil?
return false
end
#--------------------------------------------------------------------------
# * Final damage setting
# user : user
# action : action
#--------------------------------------------------------------------------
alias set_damage_skillreflect set_damage
def set_damage(user, action = nil)
set_damage_skillreflect(user, action)
if self.reflects != nil and user.target_damage[self].numeric?
self.reflection = 0
self.reflection = self.reflects['Magic'][1] if action_magic(action)
self.reflection = self.reflects['Physic'][1] if action_physical(action)
user.target_damage[self] = (user.target_damage[self] * self.reflection) / 100
user.target_damage[self] = '' if user.target_damage[self] == 0
elsif self.reflected != nil and user.target_damage[self].numeric?
self.reflection = 0
self.reflection = self.reflected['Magic'][0] if action_magic(action)
self.reflection = self.reflected['Physic'][0] if action_physical(action)
user.target_damage[self] = (user.target_damage[self] * self.reflection) / 100
user.target_damage[self] = '' if user.target_damage[self] == 0
end
user.target_damage[self] *= self.reflect_times if user.target_damage[self] != nil and
user.target_damage[self].numeric?
self.reflect_times = 1
end
#--------------------------------------------------------------------------
# * State Change (+) Application
# plus_state_set : State Change (+)
#--------------------------------------------------------------------------
alias states_plus_skillreflect states_plus
def states_plus(plus_state_set)
if (self.reflects != nil and self.reflection == 0) or
(self.reflected != nil and self.reflection == 0)
@state_changed = true
return true
end
return states_plus_skillreflect(plus_state_set)
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
alias start_skillreflection start
def start
start_skillreflection
reset_all_reflect
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
alias terminate_skillreflect terminate
def terminate
terminate_skillreflect
reset_all_reflect
end
#--------------------------------------------------------------------------
# * Make Basic Action Result
# battler : battler
#--------------------------------------------------------------------------
alias make_basic_action_result_skillreflection make_basic_action_result
def make_basic_action_result(battler)
battler.new_targets.clear
reset_reflection
set_reflect_targets(battler)
set_reflect_times(battler)
make_basic_action_result_skillreflection(battler)
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
# battler : battler
#--------------------------------------------------------------------------
alias make_skill_action_result_skillreflection make_skill_action_result
def make_skill_action_result(battler)
battler.new_targets.clear
for target in $game_troop.enemies + $game_party.actors
target.reflection = 0
target.reflect_times = 1
end
set_reflect_targets(battler, battler.current_skill)
set_reflect_times(battler)
make_skill_action_result_skillreflection(battler)
end
#--------------------------------------------------------------------------
# * Clear reflection values
#--------------------------------------------------------------------------
def reset_reflection
for target in $game_troop.enemies + $game_party.actors
target.reflection = 0
target.reflect_times = 1
end
end
#--------------------------------------------------------------------------
# * Set reflection targets
# battler : battler
# action : action
#--------------------------------------------------------------------------
def set_reflect_targets(battler, action = nil)
for target in battler.target_battlers
reflection = target.check_reflection(action)
if reflection != nil and not ignore_reflect(battler, target)
target.reflects = reflection
if oposite_side(battler, target) or Reflect_Bounce_User
battler.reflected = target.check_reflection(action)
battler.new_targets << battler
else
if battler.actor?
enemy = $game_troop.random_target_enemy
enemy.reflected = target.check_reflection(action)
battler.new_targets << enemy
else
actor = $game_party.random_target_actor
actor.reflected = target.check_reflection(action)
battler.new_targets << actor
end
end
end
end
end
#--------------------------------------------------------------------------
# * Set reflect times
# battler : battler
#--------------------------------------------------------------------------
def set_reflect_times(battler)
for target in battler.new_targets
if battler.target_battlers.include?(target)
target.reflect_times += 1
else
battler.target_battlers << target
end
end
end
#--------------------------------------------------------------------------
# * Get reflect igonore
# battler : battler
# target : target
#--------------------------------------------------------------------------
def ignore_reflect(battler, target)
if Ignore_Reflect_Magics[battler.current_action.skill_id] != nil
for state in target.states
return true if Ignore_Reflect_Magics[battler.current_action.skill_id].include?(state)
end
end
return false
end
#--------------------------------------------------------------------------
# * Set Battle Animation
# battler : battler
# wait_base : base wait time
#--------------------------------------------------------------------------
alias set_action_anim_skillreflection set_action_anim
def set_action_anim(battler, wait_base)
now_action(battler)
set_action_anim_skillreflection(battler, wait_base)
for target in battler.target_battlers
if target.reflects != nil and not battler.reflect_set[target]
action = battler.now_action.is_a?(RPG::Skill) ? battler.now_action : nil
target.animation_id = 0 if target.reflection == 0
# target.animation_id = set_reflect_anim(battler, target)
set_reflect_anim(target, target.reflects['Magic'][3]) if battler.action_magic(action)
set_reflect_anim(target, target.reflects['Physic'][3]) if battler.action_physical(action)
battler.reflect_set[target] = true
end
end
end
#--------------------------------------------------------------------------
# * Set reflection animation
# target : target
# ref : reflection value
#--------------------------------------------------------------------------
def set_reflect_anim(target, ref)
if ref.is_a?(Array)
dir = target.direction
target.animation_id = dir == 2 ? ref[0] : dir == 4 ? ref[1] : dir == 6 ? ref[2] : ref[3]
else
target.animation_id = ref
end
end
#--------------------------------------------------------------------------
# * Update battler phase 4 (part 3)
# battler : active battler
#--------------------------------------------------------------------------
alias step4_part3_skillreflection step4_part3
def step4_part3(battler)
reset_reflect(battler)
step4_part3_skillreflection(battler)
end
#--------------------------------------------------------------------------
# * Clear targets reflection values
# battler : battler
#--------------------------------------------------------------------------
def reset_reflect(battler)
for target in battler.target_battlers
target.reflect_set = {}
target.reflects = nil
target.reflected = nil
target.reflection = 0
target.reflect_times = 1
end
for target in battler.new_targets
battler.target_battlers.delete(target)
end
battler.old_targets.clear
battler.new_targets.clear
end
#--------------------------------------------------------------------------
# * Clear all reflection values
#--------------------------------------------------------------------------
def reset_all_reflect
for battler in $game_troop.enemies + $game_party.actors
battler.reflect_set = {}
battler.reflects = nil
battler.reflected = nil
battler.reflection = 0
battler.reflect_times = 1
battler.old_targets = []
battler.new_targets = []
end
end
end
 
I don't see any typos either.
It only happens when the enemy kills itself. Then you won't attack. Guard still works. Magic still works, but if you heal yourself it just hangs after the casting animation...
 
Jup, also noticed it.
Only happens if the player has to walk to the enemy when exeuting his wished action I guess.
Edit: You are right, cure also doesnt work even if its without walking.
Mabye something is wrong with them movement?

Another interesting fact: As I removed the CTB Addon, after the Ghost died by its own attack the game completly freezed. I mean it didint even switch to the next turn.
I really wounder where the real bug is.
 
Well, under ACBS | Config 1 - Basic
You can set "move to attack" setting to false, and it'll run fine.

Idk whats going on. I set it to ignore the "if moving" so it would continue with the next phase. The character will attack without moving.
I don't see anything in the reflect script that would alter the battle/target coordinates that would make the game think it's moving.
 
Ok, I did some more rigging and forced the coordinates to match up so it wouldn't think it's moving.
What happened was, the Enemy and Actor Switched places. So I'm thinking reflect reverses the target coords, but doesn't change back (after it dies I'm assuming)
 
If I set move to attack to false it will run but thats a messy "solution" because I actually want the battlers to move to their targets. Otherwise it will look odd.

Wait, I tested making move to attack false and the battler itself does not make the attack animation when he should as move to attack is false and when en enemy is killed by its own skill.

Maybe the problem is in the battle animation?
Hm... Even posting this in another forum couldnt help me finding a solution
 
Think I got it
This method had the reflection reset at battle phase 4-3
I guessed that it was suppose to be 3-3 since that's where the battle hangs at. I changed it to this
solution_zpsahvjdexp.png

and it seems to work.
I could be wrong though. There could be some grand design that I'm not seeing. You'll have to test it more to spot any other problems.

Edit: Make sure the changes are to the Add | Skill Reflect script under <<Add-ons>>; not the one under <<Main>> that's inactive.
 
You are my saviour and my hero!
Thank you so much. I havent encountered any problems/Bugs yet.

Allow me to ask you a final question about ATOA ACBS because I dont want to open a new topic.
Where can I change the size of the skill window when selecting skills in the battle?

I cant find the class/line in the scripts
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top