question on removing entity

Posted By: boyax

question on removing entity - 06/02/09 12:56

Hi,

I'm putting many obstacle objects in my game to collect points.
Once the player collides with the obstacle object it will appear some particle effects, then, remove/hide the obstacle object. The obstacle objects have only a single action implemented.

Code:
function HandleEventImpact()
{
	if (event_type == EVENT_IMPACT)
	{		
		ptr_remove(entWaterBottle);
	}
}

action actWaterBottles()
{
	entWaterBottle = my;
	my.emask |= ENABLE_IMPACT;
	my.event = HandleEventImpact;
}


Any idea how i could remove the single entity object?

Thanks
Posted By: Helghast

Re: question on removing entity - 06/02/09 13:43

Code:
function HandleEventImpact()
{
	if (event_type == EVENT_IMPACT)
	{		
		my.skill1 = 1;
	}
}

action actWaterBottles()
{
	my.emask |= ENABLE_IMPACT;
	my.event = HandleEventImpact;

	while(my.skill1 == 0) { wait(1); }
	ptr_remove(my);
}


there, that should work.

regards,
Posted By: boyax

Re: question on removing entity - 06/02/09 14:30

Thanks for the reply Helghast. smile

I've try your suggestion but not working.. it remove all the obstacle objects even the player doesn't collide. By the way, just a side-note question, I've already assigned the "my" pointer to player. Would it not get conflict re-assigning the "my" pointer to the obstacle object...? Because as you see in the action code for the obstacle object (actWaterBottles) i'm still using the "my" pointer.. confused

Back to my problem... As i've observed, when you add model/object to WED (just the same object you've added for obstacle), WED would name it like XXXX_mdl_0, XXX_mdl_1, etc. (XXX=any file name) but this all objects are pointing to one action in which I enable the EVENT_IMPACT, so, when the player collides with the obstacle object I just remove the specific obstacle object (XXX_mdl_0, XXX_mdl_1, etc.) but i don't know how to remove it one by one for a specific obstacle object?
Using ptr_remove() and ent_remove() will remove all obstacle obect...

One solution approach I can think of, is to separate the obstacle object action but the action code would function the same.. but this isn't a generic solution approach..

Any idea how I could treat it?

Thanks

Posted By: Cowabanga

Re: question on removing entity - 06/02/09 14:42

Instead of using EVENT_IMPACT, use vec_dist. smile
Posted By: boyax

Re: question on removing entity - 06/02/09 15:50

Why? I think EVENT_IMPACT is working... the only problem I have is how to remove or hide a single obstacle object/entity.

Anyone could advise me. I try to seach in AUM seems can't find any related topic I encountered...so, darn me.. crazy

Thanks
Posted By: vlau

Re: question on removing entity - 06/03/09 09:16

entWaterBottle is a global entity pointer, every
obstacle pointed by this pointer will be removed.

Try ptr_remove(my) or ent_remove(my).
© 2024 lite-C Forums