06-10-2010, 01:00 PM
(This post was last modified: 05-14-2017, 05:23 AM by DerVVulfman.)
Add-Ons for GTBS
iPenguin
Jun 15 2010
I've been working on adding code and such to make the TBS more customizable or just new features. Check each spoiler for a short summary along with another spoiler containing the code. Some of these I posted in the GTBS topic, some I posted there and improved on it, and others I havne't posted there yet. I will try and keep this first post edited as I release new features or clean/remake some of the ones I did (such as Auto-Life, needs some adjusting before I want to post here). I plan on adding my new victory conditions and such later too so check back.
I want to make these scripts as simple as adding above main rather than all the fixes my previous posts required thus the delay.
I use XP so they should work fine in XP, I'll need people who use VX to make sure they work fine in VX as well.
Please credit me if you use them(at least the bigger ones like Unite/Support System - I don't really think I deserve any credit for the smaller things like View and Force Move) and don't forget to credit GubiD overall for the TBS system!
If you have any questions about my add-ons, ask here rather than crowding GubiD's already crowded topic.
To use these, simply add them (each) as a new script above main and follow any instructions or configuration I may have commented.
Unite/Support System (now includes support status)
When 2 characters who can "support" each other stand next to each other they will both gain a small boost status (if you turn that option on and define a state ID).
When they step away from each other the status will automatically go off.
Supporting actors can also learn a unique "Unite" skill when in this support range if you
define it as well. Simply do not give them a when condition in the last method for skills
and they will only have the support status instead.
The Script
Force Move Add On
Force actors and enemies to move to a certain x,y position.
Actors can be forced to a position based on your parallel process (game turn perhaps?)
or if they reach a certain x,y.
Enemies can only be moved based on parallel process.
I also added a method to use for setting the cursor on actor
(Say for Talking events)
which is basically a copy of GubiD's method for enemy.
act = get_tbs_actor(id)
set_tbs_cursor(act.x,act.y)
View Add On
This script allows you to change enemy view range on a battle to battle basis.
For each battle, make a script before the battle (I put it before the victory conditions and it works fine) and type $game_temp.view_range = #
Replace # with whatever you want the new view to be.
The only glitch is if you have the same amount of battlers (or greater than) as the enemies, they will move regardless of what you changed the view to.
Set $game_temp.view_range = 0 to return to the default view_range.
Add the below as a new script above main
Various Patches
(I haven't fully tested and just copied and pasted my fixes I posted in the GTBS topic into a script so hopefully it is alright.)
Also Includes my "turn Counter attacks off/on" via variable.
Includes Fixes for
-------------------
Attack Allies = False Crash
Neutral Crash when no more enemies
Teleport Crash
Team Mode fixes (enemy freeze)
(Code tag is messing up so just spoiler...)
iPenguin
Jun 15 2010
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
I've been working on adding code and such to make the TBS more customizable or just new features. Check each spoiler for a short summary along with another spoiler containing the code. Some of these I posted in the GTBS topic, some I posted there and improved on it, and others I havne't posted there yet. I will try and keep this first post edited as I release new features or clean/remake some of the ones I did (such as Auto-Life, needs some adjusting before I want to post here). I plan on adding my new victory conditions and such later too so check back.
I want to make these scripts as simple as adding above main rather than all the fixes my previous posts required thus the delay.
I use XP so they should work fine in XP, I'll need people who use VX to make sure they work fine in VX as well.
Please credit me if you use them(at least the bigger ones like Unite/Support System - I don't really think I deserve any credit for the smaller things like View and Force Move) and don't forget to credit GubiD overall for the TBS system!
If you have any questions about my add-ons, ask here rather than crowding GubiD's already crowded topic.
To use these, simply add them (each) as a new script above main and follow any instructions or configuration I may have commented.
Unite/Support System (now includes support status)
Support System
When 2 characters who can "support" each other stand next to each other they will both gain a small boost status (if you turn that option on and define a state ID).
When they step away from each other the status will automatically go off.
Supporting actors can also learn a unique "Unite" skill when in this support range if you
define it as well. Simply do not give them a when condition in the last method for skills
and they will only have the support status instead.
The Script
Code:
module UNITE
#=================================================
#UNITE Add-on by iPenguin for GTBS by GubdiD
#=================================================
#What is this?
#When an actor stands next to a supported partner
#(Defined in the configuration), the actor and the
# supported partner will both learn a skill that you
# define in the database. It can only be used when this
# pair are standing next to each other. How close
# is defined by the range configuration.
#
#
# Unite Skills are forgotten the moment
# they leave the support range.
#
# Note, the actor and partner must have their own
# unique unite skill. Using the same skill for another
# pair will cause a known problem in which they lose
# the skill.
#==================================================
#Instructions:
#==================================================
# Make a parallel Process Event in each battle map.
#
#Conditional Branch: Script: $game_temp.in_battle
# Script: unite?
#branch end
#
# It is that easy!
# The configuration on the other hand is a tad
# tricky.
#=================================================
#
# Begin Configuration
#
# V1.0 Unite Skills Only
# V1.1 Include Support Status
# V1.1.1 Fix Support Range Bug
# V1.2 Fixed Not-using actor but unite skill
# shows bug.
#
#==================================================
#Support_Status - Set true if you want to use a
# a status so that any two characters who can share
# a unite skill also gain a boost in stats
#(defined from the state)
# Support_State = the ID of that state.
#
# Note, if you want characters to "support" each other
# through status but not skill, define that they can
#support each other in UNITE_WITH but simply do NOT
#give then a when # return skill in
# def self.get_unite(actor_id, partner_id)
#
#===================================================
Support_Status = true
Support_State = 17
#==================================================
# This is a list of partners to support.
# This *MUST* be defined or the code will not work.
#
# {
# Actor ID => [SupportActorID, Support Actor ID,
# Support ActorID, etc],
# Actor ID => [SupportActorID, Support Actor ID,
# Support ActorID, etc]
#
# }
#
# Note if done correctly, each actor should be in each
# other's support array. Notice Actor 1 is in Actor
# 2's support and Actor 2 is in Actor 1's support.
#
#==================================================
UNITE_WITH = {
1 => [2, 3, 5],
2 => [1, 3, 4],
3 => [1, 2, 4, 5, 6, 7],
4 => [2, 3, 7],
5 => [1, 3],
6 => [3, 7],
7 => [3, 4, 6]
}
#==================================================
# Support Range - Configure Diagonal Support
#
#
# false is like this [S] being support range
# [A] is Actor.
# [S]
# [S] [A] [S]
# [S]
#
#
#
# With Diagonal Support = true support range is
#
#
# [S] [S] [S]
# [S] [A] [S]
# [S] [A] [S]
#
#===================================================
Diagonal_Support = true
#==================================================
# Layout may be a little confusing so this is here
# to help.
# case actor_id
# when 1
# case partner_id
#
# This is saying, when the actor is 1, who are their
# support partners?
#
# Now for each when #
# case partner_id
# there is a new list going. These new --> indented
# numbers are the partner ids that the original actor
# can support with.
#
# Return value is the skill id the 2 partners learn.
#
# Note that if you did everything correctly, each unite
# skill_id should be listed twice, once for each partner.
#===================================================
def self.get_unite(actor_id, partner_id)
case actor_id
when 1 # Actor 1
case partner_id
when 2 # Partner is Actor 2
return 120 # Partner 1 & 2 learn skill 120
when 3 # Partner is Actor 2
return 87 # Partner 1 & 3 learn skill 87
when 5
return 159
end #end case partner_id
return 0
when 2
case partner_id
when 1
return 120
when 3
return 155
when 4
return 162
end #end case partner_id
return 0
when 3
case partner_id
when 1
return 87
when 2
return 155
when 4
return 158
when 5
return 160
when 6
return 156
when 7
return 154
end #end case partner_id
return 0
when 4
case partner_id
when 2
return 162
when 3
return 158
when 7
return 161
end #end case partner_id
return 0
when 5
case partner_id
when 1
return 159
when 3
return 160
end #end case partner_id
return 0
when 6
case partner_id
when 3
return 156
when 7
return 165
end #end case partner_id
return 0
when 7
case partner_id
when 3
return 154
when 4
return 161
when 6
return 165
end #end case partner_id
return 0
### Add new when # case partner_id here
### Follow the pattern above, no need to put any "end"
###except before return 0.
end #end case actor_id
end#end def
end#end module
#==================================
# Do Not edit anything below
#==================================
class Game_Actor < Game_Battler
attr_accessor :nearflag
alias setup_unite setup
def setup(actor_id)
setup_unite(actor_id)
@nearflag = 0
end
end
if GTBS::VX
#----------------------------------------------------------------
# Interpreter Updates
#----------------------------------------------------------------
class Game_Interpreter
### UNITE SYSTEM
def unite?
if $game_temp.battle_turn > 0 #Bug test check
for act in $game_system.tactics_actors
act.nearflag = 0 #reset flag to 0
# get actor
if UNITE::UNITE_WITH.keys.include?(act.id)
for id in UNITE::UNITE_WITH[act.id]
### Get partneer
for par in $game_system.tactics_actors
if par.id == id
partner = par
skill_id = UNITE.get_unite(act.id,partner.id)
if partner.dead? or act.dead?
if skill_id != 0 #if not Support Only(no skill)
act.forget_skill(skill_id)
partner.forget_skill(skill_id)
end#added
if UNITE::Support_Status
# partner.remove_state(UNITE::Support_State)
if act.dead?
act.remove_state(UNITE::Support_State)
end
end #end Support Status
else
if near_partner?(act.x,act.y,par.x,par.y)
if skill_id != 0 #if not Support Only(no skill)
act.learn_skill(skill_id)
partner.learn_skill(skill_id)
end#added
if UNITE::Support_Status
partner.add_state(UNITE::Support_State)
act.add_state(UNITE::Support_State)
act.nearflag += 1
par.nearflag +=1
end #end Support Status
else ### Not near partner = Forget skill
if skill_id != 0 #if not Support Only(no skill)
act.forget_skill(skill_id)
partner.forget_skill(skill_id)
end #added
# if UNITE::Support_Status
# partner.remove_state(UNITE::Support_State)
# end #end Support Status
end#if end near partner
end#if end is dead
end#if par.id == id
end#for
#end cycle of Partners
if UNITE::Support_Status
if act.nearflag > 0
act.add_state(UNITE::Support_State)
# else
else
# break
act.remove_state(UNITE::Support_State)
end#adddddddd
end#end if
end#for
end#if
end#for
end #bug test if check
end#def
def near_partner?(x1 = -1,y1 =-1, x2 = 0, y2 = 0)
return false if x1 == -1
return false if y1 == -1
if x1 == x2
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if y1 == y2
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
### CHecked + Now for diagonals
if UNITE::Diagonal_Support
if x1 == (x2 - 1)
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if x1 == (x2 + 1)
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if y1 == (y2 - 1)
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
if y1 == (y2 + 1)
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
end
## All else fails
return false
end
end
end
class Interpreter
### UNITE SYSTEM
def unite?
if $game_temp.battle_turn > 0 #Bug test check
for act in $game_system.tactics_actors
act.nearflag = 0 #reset flag to 0
# get actor
if UNITE::UNITE_WITH.keys.include?(act.id)
for id in UNITE::UNITE_WITH[act.id]
### Get partneer
for par in $game_system.tactics_actors
if par.id == id
partner = par
skill_id = UNITE.get_unite(act.id,partner.id)
if partner.dead? or act.dead?
if skill_id != 0 #if not Support Only(no skill)
act.forget_skill(skill_id)
partner.forget_skill(skill_id)
end#added
if UNITE::Support_Status
# partner.remove_state(UNITE::Support_State)
if act.dead?
act.remove_state(UNITE::Support_State)
end
end #end Support Status
else
if near_partner?(act.x,act.y,par.x,par.y)
if skill_id != 0 #if not Support Only(no skill)
act.learn_skill(skill_id)
partner.learn_skill(skill_id)
end#added
if UNITE::Support_Status
partner.add_state(UNITE::Support_State)
act.add_state(UNITE::Support_State)
act.nearflag += 1
par.nearflag +=1
end #end Support Status
else ### Not near partner = Forget skill
if skill_id != 0 #if not Support Only(no skill)
act.forget_skill(skill_id)
partner.forget_skill(skill_id)
end #added
# if UNITE::Support_Status
# partner.remove_state(UNITE::Support_State)
# end #end Support Status
end#if end near partner
end#if end is dead
end#if par.id == id
end#for
#end cycle of Partners
if UNITE::Support_Status
if act.nearflag > 0
act.add_state(UNITE::Support_State)
# else
else
# break
act.remove_state(UNITE::Support_State)
end#adddddddd
end#end if
end#for
end#if
end#for
end # bug check if
end#def
def near_partner?(x1 = -1,y1 =-1, x2 = 0, y2 = 0)
return false if x1 == -1
return false if y1 == -1
if x1 == x2
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if y1 == y2
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
### CHecked + Now for diagonals
if UNITE::Diagonal_Support
if x1 == (x2 - 1)
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if x1 == (x2 + 1)
if y2 == (y1 + 1) or y2 == (y1 - 1)
return true
end
end
if y1 == (y2 - 1)
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
if y1 == (y2 + 1)
if x2 == (x1 + 1) or x2 == (x1 - 1)
return true
end
end
end
## All else fails
return false
end
end
Force Move Add On
The Script
Force actors and enemies to move to a certain x,y position.
Actors can be forced to a position based on your parallel process (game turn perhaps?)
or if they reach a certain x,y.
Enemies can only be moved based on parallel process.
I also added a method to use for setting the cursor on actor
(Say for Talking events)
which is basically a copy of GubiD's method for enemy.
act = get_tbs_actor(id)
set_tbs_cursor(act.x,act.y)
Code:
#=====================================
# iPenguin's Force Move Add On for GubiD's TBS
#=====================================
#Features
#
#get_tbs_actor(actor_id) - (used for moving cursor for talking events)
#
#A script event like so
#
#act = get_tbs_actor(id)
#set_tbs_cursor(act.x,act.y)
#
#actor_force_move(x1,y1,x2,y2) - (when reach x1,y1 move to x2,y2)
#actor_force_move2(actor_id,x,y) - (force actor to move to to x y)
#enemy_force_move(enemy_id,x,y)
#
#
#Simply put these in a parallel process event on the battle map.
# Have their condition set to battle turn, whatever.
#
if GTBS::VX
#----------------------------------------------------------------
# Interpreter Updates
#----------------------------------------------------------------
class Game_Interpreter
def get_tbs_actor(id = 0)
return if id == 0
for act in $game_system.tactics_actors
if act.id == id
return act
break
end
end
end
def actor_force_move(x1 = -1,y1 =-1, x2 = 0, y2 = 0)
return false if x1 == -1
return false if y1 == -1
for act in $game_system.tactics_actors
if act.x == x1 && act.y == y1
act.moveto(x2,y2)
return true
# break
end
end
end
def actor_force_move2(id = 0,x = -1, y = -1 )
return false if x == -1
return false if y == -1
for act in $game_system.tactics_actors
if act.id == id
act.moveto(x,y)
return true
# break
end
end
return false # is not in the battle
end
def enemy_force_move(id = 0, x = -1, y = -1)
return false if x == -1
return false if y == -1
for en in $game_system.tactics_enemies
if en.id == id
en.moveto(x,y)
return true
end
end
return false #enemy not in battle
end
end #class
end #end if
class Interpreter
#### Added EDITS BE HERE
def get_tbs_actor(id = 0)
return if id == 0
for act in $game_system.tactics_actors
if act.id == id
return act
break
end
end
end
def actor_force_move(x1 = -1,y1 =-1, x2 = 0, y2 = 0)
return false if x1 == -1
return false if y1 == -1
for act in $game_system.tactics_actors
if act.x == x1 && act.y == y1
act.moveto(x2,y2)
return true
# break
end
end
end
def actor_force_move2(id = 0,x = -1, y = -1 )
return false if x == -1
return false if y == -1
for act in $game_system.tactics_actors
if act.id == id
act.moveto(x,y)
return true
# break
end
end
return false # is not in the battle
end
def enemy_force_move(id = 0, x = -1, y = -1)
return false if x == -1
return false if y == -1
for en in $game_system.tactics_enemies
if en.id == id
en.moveto(x,y)
return true
end
end
return false #enemy not in battle
end
end #class
View Add On
View Add On
This script allows you to change enemy view range on a battle to battle basis.
For each battle, make a script before the battle (I put it before the victory conditions and it works fine) and type $game_temp.view_range = #
Replace # with whatever you want the new view to be.
The only glitch is if you have the same amount of battlers (or greater than) as the enemies, they will move regardless of what you changed the view to.
Set $game_temp.view_range = 0 to return to the default view_range.
Add the below as a new script above main
Code:
#===============================================================
# iPenguin's Change View Range Add On for GubiD's TBS
#==============================================================
#For each battle, make a script before the battle
#(I put it before the victory conditions and it works fine)
# and type $game_temp.view_range = #
#
# Replace # with whatever you want the new view to be.
# The only glitch is if you have the same amount of battlers
# (or greater than) as the enemies, they will move regardless
# of what you changed the view to.
#
#Set $game_temp.view_range = 0 to return to the default view_range.
#
#
class Game_Temp
attr_accessor :view_range
#--------------------------------------------------------------------------
# Object Initialization
#--------------------------------------------------------------------------
alias view_temp_init initialize
def initialize
@view_range = 0
view_temp_init
end
end
class Game_Battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias gtbs_battlerview_initialize initialize
def initialize
if $game_temp.view_range == 0
@view_range = GTBS::VIEW_RANGE
else#GTBS - View Range value
@view_range = $game_temp.view_range
end
gtbs_battlerview_initialize
end
def view_range
if $game_temp.view_range == 0
return GTBS::VIEW_RANGE
else
return $game_temp.view_range
end
end
end
Various Patches
(I haven't fully tested and just copied and pasted my fixes I posted in the GTBS topic into a script so hopefully it is alright.)
Also Includes my "turn Counter attacks off/on" via variable.
Includes Fixes for
-------------------
Attack Allies = False Crash
Neutral Crash when no more enemies
Teleport Crash
Team Mode fixes (enemy freeze)
(Code tag is messing up so just spoiler...)
Patch
Code:
module GTBS
# This fixes the crash that occurs when turning Attack_Allies off.
# However it also disables confuse since that was crashing.
ALLY_PATCH = true
# Fixes a crash that occured when Neutrals would have no more enemies to fight.
NEUTRAL_PATCH = true
# Note Team Mode needs "Counter Attack" off for it to work without freezing.
# IF you wish to switch between an ATB with coutners and Team without counters
# see my Counter patch below.
TEAM_PATCH = true
# Note you can call Team battle through
# $game_system.cust_battle = "TEAM"
# and turn back to ATB through
# $game_system.cust_battle = "ATB"
COUNTER_PATCH = true
COUNTERVAR_ID = 25 #put ID of variable to use to turn counter off/on
# 1 is turning counter off, 0 is counter on if COUNTER_ALL is true.
#Fixes teleport bugs.
TELEPORT_PATCH = true
end
class Scene_Battle_TBS
if GTBS::ALLY_PATCH
def get_possible_targets(type = 'attack')
targets = []
#if !GTBS::ATTACK_ALLIES
#error be here
if @active_battler.is_a?(Game_Actor)
if @active_battler.state?(GTBS::CONFUSE_ID) or type == 'help' #if confused or help skill
targets = actors + neutral
else
targets = enemies
end
else
# if !@active_battler.state?(GTBS::CONFUSE_ID) or type == 'help' #if confused
# targets = enemies
# else
targets = actors + neutral
end
# end
return targets
end
end#end ally patch
if GTBS::NEUTRAL_PATCH
def find_approach_move(move_positions)
battler = @active_battler
if battler.is_a?(Game_Enemy)
away = actors + neutral
else
away = enemies
end
closest = 9999
close = nil
t_pos = [] # Temporary position container
tmove_pos = [] # target move position
safe_dist = battler.base_move_range # distance in which is 'safe'
targeten = closest_enemy[0] # Chosen enemy to approach (closest)
dist = pos_distance(targeten,battler)
if battler.is_a?(Game_Enemy) and actors.size < enemies.size and dist > battler.view_range
return [battler.x, battler.y] #no move
end
# Advanced position select method
positions = calc_pos(battler,30,0,"move")
for pos in positions
### Edit for neutral
if targeten != nil##added
if targeten.front == pos and t_pos == []
t_pos = pos
elsif targeten.lside == pos and t_pos == []
t_pos = pos
elsif targeten.rside == pos and t_pos == []
t_pos = pos
elsif targeten.front == pos
t_pos = pos
else#added
t_pos = [] #added
end#added
### end edit for neutral
end
end
if t_pos != []
route = @route[positions.index(t_pos)]
max_route = []
for i in 0...route.size
max_route.push(route[i]) if i < battler.base_move_range #pushes only positions in which you can move to
end
path_pos = get_move_positions_from_route(battler, max_route) #gets x,y coords of recommended movement route
for pos in path_pos #cycles through each position, starting with closest to ensure it is 'safe' and not occupied
next if !can_occupy?(battler, pos) #skip pos if cannot occupy
tdist = (targeten.x-pos[0]).abs + (targeten.y-pos[1]).abs #get distance
if (tdist > safe_dist) #is safe?
close = targeten
closest = tdist
tmove_pos = pos #set move position
end
end
end
closest = 999
close = nil
if battler.ai_level < 2 or tmove_pos == []
for pos in move_positions
for target in away
tdist = (target.x-pos[0]).abs + (target.y-pos[1]).abs
if (closest > tdist) and (tdist > safe_dist) and battler.ai_level > 1
close = target
closest = tdist
tmove_pos = pos
elsif (closest > tdist) and battler.ai_level == 1
close = target
closest = tdist
tmove_pos = pos
end
end
end
end
return tmove_pos
end
#----------------------------------------------------------------
# Pos Distance - Compares the two objects x,y to determine distance
#----------------------------------------------------------------
def pos_distance(p1, p2)
#neutral edits here
if (p1 != nil and p2 != nil)#added here
return ((p1.x-p2.x).abs + (p1.y-p2.y).abs)
else#added
return 999#added
end #added
#end neutral edits
end
end# end Neutral Patch
if GTBS::TEAM_PATCH
#-------------------------------------------------------------------------
# Next Enemy - determines what enemy will act next(only used in team mode)
#-------------------------------------------------------------------------
def next_enemy
#edits be here
if @active_battler == nil#added
for battler in enemies
if $game_system.acted.include?(battler)
next
else
if @active_battler == nil
set_active_battler(battler)
break
elsif @active_battler.is_a?(Game_Actor)
@active_battler = nil
end
end
end
end
end #added
#----------------------------------------------------------------------------
# Process Actions (Attack/Skill/Item)
#----------------------------------------------------------------------------
def tbs_phase_9
case @step
when 0
return if update_screen
@step = 1
when 1
if @attack_animation_index.nil? and @animation2.is_a?(Array)
@attack_animation_index = 0
end
if @attack_animation_index != nil
animation2 = @animation2[@attack_animation_index]
else
animation2 = @animation2
end
animation = $data_animations[animation2]
if !animation.nil?
@turnable = animation.name.downcase.include?("[turn]")
else
@turnable = nil
end
#Turn to target location
if @targets[0] != nil
#edits turn to fix
if @active_battler != nil#added
@active_battler.turn_to(@targets[0])
end#added
else
@active_battler.turn_to(@cursor)
end
@hit_count = 0
#Play user Animations
if @animation1 > 0
@active_battler.animation_id = @animation1
@wait_count = get_wait_guess_for_animation(@animation1)
end
check_projectiles
@step = 2
@apply_all = nil
@spell = nil
#edits be here to fix no method
if @acive_battler != nil #added
if @active_battler.current_action.skill_id > 0 and @active_battler.current_action.kind == 1
@spell = $data_skills[@active_battler.current_action.skill_id]
@windows["help"].set_text(@spell.name,1)
if ALL_TYPES.include?(@spell.scope)
@apply_all = true
end
if @spell.dual?
@targets += @targets
end
end
end#added
if @acive_battler != nil #added
if @active_battler.current_action.item_id > 0 and @active_battler.current_action.kind == 2
item = $data_items[@active_battler.current_action.item_id]
@windows["help"].set_text(item.name,1)
if ALL_TYPES.include?(item.scope)
@apply_all = true
end
if item.dual?
@targets += @targets
end
end
end#added
@gained = @targets.clone
if @targets.size == 1
@melee = true unless @active_bat_temp != nil
end
return
when 2
return if @active_battler.projectile_in_motion? unless @active_battler == nil
#Play target animations/damage display
if @attack_animation_index != nil
animation2 = @animation2[@attack_animation_index]
else
animation2 = @animation2
end
if GTBS::POP_DAMAGE_IND
if @apply_all
anim = Anim_Miss.new(2, animation2)
anim.place(@cursor.x, @cursor.y)
anim.start_anim
@wait_count = [1,$data_animations[animation2].frame_max].max rescue @wait_count = 1
@target = @targets[0]
@step = 3
@apply_all = false
elsif @apply_all == false
@target = @targets[0]
@step = 3
elsif @apply_all == nil
@target = @targets[0]
unless @target.nil?
@target.attacker_dir = @active_battler.direction if @turnable == true
@target.animation_id = animation2 unless @target.nil?
unless $data_animations[animation2] == nil
@wait_count = [1,$data_animations[@animation2].frame_max].max rescue @wait_count = 1
end
end
if @attack_animation_index == nil
@step = 3
else
@attack_animation_index += 1
if @attack_animation_index == @animation2.size
@step = 3
end
end
end
else
for target in @targets
target.animation_id = animation2
@wait_count = [1,$data_animations[animation2].frame_max].max rescue @wait_count = 1
end
if @attack_animation_index == nil
@step = 3
else
@attack_animation_index += 1
if @attack_animation_index == @animation2.size
@step = 3
end
end
return
end
if @targets.size == 0
@enable_target_cursor = false
if GTBS::is_summon?(@active_battler.current_action.skill_id) > 0 and $game_map.passable?(@cursor.x, @cursor.y, 0)
#Crease Miss object, but play summon animation
anim = Anim_Miss.new(1)
anim.place(@cursor.x, @cursor.y)
anim.start_anim
@target = anim
#Set character
sumid = GTBS::is_summon?(@active_battler.current_action.skill_id)
if @active_battler.is_a?(Game_Actor) and actors.include?(@active_battler)
set_character("actor", sumid, @cursor.x, @cursor.y,0,true)
@targets.push(actors.last)
elsif @active_battler.is_a?(Game_Actor) and neutral.include?(@active_battler)
set_character("neutral", sumid, @cursor.x, @cursor.y,0,true)
@targets.push(neutral.last)
elsif @active_battler.is_a?(Game_Enemy) and enemies.include?(@active_battler)
set_character("enemy", sumid, @cursor.x, @cursor.y,0,true)
@targets.push(enemies.last)
end
sum = @targets.last
sum.hp = sum.maxhp
sum.mp = sum.maxmp
@gained = @targets.clone
else
#Play Miss Animation
@target = anim
anim = Anim_Miss.new
anim.place(@cursor.x, @cursor.y)
anim.start_anim
end
else
if GTBS::is_summon?(@spell.id) > 0
#Play Miss Animation - since a summon cannot occupy any location already occupied.
anim = Anim_Miss.new
anim.place(@cursor.x, @cursor.y)
anim.start_anim
@step = 5
end
end
when 3 #performs action!
@attack_animation_index = nil
@wait_count = 25
if @target != nil
if @target.is_a?(Anim_Miss)
@step = 4
return
end
case @active_battler.current_action.kind
when 0 #attack/defend/etc
case @active_battler.current_action.basic
when 0
t=make_attack_result(@target, @active_battler)
@hit_count += 1 if $data_skills[@active_battler.weapon_id].element_set.include?(GTBS::CHAIN_LIGHTNING_EFFECT_ID) rescue nil
if @melee == true
@counter = @target.counter_result(@active_battler) unless @target == @active_battler
end
when 1
#defend
when 2
#escape
end
when 1 #skill
t=make_skill_result(@target, @active_battler)
@hit_count += 1 if $data_skills[@active_battler.current_action.skill_id].element_set.include?(GTBS::CHAIN_LIGHTNING_EFFECT_ID) rescue
if @melee == true
@counter = @target.counter_result(@active_battler) unless @target == @active_battler
end
when 2 #item
if @active_battler.current_action.skill_id != 0
t=make_itemskill_result(@target, @active_battler)
else
t=make_item_result(@target, @active_battler)
end
end
if GTBS::USING_MULTISLOT and @active_battler.current_action.kind == 0 and
@targets.size == 1 and !@active_battler.is_a?(Game_Enemy)
@active_battler.attack_count += 1
# If all attacks have been made
if @active_battler.attack_count == @active_battler.attacks.size or
@active_battler.current_action.kind != 0 or
@active_battler.current_action.basic != 0
# End of turn, and return attack count to 0
@active_battler.attack_count = 0
else
# Return for extra attack
@animation1 = @active_battler.animation1
@animation2 = [@active_battler.atk_animation_id,@active_battler.atk_animation_id2]
@step = 1
return
end
end
if [GTBS::Dodge_Text,GTBS::Miss_Text].include?(t) and !GTBS::GAIN_EXP_ON_MISS
@gained.delete(@target)
end
check_knock_back
@targets = clear_target
if @targets.size != 0
@step = 2
if @attack_animation_index.nil? and @animation2.is_a?(Array)
@attack_animation_index = 0
end
return
end
else
for target in @targets
case @active_battler.current_action.kind
when 0 #attack/defend/etc
t = make_attack_result(target, @active_battler)
if @melee == true
@counter = target.counter_result(@active_battler) unless target == @active_battler
end
when 1 #skill
t=make_skill_result(target, @active_battler)
if @melee == true
@counter = target.counter_result(@active_battler) unless target == @active_battler
end
when 2 #item
if @active_battler.current_action.skill_id != 0
t=make_itemskill_result(target, @active_battler)
else
t=make_item_result(target, @active_battler)
end
end
if [GTBS::Dodge_Text,GTBS::Miss_Text].include?(t) and GTBS::GAIN_EXP_ON_MISS
@gained.delete(target)
end
check_knock_back
end
@targets.clear
end
@step = 4
return
when 4 #gain_exp
#----------------
# Target now counters if they are set to do so
#----------------
@exp_gained.push([3, @active_battler, @gained]) unless @active_battler.dead? or @gained.size == 0
@hit_count = 0
if @targets.size == 0 and @counter != nil
if @counter[0] and @counter[1] != @active_battler and !@counter[1].dead? #if counter flag is true
@active_bat_temp = @active_battler #save current battler info so they can be restored when complete
@active_battler = @counter[1] #return countering party of active_battler
@active_battler.turn_to(@active_bat_temp) #turn towards attacker
@active_battler.clear_tbs_actions #reset actions for battler
@active_battler.current_action.kind = 0 #set for physical action
@active_battler.current_action.basic = 0 #set for attack
@targets.push(@active_bat_temp) #set current battler as target
@melee = false #reset melee so there is no chance of counter happening over and over
@counter = nil #reset counter so it doesnt pull this again unless conditions meet.
if @active_battler.animation1 > 0 #if attack animation set
@animation1 = @active_battler.animation1
@active_battler.animation_id = @animation1 #setup animation for battler
@wait_count = get_wait_guess_for_animation(@animation1)
end
@animation2 = [@active_battler.atk_animation_id,@active_battler.atk_animation_id2] #set attack target animation
@step = 1 #set step back to 2 so it can redo attack and animations
return
end
if @counter[1] != nil and @counter[1].dead?
@counter = nil
end
end
#Clears counter info when ready
if @active_bat_temp != nil
@active_battler = @active_bat_temp
@active_bat_temp = nil
@counter = nil
end
@gain = nil
@turnable = nil
@targets = []
@apply_all = nil
@attack_animation_index = nil
@wait_count = 25
@step = 5
return
when 5
if !@common_event_id.nil?
@common_event_q += @common_events[@common_event_id].list
@common_event_id = nil
return
end
if @return_phase == 1 #if return to battler phase, reset windows to open
@windows["actor"].active = true #set actor menu to active, visible and refresh contents
@windows["actor"].visible = true
@windows["actor"].refresh(@active_battler)
@tbs_phase = 1
@step = 0
elsif @return_phase == 7 #return to AI controlled phase
@tbs_phase = @return_phase
@step = 0
elsif @return_phase == 0 #if return phase 0 when wait skill, update wait skill info and return
skill_cast = @use_spell[0][1]
@use_spell.delete([@active_battler, skill_cast])
@enable_target_cursor = false
@tbs_phase = 0
@step = 0
@using_skill = false
end
if @active_battler.dead? #if active battler died during transaction, reset wait functions and proceed with battle.
if $game_system.cust_battle == "ATB"
@wait = false
end
@active_battler.blink = false
@active_battler.moved = false
@active_battler.perf_action = false
@active_battler = nil
@cursor_active = true
@tbs_phase = 0
@freeze_scroll = false
@enable_target_cursor = false
@using_skill = false
return
elsif @return_phase == 0
@active_battler = nil
end
clear_tr_sprites
return
end
end
end #end Team Patch
if GTBS::TELEPORT_PATCH
#-------------------------------------------------------------------------
# Make_Skill_Result - Makes item result for designated targets
#-------------------------------------------------------------------------
def make_skill_result(target, battler = @active_battler)
#edit here added the @ to the first spell
@spell = $data_skills[battler.current_action.skill_id]
if REVIVE_SCOPES.include?(@spell.scope) and GTBS::REMOVE_DEAD == 2
target.place(@cursor.x, @cursor.y)
actors.push(target) unless actors.include?(target)
@dead_actors.delete(target)
@spriteset.update
elsif REVIVE_SCOPES.include?(@spell.scope) and GTBS::REMOVE_DEAD != 2
if target.is_a?(Game_Actor)
if !target.neutral
actors.push(target) unless actors.include?(target)
else
neutral.push(target) unless neutral.include?(target)
end
else
enemies.push(target) unless enemies.inlcude?(target)
end
dead.delete(target)
end
#added the @
target.skill_effect(battler,@spell)
if target.damage != nil
target.damage_pop = true
end
#added @ to both spells
if @spell.common_event_id > 0
@common_event_id = @spell.common_event_id
end
return target.damage
end
end #end tele patch
end#end class
class Game_Battler
if GTBS::COUNTER_PATCH
#--------------------------------------------------------------------------
# * Counter Result - Used to determine if char can COUNTER the attack
#--------------------------------------------------------------------------
def counter_result(attacker)
#--------------------------------------------------------------------------
# Return false if not counter state, self == attacker, or self is a actor and attacker is actor..etc
#--------------------------------------------------------------------------
#turn off counter
return [false, nil] if $game_variables[GTBS::COUNTERVAR_ID] == 1#added
return [false, nil] if !state?(GTBS::COUNTER_ID) and GTBS::COUNTER_ALL == false
return [false, nil] if self == attacker
if ((self.is_a?(Game_Actor) and attacker.is_a?(Game_Actor)) or
(self.is_a?(Game_Enemy) and attacker.is_a?(Game_Enemy))) and
GTBS::COUNTER_TEAM == false
return [false, nil]
end
min_dist = 999
for pos in self.positions
for apos in attacker.positions
dist = (apos[0]-pos[0]).abs + (apos[1]-pos[1]).abs
if dist < min_dist
min_dist = dist
end
end
end
#--------------------------------------------------------------------------
# Return false if distance greater than max weapon_range or less than min range
#--------------------------------------------------------------------------
return [false, nil] if (min_dist > self.weapon_range[0]) or (min_dist < self.weapon_range[1])
#--------------------------------------------------------------------------
# Set default percentage
#--------------------------------------------------------------------------
perc = 25
return [true,self] if GTBS::COUNTER_ALL
if self.hp/self.maxhp.to_f < 0.25
#--------------------------------------------------------------------------
# Increase rate by 10% when 25% of hp, makes 35% counter rate
#--------------------------------------------------------------------------
perc += 10
elsif self.hp/self.maxhp.to_f < 0.50
#--------------------------------------------------------------------------
# Increase rate by 5% when 50% of hp, makes 30% counter rate
#--------------------------------------------------------------------------
perc += 5
end
#--------------------------------------------------------------------------
#Figure counter based on %
#--------------------------------------------------------------------------
if rand(100) < perc #if rand less than %, counter = true
return [true, self]
else #failed to counter
return [false, nil]
end
end
end#end counter
if GTBS::TELEPORT_PATCH
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if jumping? # Jumping
update_jump
elsif dodging?
update_dodge
elsif moving? # Moving
update_move
else # Stopped
update_stop
end
update_floating
if @wait_count > 0 # Waiting
@wait_count -= 1
elsif @move_route_forcing # Forced move route
move_type_custom
end
update_projectiles
update_iso_height
update_animation
#edit teleport here
if @move_route!=nil#added
if @move_route.size > 0
run_path unless moving?
end
end#added
end
end#end tele patch
end