/////////////////////////////////////////////////////////////////////
// DIAMOND.S - Diamond Iron Mines
/////////////////////////////////////////////////////////////////////

SETUP

	SetDoorSpeed dcart 100

	IF gt_CLEAR_MINES && !gt_MINES_CLEAR
		Add gt_MINES_CLEAR

        KillC  DI_BRIG_01
        KillC  DI_BRIG_02
        KillC  DI_BRIG_03
        KillC  DI_BRIG_04
        KillC  DI_BRIG_05
        KillC  DI_BRIG_06
        KillC  DI_BRIG_07
        KillC  DI_BRIG_08
        KillC  DI_BRIG_09
        KillC  DI_BRIG_10
        KillC  DI_BRIG_11
        KillC  DI_BRIG_12
        KillC  DI_BRIG_13
        KillC  DI_BRIG_14
        KillC  DI_BRIG_15
        KillC  DI_BRIG_16
        KillC  DI_BRIG_17
        KillC  DI_BRIG_18

	    KillC  BRAN
	    KillC 	SAMANTHA
	    KillC 	DEK
	    KillC 	MARGE
	    KillC 	BERRY
	    KillC 	LORNA
	    KillC 	LIZ
	    KillC 	AAMON
		KillC  FARMER_KEY

        KillC  SLAVER_BEAST_1
        KillC  SLAVER_BEAST_2
        KillC  SLAVER_BEAST_3
        KillC  SLAVER_BEAST_4
        KillC  SLAVER_BEAST_5
        KillC  SLAVER_BEAST_6

        // KillC  SLAVER_MASTER
		// Don't remove Comoro until Gargos has been defeated at Talendrah
		// that way the player can still kill him and get the key to the
		// mine cart. Even if he is on his tod.
	ENDIF

    IF mj_DEFEAT_GARGOS_2
        IF !gd_PLACED_DI_DK
            Add gd_PLACED_DI_DK

            // just in case remove everyone who was here once.
            IF gt_PLACED_DI_DENIZENS
                KillC  SLAVER_BEAST_1
                KillC  SLAVER_BEAST_2
                KillC  SLAVER_BEAST_3
                KillC  SLAVER_BEAST_4
                KillC  SLAVER_BEAST_5
                KillC  SLAVER_BEAST_6
                //KillC  SLAVER_MASTER
            ENDIF

            IF gd_PLACED_BRIGAND_MINERS
                KillC  DI_BRIGB_1
                KillC  DI_BRIGB_2
                KillC  DI_BRIGB_3
                KillC  DI_BRIGB_4
                KillC  DI_BRIGB_5
                KillC  DI_BRIGB_6
                KillC  DI_BRIGB_7
                KillC  DI_BRIGB_8
                KillC  DI_BRIGB_9
                KillC  DI_BRIGB_10

                KillC  DI_MINER_1
                KillC  DI_MINER_2
                KillC  DI_MINER_3
                KillC  DI_MINER_4
                KillC  DI_MINER_5
                KillC  DI_MINER_6
                KillC  DI_MINER_7
                KillC  DI_MINER_8
                KillC  DI_MINER_9
                KillC  DI_MINER_10
            ELSE
                KillC  DI_BRIG_01
                KillC  DI_BRIG_02
                KillC  DI_BRIG_03
                KillC  DI_BRIG_04
                KillC  DI_BRIG_05
                KillC  DI_BRIG_06
                KillC  DI_BRIG_07
                KillC  DI_BRIG_08
                KillC  DI_BRIG_09
                KillC  DI_BRIG_10
                KillC  DI_BRIG_11
                KillC  DI_BRIG_12
                KillC  DI_BRIG_13
                KillC  DI_BRIG_14
                KillC  DI_BRIG_15
                KillC  DI_BRIG_16
                KillC  DI_BRIG_17
                KillC  DI_BRIG_18

	            KillC  BRAN
	            KillC 	SAMANTHA
	            KillC 	DEK
	            KillC 	MARGE
	            KillC 	BERRY
	            KillC 	LORNA
	            KillC 	LIZ
	            KillC 	AAMON
				KillC  FARMER_KEY
            ENDIF

            PlaceC                  DI_DK_1     pDI_DK_1
            Wander                  DI_DK_1 
            AddFilter               DI_DK_1     DontGoFarFrom   6000 9000 pDI_DK_1
            SwitchOnSightOfPlayer   DI_DK_1     AttackDemo2

            PlaceC                  DI_DK_2     pDI_DK_2
            Wander                  DI_DK_2 
            AddFilter               DI_DK_2     DontGoFarFrom   6000 9000 pDI_DK_2
            SwitchOnSightOfPlayer   DI_DK_2     AttackDemo2

            PlaceC                  DI_DK_3     pDI_DK_3
            Wander                  DI_DK_3 
            AddFilter               DI_DK_3     DontGoFarFrom   6000 9000 pDI_DK_3
            SwitchOnSightOfPlayer   DI_DK_3     AttackDemo2

            PlaceC                  DI_DK_4     pDI_DK_4
            Wander                  DI_DK_4 
            AddFilter               DI_DK_4     DontGoFarFrom   6000 9000 pDI_DK_4
            SwitchOnSightOfPlayer   DI_DK_4     AttackDemo2

            PlaceC                  DI_DK_5     pDI_DK_5
            Wander                  DI_DK_5 
            AddFilter               DI_DK_5     DontGoFarFrom   6000 9000 pDI_DK_5
            SwitchOnSightOfPlayer   DI_DK_5     AttackDemo2

            PlaceC                  DI_DK_6     pDI_DK_6
            Wander                  DI_DK_6 
            AddFilter               DI_DK_6     DontGoFarFrom   6000 9000 pDI_DK_6
            SwitchOnSightOfPlayer   DI_DK_6     AttackDemo2

            PlaceC                  DI_DK_7     pDI_DK_7
            Wander                  DI_DK_7 
            AddFilter               DI_DK_7     DontGoFarFrom   6000 9000 pDI_DK_7
            SwitchOnSightOfPlayer   DI_DK_7     AttackDemo2

            PlaceC                  DI_DK_8     pDI_DK_8
            Wander                  DI_DK_8 
            AddFilter               DI_DK_8     DontGoFarFrom   6000 9000 pDI_DK_8
            SwitchOnSightOfPlayer   DI_DK_8     AttackDemo2

            PlaceC                  DI_DK_9     pDI_DK_9
            AddControl              DI_DK_9     Capture     cM_GUARD_STAND1
            AddControl              DI_DK_9     Capture     cM_GUARD_STAND2
            AddControl              DI_DK_9     Capture     cM_GUARD_STAND3
            SequenceRandomlySelects DI_DK_9
            SwitchOnSightOfPlayer   DI_DK_9     AttackDemo2

            PlaceC                  DI_DK_10    pDI_DK_10
            AddControl              DI_DK_10    Capture     cM_TALK_REFER_OTHER_PERSON1
            AddControl              DI_DK_10    Capture     cM_TALK_DISAGREE2
            AddControl              DI_DK_10    Capture     cM_TALK_WARNING2
            AddControl              DI_DK_10    Capture     cM_TALK_REFER_LEFT2
            SequenceRandomlySelects DI_DK_10
            SwitchOnSightOfPlayer   DI_DK_10    AttackDemo2

            PlaceC                  DI_DK_11    pDI_DK_11
            AddControl              DI_DK_11    Capture     cM_TALK_THREATEN1
            AddControl              DI_DK_11    Capture     cM_TALK_AGREE1
            AddControl              DI_DK_11    Capture     cM_TALK_SURPRISE1
            AddControl              DI_DK_11    Capture     cM_TALK_REFER_RIGHT1
            SequenceRandomlySelects DI_DK_11
            SwitchOnSightOfPlayer   DI_DK_11    AttackDemo2

            PlaceC                  DI_DK_12    pDI_DK_12
            Wander                  DI_DK_12
            AddFilter               DI_DK_12    DontGoFarFrom   6000 9000 pDI_DK_12
            SwitchOnSightOfPlayer   DI_DK_12    AttackDemo2

            PlaceC                  DI_DK_13    pDI_DK_13
            Wander                  DI_DK_13
            AddFilter               DI_DK_13    DontGoFarFrom   6000 9000 pDI_DK_13
            SwitchOnSightOfPlayer   DI_DK_13    AttackDemo2

            PlaceC                  DI_DK_14    pDI_DK_14
            Wander                  DI_DK_14
            AddFilter               DI_DK_14    DontGoFarFrom   6000 9000 pDI_DK_14
            SwitchOnSightOfPlayer   DI_DK_14    AttackDemo2

            PlaceC                  DI_DK_15    pDI_DK_15
            Wander                  DI_DK_15
            AddFilter               DI_DK_15    DontGoFarFrom   6000 9000 pDI_DK_15
            SwitchOnSightOfPlayer   DI_DK_15    AttackDemo2

			
			IF !ISDEAD-SLAVER_MASTER
				KillC SLAVER_MASTER
				//After defeating Gargos at Talendrah the Raal has found the Skull of Alchemy...

				DeleteObjectsInWorldWithID skull

				//...he has opened the necessary doors and wants to leave with the skull...

				RemoveC DI_RAAL
				ResetStats DI_RAAL
				PlaceC DI_RAAL pMINE_SMASTER_NO
				AwardOb DI_RAAL skull last-chance
				SetWalkType DI_RAAL run
				EngagePoint DI_RAAL pPKEY 250
				AddControl DI_RAAL AttackDemo2

				Add gd_OPENED_SECRET
				Add gd_ANGRY_BEASTS
				Add gt_DONT_FEAR_THE_RAAL
				IdoorOpen didol
				IdoorOpen dcart

			ENDIF
		ELSE

			IF !gt_DONT_FEAR_THE_RAAL
				//Player has left the mines and the emoors maps since the Raal was placed, so it got away.
				KillC DI_RAAL
			ENDIF

        ENDIF
    ELSE
	    IF !gt_PLACED_DI_DENIZENS

		    Add gt_PLACED_DI_DENIZENS

		    // *** PLACE BRIGANDS ***

		    PlaceC  DI_BRIG_01 pDI_BRIG_01_START
            RestrictedWanderButAttackOnSight    DI_BRIG_01
		    PlaceC  DI_BRIG_02 pDI_BRIG_02_START
            RestrictedWanderButAttackOnSight    DI_BRIG_02
		    PlaceC  DI_BRIG_03 pDI_BRIG_03_START
            RestrictedWanderButAttackOnSight    DI_BRIG_03
		    PlaceC  DI_BRIG_04 pDI_BRIG_04_START
            RestrictedWanderButAttackOnSight    DI_BRIG_04
		    PlaceC  DI_BRIG_05 pDI_BRIG_05_START
            RestrictedWanderButAttackOnSight    DI_BRIG_05

		    PlaceC  DI_BRIG_06 pDI_BRIG_06_START
            AddControl  DI_BRIG_06  MoveCDir    pDI_BRIG_06B
            AddControl  DI_BRIG_06  MoveCDir    pDI_BRIG_06_START
            SequenceLoops   DI_BRIG_06
            SwitchOnSightOfPlayer   DI_BRIG_06  SetScriptFlagControl    gd_DI_BRIG_06_ATTACK

		    PlaceC  DI_BRIG_07 pDI_BRIG_07_START
            AddControl  DI_BRIG_07  MoveCDir    pDI_BRIG_07B
            AddControl  DI_BRIG_07  MoveCDir    pDI_BRIG_07_START
            SequenceLoops   DI_BRIG_07
            SwitchOnSightOfPlayer   DI_BRIG_07  SetScriptFlagControl    gd_DI_BRIG_07_ATTACK

		    PlaceC  DI_BRIG_08 pDI_BRIG_08_START
            RestrictedWanderButAttackOnSight    DI_BRIG_08
		    PlaceC  DI_BRIG_09 pDI_BRIG_09_START
            RestrictedWanderButAttackOnSight    DI_BRIG_09
		    PlaceC  DI_BRIG_10 pDI_BRIG_10_START
            RestrictedWanderButAttackOnSight    DI_BRIG_10
		    PlaceC  DI_BRIG_11 pDI_BRIG_11_START
            RestrictedWanderButAttackOnSight    DI_BRIG_11
		    PlaceC  DI_BRIG_12 pDI_BRIG_12_START
            RestrictedWanderButAttackOnSight    DI_BRIG_12
		    PlaceC  DI_BRIG_13 pDI_BRIG_13_START
            RestrictedWanderButAttackOnSight    DI_BRIG_13
		    PlaceC  DI_BRIG_14 pDI_BRIG_14_START
            RestrictedWanderButAttackOnSight    DI_BRIG_14

		    PlaceC  DI_BRIG_15 pDI_BRIG_15_START
            AddControl  DI_BRIG_15  MoveCDir    pDI_BRIG_15B
            AddControl  DI_BRIG_15  MoveCDir    pDI_BRIG_15_START
            SequenceLoops   DI_BRIG_15
            SwitchOnSightOfPlayer   DI_BRIG_15  SetScriptFlagControl    gd_DI_BRIG_15_ATTACK

		    PlaceC  DI_BRIG_16 pDI_BRIG_16_START
            RestrictedWanderButAttackOnSight    DI_BRIG_16

		    PlaceC  DI_BRIG_17 pDI_BRIG_17_START
            RestrictedWanderButAttackOnSight    DI_BRIG_17
		    PlaceC  DI_BRIG_18 pDI_BRIG_18_START
            RestrictedWanderButAttackOnSight    DI_BRIG_18
		    PlaceC  DI_BRIG_19 pDI_BRIG_19_START
            RestrictedWanderButAttackOnSight    DI_BRIG_19
		    PlaceC  DI_BRIG_00 pDI_BRIG_20_START
            RestrictedWanderButAttackOnSight    DI_BRIG_00

		    PlaceC  SLAVER_BEAST_1      pSLAVER_BEAST_1_START
            AddControl  SLAVER_BEAST_1  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_1  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_1  Capture cM_GUARD_STAND3
            SequenceRandomlySelects SLAVER_BEAST_1
            AddFilter   SLAVER_BEAST_1  KeepPositionD   pSLAVER_BEAST_1_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_1  AttackDemo2

		    PlaceC  SLAVER_BEAST_2 pSLAVER_BEAST_2_START
            AddControl  SLAVER_BEAST_2  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_2  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_2  Capture cM_GUARD_STAND3
            SequenceRandomlySelects SLAVER_BEAST_2
            AddFilter   SLAVER_BEAST_2  KeepPositionD   pSLAVER_BEAST_2_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_2  AttackDemo2

		    PlaceC  SLAVER_BEAST_3 pSLAVER_BEAST_3_START
            AddControl  SLAVER_BEAST_3  Capture cM_V16_DANCE_AROUND_POINT1
            AddControl  SLAVER_BEAST_3  Capture cM_V16_DANCE_AROUND_POINT2
            AddControl  SLAVER_BEAST_3  Capture cM_V16_DANCE_AROUND_POINT3
            AddControl  SLAVER_BEAST_3  MoveC   pSLAVER_BEAST_3_START
            SequenceLoops           SLAVER_BEAST_3
            SwitchOnSightOfPlayer   SLAVER_BEAST_3  AttackDemo2

		    PlaceC  SLAVER_BEAST_4 pSLAVER_BEAST_4_START
            AddControl  SLAVER_BEAST_4  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_4  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_4  Capture cM_GUARD_STAND3
            SequenceRandomlySelects SLAVER_BEAST_4
            AddFilter   SLAVER_BEAST_4  KeepPositionD   pSLAVER_BEAST_4_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_4  AttackDemo2

		    PlaceC  SLAVER_BEAST_5 pSLAVER_BEAST_5_START
            AddControl  SLAVER_BEAST_5  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_5  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_5  Capture cM_GUARD_STAND3
            AddControl  SLAVER_BEAST_5  Capture cM_CLUTCH_HEAD
            SequenceRandomlySelects SLAVER_BEAST_5
            AddFilter   SLAVER_BEAST_5  KeepPositionD   pSLAVER_BEAST_5_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_5  AttackDemo2

		    PlaceC  SLAVER_BEAST_6 pSLAVER_BEAST_6_START
            AddControl  SLAVER_BEAST_6  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_6  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_6  Capture cM_GUARD_STAND3
            SequenceRandomlySelects SLAVER_BEAST_6
            AddFilter   SLAVER_BEAST_6  KeepPositionD   pSLAVER_BEAST_6_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_6  AttackDemo2

		    PlaceC  SLAVER_BEAST_7 pSLAVER_BEAST_7_START
            AddControl  SLAVER_BEAST_7  Capture cM_GUARD_STAND1
            AddControl  SLAVER_BEAST_7  Capture cM_GUARD_STAND2
            AddControl  SLAVER_BEAST_7  Capture cM_GUARD_STAND3
            SequenceRandomlySelects SLAVER_BEAST_7
            AddFilter   SLAVER_BEAST_7  KeepPositionD   pSLAVER_BEAST_7_START
            SwitchOnSightOfPlayer   SLAVER_BEAST_7  AttackDemo2

		    PlaceC	SLAVER_MASTER pSLAVER_MASTER_START
            AddControl  SLAVER_MASTER Capture cM_CRACK_WHIP
            AddControl  SLAVER_MASTER Capture cM_TALK_THREATEN1
            AddControl  SLAVER_MASTER Capture cM_V16_HANDS_HIPS_LOOK_AROUND1
            AddControl  SLAVER_MASTER MoveCDir pSLAVER_MASTER_START
            AddControl  SLAVER_MASTER MoveCDir pSLAVE_MASTER_2
            AddControl  SLAVER_MASTER MoveCDir pSLAVE_MASTER_3
            SequenceRandomlySelects SLAVER_MASTER
            SwitchOnSightOfPlayer   SLAVER_MASTER   SetScriptFlagControl    gd_SLAVE_MASTER_ATTACK

		    // *** PLACE FARMERS ***

		    PlaceC		BRAN		pBRAN_START
            AddControl  BRAN        Capture cM_PICKAXE1 notify 325 PickAxeBran
            AddControl  BRAN        Capture cM_PICKAXE2 notify 350 PickAxeBran
			AddControl	BRAN		DelayControl 1 1
            SequenceRandomlySelects BRAN
            AddFilter   BRAN        KeepPositionD   pBRAN_START
            Lock        BRAN

		    PlaceC		AAMON		pAAMON_START
            AddControl  AAMON		Capture  cM_DIG notify 180 DigAamon
			AddControl	AAMON		DelayControl 1 1
            SequenceRandomlySelects AAMON
            AddFilter   AAMON        KeepPositionD   pAAMON_START
            Lock        AAMON

		    PlaceC		BERRY		pBERRY_START
            AddControl  BERRY       Capture cM_PICKAXE1 notify 325 PickAxeBerry
            AddControl  BERRY       Capture cM_PICKAXE2 notify 350 PickAxeBerry
			AddControl	BERRY		DelayControl 1 1
            SequenceRandomlySelects BERRY
            AddFilter   BERRY        KeepPositionD   pBERRY_START
            Lock        BERRY

		    PlaceC		SAMANTHA	pSAMANTHA_START
            AddControl  SAMANTHA        Capture  cF_SHOVELLING notify 180 DigSam
			AddControl	SAMANTHA		DelayControl 1 1
            SequenceRandomlySelects SAMANTHA
            AddFilter   SAMANTHA        KeepPositionD   pSAMANTHA_START
            Lock        SAMANTHA

		    PlaceC		LORNA		pLORNA_START
            AddControl  LORNA		Capture  cM_DIG notify 180 DigLorna
			AddControl	LORNA		DelayControl 1 1
            SequenceRandomlySelects LORNA
            AddFilter   LORNA        KeepPositionD   pLORNA_START
            Lock        LORNA

		    PlaceC		LIZ			pLIZ_START
            AddControl  LIZ			Capture  cF_SHOVELLING notify 180 DigLiz
			AddControl	LIZ			DelayControl 1 1
            SequenceRandomlySelects LIZ
            AddFilter   LIZ        KeepPositionD   pLIZ_START
            Lock        LIZ

		    PlaceC		DEK			pDEK_START
            AddControl  DEK			Capture cM_PICKAXE1 notify 325 PickAxeDek
            AddControl  DEK			Capture cM_PICKAXE2 notify 350 PickAxeDek
			AddControl	DEK			DelayControl 1 1
            SequenceRandomlySelects DEK
            AddFilter   DEK        KeepPositionD   pDEK_START
            Lock        DEK

		    PlaceC		MARGE		pMARGE_START
            AddControl  MARGE       Capture cF_SEE_OBJ_ON_FLOOR_B1
            AddControl  MARGE       Capture cF_SEE_OBJ_ON_FLOOR_C1
            AddControl  MARGE       Capture cF_SEE_OBJ_ON_FLOOR_B1
            AddControl  MARGE       Capture cF_SEE_OBJ_ON_FLOOR_C1
            AddControl  MARGE       Capture cF_WIPE_BROW1
            SequenceLoops MARGE
            AddFilter   MARGE        KeepPositionD   pMARGE_START
            Lock        MARGE

            PlaceC      DI_RAAL     pDI_RAAL_START
            AddControl  DI_RAAL     MoveCDir    pDI_RAAL_2
            AddControl  DI_RAAL     Capture     cM_V16_HANDS_HIPS_LOOK_AROUND2
            AddControl  DI_RAAL     MoveCDir    pDI_RAAL_3
            AddControl  DI_RAAL     Capture     cM_LOOK_AROUND_HANDS_HIPS2
            AddControl  DI_RAAL     MoveCDir    pDI_RAAL_4
            AddControl  DI_RAAL     Capture     cM_V16_HANDS_HIPS_LOOK_AROUND1
            AddControl  DI_RAAL     MoveCDir    pDI_RAAL_START
            AddControl  DI_RAAL     Capture     cM_LOOK_AROUND_HANDS_HIPS1
            SequenceLoops   DI_RAAL
            //SwitchOnSightOfPlayer   DI_RAAL AttackDemo2

            IdoorClosed didol
            IdoorLocked didol

        ELSE
            IF gt_CLEAR_MINES && mj_FREED_FARMERS && !gd_PLACED_BRIGAND_MINERS

                Add     gd_PLACED_BRIGAND_MINERS

                KillC  DI_BRIG_01
                KillC  DI_BRIG_02
                KillC  DI_BRIG_03
                KillC  DI_BRIG_04
                KillC  DI_BRIG_05
                KillC  DI_BRIG_06
                KillC  DI_BRIG_07
                KillC  DI_BRIG_08
                KillC  DI_BRIG_09
                KillC  DI_BRIG_10
                KillC  DI_BRIG_11
                KillC  DI_BRIG_12
                KillC  DI_BRIG_13
                KillC  DI_BRIG_14
                KillC  DI_BRIG_15
                KillC  DI_BRIG_16
                KillC  DI_BRIG_17
                KillC  DI_BRIG_18

	            KillC  BRAN
	            KillC 	SAMANTHA
	            KillC 	DEK
	            KillC 	MARGE
	            KillC 	BERRY
	            KillC 	LORNA
	            KillC 	LIZ
	            KillC 	AAMON
				KillC  FARMER_KEY

                PlaceC  DI_BRIGB_1    pDI_BRIGB_1A
                AddControl  DI_BRIGB_1  MoveCDir    pDI_BRIGB_1B
                AddControl  DI_BRIGB_1  Capture     cM_GUARD_STAND2
                AddControl  DI_BRIGB_1  MoveCDir    pDI_BRIGB_1A
                AddControl  DI_BRIGB_1  Capture     cM_GUARD_STAND2
                SequenceLoops   DI_BRIGB_1
                SwitchOnSightOfPlayer   DI_BRIGB_1  AttackDemo2

                PlaceC  DI_BRIGB_2    pDI_BRIGB_2
                RestrictedWanderButAttackOnSight    DI_BRIGB_2
            
                PlaceC  DI_BRIGB_3    pDI_BRIGB_3A
                AddControl  DI_BRIGB_3  MoveCDir    pDI_BRIGB_3B
                AddControl  DI_BRIGB_3  Capture     cM_GUARD_STAND2
                AddControl  DI_BRIGB_3  MoveCDir    pDI_BRIGB_3A
                AddControl  DI_BRIGB_3  Capture     cM_GUARD_STAND2
                SequenceLoops   DI_BRIGB_3
                SwitchOnSightOfPlayer   DI_BRIGB_3  AttackDemo2

                PlaceC  DI_BRIGB_4    pDI_BRIGB_4
                RestrictedWanderButAttackOnSight    DI_BRIGB_4

                PlaceC  DI_BRIGB_5    pDI_BRIGB_5A
                AddControl  DI_BRIGB_5  MoveCDir    pDI_BRIGB_5B
                AddControl  DI_BRIGB_5  Capture     cM_GUARD_STAND2
                AddControl  DI_BRIGB_5  MoveCDir    pDI_BRIGB_5A
                AddControl  DI_BRIGB_5  Capture     cM_GUARD_STAND2
                SequenceLoops   DI_BRIGB_5
                SwitchOnSightOfPlayer   DI_BRIGB_5  AttackDemo2

                PlaceC  DI_BRIGB_6    pDI_BRIGB_6
                RestrictedWanderButAttackOnSight    DI_BRIGB_6

                PlaceC  DI_BRIGB_7    pDI_BRIGB_7
                RestrictedWanderButAttackOnSight    DI_BRIGB_7

                PlaceC  DI_BRIGB_8    pDI_BRIGB_8
                RestrictedWanderButAttackOnSight    DI_BRIGB_8

                PlaceC  DI_BRIGB_9    pDI_BRIGB_9
                RestrictedWanderButAttackOnSight    DI_BRIGB_9

                PlaceC  DI_BRIGB_10   pDI_BRIGB_10A
                AddControl  DI_BRIGB_10  MoveCDir    pDI_BRIGB_10B
                AddControl  DI_BRIGB_10  Capture     cM_GUARD_STAND2
                AddControl  DI_BRIGB_10  MoveCDir    pDI_BRIGB_10A
                AddControl  DI_BRIGB_10  Capture     cM_GUARD_STAND2
                SequenceLoops   DI_BRIGB_10
                SwitchOnSightOfPlayer   DI_BRIGB_10  AttackDemo2

                PlaceC  DI_MINER_1    pDI_MINER_1
                AddControl  DI_MINER_1	Capture cM_PICKAXE1 notify 325 PickAxeMiner1
                AddControl  DI_MINER_1	Capture cM_PICKAXE2 notify 350 PickAxeMiner1
                AddControl  DI_MINER_1	DelayControl 1 1
                AddControl  DI_MINER_1	Capture cM_PICKAXE1 notify 325 PickAxeMiner1
                AddControl  DI_MINER_1	Capture cM_PICKAXE2 notify 350 PickAxeMiner1
                AddControl  DI_MINER_1	DelayControl 1 1
				AddControl  DI_MINER_1	MoveCDir pDI_MINER_1
                SequenceRandomlySelects	DI_MINER_1
                AddFilter   DI_MINER_1	CompletesOnDamaged
				AddControl	DI_MINER_1	AttackDemo2

                PlaceC  DI_MINER_2    pDI_MINER_2
			    AddControl  DI_MINER_2		Capture  cM_DIG notify 180 DigMiner2
				AddControl	DI_MINER_2		DelayControl 1 1
			    AddControl  DI_MINER_2		Capture  cM_DIG notify 180 DigMiner2
				AddControl	DI_MINER_2		DelayControl 1 1
			    AddControl  DI_MINER_2		Capture  cM_DIG notify 180 DigMiner2
				AddControl	DI_MINER_2		DelayControl 1 1
				AddControl  DI_MINER_2	MoveCDir pDI_MINER_2
	            SequenceRandomlySelects DI_MINER_2
                AddFilter   DI_MINER_2	CompletesOnDamaged
				AddControl	DI_MINER_2	AttackDemo2

                PlaceC  DI_MINER_3    pDI_MINER_3
                AddControl  DI_MINER_3        Capture cM_PICKAXE1 notify 325 PickAxeMiner3
                AddControl  DI_MINER_3        Capture cM_PICKAXE2 notify 350 PickAxeMiner3
                AddControl  DI_MINER_3        DelayControl 1 1
                AddControl  DI_MINER_3        Capture cM_PICKAXE1 notify 325 PickAxeMiner3
                AddControl  DI_MINER_3        Capture cM_PICKAXE2 notify 350 PickAxeMiner3
                AddControl  DI_MINER_3        DelayControl 1 1
				AddControl  DI_MINER_3	MoveCDir pDI_MINER_3
                SequenceRandomlySelects DI_MINER_3
                AddFilter   DI_MINER_3	CompletesOnDamaged
				AddControl	DI_MINER_3	AttackDemo2

                PlaceC  DI_MINER_4    pDI_MINER_4
			    AddControl  DI_MINER_4		Capture  cM_DIG notify 180 DigMiner4
				AddControl	DI_MINER_4		DelayControl 1 1
			    AddControl  DI_MINER_4		Capture  cM_DIG notify 180 DigMiner4
				AddControl	DI_MINER_4		DelayControl 1 1
			    AddControl  DI_MINER_4		Capture  cM_DIG notify 180 DigMiner4
				AddControl	DI_MINER_4		DelayControl 1 1
				AddControl  DI_MINER_4	MoveCDir pDI_MINER_4
	            SequenceRandomlySelects DI_MINER_4
                AddFilter   DI_MINER_4	CompletesOnDamaged
				AddControl	DI_MINER_4	AttackDemo2

                PlaceC  DI_MINER_5    pDI_MINER_5
                AddControl  DI_MINER_5        Capture cM_PICKAXE1 notify 325 PickAxeMiner5
                AddControl  DI_MINER_5        Capture cM_PICKAXE2 notify 350 PickAxeMiner5
                AddControl  DI_MINER_5        DelayControl 1 1
                AddControl  DI_MINER_5        Capture cM_PICKAXE1 notify 325 PickAxeMiner5
                AddControl  DI_MINER_5        Capture cM_PICKAXE2 notify 350 PickAxeMiner5
                AddControl  DI_MINER_5        DelayControl 1 1
				AddControl  DI_MINER_5	MoveCDir pDI_MINER_5
                SequenceRandomlySelects DI_MINER_5
                AddFilter   DI_MINER_5	CompletesOnDamaged
				AddControl	DI_MINER_5	AttackDemo2

                PlaceC  DI_MINER_6    pDI_MINER_6
			    AddControl  DI_MINER_6		Capture  cM_DIG notify 180 DigMiner6
				AddControl	DI_MINER_6		DelayControl 1 1
			    AddControl  DI_MINER_6		Capture  cM_DIG notify 180 DigMiner6
				AddControl	DI_MINER_6		DelayControl 1 1
			    AddControl  DI_MINER_6		Capture  cM_DIG notify 180 DigMiner6
				AddControl	DI_MINER_6		DelayControl 1 1
				AddControl  DI_MINER_6	MoveCDir pDI_MINER_6
	            SequenceRandomlySelects DI_MINER_6
                AddFilter   DI_MINER_6	CompletesOnDamaged
				AddControl	DI_MINER_6	AttackDemo2

                PlaceC  DI_MINER_7    pDI_MINER_7
                AddControl  DI_MINER_7        Capture cM_PICKAXE1 notify 325 PickAxeMiner7
                AddControl  DI_MINER_7        Capture cM_PICKAXE2 notify 350 PickAxeMiner7
                AddControl  DI_MINER_7        DelayControl 1 1
                AddControl  DI_MINER_7        Capture cM_PICKAXE1 notify 325 PickAxeMiner7
                AddControl  DI_MINER_7        Capture cM_PICKAXE2 notify 350 PickAxeMiner7
                AddControl  DI_MINER_7        DelayControl 1 1
				AddControl  DI_MINER_7	MoveCDir pDI_MINER_7
                SequenceRandomlySelects DI_MINER_7
                AddFilter   DI_MINER_7	CompletesOnDamaged
				AddControl	DI_MINER_7	AttackDemo2

                PlaceC  DI_MINER_8    pDI_MINER_8
			    AddControl  DI_MINER_8		Capture  cM_DIG notify 180 DigMiner8
				AddControl	DI_MINER_8		DelayControl 1 1
			    AddControl  DI_MINER_8		Capture  cM_DIG notify 180 DigMiner8
				AddControl	DI_MINER_8		DelayControl 1 1
			    AddControl  DI_MINER_8		Capture  cM_DIG notify 180 DigMiner8
				AddControl	DI_MINER_8		DelayControl 1 1
				AddControl  DI_MINER_8	MoveCDir pDI_MINER_8
	            SequenceRandomlySelects DI_MINER_8
                AddFilter   DI_MINER_8	CompletesOnDamaged
				AddControl	DI_MINER_8	AttackDemo2

                PlaceC  DI_MINER_9    pDI_MINER_9
                AddControl  DI_MINER_9        Capture cM_PICKAXE1 notify 325 PickAxeMiner9
                AddControl  DI_MINER_9        Capture cM_PICKAXE2 notify 350 PickAxeMiner9
                AddControl  DI_MINER_9        DelayControl 1 1
                AddControl  DI_MINER_9        Capture cM_PICKAXE1 notify 325 PickAxeMiner9
                AddControl  DI_MINER_9        Capture cM_PICKAXE2 notify 350 PickAxeMiner9
                AddControl  DI_MINER_9        DelayControl 1 1
				AddControl  DI_MINER_9	MoveCDir pDI_MINER_9
                SequenceRandomlySelects DI_MINER_9
                AddFilter   DI_MINER_9	CompletesOnDamaged
				AddControl	DI_MINER_9	AttackDemo2

                PlaceC  DI_MINER_10   pDI_MINER_10
			    AddControl  DI_MINER_10		Capture  cM_DIG notify 180 DigMiner10
				AddControl	DI_MINER_10		DelayControl 1 1
			    AddControl  DI_MINER_10		Capture  cM_DIG notify 180 DigMiner10
				AddControl	DI_MINER_10		DelayControl 1 1
			    AddControl  DI_MINER_10		Capture  cM_DIG notify 180 DigMiner10
				AddControl	DI_MINER_10		DelayControl 1 1
				AddControl  DI_MINER_10	MoveCDir pDI_MINER_10
	            SequenceRandomlySelects DI_MINER_10
                AddFilter   DI_MINER_10	CompletesOnDamaged
				AddControl	DI_MINER_10	AttackDemo2

            ENDIF
	    ENDIF
    ENDIF

END

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

VIG TempSetup FALSE

    SetWeather  0 0 0 0 0 0 0 0

	Remove gg_Throbbing

	CachePortrait BRIGAND1.BIN
	CachePortrait BRIGAND2.BIN

END

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

VIG PickAxeBran FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav BRAN
		DEFAULT
			PlaySFXPerson IG_88.wav BRAN
	ENDSWITCH
END

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

VIG PickAxeBerry FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav BERRY
		DEFAULT
			PlaySFXPerson IG_88.wav BERRY
	ENDSWITCH
END

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

VIG PickAxeDek FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DEK
		DEFAULT
			PlaySFXPerson IG_88.wav DEK
	ENDSWITCH
END

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

VIG DigSam FALSE
	PlaySFXPerson IG_89.wav SAMANTHA
END

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

VIG DigLiz FALSE
	PlaySFXPerson IG_89.wav LIZ
END

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

VIG DigLorna FALSE
	PlaySFXPerson IG_89.wav LORNA
END

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

VIG DigAamon FALSE
	PlaySFXPerson IG_89.wav AAMON
END

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

VIG Throb !gg_Throbbing && !gg_SMASHED_STONE
	PlayLoopSFXArea ig_77.wav slaver_stone
	Add gg_Throbbing
END

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

VIG ThrobEffect TENSEC && !gg_SMASHED_STONE
	FX_HexStone pSLAVER_STONE
END

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

VIG T_FreezeAll FALSE

	FreezeC DI_BRIG_00
	FreezeC DI_BRIG_01
	FreezeC DI_BRIG_02
	FreezeC DI_BRIG_03
	FreezeC DI_BRIG_04
	FreezeC DI_BRIG_05
	FreezeC DI_BRIG_06
	FreezeC DI_BRIG_07
	FreezeC DI_BRIG_08
	FreezeC DI_BRIG_09
	FreezeC DI_BRIG_10
	FreezeC DI_BRIG_11
	FreezeC DI_BRIG_12
	FreezeC DI_BRIG_13
	FreezeC DI_BRIG_14
	FreezeC DI_BRIG_15
	FreezeC DI_BRIG_16
	FreezeC DI_BRIG_17
	FreezeC DI_BRIG_18
	FreezeC DI_BRIG_19
	FreezeC SLAVER_BEAST_1
	FreezeC SLAVER_BEAST_2
	FreezeC SLAVER_BEAST_3
	FreezeC SLAVER_BEAST_4
	FreezeC SLAVER_BEAST_5
	FreezeC SLAVER_BEAST_6
	FreezeC SLAVER_BEAST_7
	FreezeC DI_RAAL
	IF !gt_NO_FRZ
		FreezeC SLAVER_MASTER
	ENDIF

END

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

VIG T_UnFreezeAll FALSE

	UnFreezeC DI_BRIG_00
	UnFreezeC DI_BRIG_01
	UnFreezeC DI_BRIG_02
	UnFreezeC DI_BRIG_03
	UnFreezeC DI_BRIG_04
	UnFreezeC DI_BRIG_05
	UnFreezeC DI_BRIG_06
	UnFreezeC DI_BRIG_07
	UnFreezeC DI_BRIG_08
	UnFreezeC DI_BRIG_09
	UnFreezeC DI_BRIG_10
	UnFreezeC DI_BRIG_11
	UnFreezeC DI_BRIG_12
	UnFreezeC DI_BRIG_13
	UnFreezeC DI_BRIG_14
	UnFreezeC DI_BRIG_15
	UnFreezeC DI_BRIG_16
	UnFreezeC DI_BRIG_17
	UnFreezeC DI_BRIG_18
	UnFreezeC DI_BRIG_19
	UnFreezeC SLAVER_BEAST_1
	UnFreezeC SLAVER_BEAST_2
	UnFreezeC SLAVER_BEAST_3
	UnFreezeC SLAVER_BEAST_4
	UnFreezeC SLAVER_BEAST_5
	UnFreezeC SLAVER_BEAST_6
	UnFreezeC SLAVER_BEAST_7
	UnFreezeC DI_RAAL
	IF !gt_NO_FRZ
		UnFreezeC SLAVER_MASTER
	ENDIF

END

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

VIG RaalNoise FIVESEC && ONMAP-DI_RAAL && !ISDEAD-DI_RAAL && !INCOMBAT-DI_RAAL
	SWITCH RAND-2
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson Raal1.wav DI_RAAL
				CASE 1
//					PlaySFXPerson Raal2.wav DI_RAAL
				CASE 2
					PlaySFXPerson Raal9.wav DI_RAAL
			ENDSWITCH 
	ENDSWITCH
END

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

VIG cart-logic HALFSEC

	LogOff

	REM *** MINE CART TRIGGER LOGIC ***

	IF INAREA-P-cart1n
		MoveCart 1 n
	ELSE
		IF INAREA-P-cart1s
			MoveCart 1 s
		ELSE
			IF INAREA-P-cart2n
				MoveCart 2 n
			ELSE
				IF INAREA-P-cart2s
					MoveCart 2 s
				ELSE
					IF INAREA-P-cart3e
						MoveCart 3 e
					ELSE
						IF INAREA-P-cart3w
							MoveCart 3 w
						ELSE
							IF INAREA-P-cart4e
								MoveCart 4 e
							ELSE
								IF INAREA-P-cart4w
									MoveCart 4 w
								ELSE
									IF INAREA-P-cart6e
										MoveCart 6 e
									ELSE
										IF INAREA-P-cart6w
											MoveCart 6 w
										ELSE
											IF INAREA-P-cart7n
												MoveCart 7 n
											ELSE
												IF INAREA-P-cart7s
													MoveCart 7 s												
												ENDIF
											ENDIF
										ENDIF
									ENDIF
								ENDIF
							ENDIF
						ENDIF
					ENDIF
				ENDIF
			ENDIF
		ENDIF
	ENDIF

	LogOn

END

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

VIG talk-bran MSG-iBRAN && !mj_FREED_FARMERS
    QuickSay         fa801m  FARMERM1.BIN
END

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

VIG talk-aamon MSG-iAAMON && !mj_FREED_FARMERS
    QuickSay         fa801m  FARMERM2.BIN
END

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

VIG talk-berry MSG-iBERRY && !mj_FREED_FARMERS
    QuickSay         fa801m  FARMERM3.BIN
END

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

VIG talk-samantha MSG-iSAMANTHA && !mj_FREED_FARMERS
    QuickSay         fa801f  FARMERF1.BIN
END

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

VIG talk-lorna MSG-iLORNA && !mj_FREED_FARMERS
    QuickSay         fa801f  FARMERF2.BIN
END

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

VIG talk-liz MSG-iLIZ && !mj_FREED_FARMERS
    QuickSay         fa801f  FARMERF3.BIN
END

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

VIG talk-dek MSG-iDEK && !mj_FREED_FARMERS
    QuickSay         fa801M  FARMERM4.BIN
END

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

VIG talk-marge MSG-iMARGE && !mj_FREED_FARMERS
    QuickSay         fa801f  FARMERF4.BIN
END

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

VIG slave_master_attack gd_SLAVE_MASTER_ATTACK && !gd_SLAVE_MASTER
    Add  gd_SLAVE_MASTER
    GiveSightOfPlayerTo SLAVER_MASTER
    AttackDemo2 SLAVER_MASTER
END

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

VIG brigand1-shout FALSE

	SWITCH RAND-3
		CASE 0
			QuickSay br0002 BRIGAND1.BIN
		CASE 1
			QuickSay br0003 BRIGAND1.BIN
		CASE 2
			QuickSay br0006 BRIGAND1.BIN
	ENDSWITCH

END

VIG brigand2-shout FALSE

	SWITCH RAND-3
		CASE 0
			QuickSay br0002 BRIGAND2.BIN
		CASE 1
			QuickSay br0003 BRIGAND2.BIN
		CASE 2
			QuickSay br0006 BRIGAND2.BIN
	ENDSWITCH

END

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

VIG DRBrig06 ONESEC && gd_DI_BRIG_06_ATTACK=0
    AddTo  gd_DI_BRIG_06_ATTACK 1
	RunS brigand1-shout
    AttackDemo2 DI_BRIG_06
END

VIG DRBrig07 ONESEC && gd_DI_BRIG_07_ATTACK=0
    AddTo  gd_DI_BRIG_07_ATTACK 1
	RunS brigand2-shout
    AttackDemo2 DI_BRIG_07
END

VIG DRBrig15 ONESEC && gd_DI_BRIG_15_ATTACK=0
    AddTo  gd_DI_BRIG_15_ATTACK 1
	RunS brigand1-shout
    AttackDemo2 DI_BRIG_15
END

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

VIG WatchTheStone   HALFSEC && (CARTINAREA-0-stone_smash || gd_FREEDOM_TEST) && !mj_FREED_FARMERS && !gd_SHOWING_STONE
	RunS CARTEFFECTS
	Add gt_NO_FRZ
	RunS T_FreezeAll
    Camcut  stone
	Widescreen TRUE
    Playercontrol   off
    StopC   SLAVER_MASTER
    MoveCDir	SLAVER_MASTER   pMINE_SMASTER_NO   run
    AddControl  SLAVER_MASTER   Capture cM_CLUTCH_HEAD
    Add gd_SHOWING_STONE
    IF  gd_FREEDOM_TEST
        Wait    2000
        AddTo   gd_FREEDOM_TEST 1
    ENDIF
	///***///RunS T_UnFreezeAll
END

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

VIG SmashTheStone   !mj_FREED_FARMERS && gd_SHOWING_STONE && (CARTINAREA-0-slaver_stone || gd_FREEDOM_TEST=1)

	Add		gg_SMASHED_STONE
	///***///RunS T_FreezeAll

//    FX_GreenFire   15880 25519
//    FX_GreenFire   15000 25519

	PlaySFXPosid IG_78#.WAV pSLAVER_STONE
	StopSFX ig_77.wav
	remove gg_Throbbing

	Unlock	BRAN
	Unlock	AAMON		
	Unlock	BERRY		
	Unlock	SAMANTHA	
	Unlock	LORNA		
	Unlock	LIZ			
	Unlock	DEK			
	Unlock	MARGE	

	StopC	BRAN
	StopC	AAMON		
	StopC	BERRY		
	StopC	SAMANTHA	
	StopC	LORNA		
	StopC	LIZ			
	StopC	DEK			
	StopC	MARGE	

	MoveC_1tel  BRAN        DI_ENTRANCE   pBRAN_IN_FARM_HOUSE		run
	MoveC_1tel	SAMANTHA	DI_ENTRANCE   pSAMANTHA_IN_FARM_HOUSE	run
	MoveC_1tel	DEK			DI_ENTRANCE   pDEK_IN_FARM_HOUSE			run
	MoveC_1tel	MARGE		DI_ENTRANCE   pMARGE_IN_FARM_HOUSE		run

	FreeMinerEffect BRAN
	FreeMinerEffect SAMANTHA	
	FreeMinerEffect DEK			
	FreeMinerEffect MARGE	

    Wait    2500
//	LooseOb SLAVER_MASTER mines_key

	Wait 5000

    camcut  free1
	Capture	BERRY   cM_FARMERS_FREEDOM2
    Capture	LIZ		cF_FARMERS_FREEDOM3
	Capture	LORNA	cF_FARMERS_FREEDOM1
	FreeMinerEffect BERRY		
	FreeMinerEffect LORNA		
	FreeMinerEffect LIZ			

//	wait 1000
	PlaySFXPerson cheer6.wav LIZ

//	wait 1800
//	PlaySFXPerson cheer3.wav LIZ


    UUComplete  BERRY
	MoveC_1tel	BERRY		DI_ENTRANCE   pBERRY_IN_FARM_HOUSE		run
	MoveC_1tel	LORNA		DI_ENTRANCE   pLORNA_IN_FARM_HOUSE		run
	MoveC_1tel	LIZ			DI_ENTRANCE   pLIZ_IN_FARM_HOUSE			run
    Wait    3500

    Camcut  free2
	Capture     AAMON		cM_FARMERS_FREEDOM1
	FreeMinerEffect AAMON

	wait 1000
	PlaySFXPerson cheer6.wav AAMON
	
    UUComplete  AAMON
	MoveC_1tel	AAMON		DI_ENTRANCE   pAAMON_IN_FARM_HOUSE		run
    Wait    2000

    PlaceC FARMER_KEY pFKEY
	Add mj_FREED_FARMERS
    Widescreen      FALSE
    Playercontrol   on
    Camcut          P

    AddControl  SLAVER_MASTER   AttackDemo2
	RunS T_UnFreezeAll
	Remove gt_NO_FRZ
	DestroyHexCompass pSLAVER_STONE
END

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

VIG FarmerWithKey mj_FREED_FARMERS && !gt_PLAYED_FKEY && (MSG-iFARMER_KEY || (HALFSEC && DISTFROM-P-FARMER_KEY-8))

	Add gt_PLAYED_FKEY

	RunS T_FreezeAll
	UnDrawSwordRemember
	Widescreen TRUE

	MoveCDir P pPKEY
	UUComplete P

	QuickSay mr0001  FARMERM1.BIN
	Wait 2500
    Capture   FARMER_KEY  cM_TOSS_GENTLE
    Capture   P           cM_OBJ_ACCEPT_1H1

    UUComplete  FARMER_KEY

	AwardOb P shadows_key "key-path-shadows"
	AwardOb P gargos_letter "gargos-letter"

	UUSay
	MoveC_1tel	FARMER_KEY	DI_ENTRANCE   pTRADE_ROUTE_8_3	run

	UUComplete P
	Capture P cM_OBJ_EXAMINE_SMALL1
	UUComplete P	
	DrawSwordRemember

	Set gt_MINE_TIMEOUT 0
	WHILE !ISDEAD-BRAN
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-AAMON		
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-BERRY		
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-SAMANTHA	
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-LORNA		
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-LIZ			
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-DEK			
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-MARGE	
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE
	WHILE !ISDEAD-FARMER_KEY
		Wait 250
		AddTo gt_MINE_TIMEOUT 1
		IF gt_MINE_TIMEOUT=40
			RunS TimeoutBailout
		ENDIF
	ENDWHILE

	Widescreen FALSE
	AwardEP xp_FREED_FARMERS
	RunS T_UnFreezeAll

END

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

VIG TimeoutBailout FALSE

	RemoveC BRAN
	RemoveC AAMON		
	RemoveC BERRY		
	RemoveC SAMANTHA	
	RemoveC LORNA		
	RemoveC LIZ			
	RemoveC DEK			
	RemoveC MARGE	
	RemoveC FARMER_KEY

END

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

VIG TheMasterIsDead ONESEC && !gd_ANGRY_BEASTS && ISDEAD-SLAVER_MASTER

    IF !ISDEAD-SLAVER_BEAST_1
        Wander      SLAVER_BEAST_1
        AddFilter   SLAVER_BEAST_1  DontGoFarFrom   6000 9000 pSLAVER_BEAST_1B
        SwitchOnSightOfPlayer   SLAVER_BEAST_1  AttackDemo2
    ENDIF

    IF !ISDEAD-SLAVER_BEAST_2
        Wander      SLAVER_BEAST_2
        AddFilter   SLAVER_BEAST_2  DontGoFarFrom   6000 9000 pSLAVER_BEAST_2B
        SwitchOnSightOfPlayer   SLAVER_BEAST_2  AttackDemo2
    ENDIF

    IF !ISDEAD-SLAVER_BEAST_3
        Wander      SLAVER_BEAST_3
        AddFilter   SLAVER_BEAST_3  DontGoFarFrom   6000 9000 pSLAVER_BEAST_03B
        SwitchOnSightOfPlayer   SLAVER_BEAST_3  AttackDemo2
    ENDIF

    IF !ISDEAD-SLAVER_BEAST_4
        Wander      SLAVER_BEAST_4
        AddFilter   SLAVER_BEAST_4  DontGoFarFrom   6000 9000 pSLAVER_BEAST_04B
        SwitchOnSightOfPlayer   SLAVER_BEAST_4  AttackDemo2
    ENDIF

    IF !ISDEAD-SLAVER_BEAST_5
        Wander      SLAVER_BEAST_5
        AddFilter   SLAVER_BEAST_5  DontGoFarFrom   6000 9000 pSLAVER_BEAST_05B
        SwitchOnSightOfPlayer   SLAVER_BEAST_5  AttackDemo2
    ENDIF

    IF !ISDEAD-SLAVER_BEAST_7
        Wander      SLAVER_BEAST_7
        AddFilter   SLAVER_BEAST_7  DontGoFarFrom   6000 9000 pSLAVER_BEAST_7_START
        SwitchOnSightOfPlayer   SLAVER_BEAST_7  AttackDemo2
    ENDIF

    Add gd_ANGRY_BEASTS
	Add f_COMORRO_DEAD
	AwardEP xp_COMORRO_DEAD
END

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

VIG WatchTheOpening   TENTHSEC && !gd_OPENED_SECRET && CARTINAREA-6-idol_camera
	RunS T_FreezeAll
    Camcut  idolcam
	Widescreen TRUE
    StopC P
    Add gd_SHOWING_IDOL

	WHILE !CARTINAREA-6-idol_door
		Wait 250
		IF FIVESEC
			RunS CartEffects
		ENDIF
	ENDWHILE

	RunS CARTEFFECTS
    Add         gd_OPENED_SECRET

    FX_BombExplodes pBLAST_DOOR
	PlaySFXPosid IG_295.wav pBLAST_DOOR
	IdoorClosed didol
	RdoorOpen   didol

	Wait 2000

	Widescreen      FALSE
	Camcut          P
	RunS T_UnFreezeAll
	AwardEP xp_MINE_SECRET
END

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

VIG CARTEFFECTS FIVESEC

	DoCartEffects
	IF !gg_SMASHED_STONE
		SlaverStoneEffect 
		MinerEffect BRAN
		MinerEffect AAMON		
		MinerEffect BERRY		
		MinerEffect SAMANTHA	
		MinerEffect LORNA		
		MinerEffect LIZ			
		MinerEffect DEK			
		MinerEffect MARGE	
	ENDIF

END

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

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

VIG FlyBy FALSE

	Widescreen TRUE

	// *** EXAMPLE CAMERA FLY-BY CODE ***

	// use Wait at start and end to help when editing the final recording
	// use UUCameraComplete to wait for a pan to finish
	// use SetCamMoveConstant to set camera movement per frame
	//     - remember the movie is played at 25fps no matter how slow it records

	SetCamMoveConstant 120
	FreeCam
	PhotoOn

	camcut flyby01

	campan flyby02
	UUCameraComplete

	PhotoOff

	// *** END OF FLY-BY ***

	Widescreen FALSE

END

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

VIG SlaverBeastNoises1 FIVESEC && ONMAP-SLAVER_BEAST_1 && !ISDEAD-SLAVER_BEAST_1 && !INCOMBAT-SLAVER_BEAST_1
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_1
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_1
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_1
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises2 FIVESEC && ONMAP-SLAVER_BEAST_2 && !ISDEAD-SLAVER_BEAST_2 && !INCOMBAT-SLAVER_BEAST_2
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_2
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_2
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_2
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises3 FIVESEC && ONMAP-SLAVER_BEAST_3 && !ISDEAD-SLAVER_BEAST_3 && !INCOMBAT-SLAVER_BEAST_3
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_3
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_3
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_3
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises4 FIVESEC && ONMAP-SLAVER_BEAST_4 && !ISDEAD-SLAVER_BEAST_4 && !INCOMBAT-SLAVER_BEAST_4
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_4
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_4
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_4
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises5 FIVESEC && ONMAP-SLAVER_BEAST_5 && !ISDEAD-SLAVER_BEAST_5 && !INCOMBAT-SLAVER_BEAST_5
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_5
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_5
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_5
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises6 FIVESEC && ONMAP-SLAVER_BEAST_6 && !ISDEAD-SLAVER_BEAST_6 && !INCOMBAT-SLAVER_BEAST_6
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_6
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_6
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_6
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG SlaverBeastNoises7 FIVESEC && ONMAP-SLAVER_BEAST_7 && !ISDEAD-SLAVER_BEAST_7 && !INCOMBAT-SLAVER_BEAST_7
	SWITCH RAND-5
		CASE 0
			SWITCH RAND-3
				CASE 0
					PlaySFXPerson PitBeast1.wav SLAVER_BEAST_7
				CASE 1
					PlaySFXPerson PitBeast2.wav SLAVER_BEAST_7
				CASE 2
					PlaySFXPerson PitBeast3.wav SLAVER_BEAST_7
			ENDSWITCH 
	ENDSWITCH
END
                      
/////////////////////////////////////////////////////////////////////

VIG PickAxeMiner1 FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DI_MINER_1
		DEFAULT
			PlaySFXPerson IG_88.wav DI_MINER_1
	ENDSWITCH
END

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

VIG PickAxeMiner3 FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DI_MINER_3
		DEFAULT
			PlaySFXPerson IG_88.wav DI_MINER_3
	ENDSWITCH
END

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

VIG PickAxeMiner5 FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DI_MINER_5
		DEFAULT
			PlaySFXPerson IG_88.wav DI_MINER_5
	ENDSWITCH
END

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

VIG PickAxeMiner7 FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DI_MINER_7
		DEFAULT
			PlaySFXPerson IG_88.wav DI_MINER_7
	ENDSWITCH
END

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

VIG PickAxeMiner9 FALSE
	SWITCH RAND-8
		CASE 0
			PlaySFXPerson IG_88X.wav DI_MINER_9
		DEFAULT
			PlaySFXPerson IG_88.wav DI_MINER_9
	ENDSWITCH
END

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

VIG DigMiner2 FALSE
	PlaySFXPerson IG_89.wav DI_MINER_2
END

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

VIG DigMiner4 FALSE
	PlaySFXPerson IG_89.wav DI_MINER_4
END

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

VIG DigMiner6 FALSE
	PlaySFXPerson IG_89.wav DI_MINER_6
END

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

VIG DigMiner8 FALSE
	PlaySFXPerson IG_89.wav DI_MINER_8
END

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

VIG DigMiner10 FALSE
	PlaySFXPerson IG_89.wav DI_MINER_10
END

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

VIG SwitchMineCart FALSE
	SWITCH RAND-3
		CASE 0
			PlaySFXPerson IG_218.wav P
		CASE 1
			PlaySFXPerson IG_218X.wav P
		CASE 2
			PlaySFXPerson IG_218XX.wav P
	ENDSWITCH
END

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

VIG RaalAttacks FIVESEC && !gt_DI_RAAL_ATTACKS && (DAMAGED-DI_RAAL || POS-P-skull)

	Add gt_DI_RAAL_ATTACKS
	GiveSightOfPlayerTo DI_RAAL
	AttackDemo2 DI_RAAL

END

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

VIG ClickSlaverStone  MSG-iSLAVER_STONE
    MoveCDir        P           pP_STONE
    AddControl      P           SetScriptFlagControl    gg_STONE
END

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

VIG SlaverStoneMcap gg_STONE
    Remove		gg_STONE
	Capture		P cM_POINT
	AddControl	P SetScriptFlagControl gg_STONE_SFX
	AddControl	P Capture cM_SHRUG1
END

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

VIG SlaverStoneSFX gg_STONE_SFX
	Remove gg_STONE_SFX
	PlaySFXPerson IG_331.wav P
END

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