I've been spending the better part of a day trying to figure this out. I've gotten pretty close to achieving what I want, but there are issues I can't iron out.
What I want: I'm trying to create a passive skill with the effect that the user of the skill performs a powerful last minute counterattack when defeated in battle. For what it's worth, I am using Yami's Skill Equip for skill usage (http://forums.rpgmakerweb.com/index.php?/topic/6727-skill-equip/), along with this add-on to equip passive skills: (). I am NOT having a problem with these scripts for this skill, but thought I might bring this up anyway.
I have tried going about this several ways, but the way I am going to describe is the latest way I've attempted to do it, and it is the one that I believe has gotten me the closest to achieving the desired effect.
Okay, so what I'm doing is that I create a blank skill and a blank state. These two are then linked together through the second script I linked to. This makes it so that when an actor equips the blank skill (through Yami's Skill Equip), the blank state is added to the actor.
Next, I go into the troops tab in the database and create a battle event, with the condition that the actor's HP is 0% or below and the span is "battle" so that it can only be done once per battle. In this event, I create a conditional branch that checks to see if the actor is inflicted with the blank state. If he is, then I remove the death state and use Force Action to call a second skill that does damage to a random enemy. After that, I re-add the death state to the actor.
This works good on its own. In a battle, if the actor dies, then he does the damage-skill like I want him to and then stays dead. However, if I enter a new battle with that actor still dead, then the damage-skill immediately happens at the start of battle, since it automatically checks to see if the actor has below 0% HP. I don't want this. I want it so that the skill can only be used ONCE per death cycle.
So, to try to get around this, I created a second conditional branch and put the first conditional branch inside it. For this second branch, I create a switch which the branch checks to see is on. If it is, then it proceeds to the original conditional branch. Then I set the switch to OFF after the damage-skill is forced and death is reinstated. In any other instance where the death state is removed (revival items, churches, etc.) I turn the switch back ON.
Here is a pic:
This works better, in that if the actor was killed in a previous battle, then the damage-skill isn't forced at the beginning of the next battle. However, what I think I can't get around now is that when the actor enters a second battle dead, the battle event condition (actor's HP is 0% or below) is already checked, thus if I revive in that same battle and happen to die again, then the damage-skill won't work. I tried setting the switch to OFF in the Else of the outer conditional branch, but this doesn't do any good either.
I'm at a loss now and don't know how to proceed. I tried using Yanfly's Death Common Event, but game ended up crashing with a double resume error in fiber (don't know what that is) after forcing the damage-skill.
Thoughts? Any help would be greatly appreciated!
What I want: I'm trying to create a passive skill with the effect that the user of the skill performs a powerful last minute counterattack when defeated in battle. For what it's worth, I am using Yami's Skill Equip for skill usage (http://forums.rpgmakerweb.com/index.php?/topic/6727-skill-equip/), along with this add-on to equip passive skills: (). I am NOT having a problem with these scripts for this skill, but thought I might bring this up anyway.
I have tried going about this several ways, but the way I am going to describe is the latest way I've attempted to do it, and it is the one that I believe has gotten me the closest to achieving the desired effect.
Okay, so what I'm doing is that I create a blank skill and a blank state. These two are then linked together through the second script I linked to. This makes it so that when an actor equips the blank skill (through Yami's Skill Equip), the blank state is added to the actor.
Next, I go into the troops tab in the database and create a battle event, with the condition that the actor's HP is 0% or below and the span is "battle" so that it can only be done once per battle. In this event, I create a conditional branch that checks to see if the actor is inflicted with the blank state. If he is, then I remove the death state and use Force Action to call a second skill that does damage to a random enemy. After that, I re-add the death state to the actor.
This works good on its own. In a battle, if the actor dies, then he does the damage-skill like I want him to and then stays dead. However, if I enter a new battle with that actor still dead, then the damage-skill immediately happens at the start of battle, since it automatically checks to see if the actor has below 0% HP. I don't want this. I want it so that the skill can only be used ONCE per death cycle.
So, to try to get around this, I created a second conditional branch and put the first conditional branch inside it. For this second branch, I create a switch which the branch checks to see is on. If it is, then it proceeds to the original conditional branch. Then I set the switch to OFF after the damage-skill is forced and death is reinstated. In any other instance where the death state is removed (revival items, churches, etc.) I turn the switch back ON.
Here is a pic:
I'm at a loss now and don't know how to proceed. I tried using Yanfly's Death Common Event, but game ended up crashing with a double resume error in fiber (don't know what that is) after forcing the damage-skill.
Thoughts? Any help would be greatly appreciated!