- Joined
- Aug 16, 2013
- Messages
- 32
- Reaction score
- 6
- First Language
- English
- Primarily Uses
This script is no longer really supported. If you have problems by all means PM me and I'll see if I can help, but I cannot make any promises any more about fixing bugs or adding features. I may someday port it to MV as that is what I'm using now
Advanced Skill Targeting
WHAT'S IT FOR?
AST allows you to...
Provide rules that let you determine exactly which actors and enemies are targeted by individual skills and items
Define global rules that apply to every skill and item, that persist across saving and loading games.
Make battlers hit by these skills take immediate forced actions, and kill them afterwards if you want
Get random targeting with no repeated enemies
WHERE CAN I GET IT?
A demo is available here
(script in demo is out of date. It's fully functional but the link below has fixes)
The script used to be in two parts, now it is only one, here
The Yanfly version is here. Created for a version of yanfly that may well be outdated now, I am not using VX Ace any more and have not had the time to test it.
Example images required for the yanfly version:
Important next step: create a state that expires at battle end and turn end called forceaction, and insert its number into this section of the script
AST_FORCED_ACTION_STATE_ID = your number here
Some scripting experience is valuable, particularly in creating damage formulas.
Free for non-commercial use.
HOW IS IT USED?
There are three components to the script
Targeting rules in Skill/Item notes
The first thing to notice is that the scope option still has a purpose. It still defines how many enemies you hit (one, a group, or x random), whether you hit dead or alive enemies, and whether you see the Actor or Enemy choice screen when picking an individual target.
Targeting screen for skill in above image, with scope set to One Ally. Monsters have been added to it because they have the zombie status
Same skill and situation, but scope is One Enemy
By default, every skill you already have will work as it always has. Things only change when you add some AST commands to the notes.
AST commands are implemented in the order they're given. You'll want to start by including one or more groups of targets to the target list, and then removing targets from it using rule filters.
ASTstart:reason - required to tell the script to look for commands. Absolutely no processing will take place without this, and the skill targeting will work as it does by default.
Reason is optional. It allows you to provide a message to give to the player about why they cannot target that character.
ASTstart:Slimes cannot be targeted with this skill, they don't have necks.
note the slimes are greyed out in the selection window, but the bat and hornet are not
ASTreason:reason - let's you redefine the reason, in case you want different reasons for different enemy groups
ASTinclude:group - Note the colon :, it's required. Includes a group of targets in the targeting list. Without at least one ASTinclude:, the script will return an empty targeting list.
you can have more than one of them, the most basic example being
ASTremove:rule - removes targets from the target list based on a rule you provide. The rules are similar to the Damage Formulas but must be comparisons, not assignments.
Important note... do NOT use "valuea = valueb" unless you are very very clever. It will not have the effect you're looking for. Make sure to use "valuea == valueb" as that compares the values rather than assigning them. Note there are TWO ==
ASTpreserve - "locks in" all commands above this command. Targets already on the targetlist will not be affected at all by anything that happens after this command. Remember that heal spell from before? (note: zombies are not a standard feature in RPG Maker. I use Neon Black's script though, but you don't need it for this script. This is just an example anyway)
ASTpreserveglobal - like ASTpreserve, but only applies to global rules. Anything above this in a note will not be affected by global rules.
ASTremovecaster - easy way to remove the caster from the list of characters his action can target.
ASTrandom:num_of_targets - reduces the target list down to a list of n random targets. Unlike the built in random scopes, none of these targets will be repeated - each target in the battle can only be hit once, but which ones are hit will be random.
ASTforceaction:skill_id - If the attack hits, the target will be forced to immediately take a forced action. More information below.
ASTkillafter - If the target takes a forced action, they will immediately be killed afterwards. I made this so I could turn zombies into bombs. So yeah. More information below.
That's all the ASTcommands. Here's a few more examples, likely of varying usefulness.
... anyway, on to...
GLOBAL RULES
Global rules are handled by the $Targeting_Rules global object. They are included in save games. (and will thus break save games without them. Them's the breaks. Comment that out if you hate it and feel like keeping track of what rules should be in effect when the game is loaded)
I added the commands to the interpreter, so you can call them with the Script option in any map, battle or common event. The commands to add/remove rules are...
code works exactly like the formulas in the ASTremove section above. Use single quotes ' since you'll probably be calling this from map, battle or common events and will need to use ' there or mess about with escape characters and nobody likes that. Each rule will make anyone who it applies to untargetable.
expires lets you set global rules to automatically expire. If you do not include it, the rule will never expire by default.
Uses? Here's one. Let's say you have a FF-style dragoon with a jump command. When they use Jump, state 40 (jump) is applied and it lasts for one turn.
When your game starts up, make one of your first script calls
That dragoon will be untargetable by all skills as long as they are in the air. When they land (lose the state) they will automatically become vulnerable again. Of course if you were doing it in a different way you could use
or something.
Something more complex? The Demon King has an impenetrable forcefield, and cannot be targeted by any attacks.
(you could check for enemy_id, but these are the global rules and actors don't have that stat. Be careful!)
The only thing that can break down the forcefield is the Great Macguffin, an item with this in it's Note.
and that item has a common event in its effects with this script
Using the Great Macguffin on him will make him vulnerable and cranky.
NEW: giving reasons
You can now give reasons for why global actions do not apply. For example,
FORCED ACTIONS
Using the following AST codes in the skill/item's notes enables forced actions on hit.
ASTforceaction:skill_id - if the current skill hits, it forces the target to immediately use a skill
ASTkillafter - if the current skill hits, and the target uses a forced action, they will die immediately afterwards.
I use this for blowing up enemies.
12 is an AOE fire attack that hits all allies. The original target dies immediately afterwards.
Some notes about forcing actions...
Try adding the forced action state to your skill effects if a skill has no other effects. The script applies the state anyway, but this will prevent the "no effect" messages in the battle log.
Try to avoid having forced actions trigger forced actions without very careful planning. You can have a forced action trigger itself in retaliation, but you'll quickly end up with an infinite loop of skill uses that only ends if something dies, something dodges or something resists the status.
Confused enemies who you force to hit their their allies will hit you!
BE CAREFUL - an unfortunate side effect is that if you force an enemy to act through an event, this will still apply. Make sure to remove your confusion states and any forceaction protection from enemies before you try to event them into action!
Advanced Skill Targeting
WHAT'S IT FOR?
AST allows you to...
Provide rules that let you determine exactly which actors and enemies are targeted by individual skills and items
Define global rules that apply to every skill and item, that persist across saving and loading games.
Make battlers hit by these skills take immediate forced actions, and kill them afterwards if you want
Get random targeting with no repeated enemies
WHERE CAN I GET IT?
A demo is available here
(script in demo is out of date. It's fully functional but the link below has fixes)
The script used to be in two parts, now it is only one, here
The Yanfly version is here. Created for a version of yanfly that may well be outdated now, I am not using VX Ace any more and have not had the time to test it.
Example images required for the yanfly version:
Important next step: create a state that expires at battle end and turn end called forceaction, and insert its number into this section of the script
AST_FORCED_ACTION_STATE_ID = your number here
Some scripting experience is valuable, particularly in creating damage formulas.
Free for non-commercial use.
HOW IS IT USED?
There are three components to the script
Targeting rules in Skill/Item notes
The first thing to notice is that the scope option still has a purpose. It still defines how many enemies you hit (one, a group, or x random), whether you hit dead or alive enemies, and whether you see the Actor or Enemy choice screen when picking an individual target.
Targeting screen for skill in above image, with scope set to One Ally. Monsters have been added to it because they have the zombie status
Same skill and situation, but scope is One Enemy
By default, every skill you already have will work as it always has. Things only change when you add some AST commands to the notes.
AST commands are implemented in the order they're given. You'll want to start by including one or more groups of targets to the target list, and then removing targets from it using rule filters.
ASTstart:reason - required to tell the script to look for commands. Absolutely no processing will take place without this, and the skill targeting will work as it does by default.
Reason is optional. It allows you to provide a message to give to the player about why they cannot target that character.
ASTstart:Slimes cannot be targeted with this skill, they don't have necks.
note the slimes are greyed out in the selection window, but the bat and hornet are not
ASTreason:reason - let's you redefine the reason, in case you want different reasons for different enemy groups
ASTinclude:group - Note the colon :, it's required. Includes a group of targets in the targeting list. Without at least one ASTinclude:, the script will return an empty targeting list.
Code:
ASTinclude:friend # includes all of the caster's allies
ASTinclude:opponent # includes all of the caster's enemies
ASTinclude:troop # includes all the enemy troop
ASTinclude:party # includes all the player's party
Code:
ASTinclude:friendASTinclude:opponentwhich will make the skill target EVERYONE.
ASTremove:rule - removes targets from the target list based on a rule you provide. The rules are similar to the Damage Formulas but must be comparisons, not assignments.
Code:
ASTremove:b.hp==b.mhp # remove anyone at full health
ASTremove:b.hp<a.hp # remove anyone who has less health than the caster
ASTremove:b.state?(10) # remove anyone with state 10, whatever that may be
ASTremove:!b.state?(10) # remove anyone withOUT state 10, whatever that may be
ASTremove:b.name=="Kevin" # remove Kevin
ASTpreserve - "locks in" all commands above this command. Targets already on the targetlist will not be affected at all by anything that happens after this command. Remember that heal spell from before? (note: zombies are not a standard feature in RPG Maker. I use Neon Black's script though, but you don't need it for this script. This is just an example anyway)
Code:
ASTstart
ASTinclude:friend # includes caster's friends
ASTpreserve # preserves. The caster's friends will not be removed by the removal rule below.
ASTinclude:opponent # includes caster's opponents
ASTremove:!b.state?(26) # removes every enemy who is not a zombie, but does not remove any friends since they were preserved.The result is a targetlist of the caster's friends and his zombified enemies. Heal spells hurt zombies, so this is a nice thing.
ASTremovecaster - easy way to remove the caster from the list of characters his action can target.
ASTrandom:num_of_targets - reduces the target list down to a list of n random targets. Unlike the built in random scopes, none of these targets will be repeated - each target in the battle can only be hit once, but which ones are hit will be random.
Code:
ASTstart
ASTinclude:opponent # includes all opponents
ASTrandom:3 # picks three random opponents. If there were only two opponents, only two would be returned.
ASTforceaction:skill_id - If the attack hits, the target will be forced to immediately take a forced action. More information below.
ASTkillafter - If the target takes a forced action, they will immediately be killed afterwards. I made this so I could turn zombies into bombs. So yeah. More information below.
That's all the ASTcommands. Here's a few more examples, likely of varying usefulness.
Code:
ASTstart
ASTinclude:party
ASTremove:b.level % 5 != 0 # the popular level 5 death. Set to hit the party since enemies do not have a level stat.
# Guess they saw what happens to Exdeath.
Code:
ASTstart
ASTinclude:friend
ASTinclude:opponent
ASTremove:b.agi % 3 != 0 # hit everyone with an agility divisible by 3, Calculator style.
Code:
ASTstart
ASTinclude:opponent
ASTremove:a.name == "Mike" and b.name == "Karen" # Mike does not have the heart to hit his little sister with his most damaging attack.
Code:
ASTstart
ASTinclude:opponent
ASTrandom:3 # hits three random enemies...
ASTpreserve
ASTinclude:friend
ASTrandom:3 # and also three random allies. Erupting volcano during the fight?
GLOBAL RULES
Global rules are handled by the $Targeting_Rules global object. They are included in save games. (and will thus break save games without them. Them's the breaks. Comment that out if you hate it and feel like keeping track of what rules should be in effect when the game is loaded)
I added the commands to the interpreter, so you can call them with the Script option in any map, battle or common event. The commands to add/remove rules are...
Code:
add_target_rule(code,expires) # eg add_target_rule('b.hp==b.mhp','oneturn')
rem_target_rule(code) # rem_target_rule('b.hp==b.mhp')
code works exactly like the formulas in the ASTremove section above. Use single quotes ' since you'll probably be calling this from map, battle or common events and will need to use ' there or mess about with escape characters and nobody likes that. Each rule will make anyone who it applies to untargetable.
expires lets you set global rules to automatically expire. If you do not include it, the rule will never expire by default.
Code:
add_target_rule('b.hp==b.mhp','oneturn') # rule will expire after one turn
add_target_rule('b.hp==b.mhp','afterbattle') # rule will expire after one battle
add_target_rule('b.hp==b.mhp','never') # rule will never expire by itself
add_target_rule('b.hp==b.mhp') # never is assumed
When your game starts up, make one of your first script calls
Code:
add_target_rule('b.state?(40)','never')
Code:
add_target_rule('b.jumping?','never')
Something more complex? The Demon King has an impenetrable forcefield, and cannot be targeted by any attacks.
Code:
add_target_rule('b.name=="Demon King"','never')
The only thing that can break down the forcefield is the Great Macguffin, an item with this in it's Note.
Code:
ASTstart
ASTinclude:troop
ASTremove:b.name!="Demon King" # the macguffin can only target the Demon King
ASTpreserveglobal # and it is protected from any global rules that might stop it from doing so
Code:
rem_target_rule('b.name=="Demon King"')
NEW: giving reasons
You can now give reasons for why global actions do not apply. For example,
Code:
add_target_rule('b.name=="Demon King"',"never",'The Demon King is protected by a forcefield!')
FORCED ACTIONS
Using the following AST codes in the skill/item's notes enables forced actions on hit.
ASTforceaction:skill_id - if the current skill hits, it forces the target to immediately use a skill
ASTkillafter - if the current skill hits, and the target uses a forced action, they will die immediately afterwards.
I use this for blowing up enemies.
Code:
ASTstart
ASTinclude:opponent
ASTforceaction:12
ASTkillafterSkill
Some notes about forcing actions...
Try adding the forced action state to your skill effects if a skill has no other effects. The script applies the state anyway, but this will prevent the "no effect" messages in the battle log.
Try to avoid having forced actions trigger forced actions without very careful planning. You can have a forced action trigger itself in retaliation, but you'll quickly end up with an infinite loop of skill uses that only ends if something dies, something dodges or something resists the status.
Confused enemies who you force to hit their their allies will hit you!
BE CAREFUL - an unfortunate side effect is that if you force an enemy to act through an event, this will still apply. Make sure to remove your confusion states and any forceaction protection from enemies before you try to event them into action!
Last edited:


