Sorry, I won't debug your code. But I'll give you an example based on your code how such a simple selection algorithm could work:
 Code:
//////////////////////////////
// Ingame Unit Control
//////////////////////////////

string bmp_selected = "Selected.bmp";
entity* selectedUnit;

action Selection()
{
	me.tilt = 90;
	while ((!mouse_right) && (selectedUnit == you))
	{
		me.pan += time_step;
		wait(1);
	}
	ent_remove(me);
}

function highlight_me()
{
		if ((event_type == event_click) && (selectedUnit != me))
		{
				play_random_snd_hfx();
				selectedUnit = me;
				ent_create(bmp_selected,vector(my.x,my.y,my.z - 15),Selection);
		}
		if (event_type == event_touch)
		{
			my.ambient = 100; 
		}
		if (event_type == event_release)
		{
			my.ambient = 0;
		}
}

action my_unit
{
	my.enable_touch = on;
	my.enable_click = on;
	my.enable_release = on;
	my.event = highlight_me;
}

Storing entities in an array is quite simple. Define an array and write "arrayname[x] = me;" for example.

Last edited by Uhrwerk; 04/16/08 23:25. Reason: Kleiner Patzer im Code.

Always learn from history, to be sure you make the same mistakes again...