I am using Yanfly's Buffs & States Core on RPG Maker MV. My goal is to check if the leader (the first character in the party) is dead. If they are, then remove their passive buff to the party. If they are brought back to life, then add their passive buff back to the party.
One complication... the passive buff is a hard stat increase. For example, I increase strength by the leader's level via a common event. So I got the brilliant idea of attaching this check logic to the knockout state itself! Via the following:
<Custom Apply Effect>
if ($gameParty.leader().isDeathStateAffected()) {
$gameSwitches.setValue(7, true);
$gameTemp.reserveCommonEvent(17);}
</Custom Apply Effect>
<Custom Remove Effect>
if ($gameParty.leader().isDeathStateAffected()) {
$gameSwitches.setValue(8, true);
$gameTemp.reserveCommonEvent(17);}
</Custom Remove Effect>
So, here's the thing:
1. The Apply Effect logic won't work because it runs before the leader is actually affected by the knockout state.
2. Both of the Effects have the unfortunate issue of also running whenever I add the knockout state to enemies if my leader is dead.
What I need:
1. I need a way to check if the character knockout is being applied to is the leader (aka Party Member 1)
2. Then I need to apply the same check for removal, otherwise I might run into complications if I implement revives for enemies or other party members.
Any ideas on how to handle this? Thanks in advance!
Edit: I figured out another way to do this... Handle it using passive states & move the logic from knockout state to those states. This would eliminate the need to figure out target handling... The small victories...
One complication... the passive buff is a hard stat increase. For example, I increase strength by the leader's level via a common event. So I got the brilliant idea of attaching this check logic to the knockout state itself! Via the following:
<Custom Apply Effect>
if ($gameParty.leader().isDeathStateAffected()) {
$gameSwitches.setValue(7, true);
$gameTemp.reserveCommonEvent(17);}
</Custom Apply Effect>
<Custom Remove Effect>
if ($gameParty.leader().isDeathStateAffected()) {
$gameSwitches.setValue(8, true);
$gameTemp.reserveCommonEvent(17);}
</Custom Remove Effect>
So, here's the thing:
1. The Apply Effect logic won't work because it runs before the leader is actually affected by the knockout state.
2. Both of the Effects have the unfortunate issue of also running whenever I add the knockout state to enemies if my leader is dead.
What I need:
1. I need a way to check if the character knockout is being applied to is the leader (aka Party Member 1)
2. Then I need to apply the same check for removal, otherwise I might run into complications if I implement revives for enemies or other party members.
Any ideas on how to handle this? Thanks in advance!
Edit: I figured out another way to do this... Handle it using passive states & move the logic from knockout state to those states. This would eliminate the need to figure out target handling... The small victories...