I recently added a "constrained" status effect to my game. When an enemy successfully applies the "constrained" state on a character, that character cannot move for the duration, and that enemy acquires a different state that causes them to only attack the targeted character for the duration.
If something were to interrupt the states of either the attacker or the target, such as the target dies or the attacker has a conflicting state applied, the other character obviously loses their corresponding state and restriction as well.
The one instance this does not work is when a "constraining" enemy is defeated, their target remains "constrained" until the timer runs out like normal. I'm using Yanfly's Buffs&States Core, but <Custom Remove Effect> <Custom Leave Effect> don't run when a state ends because a battler has been defeated. I've implemented a similar effect before by using <Custom Apply Effect> on State #1 to remove a state linked to a specific character when that character dies, but because <Custom Apply Effect> executes after state 1 is applied, is seems checking
Troop events don't seem to be the solution, since the Enemy HP condition relies on a designated index.
So I'm looking for some way to remove the "constrained" condition from an actor when an enemy with the corresponding "constraining" state is defeated. The way they're currently implemented, the generic state that the actors gain does not contain information on which enemy is their attacker. The enemies gain separate states corresponding to the actor they have "constrained" which end if that actor HP <= 0.
There are two other minor issues with this mechanic that I would appreciate some help with:
1. To prevent this from completely overwhelming the player, I set a condition with Continuum AI Eval for enemies to only use a constraining skill when there isn't already a party member restrained. (
Right now with how the troops are set up, it's only possible for 2/3 party members to be constrained at most, which is difficult, but rare and still entirely possible for the player to fight their way out of. For that, I don't consider this issue "game breaking", but for consistency and QA I'd prefer to keep the restriction to 1 party member.
2. As an additional effect of the "constrained" condition, I would like to have characters with that state take increased damage, like with the Sp-Parameters Physical Damage and Magical Damage, but I haven't found a way to do the equivalent to Certain Hit damage. Is there a way to increase the rate of Certain Hit damage in the same way, or some way to modify the rate of all three equally? My understanding is the guard modifier only ever adds to the existing defense and can't be used to increase the rate of incoming damage either.
If something were to interrupt the states of either the attacker or the target, such as the target dies or the attacker has a conflicting state applied, the other character obviously loses their corresponding state and restriction as well.
The one instance this does not work is when a "constraining" enemy is defeated, their target remains "constrained" until the timer runs out like normal. I'm using Yanfly's Buffs&States Core, but <Custom Remove Effect> <Custom Leave Effect> don't run when a state ends because a battler has been defeated. I've implemented a similar effect before by using <Custom Apply Effect> on State #1 to remove a state linked to a specific character when that character dies, but because <Custom Apply Effect> executes after state 1 is applied, is seems checking
.isStateAffected() always return "false" because every other status effect is already removed.Troop events don't seem to be the solution, since the Enemy HP condition relies on a designated index.
So I'm looking for some way to remove the "constrained" condition from an actor when an enemy with the corresponding "constraining" state is defeated. The way they're currently implemented, the generic state that the actors gain does not contain information on which enemy is their attacker. The enemies gain separate states corresponding to the actor they have "constrained" which end if that actor HP <= 0.
There are two other minor issues with this mechanic that I would appreciate some help with:
1. To prevent this from completely overwhelming the player, I set a condition with Continuum AI Eval for enemies to only use a constraining skill when there isn't already a party member restrained. (
<AI Eval: 1> !$gameParty.members().some(actor => actor.isStateAffected(21)) </AI Eval>) However, it seems the check only happens once at the start of the turn and not when the move actually executes, because if a troop contains 2 snake enemies and they both happen to select that skill from their pattern, there's a possibility they both successfully hit that turn and there are 2 constrained party members.Right now with how the troops are set up, it's only possible for 2/3 party members to be constrained at most, which is difficult, but rare and still entirely possible for the player to fight their way out of. For that, I don't consider this issue "game breaking", but for consistency and QA I'd prefer to keep the restriction to 1 party member.
2. As an additional effect of the "constrained" condition, I would like to have characters with that state take increased damage, like with the Sp-Parameters Physical Damage and Magical Damage, but I haven't found a way to do the equivalent to Certain Hit damage. Is there a way to increase the rate of Certain Hit damage in the same way, or some way to modify the rate of all three equally? My understanding is the guard modifier only ever adds to the existing defense and can't be used to increase the rate of incoming damage either.