03-08-2008, 06:42 AM
GubiD's Tactical Battle System
Version: 1.5.1.4
By: GubiD
Introduction
This is a Tactical RPG based battle system that most resembles Final Fantasy Tactics. Updated rather regularly and the most powerful TBS available.
Features
Screenshots
Demo
XP 1.5.2 - Includes fixes for all the noted 1.5.1 bugs listed below
XP 1.5.1.4
VX 1.5.1.4
Old Demo Links
Script
Please see demo for script. It is way to long to be shown here.
Instructions
FAQ
Please see the help and troubleshooting section of the script in the demo. Most of the common questions are answered there.
Also please visit http://www.youtube.com/gubid for tutorials and other general how-to questions for the GTBS System.
Compatibility Issues
Most scripts are compatible if placed above the GTBS. If they are incompatible.. then please inform me and a patch MAY be created.
Addon's / Patches
All patches for known scripts that (used to) conflict are included in the demo.
Known Issues
1.5.2 Patches...
1.5.2 Patches...
The reason for this error is because of an inconsistency in the script for fill and straight line methods. To correct this, open Scene_Battle_TBS to line 7318, which should be
You will update the 1.5 to be 2.
There is another line just a little bellow that is EXACTLY the same, and requires the same edit regarding how to minus min ranges from the overall range.
Credits and Thanks
Nick for his original TBS
CronoCry for his translation of ZTBS that made me think I could do it!
MGCaladtogel and Seigfried for the ISO script that was adapated/improved
CrushD for his help with projectiles
Zeriab for the reset F12 utility. Testing would have been a headache without it.
Near Fantasia for his path finding stuff (although I ended up using the one in ZTBS)
My Beta Testers: Ice_Dragon, Edwards64, Digidog09, Ilia12345, Jaberwocky, CronoCry(Mac-RMXP.org), Rotimikid, Ragnarok Rob, and Sabao
Everyone and Anyone who reports/reported a bug in any of the online topics!
All my loyal subjects!
Author's Notes
Enjoy GTBS v1.5.2! :yahoo:
Terms and Conditions
You may NOT use this in a commercial game without my permission. (I deserve my fair cut!)
You may create your own addons for this script but please make me aware of them so that they can be added to the release!
The using of this script in your game is at your own risk.
You *MUST* give me credit. This didnt realize itself overnight.
Bugs may or may not be fixed when reported.
Version: 1.5.1.4
By: GubiD
Introduction
This is a Tactical RPG based battle system that most resembles Final Fantasy Tactics. Updated rather regularly and the most powerful TBS available.
Features
- Move/Attack in any order
- Counter Attacks
- Dual Battle System (Allows this to work separately from the default battle system so that you can use more than one!)
- Fancy Status
- Unique Summon System
- Extremely Complex AI System (better than in any other available tbs system, currently)
- Chain Lightning Effects
- Multislot & Enhanced Weapon Support
- Isometric Support
- Complex or Easy Animated Battlers (new to 1.5 allows way more customization to define number of poses, frames and even index flow)
- Active/Team based modes
- XP/VX Compatible
- SDK Compatible (but it is not required)
Screenshots
Content Hidden
Ring Menu Support (Ziifee's Spin Menu)
Gain Items/Gold Immediately
Remove Dead
Attack Ranges and Damage Pop
Customize Graphics (all menu backs, icons, even animated movement/attack tiles)
Complex AI System
Place Your Character have have them pre-placed
Action Order (including wait skills as to when they will be casted)
Customize Range Colors based on type
System also supports Isometric Movement (included in demo)
Gain Items/Gold Immediately
Remove Dead
Attack Ranges and Damage Pop
Customize Graphics (all menu backs, icons, even animated movement/attack tiles)
Complex AI System
Place Your Character have have them pre-placed
Action Order (including wait skills as to when they will be casted)
Customize Range Colors based on type
System also supports Isometric Movement (included in demo)
Demo
XP 1.5.2 - Includes fixes for all the noted 1.5.1 bugs listed below
XP 1.5.1.4
VX 1.5.1.4
Old Demo Links
Content Hidden
Script
Please see demo for script. It is way to long to be shown here.
Instructions
Content Hidden
#==============================================================================
# Importing the GTBS to your own game - Checklist
#------------------------------------------------------------------------------
# Follow these four steps to import all of the necessary components of this
# system to your own project. Open the GTBS Demo and press F11 to open the
# Script editor then follow the instructions below.
#
# 1) Copy ALL (below the SDK) scripts from the demo except those that are marked
# as optional, unless you want to, in the order in which they are shown.
#
# 2) Copy the Graphics Folder from the demo to your project to ensure you have
# all the require images in your project.
#
# 3) Make the following additions/modifications to your project:
#
# -Look for this section in GTBS_Weapon/Skill:
# In order to configure your weapons accordingly you must update their information.
# There are many options to play with in here for setup, play around with each option
# to see what it does, but please ensure you make a backup of your scripts.rxdata before
# you start chaning things!
#
# -Create a common event for Victory and Failure sequences for the battle.
# If you do not know how to do this, simply copy the common events from
# the demo. After doing this, look for VIC_COM and FAIL_COM in the
# -Module_GTBS- script, and change those numbers to match the numbers of
# the victory and fail common events. This makes it so you are actually
# capable of winning and losing, like in the demo.
#
# -Under any of the methods (def_NAMEHERE) in GTBS_*, you can
# either re-identify or remove any of the "when #" lines that change the
# ranges, wait times, and other components found in the demo. Do NOT remove
# the method entirely, and make sure the "case id" and "else" lines still
# exist at all times, or they won't work. Be sure to back up the script
# before attempting to modify anything, just to be safe.
#
# 4) Give credit to me(GubiD), either in-game, and/or in a presentation of your project
# in another place, such as a forum. This is not optional.
#
# 5) Ensure that you erase all previous saved games, as if you continue from them
# you will encounter some errors that will be resolved by starting a new game.
#
# And finally, enjoy. Configure -GTBS_*- to suit your project, and be sure
# to add to it when you make new weapons, skills, or summons.
#==============================================================================
# Importing the GTBS to your own game - Checklist
#------------------------------------------------------------------------------
# Follow these four steps to import all of the necessary components of this
# system to your own project. Open the GTBS Demo and press F11 to open the
# Script editor then follow the instructions below.
#
# 1) Copy ALL (below the SDK) scripts from the demo except those that are marked
# as optional, unless you want to, in the order in which they are shown.
#
# 2) Copy the Graphics Folder from the demo to your project to ensure you have
# all the require images in your project.
#
# 3) Make the following additions/modifications to your project:
#
# -Look for this section in GTBS_Weapon/Skill:
# In order to configure your weapons accordingly you must update their information.
# There are many options to play with in here for setup, play around with each option
# to see what it does, but please ensure you make a backup of your scripts.rxdata before
# you start chaning things!
#
# -Create a common event for Victory and Failure sequences for the battle.
# If you do not know how to do this, simply copy the common events from
# the demo. After doing this, look for VIC_COM and FAIL_COM in the
# -Module_GTBS- script, and change those numbers to match the numbers of
# the victory and fail common events. This makes it so you are actually
# capable of winning and losing, like in the demo.
#
# -Under any of the methods (def_NAMEHERE) in GTBS_*, you can
# either re-identify or remove any of the "when #" lines that change the
# ranges, wait times, and other components found in the demo. Do NOT remove
# the method entirely, and make sure the "case id" and "else" lines still
# exist at all times, or they won't work. Be sure to back up the script
# before attempting to modify anything, just to be safe.
#
# 4) Give credit to me(GubiD), either in-game, and/or in a presentation of your project
# in another place, such as a forum. This is not optional.
#
# 5) Ensure that you erase all previous saved games, as if you continue from them
# you will encounter some errors that will be resolved by starting a new game.
#
# And finally, enjoy. Configure -GTBS_*- to suit your project, and be sure
# to add to it when you make new weapons, skills, or summons.
#==============================================================================
FAQ
Please see the help and troubleshooting section of the script in the demo. Most of the common questions are answered there.
Also please visit http://www.youtube.com/gubid for tutorials and other general how-to questions for the GTBS System.
Compatibility Issues
Most scripts are compatible if placed above the GTBS. If they are incompatible.. then please inform me and a patch MAY be created.
Addon's / Patches
All patches for known scripts that (used to) conflict are included in the demo.
Content Hidden
XP Patches
[*]Mousie Patch(XP)
[*]Clan Script Patch(XP?)
[*]Visual Equipment(XP)
[*]Ccoa UMS Patch(XP)
[*]Equip Skills Patch(XP)
[*]Arev's Particle Sys(XP)
[*]EnhancedEquipment(XP)
[*]GandoPassiveSkills(XP)
[*]SquallMiniMap(XP)
VX Patches
[*]Kylock Light Effects(VX)
[*]Woratana Fogs(VX)
[*]YE Subclassia(VX)
[*]Individuality(VX)
[*]Mousie Patch(XP)
[*]Clan Script Patch(XP?)
[*]Visual Equipment(XP)
[*]Ccoa UMS Patch(XP)
[*]Equip Skills Patch(XP)
[*]Arev's Particle Sys(XP)
[*]EnhancedEquipment(XP)
[*]GandoPassiveSkills(XP)
[*]SquallMiniMap(XP)
VX Patches
[*]Kylock Light Effects(VX)
[*]Woratana Fogs(VX)
[*]YE Subclassia(VX)
[*]Individuality(VX)
Add fall damage on knockback.. and fall (iso setups)
Code:
class Game_Battler
#--------------------------------------------------------------------------
# * Knock Back - performs "knock back"
#--------------------------------------------------------------------------
alias knock_back_fall_dmg knock_back
def knock_back(*args)
before_h = screen_th
knock_back_fall_dmg(*args)
after_h = screen_th
dif = after_h - before_h
if dif < -3 #fallen more than 3 tiles, dif should always be negative in regards to falling.
base_dmg = rand(20) #get value between 0-19
self.damage = base_dmg + (dif ** 3).abs #abs is absolute value to ensure positive, ** is "to the power of' to ensure exponential loss.
self.hp -= self.damage
self.damage_pop = true
end
end
end
Drakoshade Individuality Patch - XP Only
Code:
#------------------------------------------------------------------------------
# DrakoShade Individuality GTBS Patch by GubiD 5/21/2012
#------------------------------------------------------------------------------
if defined?(Window_ItemCommand)
class Scene_Battle_TBS
#----------------------------------------------------------------------------
# Phase 1 - Actor Menu
#----------------------------------------------------------------------------
alias tbs_phase_1_individuality tbs_phase_1
def tbs_phase_1
if Input.trigger?(Input::C) and @windows["actor"].active == true
common_event = []
cmds = GTBS::MENU_COMMAND_Translation
for key in cmds.keys
if cmds[key].include?(@windows["actor"].data(@windows["actor"].index))
cmd = key.clone
end
end
case cmd
when "Item"
if @active_battler.perfaction?
Sound.play_buzzer
return
end
Sound.play_decision
@windows["item"].set_actor(@active_battler)
@windows["item"].active = true
@windows["item"].visible = true
@windows["item"].index = 0
@windows["item"].refresh
@windows["actor"].active = false
@windows["actor"].visible = false
@windows["status"].visible = false
set_active_cursor
@active_battler.current_action.kind = 2
@windows["help"].visible = true
@windows["help"].move_to(0)
return
end
end
tbs_phase_1_individuality
end
end
class TBS_Item < Window_Item
#----------------------------------------------------------------------------
# Object Initialize
#----------------------------------------------------------------------------
def initialize(*args)
if GTBS::VX
super(0, 56, 544, 360)
else
super(nil)
end
@back = Sprite.new
self.opacity = GTBS::CONTROL_OPACITY
if FileTest.exist?('Graphics/Pictures/GTBS/TBS_Item_Skill.png')
self.opacity = 0
@back.bitmap = RPG::Cache.picture('GTBS/TBS_Item_Skill')
@back.visible = false
@back.opacity = GTBS::CONTROL_OPACITY
end
end
def set_actor(actor)
if actor != nil
@actor = actor
end
refresh
end
def refresh
if @actor.nil?
return
else
super()
end
end
end
class Game_Party
#--------------------------------------------------------------------------
# Pre Setup aliasing
#--------------------------------------------------------------------------
# Required to prevent Individuality from overwriting older mthods
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Gain Item
#--------------------------------------------------------------------------
alias gain_item_individuality_compatibility gain_item
def gain_item(*args)
item = *args[0]
if item.is_a?(RPG::Weapon)
return gain_weapon(item.id, *args[1])
elsif item.is_a?(RPG::Armor)
return gain_armor(item.id, *args[1])
elsif item.is_a?(RPG::Item)
return gain_item_individuality_compatibility(item.id, *args[1])
else
return gain_item_individuality_compatibility(*args)
end
end
#--------------------------------------------------------------------------
# END Pre Setup aliasing
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
alias gain_item_individuality_xp_drako gain_item
def gain_item(item, n)
if defined?(GTBS) and $scene.is_a?(Scene_Battle_TBS) and item.is_a?(RPG::Item)
string = "@active_battler.gain_item(#{item}, #{n})"
$scene.instance_eval(string)
else
gain_item_individuality_xp_drako(item, n)
end
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
alias gain_weapon_individuality_xp_drako gain_weapon
def gain_weapon(weapon, n)
if defined?(GTBS) and $game_temp.in_battle and $scene.is_a?(Scene_Battle_TBS)
string = "@active_battler.gain_weapon(#{weapon}, #{n})"
$scene.instance_eval(string)
else
gain_weapon_individuality_xp_drako(weapon, n)
end
end
#--------------------------------------------------------------------------
# * Gain Items (or lose)
# item_id : item ID
# n : quantity
#--------------------------------------------------------------------------
alias gain_armor_individuality_xp_drako gain_armor
def gain_armor(armor, n)
if defined?(GTBS) and $game_temp.in_battle and $scene.is_a?(Scene_Battle_TBS)
string = "@active_battler.gain_armor(#{armor}, #{n})"
$scene.instance_eval(string)
else
gain_armor_individuality_xp_drako(armor, n)
end
end
end#end game_party class
end
Known Issues
1.5.2 Patches...
TEAM Mode, Counter All sometimes causes 'NoMethod TurnTo for nil:NilClass
This happens because the actor is acting on the enemies turn and the 'next_enemy' method can interrupt the player. To correct this, just comment out the following lines to make it like so..
Code:
#-------------------------------------------------------------------------
# Next Enemy - determines what enemy will act next(only used in team mode)
#-------------------------------------------------------------------------
def next_enemy
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
Enemies will cast Wait Skills on themselves rather than targeted Actor
This happens because the cursor position is not set to the skill location prior to saving actor information for the wait skill. You can correct it with the following change to this line:
#OLD code
#OLD code
Code:
if occupied_by?(action.position[0], action.position[1]) == nil
pos = action.position
target = nil
else
pos = []
t = occupied_by?(@cursor.x, @cursor.y) #THIS IS THE BAD LINE
offset_x = @cursor.x-t.x
offset_y = @cursor.y-t.y
target = [t,[offset_x, offset_y]]
end
[code]
[color=green]#Updated code[/color]
[code]
if occupied_by?(action.position[0], action.position[1]) == nil
pos = action.position
target = nil
else
@cursor.x = action.position[0]
@cursor.y = action.position[1]
pos = []
t = occupied_by?
offset_x = @cursor.x-t.x
offset_y = @cursor.y-t.y
target = [t,[offset_x, offset_y]]
end
1.5.2 Patches...
Movement Patch for 1.5.1.4 - Resolves like 6 different problems at once
Code:
################################ Configuration ###################################
module GTBS
NON_FLYING_CLIMBABLE = 2 #non flying units can clim 1 height bloc without penality
FLYING_CLIMBABLE = 3 #flying unit can climb up to 3 height without penality
CLIMB_COST = 1 # cost 1 movement up if climbing
MAX_DROP_HEIGHT = 4
end
class Game_Map
#--------------------------------------------------------------------------
# * Get Terrain Tag
# x : x-coordinate
# y : y-coordinate
# There is a bug in the original terrain tag code, when == nil, it would
# return nothing, which causes many things to crash that depend on the response
#--------------------------------------------------------------------------
if GTBS::VX
def terrain_tag(x, y)
return 0
end
else#XP
def terrain_tag(x, y)
if @map_id != 0
for i in [2, 1, 0]
tile_id = data[x, y, i]
if tile_id == nil
return 0
else
test = @terrain_tags[tile_id]
test = 0 if test == nil
return test if test > 0
end
end
end
return 0
end
#----------------------------------------------------------------------------
# Check Tile Height at XY
#----------------------------------------------------------------------------
def check_th(x,y)
return 99 if !valid?(x,y)
return 0 if !iso?
tile_id = map.data[x,y,0]
t_x = (tile_id - 384) % 8
t_y = (tile_id - 384) / 8
th = t_x + t_y * 8
return th
end
end
#-------------------------------------------------------------------------
# Get cost of the move from x, y to nu_x, nu_y for actor
#-------------------------------------------------------------------------
def add_cost_move(x,y, nu_x, nu_y, flying = false)
tt = terrain_tag(x, y) #get terrain tag always defined, see above
if tt > 4 #is terrain tag less than 4?
tt = 0 #else, tt = o
end
if iso? #if using iso maps
th = check_th(x,y) #get current tile height
nth = check_th(nu_x, nu_y) #get new tile height
dif = (nth - th)
if !flying
if (dif > GTBS::NON_FLYING_CLIMBABLE)
tt += 999; #Cannot climb
elsif (dif > 0 && (nth-th) <= GTBS::NON_FLYING_CLIMBABLE)
tt += GTBS::CLIMB_COST * (dif / GTBS::NON_FLYING_CLIMBABLE)
elsif (dif < 0 && dif > MAX_DROP_HEIGHT) #Too far to jump down
tt += 999;
end
else #If Flying
if (dif > GTBS::FLYING_CLIMBABLE)
tt ++ 999; #Cannot fly over
end
end
end
return tt
end
end
class Game_Battler
#-------------------------------------------------------------------------
#* encounter_enemy?
# Is the battler near an enemy ?
# return always false if the ENCOUNTER_MOVING_METHOD == false
#-------------------------------------------------------------------------
def encounter_enemy?( nu_x, nu_y, no_test)
return false unless GTBS::ENCOUNTER_MOVING_METHOD
return false if no_test
for enemy in opponents
if (enemy.x - nu_x).abs + (enemy.y - nu_y).abs == 1
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Move to Designated Position
# x : x-coordinate
# y : y-coordinate
#--------------------------------------------------------------------------
def moveto(x, y)
@x = x % $game_map.width
@y = y % $game_map.height
@real_x = @x * (GTBS::VX == true ? 256 : 128)
@real_y = @y * (GTBS::VX == true ? 256 : 128)
@prelock_direction = 0
straighten
update_bush_depth
@h = screen_th
end
#--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
new_x = $game_map.round_x(new_x) # Horizontal loop adj.
new_y = $game_map.round_y(new_y) # Vertical loop adj.
#--------------------------------------------------------------------------
# Large Unit Passable? Update
#--------------------------------------------------------------------------
for ux in x..x+unit_size-1
for uy in y..y+unit_size-1
nu_x = ux + (d == 6 ? 1 : d == 4 ? -1 : 0)
nu_y = uy + (d == 2 ? 1 : d == 8 ? -1 : 0)
return false unless $game_map.valid?(nu_x, nu_y)
return false if nu_x.nil? or nu_y.nil?
return true if @through or debug_through? # Through ON?
return false if !move_climbable?(x, y, new_x, new_y)
next if can_fly_over?(nu_x, nu_y)
return false if collide_with_battlers?(nu_x, nu_y) # Collide with character?
next if can_walk_over?(nu_x, nu_y)
return false unless map_passable?(nu_x, nu_y, d) # Map Impassable?
end
end
return true # Passable
end
end
class Scene_Battle_TBS
TEST_DIR = [ [2, 0, 1], [4, -1, 0], [6, 1, 0], [8, 0, -1] ]
#----------------------------------------------------------
#Calc_Pos - calculates tiles to be highlighted for spells, move, attack
#----------------------------------------------------------
alias calc_pos_move_fix calc_pos
def calc_pos(actor, range_max = 0, range_min = 0, type = "all", override = false)
return [] if range_max.nil?
if range_max > -1 and type == "move"
#if ( && == true)
# p "right method?";
#end
move_range = range_max
# is flying unit ?
flying_unit = actor.state?(GTBS::FLYING_ID)
#initialize the encounter method
start_move = true
#start position initialization
start_pos = actor.pos #push starting position
route = {start_pos => []} #initialize route #Push empty route for starting postion
cost = {start_pos => 0} #start position cost = 0
more_step = [start_pos] #initialize array
for pos in more_step #each step in position
x, y = pos #set x, y for index
c = cost[pos] #set cost for current postion index
for dir,dx,dy in TEST_DIR # loop for the four directions
nu_pos = (nu_x, nu_y = x + dx, y + dy) #
next unless actor.passable?(x, y, dir) # can battler go to new position ?
nu_cost = c+1+ $game_map.add_cost_move( x, y, nu_x, nu_y, flying_unit)
next if nu_cost > move_range # Abort tests if current route cost is bigger than move_range
old_cost = cost[nu_pos]
# if not reached yet or old_cost is bigger
if !old_cost or old_cost > nu_cost
route[nu_pos] = route[pos] + [dir]
cost[nu_pos] = nu_cost
if nu_cost < move_range and #can one more step?
!actor.encounter_enemy?(nu_x, nu_y, start_move) # always false if ENCOUNTER_METHOD disabled
#push more step for position if no close to enemy
more_step.push(nu_pos)
end
#switch 1/2 times if equal cost
elsif cost[nu_pos] == nu_cost
if rand(2) == 0
route[nu_pos] = route[pos] + [dir]
end
end
end#4dir loop for
start_move = false if start_move # at the end of the tests of the start position, this flag is set to false
end
for pos in cost.keys #check all positions
if !can_occupy?(actor, pos)
route.delete(pos)
end
end
@route = route
return @route.keys
end
return calc_pos_move_fix(actor,range_max,range_min,type,override)
end
#-------------------------------------------------------------------------
# Find Approach Move
#-------------------------------------------------------------------------
# Finds the best movable position that is approaching the desired target since
# none are currently reachable
#-------------------------------------------------------------------------
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
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
end
end
if t_pos != []
#Old Method
#route = @route[positions.index(t_pos)]
route = @route[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
#----------------------------------------------------------------------------
# Performs the move action that was determined previously, by AI
#----------------------------------------------------------------------------
def process_move
draw_ranges(@active_battler,3)
action = @active_battler.current_action
@active_battler.moved = true
#@active_battler.run_route(@route[@move_positions.index(action.move_pos)])
@active_battler.run_route(@route[action.move_pos]) rescue nil
end
#----------------------------------------------------------------------------
# Actor Move
#----------------------------------------------------------------------------
def tbs_phase_5
if @windows["confirm"].active and !@active_battler.moving?
if @active_battler.x == @cursor.x and @active_battler.y == @cursor.y
if @drawn == false and GTBS::SHOW_MOVE_ATTACK
clear_tr_sprites
unless @active_battler.perf_action
if !GTBS::MOVE_INCLUDE_SPELL
draw_ranges(@active_battler,8)
@enable_target_cursor = false
else
draw_ranges(@active_battler,4)
end
end
@drawn = true
end
end
end
if Input.trigger?(Input::B) and @windows["confirm"].active == true
if @active_battler.moving?
Sound.play_buzzer
return
else
Sound.play_cancel
@windows["confirm"].active = false
@windows["confirm"].visible = false
@cursor_active = true
@active_battler.moveto(@pre_x, @pre_y)
clear_tr_sprites
draw_ranges(@active_battler)
@drawn = false
return
end
end
if Input.trigger?(Input::B)
Sound.play_cancel
@windows["actor"].active = true
@windows["actor"].visible = true
@tbs_phase = 1
clear_tr_sprites
return
end
if Input.trigger?(Input::C) and @windows["confirm"].active == true
if GTBS::MOVE_CONFIRM
case @windows["confirm"].index
when 0
Sound.play_decision
if (@active_battler.state?(GTBS::TELEPORT1_ID) or @active_battler.state?(GTBS::TELEPORT2_ID))
@active_battler.animation_id = GTBS::TELEPORT_ANIM
success = teleport?(@active_battler, @cursor)
if success == true
@active_battler.moveto(@cursor.x, @cursor.y)
end
@wait_count = 10
end
@active_battler.moved = true
clear_tr_sprites
@tbs_phase = 1
@pre_x = nil; @pre_y = nil
@windows["confirm"].active = false
@windows["confirm"].visible = false
@windows["actor"].active = true
@windows["actor"].refresh(@active_battler)
if !@active_battler.perf_action
@windows["actor"].visible = true
end
when 1
if @active_battler.moving?
Sound.play_buzzer
return
else
Sound.play_decision
@windows["confirm"].active = false
@windows["confirm"].visible = false
@cursor_active = true
@active_battler.moveto(@pre_x, @pre_y)
clear_tr_sprites
draw_ranges(@active_battler)
@drawn = false
return
end
end
else
Sound.play_decision
if (@active_battler.state?(GTBS::TELEPORT1_ID) or @active_battler.state?(GTBS::TELEPORT2_ID))
@active_battler.animation_id = GTBS::TELEPORT_ANIM
success = teleport?(@active_battler, @cursor)
if success == true
@active_battler.moveto(@cursor.x, @cursor.y)
end
@wait_count = 10
end
@active_battler.moved = true
clear_tr_sprites
@tbs_phase = 1
@pre_x = nil; @pre_y = nil
@windows["confirm"].active = false
@windows["confirm"].visible = false
@windows["actor"].active = true
@windows["actor"].refresh(@active_battler)
if !@active_battler.perf_action
@windows["actor"].visible = true
end
end
return
end
if Input.trigger?(Input::C)
if in_range?
if !occupied?
Sound.play_decision
text = "Move here?"
@windows["confirm"].refresh(text)
@windows["confirm"].active = true
if GTBS::MOVE_CONFIRM
@windows["confirm"].visible = true
else
@windows["confirm"].visible = false
end
@pre_x = @active_battler.x
@pre_y = @active_battler.y
if !(@active_battler.state?(GTBS::TELEPORT1_ID) and !@active_battler.state?(GTBS::TELEPORT2_ID))
#@active_battler.run_route(@route[@move_positions.index([@cursor.x, @cursor.y])])
@active_battler.run_route(@route[ [@cursor.x, @cursor.y] ])
end
@cursor_active = false
else
Sound.play_buzzer
end
else
Sound.play_buzzer
end
return
end
end
end[/code[[/spoiler]
[spoiler=Attack Allies False error patch, wrong number of arguments][code]class Scene_Battle_TBS
#----------------------------------------------------------------
# Get Enemies
#----------------------------------------------------------------
def get_possible_targets(type = 'attack')
targets = []
if !GTBS::ATTACK_ALLIES
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
elsif @active_battler.is_a?(Game_Enemy)
if !@active_battler.state?(GTBS::CONFUSE_ID) or type == 'help' #if confused
targets = enemies
else
targets = actors + neutral
end
end
else
targets = actors + neutral + enemies
end
return targets
end
end
1.5 using XP with SDK causes attack/skill animations to be opaque
To fix this one you need to add a 'detect sdk' line so that I dont overwrite their method. Its pretty easy, just open Part 1 and browse to line 867, which should be "def update_appear". You will insert a line above that with the following: if !defined?(SDK), then an 'end' after that method end.. like thisYou will need to repeat this for def update_collapse just a few lines further down. This should fix it
Code:
#--------------------------------------------------------------------------
# * Update Appearance Effect
#--------------------------------------------------------------------------
if !defined?(SDK)
def update_appear
self.blend_type = 0
self.color.set(0, 0, 0, 0)
self.opacity = (16 - @effect_duration) * 16
end
end
Using an ISO map can cause weird skill range patterns, when involving height changes
The reason for this error is because of an inconsistency in the script for fill and straight line methods. To correct this, open Scene_Battle_TBS to line 7318, which should be
Code:
h_max = [2, range_max/1.5].max
There is another line just a little bellow that is EXACTLY the same, and requires the same edit regarding how to minus min ranges from the overall range.
("Important Information") Wrote:Also one last note...
I have decided to pickup this project up again. Expect to see many new updates coming soon.
Credits and Thanks
Nick for his original TBS
CronoCry for his translation of ZTBS that made me think I could do it!
MGCaladtogel and Seigfried for the ISO script that was adapated/improved
CrushD for his help with projectiles
Zeriab for the reset F12 utility. Testing would have been a headache without it.
Near Fantasia for his path finding stuff (although I ended up using the one in ZTBS)
My Beta Testers: Ice_Dragon, Edwards64, Digidog09, Ilia12345, Jaberwocky, CronoCry(Mac-RMXP.org), Rotimikid, Ragnarok Rob, and Sabao
Everyone and Anyone who reports/reported a bug in any of the online topics!
All my loyal subjects!
Author's Notes
Enjoy GTBS v1.5.2! :yahoo:
Terms and Conditions
You may NOT use this in a commercial game without my permission. (I deserve my fair cut!)
You may create your own addons for this script but please make me aware of them so that they can be added to the release!
The using of this script in your game is at your own risk.
You *MUST* give me credit. This didnt realize itself overnight.
Bugs may or may not be fixed when reported.