Quantcast
Channel: ZDoom
Viewing all articles
Browse latest Browse all 3391

Scripting • Re: Preferred Float Height

$
0
0
Could you show your current implementation?
Apologies - I never saw a notification that someone responded.

Heres the zscript

Code:

override void Tick(){    super.Tick();    if(bFloat)    {        double targetHeight = floorz + preferredFloatHeight;        if (pos.z < targetHeight - 8) // Allow for a small buffer to prevent jittering        {            vel.z += 2.0; // Move up        }        else if (pos.z > targetHeight + 8)        {            vel.z = -2.0; // Move down        }        else        {            vel.z = 0;        }    }}
This code works well until the monster encounters large steps. I want the monster to float up.

Couple of approaches I have thought about -
  • Trying to figure out the next polygon the monster is facing when they try to move
  • If the monster can't move, disable my float code with some sort of cooldown logic

Statistics: Posted by mirata — Wed Jan 15, 2025 12:47 am



Viewing all articles
Browse latest Browse all 3391

Trending Articles