"S5L1_tactic2.sce"
{
	//unit
	INT joan_recno 
	INT alencon_recno
	INT la_hire_recno
	INT jean_recno

	INT talk_unit_recno

	INT citizen_recno

	// ai unit
	INT boss_ten_three_recno
	INT boss_ten_four_recno
	INT boss_ten_five_recno
	INT boss_ten_six_recno

	INT team_one_two_zero_leader
	INT team_one_two_one_leader
	INT team_one_two_two_leader
	INT team_one_two_three_leader
	INT team_one_five_seven_leader

	INT team_nine_zero_zero_leader

	INT meung_weapon_seller_recno 
	INT meung_potion_seller_recno

	// place
	INT town_loches_recno
	INT castle_meung_recno
	INT settlement_bourges_recno

	// Spawn
	INT spawn_h_eight
	INT spawn_h_nine
	INT spawn_h_ten
	INT spawn_h_ten_three
	INT spawn_h_ten_four
	INT spawn_h_ten_five
	INT spawn_h_ten_six

	// facility
	INT facility_h_eight_recno_a
	INT facility_h_eight_recno_b
	INT facility_h_eight_recno_c
	INT facility_h_eight_recno_d
	INT facility_h_eight_recno_e
	INT facility_h_eight_recno_f

	INT facility_h_nine_recno_a
	INT facility_h_nine_recno_b
	INT facility_h_nine_recno_c
	INT facility_h_nine_recno_d
	INT facility_h_nine_recno_e
	INT facility_h_nine_recno_f

	INT facility_h_ten_recno
	INT facility_h_ten_three_recno
	INT facility_h_ten_four_recno
	INT facility_h_ten_four_recno_two
	
	INT facility_h_ten_five_recno_a
	INT facility_h_ten_five_recno_b
	INT facility_h_ten_five_recno_c
	INT facility_h_ten_five_recno_d
	INT facility_h_ten_five_recno_e

	INT facility_h_ten_six_recno_a
	INT facility_h_ten_six_recno_b
	INT facility_h_ten_six_recno_c
	INT facility_h_ten_six_recno_d
	INT facility_h_ten_six_recno_e
	INT facility_h_ten_six_recno_f
	INT facility_h_ten_six_recno_g
	INT facility_h_ten_six_recno_h
	INT facility_h_ten_six_recno_i
	INT facility_h_ten_six_recno_j
	INT facility_h_ten_six_recno_k

	INT facility_s_two_one
	INT facility_s_two_two
	INT facility_s_two_three

	INT meung_weapon_shop_recno
	INT meung_potion_shop_recno

	// event
	INT	two_event_zero_place_recno
	INT	two_event_one_place_recno
	INT	two_event_two_one_place_recno
	INT two_event_two_two_place_recno
	INT	two_event_three_place_recno
	INT	two_event_four_place_recno
	
	INT	two_event_six_place_recno
	INT	two_event_seven_place_recno
	INT	two_event_eight_place_recno

	INT arrive_orlean_one_recno
	INT arrive_orlean_two_recno
	
	
	// event item
	INT two_event_nine_item_recno
	
	// unit id
	INT ehinfcap_id
	INT ehinfant_id
	INT elinfcap_id
	INT elinfant_id
	INT ecrosscap_id
	INT ecrossbow_id
	INT epolecap_id
	INT epoleman_id
	INT earchcap_id
	INT earcher_id

	INT eexarcherc_id
	INT eexarcher_id

	INT citizen_one_id
	INT citizen_two_id


	// item
	
	// unit in place
	INT joan_in_place_recno
	INT alencon_in_place_recno

	INT num_of_enemy

	init 
	{
		// get unit recno
		joan_recno = FUNC("get_main_character") 		
		alencon_recno = FUNC("search_unit_by_code" , "Alencon") 
		la_hire_recno = FUNC("search_unit_by_code" , "LaHire") 
		jean_recno = FUNC("search_unit_by_code" , "Jean_de_metz") 

		team_one_two_zero_leader = FUNC("get_unit_team_leader_by_team_id", 120)
		team_one_two_one_leader = FUNC("get_unit_team_leader_by_team_id", 121)
		team_one_two_two_leader = FUNC("get_unit_team_leader_by_team_id", 122)
		team_one_two_three_leader = FUNC("get_unit_team_leader_by_team_id", 123)

		team_one_five_seven_leader = FUNC("get_unit_team_leader_by_team_id", 157)

		ACTION("give_task", team_one_two_zero_leader, "TOWER_ATTACK", 1, 3000, 0, 0, 0)
		ACTION("give_task", team_one_two_one_leader, "TOWER_ATTACK", 1, 3000, 0, 0, 0)
		ACTION("give_task", team_one_two_two_leader, "TOWER_ATTACK", 1, 3000, 0, 0, 0)
		ACTION("give_task", team_one_two_three_leader, "TOWER_ATTACK", 1, 3000, 0, 0, 0)

		meung_weapon_seller_recno = FUNC("search_unit_by_name", "MeungWeaponShopkeeper")
		FUNC("set_can_interact_flag", meung_weapon_seller_recno, 0)
		ACTION("give_task", meung_weapon_seller_recno, "IDLE", 1, 0, 0, 0, 0) 

		meung_potion_seller_recno = FUNC("search_unit_by_name", "MeungPotionShopkeeper")
		FUNC("set_can_interact_flag", meung_potion_seller_recno, 0)
		ACTION("give_task", meung_potion_seller_recno, "IDLE", 1, 0, 0, 0, 0) 

		// get place recno
		town_loches_recno = FUNC("search_place_by_name", "Town_Loches")
		castle_meung_recno = FUNC("search_place_by_name", "Castle_Meung")
		settlement_bourges_recno = FUNC("search_place_by_name", "Settlement_Bourges")

		// Spawn
		spawn_h_eight = FUNC("search_place_by_name", "Spawn_H8")
		spawn_h_nine = FUNC("search_place_by_name", "Spawn_H9")
		spawn_h_ten = FUNC("search_place_by_name", "Spawn_H10")
		spawn_h_ten_three = FUNC("search_place_by_name", "Spawn_H13")
		spawn_h_ten_four = FUNC("search_place_by_name", "Spawn_H14")
		spawn_h_ten_five = FUNC("search_place_by_name", "Spawn_H15")
		spawn_h_ten_six = FUNC("search_place_by_name", "Spawn_H16")

		// get facility recno
		facility_h_eight_recno_a = FUNC("search_facility_by_name", "Facility_H8a")
		facility_h_eight_recno_b = FUNC("search_facility_by_name", "Facility_H8b")
		facility_h_eight_recno_c = FUNC("search_facility_by_name", "Facility_H8c")
		facility_h_eight_recno_d = FUNC("search_facility_by_name", "Facility_H8d")
		facility_h_eight_recno_e = FUNC("search_facility_by_name", "Facility_H8e")
		facility_h_eight_recno_f = FUNC("search_facility_by_name", "Facility_H8f")

		facility_h_nine_recno_a = FUNC("search_facility_by_name", "Facility_H9a")
		facility_h_nine_recno_b = FUNC("search_facility_by_name", "Facility_H9b")
		facility_h_nine_recno_c = FUNC("search_facility_by_name", "Facility_H9c")
		facility_h_nine_recno_d = FUNC("search_facility_by_name", "Facility_H9d")
		facility_h_nine_recno_e = FUNC("search_facility_by_name", "Facility_H9e")
		facility_h_nine_recno_f = FUNC("search_facility_by_name", "Facility_H9f")

		facility_h_ten_recno = FUNC("search_facility_by_name", "Facility_H10")
		facility_h_ten_three_recno = FUNC("search_facility_by_name", "Facility_H13")
		facility_h_ten_four_recno = FUNC("search_facility_by_name", "Facility_H14")
		facility_h_ten_four_recno_two = FUNC("search_facility_by_name", "Facility_H14_2")

		facility_h_ten_five_recno_a = FUNC("search_facility_by_name", "Facility_H15a")
		facility_h_ten_five_recno_b = FUNC("search_facility_by_name", "Facility_H15b")
		facility_h_ten_five_recno_c = FUNC("search_facility_by_name", "Facility_H15c")
		facility_h_ten_five_recno_d = FUNC("search_facility_by_name", "Facility_H15d")
		facility_h_ten_five_recno_e = FUNC("search_facility_by_name", "Facility_H15e")

		facility_h_ten_six_recno_a = FUNC("search_facility_by_name", "Facility_H16a")
		facility_h_ten_six_recno_b = FUNC("search_facility_by_name", "Facility_H16b")
		facility_h_ten_six_recno_c = FUNC("search_facility_by_name", "Facility_H16c")
		facility_h_ten_six_recno_d = FUNC("search_facility_by_name", "Facility_H16d")
		facility_h_ten_six_recno_e = FUNC("search_facility_by_name", "Facility_H16e")
		facility_h_ten_six_recno_f = FUNC("search_facility_by_name", "Facility_H16f")
		facility_h_ten_six_recno_g = FUNC("search_facility_by_name", "Facility_H16g")
		facility_h_ten_six_recno_h = FUNC("search_facility_by_name", "Facility_H16h")
		facility_h_ten_six_recno_i = FUNC("search_facility_by_name", "Facility_H16i")
		facility_h_ten_six_recno_j = FUNC("search_facility_by_name", "Facility_H16j")
		facility_h_ten_six_recno_k = FUNC("search_facility_by_name", "Facility_H16k")

		facility_s_two_one = FUNC("search_facility_by_name", "Facility_S2_1")
		facility_s_two_two = FUNC("search_facility_by_name", "Facility_S2_2")
		facility_s_two_three = FUNC("search_facility_by_name", "Facility_S2_3")

		meung_weapon_shop_recno = FUNC("search_facility_by_name" , "MeungWeaponShop") 
		meung_potion_shop_recno = FUNC("search_facility_by_name" , "MeungPotionShop") 

		// get event place recno
		two_event_zero_place_recno = FUNC("search_place_by_name", "Event_2_0")
		two_event_one_place_recno = FUNC("search_place_by_name", "Event_2_1")
		two_event_two_one_place_recno = FUNC("search_place_by_name", "Event_2_2_1")
		two_event_two_two_place_recno = FUNC("search_place_by_name", "Event_2_2_2")
		two_event_three_place_recno = FUNC("search_place_by_name", "Event_2_3")
		two_event_four_place_recno = FUNC("search_place_by_name", "Event_2_4")
		
		two_event_six_place_recno = FUNC("search_place_by_name", "Event_2_6")
		two_event_seven_place_recno = FUNC("search_place_by_name", "Event_2_7")
		two_event_eight_place_recno = FUNC("search_place_by_name", "Event_2_8")

		arrive_orlean_one_recno = FUNC("search_place_by_name", "arriveOrlean1")
		arrive_orlean_two_recno = FUNC("search_place_by_name", "arriveOrlean2")

		// get unit id
		ehinfant_id = FUNC("unit_code_to_id", "ENGLISH_HEAVY_INFANTRY") 
		ehinfcap_id = FUNC("unit_code_to_id", "ENGLISH_HEAVY_INFANTRY_CAPTAIN")
		elinfant_id = FUNC("unit_code_to_id", "ENGLISH_LIGHT_INFANTRY") 
		elinfcap_id = FUNC("unit_code_to_id", "ENGLISH_LIGHT_INFANTRY_CAPTAIN")
		ecrosscap_id = FUNC("unit_code_to_id", "FRENCH_CROSSBOW_MAN_CAPTION")
		ecrossbow_id = FUNC("unit_code_to_id", "FRENCH_CROSSBOW_MAN")
		epolecap_id = FUNC("unit_code_to_id", "ENGLISH_POLEMAN_CAPT")
		epoleman_id = FUNC("unit_code_to_id", "ENGLISH_POLEMAN")
		earchcap_id = FUNC("unit_code_to_id", "ENGLISH_ARCHER_CAPTAIN")
		earcher_id = FUNC("unit_code_to_id", "ENGLISH_ARCHER")

		eexarcher_id = FUNC("unit_code_to_id", "ENGLISH_EX_ARCHER")
		eexarcherc_id = FUNC("unit_code_to_id", "ENGLISH_EX_ARCHER_CAPTAIN")

		citizen_one_id = FUNC("unit_code_to_id", "CITIZEN_01")
		citizen_two_id = FUNC("unit_code_to_id", "CITIZEN_02A")

		// get item recno


		// get init task for unit
		FUNC("set_can_interact_flag", team_one_five_seven_leader, 1)
		ACTION("give_task", team_one_five_seven_leader, "IDLE", 1, 0, 0, 0, 0)
	} 



		// citizen
		if(	citizen_recno > 0 && FUNC( "get_can_interact_flag" , citizen_recno) && ( talk_unit_recno == citizen_recno ) )
		{
			FUNC("set_cut_scene_flag" , 1)					// enter cut scene! 
			
			// set main character to idle
			FUNC("set_idle", joan_recno) 
			FUNC("set_unit_can_process_in_cut_scene", 0, 0)	// all unit can't process
			FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	// joan can process

			// set weapon seller to idle and rotate him
			ACTION("stop_all_order", citizen_recno ) 
			ACTION("give_order" , citizen_recno, "TURN" , 3 , 0 , FUNC("get_rotation" , citizen_recno, joan_recno) , 0 , 0 , 0, 2500)

			WAIT { DIALOG("add_dialog", citizen_recno, "[0001N]Words cannot express our gratitude - you came just in time to vanquish our tyrannical captors! Our unwavering faith in cross and church has finally met its purpose. Now, may the cross grace your paths and exploits wherever you go!") }

			INT itemId

			itemId = FUNC("item_code_to_id", "JOAN_SWORD_LV10B")

			FUNC("remove_item_from_unit_inventory", itemId, joan_recno)
			FUNC("give_item_to_unit", "JOAN_SWORD_LV10B", 1, 1, joan_recno)

			// leave cut scene
			DIALOG("del_all_dialog") 
			FUNC("set_cut_scene_flag" , 2)	// stop cut scene! 
			FUNC("set_cut_scene_flag" , 0)	// stop cut scene! 
			FUNC("set_unit_can_process_in_cut_scene", 0, 1)	
					
			FUNC("set_can_interact_flag", citizen_recno, 0)		
			FUNC("stop_curr_task" , citizen_recno )
		}



		talk_unit_recno = FUNC("get_interact_unit_recno", joan_recno) 

		// weapon shop
		if( ( meung_weapon_seller_recno > 0 ) && ( talk_unit_recno == meung_weapon_seller_recno ) )	// talking with Weapon shop keeper~~~~~ 
		{
			if( FUNC("get_interact_stage", meung_weapon_seller_recno) == 0)
			{
				FUNC("set_cut_scene_flag" , 2)	// enter cut scene! 
//				FUNC("set_unit_can_process_in_cut_scene", 0, 1)	// all unit can process
				FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	
				FUNC("set_unit_can_process_in_cut_scene", talk_unit_recno, 1)	

				// set main character to idle
				FUNC("set_idle", joan_recno) 

				// set weapon seller to idle and rotate him
				ACTION("stop_all_order", meung_weapon_seller_recno ) 
				ACTION("give_order" , meung_weapon_seller_recno, "TURN" , 3 , 0 , FUNC("get_rotation" , meung_weapon_seller_recno , joan_recno) , 0 , 0 , 0, 2500)

				WAIT { DIALOG("add_dialog", meung_weapon_seller_recno, "[0002N]Welcome to me humble armory! I am experimenting with a new type of arrow, but please feel free to look around.") }

				// leave cut scene
				DIALOG("del_all_dialog") 
				FUNC("set_cut_scene_flag" , 0)	// stop cut scene! 

				// change to buy weapon interface, wait until finish buying
				WAIT { FUNC("start_buy_interface", meung_weapon_shop_recno, meung_weapon_seller_recno) } 

				FUNC("set_cut_scene_flag" , 2)	// enter cut scene! 
//				FUNC("set_unit_can_process_in_cut_scene", 0, 1)	// all unit can process
				FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	
				FUNC("set_unit_can_process_in_cut_scene", talk_unit_recno, 1)	

				FUNC("set_interact_unit_recno", joan_recno, 0) 
				FUNC("set_cut_scene_flag" , 0)	// leave cut scene!
			}
		}

		// potion shop
		if( ( meung_potion_seller_recno > 0 ) && ( talk_unit_recno == meung_potion_seller_recno ) )	// talking with Potion shop keeper~~~~~ 
		{
			if( FUNC("get_interact_stage", meung_potion_seller_recno) == 0)
			{
				FUNC("set_cut_scene_flag" , 2)	// enter cut scene! 
//				FUNC("set_unit_can_process_in_cut_scene", 0, 1)	// all unit can process
				FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	
				FUNC("set_unit_can_process_in_cut_scene", talk_unit_recno, 1)	

				// set main character to idle
				FUNC("set_idle", joan_recno) 

				// set weapon seller to idle and rotate him
				ACTION("stop_all_order", meung_potion_seller_recno ) 
				ACTION("give_order" , meung_potion_seller_recno, "TURN" , 3 , 0 , FUNC("get_rotation" , meung_potion_seller_recno , joan_recno) , 0 , 0 , 0, 2500)

				WAIT { DIALOG("add_dialog", meung_potion_seller_recno, "[0002N]Welcome to me humble armory! I am experimenting with a new type of arrow, but please feel free to look around.") }

				// leave cut scene
				DIALOG("del_all_dialog") 
				FUNC("set_cut_scene_flag" , 0)	// stop cut scene! 

				// change to buy weapon interface, wait until finish buying
				WAIT { FUNC("start_buy_interface", meung_potion_shop_recno, meung_potion_seller_recno) } 

				FUNC("set_cut_scene_flag" , 2)	// enter cut scene! 
//				FUNC("set_unit_can_process_in_cut_scene", 0, 1)	// all unit can process
				FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	
				FUNC("set_unit_can_process_in_cut_scene", talk_unit_recno, 1)	

				FUNC("set_interact_unit_recno", joan_recno, 0) 
				FUNC("set_cut_scene_flag" , 0)	// leave cut scene!
			}
		}

	// jean die / follow joan
//	if ( jean_recno )
//	{
		//set jean follow joan
//		ACTION("give_task", jean_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
//	}
//	else
//	{
//		jean_recno = FUNC("search_unit_by_code" , "JEAN_DE_METZ") 
//	}

	// la hire die / follow joan
//	if ( la_hire_recno )
//	{
		//set la hire follow joan
//		ACTION("give_task", la_hire_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
//	}
//	else
//	{
//		la_hire_recno = FUNC("search_unit_by_code" , "LAHIRE") 
//	}

	// Event 0 & 1
	if( FUNC("get_scenario_event_bit_flag", 1) == 0 )
	{	
		joan_in_place_recno = FUNC("search_for_unit_in_place", two_event_zero_place_recno, "F")
		
		if(joan_in_place_recno > 0) 
		{
			FUNC("attention_call_message_2", "Now that Jargeau belongs once more to the French, let's divide our forces - Joan, La Hire, and I will take the northern pass towards Meung.", "Jean de Metz")
			FUNC("attention_call_message_2", "And I shall lead Dunois and d'llliers along the southern pass. Milady, to the west of Orleans, within the mountain there are two settlements. Please go and appraise to their well-being!", "Książę Alencon")
			FUNC("set_scenario_event_bit_flag", 1, 1)
		}
	}


	// Event 2
	if ( FUNC("get_scenario_event_bit_flag", 3) == 0 )
	{
		alencon_in_place_recno = FUNC("is_unit_inside_place", two_event_two_one_place_recno, alencon_recno)
		
		if ( alencon_in_place_recno == 0 )
		{
			alencon_in_place_recno = FUNC("is_unit_inside_place", two_event_two_two_place_recno, alencon_recno)
		}

		if ( alencon_in_place_recno > 0 )
		{
			FUNC("attention_call_message_2", "Troops, ready yourselves for combat - there are enemies to be slain!", "Książę Alencon")
			FUNC("set_scenario_event_bit_flag", 3, 1)
		}
	}

	// Arrived Orlean
	if ( FUNC("get_scenario_event_bit_flag", 6) == 0 )
	{
		joan_in_place_recno = FUNC("is_unit_inside_place", arrive_orlean_one_recno, joan_recno)

		if ( joan_in_place_recno == 0 )
		{
			joan_in_place_recno = FUNC("is_unit_inside_place", arrive_orlean_two_recno, joan_recno)
		}

		if ( joan_in_place_recno )
		{
			FUNC("attention_call_message", "Your grace, news from our brethren near the mountainous pass to the west bear bad tidings. It appears that enemies have occupied two settlements there, and they are in dire need of assistance!")
			FUNC("set_scenario_event_bit_flag", 6, 1)
		}
	}

	// Event 3
	if ( FUNC("get_scenario_event_bit_flag", 4) == 0 )
	{
		joan_in_place_recno = FUNC("is_unit_inside_place", two_event_three_place_recno, joan_recno)

		if ( joan_in_place_recno > 0 )
		{
			FUNC("attention_call_message_2", "Hmmm... Mountainous terrain lies before us. Something tells me the English are waiting for us, in ambush! We must tread carefully...", "Jean de Metz")
			FUNC("set_scenario_event_bit_flag", 4, 1)
		}
	}

	// Event 4  & 5
	if( FUNC("get_scenario_event_bit_flag", 5) == 0 )
	{	
		joan_in_place_recno = FUNC("search_for_unit_in_place", two_event_four_place_recno, "F")
		
		if(joan_in_place_recno > 0) 
		{
			FUNC("attention_call_message_2", "We cannot enter easily, but teh enemy garrison is within reach of our range troops!", "La Hire")
			FUNC("attention_call_message_2", "Yes - the enemy will be unable to replenish their forces, and out fellows to the south will have an easier time breaching Meung!", "Jean de Metz")

			FUNC("set_scenario_event_bit_flag", 5, 1)
		}
	}

	// Event 6
	if( FUNC("get_scenario_event_bit_flag", 7) == 0 )
	{	
		alencon_in_place_recno = FUNC("is_unit_inside_place", two_event_six_place_recno, alencon_recno)
		
		if(alencon_in_place_recno > 0) 
		{
			FUNC("attention_call_message_2", "The enemy has spotted us - Men, prepare for attack!", "Książę Alencon")

			FUNC("set_scenario_event_bit_flag", 7, 1)
		}
	}

	// Event 7
	if( FUNC("get_scenario_event_bit_flag", 8) == 0 )
	{	
		alencon_in_place_recno = FUNC("is_unit_inside_place", two_event_seven_place_recno, alencon_recno)

		if(alencon_in_place_recno > 0) 
		{
			FUNC("attention_call_message_2", "Crossing the bridge might be hazardous, but we must secure the guardhouse if we are to have success breaking through these gates!", "Książę Alencon")

			FUNC("set_scenario_event_bit_flag", 8, 1)
		}		
	}

	// Event 8
	if( FUNC("get_scenario_event_bit_flag", 9) == 0 )
	{	
		alencon_in_place_recno = FUNC("is_unit_inside_place", two_event_eight_place_recno, alencon_recno)

		if(alencon_in_place_recno > 0) 
		{
			FUNC("attention_call_message", "Dunois: Let us capture the towers, men! They are sure to aid our cause!")

			FUNC("set_scenario_event_bit_flag", 9, 1)
		}		
	}

	// Event 11-14
	if( FUNC("get_scenario_event_bit_flag", 14) == 0 )
	{	
		if ( FUNC("get_place_captured", castle_meung_recno) == 1 )
		{
			FUNC("attention_call_message_2", "Well done! We seem to have the enemy the enemy running aflutter. Let us keep up the pressure!", "Jean de Metz")
			FUNC("attention_call_message_2", "Beaugency will be tougher to capture, men. We should approach from the north and south with siege engines.", "Książę Alencon")
			FUNC("attention_call_message", "Dunois: I shall go ahead first along the northeastern route, and meet milady there.")
			FUNC("attention_call_message_2", "What are we waiting for? Let us move swiftly and vanquish these scoundrels", "La Hire")

			FUNC("set_scenario_event_bit_flag", 14, 1)
			FUNC("set_scenario_event_bit_flag", 15, 1)

			FUNC("set_scenario_stage", 3)
			FUNC("reset_scenario_event_bit_flag")

			exit
		}		
	}

	// Capture Castle Meung
	if ( FUNC("get_place_captured", castle_meung_recno) == 0 )
	{
		joan_in_place_recno = FUNC("search_for_unit_in_place", castle_meung_recno, "P")

		if ( joan_in_place_recno > 0 )
		{
			if ( FUNC("number_of_enemy_in_place", castle_meung_recno, joan_recno) == 0 )
			{
				FUNC("attention_call_message", "You have capture Castle Meung!")
				FUNC("set_place_captured", castle_meung_recno, 1)

				FUNC("set_can_interact_flag", meung_weapon_seller_recno, 1)	
				FUNC("set_can_interact_flag", meung_potion_seller_recno, 1)
			}
		}
	}

	// Capture Settlement Bourges
	if ( FUNC("get_place_captured", settlement_bourges_recno) == 0 )
	{
		joan_in_place_recno = FUNC("search_for_unit_in_place", settlement_bourges_recno, "P")

		if ( joan_in_place_recno > 0 )
		{
			if ( FUNC("number_of_enemy_in_place", settlement_bourges_recno, joan_recno) == 0 )
			{
				FUNC("attention_call_message", "You have capture Settlement Bourges!")
				FUNC("set_place_captured", settlement_bourges_recno, 1)

				FUNC("facility_barrack_add_leader", facility_s_two_one, citizen_one_id, 901, 1, "Citizen1", "Citizen1")
				FUNC("facility_barrack_add_leader", facility_s_two_two, citizen_one_id, 902, 1, "Citizen2", "Citizen2")
				FUNC("facility_barrack_add_leader", facility_s_two_three, citizen_two_id, 903, 1, "Citizen3", "Citizen3")
			}
		}
	}

	// *** check when player cross some places, ask AI to attack *** //

	// Spawn H8
	joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_eight, "E")

	if ( joan_in_place_recno > 0 ) 
	{
		if ( FUNC("get_spawn_unit_count_in_place", spawn_h_eight) == 0 )
		{
			// need spawn H8
			FUNC("facility_barrack_add_leader", facility_h_eight_recno_a, epolecap_id, 34, 3, "Stephan Alicie", "Alicie")
			FUNC("facility_barrack_add_leader_order", facility_h_eight_recno_a, "APPROACH_PLACE", 1, spawn_h_eight,0,0,0,0,0)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_b, epoleman_id, 34, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_c, epoleman_id, 34, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_d, epoleman_id, 34, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_e, epoleman_id, 34, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_f, epoleman_id, 34, 1, 1)

			FUNC("facility_barrack_add_leader", facility_h_eight_recno_a, earchcap_id, 96, 3, "Theobald Alsthorpe", "Alsthorpe")
			FUNC("facility_barrack_add_member", facility_h_eight_recno_b, earcher_id, 96, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_c, earcher_id, 96, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_d, earcher_id, 96, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_e, earcher_id, 96, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_f, earcher_id, 96, 1, 1)
		}
	}

	// Spawn H9
	joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_nine, "E")

	if ( joan_in_place_recno > 0 ) 
	{
		if ( FUNC("get_spawn_unit_count_in_place", spawn_h_nine) == 0 )
		{
			// need spawn H9
			FUNC("facility_barrack_add_leader", facility_h_nine_recno_a, ehinfcap_id, 35, 3, "Willielmus Hely", "Hely")
			FUNC("facility_barrack_add_leader_order", facility_h_nine_recno_a, "APPROACH_PLACE", 1, spawn_h_nine,0,0,0,0,0)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_b, ehinfant_id, 35, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_c, ehinfant_id, 35, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_d, ehinfant_id, 35, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_e, ehinfant_id, 35, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_f, ehinfant_id, 35, 1, 1)

			FUNC("facility_barrack_add_leader", facility_h_nine_recno_a, ecrosscap_id, 95, 3, "Arnold Carter", "Carter")
			FUNC("facility_barrack_add_member", facility_h_nine_recno_b, ecrossbow_id, 95, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_c, ecrossbow_id, 95, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_d, ecrossbow_id, 95, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_e, ecrossbow_id, 95, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_nine_recno_f, ecrossbow_id, 95, 1, 1)
		}
		
		if ( FUNC("get_spawn_unit_count_in_place", spawn_h_eight) == 12 )
		{
			// need spawn H8
			FUNC("facility_barrack_add_leader", facility_h_eight_recno_a, ehinfcap_id, 36, 3, "Paul Bercarius", "Bercarius")
			FUNC("facility_barrack_add_member", facility_h_eight_recno_b, ehinfant_id, 36, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_c, ehinfant_id, 36, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_d, ehinfant_id, 36, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_e, ehinfant_id, 36, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_eight_recno_f, ehinfant_id, 36, 1, 1)
		}
	}

	// Spawn H10
	if ( FUNC("get_spawn_unit_count_in_place", spawn_h_ten) == 0 )
	{
		joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_ten, "E")

		if ( joan_in_place_recno > 0 ) 
		{
			// need spawn H10
			FUNC("facility_barrack_add_leader", facility_h_ten_recno, ehinfcap_id, 37, 3, "Willlelm Couhyrd", "Couhyrd")
			FUNC("facility_barrack_add_member", facility_h_ten_recno, ehinfant_id, 37, 6, 1)
		}
	}

	// Spawn H13
//	joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_ten_three, "E")

//	if ( joan_in_place_recno > 0 ) 
//	{
//		if ( FUNC("get_spawn_unit_count_in_place", spawn_h_ten_three) == 0 )
//		{
			// need spawn H13
//			FUNC("facility_barrack_add_leader", facility_h_ten_three_recno, ehinfcap_id, 39, 3, "Boss 18", "Infantry")
//			FUNC("facility_barrack_add_member", facility_h_ten_three_recno, ehinfant_id, 39, 2, 1)
//		}
//	}

	// Spawn H14
//	joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_ten_four, "E")

//	if ( joan_in_place_recno > 0 ) 
//	{
//		if ( FUNC("get_spawn_unit_count_in_place", spawn_h_ten_four) == 0 )
//		{
			// need spawn H14
//			FUNC("facility_barrack_add_leader", facility_h_ten_four_recno, ehinfcap_id, 40, 3, "Boss 19", "Infantry")
//			FUNC("facility_barrack_add_member", facility_h_ten_four_recno, ehinfant_id, 40, 2, 1)

			// need spawn H14
//			FUNC("facility_barrack_add_leader", facility_h_ten_four_recno_two, ehinfcap_id, 41, 3, "Boss 20", "Infantry")
//			FUNC("facility_barrack_add_member", facility_h_ten_four_recno_two, ehinfant_id, 41, 2, 1)
//		}
//	}

	// Spawn H15
	if ( FUNC("get_spawn_unit_count_in_place", spawn_h_ten_five) == 0 )
	{
		joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_ten_five, "E")

		if ( joan_in_place_recno > 0 ) 
		{
			// need spawn H15
			FUNC("facility_barrack_add_leader", facility_h_ten_five_recno_a, elinfcap_id, 152, 3, "Willlelm Couhyrd", "Couhyrd")
			FUNC("facility_barrack_add_member", facility_h_ten_five_recno_b, elinfant_id, 152, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_ten_five_recno_c, elinfant_id, 152, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_ten_five_recno_d, elinfant_id, 152, 1, 1)
			FUNC("facility_barrack_add_member", facility_h_ten_five_recno_e, elinfant_id, 152, 1, 1)
		}
	}

	// Spawn H16
//	if ( FUNC("get_scenario_event_bit_flag", 10) == 0 )
//	{
//		joan_in_place_recno = FUNC("search_for_unit_in_place", spawn_h_ten_six, "E")

//		if ( joan_in_place_recno > 0 ) 
//		{
//			ACTION("stop_all_order", team_one_five_seven_leader) 
//			FUNC("stop_curr_task", team_one_five_seven_leader)


//			FUNC("set_scenario_event_bit_flag", 10, 1)
//		}
//	}

	// ask AI unit to attack 
	if ( boss_ten_three_recno == 0 )
	{
		boss_ten_three_recno = FUNC("get_unit_team_leader_by_team_id", 34)
	}

	if ( boss_ten_three_recno > 0 )
	{
		ACTION("give_task", boss_ten_three_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
	}

	if ( boss_ten_four_recno == 0 )
	{
		boss_ten_four_recno = FUNC("get_unit_team_leader_by_team_id", 96)
	}

	if ( boss_ten_four_recno > 0 )
	{
		ACTION("give_task", boss_ten_four_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
	}

	if ( boss_ten_five_recno == 0 )
	{
		boss_ten_five_recno = FUNC("get_unit_team_leader_by_team_id", 36)
	}

	if ( boss_ten_five_recno > 0 )
	{
		ACTION("give_task", boss_ten_five_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
	}

	if ( boss_ten_six_recno == 0 )
	{
		boss_ten_six_recno = FUNC("get_unit_team_leader_by_team_id", 35)
	}

	if ( boss_ten_six_recno > 0 )
	{
		ACTION("give_task", boss_ten_six_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
	}

	boss_ten_six_recno = FUNC("get_unit_team_leader_by_team_id", 95)
	if ( boss_ten_six_recno > 0 )
	{
		ACTION("give_task", boss_ten_six_recno, "FOLLOW_UNIT", 1, joan_recno, 0, 0, 0)
	}

	if(	FUNC( "get_can_interact_flag" , team_one_five_seven_leader ) && FUNC("is_unit_inside_place", spawn_h_ten_six , joan_recno) )
	{
		FUNC("set_cut_scene_flag" , 1)					// enter cut scene! 
		
		// set main character to idle
		FUNC("set_idle", joan_recno) 
		FUNC("set_unit_can_process_in_cut_scene", 0, 0)	// all unit can't process
		FUNC("set_unit_can_process_in_cut_scene", joan_recno, 1)	// joan can process

		// set weapon seller to idle and rotate him
		ACTION("stop_all_order", team_one_five_seven_leader ) 
		ACTION("give_order" , team_one_five_seven_leader, "TURN" , 3 , 0 , FUNC("get_rotation" , team_one_five_seven_leader, joan_recno) , 0 , 0 , 0, 2500)

		WAIT { DIALOG("add_dialog", team_one_five_seven_leader, "[0003N]You! Meddling peasants! This land is of the rightful ownership of our king Henry, and you have just trampled on our land uninvited - for that you shall pay!") }

		// leave cut scene
		DIALOG("del_all_dialog") 
		FUNC("set_cut_scene_flag" , 2)	// stop cut scene! 
		FUNC("set_cut_scene_flag" , 0)	// stop cut scene! 
		FUNC("set_unit_can_process_in_cut_scene", 0, 1)	
				
		//spawn troops
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_a, ehinfant_id, 151, 3, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_b, ehinfant_id, 151, 3, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_c, elinfant_id, 151, 3, 1)

		FUNC("facility_barrack_add_leader", facility_h_ten_six_recno_d, eexarcherc_id, 900, 3, "Stephan Alicie", "Alicie")
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_e, eexarcher_id, 900, 2, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_f, eexarcher_id, 900, 1, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_g, eexarcher_id, 900, 2, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_h, eexarcher_id, 900, 1, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_i, earcher_id, 151, 2, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_j, earcher_id, 151, 1, 1)
		FUNC("facility_barrack_add_member", facility_h_ten_six_recno_k, earcher_id, 151, 2, 1)


		FUNC("set_can_interact_flag", team_one_five_seven_leader, 0)		
		FUNC("stop_curr_task" , team_one_five_seven_leader )
	}

	if ( team_nine_zero_zero_leader == 0 )
	{
		team_nine_zero_zero_leader = FUNC("get_unit_team_leader_by_team_id", 900)
	}

	if ( team_nine_zero_zero_leader > 0 )
	{
		ACTION("give_task", team_nine_zero_zero_leader, "TOWER_ATTACK", 1, 3000, 0, 0, 0)
	}

	if ( citizen_recno == 0 )
	{
		citizen_recno = FUNC("search_unit_by_name", "Citizen1")
	}
	
	if ( citizen_recno > 0 )
	{
		FUNC("set_can_interact_flag", citizen_recno, 1)					
	}



//	joan_in_place_recno = FUNC("search_for_unit_in_place", camp_bridge_place_recno, "P")

//	if(joan_in_place_recno > 0) 
//	{
//		if( FUNC("get_scenario_bit_flag", 2) == 0 )
//		{	
//			FUNC("add_gate_trigger", cbridge_recno, 0)
//			FUNC("set_scenario_bit_flag", 2, 1)
//		}
//	}

}
