Page 1 of 1

Destroy the child! But how? Parent dies->kill child, ho

PostPosted: Mon May 21, 2007 2:26 pm
by MrScience101
The situation: A bullet strikes the player and using the wonderful collision part of game editor the player actor is destroyed. However the gun actor which is a child of the player actor is still there.

How do I destroy the child actor when the parent actor is destroyed?

PostPosted: Mon May 21, 2007 2:33 pm
by Caaz Games
Instead Of Destroying The
Player Destroy The Gun, And On The Destroy Actor Of The Gun Put This
Code: Select all
DestroyActor("Parent Actor");

PostPosted: Mon May 21, 2007 3:37 pm
by d-soldier
Or if thats not practical, you could right click on the player, select NEW ACTIVATION EVENT, and have it sent on DESTROY ACTOR, to the GUN. And under the gun, set up the activation event from the player to destroy actor...

PostPosted: Tue May 22, 2007 11:26 am
by DilloDude
If you are only having one gun actor, just say to destroy the gun. If there are more than one, you can store a reference to the gun in the parent actor. Another option is to check on the gun's draw actor:
Code: Select all
if (parent.cloneindex >= 0)
{
    //do normal script
}
else
{
    DestroyActor("Event Actor");
}

This will destroy the actor whenever it is not parented to something. You can also use this to check the actor;s creator.