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(http://www.pictureupload.de/originals/pictures/260709215821_target.jpg)
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.com
That's it! N-Joy! =D
Cool
I'll try it out. :O
Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks. Thanks.
I'll try it, too.
There was a slight problem. I improved and updated the script.
something tells me that with Blizz's awesome AI, this would really screw you over if you were fighting four or more enemies at once. Good for small groups of enemies anyways though.
Level++ blizz for this this will go great with my battle dome script when i get all the problems worked out
This looks like it can be a freaking awesome script. But I do agree with winkio, as the targeting system would get a bit whacky if there were too many enemies nearby. But then again, that's why it's like Zelda's Z targeting system, you only use it when you need to. It should make a great addition to any game.
I was going to suggest making the toggle button select the nearest enemy, as long as the button is held, just like Z targeting in Zelda. Once released it erases the targeting allowing for player movement. This will help for rooms with lots of enemies and crowding. You'd have to make the Z-Targeting acquire the enemy through an arc direction in front of the player instead of in all around, as well limit how many tiles ahead it can see, cause i've been targeting stuff way off my field of view.
Honestly, I was too lazy to implement the target selection of the closest enemy. As for the rest of the target selection, only enemies visible in the screen are targeted with the current version. Of course, that all can be edited. I was just too lazy. :P
Uhm, Blizz, there is a problem: It works perfectly except that the targeting screen still comes up o.O
Yes, it comes up when you have no autotarget. That's not a bug.
No, even when I have one. I'll make a video if you don't believe me XD
Can I somehow also disable it when I have no autotarget, btw?
Look:
if result && $BlizzABS.autotarget != nil && $game_temp.select_data != nil
...
$game_temp.select_data = nil
end
"If the skill can be used and there is a target and selection screen should be displayed, remove the selection screen display request."
The selection screen can't appear if you have an autotarget. It can't. Whatever happens afterwards or before that, it can't appear when there is an autotarget.
If you want the selection screen to never appear, move the "$game_temp.select_data = nil" below that "end". There are two lines where you have to do this.
But it does open the targeting scene when I have an enemy selected. I made a video but I can't upload it because of my shitty internet. >.< So you'll have to believe me. Or could I upload it as an attachment? That alwayws worked.
Ok, just to make this even stranger, it just does it for 1 skill o.O
My other skill works without a problem.
What is the skill? Which type is it? What is the target scope?
It's a homing skill. Direct skills work without problems. This one worked one out of ~50 times o.O
That's very weird. Homing skills were pretty much the ones I tested this one. :/ I'll look into it.
Only issue I have discovered so far is that if you have any enemies which requires a switch or a variable to be active, the game tends to target them rather than enemies that are already moving, so to speak. Somewhat annoying.
Quote from: Kagutsuchi on August 01, 2009, 06:58:47 pm
Only issue I have discovered so far is that if you have any enemies which requires a switch or a variable to be active, the game tends to target them rather than enemies that are already moving, so to speak. Somewhat annoying.
I have this problem too. I've been waiting for a fix on this for a bit now.
I'll see if I can find some time today to fix it then.
EDIT: Ok, I did "fix" something, but I don't think it's related to this. I never had problems with targeting enemies that are turned off by a switch or a variable, though. :/
Try it out, maybe I did fix what was causing your problems.
Yeah it solved it ^^
I was thinking of something like this.
I just tried it against a boss, battles are much better now! Thanks! *levels up*
The screenshot is broken D:
That means I need a new one. ._.
EDIT: I updated this script so it works with Blizz-ABS v2.6 and higher properly. Remember, if you are using a lower Blizz-ABS version, keep using your old version of the script. As soon as v2.6 is released and as soon as you switch to v2.6, you need to update this plugin.
Awesome addon. So simple to install. :haha:
Is there a way to do disable the old way of using skills in Blizzabs? So that you can only use this targeting system and not be able to do it the old way with everyone frozen?
Sorry for the huge necropost guys,
but would this be compatible with RMX-os? Cuz I really need this thing in my project...
It should be.
Can you make it not target enemies grouped as Lifeless? A pain in the ass when making zelda ripoffs :knight:
im sorry to necro this but i need to ask few things about this script. is there anyway to check if there is an enemy targeted? such as $BlizzABS.autotarget enemy? i know thats completely wrong lol just an example i tried to find it but i only found the buttons for it and i can get the event to run off that but i'd preffer it to run off the actual target cause when its off the buttons the event dont stop. well guess it was only one question hope it makes sense. im a little tired.
Edit: Remembered the other question lol i dont think it'd be too hard to add this but would it be possible to add move.forward command to the auto turning as well and if so where could i add it?
also could the targeting be triggered by clicking an event? (using mouse script i guess itd be action button though) like say i click on an enemy and it will target that enemy? thats the only questions i have. also can this be used to target players? but only allowing healing or helping skills?
Edit:
ok i resolved the moving toward an event.. i just need a little help with how to target something an enemy by action button im sure it can be evented? and how run an event based on if there is a target or not. (and optional.) targeting party for healing?
is it possible to add the AI movement into this script? so that the player will move toward the enemy? just curious would it be hard to add it? which pieces of the AI movement would i need to write in ? or maybe i could add it on a common event?
Edit: is there anyway to set a custom auto target? to explain better i.e. after an event happens have the auto target set to a specific enemy. i'm taking a guess that it's something to do with this line here?
$BlizzABS.autotarget = targets[(index + 1) % targets.size] if index != nil
any helps appreciated.
Just thought id post this in here as well as littledragos "smart target".
I found the homing bug that i remember bringing up months ago in another thread. (once i spent some time on it)
it seems to be linked to "charge" skills.
i put some more detail into it on dragos page. but basically if a skill is on charge i can spam it to make it cast unless the charge is over 40 frames or so.
that same bug caused targeting issues on yours and littlegragos version.
after setting it to no charge...it was all well and good.
Just a note for you and the community Blizz and anyone who is trying to figure out why they cant cast their friggen fire ball till they nerd rage on the hot key.
Hey Blizz. I found a funny bug.
Using the Shooting / thrusting skill set up with a charge (move on charge)
I also have the BABS red circle disabled by moving the "$game_temp.select_data = nil".
on line 109 to 111.
and AUTO_TURNING = true
I run around to shoot people. I face them and while my spell is charging. no problem.
Then the fire ball shoots... but it doesn't shot in the direction I'm facing. it shoots in the direction of my last directional key pressed.
really pretty funny.
idk if that's related to BABS or this code.. but i figured id mention it.
Hm, really not sure how this was supposed to work. I haven't touched this code in quite a while. Also, I'm not sure if it will work properly if you change the code.
Can you explain step-by-step what you do, what happens and what you expect to happen?