[SOLVED]FallAndSink question[zscript]

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
Laskow
Posts: 100
Joined: Tue Feb 16, 2021 7:35 am
Preferred Pronouns: He/Him

[SOLVED]FallAndSink question[zscript]

Post by Laskow »

Hello. I'm facing a strange phenomenon related to FallandSink. The goal is making a non-monster actor that can be damaged and float on the water.

This code works for all monster actors as well, so I thought it also works for frozen actors, then it didn't work like monsters.

It's strange that the frozen actor keeps height and floats on the water when it's far from the player, but when the player closes to the frozen actor, suddenly it starts bobbing. I have no idea why its behavior changes by the player's position from the actor.
Probably the float bob isn't the reason for this problem. If the cause is FLOATBOB or FloatBobStrength, then it must bob continually.

I've never seen overridden FallandSink code as far as I know, so any help or hint appreciated!


[EDIT] Aha... I found the bobbing speed is affected by FloatSpeed's value. Still don't know why the frozen actor bobs only when the player closes to it. Not sure though, the frozen actor starts bobbing within approximately 100 units of the center of the frozen actor.
Last edited by Laskow on Fri Dec 13, 2024 5:57 am, edited 2 times in total.
Laskow
Posts: 100
Joined: Tue Feb 16, 2021 7:35 am
Preferred Pronouns: He/Him

Re: FallAndSink question[zscript]

Post by Laskow »

Agh, another hard-coded underwater physics... The cause is this code in p_mobj.cpp.

https://github.com/ZDoom/gzdoom/blob/ma ... .cpp#L2401
Last edited by Laskow on Fri Dec 13, 2024 5:57 am, edited 1 time in total.
User avatar
Nash
 
 
Posts: 17503
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: [SOLVED]FallAndSink question[zscript]

Post by Nash »

That's some very oddly-specific hardcoded behavior. I wonder why was that added...
Professor Hastig
Posts: 256
Joined: Mon Jan 09, 2023 2:02 am
Graphics Processor: nVidia (Modern GZDoom)

Re: [SOLVED]FallAndSink question[zscript]

Post by Professor Hastig »

That fragment is the original implementation for the MF_FLOAT flag, but it looks like it never got any handling added for dealing with the case where a dead item is suspended in mid-air/water and no gravity being applied.
Post Reply

Return to “Scripting”