Hello Chaos Project, this is my first post, so hi!
I'm still learning ruby right now, but regardless, I tried my hand at making a custom battle system.
I came up with this WIP snippet of code (that actually works mind you):
class Scene_Battle
def time_update
$game_temp.battle_turn += 1
$stamina_cooldown -= 1 if $stamina_cooldown > 0
$stamina = [$stamina + 1, $maxstamina].min if $stamina_cooldown < 1
@enemy_attack_cooldown -= 1
if Input.trigger?(Input::C)
if $stamina > 0
hero_attack
stamina_cost(50, 20)
else
$game_system.se_play($data_system.cancel_se)
end
end
if Input.trigger?(Input::B)
if @attack_incoming
hero_block
@attack_incoming = false
@enemy_attack_cooldown = 100
else
$game_system.se_play($data_system.cancel_se)
end
end
if @enemy_attack_cooldown < @enemy_attack_speed
if @attack_incoming == false
@animation1_id = @enemy.animation1_id
if @animation1_id == 0
@enemy.white_flash = true
else
@enemy.animation_id = @animation1_id
@enemy.animation_hit = true
end
@attack_incoming = true
end
if @enemy_attack_cooldown < 0
enemy_attack
@enemy_attack_cooldown = 100
@attack_incoming = false
end
end
end
def hero_attack
@animation1_id = @hero.animation1_id
@animation2_id = @hero.animation2_id
@enemy.attack_effect(@hero)
if @animation1_id == 0
@hero.white_flash = true
else
@hero.animation_id = @animation1_id
@hero.animation_hit = true
end
@enemy.animation_id = @animation2_id
@enemy.animation_hit = true
# Animation has at least 8 frames, regardless of its length
# Shift to step 5
@phase4_step = 5
# Refresh status window
@status_window.refresh
# Display damage
if @enemy.damage != nil
@enemy.damage_pop = true
end
end
def hero_block
@animation1_id = @enemy.animation1_id
@animation2_id = @enemy.animation2_id
if @animation1_id == 0
@enemy.white_flash = true
else
@enemy.animation_id = @animation1_id
@enemy.animation_hit = true
end
@hero.animation_id = COMBAT::BLOCK_ANI
@hero.animation_hit = true
# Refresh status window
@status_window.refresh
# Display damage
@hero.damage = 'Blocked'
@hero.damage_pop = true
end
def stamina_cost(cost, cd)
$stamina_cooldown += cd
if $stamina < cost
$stamina_cooldown += cost - $stamina
$stamina = 0
else
$stamina -= cost
end
end
def enemy_attack
@animation2_id = @enemy.animation2_id
@hero.attack_effect(@enemy)
@hero.animation_id = @animation2_id
@hero.animation_hit = true
# Refresh status window
@status_window.refresh
# Display damage
if @hero.damage != nil
@hero.damage_pop = true
end
end
end
To explain whats going on here, this piece of code replaces Scene_Battle parts 2, 3, and 4, and time_update is called in the 'update' method of Scene_Battle part 1. (I don't understand how to make standalone scripts.

)
The battle works like this: there is no turns, and there is only one player character (hero) and one enemy. You attack the enemy by pressing C and using stamina. You can also block the enemy with X when the enemy is about to attack. It'll be much more complex later, but that's all it is right now.
The problem I'm having is that whenever an animation effect, whiten effect or damage pop effect is called, the battle is paused briefly, letting the effect play before resuming the battle. My intent is to get it as fluid (or close to) as RTAB. I've tried searching for the code that calls the animation sprites, etc, but I couldn't find them, so I believe its built in to RMXP (?). Am I missing something?
Is it even possible to have the effects playing like RTAB's does, in combination with my script? Or is my script inherently flawed?
Does anyone know the animation code?
Any suggestions?
Thanks for your time.