Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
I have some actors that use the A_SpawnItemEx whenever they die to turn into another actor. For example I started using this for actor's freeze death so that I could do some custom stuff when they shatter or for an actor to resurrect themselves.
The problem I've just noticed is that whenever the actor is at height 72 in a sector with the height of 96. Whenever the actor goes into A_SpawnItemEx, they disappear. So I did a little test and reduced the height of the actor that was spawned from 72 to 56 and it solved the problem. Then I was thinking what's going to happen when the actor is in a sector where the height is as low as 56 or 64 so I need a different solution. I was thinking maybe somehow giving the actor that is spawned a flag where it's like a ghost and can go through ceilings and then change the flag back as soon as it's on it's feet.
Also I've been doing research and I think if I have it set with noblocking flag this would work, but is there a way to clear that flag after?
actor Succubus2
{
Game Doom
obituary "%o destroyed by the Succubus."
Health 120
Radius 20
Height 72
Speed 7
Mass 100
PainChance 160
Species Charm
SEESOUND "succubus/sight"
painsound "succubus/pain"
deathsound "succubus/death"
MONSTER
+FLOORCLIP
states
{
Spawn:
C0XX A 0 A_SetInvulnerable
C0XX A 7 A_ClearTarget
C0XX A 0 A_UnSetInvulnerable
Idle:
SUCC AB 10 A_Look
goto Idle
See:
SUCC A 3 A_UnSetInvulnerable
SUCC ABBCCDDEEFF 3 A_Chase
loop
If you don't need the spawned actor to be in a valid position, you could use "SXF_NOCHECKPOSITION" in [wiki]A_SpawnItemEx[/wiki]. If it still dies, disappears or fails to spawn without fulfilling its purpose you can give the spawned actor +NOINTERACTION (no regular physics apply, if the actor has a speed it moves straight ahead every tic) or possibly +NOCLIP (might help on height checks, might not; makes actor go through stuff). Does any of that work for you?
So, you spawn a 72-unit tall actor in a sector 96 units tall. 96 - 72 = 24. You spawn it at a Z height of 28 units, which is 4 units too high for the actor to successfully spawn. Making the spawned actor 56 units tall gives you a 40 unit leeway.
So you can either:
Reduce the spawned actor's height by a few units.
Spawn it a few units lower.
Spawn it at 0 and use sprite offsets to line it up how you need it. (The less desirable option, as it results in screwy hitboxes.)
FDARI wrote:If you don't need the spawned actor to be in a valid position, you could use "SXF_NOCHECKPOSITION" in [wiki]A_SpawnItemEx[/wiki]. If it still dies, disappears or fails to spawn without fulfilling its purpose you can give the spawned actor +NOINTERACTION (no regular physics apply, if the actor has a speed it moves straight ahead every tic) or possibly +NOCLIP (might help on height checks, might not; makes actor go through stuff). Does any of that work for you?
SXF_NOCHECKPOSITION worked like a charm. I even tested it to see if it would work if the ceiling was so low that the enemy was stuck like 48 height and it still worked. I was thinking the noclip flag would work but that didn't do it. Thanks a bunch!