If that doesn't work, this definitely will. This is the type of method I prefer to use for cleaning up sub-functions because I know exactly what is going to happen.

Code:
#define Health    skill20

action my_action()
{
	my.Health = 100;
 	my_function();
	while (my.Health > 0)
	{
		...
                if(key_U)
		{
			my.Health = 0;
		}

		wait(1);
	}
	wait(1);  // this wait(1) gives time for all sub-functions to end before removing MY
        ent_remove(my);
} 

function my_function()
{
 	PANEL* pan = pan_create(...);
	while (my.Health > 0)
	{
		...
		wait(1);
	}
	pan_remove(pan);
}




The problem is that when you use ent_remove(my); it will also stop all functions that are currently running that MY pointer also, so it might quit function before ptr_remove() is reached.

Loco


Professional A8.30
Spoils of War - East Coast Games