/////////////////////////////////////////////////////////////////////
// SOUTHSQ.S
/////////////////////////////////////////////////////////////////////

SETUP

	// *** PLACE MEL FOR INTRO ***
	//IF (gt_FESTIVAL_PREP && !mj_BEEN_TO_HEX) || !gt_FESTIVAL_PREP
		IF !gt_PLACED_MEL
			Add gt_PLACED_MEL
			PlaceC MEL pMEL_IN_HOUSE
			RunS MelActions
		ENDIF
	//ELSE
		//IF gt_PLACED_MEL
			//Remove gt_PLACED_MEL
			//RemoveC MEL
		//ENDIF
	//ENDIF

	// *** PLACE CHANT ***
	IF mj_SLEPT_AT_ANDRUS && !mj_BEEN_TO_HEX
		IF !gt_PLACED_CHANT
			Add gt_PLACED_CHANT
			PlaceC LAEN pLAEN_IN_HOUSE 
			RunS LaenActions
		ENDIF
	ELSE
		IF gt_PLACED_CHANT
			Remove gt_PLACED_CHANT
			RemoveC LAEN
		ENDIF
	ENDIF

	// *** PLACE BRIGANDS ***
	IF !mj_SLEPT_AT_ANDRUS
		IF !gt_PLACED_SS_BRIG
			Add gt_PLACED_SS_BRIG
			
			PlaceC SS_BRIG_1 pSS_BRIG_1_START
			AwardOb SS_BRIG_1 ar_ltr_cl_brig "bandit-cloak"
			PlaceC SS_BRIG_2 pSS_BRIG_2_START
			PlaceC SS_BRIG_3 pSS_BRIG_3_START
			PlaceC SS_BRIG_4 pSS_BRIG_4_START

	        LookAtTurn  SS_BRIG_1   SS_BRIG_2
			AddControl  SS_BRIG_1   Capture cM_TALK_GENERAL1
			AddControl  SS_BRIG_1   Capture cM_TALK_GENERAL2
			AddControl  SS_BRIG_1   Capture cM_TALK_AGREE2
			AddControl  SS_BRIG_1   Capture cM_GUARD_STAND2
			SequenceRandomlySelects SS_BRIG_1
			LookAtTurn  SS_BRIG_2   SS_BRIG_1
			AddControl  SS_BRIG_2   Capture cM_TALK_GENERAL1
			AddControl  SS_BRIG_2   Capture cM_TALK_GENERAL2
			AddControl  SS_BRIG_2   Capture cM_TALK_AGREE2
			AddControl  SS_BRIG_2   Capture cM_GUARD_STAND2
			SequenceRandomlySelects SS_BRIG_2
			Wander SS_BRIG_3 
			Wander SS_BRIG_4
			SwitchOnSightOfPlayer SS_BRIG_1 AttackDemo2
			SwitchOnSightOfPlayer SS_BRIG_2 AttackDemo2
			SwitchOnSightOfPlayer SS_BRIG_3 AttackDemo2
			SwitchOnSightOfPlayer SS_BRIG_4 AttackDemo2

		ENDIF
	ELSE
		IF gt_PLACED_SS_BRIG
			Remove gt_PLACED_SS_BRIG

			KillC SS_BRIG_1
			KillC SS_BRIG_2
			KillC SS_BRIG_3
			KillC SS_BRIG_4
		ENDIF
	ENDIF

	IF mj_FREED_FARMERS
		IF !gt_PLACED_MAD_FARMER_5
			Add gt_PLACED_MAD_FARMER_5
			PlaceC MAD_FARMER_5 pMADF_5
			Wander MAD_FARMER_5
		ENDIF
	ENDIF

    IF  mj_DEFEAT_GARGOS_2
        IF !gd_PLACED_SS_DRAGONS
            Add                 gd_PLACED_SS_DRAGONS
            PlaceC              SS_DRAGON_1 pSS_DRAGON_1
            WanderNotFar        SS_DRAGON_1 4 12
			AddFilter			SS_DRAGON_1 CompletesOnDamaged
			AddControl			SS_DRAGON_1 MeleeAttackBLands
            PlaceC              SS_DRAGON_2 pSS_DRAGON_2
            WanderNotFar        SS_DRAGON_2 4 12
			AddFilter			SS_DRAGON_2 CompletesOnDamaged
			AddControl			SS_DRAGON_2 MeleeAttackBLands

			PlaceC RENYA pLAEN_IN_HOUSE
        ENDIF
		IF mj_DEFEAT_INCUBAH
			RemoveC RENYA
		ENDIF

    ENDIF

	IF mj_RECOVER_CROWN
		//bug fix for B2.3 (or whatever)
		KillC SS_DRAGON_1
		KillC SS_DRAGON_2
		KillC MAD_FARMER_5
	ENDIF

	IF gt_BLOODKIN_ARMY_IN_MADRIGAL
		RemoveC LAEN
		RemoveC CANDICE5
		RemoveC LAEN_GUARD_5
		RemoveC LAEN_GUARD_6
		RemoveC LAEN_GUARD_7
		RemoveC LAEN_GUARD_8

		IF !gt_DONE_MIRES_PIT
			PlaceC LAEN pLAEN_IN_HOUSE 
			PlaceC CANDICE5 pLAEN_IN_HOUSE

			PlaceC LAEN_GUARD_5 pSS_DRAGON_1
			PlaceC LAEN_GUARD_6 pSS_DRAGON_2
			PlaceC LAEN_GUARD_7 pSS_BRIG_1_START
			PlaceC LAEN_GUARD_8 pSS_BRIG_2_START

			Wander LAEN_GUARD_5
			Wander LAEN_GUARD_6
			Wander LAEN_GUARD_7
			Wander LAEN_GUARD_8
		ENDIF
	ENDIF

	IF !gt_RECENT_MUSIC_IN_MADRIGAL
		Add gt_RECENT_MUSIC_IN_MADRIGAL
		PlayMusic RPG18.WAV
	ENDIF

END

VIG TempSetup FALSE

	RunS AndrusWeather
	Set gd_WIND_TYPE	1
    RunS CueWeather

	SetLiquid ALL 208 20 5
	SetWaterType 0

	IF ONMAP-LAEN || ONMAP-RENYA || ONMAP-CANDICE5
		AddBigFire 1671 1396
		AttachLoopSFXArea ig_253.wav 50 fire
	ENDIF

	IF mj_RECOVER_CROWN
		CachePortrait CANDICE5.BIN
		CachePortrait LAENCHNT.BIN
		CachePortrait CREDO.BIN
	ELSE
		CachePortrait RENYA.BIN
	ENDIF
	CachePortrait MELLISSA.BIN

END

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

VIG FirstNightBrigandKilled ONESEC && !mj_SLEPT_AT_ANDRUS && ISDEAD-SS_BRIG_1 && !gt_KEEP_SSB1_QUEST

	Add gt_KEEP_SSB1_QUEST

END

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

VIG TalkToMadFarmer_5 MSG-iMAD_FARMER_5

	Widescreen TRUE
	StopC MAD_FARMER_5
	EngageAndFace P MAD_FARMER_5

	IF mj_DEFEAT_GARGOS_2
		Say faf304 farmerf4.bin
	ELSE
		//"We thank you once more, stranger. We owe you our lives."
		Say fa2002 farmerf4.bin
	ENDIF

	Wander MAD_FARMER_5
	Widescreen FALSE

END

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

VIG TalkToSSDragon1 MSG-iSS_DRAGON_1
	Widescreen TRUE
    StopC           SS_DRAGON_1
    EngageAndFace   SS_DRAGON_1 P
    RunS            TalkToDragonWarrior
    WanderNotFar    SS_DRAGON_1 4 12
	Widescreen FALSE
END

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

VIG TalkToSSDragon2 MSG-iSS_DRAGON_2
	Widescreen TRUE
    StopC           SS_DRAGON_2
    EngageAndFace   SS_DRAGON_2 P
    RunS            TalkToDragonWarrior
    WanderNotFar    SS_DRAGON_2 4 12
	Widescreen FALSE
END

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

VIG TalkToMadFarmer_6 MSG-iMAD_FARMER_6

	Widescreen TRUE
	StopC MAD_FARMER_6
	EngageAndFace P MAD_FARMER_6

	IF mj_DEFEAT_GARGOS_2
		Say fam607 farmerm4.bin
	ELSE
		//"Good day to you. You're well, I hope?"
		IF LANG-English || LANG-German
			Say fa8001 FARMERM4.BIN
		ELSE
			Say fa1003 farmerm4.bin
		ENDIF
	ENDIF

	Wander MAD_FARMER_6
	Widescreen FALSE

END

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

VIG TalkToLaenGuard MSG-LAEN_GUARD_6 || MSG-LAEN_GUARD_7 || MSG-LAEN_GUARD_8

	//"We stand with you Light Bringer..."
	QuickSay bk0102 CREDO.BIN

END

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

VIG MelActions FALSE

	Capture MEL cF_MEL_SCATTER1_PICK
	AddControl MEL Capture cF_MEL_SCATTER2_SATTER
	AddControl MEL Capture cF_MEL_GATHER1_PICK
	AddControl MEL Capture cF_MEL_GATHER2_SCATTER
	AddControl MEL Capture cF_MEL_PLACE_HANDS1
	AddControl MEL Capture cF_MEL_PLACE_HANDS3
	SequenceRandomlySelects MEL
	AddFilter  MEL FilterToStart
END

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

VIG TalkToMel MSG-iMEL

	Widescreen TRUE
	UnDrawSwordRemember

	MoveCDir P pTALK_MEL

	Capture MEL cF_MEL_STAND1

	//"Your soul resounds with destiny..."
	Say my0011

	UUComplete MEL
	UUComplete P

	// *** START CONVERSATION WITH MEL ***

	ResetChoice
	WHILE !MenuExit
		ClearChoices

		//Work
		IF !gt_MEL_GOT_EGGSHELL
			AddChoice 1 tx0004
		ENDIF

		IF !mj_DEFEAT_GARGOS_2
			//Show Casket
			IF POS-P-casket
				AddChoice 2 tx0018
			ENDIF

			//Jake
			IF co_JAKE
				AddChoice 3 tx0019
			ENDIF
		ENDIF

		//Raal
		IF co_RAAL
			AddChoice 4 tx0032
		ENDIF

		//Demon Papers
		IF co_DEMONPAPERS
			AddChoice 5 txm300
		ENDIF

		//The Hex
		IF co_THEHEX
			AddChoice 6 tx0025
		ENDIF

		//Seeing
		AddChoice 8 tx0035

		IF co_BARADATHLIN
			AddChoice 9 txfh01
			IF co_FAY
				//AddChoice 10 txfh03
				AddChoice 11 txfh02
			ENDIF
		ENDIF

		//Leave
		AddChoice 0 tx0003

		// *** DISPLAY THE MENU ***
		GetChoice MEL

		// *** DEAL WITH THE CHOICE ***

		SWITCH CHOICE
			CASE 1
				//Work
				
				IF !POS-P-eggshell || !gt_MEL_SAID_DOVE

					Add gt_MEL_SAID_DOVE

					//"I do have a small task... eggshells from a snowdove's nest...west..."
					Say my0014

					Add f_DOVE
					QLAdd ql006 qlt006 qlb006
				ENDIF

				IF POS-P-eggshell

					DeleteObjectsInBackpackWithID P eggshell
					Add gt_MEL_GOT_EGGSHELL
					QLRemove ql006
					AwardEP xp_MEL_EGGSHELL
					Gold+ P 25

				ENDIF

			CASE 2
				//Show Casket

				//"Hmm...emblem...three knives...Ask Chant..."
				Say my0059

				Add co_GUILDSEAL

			CASE 3
				//Jake

				//"I do not know the man...sinister...severed head...three steel blades."
				Say my0022

			CASE 4
				//Raal

				//"The Raal...Revenants...Demon Papers..."
				Say my0028

				Add co_DEMONPAPERS

			CASE 5
				//Demon Papers

				IF !gt_MEL_GIVEN_DEMON_PAPERS
					Add gt_MEL_GIVEN_DEMON_PAPERS

					Capture MEL cF_OBJ_ACCEPT_1H1
					Capture P cM_OBJ_ACCEPT_1H1
					UUComplete P

					AwardOb P demonpapers1 "demon papers"
				ENDIF

				//"What I have given you...first of four parts..."
				Say my0030

			CASE 6
				//The Hex

				//"...part of a greater design..."
				Say my0042

			CASE 8
				//Seeing

				//get message every time you buy card(s)
				Remove gt_MYX001

				MessagesOff
				ShopPanel	MELI_SHOP	100	100	MEL	BUYSELL

				
				//didn't buy a card
				IF !POS-P-card_facedn
					//"For now, I have no cards to give..."
					Say myx002 MELLISSA.BIN
				ENDIF

				//bought card(s)
				WHILE POS-P-card_facedn
					DeleteObjectsInBackpackWithID P card_facedn 1
					
					Remove gg_FoundCard

					WHILE !gg_FoundCard
						SWITCH RAND-16
							CASE 0
								IF !gg_CARD0
									AwardOb P card_aid "seeingcard"
									Add gg_CARD0
									Add gg_FoundCard
								ENDIF
							CASE 1
								IF !gg_CARD1
									AwardOb P card_alchemy "seeingcard"
									Add gg_CARD1
									Add gg_FoundCard
								ENDIF
							CASE 2
								IF !gg_CARD2
									AwardOb P card_birds "seeingcard"
									Add gg_CARD2
									Add gg_FoundCard
								ENDIF
							CASE 3
								IF !gg_CARD3
									AwardOb P card_craft "seeingcard"
									Add gg_CARD3
									Add gg_FoundCard
								ENDIF
							CASE 4
								IF !gg_CARD4
									AwardOb P card_diam "seeingcard"
									Add gg_CARD4
									Add gg_FoundCard
								ENDIF
							CASE 5
								IF !gg_CARD5
									AwardOb P card_door "seeingcard"
									Add gg_CARD5
									Add gg_FoundCard
								ENDIF
							CASE 6
								IF !gg_CARD6
									AwardOb P card_enter "seeingcard"
									Add gg_CARD6
									Add gg_FoundCard
								ENDIF
							CASE 7
								IF !gg_CARD7
									AwardOb P card_fire "seeingcard"
									Add gg_CARD7
									Add gg_FoundCard
								ENDIF
							CASE 8
								IF !gg_CARD8
									AwardOb P card_flute "seeingcard"
									Add gg_CARD8
									Add gg_FoundCard
								ENDIF
							CASE 9
								IF !gg_CARD9
									AwardOb P card_house "seeingcard"
									Add gg_CARD9
									Add gg_FoundCard
								ENDIF
							CASE 10
								IF !gg_CARD10
									AwardOb P card_phoenix "seeingcard"
									Add gg_CARD10
									Add gg_FoundCard
								ENDIF
							CASE 11
								IF !gg_CARD11
									AwardOb P card_pine "seeingcard"
									Add gg_CARD11
									Add gg_FoundCard
								ENDIF
							CASE 12
								IF !gg_CARD12
									AwardOb P card_scales "seeingcard"
									Add gg_CARD12
									Add gg_FoundCard
								ENDIF
							CASE 13
								IF !gg_CARD13
									AwardOb P card_sword "seeingcard"
									Add gg_CARD13
									Add gg_FoundCard
								ENDIF
							CASE 14
								IF !gg_CARD14
									AwardOb P card_tiger "seeingcard"
									Add gg_CARD14
									Add gg_FoundCard
								ENDIF
							CASE 15
								IF !gg_CARD15
									AwardOb P card_water "seeingcard"
									Add gg_CARD15
									Add gg_FoundCard
								ENDIF
						ENDSWITCH
					ENDWHILE

					IF !gt_MYX001
						//"Here is a spirit card..."
						Say myx001 MELLISSA.BIN
						Add gt_MYX001
					ENDIF
				ENDWHILE

				MessagesOn

			CASE 9
				//Baradathlin

				//"...my home...Fay Queen..."
				Say myh001
				
				IF !co_FAY
					Capture MEL cF_OBJ_ACCEPT_1H1
					Capture P cM_OBJ_ACCEPT_1H1
					UUComplete P
					AwardOb P mel_talisman "thing"
					AwardOb P fay_key "and-another-thing"

					//"...doorway...hidden..."
					Say myh002

					Add co_FAY
				ENDIF

			CASE 10
				//Doorway

				//"...hidden..."
				Say myh003

			CASE 11
				//Fay Queen

				//"...evil..."
				Say myh004

			CASE 0
				//Leave

				Capture MEL cF_MEL_KNEEL1

				//"Farewell Then. And may the spirits guide you."
				Say my0057
				UUComplete MEL
		ENDSWITCH
	ENDWHILE

	// *** END CONVERSATION WITH MEL ***

	RunS MelActions
//	DrawSwordRemember
	Widescreen FALSE

END

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

VIG LaenActions FALSE

	LookAt LAEN P
	AddControl LAEN Capture cM_STAND1
	AddControl LAEN Capture cM_STAND2
	AddControl LAEN Capture cM_STAND3
	AddControl LAEN Capture cM_STAND4
	SequenceRandomlySelects LAEN

END

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

VIG TalkToCandiceFinal MSG-iCANDICE5

	Say nd0051 CANDICE5.BIN

END

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

VIG TalkToChant MSG-iLAEN

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P LAEN

	// *** START CONVERSATION WITH LAEN ***

	IF mj_DEFEAT_BART
		Say damd01
	ELSE

		IF ce_LAEN
			//"Destiny crosses our paths once again, Blood of Andrus."
			Say da0010
		ELSE
			//"Good day...We met briefly at the inn."
			//Say da0008
			//"Chant is a name that...means 'traveller'..."
			Say da0009

			ChangeProfileToIdentified Mbloodkin_Chant
			Add ce_LAEN
		ENDIF

		ResetChoice
		WHILE !MenuExit
			ClearChoices

			// *** SETUP MENU ***

			IF mj_HEX_COMPASS
				IF gt_CHANT_SEVEN_KINGS
					//Seven Kings' Barrow
					AddChoice 1 tx0060
				ELSE
					//Tales
					AddChoice 1 tx020a
				ENDIF
			ENDIF

			//IF gt_CHANT_BOOK_WORLD
				//Book of the World
				//AddChoice 2 tx0084
			//ELSE
				//Work
				//AddChoice 2 tx0004
			//ENDIF
		
			//Show Casket
			IF POS-P-casket
				AddChoice 3 tx0018
			ENDIF
		
			//Seal with 3 knives
			IF co_GUILDSEAL
				AddChoice 4 txt200
			ENDIF
		
			//Guild of Assassins
			IF co_THEGUILD
				AddChoice 5 tx0097
			ENDIF
		
			//Raal
			IF co_RAAL
				AddChoice 6 tx0032
			ENDIF
			
			//Temple of Shadows
			IF co_TEMPLE_OF_SHADOWS && !mj_FOUND_TOME
				AddChoice 7 tx0015
			ENDIF

			//Exit
			AddChoice 0 tx0003

			// *** DISPLAY THE MENU ***
			GetChoice LAEN

			// *** DEAL WITH THE CHOICE ***
			SWITCH CHOICE
				case 1
					//Tales -or- Seven Kings' Barrow

					//"To the north-west and beyond the Path of Shadows..."
					Say da0036
					//"I journeyed there, and stood before the Path..."
					Say da036a
					//"The Path is north of Ravenscar...a great gate...I do not know who holds the key."
					Say da036b

					//player gets the same story under a different name
					Add gt_CHANT_SEVEN_KINGS

				//case 2
					//Work -or- Book of the World

					//"Many years ago...a vast tome..."
					//say da0015
					//"The Book of The World still exists...we may yet find the book."
					//Say da015a

					//player gets the same story under a different name
					//Add gt_CHANT_BOOK_WORLD

				case 3
					//Show Casket

					//"I would advise you to be rid of this...how did this come to you?"
					Say da0030
					//"Through Will Farshore...a man called Jake"
					Say Hx0129
					//"Jake lives on the old estate...has a symbol of evil on it..."
					Say da0032

					Add co_JAKE

				case 4
					//Seal with 3 knives

					//"...the Guild of Assassins...rid yourself of it..."
					Say da0033

					Add co_THEGUILD

				case 5
					//Guild of Assassins

					//"...ruthless, mercenary...powers of darkness...demons...Shadows and even Raal."
					Say da0034

					Add co_RAAL

				case 6
					//Raal

					//"...evil...demons...serve a powerful master."
					Say da021a

				case 7
					//Temple of Shadows

					//"The Temple is now a memory..."
					Say da0022

			ENDSWITCH
		ENDWHILE

		// *** END CONVERSATION WITH LAEN ***

	ENDIF

	RunS LaenActions
	Widescreen FALSE

END

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

VIG TalkToRenya MSG-iRENYA

	Widescreen TRUE
	UnDrawSwordRemember
	EngageAndFace P RENYA

	IF ce_RENYA
		Say pe0002
	ELSE
		Say pe0001
		Add ce_RENYA
		ChangeProfileToIdentified Mbloodkin_Renya
	ENDIF

	ResetChoice
	WHILE !MenuExit
		ClearChoices
		AddChoice 1 txpe01

		IF gt_RENYA_TALK_2
			AddChoice 2 txpi02
		ENDIF

		IF gt_RENYA_TALK_3
			AddChoice 3 txry02
		ENDIF

		AddChoice 0 tx0003

		GetChoice RENYA

		SWITCH Choice

			CASE 1
				Say pe0003
				Add gt_RENYA_TALK_2

			CASE 2
				Say pe0005
				Add gt_RENYA_TALK_3

			CASE 3
				Say pe0006
				IF !gt_RENYA_IN_FENS
					QLAdd ql301 qlt301 qlb301
					Add gt_RENYA_IN_FENS
				ENDIF

		ENDSWITCH
	ENDWHILE

	Widescreen FALSE

END

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

