Well at the moment i have this.
I tryed to make it move with the selection circle.
And it works now.
Also the first version was bugged when i clicked right en then left again it didnt select the unit now it does.

Owyeah and this doesn't work "ENTITY* selectedUnit[30];" it gives an error cause the [30] behind it \:\(


here is the code.

 Code:
//////////////////////////////
// Ingame Unit Control
//////////////////////////////
var Building_Powerplant;
var Building_Powerplant_X = 0;
var Powerplant_time = 10;
var own_unit;
var secondtry;
var dontmove;
string bmp_selected = "Selected.bmp";
ENTITY* selectedUnit;



action Selection()
{
	me.tilt = 90;
	while ((!mouse_right) && (selectedUnit == you))
	{
		my.x = you.x;
		my.y = you.y;
		my.z = you.z-15;
		me.pan += time_step;
		wait(1);
	}
	selectedUnit = null;
	ent_remove(me);
}


function highlight_me()
{
		if ((event_type == event_click) && (selectedUnit != me))
		{
				play_random_snd_hfx();

				selectedUnit = null;
				wait(1);
				selectedUnit = me;
				wait(1);
				ent_create(bmp_selected,vector(my.x,my.y,my.z - 15),Selection);
		}
		if (event_type == event_touch)
		{
			dontmove = 1;
			my.ambient = 100; 
		}
		if (event_type == event_release)
		{
			dontmove = 0;
			my.ambient = 0;
		}
}


action my_unit

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

function move_unit()
{
	
	if ((selectedUnit) && (dontmove == 0))
	{
	selectedUnit.x += 15;
	}
}

on_mouse_left = move_unit;
//////////////////////////////
// End
//////////////////////////////


Last edited by SurudoiRyu; 04/19/08 16:51.

-The Dragon's Eye is alway's watching you!-