ok, so let me try to get this straight... The switch command switches the case according to the state of the entity... ? So in the enemy_act action case 1 is assigned to function state_wait. When the condition in function state_wait is fulfilled I need to change my.state to 2, so that case 2 is active? Is that right? Is this script better? (obviously not, because it still doesn't work...) frown
Code:
#define state skill1

var movement;
var allow_fire;
var p_angle;
ENTITY* enemy = "enemy.mdl";

function state_wait ()
{
	c_move (me, nullvector, nullvector, 0);
	c_scan (my.x,my.pan, vector (360,0,1000), SCAN_ENTS | IGNORE_ME);
	if (event_type ==EVENT_SCAN) my.state = 2;
}
function state_attack ()
{
	{
		c_move(me,vector(player.x,player.y,0), nullvector,GLIDE);
	}
}

action enemy_act ()
{
	enemy = my;
	my.state = 1;
	while (my)
	{
		switch (my.state)
		{
			case 1: state_wait(); break;
			case 2: state_attack(); break;
		}
		wait (1);
	}
}