Page 1 of 1

Parent Child Relationships

PostPosted: Thu Aug 19, 2004 9:13 am
by jazz_e_bob
I have an enemy ship.

When the enemy ship is created it creates two child actors (guns).

You can shoot the guns leaving only the ship.

I want it so that when the last gun is destroyed the ship is destroyed.

How can an actor know if all of its children are dead?

PostPosted: Thu Aug 19, 2004 1:18 pm
by makslane
Use Activation Events.

When a gun was destroyed, send a Activation Event to the parent.
On parent actor, set the event from Activation Event from "All Actors"

So, when all connected actors are destroyed, the parent can be destroyed.

To work, your childs must be created as clones into editor, not in a CreateActor call.

PostPosted: Thu Aug 19, 2004 7:50 pm
by jazz_e_bob
OK. Thanks. :)

Suggestion: :idea:

This is where I think a "parent" property might be handy.

On Destroy Gun
parent.guns -= 1;

Image

PostPosted: Tue Aug 24, 2004 7:42 am
by jazz_e_bob
"parent" and "creator" properties.

It would make it faster to program complex actors.

I can just create a Destroyer and know that Destroyers will create it's own turrets.

I can now clone as many destroyers as I want and not have to worry about putting turrets on each one.

Nag Nag Nag I'm such a pushy bastard! :wink:

GE RULES

PostPosted: Wed Aug 25, 2004 9:27 am
by jazz_e_bob
Add to typedef struct stActorVars

char name[PARENT_NAME]; //Parent name - returns 0 if no parent
char name[CREATOR_NAME]; //Creator name - returns 0 if created at startup

ENHANCED ACTOR INTERCONNECTIVITY! 8)

( Using Activation Events means that you have to build new actors everytime you build a new version of the same enemy. This is VERY time consuming. )

What do you think? :)

PostPosted: Thu Aug 26, 2004 1:17 pm
by makslane
I think creator and parent actors will be nice :)