Auto-Targeting for Blizz-ABS + Mouse
Authors: Blizzard, chaucer
Version: 1.11
Type: Blizz ABS Plugin
Key Term: Blizz-ABS Plugin
IntroductionAllows you to select an enemy before using skills & items
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
- able to select enemies with mouse click
- able to choose to use Arrow_Base(cursor for normal battle's) or an animation
- added ability to choose if arrow is above or below an enemy
Screenshots
DemoN/A if you need one just ask
Script
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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 = 1 #ID of Animation or nil for Arrow Base
#button for mouse toggle
TARGET_MOUSE_KEY = Input::Key['Mouse Left']
# button for target toggle
TARGET_TOGGLE_KEY = Input::Key['Q']
# button for target change
TARGET_CHANGE_KEY = Input::Key['E']
# choose if the arrow is ahove or below target(if TARGET_ANIMATION_ID = nil)
TARGET_ABOVE = false
# 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
#===============================================================================
#Mouse Controls
if Input.trigger?(BlizzCFG::TARGET_MOUSE_KEY)
targets = $game_map.battlers.find_all {|b| b.valid? && b.in_screen? && b.mouse_in_area?}
$BlizzABS.autotarget = targets[0]
end
elsif Input.trigger?(BlizzCFG::TARGET_MOUSE_KEY)
targets = $game_map.battlers.find_all {|b| b.valid? && b.in_screen? && b.mouse_in_area?}
index = $game_map.battlers.any?{|b| b.valid? && b.mouse_in_area?}
$BlizzABS.autotarget = targets[0] if targets[0] !=nil
# 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) if BlizzCFG::TARGET_ANIMATION_ID !=nil
@character = character
@blink_count = 0
update
end
def update
@character = $BlizzABS.autotarget
if @character == nil
self.bitmap = nil
@loop_animation_id = 0
loop_animation(nil)
return
end
super
@blink_count += 1 if BlizzCFG::TARGET_ANIMATION_ID ==nil
@blink_count = 0 if @blink_count == 8
self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name) if BlizzCFG::TARGET_ANIMATION_ID ==nil
self.ox = self.bitmap.width / 12 if BlizzCFG::TARGET_ANIMATION_ID ==nil
self.oy = 0 if BlizzCFG::TARGET_ABOVE == false && BlizzCFG::TARGET_ANIMATION_ID ==nil
self.oy = -(self.bitmap.height) + 64 if BlizzCFG::TARGET_ABOVE == true && BlizzCFG::TARGET_ANIMATION_ID ==nil
self.mirror = true if BlizzCFG::TARGET_ABOVE == true
self.angle = 180 if BlizzCFG::TARGET_ABOVE == true
self.z = 0
if @blink_count < 4
self.src_rect.set(128, 96, 32, 32) if BlizzCFG::TARGET_ANIMATION_ID ==nil
else
self.src_rect.set(160, 96, 32, 32) if BlizzCFG::TARGET_ANIMATION_ID ==nil
end
if @loop_animation_id == 0
@loop_animation_id = BlizzCFG::TARGET_ANIMATION_ID
loop_animation($data_animations[@loop_animation_id]) if BlizzCFG::TARGET_ANIMATION_ID !=nil
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
InstructionsPlace Below Blizz ABS (Instructions in script)
CompatibilityRequires Blizz-ABS & Mouse Controler to work
Credits and Thanks
- thanks to Blizzard for making the original script
- me, chaucer, for this edit
Author's NotesNone