#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
# Field of Aether Script by TerreAqua
# Version: 1.10
# Type: Blizz-ABS Skills Add-on
# Key Term: Skill Add-on
# Date: 9/3/08
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=#
#===============================================================================
# Information
#-------------------------------------------------------------------------------
#
# This script is a plug-in for the popular Blizz-ABS. It allows for skills
# to create an elemental field which allows for new skills to be used within
# the field, much like the PS2 game, Tales of the Abyss.
#
# If you need to contact me about this script, please go to:
# http://forum.chaos-project.com
#
# You should have only gotten this script from http://chaos-project.com
# Please let me know if you have found it somewhere else.
#===============================================================================
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~::~:~:~: Instructions :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#===============================================================================
# Fill out all the info in the below module with the settings that you want.
# Please make sure that
# FIELD_ELEMENTS,
# FIELD_EVENT_ID,
# FIELD_SWITCHES, and
# FIELD_ELE_CHARGE
# are in same corresponding order to avoid possible bugs.
#
# In order for a skill to make a field, it needs to have the elements of
# one of the FIELD_ELEMENTS and has to have the element set up in FIELD.
# NOTE:
# If a skill that creates a field has multiple FIELD_ELEMENTS for elements,
# then it will create only the elemental field of the last element set up in
# FIELD_ELEMENTS that the skill has.
#-------------------------------------------------------------------------------
#
# IMPORTANT!!!!! YOU MUST DO THIS FOR THIS PLUG-IN TO WORK
# On the map ID that you set up for FIELD_MAP_ID, make one event for each
# elemental field that you have, making sure that the event IDs match
# FIELD_EVENT_ID.
#
# For best results it is recommended that you have this event coding for each
# event.
#
# Conditions: Switch ID (corresponding one in FIELD_SWITCHES) to be on
# Event Graphic: An elemental field
# Trigger: Parallel Process
# Options: Through (others depending on how you want it)
# Event Commands: (Remember to change the Variables to appropriate numbers)
#
# Control Variables: [0000: Hero Map X] = Player's Map X
# Control Variables: [0000: Hero Map Y] = Player's Map Y
# Script: @foatime = $game_variables[
# AquaFoA::FIELD_TIME_ID] /
# Graphics.frame_rate
# Conditional Branch: @foatime == AquaFoA::FIELD_TIME
# Control Switches: [Corresponding one in FIELD_SWITCHES: ] = Off
#
# Else
# Control Variables [0000: FIELD_TIME_ID] += 1
# (Add optional, misc. coding here ie. heal party)
#
# Branch End
#
#
#===============================================================================
module AquaFoA
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~: Main Configuration Area :~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
FIELD_ELEMENTS = [1, 2, 5, 6, 7, 8] #Elements that create fields
FIELD_X = 30 #Variable ID to store Field Map X
FIELD_Y = 31 #Variable ID to store Field Map Y
FIELD_MAP_ID = 'Data/Map002.rxdata' #Map ID that contains Field Events
FIELD_TIME = 5 #Seconds a field is active
FIELD_TIME_ID = 39 #Variable to store the time a field is active
FIELD_EVENT_ID = [1, 2, 3, 4, 5, 6] #Event ID of Field Events
FIELD_ON = false #true/false to allow/disallow all elemental skills to make a field
FIELD = 16 #Element ID of skills that will create fields. Does not need to be
#configured if FIELD_ON is set to true
FIELD_SWITCHES = [3, 4, 5, 6, 7, 8] #Switches to turn off/on field
FIELD_ELE_CHARGE = [33, 34, 35, 36, 37, 38] #Variables to contain the charge of a field
DISPLAYFOA = true #true/false to turn on/off the text that display when a FoA skill is used
FOATEXT = 'FoA Charge!' #Text to display when a charge is used
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~: Configure Skill Area ~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
def self.skill(id)
case id
#===============================================================================
# Configure the skills that get replaced and what elemental field it needs by
# this format:
#
# when A then return [W, X, Y, Z]
#
# Where A is the skill that gets replaced,
# W is the charged skill that replaces A,
# X is the the id from FIELD_EVENT_ID of the elemental field it needs,
# Y is the amount of charge the skill gives to its elemental field,
# Z is the amount of charge from its elemental field needed for a skill
# to change.
#
# when A
# if $game_switches[Elemental switch corresponding to X]
# return [W, X, Y, Z]
# elsif $game_switches[Elemental switch corresponding to X]
# return [W, X, Y, Z]
# end
#===============================================================================
when 57 then return [81, 1, 30, 30]
when 7 then return [id, 1, 10, 10]
when 84 then return [83, 6, 30, 30]
when 85 then return [86, 5, 30, 30]
when 87 then return [88, 4, 30, 30]
when 89 then return [90, 3, 30, 30]
when 91 then return [92, 2, 30, 30]
when 16 then return [id, 2, 10, 10]
when 19 then return [id, 3, 10, 10]
when 22 then return [id, 4, 10, 10]
when 25 then return [id, 5, 10, 10]
when 28 then return [id, 6, 10, 10]
end
return [id, 0, 10, 50] #Set the default
#Leave id as is for no default charged replacement skill.
end
end
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~ End Configure Area :~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
################################################################################
####################### Continue Scrolling Down ##############################
####################### For Credit Info, ##############################
####################### Upcoming Features/Bugs, ##############################
####################### and Terms of Use ##############################
####################### Otherwise... ##############################
####################### STOP HERE!!! ##############################
################################################################################
#===============================================================================
# Credits:
# Aqua (aka TerreAqua) for making this Blizz-ABS Plug-in.
# Namco Bandai Games for making Tales of the Abyss for which this plug-in is
# based from.
# Blizzard for making Blizz-ABS, the event steal code, and helping me through
# start of this script.
# Juan, legacyblade, and NAMKCOR for helping me with a few scripting troubles
# through IRC.
# shdwlink1993 for letting me pester him with questions about cases and arrays
# and the tip about multiple replacement skills.
# Starrodkirby86 for letting me rant when I didn't have a clue what was wrong,
# proofreading the comments, making the demo, and for the support.
#===============================================================================
#===============================================================================
# Features Planned for Future Release
#-------------------------------------------------------------------------------
# FoA skill description in skill menu
# (Working on it...)
# Different field sizes
# (Expect this next realease.)
# Fields being used as multiple elements
# (I got it working with my own input for variables, but I need to make it
# work with a module. Expect this next release.)
#===============================================================================
# Known Bugs
#-------------------------------------------------------------------------------
# Does not work with pixel movement due to problems with the Distance
# (I will try to get this fixed ASAP)
#===============================================================================
#===============================================================================
# This work is protected by the following license:
# #-----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #-----------------------------------------------------------------------------
#===============================================================================
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~: DO NOT EDIT BELOW THIS!! ~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
#:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~#
# Version Number Global Variable
$AquaFoAVer = 1.10
# Blizz-ABS Version Checker
if $BlizzABS != true || BlizzABS::VERSION < 1.99
raise 'ERROR: The Field of Aether plugin requires Blizz-ABS 1.99 or higher.'
end
class Map_Battler
alias skill_effect_aqua_x skill_effect
def skill_effect(character, _battler, skill)
result = skill_effect_aqua_x(character, _battler, skill)
if result && AquaFoA::FIELD_ELEMENTS.any? {|i| skill.element_set.include?(i)} &&
skill.element_set.include?(AquaFoA::FIELD)
# Gets coords of the target of a skill
@fieldx = (@real_x + 64) / 128
@fieldy = (@real_y + 64) / 128
# Stores current skill into a variable
@currentskill = skill.id
# Event Steal Code P1
map = load_data(AquaFoA::FIELD_MAP_ID)
max = ($game_map.events.keys + $game_map.map.events.keys).max
max = 0 if max == nil
max += 1
# Turn on correct field by element
AquaFoA::FIELD_ELEMENTS.each {|i|
@skillelement = i if skill.element_set.include?(i)
}
AquaFoA::FIELD_ELEMENTS.each_index {|i|
@fieldelement = i if AquaFoA::FIELD_ELEMENTS[i] == @skillelement
}
(AquaFoA::FIELD_SWITCHES.first..AquaFoA::FIELD_SWITCHES.last).each {|i|
$game_switches[i] = false
}
# Add amount of charge
$game_variables[AquaFoA::FIELD_ELE_CHARGE[@fieldelement]] += AquaFoA.skill(@currentskill)[2]
# Turns on field switch
$game_switches[AquaFoA::FIELD_SWITCHES[@fieldelement]] = true
# Resets Timer
$game_variables[AquaFoA::FIELD_TIME_ID] = 0
# Steals event
if skill.element_set.include?(AquaFoA::FIELD) && !AquaFoA::FIELD_ON ||
AquaFoA::FIELD_ON == true
# Event steal code p2
event = map.events[AquaFoA::FIELD_EVENT_ID[@fieldelement]]
event.id = max
# Map X and Y coords for Event
event.x = @fieldx
event.y = @fieldy
$game_variables[AquaFoA::FIELD_X] = @fieldx
$game_variables[AquaFoA::FIELD_Y] = @fieldy
# Gets Graphic for the stolen event
$game_map.map.events[max] = event
$game_map.events[max] = Game_Event.new($game_map.map_id, event)
sprite = Sprite_Character.new($scene.spriteset.viewport1, $game_map.events[max])
$scene.spriteset.character_sprites.push(sprite)
# Turns off old field if already exists
$game_map.events.each_value {|e| e.terminate = true if e.stolen}
if $game_map.events[max].stolen == true
$game_switches[AquaFoA::FIELD_SWITCHES[@fieldelement]] = false
$game_variables[AquaFoA::FIELD_TIME_ID] = 0
end
# Signals that a field has been made
$game_map.events[max].stolen = true
end
end
return result
end
# Skill replacement
alias use_skill_aqua_x use_skill
def use_skill(skill)
# Assign some variables used for conditions and skill replacement
@currentskill2 = skill.id
@skillreplace = AquaFoA.skill(@currentskill2)[0]
@replaceele = AquaFoA.skill(@currentskill2)[1]
@currentfield = @replaceele - 1
@battlerx = @real_x/128
@battlery = @real_y/128
# Replacement result
replace = has_learned = false
# Conditions to test if able to use Field
if $game_switches[AquaFoA::FIELD_SWITCHES[@currentfield]] == true &&
$game_variables[AquaFoA::FIELD_ELE_CHARGE[@currentfield]] >= AquaFoA.skill(@currentskill2)[3] &&
@battlerx == $game_variables[AquaFoA::FIELD_X] &&
@battlery == $game_variables[AquaFoA::FIELD_Y]
# Checks Field Distance
# Replaces current skill with new and charged one if there is one
if @skillreplace != @currentskill2 &&
# Checks if battler has enough SP to use skill
self.battler.sp >= $data_skills[@skillreplace].sp_cost
# If can use
if self.battler.is_a?(Game_Enemy) ||
self.battler.skills.include?(@skillreplace)
# Uses replacement skill if already learned
skill = $data_skills[@skillreplace] if skill.id == @currentskill2
else
# Set learning flag
has_learned = true
# Learns replacement skill if not learned
self.battler.learn_skill(@skillreplace)
# Uses replacement skill
skill = $data_skills[@skillreplace] if skill.id == @currentskill2
end
# Set replacement flag
replace = true
end
# Checks the element of replacement skill
for i in AquaFoA::FIELD_ELEMENTS
@skillelement2 = i if skill.element_set.include?(i)
end
# Turns off and resets the field when a replacement skill is usedl
$game_switches[AquaFoA::FIELD_SWITCHES[@currentfield]] = false
$game_variables[AquaFoA::FIELD_ELE_CHARGE[@currentfield]] = 0
$game_map.events.each_value {|e| e.terminate = true if e.stolen}
@skillelement = nil
@skillelement2 = nil
end
# Execute skill
result = use_skill_aqua_x(skill)
# If replaced
if replace
# Displays text if configured
self.battler.damage = "#{AquaFoA::FOATEXT}"
# Forgets replacement skill if learned before
self.battler.forget_skill(@skillreplace) if has_learned
end
# Skill use result for further processing
return result
end
end
class Game_Character
attr_accessor :stolen
end
class Game_System
alias event_removal_aqua_x event_removal
def event_removal
# Delete all stolen events that should be terminated
($game_map.events.values.find_all {|event|
event.stolen && event.terminate}).each {|event|
$game_map.events.delete(event.id)}
event_removal_aqua_x
end
end