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

Non-platform specific questions.

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

Postby MrScience101 » Mon May 21, 2007 2:26 pm

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?
User avatar
MrScience101
 
Posts: 115
Joined: Tue Mar 20, 2007 9:52 pm
Score: 13 Give a positive score

Postby Caaz Games » Mon May 21, 2007 2:33 pm

Instead Of Destroying The
Player Destroy The Gun, And On The Destroy Actor Of The Gun Put This
Code: Select all
DestroyActor("Parent Actor");
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby d-soldier » Mon May 21, 2007 3:37 pm

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...
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby DilloDude » Tue May 22, 2007 11:26 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest