Immunity to Hexen Fall damage

Ask about ACS, DECORATE, ZScript, or any other scripting questions 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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
4page
Posts: 120
Joined: Tue Aug 06, 2019 5:08 pm
Location: American Pacific Northwest

Immunity to Hexen Fall damage

Post by 4page »

I'd like to avoid ACS or Zscript if possible, but if there's no other options I may have to branch out. So, I've tried to use a PowerProtection inherited item to make the player immune to fall damage, and it works like a charm. However, Hexen has a weird thing about it that it doesn't matter what kind of damage protection you use, at least from what I've found, if you're falling fast enough and hit the floor, it insta kills you. The only way I can figure to negate this so far is to just constantly check the players height against the floor, but even then it would be really hacky and complicated. Is there some easier and simpler way that I'm missing?
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Immunity to Hexen Fall damage

Post by Void Weaver »

Yep, for a some reason DamageFactor "Falling", 0.0 doesn't prevent from getting instakill damage (aka Minimum kill speed), which will guaranteed inflicted after reaching VelZ = -63. So you should be sure that player's VelZ will be less than -63 when landing will happen:

Code: Select all

ACTOR FallDmgProtector : CustomInventory
{
//+INVENTORY.UNCLEARABLE
+INVENTORY.KEEPDEPLETED
Inventory.MaxAmount 1
States
{
Spawn:
TLGL A 1 Bright
TLGL B 1 
TLGL C 1 Bright
TLGL D 1
Loop

Pickup:
Use:
TNT1 A 0 A_GiveInventory("PowerFallingProtection")
TNT1 A 0 A_Overlay(5,"CriticalSpeedHandler",1) //Also you can call overlay directly from custom player's Spawn state, instead of CustomInventory.
Stop

CriticalSpeedHandler:
TNT1 A 1
{
If(VelZ<=-63){A_ChangeVelocity(VelX,VelY,-60,CVF_RELATIVE|CVF_REPLACE);Return state("");}
Else{Return state("");}
}
Wait
}
}

ACTOR PowerFallingProtection : PowerProtection
{
//+INVENTORY.UNCLEARABLE
DamageFactor "Falling", 0.0
Powerup.Duration 0x7FFFFFFF
}
User avatar
4page
Posts: 120
Joined: Tue Aug 06, 2019 5:08 pm
Location: American Pacific Northwest

Re: Immunity to Hexen Fall damage

Post by 4page »

Ooof. That's a frustrating limitation. Thanks for the tips, though. I figured out a mild workaround that involved checking the distance between the player and the floor and if it was within the VelZ range, then adjusting the Velz to be slightly less than the distance between the player and the ground. Worked great until I found out that it didn't work on actors and you could still be instakilled by landing on top of them. Back to the drawing board, I guess.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Immunity to Hexen Fall damage

Post by Void Weaver »

Yeah, check for floorz are interferes here, so only VelZ check needed.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Immunity to Hexen Fall damage

Post by Blue Shadow »

4page wrote:However, Hexen has a weird thing about it that it doesn't matter what kind of damage protection you use, at least from what I've found, if you're falling fast enough and hit the floor, it insta kills you.
What happens here is that the game does one million points of damage (referred to as "telefrag damage") upon hitting the floor. It's treated specially, and is meant to guarantee a death. That's why your powerup had no effect in protecting you from the fall in that case.

Although it's not a perfect solution, since its effect is universal, you can set the [wiki=Actor_flags#LAXTELEFRAGDMG]LAXTELEFRAGDMG[/wiki] flag on the player. The flag will allow the powerup to function as normal and do its thing.


If compatibility with Zandronum isn't important, you should really consider using ZScript. Lack of knowledge or laziness are weak excuses for not using it, if you ask me.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Immunity to Hexen Fall damage

Post by Void Weaver »

Wow! That's make sense, thank you for that tip. :)
Anyway the overlay above work for this goal like as swiss watch and prevent from taking lethal damage.
User avatar
4page
Posts: 120
Joined: Tue Aug 06, 2019 5:08 pm
Location: American Pacific Northwest

Re: Immunity to Hexen Fall damage

Post by 4page »

If compatibility with Zandronum isn't important, you should really consider using ZScript. Lack of knowledge or laziness are weak excuses for not using it, if you ask me.
It's not important, but I started this mod with DECORATE and I want to finish it with DECORATE, or at least get it to a point where I don't know what else to do with it, then start learning zscript. I'll probably end up porting my mod to zscript as I learn and find better ways to do things. That's the plan at least.
Post Reply

Return to “Scripting”