Where do I find death code? (VXA)

Status
Not open for further replies.

Jono99

Veteran
Veteran
Joined
May 8, 2015
Messages
76
Reaction score
17
First Language
English
Primarily Uses
RMVXA
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
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.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,528
Reaction score
14,261
First Language
English
Primarily Uses
RMVXA
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.
 

Jono99

Veteran
Veteran
Joined
May 8, 2015
Messages
76
Reaction score
17
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Jono99

Veteran
Veteran
Joined
May 8, 2015
Messages
76
Reaction score
17
First Language
English
Primarily Uses
RMVXA
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.
 

Jono99

Veteran
Veteran
Joined
May 8, 2015
Messages
76
Reaction score
17
First Language
English
Primarily Uses
RMVXA
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,434
Reaction score
7,713
First Language
German
Primarily Uses
RMMV
@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
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,381
Reaction score
8,537
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,546
Members
137,835
Latest member
yetisteven
Top