Hello, I have a skill called "Purge" that will Remove any Buff parameter on a hero.
(ATK, MAT, MDF, LUK, ect...)
What I'm trying to figure out is the enemy casting this can currently cast it whenever.
I want to conditionally have the enemy only cast Purge when a hero actually has
a Buff that can be removed. Does this make sense and is this possible?
Thanks,
Eric
I would say you would need a custom AI script, and have it check if any actor battler has parameter buffs in order to use that skill. Database enemy action patterns do not support this. However custom AI scripts can be quite complicated, meant for decent-knowledge scripters.
Hm, I think you could do this by finding all the skills and/or items that give the player a buff, and have them call a common event that turns on a switch. Then, condition the enemy's Purge skill to happen only when that switch is on.
Also in the Purge skill itself, have it call another common event that turns the switch off so the enemy won't keep casting it.
...But it's not multiple turns, though? OP said they wanted the skill to cast once to remove all buffs, and then not cast again until there are more buffs to be removed. The common event in the Purge skill itself will turn off the switch, so there's no need to check whether or not a buff was removed.
Or are you talking about something else that I'm not getting? 🤔
The Buffs on the actors themselves are possibly multi-turned. Hell they could be up to 10 turns or 1 turn.
Let's say I use an Attack buff on my actor, 3 turns long. Let's pretend the buff skill also put a switch ON. (your example per say)
When the enemy uses Purge, he would turn the switch OFF (once again your example)
So what would happen if the enemy didn't use purge? What if he used Attack or another skill instead for 3 turns long? On the 4th turn my actors already ran out of the Attack buff but the switch is still ON, and there would be no way to turn it OFF by non-scripting means. He'll then use Purge even though I don't have a buff.
And trying to make a scripted means for that case would be extremely complex to the point where it's...well....pointless.
Ah, I see what you mean.
Okay, well a non-scripting way around that would be to have another state called "Has Buff" or something, and add that to the player when there's a buff (just add the state in the skill/item, too, when you add a buff). Then in a troop event, have a conditional branch run each turn checking whether or not the actor has the "Has Buff" state; if they do, then don't do anything, but if they don't, then turn the switch off.
But then you run into the problem where if each Buff has a different turn count duration. What if I have an Attack buff for 2 turns and a Defense buff for 4 turns? What if the game uses multiple Attack buffs of different time durations? It would be too much to check to work out, and the switch would get wonky due to accidental "Has Buff" miss-checks.
you can use this to manually check if there is a buff...
class Game_Battler def has_buff? (1..8).each do |id| return true if buff?(id) end end return falseendbut to use it as a condition to whether or not the enemy will cast Purge or not, is a different matter... of course you could probably make a battle event that runs every turn start to check the buffs, and turn a switch... but then again, what if there are multiple actors, then you'd also need to identify which one returned true, and you will still need to modify the target acquisition of the enemy so that it will only cast it on the actors that has t he buff...
If there's only 1 actor, it becomes easier since you won't need to dabble with the targetting... but once there are more than 1 actors, you will now need to modify the target acquisition of your enemy too...
it's far easier to actually use Force Action and troop events to do this rather than the default AI...
Thanks everyone for your input. I somehow knew in theory, I was thinking of
an easy thing logically to do, but knew it would be pretty complex to pull off without
some script handling. I'll give Troop Events a shot, thanks!
it is complex to do, even with scripting... XD
if Ace comes with a better AI set-up or at least conditions for targeting too instead of just conditions on when a skill is usable by the enemy, it would make things a lot easier...