Reaper_Man, on 23 September 2022 - 05:41 PM, said:
Maybe there's context here I'm missing, but wouldn't a movesprite with a 0 clipmask - meaning it collides against no sprites or walls - solve this?
Yes, but movesprite moves the sprite. I assume he wants his sprite to move only using the fall command. Otherwise, yeah, if he wants to make the sprite fall by putting a positive value on the z velocity parameter in the movesprite command, then he could use that. He would still need to decode the hit sprite in the same way he needs to for getzrange though, so I don't think it is any easier.
Anyway, here is code that should work for getzrange:
gamevar tempvar 0 0
gamevar floorz 0 0
gamevar floorhit 0 0
getzrange sprite[].x sprite[].y sprite[].z sprite[].sectnum tempvar tempvar floorz floorhit 256 CLIPMASK0
sub floorz sprite[].z
ifl floorz 12288
ifge floorhit 49152
{
sub floorhit 49152
ife floorhit player[].i killit
}
I think that's all there is to it. You can use the same var to receive most of the data because the only ones you actually care about are <floorz> and <floorhit> returns. What that code does is check what the sprite would hit below it in a 256 build unit radius. If that thing is the player sprite and the base of the player sprite is < 12288 z units below the sprite doing the check, the sprite deletes itself.