How to make a battle event that controls a variable upon monster death

Hi all. I've spent the last hour and a half or so searching around for a tutorial on this (because I know I've seen one before) and trying various things to no avail. I simply want to make a battle event that causes a variable to tick when a certain type of enemy is killed in order to count how many the player has defeated for a quest, but I cannot for the life of me figure out how. It doesn't seem like it should be difficult at all, and I'm sure the solution is something very simple that I'm just missing, but after reading through numerous tutorials and scanning the last few pages of this forum, I'm unable to figure it out. If someone could explain this to me, or perhaps link me to a tutorial that does so, I'd be extremely grateful. I feel rather silly being unable to figure this out myself, but I guess that's just how it goes sometimes.

Thanks!
If you use touch encounters it would be pretty easy:

Engage battle with encounter ##:

If victorious: Add variable equal to monsters slain in encounter ##.

With random encounters it would be more work, though...
Hi all. I've spent the last hour and a half or so searching around for a tutorial on this (because I know I've seen one before) and trying various things to no avail. I simply want to make a battle event that causes a variable to tick when a certain type of enemy is killed in order to count how many the player has defeated for a quest, but I cannot for the life of me figure out how. It doesn't seem like it should be difficult at all, and I'm sure the solution is something very simple that I'm just missing, but after reading through numerous tutorials and scanning the last few pages of this forum, I'm unable to figure it out. If someone could explain this to me, or perhaps link me to a tutorial that does so, I'd be extremely grateful. I feel rather silly being unable to figure this out myself, but I guess that's just how it goes sometimes.

Thanks!
What I do is just use the Troops Battle Events.  There is a condition in your  Event page that allows you to trigger an event when enemy 1~8 reach 0 HP.  So from there just add to the variable that represents the amount of that enemy slain.
What I do is just use the Troops Battle Events.  There is a condition in your  Event page that allows you to trigger an event when enemy 1~8 reach 0 HP.  So from there just add to the variable that represents the amount of that enemy slain.
Hey thanks to both you and Milennin for your responses. I've tried doing this, but for some reason I can't seem to get it to work. Do you think maybe you could walk me through it a little more closely? What exactly is the event command that I use and what are the settings? What are the span and conditions of the event? I know it must seem a bit obvious, but I though so, too, and I still can't get this to work. More help would be much appreciated, and it helps to know that at least I've been..... almost doing it right.

EDIT: I have also discovered that what I have set now will work if the monster is killed first, or at least not last, in an encounter with multiple monsters, but not if the monster in question is the only monster in the encounter, or is killed last, or if all monsters in the encounter are killed at once.
Hey thanks to both you and Milennin for your responses. I've tried doing this, but for some reason I can't seem to get it to work. Do you think maybe you could walk me through it a little more closely? What exactly is the event command that I use and what are the settings? What are the span and conditions of the event? I know it must seem a bit obvious, but I though so, too, and I still can't get this to work. More help would be much appreciated, and it helps to know that at least I've been..... almost doing it right.

EDIT: I have also discovered that what I have set now will work if the monster is killed first, or at least not last, in an encounter with multiple monsters, but not if the monster in question is the only monster in the encounter, or is killed last, or if all monsters in the encounter are killed at once.
What you probably need to do is set the monsters to an immortal state - that way you can abort the battle yourself when ever you are ready.  This gives you a lot more flexibility to tinker with your game at the end of a battle after your monsters are dead. You can do this by using the Change Enemy State under Battle in page 3 of your event commands.

If you're using a single monster encounter this is what I would do to get it to work:

Condition: Enemy [1. Monster]'s HP 0% or below        Span: Moment

That way the event will trigger automatically as soon as Enemy1 reaches 0 HP. 

Then you can add to variables and do what ever else you would like to then just Abort Battle when ever you are ready.
Hey thanks to both you and Milennin for your responses. I've tried doing this, but for some reason I can't seem to get it to work. Do you think maybe you could walk me through it a little more closely? What exactly is the event command that I use and what are the settings? What are the span and conditions of the event? I know it must seem a bit obvious, but I though so, too, and I still can't get this to work. More help would be much appreciated, and it helps to know that at least I've been..... almost doing it right.

EDIT: I have also discovered that what I have set now will work if the monster is killed first, or at least not last, in an encounter with multiple monsters, but not if the monster in question is the only monster in the encounter, or is killed last, or if all monsters in the encounter are killed at once.
I was going to say do a span of Battle (so it occurs once per battle) but after reading Beryl's reply, I know I'm wrong.

What you probably need to do is set the monsters to an immortal state - that way you can abort the battle yourself when ever you are ready.  This gives you a lot more flexibility to tinker with your game at the end of a battle after your monsters are dead. You can do this by using the Change Enemy State under Battle in page 3 of your event commands.

If you're using a single monster encounter this is what I would do to get it to work:

Condition: Enemy [1. Monster]'s HP 0% or below        Span: Moment

That way the event will trigger automatically as soon as Enemy1 reaches 0 HP. 

Then you can add to variables and do what ever else you would like to then just Abort Battle when ever you are ready.
I tried something similar with an Auto-Life ability (like Final Fantasy) and setting condition: Actor[1]'s Hp 0% or below    Span: moment, but it still gave me a party defeated message when I did a battle test under the troop tab. My event checked the death state, and if they have the death state (which is supposed to be applied when hp reaches 0, according to the note tag in the States tab) then check to see if they have the Auto-Life State; if they do, remove the death state, restore hp to 50% of max, and remove the Auto-Life state. Whenever I do a battle test (using a single character and an item that is properly applying the State) I get a party defeated message when the actor reaches 0 hp (I know that I"m identifying the correct actor number in the battle event command.

Perhaps it is the same cause that affects both TheBigFace and myself.
Add this script to your project so your event also runs after the last enemy is defeated


http://himeworks.wordpress.com/2013/03/06/end-phase-triggers/
I was going to say do a span of Battle (so it occurs once per battle) but after reading Beryl's reply, I know I'm wrong.

I tried something similar with an Auto-Life ability (like Final Fantasy) and setting condition: Actor[1]'s Hp 0% or below    Span: moment, but it still gave me a party defeated message when I did a battle test under the troop tab. My event checked the death state, and if they have the death state (which is supposed to be applied when hp reaches 0, according to the note tag in the States tab) then check to see if they have the Auto-Life State; if they do, remove the death state, restore hp to 50% of max, and remove the Auto-Life state. Whenever I do a battle test (using a single character and an item that is properly applying the State) I get a party defeated message when the actor reaches 0 hp (I know that I"m identifying the correct actor number in the battle event command.

Perhaps it is the same cause that affects both TheBigFace and myself.
I think the problem is the game checks to see when all the monsters are in a downed state and that condition takes priority over everything else and immediately ends the battle before your events get a chance to trigger.  That's why the events seem to work for everything except the monster that dies last.  You can fix this by altering the state of the monster to Immortal.  That prevents the battle from closing prematurely. 

I would think it would be the same with party members too, but I'm reluctant to say for sure because I've only tested this with monsters.  You might want to try changing the state of your party members to immortal for your auto life event and see if it helps fix your problems. 

Or you can just try using Tsukihime's script - which works like a charm for adding variables after the last monster dies.   Though I should caution if you decide to use his script don't use Span: Moment like I suggested for a single monster encounter in the previous post.  If you do, your event will continue to loop even if you try to abort battle in the event itself.  
I think the problem is the game checks to see when all the monsters are in a downed state and that condition takes priority over everything else and immediately ends the battle before your events get a chance to trigger.  That's why the events seem to work for everything except the monster that dies last.  You can fix this by altering the state of the monster to Immortal.  That prevents the battle from closing prematurely. 

I would think it would be the same with party members too, but I'm reluctant to say for sure because I've only tested this with monsters.  You might want to try changing the state of your party members to immortal for your auto life event and see if it helps fix your problems. 

Or you can just try using Tsukihime's script - which works like a charm for adding variables after the last monster dies.   Though I should caution if you decide to use his script don't use Span: Moment like I suggested for a single monster encounter in the previous post.  If you do, your event will continue to loop even if you try to abort battle in the event itself.  
That works (with the immortal state), and checking in the common event if their hp < 1 (can't check death state because they are immune to death with immortal) to run the common event. Added a message that the character is revived so that the player is notified.
That works (with the immortal state), and checking in the common event if their hp < 1 (can't check death state because they are immune to death with immortal) to run the common event. Added a message that the character is revived so that the player is notified.
Ok good.  I should have probably been more clear that was I suggesting using the HP condition in conjunction with an immortal state in my earlier post.  Now that I re-read it, I could see how it could give the impression that I was separating the two.
Ok good.  I should have probably been more clear that was I suggesting using the HP condition in conjunction with an immortal state in my earlier post.  Now that I re-read it, I could see how it could give the impression that I was separating the two.
Unless I want to add the state check and auto life effect into the script before it checks the downed state, I'll have to suck it up and give the character immunity from death attacks with Auto-Life (like the Death Spell).
Unless I want to add the state check and auto life effect into the script before it checks the downed state, I'll have to suck it up and give the character immunity from death attacks with Auto-Life (like the Death Spell).
What I plan to do is just design my own type of death state and apply it when the monsters are at 0 HP, since the default one is so cumbersome to use if you want to run events after the monsters have all been defeated. 

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-battle-event-that-controls-a-variable-upon-monster-death.16335/