Auto-Targeting for Blizz-ABS
Authors: Blizzard
Version: 1.11b
Type: Blizz-ABS Plugin
Key Term: Blizz-ABS Plugin
IntroductionIt will allow you to set a target for the actor before using a skill or item that requires the selection screen.
This script is to be distributed under the same terms and conditions like the script it was created for: Blizz-ABS.
Features
- when targeting an enemy, every skill and item that would normally call the selection screen now execute on that target immediately
- toggle it on and off
- cycle through targets
- optional auto-facing of target
Screenshots
DemoN/A
ScriptJust make a new script above main and paste this code into it.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Auto-Targeting for Blizz-ABS by Blizzard
# Version: 1.11b
# Type: Blizz-ABS Add-on
# Date: 26.7.2009
# Date v1.0b: 26.7.2009
# Date v1.1b: 19.8.2009
# Date v1.11b: 26.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the script it was created for: Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed RIGHT BELOW Blizz-ABS and requires Blizz-ABS
# v2.6 or higher to work properly. It will allow you to set a target for the
# actor before using a skill or item that requires the selection screen.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.6
raise 'ERROR: The "Auto-Targeting" plugin requires Blizz-ABS 2.6 or higher.'
end
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# animation ID of animation to play over the target
TARGET_ANIMATION_ID = 48
# button for target toggle
TARGET_TOGGLE_KEY = Input::Key['Q']
# button for target change
TARGET_CHANGE_KEY = Input::Key['E']
# auto facing the target all the time
AUTO_TURNING = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
$blizzabs_auto_target = 1.11
#==============================================================================
# BlizzABS::Processor
#==============================================================================
class BlizzABS::Processor
attr_accessor :autotarget
end
#==============================================================================
# BlizzABS::Controls
#==============================================================================
class BlizzABS::Controls
alias update_attack_autotarget_later update_attack
def update_attack
if $BlizzABS.autotarget == nil
if Input.trigger?(BlizzCFG::TARGET_TOGGLE_KEY) ||
Input.trigger?(BlizzCFG::TARGET_CHANGE_KEY)
targets = $game_map.battlers.find_all {|b| b.valid? && b.in_screen?}
$BlizzABS.autotarget = targets[0] if targets.size > 0
end
elsif Input.trigger?(BlizzCFG::TARGET_TOGGLE_KEY)
$BlizzABS.autotarget = nil
elsif Input.repeat?(BlizzCFG::TARGET_CHANGE_KEY)
targets = $game_map.battlers.find_all {|b| b.valid? && b.in_screen?}
index = targets.index($BlizzABS.autotarget)
$BlizzABS.autotarget = targets[(index + 1) % targets.size] if index != nil
end
if $BlizzABS.autotarget != nil && (!$BlizzABS.autotarget.in_screen? ||
!$BlizzABS.autotarget.valid?)
$BlizzABS.autotarget = nil
end
return update_attack_autotarget_later
end
alias update_skill_autotarget_later update_skill
def update_skill
result = update_skill_autotarget_later
if result && $BlizzABS.autotarget != nil && $game_temp.select_data != nil
characters = []
$game_temp.select_data[3].each {|s| characters.push(s.character)}
if characters.include?($BlizzABS.autotarget)
$game_player.ai.target = $BlizzABS.autotarget
$game_player.use_skill($game_temp.select_data[0])
else
$game_system.se_play($data_system.buzzer_se)
end
$game_temp.select_data = nil
end
return result
end
alias update_item_autotarget_later update_item
def update_item
result = update_item_autotarget_later
if result && $BlizzABS.autotarget != nil && $game_temp.select_data != nil
characters = []
$game_temp.select_data[3].each {|s| characters.push(s.character)}
if characters.include?($BlizzABS.autotarget)
$game_player.ai.target = $BlizzABS.autotarget
$game_player.use_item($game_temp.select_data[0])
else
$game_system.se_play($data_system.buzzer_se)
end
$game_temp.select_data = nil
end
return result
end
end
$BlizzABS = BlizzABS::Processor.new
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
attr_accessor :direction_fix
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Sprite_Targeter < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil)
super(viewport)
self.bitmap = Bitmap.new(1, 1)
@character = character
update
end
def update
@character = $BlizzABS.autotarget
if @character == nil
@loop_animation_id = 0
loop_animation(nil)
return
end
super
if @loop_animation_id == 0
@loop_animation_id = BlizzCFG::TARGET_ANIMATION_ID
loop_animation($data_animations[@loop_animation_id])
end
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(0)
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
alias init_autotarget_later initialize
def initialize
@autotarget = Sprite_Targeter.new(@viewport1)
init_autotarget_later
end
alias update_autotarget_later update
def update
@autotarget.update
if BlizzCFG::AUTO_TURNING && $BlizzABS.autotarget != nil
$game_player.turn_toward($BlizzABS.autotarget)
end
update_autotarget_later
end
alias dispose_autotarget_later dispose
def dispose
@autotarget.dispose
@autotarget = nil
dispose_autotarget_later
end
end
InstructionsIn the script in the first comment.
CompatibilityRequires Blizz-ABS to work.
Credits and Thanks
Author's NotesKeep in mind that this plugin comes RIGHT UNDER Blizz-ABS. This script was done on request and is not fully supported by me as my other scripts are.
If you find any bugs, please report them here:
http://forum.chaos-project.comThat's it! N-Joy! =D