|
removing entity
#298240
11/13/09 04:25
11/13/09 04:25
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
Hello Guys, I need your ideas to help me solve my problem. I have an entity action that is making another entity inside..
void act_shellpearl()
{
you = ent_create("pearl28.dds", vector(my.x, my.y, my.z + 2), NULL);
you.tilt = 90;
you.ambient = 100;
you.scale_x = 0.8;
you.scale_y = you.scale_x;
set(you, PASSABLE | INVISIBLE);
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_SCAN | ENABLE_DETECT);
my.event = shellpearl_event;
while(1)
{
//action of the my entity..
// I have to toggle here the visibility of the you entity
}
ent_remove(me);
}
Indeed, you entity is a Pearl while my entity is a Shell.. I can't use a single global ENTITY* declaration since I'll be making variable number of Shell entities with action "act_shellpearl" Now my problem is how to remove the you entity (Pearl) inside the "shellpearl_event" function.. during that event, the Shell will be removed and so as the Pearl must be.. but I can't use you pointer to remove the Pearl entity since it's already on another function.. Please advise.. Thanks, Sedrix
Can't is not an option™
|
|
|
Re: removing entity
[Re: seecah]
#298248
11/13/09 06:20
11/13/09 06:20
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
void act_shellpearl()
{
you = ent_create("pearl28.dds", vector(my.x, my.y, my.z + 2), NULL);
you.tilt = 90;
you.ambient = 100;
you.scale_x = 0.8;
you.scale_y = you.scale_x;
set(you, PASSABLE | INVISIBLE);
//
you.parent = me;
//
my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY | ENABLE_SCAN | ENABLE_DETECT);
my.event = shellpearl_event;
while(1)
{
//action of the my entity..
// I have to toggle here the visibility of the you entity
}
ent_remove(me);
}
and in the pearls action, put something like if(my.parent==NULL) ent_remove(me)
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: removing entity
[Re: EvilSOB]
#298258
11/13/09 09:13
11/13/09 09:13
|
Joined: Apr 2009
Posts: 248 Philippines
seecah
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 248
Philippines
|
thanks EvilSOB, this is really what I needed.. waaaaaaaahhh.. I never know there is this parent pointer..
Super thank you!!!
Can't is not an option™
|
|
|
Re: removing entity
[Re: Joey]
#298288
11/13/09 15:14
11/13/09 15:14
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
OK Joey, after a bit of a dig through the manual, I stand corrected.
I'll call it "almost" undocumented then....
I just that Ive never come across it in the manual in nearly 2 years.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
|