Advanced Skill Targeting (plus multiple forced actions) (now Yanfly's compatible)

OK!

First of all, there's a new version with some fixes that you need to get this working.

Latest version of AST for YANFLY

Secondly, a compatibility script for Pets and Summons (Compatibility) v1.6! Add it in a separate script page after AST and the pets script.

With this, any pets will be included when you ASTinclude:friend (if actor) or ASTincludeLopponent (if enemy) There's also a new command!

ASTinclude😛ets

which only includes the pets!

Seems to work on my end. Please let me know if it works for you!

Code:
class Advanced_Targeting    def basic_friend    if @targetside=="friend"      push_unit(@friends.members)      push_unit($game_party.pets) if @actor.actor?    end  end    def basic_opponent    if @targetside=="enemy"      push_unit(@opponents.members)      push_unit($game_party.pets) if @actor.enemy?    end  end   #--------------------------------------------------------------------------  # * advanced_choice  #   processes the more complex AST commands  #--------------------------------------------------------------------------  def advanced_choice    clear    @startat = 0    @globalstartat = 0    forcedaction = -1    killafter = 0    randomise = false    repeats = false    randomnum = 0    @reason = "This creature is untargetable"    puts "*** starting skill rules evaluation ***"  if @verbose == true    @action.note.split( /\n */ ).each do |line|      puts line if @verbose == true      bits=line.split( /: */ )      bits[1] = "" if bits.length==1      bits[0] = bits[0].chomp      bits[1] = bits[1].chomp      case      when bits[0]=="ASTinclude"        if bits[1]=="friend"          push_unit(@friends.members)          push_unit($game_party.pets) if @actor.actor?        end        if bits[1]=="opponent"          push_unit(@opponents.members)          push_unit($game_party.pets) if @actor.enemy?        end        push_unit($game_party.members) if bits[1]=="party"        push_unit($game_troop.members) if bits[1]=="troop"        push_unit($game_party.pets) if bits[1]=="pets"      when bits[0]=="ASTremove"        evaluate_units(bits[1])      when bits[0]=="ASTpreserve"        @startat = @targets.length      when bits[0]=="ASTpreserveglobal"        @globalstartat = @targets.length      when bits[0]=="ASTforceaction"        forcedaction = bits[1].to_i      when bits[0]=="ASTkillafter"        killafter = 1      when bits[0]=="ASTremovecaster"        evaluate_units("a==b")      when bits[0]=="ASTrandom"        @targets = randomise(bits[1].to_i) if @executing == true      when bits[0]=="ASTstart"        @reason = bits[1]      when bits[0]=="ASTreason"        @reason = bits[1]      end    end    $Targeting_Rules.puts_rules if @verbose == true    @startat = @globalstartat    process_targeting_rules    @targets = @targets.uniq    puts "--------------" if @verbose == true    puts "VIABLE TARGETS" if @verbose == true    @targets.each do |member|      member.ASTkillafter(killafter) if @executing == true      member.ASTset_forced_action(forcedaction) if @executing == true      puts member.name + " forced action " + member.AST_forced_action.to_s if @verbose == true    end    puts "--------------" if @verbose == true  end  end class Targeting_Rules    def reset_members    @members = []    @members = $game_troop.members + $game_party.members + $game_party.pets    @members = @members.uniq  end  end
Oh wow this is still a thing.

Hm, I think so. I'm afraid I've not looked at RPGmaker for months, so I can't give you the exact code required, but if you added a global rule like this pseudocode

add_target_rule('a.has_a_sword_equipped and b.state?(x)',"never",'This enemy is flying out of reach!')where x is the state number of a "flying" state, then you should be unable to hit any enemy who has the flying state when the character has a sword equipped. As a global rule, this only needs to be used once while initialising your game and then it will be permanently stored until you remove it, and then of course you can do clever stuff to remove the flying state in battle and bring it within sword's reach etc. But I'm afraid I don't know offhand how to detect whether a sword is equipped, as I've not touched AST or RPG Maker in months. But since you can set the weapon type of an item in the database, I'd guess it should be possible.

Sorry I can't be more help. Let me know if you try it out.

EDIT: Crap, now that I think about it, that rule would prevent any sword users from using ANYTHING on flying enemies, including items and magic. You'd want to add something else to that rule to check if it's a physical attack. Obviously magical and certain hit attacks should be able to be used in the example you gave.

add_target_rule('a.has_a_sword_equipped and a.attack_is_physical and b.state?(x)',"never",'This enemy is flying out of reach!')Sorry. don't know offhand how to determine if the attack is physical either.

MORE EDIT: That said, if all you want is the "out of range" thing maybe make sure there's not another script that's more focused and simpler to use. AST really mucks around with targeting and display, and I have no data on how compatible it may be with other scripts you may be using.
I know this was an old post, but I believe this would work:

add_target_rule('!a.wtype_equipped?(id of ranged weapon type) and a.current_action.attack? and b.state?(x)',"never",'This enemy is flying out of reach!')

Theoretically this should prevent a normal attack from targeting flying enemies for ANY type of weapon other than those designated as "ranged", so it won't be limited to swords.
Thank you, that's really cool!

... I need to go back and rewrite this some day. I think I was on to a good thing but the implementation is clunky and it's really bloated with the forced action stuff. Personally I don't know if I would use it as it currently is, it's a little embarrassing.

Maybe cut it down to a core script and then have compatibility/UI scripts for different battle engines...

But I have many other things to do first.
I was offline for some time again.

I will be checking later if 1.6 works on my end but now just a quick thank you for your work 😉 I am going to save pre 1.6 version in txt file for possible future use, it grew on me 🙂
Ok, it is of maximum importance that when we use Advanced Skill Targeting we must set in Pets and Summons script all messages for all actors-summon

example:

#Message played when pet dies:
DEATH_MESSAGES = {
  2 => "A large wolf has died!",
  3 => "A large wolf has died!",
  4 => "A large wolf has died!",
  5 => "A large wolf has died!",
  7 => "A large wolf has died!"

In default settings, Pets and Summons only defines messages for actors 2 and 7, and that is why actor 2 was only working summon 😉

Now everything seem to work.

I finally have some time to test it and unfortunatelly now we have a different problem.

Script line 621 NoMethodError undefined method 'for_dead_friend?' for nil:NilClass

Now pets (summons) create this error when thay die. Regardles of method of death. Except actor 2, he works fine as summon...


I did make a demo. In troops choose troop 1 ( two slimes ) and play as test summoner. Summoner has skills summmon and each summon has unsummon to quickly kill them. Everything works fine when we summon actor 2,but error occurs when we try to kill (unsummon, kill by dmg) other actors ( in this case 3-5) I have tried different combinations, with fresh project etc and this problem occurs as soon as we introduce advance targeting to the script base.

If you have some time and still want to try to fix this compatibiliti issue I will be graetfull for help 😉

http://www.mediafire.com/download/30aqwwz4w0k6wvk/demo_error_at_summon.7z
Ah, good to hear you've figured it out.
Hi!

First of all, thanks for the great script!

I'd like to hide untargetable enemies, so they don't show up in the target selection window. If I'm not wrong, there's such a thing in the Yanfly compatible version. Unfortunatly I don't use Yanfly's battle system.

Could you (or someone else) please tell me what lines of code I have to copy, to make it work in the regular version of the script? If it's that simple.
Hi, thanks for checking this out. It's very late at night here, but I'll see what I can do tomorrow. I don't think it'll be too complex.
Right, this ought to work. Let me know if you have any problems with it.

https://dl.dropboxusercontent.com/u/65029315/Advanced_Targetingv4default.txt
Right, this ought to work. Let me know if you have any problems with it.

https://dl.dropboxusercontent.com/u/65029315/Advanced_Targetingv4default.txt
Oh nice, thank you! 🙂

I'll check it out.

Original thread: https://forums.rpgmakerweb.com/threads/advanced-skill-targeting-plus-multiple-forced-actions-now-yanflys-compatible.17950/