Damaging sector - not just on floor

Mon Oct 05, 2020 3:44 pm

I probably should already know this but, what is the best way to create a damaging sector that damages the player whenever they are in it, regardless of whether they are touching the floor or not?

Specific scenario:

The map in question is set on a low-orbit space station and when the player goes outside the buildings, he can take damage if he hasn't picked up a space suit (rad suit). I am currently using the normal damaging floors but, because of where the map is set, I have adjusted the map gravity to be lower than normal. This means that the player can make very long jumps and avoid touching the floor for longer than normal and thereby avoid damage. In addition, there are still some other areas of the map that need to use the normal floor damaging system (so a universal "change everything on this map" solution would not be appropriate).

So, what I need is a system that allows:
The player to take damage whenever he is in one of the outside sectors (whether he is touching the floor or not).
The player to be protected in such a sector if he has a rad suit power-up active.
Other damaging sectors to behave normally.

I can think of a couple of ways to do it but they all involve a bit of scripting and it strikes me as this might be something that can be done more simply somehow. So, what would be the best way to achieve this?


Re: Damaging sector - not just on floor

Mon Oct 05, 2020 4:06 pm

UDMF map format?

Re: Damaging sector - not just on floor

Mon Oct 05, 2020 5:18 pm

Yes. Sorry, meant to say that in the OP.

Re: Damaging sector - not just on floor

Tue Oct 06, 2020 2:49 am

Something like this.
Check both map and zscript file.

Zero gravity is janky, I know.
You do not have the required permissions to view the files attached to this post.

Re: Damaging sector - not just on floor

Tue Oct 06, 2020 11:43 am

Yes! That's precisely the kind of effect that I want. Thank you kindly. :)

Re: Damaging sector - not just on floor

Sun Oct 11, 2020 2:55 pm

FWIW I did very much what you wanted when helping Rex in the Paranoic sequel for Paranoid (MAP15, the freezer).

The trick there was simply to use a 3D floor covering the entire sector, and then make it so the player can walk through the 3D floor.

Standing on an empty ledge in this death trap gave you no safety - eventually you'll take freeze damage if you stay in there too long, and if you die you become an ice chunk.

It was a trick originally suggested by Gez.

Re: Damaging sector - not just on floor

Mon Oct 12, 2020 1:03 am

There's also the SectorDamage ACS function.

Re: Damaging sector - not just on floor

Mon Oct 12, 2020 4:45 am

I haven't had a chance to put it into my map yet, but Apeirogon's solution certainly seems like it will do what I want.

The 3D floor idea is cunning. Would having such an extensive 3D floor (even if it is unrendered) have any performance impact?

SectorDamage would also be a possibility - but by my reading of the Wiki page, it doesn't set the damage in the sector to be an ongoing hazardous area but is a one-off "damage things now" kind of effect. So presumably it would need to be set up in a looping script to keep applying damage? (Not really a problem, I'm just checking.)

Re: Damaging sector - not just on floor

Mon Oct 12, 2020 7:25 pm

The performance impact of the 3d floor is fairly negligible from what I have observed.

Re: Damaging sector - not just on floor

Fri Oct 16, 2020 6:58 pm

I once did a room and placed an invisible sector into that room with damage.

To avoid the damage you had to crouch. So you only took damage when you were walking upright. Doomguy┬┤s head is otherwise actually in the 3d floor sector and therefore he takes damage by standing upright in the room.

Re: Damaging sector - not just on floor

Fri Oct 22, 2021 5:57 pm

Almost exactly a year's bump! I just wanted to drop in and say that I finally got around to trying this in a map properly.

Apeirogon's solution works very nicely and effectively gives me a new sector based damage type that I can apply to any sector in any map.

I'm not a natural scripter by any means, but after poking around in the ZSCript that Apeirogon provided, I think I have managed to tweak things to how I wanted. I have lowered the damage and set it so that it only affects players (with the original code, all actors were susceptible to the damage if they were in the sector). I also removed the messages, because I don't need them, and the air control tweak because I'll be handling that on a whole map basis.

I also noticed that if a sector has already been given a damaging floor, this really hits the player hard because he will take damage from the floor and from this ZScript. Not a problem, I just thought I'd mention it.

So, yeah, I just wanted to drop by and say thank you again and to report that I have managed to get exactly what I want from using Apeirogon's code.