How to switch to dead state?

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
SamsonFranecki
Posts: 1
Joined: Fri Jan 19, 2024 3:49 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Contact:

How to switch to dead state?

Post by SamsonFranecki »

I'm trying to implement the use of A_SetPitch in the player death state for a specific effect where the camera tilts up as the player falls. While it partially achieves the desired result, I'm encountering an issue where the pre-defined movement abruptly snaps the camera back to its forward-facing position in an awkward manner. Is there a way to override or disable this movement? I attempted routing the death state into another state that sets the pitch, but that didn't resolve the problem either.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: How to switch to dead state?

Post by Jarewill »

You will have to override player's DeathThink function in ZScript for that, as it forces the player's pitch to zero no matter what. (Well, if you give the player the ICECORPSE flag then it won't affect the pitch, but that will not have desired behavior)
The function can be found in gzdoom.pk3:zscript/actors/player/player.zs at line 682.
You can mostly just copy that function and change the pitch changing code, it has a comment saying "Fall to ground (if not frozen)".
Post Reply

Return to “Scripting”