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

How to end level when the player dies?

Recommended Posts

You might want to clarify whether you're looking to make a death exit (that is, an exit trigger that both kills the player and exits the map), or a script that will end the level anytime the player is killed during the level.  The former is fairly straightforward to do even in vanilla with romero heads & voodoo dolls.  I'm not sure if the latter is possible in ACS scripting (Hexen or otherwise) but you could try it out-- look for examples of a script that runs constantly during gameplay (as a lot of people use for updating a custom HUD, for example), then try tweaking it so that it constantly checks if the player is dead and calls Exit_Normal.

Edited by jerrysheppy

Share this post


Link to post
32 minutes ago, jerrysheppy said:

You might want to clarify whether you're looking to make a death exit (that is, an exit trigger that both kills the player and exits the map), or a script that will end the level anytime the player is killed during the level.  The former is fairly straightforward to do even in vanilla with romero heads & voodoo dolls.  I'm not sure if the latter is possible in ACS scripting (Hexen or otherwise) but you could try it out-- look for examples of a script that runs constantly during gameplay (as a lot of people use for updating a custom HUD, for example), then try tweaking it so that it constantly checks if the player is dead and calls Exit_Normal.

More or less what I want to do is make the level end when the player dies similar to what happens at the end of episode 1 in The Ultimate Doom. A door opens that lets out an impossible to defeat amount of demons, and when the player is killed the map ends, however I'm not necessarily sure how to do this.

Share this post


Link to post
1 hour ago, TheDoomedHellKnight said:

More or less what I want to do is make the level end when the player dies similar to what happens at the end of episode 1 in The Ultimate Doom. A door opens that lets out an impossible to defeat amount of demons, and when the player is killed the map ends, however I'm not necessarily sure how to do this.

 

If you want the ending of Knee-Deep in the Dead, it's as simple as setting the appropriate sector type (11, I believe).  However, you'll need to make sure that the player can't just escape the lethal sector(s); E1M8 does this via a one-way teleport.

 

Otherwise, it sounds like you'll need to do it via scripting.  Again, I don't have a ready-made script template for exactly what you want (I'm a relative newcomer to scripting myself), so unless someone else does, you'll have to learn the basics and then figure out what you need to do.  In addition to my above idea about having a script running for the entire level, which might be a bit inelegant, it might also be possible to assign a script directly to the player that calls Exit_Normal on death-- I know you can assign death scripts to monster Things.

Edited by jerrysheppy

Share this post


Link to post
script "exit on death" DEATH
{
    Exit_Normal(0);
}

But yes, that one works the whole level, so depending on how your level is designed that might not be what you want.

 

Here's a script that can be enabled through a normal ACS_Execute action (for example when the player walks over a line):


 

script "exit on death" (void)
{
    while(GetActorProperty(0, APROP_Health) > 0)
        Delay(1);

    Exit_Normal(0);
}

 

 

Edited by boris

Share this post


Link to post

ZDoom in Hexen format uses a different system for sector types; damage and exit is type 75, not 11. (At least, I think it is. Not sure if type 11 still works anyway.) A few points to consider about this sector type:

  • Most significantly, the player cannot technically die while within the sector. When the player would have died, they are instead left with 1% health and exit the level alive. This is really only of consequence if it is not the final level, as they will keep all their weapons for the next level but have almost no health. (In contrast to the various means of truly exiting the level while dead, which completely resets the player's health and inventory on the next level.)
  • It also causes 20% damage per second, and a radiation suit does not protect against this. (Invulnerability does, but kinda goes against the effect you're trying to achieve.)
  • Like all sector types except lighting effects and time-delay doors, it is affected by any linedef action that changes sector types. One idea might be to use a LowerAndChange action to turn a previously safe sector into a damage and exit sector, while simultaneously lowering walls that release monsters.

Share this post


Link to post
10 minutes ago, boris said:

script "exit on death" DEATH
{
    Exit_Normal(0);
}

But yes, that one works the whole level, so depending on how your level is designed that might not be what you want.

 

I didn't even realize there was a special DEATH type of script; as I said, I'm new at this!  So that makes it a lot easier for @TheDoomedHellKnight.

 

It seems to me that making it only activate at a certain point would be a simple matter of using a variable to track it:

 

script "exit on death" DEATH
{
	if(deathExit == 1)
		{
    		Exit_Normal(0);
		}
}

 

and then just make sure that whatever releases the unstoppable enemy horde (or starts them teleporting in, or whatever) also sets deathExit to 1.

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
×