Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
TimeOfDeath

script: kill player when a monster dies?

Recommended Posts

monster has TID = 8
if the monster dies, I want the player to die too
But, the monster can also be killed by other monsters, so how do I make the player die instead of the monster that killed the other monster?

I tried giving the player a TID but I don't think that worked? I can't seem to figure it out, even though it's probably simple.

Share this post


Link to post

You cannot assign the player a TID in the Things properties dialog, but you can, if I recall correctly, do something to this effect:

#include "zcommon.acs"

Script 900 ENTER
{
  Thing_ChangeTID(0,100+PlayerNumber());
}

Script 100 (int tid)
{
  Thing_Damage(tid,255);
}
Now every player, beginning with player #0, will be assigned a TID of 100, 101, 102, 103, etc... Also, if I am remembering right, giving Thing_ChangeTID an oldtid of 0 will reference the activator of the script, which in the case of all ENTER scripts is a particular player thing. Now, if you want ALL the players to die when this monster is killed, you can remove the '+PlayerNumber()' segment of the code. In either case, have the monster in question call Action 80, Script # 100, with parameter 1 set to 0 if you want just one player to die or 100 if you want all players to die.

Share this post


Link to post

A Boom-compat way to do this would be assign the monster's death frame to the KeenDie codepointer. Stick a voodoo doll somewhere behind a door tagged 666, which will open when the monster dies, have the doll die when it passes the door.

Note this will happen EVERY time one of the monster type dies, so it's useful for something like a map with a single unique monster, not so useful to kill the player when the last Imp dies on a map full of Imps (though technically still possible with voodoo scripting)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×