01-04-2016, 01:04 AM
ATOA Chanting Battle Animations
Version: 1.0
Version: 1.0
Introduction
This script, an add-on to ATOA's ACBS system, adds the ability to apply battle animations to battlers that are delayed by the ATB/CTB casting time delays, known as Chanting Times. It is only for use with the ACBS and requires either the ATB or CTB add-on.
Script
"Script Time!"
Code:
#==============================================================================
# ** ATOA Chanting Battle Animations
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 01-03-2016 (mm/dd/yyyy)
# RGSS / RPGMaker XP
#
#==============================================================================
#
# INTRODUCTION:
#
# This script adds the ability to apply battle animations to battlers that
# are delayed by the ATB/CTB casting time delays, known as Chanting Times.
#
# This script is an add-on for Atoa's ACBS in tandem with either his ATB
# or CTB addons, included with his demo.
#
#------------------------------------------------------------------------------
#
# INSTALLATION:
#
# Paste below either the Atoa ATB or CTB code.
#
# The configurations are explained below.
#
#==============================================================================
#
# TERMS AND CONDITIONS:
#
# Free for use, even in commercial games. And as this script was requested
# by Noctis, you have to give both of us credit for this script.
#
#==============================================================================
module Atoa
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# CAST SETTINGS
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Chanting default animation ID.
# Set to 0 by default, assuming all chanting delays have no animation unless
# set in their individual skills/items settings.
#
Chanting_Anim = 0
# To add a battle animation to a skill or item that has a set delay, add
# this effect to the setting of the skill or the item:
# "CHANTANIM/**"
# ** must be the battle animation's ID.
#
# EX:
# Altering the potion in the ACBS | Config 2 - Advanced page:
#
# Item_Settings[1] = ["MOVETYPE/STEPFOWARD","CHANTING/5","CHANTANIM/2"]
#
# This applies the chanting delay of '5' to the potion, preventing its use
# until the delay is over. And it renders the 'Cast Magic' battle animation
# to the item until the actual use of the item is performed.
#
# NOTE: If the skill or item has a delay but no animation is set by way of
# the 'CHANTANIM/**' parameter, the system will apply the default
# setting (Chanting_Anim).
#
#
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
end
#==============================================================================
# ** Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
unless $atoa_script.include?('Atoa CTB') or $atoa_script.include?('Atoa ATB')
# Apply message
p "Error: Necessary ATB/CTB script not included. Exiting now."
# Forces termination
exit
end
$atoa_script['Atoa CastAnims'] = 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 :animation_wait # animation hit flag
attr_accessor :animation_chant # animation hit flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias meebers initialize
def initialize
meebers
@animation_wait = 0
@animation_chant = 0
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias set_idle_pose_chantinganim set_idle_pose
alias update_idle_anim_chantinganim update_idle_anim
#--------------------------------------------------------------------------
# * Get idle pose ID
#--------------------------------------------------------------------------
def set_idle_pose
# Perform the original call and get pose as normal
pose = set_idle_pose_chantinganim
# Perform the attached code
set_idle_pose_chantanim
# Return pose from system
return pose
end
#--------------------------------------------------------------------------
# * Get chanting pose animation for action
#--------------------------------------------------------------------------
def set_idle_pose_chantanim
action = @battler.cast_action
return if action.nil?
cast_anim_id = Atoa::Chanting_Anim
ext = check_extension(action, 'CHANTANIM/')
if ext != nil
ext.slice!('CHANTANIM/')
cast_anim_id = ext.to_i
end
@battler.animation_chant = cast_anim_id
end
#--------------------------------------------------------------------------
# * Idle pose update
#--------------------------------------------------------------------------
def update_idle_anim
# Perform the original call
update_idle_anim_chantinganim
# Perform the attached code
update_idle_anim_chantanim
end
#--------------------------------------------------------------------------
# * Idle pose update chanting animation
#--------------------------------------------------------------------------
def update_idle_anim_chantanim
return if update_idle_anim_waiting?
return unless @battler.animation_id == 0
animation_id = @battler.animation_chant
@battler.animation_chant = 0
return if animation_id == 0
@battler.animation_id = animation_id
update_idle_anim_delay(animation_id)
end
#--------------------------------------------------------------------------
# * Idle pose Animation : Number of frames in animation
# id : animation_id
#--------------------------------------------------------------------------
def update_idle_anim_delay(id)
# Obtain animation by ID
animation = $data_animations[id]
# Set battler's wait time by animation's number of frames (times 2)
@battler.animation_wait = animation.frame_max * 2
end
#--------------------------------------------------------------------------
# * Idle pose Animation : Determine if animation should be over
#--------------------------------------------------------------------------
def update_idle_anim_waiting?
@battler.animation_wait = 0 if @battler.animation_wait.nil?
@battler.animation_wait -= 1
@battler.animation_wait = 0 if @battler.animation_wait < 0
return (@battler.animation_wait != 0)
end
end
Instructions
In the script as always.
Compatibility
For use with Atoa's (Victor Sant's) ACBS system and either its ATB or CTB add-on.
Terms and Conditions
Free for use, even in commercial games. And as this script was requested by Noctis, you have to give both of us credit for this script.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links