Shad3 34 Posted March 20, 2014 (edited) Enemy AI : Targeting Priority Manipulator By Shad3Light The default VX Ace's enemy targeting behavior just pick a random target for any actions.This script adds some AI targeting priority. With this script, the enemies become able to pick a target based on the action specific priority.Download the script here, or grab it from my blog here. InstallationPut this script below â–¼ Materials and above â–¼ Main Process.UsageThe copy of the following instruction is included within the script. In an enemy notebox, you can add some tags. <target [action_id] [shortcut]> where [action_id] corresponds to the enemy's action list, and [shortcut] corresponds to one of the implemented targeting priority method.Example: <target 1 high_hp> This will make the enemy target the battlers with the highest HP value when using action number 1 (by default Attack). <target 2 low_hp_rate> This will make the enemy target the battler with the lowest HP percentage when using action number 2. If the action no. 2 is set to Heal, the enemy will proceed to heal its ally with the lowest percentage of health.Available targeting shortcut is as follows: low_hp high_hp low_hp_rate high_hp_rate low_mp high_mp low_mp_rate high_mp_rate low_tp high_tp low_tp_rate high_tp_rate self not_self If you want to make your own targeting condition, use <target eval [action_id]> [eval] </target eval> where [eval] is a ruby expression that takes returns -1, 0, or 1.In the eval, a and b denotes the battlers that would be sorted.For example, to make the enemy prioritize Eric when doing its ultimate skill, the tag will be <target eval 8> if a.name == "Eric" -1 elsif b.name == "Eric" 1 else a.hp <=> b.hp end </target eval> Do note that target selection is done at the start of the turn, like actors. The enemy will not suddenly change target mid-turn, for example if its target had already healed.Also, TGR have no effect on acquiring target with this script. PatchesThis script should work with most battle systems.For users of Schala Battle System, there is a patch here.CreditsGive credits to Shad3Light (me).For use in commercial project, I expect to at least be contacted first. Edited March 21, 2014 by Shad3 7 Ventwig, AJNR, TheoAllen and 4 others reacted to this Share this post Link to post Share on other sites
+ Fisherolol 12 Posted March 20, 2014 so you decided to make a whole script after all nice one Share this post Link to post Share on other sites
Shad3 34 Posted March 20, 2014 Well, this script and the snippet I posted before is different in inner working but yeah, decided to make a whole script as the default targeting behavior is just randomness. Share this post Link to post Share on other sites
Coolie 148 Posted March 20, 2014 Would it be possible with this script to allow enemies to target actors with states, only when the actor doesn't already have the state applied? Share this post Link to post Share on other sites
Shad3 34 Posted March 20, 2014 (edited) Would it be possible with this script to allow enemies to target actors with states, only when the actor doesn't already have the state applied? <target eval 3> if !a.state?(18) -1 elsif !b.state?(18) 1 else rand(3) - 1 end </target eval> This will prioritize any target without the state id 18. Though, if you want to make the enemy only consider using the skill only when there's opponent without said state, you'd want another script, either Hime's Enemy Action Conditions or my own (uncommented, beware) script. In case of my script: <condition eval 3> p.any? { |a| !a.state?(18) } </condition eval> For Hime's script, the code is basically the same. As analogues to the player, Action condition script is like considering which skill to use, and my targeting script is like picking the target for said skill. Edited March 20, 2014 by Shad3 Share this post Link to post Share on other sites
Coolie 148 Posted March 20, 2014 Got it, cool, thank you! Share this post Link to post Share on other sites
Blackvivi 10 Posted March 20, 2014 And another better one!!! YAAAY! And another better one, is that even a correct sentence? LoL... anyway Your like my target man for the week Shad Much Kudos to ya Share this post Link to post Share on other sites
Shad3 34 Posted March 21, 2014 I've made a patch to make this script work with Schala Battle System here. I also edited the first post to reflect this. 1 Blackvivi reacted to this Share this post Link to post Share on other sites
Zebraoracle 4 Posted April 30, 2014 I hope posting a month later isn't considered necroposting. :/ How would I make an enemy prioritize using a certain skill on a character with a certain state over using said skill to a character without the state? Would it be possible with this script to allow enemies to target actors with states, only when the actor doesn't already have the state applied? <target eval 3> if !a.state?(18) -1 elsif !b.state?(18) 1 else rand(3) - 1 end </target eval> This will prioritize any target without the state id 18. Would I use this, only slightly altered? Share this post Link to post Share on other sites
Shad3 34 Posted May 1, 2014 Yes. Just delete the "!". Share this post Link to post Share on other sites
Zebraoracle 4 Posted May 1, 2014 Thanks! I'll try it out. Share this post Link to post Share on other sites
+ Sughayyer 163 Posted May 11, 2014 Is tgr totally disabled when this script is active or only when I configure the enemies' actions? If it is completely disabled, can I set attacking priority based on party lineup (position 1, 2, 3, 4 and so on)? If so, what would it look like? Thanks! Share this post Link to post Share on other sites
Euphoria 147 Posted July 9, 2014 I can't get it to work, I can't get any AI scripts to work actually... I don't know what the hell is going on. 1 THEAQIB reacted to this Share this post Link to post Share on other sites
Shad3 34 Posted July 9, 2014 What are you trying to do? Share this post Link to post Share on other sites
Euphoria 147 Posted July 9, 2014 I think it's incompatibility, I finally got DoubleX's to work, sort of, when placed in a certain spot on my script list. I just need something that can check if states are already applied, and then sort by parameters for targeting. I'm assuming through the custom eval, this is possible with this script? Share this post Link to post Share on other sites
Shad3 34 Posted July 12, 2014 Yes, with custom eval it is possible. Share this post Link to post Share on other sites
bloodyliao 5 Posted May 24, 2016 Is there a way to to target actors with highest/ lowest parameters like atk, def, mat? Share this post Link to post Share on other sites