Where do I find death code? (VXA)

For a game I'm working on, I want to have code run every time an enemy dies in combat. I've been looking through the code (100% default) to find the part that should amount to [enemy.inflict_state(1) if enemy.hp < 1] (NOTE: That was psuedo-code, I don't know if inflict_state is the actual method the game uses). Can someone please help me find it? Thanks.
I don't know exactl where the code is, but I know the mistake you did when searching - there is no "enemy" in the battle, both actors and enemies become battlers and are handled by the same code. And there is no direct number used for the state, there is a function that returns 1 for the death state.


Search the script editor (crtl-shift-f)  for death_state_id, that will point you to the lines where it is used, and you should be able to find the rest from that base.
Do be careful though, if you add code it will also run when a player dies. You'll need to run a check to see if it is an enemy or an actor that dies, then run your command in the case it is an enemy that dies.


I think the command  you want is die, which is where all the death processing is held. So do a search for def die, and edit there.
I don't know exactl where the code is, but I know the mistake you did when searching - there is no "enemy" in the battle, both actors and enemies become battlers and are handled by the same code. And there is no direct number used for the state, there is a function that returns 1 for the death state.


Search the script editor (crtl-shift-f)  for death_state_id, that will point you to the lines where it is used, and you should be able to find the rest from that base.

Thanks! I think I saw the death_state_id function before when I was crtl-shift-fing for the number 1, but I didn't put two and two together (probably because I'm tired). Either way, I now have what I need due to you pointing me in the right direction. Thanks! I'll leave the thread open because I have a gut feeling that I'm about to stumble upon a similar problem that isn't deserving of its own thread.
Thanks! I think I saw the death_state_id function before when I was crtl-shift-fing for the number 1, but I didn't put two and two together (probably because I'm tired). Either way, I now have what I need due to you pointing me in the right direction. Thanks! I'll leave the thread open because I have a gut feeling that I'm about to stumble upon a similar problem that isn't deserving of its own thread.

Screw it, I think I'll be fine.
Do be careful though, if you add code it will also run when a player dies. You'll need to run a check to see if it is an enemy or an actor that dies, then run your command in the case it is an enemy that dies.


I think the command  you want is die, which is where all the death processing is held. So do a search for def die, and edit there.

Don't worry, I added checks to account for that.
@Jono99, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you have to add something and your own post is the last one, please edit that post
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/where-do-i-find-death-code-vxa.69145/