"RETREAT"
{
	INT my_unit_recno 
	my_unit_recno = FUNC("get_character_recno") 

	INT place_recno 
	INT task_end_time

	place_recno = FUNC("get_curr_task_para" , my_unit_recno, 1)
	task_end_time = FUNC("get_curr_task_para", my_unit_recno, 3)
	

	// go back to parking pos
	ACTION("give_order" , my_unit_recno, "APPROACH_PLACE" , 99 , 1 , place_recno , 0 , 0 , 0, 30000)

	if( FUNC("is_unit_inside_place", place_recno, my_unit_recno) == 1 ) // the unit is inside the place already
	{
		// set dead
		FUNC("set_unit_dead", my_unit_recno) 
		FUNC("set_idle", my_unit_recno) 
		FUNC("stop_curr_task" , my_unit_recno) 	
		ACTION("give_task", my_unit_recno, "IDLE", 99, 0, 0, 0, 0)
		//FUNC("set_unit_retreat", my_unit_recno, 0)
		exit
	}

	if( task_end_time <= 0 )
	{
		// set dead
		FUNC("set_unit_dead", my_unit_recno) 
		FUNC("set_idle", my_unit_recno) 
		FUNC("stop_curr_task" , my_unit_recno) 	
		ACTION("give_task", my_unit_recno, "IDLE", 99, 0, 0, 0, 0)
		//FUNC("set_unit_retreat", my_unit_recno, 0)
		exit
	}
	
}
   


