"HUMAN_LIGHT_INF_REPAIR_WALL"
{
	INT my_unit_recno 
	INT enemy_recno

	INT is_getting_weapon
	INT dist_to_weapon_a
	INT dist_to_weapon_b
	INT camp_place_recno 

	my_unit_recno = FUNC("get_character_recno") 

	INT item_recno
	item_recno = FUNC("get_curr_task_para" , my_unit_recno, 1)

	is_getting_weapon = FUNC("is_getting_weapon", my_unit_recno)
	camp_place_recno = FUNC("search_place_by_name", "English Camp") 

	if ( is_getting_weapon )
	{
		// distance to weapon site a and site b
		dist_to_weapon_a = FUNC("get_distance", my_unit_recno, 23832, 6995, -90 )
		dist_to_weapon_b = FUNC("get_distance", my_unit_recno, 23487, 5543, -105 )

		// get weapon	
		if ( dist_to_weapon_a < 80 || dist_to_weapon_b < 80 )
		{
			ACTION("give_order" , my_unit_recno , "SPECIAL_MOVEMENT" , 20 , 0 , 5 , 0 , 1, 0, 10000)
			FUNC("set_getting_weapon_flag", my_unit_recno, 0)		
			FUNC("get_default_weapon" , my_unit_recno) 	
			FUNC("stop_curr_task" , my_unit_recno) 	
//			ACTION("give_task", my_unit_recno, "DEFEND_PLACE", 1, camp_place_recno, 0, 0, 0)
			exit
		}

		// run get weapon
		if ( dist_to_weapon_a < dist_to_weapon_b )
		{
			ACTION("give_order", my_unit_recno, "MOVE_TO_TARGET", 10, 0, 23832, 6995, -90, 0, 10000)	
		}
		else
		{
			ACTION("give_order", my_unit_recno, "MOVE_TO_TARGET", 10 , 0, 23487, 5543, -105, 0, 10000)
		}
		exit
	}	

	// attack enemy on road
	enemy_recno = FUNC("search_for_unit" , my_unit_recno , "E" , 500 , 0 , 0 , 90) 
	if ( enemy_recno )
	{
		// alert
		FUNC("set_scenario_bit_flag", 2, 1)
	}

	if ( enemy_recno || FUNC("get_scenario_bit_flag", 1) || FUNC("get_scenario_bit_flag", 2) )
	{
		FUNC("drop_item_on_floor" , my_unit_recno , item_recno , 0)

		// get weapon
		FUNC("set_getting_weapon_flag", my_unit_recno, 1)		

		// stop all current order first
		ACTION("stop_all_order", my_unit_recno) 


		// distance to weapon site a and site b
		dist_to_weapon_a = FUNC("get_distance", my_unit_recno, 23832, 6995, -90 )
		dist_to_weapon_b = FUNC("get_distance", my_unit_recno, 23487, 5543, -105 )

		// get weapon	
		if(dist_to_weapon_a < 80 || dist_to_weapon_b < 80)
		{
			ACTION("give_order" , my_unit_recno , "SPECIAL_MOVEMENT" , 20 , 0 , 5 , 0 , 1, 0, 10000)
			FUNC("set_getting_weapon_flag", my_unit_recno, 0)		
			FUNC("get_default_weapon" , my_unit_recno) 	
			FUNC("stop_curr_task" , my_unit_recno) 	
			exit
		}

		// run get weapon
		if ( dist_to_weapon_a < dist_to_weapon_b )
		{
			ACTION("give_order", my_unit_recno, "MOVE_TO_TARGET", 10, 0, 23832, 6995, -90, 0, 10000)	
		}
		else
		{
			ACTION("give_order", my_unit_recno, "MOVE_TO_TARGET", 10 , 0, 23487, 5543, -105, 0, 10000)
		}

		exit
	}

	if( enemy_recno == 0 ) // repair wall
	{
		//repair wall
		ACTION("give_order" , my_unit_recno , "SPECIAL_MOVEMENT" , 3 , 0 , 2 , 0 , 1 , 0, 40000)
	}

}
