Jump to content
  • 0

Death states that spawn actors don't spawn actors (properly)


Question

This fancy version of the Zombieman gets a special death animation when he is shot by a machine gun, and spins in random directions every time he gets hit.

 

This is supposed to spawn a seperate actor that handles the death animation.

 

But when A_SpawnItemEx is called, the actor doesn't appear and the zombieman simply vanishes.

 

(I tried TNT1 A 0 A_SpawnItemEx("MGunnedClassicZombieman", 0, 0, 20) and the actor actually spawned but higher than the zombieman's regular height, implying the actor was spawned in the floor.)

 

How do I spawn the actor without making it spawn in several units above the expected height? Much help would be appreciated

actor ClassicZombieman : Zombieman
{
tag "Rifle Zombieman"
radius 14
height 50
bloodtype "HBlood"
dropitem "M16Spawner"
States
{
Missile:
    POSS E 10 A_FaceTarget
    POSS F 0 bright A_SpawnProjectile("BulletCasing", 24, 0, -60, CMF_AIMDIRECTION)
    POSS F 3 bright A_CustomBulletAttack(22.5, 0, 1, random(1,5)*3, "ViolentPuff", 0, CBAF_NORANDOM)
    POSS E 13
    goto See
Death.MachineGun:
    POSS G 1 A_Scream
    TNT1 A 0 A_SpawnItemEx("MGunnedClassicZombieman")
    stop
XDeath:
    POSS M 1 A_SpawnItemEx("HBloodController")
    POSS M 4 A_SpawnItemEx("HGoreController")
    POSS N 5 A_XScream
    POSS O 5 A_NoBlocking
    POSS PQRST 5
    POSS U -1
    Stop
}
}



actor MGunnedClassicZombieman : ClassicZombieman
{
painchance 256
damagefactor "MachineGun", 0.05
States
{
Spawn:
    POSS G 3 NoDelay A_Pain
    POSS G 10
    POSS H 1 A_Die
See:
    stop
Missile:
    stop
Pain:
    POSS G 3 A_SetAngle(random(-180,180))
    goto Spawn
}
}

 

Edited by watermelon eater gaming

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0

According the ZDoom wiki about A_SpawnItemEx:

Quote

The function does not spawn monster-based actors if the calling actor was massacred.

Share this post


Link to post
  • 0

I don't think that's the explanation here, since massacre is as special damage type used by cheats, and if that special damage type was used then it wouldn't go to the "Death.MachineGun" state in the first place, since that one is for the MachineGun damage type.

 

I would suspect instead that you need to use the SXF_NOCHECKPOSITION flag to make sure the actor even if it overlaps the spawning actor. That's the problem with attempting to spawn a separate actor, there's a collision check that happens to make sure there's room for it, and since you're putting it right at the position of the dying actor then it fails. That's why it works when you try spawning it with a Z offset of 20.

 

Alternatively, you could tackle that same issue by calling A_NoBlocking before calling A_SpawnItemEx. If you don't want drops to happen, you can use A_NoBlocking(false) to disable them.

Share this post


Link to post
  • 0

Far as I can tell, a new actor with its own hitbox is trying to spawn in while the previous one's hitbox still exists. In which case, your machinegun death state just needs to remove that collision before attempting the spawn.


So, try this:

Death.MachineGun:
	POSS G 1 A_Scream
	POSS G 0 A_NoBlocking
	TNT1 A 0 A_SpawnItemEx("MGunnedClassicZombieman")
	stop

 

Edited by Perfect Bear

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...