Damaging sector - not just on floor

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Damaging sector - not just on floor

Post by Enjay »

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?

Thanks.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Damaging sector - not just on floor

Post by Apeirogon »

UDMF map format?
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Damaging sector - not just on floor

Post by Enjay »

Yes. Sorry, meant to say that in the OP.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Damaging sector - not just on floor

Post by Apeirogon »

Something like this.
Check both map and zscript file.
n-jay_space_rad.zip
(45.56 KiB) Downloaded 60 times
Zero gravity is janky, I know.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Damaging sector - not just on floor

Post by Enjay »

Yes! That's precisely the kind of effect that I want. Thank you kindly. :)
User avatar
Rachael
Posts: 13574
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Damaging sector - not just on floor

Post by Rachael »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Damaging sector - not just on floor

Post by Graf Zahl »

There's also the SectorDamage ACS function.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Damaging sector - not just on floor

Post by Enjay »

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.)
User avatar
Rachael
Posts: 13574
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Damaging sector - not just on floor

Post by Rachael »

The performance impact of the 3d floor is fairly negligible from what I have observed.
User avatar
WARCHILD_89
Posts: 452
Joined: Sun Nov 17, 2013 12:27 pm
Graphics Processor: nVidia with Vulkan support
Location: MIA between doomed dimensions

Re: Damaging sector - not just on floor

Post by WARCHILD_89 »

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.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Damaging sector - not just on floor

Post by Enjay »

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.
Post Reply

Return to “Mapping”