/////////////////////////////////////////////////////////////////////
// EMOORS.S
/////////////////////////////////////////////////////////////////////

SETUP

	Set gg_COO_STATE 0

    IF mj_FREED_FARMERS && !f_RETURNED_AFTER_FREED_FARMERS
	// && gt_CLEAR_MINES - no: must always move farmers

        Add f_RETURNED_AFTER_FREED_FARMERS
	    IF !INAREA-AAMON-FH3
			RemoveC AAMON
	        PlaceC	AAMON		pAAMON_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-BERRY-BARN1
			RemoveC BERRY
	        PlaceC	BERRY		pBERRY_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-BRAN-FH2
			RemoveC BRAN
	        PlaceC  BRAN        pBRAN_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-DEK-FH1
			RemoveC DEK
	        PlaceC	DEK			pDEK_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-LIZ-FH1
			RemoveC LIZ
	        PlaceC	LIZ			pLIZ_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-LORNA-FH2
			RemoveC LORNA
	        PlaceC	LORNA		pLORNA_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-MARGE-FH3
			RemoveC MARGE
	        PlaceC	MARGE		pMARGE_IN_FARM_HOUSE
	    ENDIF

	    IF !INAREA-SAMANTHA-BARN2
			RemoveC SAMANTHA
	        PlaceC	SAMANTHA	pSAMANTHA_IN_FARM_HOUSE
	    ENDIF
    ENDIF

	IF mj_FREED_FARMERS && !gt_PLACED_FARMER_WITH_KEY_LEGACY_FLAG
		Add gt_PLACED_FARMER_WITH_KEY_LEGACY_FLAG

        RemoveC FARMER_KEY
		KillC  Alice
		KillC  WM_BRIG_1
		KillC  WM_BRIG_2

        PlaceC  WM_FARMER_1 pFARMER_1A
        MoveCDir    WM_FARMER_1 pFARMER_1B
        Add     gd_WM_FARMER_1

        PlaceC  WM_FARMER_2 pFARMER_2
        Capture WM_FARMER_2 cM_LEAN_AGAINST_BAR1
        Add     gd_WM_FARMER_2

        PlaceC  WM_FARMER_3 pFARMER_3
        Capture WM_FARMER_2 cM_LEAN_AGAINST_BAR1
        Add     gd_WM_FARMER_3

        PlaceC  WM_FARMER_4 pFARMER_4A
        Capture WM_FARMER_2 cM_LEAN_AGAINST_BAR1
        Add     gd_WM_FARMER_4

        PlaceC  WM_FARMER_5 pFARMER_5
        Capture WM_FARMER_2 cM_LEAN_AGAINST_BAR1
        Add     gd_WM_FARMER_5

	ENDIF

	// *** ALICE ***

	IF !gt_PLACED_ALICE
		Add gt_PLACED_ALICE

		PlaceC ALICE pALICE_START
		Capture ALICE cSG_STAND_BORED1
		AddControl  ALICE   Capture cSG_STAND_BORED2
		AddControl  ALICE   Capture cSG_STAND_BORED3
		AddControl  ALICE   Capture cSG_STAND_BORED4
		SequenceRandomlySelects ALICE

		PlaceC WM_BRIG_1 pBRIGAND1_START
		PlaceC WM_BRIG_2 pBRIGAND2_START

		LookAtTurn  WM_BRIG_1   WM_BRIG_2
		AddControl  WM_BRIG_1   Capture cM_TALK_GENERAL1
		AddControl  WM_BRIG_1   Capture cM_TALK_GENERAL2
		AddControl  WM_BRIG_1   Capture cM_TALK_AGREE2
		AddControl  WM_BRIG_1   Capture cM_GUARD_STAND2
		SequenceRandomlySelects WM_BRIG_1

		LookAtTurn  WM_BRIG_2   WM_BRIG_1
		AddControl  WM_BRIG_2   Capture cM_TALK_GENERAL1
		AddControl  WM_BRIG_2   Capture cM_TALK_GENERAL2
		AddControl  WM_BRIG_2   Capture cM_TALK_AGREE3
		AddControl  WM_BRIG_2   Capture cM_GUARD_STAND2
		SequenceRandomlySelects WM_BRIG_2

		// *** BRIGAND CAMPERS ***

		Add gt_BRIG_CAMP_A_READY
		Add gt_BRIG_CAMP_B_READY
		Add gt_BRIG_CAMPERS_PRESENT

		PlaceC		BRIG_CAMP_1 pCAMP_1
		Capture		BRIG_CAMP_1 cM_V5_KNEEL1

		PlaceC		BRIG_CAMP_2 pCAMP_2
		Capture		BRIG_CAMP_2 cM_V5_KNEEL1

		PlaceC		BRIG_CAMP_3 pCAMP_3
		Capture		BRIG_CAMP_3 cM_GUARD_STAND1
		AddControl	BRIG_CAMP_3 Capture cM_GUARD_STAND2
		AddControl	BRIG_CAMP_3 Capture cM_GUARD_STAND3
		SequenceRandomlySelects BRIG_CAMP_3

		PlaceC		BRIG_CAMP_4 pCAMP_4
		Capture		BRIG_CAMP_4 cM_GUARD_STAND1
		AddControl	BRIG_CAMP_4 Capture cM_GUARD_STAND2
		AddControl	BRIG_CAMP_4 Capture cM_GUARD_STAND3
		SequenceRandomlySelects BRIG_CAMP_4
		SwitchOnSightOfPlayer	BRIG_CAMP_4 AttackDemo2

		PlaceC		BRIG_CAMP_5 pCAMP_5
		Capture		BRIG_CAMP_5 cM_V5_KNEEL1
		AwardOb		BRIG_CAMP_5	journal4 "talos-letter"

		PlaceC		BRIG_CAMP_6 pCAMP_6
		Capture		BRIG_CAMP_6 cM_V5_KNEEL1

		PlaceC		BRIG_CAMP_7 pCAMP_7
		Capture		BRIG_CAMP_7 cM_GUARD_STAND1
		AddControl	BRIG_CAMP_7 Capture cM_GUARD_STAND2
		AddControl	BRIG_CAMP_7 Capture cM_GUARD_STAND3
		SequenceRandomlySelects BRIG_CAMP_7

		PlaceC		BRIG_CAMP_8 pCAMP_8
		Capture		BRIG_CAMP_8 cM_GUARD_STAND1
		AddControl	BRIG_CAMP_8 Capture cM_GUARD_STAND2
		AddControl	BRIG_CAMP_8 Capture cM_GUARD_STAND3
		SequenceRandomlySelects BRIG_CAMP_8
		SwitchOnSightOfPlayer	BRIG_CAMP_8 AttackDemo2
	ENDIF

	IF mj_DEFEAT_GARGOS_1

		IF gt_PLACED_BRIG_HUNTERS
			Remove gt_PLACED_BRIG_HUNTERS
			KillC WM_BRIG_HUNT_1
			KillC WM_BRIG_HUNT_2
			KillC WM_BRIG_HUNT_3
			KillC WM_BRIG_HUNT_4
		ENDIF

		IF gt_BRIG_CAMPERS_PRESENT
			Remove gt_BRIG_CAMP_A_READY
			Remove gt_BRIG_CAMP_B_READY
			Remove gt_BRIG_CAMPERS_PRESENT

			KillC  BRIG_CAMP_1
			KillC  BRIG_CAMP_2
			KillC  BRIG_CAMP_3
			KillC  BRIG_CAMP_4
			KillC  BRIG_CAMP_5
			KillC  BRIG_CAMP_6
			KillC  BRIG_CAMP_7
			KillC  BRIG_CAMP_8
		ENDIF

		IF gt_PLACED_CARAVANS
			Remove gt_PLACED_CARAVANS
			Remove gt_A_SQUAD_ACTIVE
			Remove gt_B_SQUAD_ACTIVE
			KillC  A_SQUAD_GUARD
			KillC  A_SQUAD_GRUNT_1
			KillC  A_SQUAD_GRUNT_2
			KillC  B_SQUAD_GUARD
			KillC  B_SQUAD_GRUNT_1
			KillC  B_SQUAD_GRUNT_2
		ENDIF

	ELSE

		IF !gt_PLACED_BRIG_HUNTERS
			Add gt_PLACED_BRIG_HUNTERS
			PlaceC WM_BRIG_HUNT_1 pHUNTING_3
			PlaceC WM_BRIG_HUNT_2 pHUNTING_6
			PlaceC WM_BRIG_HUNT_3 pHUNTING_7
			PlaceC WM_BRIG_HUNT_4 pHUNTING_8
			RunS BrigandHunterOrders
		ENDIF			

		IF !gt_PLACED_CARAVANS
			Add gt_PLACED_CARAVANS
			Add gt_A_SQUAD_ACTIVE
			Add gt_B_SQUAD_ACTIVE
			PlaceC A_SQUAD_GUARD	pTRADE_ROUTE_2_1
			PlaceC A_SQUAD_GRUNT_1	pTRADE_ROUTE_2_2
			PlaceC A_SQUAD_GRUNT_2	pTRADE_ROUTE_2_3
			PlaceC B_SQUAD_GUARD	pTRADE_ROUTE_8_1
			PlaceC B_SQUAD_GRUNT_1	pTRADE_ROUTE_8_2
			PlaceC B_SQUAD_GRUNT_2	pTRADE_ROUTE_8_3
			Set gt_A_SQUAD_STAGE 1
			Set gt_B_SQUAD_STAGE 7
			AwardOb A_SQUAD_GRUNT_1 sack "trade-sack"
			AwardOb A_SQUAD_GRUNT_2 sack "trade-sack"
			AwardOb B_SQUAD_GRUNT_1 sack "trade-sack"
			AwardOb B_SQUAD_GRUNT_2 sack "trade-sack"
		ENDIF

		IF gt_A_SQUAD_ACTIVE
			RunS NewOrdersA_Squad
		ENDIF
		IF gt_B_SQUAD_ACTIVE
			RunS NewOrdersB_Squad
		ENDIF
	ENDIF

	// *** DOVE LOGIC ***

	IF gt_KILL_THE_DAMN_DOVE
		RemoveDove DOVE
		Remove gd_DOVE_FLIGHT
	ELSE
		IF !f_REMOVED_DOVE
			Remove gg_SEEN_DOVE
			RemoveDove DOVE
			PlaceDove DOVE pDOVE_START
//			StopSFX "Treated Pigeon Cooing #2.wav"
//			PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_START
			Add gg_COO
			Set gd_DOVE_FLIGHT  0
		ENDIF
	ENDIF


    IF  mj_DEFEAT_GARGOS_2
        IF !gd_PLACED_WM_DK
            Add gd_PLACED_WM_DK

            PlaceC                  WM_DK_1     pWM_DK_1
            WanderNotFar            WM_DK_1     8 16
            SwitchOnSightOfPlayer   WM_DK_1     AttackDemo2

            PlaceC                  WM_DK_2     pWM_DK_2
            WanderNotFar            WM_DK_2     8 16
            SwitchOnSightOfPlayer   WM_DK_2     SetScriptFlagControl    gd_WM_DK_2_RUMBLE

            PlaceC                  WM_DK_3     pWM_DK_3
            WanderNotFar            WM_DK_3     8 16
            SwitchOnSightOfPlayer   WM_DK_3     AttackDemo2

            PlaceC                  WM_DK_4     pWM_DK_4
            WanderNotFar            WM_DK_4     8 16
            SwitchOnSightOfPlayer   WM_DK_4     SetScriptFlagControl    gd_WM_DK_4_RUMBLE

            PlaceC                  WM_DK_5     pWM_DK_5
            WanderNotFar            WM_DK_5     8 16
            SwitchOnSightOfPlayer   WM_DK_5     AttackDemo2

            PlaceC                  WM_DK_6     pWM_DK_6
            WanderNotFar            WM_DK_6     8 16
            SwitchOnSightOfPlayer   WM_DK_6     AttackDemo2


        ENDIF
    ENDIF

END

VIG TempSetup FALSE

	RunS AndrusWeather
	Set gd_WIND_TYPE	2
    RunS CueWeather

	SetLiquid ALL 300 20 5
	SetWaterAnimSpeed 0
	SetWaterType 0

	//AddBigFire	22153	20134

	IF !ISDEAD-BRIG_CAMP_1 || !ISDEAD-BRIG_CAMP_2 || !ISDEAD-BRIG_CAMP_3
		AddBigFire	23403	33909
		AttachLoopSFXArea ig_253.wav 50 fire1
	ENDIF
	IF !ISDEAD-BRIG_CAMP_4
		AddBigFire	25723	44691
		AttachLoopSFXArea ig_253.wav 50 fire2
	ENDIF
	IF !ISDEAD-BRIG_CAMP_5 || !ISDEAD-BRIG_CAMP_6 || !ISDEAD-BRIG_CAMP_7
		AddBigFire	2938	54663
		AttachLoopSFXArea ig_253.wav 50 fire3
	ENDIF
	IF !ISDEAD-BRIG_CAMP_8
		AddBigFire	29833	58774
		AttachLoopSFXArea ig_253.wav 50 fire4
	ENDIF

	IF mj_DEFEAT_GARGOS_2
		CachePortrait DKMAGICN.BIN
	ELSE
		CachePortrait ALICE.BIN
		CachePortrait BRIGAND1.BIN
		CachePortrait BRIGAND2.BIN
		CachePortrait PC1.BIN
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG WM_DK_2_Attack  gd_WM_DK_2_RUMBLE && !gd_WM_DK_2_ATTACK
    Add         gd_WM_DK_2_ATTACK
    StopC       WM_DK_2
    RunS        TalkToDragonKin
    AttackDemo2 WM_DK_2
END

/////////////////////////////////////////////////////////////////////

VIG WM_DK_4_Attack  gd_WM_DK_4_RUMBLE && !gd_WM_DK_4_ATTACK
    Add         gd_WM_DK_4_ATTACK
    StopC       WM_DK_4
    RunS        TalkToDragonKin
    AttackDemo2 WM_DK_4
END

/////////////////////////////////////////////////////////////////////

VIG BrigandCamp_A_Attacks gt_BRIG_CAMP_A_READY && ((ONESEC && (DAMAGED-BRIG_CAMP_1 || DAMAGED-BRIG_CAMP_2 || DAMAGED-BRIG_CAMP_3)) || (TENSEC && INAREA-P-NEAR_CAMP_A))

	GiveSightOfPlayerTo BRIG_CAMP_1
	GiveSightOfPlayerTo BRIG_CAMP_2
	GiveSightOfPlayerTo BRIG_CAMP_3

	Remove			gt_BRIG_CAMP_A_READY
	QuickSay		br011a BRIG_CAMP_1

	Capture			BRIG_CAMP_1 cM_V5_STAND1
	AddControl		BRIG_CAMP_1 AttackDemo2

	DelayControl	BRIG_CAMP_2 0 1
	AddControl		BRIG_CAMP_2	Capture		cM_V5_STAND1
	AddControl		BRIG_CAMP_2 AttackDemo2

	AttackDemo2		BRIG_CAMP_3

END

/////////////////////////////////////////////////////////////////////

VIG BrigandCamp_B_Attacks gt_BRIG_CAMP_B_READY && ((ONESEC && (DAMAGED-BRIG_CAMP_5 || DAMAGED-BRIG_CAMP_6 || DAMAGED-BRIG_CAMP_7)) || (TENSEC && INAREA-P-NEAR_CAMP_B))

	GiveSightOfPlayerTo BRIG_CAMP_5
	GiveSightOfPlayerTo BRIG_CAMP_6
	GiveSightOfPlayerTo BRIG_CAMP_7

	Remove			gt_BRIG_CAMP_B_READY
	QuickSay		br011c BRIG_CAMP_5

	DelayControl	BRIG_CAMP_5 0 1
	AddControl		BRIG_CAMP_5	Capture		cM_V5_STAND1
	AddControl		BRIG_CAMP_5 AttackDemo2

	Capture			BRIG_CAMP_6 cM_V5_STAND1
	AddControl		BRIG_CAMP_6 AttackDemo2

	AttackDemo2		BRIG_CAMP_7

END

/////////////////////////////////////////////////////////////////////

VIG BrigHunter_3_Hunt FALSE

	Filter					WM_BRIG_HUNT_3			Timeout	15	AttackDemo2
	AddControl				WM_BRIG_HUNT_3	Filter	Timeout	25	RunAwayFrom P
	SequenceLoops			WM_BRIG_HUNT_3
	PushControl				WM_BRIG_HUNT_3
	Wander					WM_BRIG_HUNT_3
	SwitchOnSightOfPlayer	WM_BRIG_HUNT_3	PopControl

END

/////////////////////////////////////////////////////////////////////

VIG BrigHunter_4_Hunt FALSE

	Filter					WM_BRIG_HUNT_4			Timeout	15	AttackDemo2
	AddControl				WM_BRIG_HUNT_4	Filter	Timeout	25	RunAwayFrom P
	SequenceLoops			WM_BRIG_HUNT_4
	PushControl				WM_BRIG_HUNT_4
	Wander					WM_BRIG_HUNT_4
	SwitchOnSightOfPlayer	WM_BRIG_HUNT_4	PopControl

END

/////////////////////////////////////////////////////////////////////

VIG BrigandHunterOrders FALSE

	MoveC WM_BRIG_HUNT_1 pTRADE_ROUTE_1_1
	AddControl WM_BRIG_HUNT_1 MoveC pTRADE_ROUTE_2_1
	AddControl WM_BRIG_HUNT_1 MoveC pTRADE_ROUTE_3_1
	AddControl WM_BRIG_HUNT_1 MoveC pTRADE_ROUTE_4_1
	AddControl WM_BRIG_HUNT_1 MoveC pHUNTING_1
	AddControl WM_BRIG_HUNT_1 MoveC pHUNTING_3
	AddControl WM_BRIG_HUNT_1 Capture cM_V4_LOOK_AROUND1
	AddControl WM_BRIG_HUNT_1 Capture cM_V4_LOOK_AROUND2
	AddControl WM_BRIG_HUNT_1 Capture cM_V4_LOOK_AROUND3
	AddControl WM_BRIG_HUNT_1 Capture cM_LOOK_AROUND_HANDS_HIPS1
	AddControl WM_BRIG_HUNT_1 Capture cM_LOOK_AROUND_HANDS_HIPS2
	SequenceRandomlySelects WM_BRIG_HUNT_1
	SwitchOnSightOfPlayer WM_BRIG_HUNT_1 AttackDemo2

	MoveC WM_BRIG_HUNT_2 pTRADE_ROUTE_1_2
	AddControl WM_BRIG_HUNT_2 MoveC pTRADE_ROUTE_2_2
	AddControl WM_BRIG_HUNT_2 MoveC pTRADE_ROUTE_3_2
	AddControl WM_BRIG_HUNT_2 MoveC pTRADE_ROUTE_4_2
	AddControl WM_BRIG_HUNT_2 MoveC pHUNTING_2
	AddControl WM_BRIG_HUNT_2 MoveC pHUNTING_4
	AddControl WM_BRIG_HUNT_2 Capture cM_V4_LOOK_AROUND1
	AddControl WM_BRIG_HUNT_2 Capture cM_V4_LOOK_AROUND2
	AddControl WM_BRIG_HUNT_2 Capture cM_V4_LOOK_AROUND3
	AddControl WM_BRIG_HUNT_2 Capture cM_LOOK_AROUND_HANDS_HIPS1
	AddControl WM_BRIG_HUNT_2 Capture cM_LOOK_AROUND_HANDS_HIPS2
	SequenceRandomlySelects WM_BRIG_HUNT_2
	SwitchOnSightOfPlayer WM_BRIG_HUNT_2 AttackDemo2

	RunS BrigHunter_3_Hunt
	RunS BrigHunter_4_Hunt

END

/////////////////////////////////////////////////////////////////////

VIG DoveControlLogic ONESEC && !f_REMOVED_DOVE
	LogOff
// && f_DOVE - always active

	IF !FLYING-DOVE
		IF !gg_COO
			Add gg_COO

//			SWITCH FLAG-gd_DOVE_FLIGHT
//				CASE 1
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_1A
//				CASE 2
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_1B
//				CASE 3
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_2A
//				CASE 4
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_2B
//				CASE 5
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_3A
//				CASE 6
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_3B
//				CASE 7
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_4A
//				CASE 8
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_4B
//				CASE 9
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_5
//				CASE 10
//					PlayLoopSFXPosid "Treated Pigeon Cooing #2.wav" pDOVE_LAND_5
//			ENDSWITCH
		ENDIF

		IF !f_REMOVED_DOVE && gd_DOVE_FLIGHT=12
			RemoveDove DOVE
			Remove gd_DOVE_FLIGHT
			Add f_REMOVED_DOVE
		ENDIF

		IF gd_DOVE_FLIGHT=11 && INAREA-P-edove_end
			IF DOORSTILL-dOBELISK
				Remove gg_COO
//				StopSFX "Treated Pigeon Cooing #2.wav"

				MoveDove DOVE pDOVE_VANISH

				SWITCH RAND-2
				CASE 0
					PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_HEX_EXIT
				CASE 1
					PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_HEX_EXIT
				ENDSWITCH

   				AddTo gd_DOVE_FLIGHT 1
			ENDIF
		ENDIF

		IF gd_DOVE_FLIGHT=10
// 			IDoorClosed dOBELISK
   			RDoorOpen dOBELISK
			AddTo gd_DOVE_FLIGHT 1
		ENDIF

		IF gd_DOVE_FLIGHT=9
			IF INAREA-P-edove5
				Remove gg_COO
//				StopSFX "Treated Pigeon Cooing #2.wav"

				MoveDove DOVE   pDOVE_HEX_EXIT

				SWITCH RAND-2
				CASE 0
					PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_5
				CASE 1
					PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_5
				ENDSWITCH

    			AddTo gd_DOVE_FLIGHT 1
			ENDIF
		ENDIF

		IF (gd_DOVE_FLIGHT=7 || gd_DOVE_FLIGHT=8)
			IF gd_DOVE_FLIGHT=7
				IF INAREA-P-edove4A
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  9

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_4A
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_4A
					ENDSWITCH

				ENDIF
			ELSE
				IF INAREA-P-edove4B
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  9

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_4B
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_4B
					ENDSWITCH

				ENDIF
			ENDIF
			IF gd_DOVE_FLIGHT=9
				MoveDove DOVE pDOVE_LAND_5
			ENDIF
		ENDIF

		IF (gd_DOVE_FLIGHT=5 || gd_DOVE_FLIGHT=6)
			IF gd_DOVE_FLIGHT=5
				IF INAREA-P-edove3A
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  7

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_3A
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_3A
					ENDSWITCH

				ENDIF
			ELSE
				IF INAREA-P-edove3B
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  7

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_3B
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_3B
					ENDSWITCH

				ENDIF
			ENDIF
			IF gd_DOVE_FLIGHT=7
				//prevent dove flying near to farmhouse
				//SWITCH  RAND-2
				//CASE 0
				//	MoveDove DOVE pDOVE_LAND_4A
    			//	Set gd_DOVE_FLIGHT 7
				//CASE 1
					MoveDove DOVE pDOVE_LAND_4B
    				Set gd_DOVE_FLIGHT 8
				//ENDSWITCH
			ENDIF
		ENDIF

		IF (gd_DOVE_FLIGHT=3 || gd_DOVE_FLIGHT=4)
			IF gd_DOVE_FLIGHT=3
				IF INAREA-P-edove2A
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  5

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_2A
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_2A
					ENDSWITCH

				ENDIF
			ELSE
				IF INAREA-P-edove2B
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  5

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_2B
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_2B
					ENDSWITCH

				ENDIF
			ENDIF
			IF gd_DOVE_FLIGHT=5
				SWITCH  RAND-2
				CASE 0
					MoveDove DOVE pDOVE_LAND_3A
    				Set gd_DOVE_FLIGHT 5
				CASE 1
					MoveDove DOVE pDOVE_LAND_3B
    				Set gd_DOVE_FLIGHT 6
				ENDSWITCH
			ENDIF
		ENDIF

		IF (gd_DOVE_FLIGHT=1 || gd_DOVE_FLIGHT=2)
			IF gd_DOVE_FLIGHT=1
				IF INAREA-P-edove1A
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  3

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_1A
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_1A
					ENDSWITCH

				ENDIF
			ELSE
				IF INAREA-P-edove1B
					Remove gg_COO
//					StopSFX "Treated Pigeon Cooing #2.wav"

					Set gd_DOVE_FLIGHT  3

					SWITCH RAND-2
					CASE 0
						PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_LAND_1B
					CASE 1
						PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_LAND_1B
					ENDSWITCH

				ENDIF
			ENDIF
			IF gd_DOVE_FLIGHT=3
				SWITCH  RAND-2
				CASE 0
					MoveDove DOVE pDOVE_LAND_2A
    				Set gd_DOVE_FLIGHT 3
				CASE 1
					MoveDove DOVE pDOVE_LAND_2B
    				Set gd_DOVE_FLIGHT 4
				ENDSWITCH
			ENDIF
		ENDIF
	ENDIF

    IF gd_DOVE_FLIGHT=0
	    IF INAREA-P-edove1 && !gg_SEEN_DOVE && !INCOMBAT-P

			Add gg_SEEN_DOVE
            StopC   P
			//Widescreen TRUE

            //EngagePoint P pDOVE_START 750
			// ...replaces...
			//MoveCDir    P   pMOOR_PDOVE

//camnlock 45
//campan pDOVE_START
//Campan      dove1
//            UUComplete  P
//            Capture     P   cM_CROUCH_TALK_TO_ALICE1_SQUAT

//            Wait        1500

//Campan      dove2
//            Wait        3000


			Remove gg_COO
//			StopSFX "Treated Pigeon Cooing #2.wav"

            SWITCH  RAND-2
            CASE 0
		        MoveDove DOVE pDOVE_LAND_1A
    		    Set gd_DOVE_FLIGHT 1
            CASE 1
		        MoveDove DOVE pDOVE_LAND_1B
    		    Set gd_DOVE_FLIGHT 2
            ENDSWITCH

			SWITCH RAND-2
			CASE 0
				PlaySFXPosid "Pigeon Wings #1.wav" pDOVE_START
			CASE 1
				PlaySFXPosid "Pigeon Wings #2.wav" pDOVE_START
			ENDSWITCH

//            UUComplete  P
//            Capture     P   cM_CROUCH_TALK_TO_ALICE2_STAND
//            UUComplete  P
//            Camcut      P
//			Widescreen FALSE
	    ENDIF
    ENDIF

	LogOn
END

/////////////////////////////////////////////////////////////////////

VIG SeeAlice ONESEC && !ce_ALICE && gt_PLACED_ALICE && !mj_FREED_FARMERS && (INAREA-P-emoors_alice || MSG-iALICE)

	Add ce_ALICE
	Add gt_ALICE_BRIGAND_ATTACKING

	IF !ISDEAD-WM_BRIG_1 || !ISDEAD-WM_BRIG_2
		FreezeC WM_BRIG_HUNT_1
		FreezeC WM_BRIG_HUNT_2
		FreezeC WM_BRIG_HUNT_3
		FreezeC WM_BRIG_HUNT_4
		
		Widescreen TRUE
		freecam
		// *** MEETING FARMER GIRL ALICE ***
		camnlock 45
		camcut p
		setcammoveconstant 7
		//campan pos100

		MoveC   ALICE   pALICE_START
		MoveC   P       pP_NEAR_ALICE
		UUComplete      ALICE
		UUComplete      P
		LookAtTurn      P   ALICE
		UUComplete      P

		Capture         P   cM_CROUCH_TALK_TO_ALICE1_SQUAT
		LookAtTurn      ALICE   P
		camcut pos01
		LookAtTurn WM_BRIG_1 P
		DelayControl WM_BRIG_2 1 1
		AddControl WM_BRIG_2 LookAtTurn P
		//"Hey you. Leave the child. She's ours."
		Say             br0001  BRIGAND1.BIN


		campan pos02
		setcammoveconstant 12
		// Move player to alice and start conversation
		MoveC WM_BRIG_1 pBRIGAND1_ATTACK    run
		MoveC WM_BRIG_2 pBRIGAND2_ATTACK    run

		Wait            1

		Capture         P   cM_CROUCH_TALK_TO_ALICE2_STAND
		UUComplete      P
		Capture         P   cM_V4_LOOK_AROUND1

		AddControl  ALICE MoveC pALICE_RUN1
		AddControl  ALICE MoveC pALICE_RUN_AWAY
		//AddControl	ALICE Capture cSG_SCARED_CROUCH1

		UUComplete WM_BRIG_1
		UUComplete WM_BRIG_2
		LookAtTurn  P   WM_BRIG_1

		AttackDemo WM_BRIG_1 P
		AttackDemo WM_BRIG_2 P

		Add gt_ALICE_BRIGAND_ATTACKING

		// *** END OF MEETING FARMER GIRL ALICE ***
		camcut p 
		setcammovenormal
		NormalCam
		Widescreen FALSE
		UnFreezeC WM_BRIG_HUNT_1
		UnFreezeC WM_BRIG_HUNT_2
		UnFreezeC WM_BRIG_HUNT_3
		UnFreezeC WM_BRIG_HUNT_4
	ELSE
		AddControl  ALICE MoveC pALICE_RUN1
		AddControl  ALICE MoveC pALICE_RUN_AWAY
		//AddControl	ALICE Capture cSG_SCARED_CROUCH1
	ENDIF
END

/////////////////////////////////////////////////////////////////////

VIG TalkToAlice MSG-iALICE && ce_ALICE

	IF !ISDEAD-WM_BRIG_1 || !ISDEAD-WM_BRIG_2
		//"Look out! The bad man is going to kill you!"
		QuickSay ic0003
	ELSE
		IF !mj_FREED_FARMERS
			//"My mother and father are in the cave. The bad men make them dig the rocks."
			QuickSay ic0001
		ENDIF
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG DefeatedAliceBrigands ONESEC && gt_ALICE_BRIGAND_ATTACKING && ISDEAD-WM_BRIG_1 && ISDEAD-WM_BRIG_2 && !mj_FREED_FARMERS
widescreen true
camcut p
	Remove gt_ALICE_BRIGAND_ATTACKING

	// *** ALICE SHOWS PLAYER MINE ENTRANCE ***

	// Move the player to alice

	EngageAndFace P ALICE

	//Capture ALICE cSG_STAND_FROM_CROUCH1
	UUComplete P

	//"Don't worry. You are safe now. Can you show me where your parents are?"
	Say Hx0170

	MoveCDir ALICE pALICE_MINE_ENTRANCE
	Wait 2500	
		
    MoveC   P   pP_MINE_ENTRANCE

    UUComplete  P
    UUComplete	ALICE

    LookAtTurn  P   ALICE
	Capture     ALICE  cSG_POINT_SCARED1

	//"My mother and father are in the cave. The bad men make them dig the rocks."
    Say         ic0001

	// *** END OF ALICE SHOWING PLAYER MINE ENTRANCE ***
widescreen false

END

/////////////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////////////////////
//	BRIGAND TRADING OPERATIONS
/////////////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////////////////////
//	A_SQUAD
/////////////////////////////////////////////////////////////////////

VIG EndOFA_SQUAD FIVESEC && gt_A_SQUAD_ACTIVE && ISDEAD-A_SQUAD_GUARD && ISDEAD-A_SQUAD_GRUNT_1 && ISDEAD-A_SQUAD_GRUNT_2 && !gt_A_SQUAD_GUARD_OFFMAP && !gt_A_SQUAD_GRUNT_1_OFFMAP && !gt_A_SQUAD_GRUNT_2_OFFMAP

	// Squad is dead :- disable further vignettes

	Remove gt_A_SQUAD_ACTIVE
	AwardEP xp_SQUAD_A_DEAD

END

/////////////////////////////////////////////////////////////////////

VIG WaitingForA_SQUAD TENSEC && gt_A_SQUAD_TIMER

	// Squad is off map :- count time spent off map

	AddTo gt_A_SQUAD_TIMER 1

END

/////////////////////////////////////////////////////////////////////

VIG ForceHandOfA_SQUAD ONESEC && gt_A_SQUAD_ACTIVE 

	IF (!ISDEAD-A_SQUAD_GUARD && DISTFROM-P-A_SQUAD_GUARD-5) || (!ISDEAD-A_SQUAD_GRUNT_1 && DISTFROM-P-A_SQUAD_GRUNT_1-5) || (!ISDEAD-A_SQUAD_GRUNT_2 && DISTFROM-P-A_SQUAD_GRUNT_2-5)
		Add gt_FORCE_HAND
		RunS AttackOnA_SQUAD
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG AttackOnA_SQUAD ONESEC && gt_A_SQUAD_ACTIVE && (DAMAGED-A_SQUAD_GUARD || DAMAGED-A_SQUAD_GRUNT_1 || DAMAGED-A_SQUAD_GRUNT_2)

	// A squad member has been attacked :- 
	//		dispatch the guard to attack (if alive) - grunts will wait at next waypoint
	//		failing that, the grunt attacked will retaliate
	//			(the other grunt will help unless carrying iron)
	//	Any character attacking will break off if the player does not continue to attack

	IF !ISDEAD-A_SQUAD_GUARD
		AttackDemo A_SQUAD_GUARD
		AddFilter A_SQUAD_GUARD Timeout 10
	ELSE
		IF !ISDEAD-A_SQUAD_GRUNT_1 && (DAMAGED-A_SQUAD_GRUNT_1 || !POS-A_SQUAD_GRUNT_1-diingot || gt_FORCE_HAND)
			AttackDemo A_SQUAD_GRUNT_1
			AddFilter A_SQUAD_GRUNT_1 Timeout 10
		ENDIF
		IF !ISDEAD-A_SQUAD_GRUNT_2 && (DAMAGED-A_SQUAD_GRUNT_2 || !POS-A_SQUAD_GRUNT_2-diingot || gt_FORCE_HAND)
			AttackDemo A_SQUAD_GRUNT_2
			AddFilter A_SQUAD_GRUNT_2 Timeout 10
		ENDIF
	ENDIF

	ClearDamaged A_SQUAD_GUARD
	ClearDamaged A_SQUAD_GRUNT_1
	ClearDamaged A_SQUAD_GRUNT_2

	Remove gt_FORCE_HAND

END

/////////////////////////////////////////////////////////////////////

VIG NewOrdersA_SQUAD ONESEC && gt_A_SQUAD_ACTIVE && CC-A_SQUAD_GUARD && CC-A_SQUAD_GRUNT_1 && CC-A_SQUAD_GRUNT_2

	// Each squad member has reached destination OR is dead OR has broken off attacking the player :-
	//		continue to the next stage of the route

	//moved to top : this vignette runs every frame if stage=16
	IF gt_A_SQUAD_STAGE=16
		//off-map, time to re-appear ?
		IF gt_A_SQUAD_TIMER>3
			//clear timer
			Remove gt_A_SQUAD_TIMER
			//place squad members if still alive, move to bend in road
			Set gt_A_SQUAD_STAGE 1
			IF gt_A_SQUAD_GUARD_OFFMAP
				Remove gt_A_SQUAD_GUARD_OFFMAP
				PlaceC	A_SQUAD_GUARD	pTRADE_ROUTE_1_1
				MoveC	A_SQUAD_GUARD	pTRADE_ROUTE_2_1
			ENDIF
			IF gt_A_SQUAD_GRUNT_1_OFFMAP
				Remove gt_A_SQUAD_GRUNT_1_OFFMAP
				PlaceC A_SQUAD_GRUNT_1	pTRADE_ROUTE_1_2
				MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_2_2
			ENDIF
			IF gt_A_SQUAD_GRUNT_2_OFFMAP
				Remove gt_A_SQUAD_GRUNT_2_OFFMAP
				PlaceC A_SQUAD_GRUNT_2	pTRADE_ROUTE_1_3
				MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_2_3
			ENDIF
		ENDIF
	ELSE
	IF gt_A_SQUAD_STAGE=1
		//arrived at bend in road
		Set gt_A_SQUAD_STAGE 2
		//move to south junction
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_3_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_3_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_3_3
	ELSE
	IF gt_A_SQUAD_STAGE=2
		//arrived at south junction
		Set gt_A_SQUAD_STAGE 3
		//move to road midpoint
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_4_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_4_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_4_3
	ELSE
	IF gt_A_SQUAD_STAGE=3
		//arrived at road midpoint
		Set gt_A_SQUAD_STAGE 4
		//move to north junction
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_5_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_5_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_5_3
	ELSE
	IF gt_A_SQUAD_STAGE=4
		//arrived at north junction
		Set gt_A_SQUAD_STAGE 5
		//move to offroad point
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_6_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_6_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_6_3
	ELSE
	IF gt_A_SQUAD_STAGE=5
		//arrived at offroad point
		Set gt_A_SQUAD_STAGE 6
		//move to outside mine complex
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_7_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_7_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_7_3
	ELSE
	IF gt_A_SQUAD_STAGE=6
		//arrived outside mine complex
		Set gt_A_SQUAD_STAGE 7
		//move to pickup point
		MoveCDir A_SQUAD_GUARD		pTRADE_ROUTE_8_1
		MoveCDir A_SQUAD_GRUNT_1	pTRADE_ROUTE_8_2
		MoveCDir A_SQUAD_GRUNT_2	pTRADE_ROUTE_8_3
	ELSE
	IF gt_A_SQUAD_STAGE=7
		// ??? arrived at pickup point ???
		IF (INAREA-A_SQUAD_GUARD-NEAR_IRON_PICKUP || ISDEAD-A_SQUAD_GUARD) && (INAREA-A_SQUAD_GRUNT_1-NEAR_IRON_PICKUP || ISDEAD-A_SQUAD_GRUNT_1) && (INAREA-A_SQUAD_GRUNT_2-NEAR_IRON_PICKUP || ISDEAD-A_SQUAD_GRUNT_2)
			// everyone is either here or they're dead, so let's go
			Set gt_A_SQUAD_STAGE 8
			Capture A_SQUAD_GUARD cM_GUARD_STAND1
			AddControl A_SQUAD_GUARD Capture cM_GUARD_STAND2
			AddControl A_SQUAD_GUARD Capture cM_GUARD_STAND3
			SequenceRandomlySelects A_SQUAD_GUARD
			AddFilter A_SQUAD_GUARD Timeout 10
			IF !ISDEAD-A_SQUAD_GRUNT_1
				DelayControl A_SQUAD_GRUNT_1 0 1
				AddControl A_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AddControl A_SQUAD_GRUNT_1 DelayControl 0 1
				AddControl A_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AddControl A_SQUAD_GRUNT_1 DelayControl 0 1
				AddControl A_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AwardObjToContainerInBackpack diingot myingots 3 A_SQUAD_GRUNT_1 sack trade-sack
			ENDIF
			IF !ISDEAD-A_SQUAD_GRUNT_2
				DelayControl A_SQUAD_GRUNT_2 0 1
				AddControl A_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AddControl A_SQUAD_GRUNT_2 DelayControl 0 1
				AddControl A_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AddControl A_SQUAD_GRUNT_2 DelayControl 0 1
				AddControl A_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AwardObjToContainerInBackpack diingot myingots 3 A_SQUAD_GRUNT_2 sack trade-sack
			ENDIF
		ELSE
			//still waiting for someone, get them over here
			MoveCDir A_SQUAD_GUARD		pTRADE_ROUTE_8_1
			MoveCDir A_SQUAD_GRUNT_1	pTRADE_ROUTE_8_2
			MoveCDir A_SQUAD_GRUNT_2	pTRADE_ROUTE_8_3
		ENDIF
	ELSE
	IF gt_A_SQUAD_STAGE=8
		//picked up goods
		Set gt_A_SQUAD_STAGE 9
		//move outside mine complex
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_7R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_7R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_7R_3
	ELSE
	IF gt_A_SQUAD_STAGE=9
		//arrived outside mine complex
		Set gt_A_SQUAD_STAGE 10
		//move to offroad point
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_6R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_6R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_6R_3
	ELSE
	IF gt_A_SQUAD_STAGE=10
		//arrived at offroad point
		Set gt_A_SQUAD_STAGE 11
		//move to north junction
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_5R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_5R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_5R_3
	ELSE
	IF gt_A_SQUAD_STAGE=11
		//arrived at north junction
		Set gt_A_SQUAD_STAGE 12
		//move to road midpoint
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_4R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_4R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_4R_3
	ELSE
	IF gt_A_SQUAD_STAGE=12
		//arrived at road midpoint
		Set gt_A_SQUAD_STAGE 13
		//move to south junction
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_3R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_3R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_3R_3
	ELSE
	IF gt_A_SQUAD_STAGE=13
		//arrived at south junction
		Set gt_A_SQUAD_STAGE 14
		//move to bend in road
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_2R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_2R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_2R_3
	ELSE
	IF gt_A_SQUAD_STAGE=14
		//arrived at bend in road
		Set gt_A_SQUAD_STAGE 15
		//move to high rock pass exit
		MoveC A_SQUAD_GUARD		pTRADE_ROUTE_1R_1
		MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_1R_2
		MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_1R_3
	ELSE
	IF gt_A_SQUAD_STAGE=15
		// ??? arrived at high rock pass exit ???
		IF (INAREA-A_SQUAD_GUARD-NEAR_HR_PASS || ISDEAD-A_SQUAD_GUARD) && (INAREA-A_SQUAD_GRUNT_1-NEAR_HR_PASS || ISDEAD-A_SQUAD_GRUNT_1) && (INAREA-A_SQUAD_GRUNT_2-NEAR_HR_PASS || ISDEAD-A_SQUAD_GRUNT_2)
			// everyone is either here or they're dead, so let's go
			Set gt_A_SQUAD_STAGE 16
			IF !ISDEAD-A_SQUAD_GUARD
				RemoveC A_SQUAD_GUARD
				Add gt_A_SQUAD_GUARD_OFFMAP
			ENDIF
			IF !ISDEAD-A_SQUAD_GRUNT_1
				DeleteObjectsInBackpackWithID A_SQUAD_GRUNT_1 diingot
				RemoveC A_SQUAD_GRUNT_1
				Add gt_A_SQUAD_GRUNT_1_OFFMAP
			ENDIF
			IF !ISDEAD-A_SQUAD_GRUNT_2
				DeleteObjectsInBackpackWithID A_SQUAD_GRUNT_2 diingot
				RemoveC A_SQUAD_GRUNT_2
				Add gt_A_SQUAD_GRUNT_2_OFFMAP
			ENDIF
			//init timer for re-appearance
			Set gt_A_SQUAD_TIMER 0
		ELSE
			//still waiting for someone, get them over here
			MoveC A_SQUAD_GUARD		pTRADE_ROUTE_1R_1
			MoveC A_SQUAD_GRUNT_1	pTRADE_ROUTE_1R_2
			MoveC A_SQUAD_GRUNT_2	pTRADE_ROUTE_1R_3
		ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
END
		
/////////////////////////////////////////////////////////////////////
//	B_SQUAD
/////////////////////////////////////////////////////////////////////

VIG EndOFB_SQUAD FIVESEC && gt_B_SQUAD_ACTIVE && ISDEAD-B_SQUAD_GUARD && ISDEAD-B_SQUAD_GRUNT_1 && ISDEAD-B_SQUAD_GRUNT_2 && !gt_B_SQUAD_GUARD_OFFMAP && !gt_B_SQUAD_GRUNT_1_OFFMAP && !gt_B_SQUAD_GRUNT_2_OFFMAP

	// Squad is dead :- disable further vignettes

	Remove gt_B_SQUAD_ACTIVE
	AwardEP xp_SQUAD_B_DEAD

END

/////////////////////////////////////////////////////////////////////

VIG WaitingForB_SQUAD TENSEC && gt_B_SQUAD_TIMER

	// Squad is off map :- count time spent off map

	AddTo gt_B_SQUAD_TIMER 1

END

/////////////////////////////////////////////////////////////////////

VIG ForceHandOfB_SQUAD ONESEC && gt_B_SQUAD_ACTIVE 

	IF (!ISDEAD-B_SQUAD_GUARD && DISTFROM-P-B_SQUAD_GUARD-5) || (!ISDEAD-B_SQUAD_GRUNT_1 && DISTFROM-P-B_SQUAD_GRUNT_1-5) || (!ISDEAD-B_SQUAD_GRUNT_2 && DISTFROM-P-B_SQUAD_GRUNT_2-5)
		Add gt_FORCE_HAND
		RunS AttackOnB_SQUAD
	ENDIF

END

/////////////////////////////////////////////////////////////////////

VIG AttackOnB_SQUAD ONESEC && gt_B_SQUAD_ACTIVE && (DAMAGED-B_SQUAD_GUARD || DAMAGED-B_SQUAD_GRUNT_1 || DAMAGED-B_SQUAD_GRUNT_2)

	// A squad member has been attacked :- 
	//		dispatch the guard to attack (if alive) - grunts will wait at next waypoint
	//		failing that, the grunt attacked will retaliate
	//			(the other grunt will help unless carrying iron)
	//	Any character attacking will break off if the player does not continue to attack

	IF !ISDEAD-B_SQUAD_GUARD
		AttackDemo B_SQUAD_GUARD
		AddFilter B_SQUAD_GUARD Timeout 10
	ELSE
		IF !ISDEAD-B_SQUAD_GRUNT_1 && (DAMAGED-B_SQUAD_GRUNT_1 || !POS-B_SQUAD_GRUNT_1-diingot || gt_FORCE_HAND)
			AttackDemo B_SQUAD_GRUNT_1
			AddFilter B_SQUAD_GRUNT_1 Timeout 10
		ENDIF
		IF !ISDEAD-B_SQUAD_GRUNT_2 && (DAMAGED-B_SQUAD_GRUNT_2 || !POS-B_SQUAD_GRUNT_2-diingot || gt_FORCE_HAND)
			AttackDemo B_SQUAD_GRUNT_2
			AddFilter B_SQUAD_GRUNT_2 Timeout 10
		ENDIF
	ENDIF

	ClearDamaged B_SQUAD_GUARD
	ClearDamaged B_SQUAD_GRUNT_1
	ClearDamaged B_SQUAD_GRUNT_2

	Remove gt_FORCE_HAND

END

/////////////////////////////////////////////////////////////////////

VIG NewOrdersB_SQUAD ONESEC && gt_B_SQUAD_ACTIVE && CC-B_SQUAD_GUARD && CC-B_SQUAD_GRUNT_1 && CC-B_SQUAD_GRUNT_2

	// Each squad member has reached destination OR is dead OR has broken off attacking the player :-
	//		continue to the next stage of the route

	//moved to top : this vignette runs every frame if stage=16
	IF gt_B_SQUAD_STAGE=16
		//off-map, time to re-appear ?
		IF gt_B_SQUAD_TIMER>3
			//clear timer
			Remove gt_B_SQUAD_TIMER
			//place squad members if still alive, move to bend in road
			Set gt_B_SQUAD_STAGE 1
			IF gt_B_SQUAD_GUARD_OFFMAP
				Remove gt_B_SQUAD_GUARD_OFFMAP
				PlaceC	B_SQUAD_GUARD	pTRADE_ROUTE_1_1
				MoveC	B_SQUAD_GUARD	pTRADE_ROUTE_2_1
			ENDIF
			IF gt_B_SQUAD_GRUNT_1_OFFMAP
				Remove gt_B_SQUAD_GRUNT_1_OFFMAP
				PlaceC B_SQUAD_GRUNT_1	pTRADE_ROUTE_1_2
				MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_2_2
			ENDIF
			IF gt_B_SQUAD_GRUNT_2_OFFMAP
				Remove gt_B_SQUAD_GRUNT_2_OFFMAP
				PlaceC B_SQUAD_GRUNT_2	pTRADE_ROUTE_1_3
				MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_2_3
			ENDIF
		ENDIF
	ELSE
	IF gt_B_SQUAD_STAGE=1
		//arrived at bend in road
		Set gt_B_SQUAD_STAGE 2
		//move to south junction
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_3_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_3_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_3_3
	ELSE
	IF gt_B_SQUAD_STAGE=2
		//arrived at south junction
		Set gt_B_SQUAD_STAGE 3
		//move to road midpoint
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_4_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_4_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_4_3
	ELSE
	IF gt_B_SQUAD_STAGE=3
		//arrived at road midpoint
		Set gt_B_SQUAD_STAGE 4
		//move to north junction
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_5_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_5_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_5_3
	ELSE
	IF gt_B_SQUAD_STAGE=4
		//arrived at north junction
		Set gt_B_SQUAD_STAGE 5
		//move to offroad point
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_6_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_6_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_6_3
	ELSE
	IF gt_B_SQUAD_STAGE=5
		//arrived at offroad point
		Set gt_B_SQUAD_STAGE 6
		//move to outside mine complex
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_7_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_7_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_7_3
	ELSE
	IF gt_B_SQUAD_STAGE=6
		//arrived outside mine complex
		Set gt_B_SQUAD_STAGE 7
		//move to pickup point
		MoveCDir B_SQUAD_GUARD		pTRADE_ROUTE_8_1
		MoveCDir B_SQUAD_GRUNT_1	pTRADE_ROUTE_8_2
		MoveCDir B_SQUAD_GRUNT_2	pTRADE_ROUTE_8_3
	ELSE
	IF gt_B_SQUAD_STAGE=7
		// ??? arrived at pickup point ???
		IF (INAREA-B_SQUAD_GUARD-NEAR_IRON_PICKUP || ISDEAD-B_SQUAD_GUARD) && (INAREA-B_SQUAD_GRUNT_1-NEAR_IRON_PICKUP || ISDEAD-B_SQUAD_GRUNT_1) && (INAREA-B_SQUAD_GRUNT_2-NEAR_IRON_PICKUP || ISDEAD-B_SQUAD_GRUNT_2)
			// everyone is either here or they're dead, so let's go
			Set gt_B_SQUAD_STAGE 8
			Capture B_SQUAD_GUARD cM_GUARD_STAND1
			AddControl B_SQUAD_GUARD Capture cM_GUARD_STAND2
			AddControl B_SQUAD_GUARD Capture cM_GUARD_STAND3
			SequenceRandomlySelects B_SQUAD_GUARD
			AddFilter B_SQUAD_GUARD Timeout 10
			IF !ISDEAD-B_SQUAD_GRUNT_1
				DelayControl B_SQUAD_GRUNT_1 0 1
				AddControl B_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AddControl B_SQUAD_GRUNT_1 DelayControl 0 1
				AddControl B_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AddControl B_SQUAD_GRUNT_1 DelayControl 0 1
				AddControl B_SQUAD_GRUNT_1 Capture cM_PICK_GROUND
				AwardObjToContainerInBackpack diingot myingots 3 B_SQUAD_GRUNT_1 sack trade-sack
			ENDIF
			IF !ISDEAD-B_SQUAD_GRUNT_2
				DelayControl B_SQUAD_GRUNT_2 0 1
				AddControl B_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AddControl B_SQUAD_GRUNT_2 DelayControl 0 1
				AddControl B_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AddControl B_SQUAD_GRUNT_2 DelayControl 0 1
				AddControl B_SQUAD_GRUNT_2 Capture cM_PICK_GROUND
				AwardObjToContainerInBackpack diingot myingots 3 B_SQUAD_GRUNT_2 sack trade-sack
			ENDIF
		ELSE
			//still waiting for someone, get them over here
			MoveCDir B_SQUAD_GUARD		pTRADE_ROUTE_8_1
			MoveCDir B_SQUAD_GRUNT_1	pTRADE_ROUTE_8_2
			MoveCDir B_SQUAD_GRUNT_2	pTRADE_ROUTE_8_3
		ENDIF
	ELSE
	IF gt_B_SQUAD_STAGE=8
		//picked up goods
		Set gt_B_SQUAD_STAGE 9
		//move outside mine complex
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_7R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_7R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_7R_3
	ELSE
	IF gt_B_SQUAD_STAGE=9
		//arrived outside mine complex
		Set gt_B_SQUAD_STAGE 10
		//move to offroad point
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_6R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_6R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_6R_3
	ELSE
	IF gt_B_SQUAD_STAGE=10
		//arrived at offroad point
		Set gt_B_SQUAD_STAGE 11
		//move to north junction
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_5R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_5R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_5R_3
	ELSE
	IF gt_B_SQUAD_STAGE=11
		//arrived at north junction
		Set gt_B_SQUAD_STAGE 12
		//move to road midpoint
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_4R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_4R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_4R_3
	ELSE
	IF gt_B_SQUAD_STAGE=12
		//arrived at road midpoint
		Set gt_B_SQUAD_STAGE 13
		//move to south junction
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_3R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_3R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_3R_3
	ELSE
	IF gt_B_SQUAD_STAGE=13
		//arrived at south junction
		Set gt_B_SQUAD_STAGE 14
		//move to bend in road
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_2R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_2R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_2R_3
	ELSE
	IF gt_B_SQUAD_STAGE=14
		//arrived at bend in road
		Set gt_B_SQUAD_STAGE 15
		//move to high rock pass exit
		MoveC B_SQUAD_GUARD		pTRADE_ROUTE_1R_1
		MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_1R_2
		MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_1R_3
	ELSE
	IF gt_B_SQUAD_STAGE=15
		// ??? arrived at high rock pass exit ???
		IF (INAREA-B_SQUAD_GUARD-NEAR_HR_PASS || ISDEAD-B_SQUAD_GUARD) && (INAREA-B_SQUAD_GRUNT_1-NEAR_HR_PASS || ISDEAD-B_SQUAD_GRUNT_1) && (INAREA-B_SQUAD_GRUNT_2-NEAR_HR_PASS || ISDEAD-B_SQUAD_GRUNT_2)
			// everyone is either here or they're dead, so let's go
			Set gt_B_SQUAD_STAGE 16
			IF !ISDEAD-B_SQUAD_GUARD
				RemoveC B_SQUAD_GUARD
				Add gt_B_SQUAD_GUARD_OFFMAP
			ENDIF
			IF !ISDEAD-B_SQUAD_GRUNT_1
				DeleteObjectsInBackpackWithID B_SQUAD_GRUNT_1 diingot
				RemoveC B_SQUAD_GRUNT_1
				Add gt_B_SQUAD_GRUNT_1_OFFMAP
			ENDIF
			IF !ISDEAD-B_SQUAD_GRUNT_2
				DeleteObjectsInBackpackWithID B_SQUAD_GRUNT_2 diingot
				RemoveC B_SQUAD_GRUNT_2
				Add gt_B_SQUAD_GRUNT_2_OFFMAP
			ENDIF
			//init timer for re-appearance
			Set gt_B_SQUAD_TIMER 0
		ELSE
			//still waiting for someone, get them over here
			MoveC B_SQUAD_GUARD		pTRADE_ROUTE_1R_1
			MoveC B_SQUAD_GRUNT_1	pTRADE_ROUTE_1R_2
			MoveC B_SQUAD_GRUNT_2	pTRADE_ROUTE_1R_3
		ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
END
		








/////////////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////////////////////
//	END OF BRIGAND TRADING OPERATIONS
/////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////////////////////

VIG CheckFarmerAreHome mj_FREED_FARMERS && TENSEC
	LogOff
	

	IF INAREA-AAMON-FH3
		Add gd_ARRIVED_HOME_AAMON
	ENDIF

	IF INAREA-BERRY-BARN1
		Add gd_ARRIVED_HOME_BERRY
	ENDIF

	IF INAREA-BRAN-FH2
		Add gd_ARRIVED_HOME_BRAN
	ENDIF

	IF INAREA-DEK-FH1
		Add gd_ARRIVED_HOME_DEK
	ENDIF

	IF INAREA-LIZ-FH1
		Add gd_ARRIVED_HOME_LIZ
	ENDIF

	IF INAREA-LORNA-FH2
		Add gd_ARRIVED_HOME_LORNA
	ENDIF

	IF INAREA-MARGE-FH3
		Add gd_ARRIVED_HOME_MARGE
	ENDIF

	IF INAREA-SAMANTHA-BARN2
		Add gd_ARRIVED_HOME_SAMANTHA
	ENDIF

	LogOn
END

/////////////////////////////////////////////////////////////////////
// TALK TO FARMERS
/////////////////////////////////////////////////////////////////////

VIG SetupBran   FIVESEC && gd_ARRIVED_HOME_BRAN=0 && CC-BRAN
    Lock        BRAN
    AddControl  BRAN    Capture cM_TALK_REFER_OTHER_PERSON1
    AddControl  BRAN    Capture cM_TALK_GENERAL1
    AddControl  BRAN    Capture cM_TALK_GENERAL2
    AddControl  BRAN    Capture cM_V16_LAUGHING_NORMAL1
    SequenceRandomlySelects BRAN
    AddFilter   BRAN    KeepPositionD   pBRAN_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_BRAN    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerBran MSG-iBRAN

	Widescreen TRUE
    Unlock          BRAN

	EngageAndFace P BRAN

	IF LANG-English || LANG-German
		Say fa8001  FARMERM1.BIN
	ELSE
		Say fa1003  FARMERM1.BIN
	ENDIF

	MoveCDir BRAN pBRAN_IN_FARM_HOUSE
    Remove gd_ARRIVED_HOME_BRAN
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG SetupAamon   FIVESEC && gd_ARRIVED_HOME_AAMON=0 && CC-AAMON
    Lock        AAMON
    AddControl  AAMON    Capture cM_TALK_QUESTION2
    AddControl  AAMON    Capture cM_TALK_GENERAL2
    SequenceRandomlySelects AAMON
    AddFilter   AAMON    KeepPositionD   pAAMON_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_AAMON    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerAamon MSG-iAAMON
    Unlock          AAMON

	Widescreen TRUE
	EngageAndFace P AAMON

	
	IF LANG-English || LANG-German
		Say fa8001 FARMERM2.BIN
	ELSE
		Say fa6002  FARMERM2.BIN
	ENDIF

	MoveCDir AAMON pAAMON_IN_FARM_HOUSE
    Remove gd_ARRIVED_HOME_AAMON
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG SetupBerry   FIVESEC && gd_ARRIVED_HOME_BERRY=0 && CC-BERRY
    Lock        BERRY
    AddControl  BERRY    Capture    cM_STAND_AT_EASE1
    AddControl  BERRY    Capture    cM_STAND_AT_EASE2
    AddControl  BERRY    Capture    cM_STAND_AT_EASE3
    AddControl  BERRY    Capture    cM_STAND_AT_EASE4
    SequenceRandomlySelects BERRY
    AddFilter   BERRY    KeepPositionD   pBERRY_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_BERRY    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerBerry MSG-iBERRY
    Unlock  BERRY

	Widescreen TRUE
	EngageAndFace P BERRY

	Say fa8001  FARMERM3.BIN

	MoveCDir BERRY pBERRY_IN_FARM_HOUSE
    Remove gd_ARRIVED_HOME_BERRY
	Widescreen FALSE

END

/////////////////////////////////////////////////////////////////////

VIG SetupSamantha   FIVESEC && gd_ARRIVED_HOME_SAMANTHA=0 && CC-SAMANTHA
    Lock        SAMANTHA
    AddControl  SAMANTHA    Capture cF_EATING
    AddControl  SAMANTHA    Capture cF_STAND_AT_EASE
    AddControl  SAMANTHA    Capture cF_STAND_AT_EASE2
    AddControl  SAMANTHA    Capture cF_FIDDLE_AT_WAIST_LEVEL
    SequenceRandomlySelects SAMANTHA
    AddFilter   SAMANTHA    KeepPositionD   pSAMANTHA_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_SAMANTHA    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerSamantha MSG-iSAMANTHA
    Unlock      SAMANTHA

	Widescreen TRUE
	EngageAndFace P SAMANTHA

	Say fa2002  FARMERF1.BIN

	MoveCDir SAMANTHA pSAMANTHA_IN_FARM_HOUSE
    Remove gd_ARRIVED_HOME_SAMANTHA
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG SetupLorna   FIVESEC && gd_ARRIVED_HOME_LORNA=0 && CC-LORNA
    Lock        LORNA
    AddControl  LORNA    Capture cF_LAUGHING1_GENTLEA
    AddControl  LORNA    Capture cF_TALK_GENERAL1
    AddControl  LORNA    Capture cF_TALK_GENERAL2
    AddControl  LORNA    Capture cF_LAUGHING4_NORMALB
    SequenceRandomlySelects LORNA
    AddFilter   LORNA    KeepPositionD   pLORNA_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_LORNA    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerLorna MSG-iLORNA
	Widescreen TRUE
    Unlock      LORNA

	EngageAndFace P LORNA

	Say fa2002  FARMERF2.BIN

	MoveCDir LORNA pLORNA_IN_FARM_HOUSE
    Remove  gd_ARRIVED_HOME_LORNA
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG SetupLiz   FIVESEC && gd_ARRIVED_HOME_LIZ=0 && CC-LIZ
    Lock        LIZ
    AddControl  LIZ    Capture cM_TALK_QUESTION2
    AddControl  LIZ    Capture cM_TALK_DISAGREE2
    AddControl  LIZ    Capture cM_TALK_REFER_SELF2
    AddControl  LIZ    Capture cM_TALK_WARNING1
    SequenceRandomlySelects LIZ
    AddFilter   LIZ    KeepPositionD   pLIZ_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_LIZ    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerLiz MSG-iLIZ
	Widescreen TRUE
    Unlock      LIZ

	EngageAndFace P LIZ

	Say fa7001  FARMERF3.BIN

	MoveCDir LIZ pLIZ_IN_FARM_HOUSE
    Remove  gd_ARRIVED_HOME_LIZ
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG SetupDek   FIVESEC && gd_ARRIVED_HOME_DEK=0 && CC-DEK
    Lock        DEK
    AddControl  DEK    Capture cM_TALK_AGREE3
    AddControl  DEK    Capture cM_TALK_GENERAL3_FEET
    AddControl  DEK    Capture cM_TALK_CREEP_BEG1
    AddControl  DEK    Capture cM_TALK_AGREE1
    SequenceRandomlySelects DEK
    AddFilter   DEK    KeepPositionD   pDEK_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_DEK    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerDek MSG-iDEK
    Unlock      DEK

	Widescreen TRUE
	EngageAndFace P DEK

	IF LANG-English || LANG-German
		Say fa8001  FARMERM4.BIN
	ELSE
		Say fa1003  FARMERM4.BIN
	ENDIF

	MoveCDir DEK pDEK_IN_FARM_HOUSE
    Remove  gd_ARRIVED_HOME_DEK
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG SetupMarge   FIVESEC && gd_ARRIVED_HOME_MARGE=0 && CC-MARGE
    Lock        MARGE
    AddControl  MARGE    Capture cF_WIPE_BROW1
    AddControl  MARGE    Capture cF_TALK_GENERAL4
    AddControl  MARGE    Capture cF_CURSE_WEATHER5
    AddControl  MARGE    Capture cF_TALK_GENERAL3
    AddControl  MARGE    Capture cF_TALK_GENERAL2
    SequenceRandomlySelects MARGE
    AddFilter   MARGE    KeepPositionD   pMARGE_IN_FARM_HOUSE

    AddTo   gd_ARRIVED_HOME_MARGE    1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmerMarge MSG-iMARGE
	Widescreen TRUE
    Unlock      MARGE

	EngageAndFace P MARGE

	Say fa9001  FARMERF4.BIN

	MoveCDir MARGE pMARGE_IN_FARM_HOUSE
    Remove  gd_ARRIVED_HOME_MARGE
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG Farmer1Work   FIVESEC && gd_WM_FARMER_1=0 && CC-WM_FARMER_1
    AddControl  WM_FARMER_1    MoveCDir    pFARMER_1C
    AddControl  WM_FARMER_1    Capture cF_KNEEL_FUMBLE
    AddControl  WM_FARMER_1    MoveCDir    pFARMER_1D
    AddControl  WM_FARMER_1    Capture cF_HAVE_A_STRETCH_FORWARD
    AddControl  WM_FARMER_1    MoveCDir    pFARMER_1A
    AddControl  WM_FARMER_1    Capture cF_KNEEL_FUMBLE
    AddControl  WM_FARMER_1    MoveCDir    pFARMER_1B
    AddControl  WM_FARMER_1    Capture cF_HAVE_A_STRETCH_UP
    SequenceLoops WM_FARMER_1

    AddTo   gd_WM_FARMER_1  1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmer1 MSG-iWM_FARMER_1

	Widescreen TRUE
	EngageAndFace P WM_FARMER_1

	Say fa7001  FARMERF1.BIN

    MoveCDir    WM_FARMER_1  pFARMER_1A
    Set  gd_WM_FARMER_1 0
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG Farmer2Work   FIVESEC && gd_WM_FARMER_2=0 && CC-WM_FARMER_2
    Lock        WM_FARMER_2
    AddControl  WM_FARMER_2    Capture cM_GUARD_STAND1
    AddControl  WM_FARMER_2    Capture cM_GUARD_STAND2
    AddControl  WM_FARMER_2    Capture cM_GUARD_STAND3
    SequenceRandomlySelects WM_FARMER_2
    AddFilter   WM_FARMER_2    KeepPositionD   pFARMER_2

    AddTo   gd_WM_FARMER_2  1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmer2 MSG-iWM_FARMER_2
	Widescreen TRUE
    Unlock      WM_FARMER_2

	EngageAndFace P WM_FARMER_2

	IF LANG-English || LANG-German
		Say fa8001  FARMERM2.BIN
	ELSE
		Say fa1003  FARMERM2.BIN
	ENDIF

    MoveCDir    WM_FARMER_2  pFARMER_2
    Set  gd_WM_FARMER_2 0
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG Farmer3Work   FIVESEC && gd_WM_FARMER_3=0 && CC-WM_FARMER_3
    AddControl  WM_FARMER_3    Capture cM_PICK_GROUND
    AddControl  WM_FARMER_3    Capture cM_GUARD_STAND2
    SequenceRandomlySelects WM_FARMER_3

    AddTo   gd_WM_FARMER_3  1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmer3 MSG-iWM_FARMER_3
	Widescreen TRUE
	EngageAndFace P WM_FARMER_3

	Say fa9001  FARMERF3.BIN

    MoveCDir    WM_FARMER_3  pFARMER_3
    Set  gd_WM_FARMER_3 0
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG Farmer4Work   FIVESEC && gd_WM_FARMER_4=0 && CC-WM_FARMER_4
    AddControl  WM_FARMER_4    MoveCDir pFARMER_4B
    AddControl  WM_FARMER_4    MoveCDir pFARMER_4A
    SequenceRandomlySelects WM_FARMER_4
	SwitchOnSightOfPlayer WM_FARMER_4 LookAtTurnFollow P

    AddTo   gd_WM_FARMER_4  1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmer4 MSG-iWM_FARMER_4

	Widescreen TRUE
	EngageAndFace P WM_FARMER_4

	Say fa2002  FARMERF2.BIN

    Set  gd_WM_FARMER_4 0
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG Farmer5Work   FIVESEC && gd_WM_FARMER_5=0 && CC-WM_FARMER_5
    AddControl  WM_FARMER_5    Capture cM_PICK_GROUND
    AddControl  WM_FARMER_5    Capture cM_GUARD_STAND2
    SequenceRandomlySelects WM_FARMER_5

    AddTo   gd_WM_FARMER_5  1
END

/////////////////////////////////////////////////////////////////////

VIG TalkToFarmer5 MSG-iWM_FARMER_5
	Widescreen TRUE
	EngageAndFace P WM_FARMER_5

	Say fa8001  FARMERM2.BIN

    MoveCDir    WM_FARMER_5  pFARMER_5
    Set  gd_WM_FARMER_5 0
	Widescreen FALSE
END

/////////////////////////////////////////////////////////////////////

VIG PlayCoo FALSE
	SWITCH FLAG-gd_DOVE_FLIGHT
		CASE 0
			// Only play the dove sfx when the player has no done the quest
			IF !f_REMOVED_DOVE
				PlaySFXPosid coo.wav pDOVE_START
			ENDIF
		CASE 1
			PlaySFXPosid coo.wav pDOVE_LAND_1A
		CASE 2
			PlaySFXPosid coo.wav pDOVE_LAND_1B
		CASE 3
			PlaySFXPosid coo.wav pDOVE_LAND_2A
		CASE 4
			PlaySFXPosid coo.wav pDOVE_LAND_2B
		CASE 5
			PlaySFXPosid coo.wav pDOVE_LAND_3A
		CASE 6
			PlaySFXPosid coo.wav pDOVE_LAND_3B
		CASE 7
			PlaySFXPosid coo.wav pDOVE_LAND_4A
		CASE 8
			PlaySFXPosid coo.wav pDOVE_LAND_4B
		CASE 9
			PlaySFXPosid coo.wav pDOVE_LAND_5
		CASE 10
			PlaySFXPosid coo.wav pDOVE_LAND_5
	ENDSWITCH
END

/////////////////////////////////////////////////////////////////////

VIG PigeonCoos ONESEC && gg_COO

	SWITCH FLAG-gg_COO_STATE
		CASE 0
			RunS PlayCoo
		CASE 2
			RunS PlayCoo
		CASE 4
			RunS PlayCoo
	ENDSWITCH

	AddTo gg_COO_STATE 1
	IF gg_COO_STATE>8
		Set gg_COO_STATE 0
	ENDIF
END

/////////////////////////////////////////////////////////////////////
