Okay to just simplify things at this point, I'm going to give the most recent update and code here and remove all the other stuff I wrote before. The problem is now back to unfixed but there's progress status.
Below is the code. The game variables are "sadness" variables for two other actors. The switch triggers
a common event where the characters are all mourning the character killed. So for each of my actors they have a hidden state similar to this with just game variables and switches triggered.
As I have it now it sort of works. The sytax and way intended works. What should happen is that when a character is killed in battle, the other characters sadness variables go up and they mourn that character via a dialogue that plays. dialogue is triggered by a switch which turns on a common troop event.
Right now, the only problem left to figure out is how to get it to trigger when a character is killed but not when they're already dead. I tried mimicking code from an earlier thread here
I have a respond effect when an attack kills them. I have a regenerate effect that does the same thing only when they are killed by poison or if the character pays health to do it. Only problem now is the regenerate effect is triggering if a character is already dead and a new battle starts and it seems like I can't have it both ways. Any suggestions here, or am I just going to need to pick one or the other at this point?
Below is the code. The game variables are "sadness" variables for two other actors. The switch triggers
a common event where the characters are all mourning the character killed. So for each of my actors they have a hidden state similar to this with just game variables and switches triggered.
As I have it now it sort of works. The sytax and way intended works. What should happen is that when a character is killed in battle, the other characters sadness variables go up and they mourn that character via a dialogue that plays. dialogue is triggered by a switch which turns on a common troop event.
Right now, the only problem left to figure out is how to get it to trigger when a character is killed but not when they're already dead. I tried mimicking code from an earlier thread here
I have a respond effect when an attack kills them. I have a regenerate effect that does the same thing only when they are killed by poison or if the character pays health to do it. Only problem now is the regenerate effect is triggering if a character is already dead and a new battle starts and it seems like I can't have it both ways. Any suggestions here, or am I just going to need to pick one or the other at this point?
Code:
<Custom Battle Effect>
user.sadHit = false;
</Custom Battle Effect>
<Custom Respond Effect>
if (target.isDead() && !target.sadHit && target.actorId()==1)
{
target.sadHit = true;
$gameVariables.setValue(77,
$gameVariables.value(77) + 20);
$gameVariables.setValue(83,
$gameVariables.value(83) + 20);
$gameSwitches.setValue(101,
!$gameSwitches.value(101));
}
else if (!target.isDead() && target.sadHit)
{
target.sadHit = false;
$gameSwitches.setValue(101,
!$gameSwitches.value(101));
}
</Custom Respond Effect>
<Custom Regenerate Effect>
if (target.isDead() && !target.sadHit && target.actorId()==1)
{
target.sadHit = true;
$gameVariables.setValue(77,
$gameVariables.value(77) + 20);
$gameVariables.setValue(83,
$gameVariables.value(83) + 20);
$gameSwitches.setValue(101,
!$gameSwitches.value(101));
}
else if (!target.isDead() && target.sadHit)
{
target.sadHit = false;
$gameSwitches.setValue(101,
!$gameSwitches.value(101));
}
</Custom Regenerate Effect>