Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,089 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
removing entity #298240
11/13/09 04:25
11/13/09 04:25
Joined: Apr 2009
Posts: 248
Philippines
seecah Offline OP
Member
seecah  Offline 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..

Code:
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 Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Code:
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 Offline OP
Member
seecah  Offline 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: seecah] #298277
11/13/09 13:55
11/13/09 13:55
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Hardly surprising, its undocumented... my area of expertise. grin


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: removing entity [Re: EvilSOB] #298279
11/13/09 14:10
11/13/09 14:10
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
parent is not undocumented wink

Re: removing entity [Re: Joey] #298288
11/13/09 15:14
11/13/09 15:14
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
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

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1