Page 1 of 1

if actor is parent

PostPosted: Thu Jan 24, 2008 7:43 pm
by mrgame
i need a way to do this.
eg
if (actor1 is child of actor2)
{
ect ect ect
}
any ideas?

little more info.
i need it so if say the engine is attached to the car the car can move. if the engine isnt attached it wont move. but i need to be able to dublicate engine and car and if i attach the engine to 1 car only that car will move. or if i attach to both they both will move.
THEY ATTACH by if they touch each other the engine becomes a child of the car
then if i click on the engine it become not an child and falls of.

Re: if actor is parent

PostPosted: Thu Jan 24, 2008 8:09 pm
by Kalladdolf
I think there's no way around using variables =(
so basically when you drag the engine to the car 1:
Code: Select all
car1.attach = 1;
//change parent

and then when you wanna drive (this goes for car):
Code: Select all
if(attatch == 1)
{//drive;}

then when you remove the engine:
Code: Select all
car1.attatch = 0;
//change parent


note that attach is an actor vaiable, because you wanna do it with other cars as well, right? =D

ok, try this code, I've wrote it in a hurry, hope it works.
=D

Re: if actor is parent

PostPosted: Sun Jan 27, 2008 7:33 am
by Bee-Ant
Code: Select all
if(parent==1)
{
    //change parent to any actor
    parentevent=1;
}
if(parent==0)
{
    //change parent to none
    parentevent=0;
}
if(parentevent==1)
{
    //event while parented
}
if(parentevent==0)
{
    //event while not parented
}