RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

how do I make actors die at 0 hp?

Started by shintashi, January 26, 2011, 04:49:09 AM

0 Members and 1 Guest are viewing this topic.

shintashi

How do I make a character die if their hit points go to zero by some indirect effect outside combat?

Pseudo code:

if @actor.hp == 0
@actor.dead = true
end

brewmeister

The default system will set the "Knockout" state when HP 0 is reached. You don't have to do anything.

Essentially, "Dead" is having a state with "Regard as HP 0".  Usually also with "Can't Get EXP" & "Can't Move"

shintashi

Quote from: brewmeister on March 02, 2011, 02:54:17 AM
The default system will set the "Knockout" state when HP 0 is reached. You don't have to do anything.

Essentially, "Dead" is having a state with "Regard as HP 0".  Usually also with "Can't Get EXP" & "Can't Move"


unfortunately I'm not using a default system. I've got a battle system where if a monster kills off my characters, they die, but If I create a piece of code that lowers their hp (such as from backlash of a powerful spell) combat monsters stop attacking, and they can no longer attack, but they can continue walking around, get healed, etc. While this is a useful effect for simulating quasi immortal zombie status, since i actually want characters to be able to die/explode from casting over powered spells, this effect is superfluous and unwanted.

In other words, I need a method of telling the computer to kill the actors when their hit points hit zero.

Pokey

I dont know if this will work:
make a common event. set variable x = player's HP
conditional branch: x </= 0,
[do what you want here]

Zylos

So... wait, are you using something like an ABS? Because I thought you could just make a poison-like status that would knock you out, or import a doom countdown script or something.




shintashi

I was using Mr Mo's ABS actually. Its for the 'Child of Reason' project - the other projects don't use ABS, and I'd taken a break from CoR to work on particle systems and Text interface - both of which are going to be integral to CoR later on.

Point is, when you cause someone's hit points to drop to zero outside of a direct attack, in ABS, they don't always die, because death checking code isn't instantiated in the same place as hp tracking. (I can't believe I'm using instantiate in a sentence).