+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: CTB - A Final Fantasy X-like Battle System, Version 3.2 (/thread-2298.html)
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Charlie Fleed - 07-18-2009
All those are debug messages, I forgot to remove them... :P
Here's the cleaned version:
Content Hidden
Code:
#==============================================================================
# ** Summons (Add-on for the Custom Battle System (CTB) by Charlie Lee)
#
# Version: 0.7
# Author: Charlie Lee
#==============================================================================
#==============================================================================
# ? *** CONFIGURATION *** ? #
#==============================================================================
# This is used for the identification of summon skills and has nothing to do
# with the command name in the actor command window
SUMMON_NAME="Summon"
# Experience acquisition
REMOVED_ACTORS_EXP_MULTIPLIER = 0.8
TRANSFORMED_ACTORS_EXP_MULTIPLIER = 0.8 # Applies to actors not in their
# original form at the end of the battle. The transformed form gets full exp
INVOKED_AEON_EXP_MULTIPLIER = 0.8
NOT_INVOKED_AEON_EXP_MULTIPLIER = 0.2
INVOKED_TRANSFORMATION_EXP_MULTIPLIER = 0.8
NOT_INVOKED_TRANSFORMATION_EXP_MULTIPLIER = 0.2
# Use this if you want dead aeons to be unavailable for N battles
# For multiple invocations it only applies if all the aeons have been killed
# For aoens summoned with multiple summons it only applies to the summon that
# was active when they were killed
BATTLES_BEFORE_AEONS_RETURN = 2
# Aeons recover HP_RECOVER percent of HPs
# at the end of every battle
HP_RECOVER = 10
# Aeons recover SP_RECOVER percent of SPs
# at the end of every battle
SP_RECOVER = 10
# Transformations recover HP_RECOVER percent of HPs
# at the end of every battle
HP_RECOVER3 = 10
# Transformations recover SP_RECOVER percent of SPs
# at the end of every battle
SP_RECOVER3 = 10
#==============================================================================
# ? SUMMON
# type: 1) do not remove party actors, 2) remove party actors,
# 3) remove the summoned (aka transformations)
#==============================================================================
class Summon
attr_reader :actors_ids
attr_reader :actors_names
attr_reader :type
attr_reader :skill_id
attr_accessor :available
attr_reader :key
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(type,id,names,key)
@available=0
@type=type
@skill_id=id
@key=key
@actors_names=[]
@actors_ids=[]
for name in names
for i in 0...999
actor = $game_actors[i]
if actor != nil and actor.name == name
@actors_ids.push(actor.id)
$game_party.aeons_ids.push(actor.id) unless type==3
$game_party.transformations_ids.push(actor.id) if type==3
@actors_names.push(name)
end
end
end
# output
end
#--------------------------------------------------------------------------
# * Output
#--------------------------------------------------------------------------
def output
print("Summon skill id: "+@skill_id.to_s+"\ntype: "+type.to_s)
print("Actors:")
for actor_name in @actors_names
print(actor_name)
end
end
end
#==============================================================================
# ? GAME_PARTY
#==============================================================================
class Game_Party
attr_accessor :aeons # array of Aeons in the game party
attr_accessor :transformations # array of Transformations in the game party
attr_accessor :removed_actors
attr_accessor :aeons_ids # array of all the aeons' ids
attr_accessor :transformations_ids # array of all the transformations' ids
attr_accessor :game_summons # array of all the Summons
attr_accessor :transformed_actors
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias summon_initialize initialize
def initialize
summon_initialize
@aeons=[]
@transformations=[]
@removed_actors=[]
@aeons_ids=[]
@transformations_ids=[]
@game_summons=[]
@transformed_actors=[]
end
#--------------------------------------------------------------------------
# * Fill Summons Database
#--------------------------------------------------------------------------
def fill_summons_database
$game_temp.filling_summons_database=true
# print("filling_summons_database")
for skill in $data_skills
@filling_summons_database_skill_id=skill.id
if skill!=nil and skill.element_set.include?($game_temp.summon_element_id)
# print("summon: "+skill.name+" id"+skill.id.to_s)
id=skill.common_event_id
command=""
for line in $data_common_events[id].list
command=command+line.parameters[0].to_s
end
# print(command)
eval(command)
end
end
$game_temp.filling_summons_database=false
end
#--------------------------------------------------------------------------
# * Summon
#--------------------------------------------------------------------------
def summon(type,actors_names,key=-1)
if $game_temp.filling_summons_database==true
# create the summon
skill_id=@filling_summons_database_skill_id
@game_summons[skill_id]=Summon.new(type,skill_id,actors_names,key)
if $game_temp.auto_add_aeons_list.include?(skill_id)
if type==1 or type==2
for actor_id in $game_party.game_summons[skill_id].actors_ids
if not $game_party.aeons.include?($game_actors[actor_id])
$game_party.aeons.push($game_actors[actor_id])
end
end
else
for actor_id in $game_party.game_summons[skill_id].actors_ids
if not $game_party.transformations.include?($game_actors[actor_id])
$game_party.transformations.push($game_actors[actor_id])
end
end
end
end
else
for summon in @game_summons
if summon != nil
if summon.type == type and summon.actors_names==actors_names and
(summon.key==-1 or summon.key==key)
$scene.summon(summon)
end
end
end
end
end
#--------------------------------------------------------------------------
# * Add Summoned
#--------------------------------------------------------------------------
def add_summoned(actor_id, position=-1)
# Get actor
actor = $game_actors[actor_id]
if not @actors.include?(actor)
# Add actor
if position>=0
@actors.insert(position,actor)
else
@actors.push(actor)
end
actor.battle_data_reset
actor.randomize_next_action_time
end
$game_player.refresh
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
#--------------------------------------------------------------------------
# * Remove Party
#--------------------------------------------------------------------------
def remove_party()
to_be_removed=[]
@removed_actors=[]
for actor in @actors
to_be_removed.push(actor)
end
for actor in to_be_removed
# Remove actor
@actors.delete(actor)
# Add actor to the removed actors array
@removed_actors.push(actor)
end
$game_temp.party_removed = true
$game_player.refresh
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
#--------------------------------------------------------------------------
# * Return Party
#--------------------------------------------------------------------------
def return_party
# p "return party"
# print("removed actors size: "+ @removed_actors.size.to_s)
for actor in @removed_actors
# Add actor
@actors.push(actor)
actor.battle_data_reset(false) # Do not reset the last commands
actor.randomize_next_action_time
end
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
size=@removed_actors.size
@removed_actors.clear
$game_temp.party_removed = false
$game_player.refresh
# return the # of actors
return size
end
#--------------------------------------------------------------------------
# * Return Transformed Actor
#--------------------------------------------------------------------------
def return_transformed_actor(id)
for a in @transformed_actors
if a.id == id
actor=a
end
end
# Add actor
@actors.push(actor)
actor.battle_data_reset
actor.randomize_next_action_time
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
#--------------------------------------------------------------------------
# * Return Transformed Backup Actor
#--------------------------------------------------------------------------
def return_transformed_backup_actor(id)
for a in @transformed_actors
if a.id == id
actor=a
end
end
# Add actor
@backup_actors.push(actor)
actor.battle_data_reset
actor.randomize_next_action_time
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
def update_size
@party_size=$game_party.actors.size
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
alias summon_add_actor add_actor
def add_actor(actor_id)
# Original call
summon_add_actor(actor_id)
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
#--------------------------------------------------------------------------
# * Remove Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
alias summon_remove_actor remove_actor
def remove_actor(actor_id)
# Original call
summon_remove_actor(actor_id)
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
end
def summons_hp_recover
for actor in $game_party.aeons
actor.hp = Integer([actor.maxhp,actor.hp+actor.maxhp*HP_RECOVER/100].min)
end
for actor in $game_party.transformations
actor.hp = Integer([actor.maxhp,actor.hp+actor.maxhp*HP_RECOVER3/100].min)
end
end
def summons_sp_recover
for actor in $game_party.aeons
actor.sp = Integer([actor.maxsp,actor.sp+actor.maxsp*SP_RECOVER/100].min)
end
for actor in $game_party.transformations
actor.sp = Integer([actor.maxsp,actor.sp+actor.maxsp*SP_RECOVER3/100].min)
end
end
#--------------------------------------------------------------------------
# * Remove Transformed
#--------------------------------------------------------------------------
def remove_transformed(id)
for a in @actors
if a.id==id
actor=a
# Save position
temp=@actors.index(a)
end
end
# Remove actor
@actors.delete(actor)
# Add actor to the removed actors array
@transformed_actors.push(actor)
$game_player.refresh
# THIS LINE IS FOR COMPATIBILITY WITH MINKOFF/DERVVULFMAN ANIMATION SYSTEM
update_size
return temp
end
#--------------------------------------------------------------------------
# * Refresh Party Members
#--------------------------------------------------------------------------
alias summon_refresh refresh
def refresh
# Original call
summon_refresh
# Actor objects split from $game_actors right after loading game data
# Avoid this problem by resetting the actors each time data is loaded.
new_actors = []
for i in 0...@aeons.size
if $data_actors[@aeons[i].id] != nil
new_actors.push($game_actors[@aeons[i].id])
end
end
@aeons = new_actors
new_actors = []
for i in 0...@backup_actors.size
if $data_actors[@backup_actors[i].id] != nil
new_actors.push($game_actors[@backup_actors[i].id])
end
end
@backup_actors = new_actors
new_actors = []
for i in 0...@transformations.size
if $data_actors[@transformations[i].id] != nil
new_actors.push($game_actors[@transformations[i].id])
end
end
@transformations = new_actors
end
end
#==============================================================================
# ? SPRITESET BATTLE
#==============================================================================
class Spriteset_Battle
def add_sprites(n=1)
added_sprites=[]
for i in 1..n
actor_sprite=Sprite_Battler.new(@viewport1)
@actor_sprites.push(actor_sprite)
added_sprites.push(actor_sprite)
# print("add_sprite")
end
return added_sprites
end
def remove_sprites(n=1)
for i in 1..n
# print("remove sprite")
sprite=@actor_sprites.pop
sprite.battler=nil
sprite.dispose
end
end
def remove_sprite_in_pos(pos)
sprite=@actor_sprites.delete_at(pos)
sprite.battler=nil
sprite.dispose
end
alias summon_update update
def update
@actor_sprites.each_index do |index| @actor_sprites[index].battler =
$game_party.actors[index] end
summon_update
end
end
#==============================================================================
# ? SCENE BATTLE
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Initialize invoked_during_last_battle flag
#--------------------------------------------------------------------------
alias summon_start_phase1 start_phase1
def start_phase1
for aeon in $game_party.aeons
aeon.invoked_during_last_battle = false
end
for transformation in $game_party.transformations
transformation.invoked_during_last_battle = false
end
summon_start_phase1
end
#--------------------------------------------------------------------------
# * Summon
#--------------------------------------------------------------------------
def summon(s)
# print("Scene Battle")
# s.output
# If the summon adds characters to the party
if s.type==1
if $game_party.actors.size + s.actors_ids.size > 8
$game_temp.too_many_actors = true
return
end
# Add the actors
for actor_id in s.actors_ids
$game_party.add_summoned(actor_id)
# Set the invoked flag
$game_actors[actor_id].invoked_during_last_battle = true
added_sprites=[]
added_sprites=@spriteset.add_sprites
for sprite in added_sprites; sprite.animation($data_animations[SUMMONED_ACTORS_ANIMATION_ID],true) unless SUMMONED_ACTORS_ANIMATION_ID==nil; end
end
for actor_id in s.actors_ids
$game_actors[actor_id].summon_id=s.skill_id
# print($game_actors[actor_id].summon_id.to_s)
end
return
elsif s.type==2
# Remove the sprites
@spriteset.remove_sprites($game_party.actors.size)
$game_party.remove_party
# Add the actors
for actor_id in s.actors_ids
$game_party.add_summoned(actor_id)
# Set the invoked flag
$game_actors[actor_id].invoked_during_last_battle = true
added_sprites=[]
added_sprites=@spriteset.add_sprites
for sprite in added_sprites; sprite.animation($data_animations[SUMMONED_ACTORS_ANIMATION_ID],true) unless SUMMONED_ACTORS_ANIMATION_ID==nil; end
end
for actor_id in s.actors_ids
$game_actors[actor_id].summon_id=s.skill_id
# print($game_actors[actor_id].summon_id.to_s)
end
return
elsif s.type==3
# Remove the sprite
party_position=$game_party.remove_transformed(@active_battler.id)
@spriteset.remove_sprite_in_pos(party_position)
# Add the actors
for actor_id in s.actors_ids
$game_party.add_summoned(actor_id, party_position)
sprite=@spriteset.add_sprite_in_pos(party_position)
sprite.animation($data_animations[TRANSFORMED_ACTOR_ANIMATION_ID],true) unless TRANSFORMED_ACTOR_ANIMATION_ID==nil
end
for actor_id in s.actors_ids
$game_actors[actor_id].summon_id=s.skill_id
# Save the original form id
$game_actors[actor_id].original_form_id=@active_battler.id
# Save the transformed form id
@active_battler.transformed_form_id=actor_id
# print($game_actors[actor_id].summon_id.to_s)
end
return
end
end
#--------------------------------------------------------------------------
# * Return Party # This method deals with the sprites
#--------------------------------------------------------------------------
def return_party
# p "return party"
n_of_returned_members=$game_party.return_party
for i in 1..n_of_returned_members
added_sprites=[]
added_sprites=@spriteset.add_sprites
for sprite in added_sprites; sprite.animation($data_animations[RETURNING_PARTY_ANIMATION_ID],true) unless RETURNING_PARTY_ANIMATION_ID==nil; end
# p "Adding sprite"
end
end
#--------------------------------------------------------------------------
# * Battle_End
#--------------------------------------------------------------------------
alias summon_battle_end battle_end
def battle_end(n)
# HP recover for aeons
$game_party.summons_hp_recover
# SP recover for aeons
$game_party.summons_sp_recover
for s in $game_party.game_summons
if s != nil
s.available=[s.available-1,0].max
end
end
# Remove all the summoned actors
to_be_removed=[]
for actor in $game_party.actors
if $game_party.aeons_ids.include?(actor.id)
to_be_removed.push(actor)
# print("removed ", actor.name)
end
end
for actor in to_be_removed
$game_party.actors.delete(actor)
end
# Let the party return, no need to add any sprites, so we call the
# class Game_Party method
$game_party.return_party
# Remove all the summoned actors from the returned party
to_be_removed=[]
for actor in $game_party.actors
if $game_party.aeons_ids.include?(actor.id)
to_be_removed.push(actor)
# print("removed ", actor.name)
end
end
for actor in to_be_removed
$game_party.actors.delete(actor)
end
# Remove all the transformed actors from the party
to_be_removed=[]
for actor in $game_party.actors
if $game_party.transformations_ids.include?(actor.id)
to_be_removed.push(actor)
# print("removed ", actor.name)
end
end
for actor in to_be_removed
$game_party.actors.delete(actor)
$game_party.return_transformed_actor(actor.original_form_id)
end
# Remove all the transformed actors from the backup party
to_be_removed=[]
for actor in $game_party.backup_actors
if $game_party.transformations_ids.include?(actor.id)
to_be_removed.push(actor)
# print("removed ", actor.name)
end
end
for actor in to_be_removed
$game_party.backup_actors.delete(actor)
$game_party.return_transformed_backup_actor(actor.original_form_id)
end
$game_player.refresh
# Original call
summon_battle_end(n)
end
#--------------------------------------------------------------------------
# * Retire # This method does not deal with sprites
#--------------------------------------------------------------------------
def retire(summon_id)
# Remove all the actors summoned with the retiring battler's summon
#p summon_id.to_s
#p $game_party.game_summons[summon_id].type.to_s
to_be_removed_ids = $game_party.game_summons[summon_id].actors_ids
for actor_id in to_be_removed_ids
$game_party.remove_actor(actor_id)
end
@spriteset.remove_sprites(to_be_removed_ids.size)
# Make the party return if the summon was type 2
if $game_party.game_summons[summon_id].type == 2
return_party
end
$game_party.update_size # can be removed?
end
#--------------------------------------------------------------------------
# * Determine Battle Win/Loss Results
#--------------------------------------------------------------------------
alias summon_judge judge
def judge
# If all dead determinant is true, or number of members in party is 0
if $game_party.all_dead? or $game_party.actors.size == 0
# If the party has been removed
if $game_party.removed_actors.size > 0
to_be_removed=[]
# Remove all the summoned actors
for actor in $game_party.actors
if $game_party.aeons_ids.include?(actor.id)
to_be_removed.push(actor)
end
end
for actor in to_be_removed
# print("remove"+actor.name)
$game_party.actors.delete(actor)
$game_party.game_summons[actor.summon_id].available = BATTLES_BEFORE_AEONS_RETURN + 1
end
$game_party.update_size # can be removed?
@spriteset.remove_sprites(to_be_removed.size)
@spriteset.update
# Party return
return_party
$game_party.update_size # can be removed?
@spriteset.update
# It isn't over yet!
return false
end
end
# Remove dead summon
if REMOVE_DEAD_SUMMONS
initial_actors=$game_party.actors
for actor in initial_actors
# initial actors may not be in the party anymore after some retirements
if $game_party.actors.include?(actor)
# if actor is summoned
if $game_party.aeons_ids.include?(actor.id)
remove = true
to_be_tested_ids = $game_party.game_summons[actor.summon_id].actors_ids
for actor_id in to_be_tested_ids
remove = false unless $game_actors[actor_id].dead?
end
end
if remove
retire(actor.summon_id)
@spriteset.update
$game_party.game_summons[actor.summon_id].available = BATTLES_BEFORE_AEONS_RETURN + 1
end
end
end
end
# original call
return summon_judge
end
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
alias summon_start_phase5 start_phase5
def start_phase5
exp = 0
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Add EXP and amount of gold obtained
exp += enemy.exp
end
end
# Actors removed for summon (can be aeons or transformations)
for actor in $game_party.removed_actors
actor.old_exp=actor.exp
actor.exp += (actor.state?($expx2_state_id)?2:1) * Integer(exp * REMOVED_ACTORS_EXP_MULTIPLIER)
end
# Original form of transformed actors
for actor in $game_party.transformed_actors
actor.old_exp=actor.exp
# if removed
if $game_party.removed_actors.include?($game_actors[actor.transformed_form_id])
# print(actor.name + " transformed and removed")
actor.exp += (actor.state?($expx2_state_id)?2:1) * Integer(exp * TRANSFORMED_ACTORS_EXP_MULTIPLIER * REMOVED_ACTORS_EXP_MULTIPLIER)
# if switched
elsif $game_party.backup_actors.include?($game_actors[actor.transformed_form_id])
# print(actor.name + " transformed and switched")
actor.exp += (actor.state?($expx2_state_id)?2:1) * Integer(exp * TRANSFORMED_ACTORS_EXP_MULTIPLIER * SWITCHED_ACTORS_EXP_MULTIPLIER)
else
# print(actor.name + " transformed")
actor.exp += (actor.state?($expx2_state_id)?2:1) * Integer(exp * TRANSFORMED_ACTORS_EXP_MULTIPLIER)
end
end
# Aeons not in the party
for aeon in $game_party.aeons-$game_party.actors
aeon.old_exp=aeon.exp
# p aeon.name
aeon.exp += Integer(exp *
((aeon.invoked_during_last_battle)?(INVOKED_AEON_EXP_MULTIPLIER):(NOT_INVOKED_AEON_EXP_MULTIPLIER)))
end
# Transformations not in the party or the backup party or the removed actors
for transformation in ((($game_party.transformations-$game_party.actors)-$game_party.backup_actors)-$game_party.removed_actors)
transformation.old_exp=transformation.exp
# p transformation.name
transformation.exp += Integer(exp *
((transformation.invoked_during_last_battle)?(INVOKED_TRANSFORMATION_EXP_MULTIPLIER):(NOT_INVOKED_TRANSFORMATION_EXP_MULTIPLIER)))
end
# Call the original script
summon_start_phase5
end
end
#==============================================================================
# ? GAME TEMP
#==============================================================================
class Game_Temp
attr_accessor :too_many_actors
attr_accessor :summon_element_id
attr_accessor :filling_summons_database
attr_accessor :party_removed
attr_accessor :actors_transformed
attr_accessor :auto_add_aeons_list
alias initialize_summons initialize
def initialize
# Perform the original call
initialize_summons
@too_many_actors = false
@summon_element_id = $data_system.elements.index(SUMMON_NAME)
@party_removed = false
@actors_transformed = false
@auto_add_aeons_list = []
end
end
#==============================================================================
# ? GAME BATTLER
#==============================================================================
class Game_Battler
attr_accessor :summon_id
#--------------------------------------------------------------------------
# * Retire
#--------------------------------------------------------------------------
def retire
$scene.retire(@summon_id)
end
end
#==============================================================================
# ? SCENE TITLE
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
alias summon_command_new_game command_new_game
def command_new_game
summon_command_new_game
$game_party.fill_summons_database
end
end
#==============================================================================
# ? GAME ACTOR
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :invoked_during_last_battle
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
# skill_id : skill ID
#--------------------------------------------------------------------------
alias summon_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
# If skill is a summon
if $data_skills[skill_id].element_set.include?($game_temp.summon_element_id)
if $game_party.game_summons[skill_id].available > 0
return false
end
# return false if the party has been removed
if $game_party.game_summons[skill_id].type == 2 and
$game_temp.party_removed
return false
end
# return false if some of the actors is already in the party
for actor_id in $game_party.game_summons[skill_id].actors_ids
if $game_party.actors.include?($game_actors[actor_id])
return false
end
end
# return false if some of the actors is already in the backup party
for actor_id in $game_party.game_summons[skill_id].actors_ids
if $game_party.backup_actors.include?($game_actors[actor_id])
return false
end
end
# return false if all the actors are dead
all_dead=true
for actor_id in $game_party.game_summons[skill_id].actors_ids
if not $game_actors[actor_id].dead?
all_dead = false
end
end
return false if all_dead
end
# Perform the original call
return summon_skill_can_use?(skill_id)
end
def summon_skill_can_learn?(skill_id)
return false if AEONS_LEARNINGS[skill_id] == nil
return false if skill_learn?(skill_id)
item_needed=AEONS_LEARNINGS[skill_id][0]
quantity_needed=AEONS_LEARNINGS[skill_id][1]
if $game_party.item_number(item_needed) < quantity_needed
return false
else
return true
end
end
alias summon_learn_skill learn_skill
def learn_skill(skill_id)
summon_learn_skill(skill_id)
return unless AUTO_ADD_ACTORS
if $data_skills[skill_id].element_set.include?($game_temp.summon_element_id)
if skill_learn?(skill_id)
if $game_party.game_summons!=[]
if $game_party.game_summons[skill_id].type != 3
for actor_id in $game_party.game_summons[skill_id].actors_ids
if not $game_party.aeons.include?($game_actors[actor_id])
$game_party.aeons.push($game_actors[actor_id])
end
end
else
for actor_id in $game_party.game_summons[skill_id].actors_ids
if not $game_party.transformations.include?($game_actors[actor_id])
$game_party.transformations.push($game_actors[actor_id])
end
end
end
else
$game_temp.auto_add_aeons_list.push(skill_id) unless $game_temp.auto_add_aeons_list.include?(skill_id)
end
end
end
end
end
#==============================================================================
# ? SCENE BATTLE
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Determine if the Item command is available for summons
#--------------------------------------------------------------------------
alias summons_phase3_setup_command_window2 phase3_setup_command_window2
def phase3_setup_command_window2
if @active_battler.summon_id != nil
t=$game_party.game_summons[@active_battler.summon_id].type
if t==1
@individual_battle_commands.delete($data_system.words.item) unless TYPE_1_CAN_USE_ITEMS
elsif t==2
@individual_battle_commands.delete($data_system.words.item) unless TYPE_2_CAN_USE_ITEMS
end
end
# original call
summons_phase3_setup_command_window2
end
#--------------------------------------------------------------------------
# * Determine if the item can be used on summons
#--------------------------------------------------------------------------
alias summons_update_phase3_actor_select2 update_phase3_actor_select2
def update_phase3_actor_select2
# If item window is showing
if @item_window != nil
# If C button was pressed
if Input.trigger?(Input::C)
if $game_party.actors[@actor_arrow.index].summon_id != nil
t=$game_party.game_summons[$game_party.actors[@actor_arrow.index].summon_id].type
if t==1
if not USE_ITEMS_ON_TYPE_1
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
elsif t==2
if not USE_ITEMS_ON_TYPE_2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
end
end
# Original call
summons_update_phase3_actor_select2
end
#--------------------------------------------------------------------------
# * Determine if auto-phoenix can revive summons
#--------------------------------------------------------------------------
alias summon_make_phoenix_users_and_targets2 make_phoenix_users_and_targets2
def make_phoenix_users_and_targets2
for actor in $game_party.actors
if actor.summon_id != nil
t = $game_party.game_summons[actor.summon_id].type
if t==1
if not USE_ITEMS_ON_TYPE_1
@phoenix_targets.delete(actor)
end
elsif t==2
if not USE_ITEMS_ON_TYPE_2
@phoenix_targets.delete(actor)
end
end
end
end
# original call
summon_make_phoenix_users_and_targets2
end
end
#==============================================================================
# ? GAME BATTLER
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Determine if the item can be used on summons
#--------------------------------------------------------------------------
alias summons_item_effect item_effect
def item_effect(item)
if self.summon_id != nil
t = $game_party.game_summons[self.summon_id].type
if t==1
if not USE_ITEMS_ON_TYPE_1
return false
end
elsif t==2
if not USE_ITEMS_ON_TYPE_2
return false
end
end
end
# original call
return summons_item_effect(item)
end
end
#==============================================================================
# ? SCENE SUMMONS
#==============================================================================
class Scene_Summons
def initialize(menu_index = 0)
@actors=$game_party.aeons
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make aeons window
s=[]
for aeon in @actors
s.push(aeon.name)
end
# No Aeons yet
if s.size == 0
@empty = true
s.push("empty")
@empty_window = Window_Command.new(120,s)
@empty_window.x = 260
@empty_window.y = 208
@empty_window.active = true
else
@empty = false
@aeons_window = Window_CommandSliding.new(160, s)
@aeons_window.set_y(64)
@aeons_window.index = @menu_index
@aeons_window.active=true
# Make status window
@status_window = Window_SummonStatus.new(@actors[0])
# Make abilities window
@abilities_window = Window_AbilitiesSliding.new(640+32,64,380,416-96,
@actors[@menu_index])
@abilities_window.index = 0
@abilities_window.active = false
# Make help window
@help_window = Window_Help.new
@help_window.set_text("Select Actor")
# Associate help window
@abilities_window.help_window = @help_window
# Make ItemNeeded Window
@item_needed_window = Window_ItemNeeded.new
# Make Confirm Window
@confirm_window=Window_Confirm.new
@confirm_window.active = false
@confirm_window.visible = false
end
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
if @empty
@empty_window.dispose
return
end
@aeons_window.dispose
@status_window.dispose
@abilities_window.dispose
@help_window.dispose
@item_needed_window.dispose
@confirm_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# No Aeons yet
if @empty == true
update_empty
return
end
# Update windows
@aeons_window.update
@status_window.update
@abilities_window.update
@item_needed_window.update
@confirm_window.update
# If aeons window is active: call update_aeons
if @aeons_window.active
update_aeons
return
end
# If abilities window is active: call update_abilities
if @abilities_window.active
update_abilities
return
end
# If confirm_window is active
if @confirm_window.active
update_confirm
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when aeons window is active)
#--------------------------------------------------------------------------
def update_aeons
old_menu_index=@menu_index
@menu_index=@aeons_window.index
@status_window.actor=@actors[@menu_index]
# If UP or DOWN button was pressed
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or old_menu_index!=@menu_index
@status_window.refresh
@abilities_window.index = 0
return
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
@aeons_window.active = false
@abilities_window.actor = @actors[@menu_index]
@abilities_window.refresh
@abilities_window.active = true
@aeons_window.target_x = -160
@status_window.target_x = 0
@abilities_window.target_x = 260
@abilities_window.update_help
@item_needed_window.target_x = 260
@item_needed_window.skill = @abilities_window.skill
@item_needed_window.refresh
return
end
end
def update_abilities
# If C button was pressed
if Input.trigger?(Input::C)
if @actors[@menu_index].summon_skill_can_learn?(
@abilities_window.skill.id)
# Play decision SE
$game_system.se_play($data_system.decision_se)
@confirm_window.visible = true
@confirm_window.active = true
@abilities_window.active = false
return
else
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
return
end
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@aeons_window.active = true
@abilities_window.active = false
@aeons_window.target_x = 0
@status_window.target_x = 160
@abilities_window.target_x = 640 +32
@item_needed_window.target_x = 640 +32
@help_window.set_text("Select Aeon")
return
end
# If UP or DOWN button was pressed
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
@abilities_window.update_help
@item_needed_window.skill = @abilities_window.skill
@item_needed_window.refresh
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when confirm window is active)
#--------------------------------------------------------------------------
def update_confirm
if Input.trigger?(Input::C)
if @confirm_window.index==0
# Play decision SE
$game_system.se_play($data_system.decision_se)
@confirm_window.active=false
@confirm_window.visible=false
@abilities_window.active = true
@actors[@menu_index].learn_skill(@abilities_window.skill.id)
$game_party.lose_item(AEONS_LEARNINGS[@abilities_window.skill.id][0],
AEONS_LEARNINGS[@abilities_window.skill.id][1])
@item_needed_window.refresh
@abilities_window.refresh
return
else
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@confirm_window.active=false
@confirm_window.visible=false
@abilities_window.active = true
return
end
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@confirm_window.active=false
@confirm_window.visible=false
@abilities_window.active = true
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when empty window is active)
#--------------------------------------------------------------------------
def update_empty
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new
return
end
end
end
def initialize(x, y, width, height, actor)
super(x, y, width, height, 22)
@actor = actor
@target_x=self.x
@target_y=self.y
refresh
end
#--------------------------------------------------------------------------
# * Set coordinates
#--------------------------------------------------------------------------
def set_x(val)
self.x=val
@target_x=val
end
def set_y(val)
self.y=val
@target_y=val
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
# Not needed as WindowSelectablePlus already supports sliding
#def update
# super
# self.x+=0.3*(@target_x-self.x)
# self.y+=0.3*(@target_y-self.y)
#end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
keys=AEONS_LEARNINGS.keys
for key in 0...keys.length
skill = $data_skills[keys[key]]
if skill != nil and not @data.include?(skill)
@data.push(skill)
end
end
@data.sort! {|a,b|
a.sp_cost - b.sp_cost }
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Acquiring Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.summon_skill_can_learn?(skill.id)
self.contents.font.color = crisis_color
elsif @actor.skills.include?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# initialize values according to window_selectable_plus class
cursor_width = self.width / @column_max - 32
x = 4 + index % @column_max * (cursor_width + 32)
y = index / @column_max * @row_height
rect = Rect.new(x, y, cursor_width-4, @row_height)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == disabled_color ? 128 : 255
temp2=Rect.new(x, y, @row_height, @row_height)
temp1=Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.stretch_blt(temp2,bitmap,temp1,opacity)
self.contents.font.size=@row_height-2
x = x + @row_height + 4
self.contents.draw_text(x, y, cursor_width - @row_height - 4 - 4 - 48 - 4, @row_height, skill.name, 0)
x = x + cursor_width - @row_height - 4 - 4 - 48 - 4
self.contents.draw_text(x, y, 48, @row_height, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
if @skill != nil
if AEONS_LEARNINGS[@skill.id] != nil
x = 8
y = 0
item = $data_items[AEONS_LEARNINGS[@skill.id][0]]
self.contents.draw_text(x, y, 32, 32,
(AEONS_LEARNINGS[@skill.id][1]).to_s+"x", 1)
# draw item
x = 40
rect = Rect.new(x, y, 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.font.bold = true
y = 32
x = 4
self.contents.font.color = ($game_party.item_number(item.id)-AEONS_LEARNINGS[@skill.id][1]>0) ? normal_color : disabled_color
self.contents.draw_text(x, y, 32, 32,
($game_party.item_number(item.id)).to_s, 1)
x = 120
self.contents.draw_text(x, y, 32, 32,
[($game_party.item_number(item.id)-AEONS_LEARNINGS[@skill.id][1]),0].max.to_s, 1)
end
end
end
#--------------------------------------------------------------------------
# * Set coordinates
#--------------------------------------------------------------------------
def set_x(val)
self.x=val
@target_x=val
end
def set_y(val)
self.y=val
@target_y=val
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
self.x+=0.3*(@target_x-self.x)
self.y+=0.3*(@target_y-self.y)
end
end
#==============================================================================
# ? Window_Confirm
#==============================================================================
class Window_Confirm < Window_Selectable
attr_accessor :answer
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize()
super(100, 200, 440, 96+32)
@column_max = 2
@item_max = 2
@choiches= ["Continue","Cancel"]
self.z=999
self.back_opacity=255
self.opacity=255
refresh
self.active = true
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text(0, 0, 408, 32, "Are you sure?", 1)
self.contents.draw_text(0, 32, 408, 32, "", 1)
self.contents.draw_text(16, 64, 172, 32, @choiches[0], 1)
self.contents.draw_text(16+172+32, 64, 172, 32, @choiches[1], 1)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = 180
# Calculate cursor coordinates
x = @index==0 ? 16 : 16+172+32
y = 64
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
end
class Scene_Battle
alias summon_main main
def main
@summon_help_window=Window_Summon_Help.new(0,64,332+32,200)
@summon_help_window.visible=false
@summon_id=-1
summon_main
@summon_help_window.dispose
end
alias summon_update_phase3_skill_select update_phase3_skill_select
def update_phase3_skill_select
summon_update_phase3_skill_select
if @skill_window==nil or @skill_window.visible==false
@summon_help_window.visible=false
@summon_id=-1
return
end
if @skill_window.skill.element_set.include?($game_temp.summon_element_id)
if @skill_window.skill.id != @summon_id
@summon_id = @skill_window.skill.id
@summon_help_window.set_summon(@summon_id)
end
else
@summon_help_window.visible=false
@summon_id=-1
end
end
end
class Window_Summon_Help < Window_Base
def set_summon(id)
@summon_id=id
@actors_ids=$game_party.game_summons[id].actors_ids
self.visible=true
refresh
end
class Game_Actor
attr_accessor :original_form_id
attr_accessor :transformed_form_id
end
$data_skills.each_index do |index| $retire_skill_id=index if ($data_skills[index]!=nil and $data_skills[index].name==RETIRE_NAME) end
#==============================================================================
# ? SCENE TRANSFORMATIONS
#==============================================================================
class Scene_Transformations < Scene_Summons
def initialize(menu_index = 0)
@actors=$game_party.transformations
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Frame Update (when aeons window is active)
#--------------------------------------------------------------------------
def update_aeons
old_menu_index=@menu_index
@menu_index=@aeons_window.index
@status_window.actor=@actors[@menu_index]
# If UP or DOWN button was pressed
if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or old_menu_index!=@menu_index
@status_window.refresh
@abilities_window.index = 0
return
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Menu.new
return
end
end
end
You have use the "Summon" tag again, like you did.
That error shouldn't be there...
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - habs11 - 07-18-2009
Hey Charlie, thank you for removing those debug messages, much appreciated. Ok, so I still had the error, but I think I might have fixed it.
So take a look at the error line:
715 ((aeon.invoked_during_last_battle)?(INVOKED_AEON_EXP_MULTIPLIER):(NOT_INVOKED_AEON_EXP_[]MULTIPLIER)))
Now for whatever reason, on my script there was a symbol that looks like a square in front of the last Multiplier. I drew it with brackets ([]) above. I don't know what the symbol is, I have never seen it in any other scripts, and it looked out of place so I tried deleting it and it worked! No more error! I guessing that this is not in the original script because I don't see it in the one you posted above. Any ideas where it came from? And is it ok to leave off? There is another one on line 722 right before the last Transformation. I denoted it with the ([]) again. Should I get rid of it?
Again I don't see it in the script above here, so I don't know why it would be in the game script when I pasted it into the summons script. I hope this helps. Let me know if I'm messing things up. Sorry that this little problem has taken much of your time. Thanks for the help.
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Charlie Fleed - 07-18-2009
I don't know where these "[]" come from... you did right by getting rid of them.
I'm glad to hear everything is working now. Cya.
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Kany64 - 07-19-2009
charlie i have a problem again when i want to swith a actor in battle
then is writing
script super arts1.7 line351 type error occured
no implicit conversion from nil to integer
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Charlie Fleed - 07-19-2009
Make sure you created a skill named with the name defined in:
SWITCH_NAME="Switch"
and that it calls a common event with "$scene.switch()" in it.
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - pman6666 - 07-23-2009
it will not run in my xp it says "project could not read due to incompatibility between software versions"
plz help
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - lndignation - 07-23-2009
Hey Charlie, I just joined the forums to ask you a question on the "Superarts" section of the script
I've fiddled around with the script a bit, changing the status screen slightly to a different input button and some other small details.
Now, in my game, I would prefer if only one kind Super Arts was available. I assume I would remove the following the lines to prevent toggling and such, but how would I actually remove some of the methods of filling the bar, i.e, I only want the bar to be filled by "rage".
I know I have to get rid of the following code, but I don't know what else. I don't want to accidently delete something I needed :P
Code:
class Scene_Status
alias sa_update update
def update
if Input.trigger?(Input::A)
@actor.toggle_superart_type
@status_window.refresh
return
end
sa_update
end
end
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Charlie Fleed - 07-23-2009
@pman6666: I'm not sure but maybe the problem is the dll you have installed in your system. Open Game.ini in the demo folder and locate the line that says Library=RGSS102E.dll, you can change it to reflect the dll you have.
@Indignation: You can just remove that section. The code for the other filling methods will never be executed, you don't need to actually remove it.
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - lndignation - 07-24-2009
Alright thanks a lot, but how can I set what method of super art filling is default instead of it being the damage inflicted one?
CTB - A Final Fantasy X-like Battle System, version 3.1 (NEW Jul 4 2010) - Charlie Fleed - 07-24-2009
Here you decide, it's in the configuration:
Code:
SUPER_ARTS_TYPE_DEFAULT=1
# 0 - Earn SA points by suffered damage (SA=TYPE_0_RATE*SUPER_ARTS_MAX*damage/(MaxHp))
# 1 - Earn SA points by inflicted damage (SA=TYPE_1_RATE*SUPER_ARTS_MAX*damage/(AttackerMaxHP))
# 2 - Earn SA points by suffered damage by allies (SA=TYPE_2_RATE*SUPER_ARTS_MAX*damage/(AllyMaxHp))
# 3 - Earn SA points when skills belonging to given categories are used (SA=TYPE_3_RATE*SUPER_ARTS_MAX)
# 4 - Earn SA points when hp <= max_hp / 4 (SA=TYPE_4_RATE*SUPER_ARTS_MAX)