Jump to content
  • 0

[ZScript] Unable to destroy child object


Rifleman

Question

Hi,

 

I am trying to make a new Ettin actor and mostly got everything working so far, even an aura effect:


CCC.gif.142515617e23b2ac36010c14913276d1.gif

Aura actor code:

Spoiler

Class RoyalAura : Actor
{
    Default
    {
    Scale 2.0;
    +NOINTERACTION;
    +FLATSPRITE;
    }
    States
    {
    Spawn:
        POFX LMNOPQ 3 Bright A_Warp(AAPTR_MASTER, 0, 0, 0, 0, WARPF_INTERPOLATE | WARPF_NOCHECKPOSITION);
        Loop;
    Death:
        TNT1 A -1;
        Stop;
    }
}

 

The Ettin spawn the aura and sets itself its master using this code:

Spawn:
ETMA A 0 NoDelay A_SpawnItemEx("RoyalAura", 0, 0, 0, 0, 0, 0, 0, SXF_SETMASTER);

When it dies, it calls this function:

Death:
ETMA IJ 4 A_KillChildren();

But the aura remains on the dead body. I tried to use pointers from the aura actor and override Tick() to check for when the master dies and then use A_Die() on itself and other things, but I can't figure it out. I attached the wad, in case you need to see the full code. Thanks in advance for any info!

 

EttinRoyal.zip

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 1

Hi,

 

I think A_Die and A_KillChildren only work on things that are +SHOOTABLE or +VULNERABLE.

I managed to make your aura removal work using:

A_RemoveChildren(true, RMVF_EVERYTHING);

 

Btw, the ettin keeps spawning more and more auras when it loops in Spawn/Idle state. I suggest putting the aura spawning to PostBeginPlay to ensure only single aura actor spawns from it.

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...