Damaging sector - not just on floor
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.
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.
Damaging sector - not just on floor
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.
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.
Re: Damaging sector - not just on floor
UDMF map format?
Re: Damaging sector - not just on floor
Yes. Sorry, meant to say that in the OP.
Re: Damaging sector - not just on floor
Something like this.
Check both map and zscript file. Zero gravity is janky, I know.
Check both map and zscript file. Zero gravity is janky, I know.
Re: Damaging sector - not just on floor
Yes! That's precisely the kind of effect that I want. Thank you kindly.
Re: Damaging sector - not just on floor
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.
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Damaging sector - not just on floor
There's also the SectorDamage ACS function.
Re: Damaging sector - not just on floor
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.)
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
The performance impact of the 3d floor is fairly negligible from what I have observed.
- 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
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.
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
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.
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.