/////////////////////////////////////////////////////////////////////
// LILITH.S		-	The Ice Queen's domain
/////////////////////////////////////////////////////////////////////

SETUP

	ResetStats LILITH
	PlaceC LILITH pLILITH
	AwardOb LILITH mess4 "stolen-sword"

	RemoveC P
	PlaceC P pP
	camcut P

	SetPCModel				PCstage5
	ChangeProfilePortrait P	PC5.BIN

	IF POS-P-mess2
		DeleteObjectsInBackpackWithID P mess2
	ENDIF
	IF POS-P-mess3
		DeleteObjectsInBackpackWithID P mess3
	ENDIF
	StealAllPlayersEquipmentAndPlaceAt pEQUIP

	PlaceC ICE_SKEL_00 pS00
	Add gt_CUE_SKELEDEATH
	Set gt_ICE_SWITCH 0
	Set gt_ICE_COLOUR 0
	Set gt_ICE_SKELES 0

	QLAdd ql403 qlt403 qlb403

	IF !HSACTIVE-MIRES2
		ActivateHexStone MIRES2
	ENDIF

END

VIG TempSetup FALSE

	DisableTeleport LI_GT
	DisableTeleport LI_EM

	Set	gd_WEATHER_TYPE	0

	// temp disable snow 
	//Set gd_WEATHER_TYPE	1

	Set gd_WIND_TYPE	4
    RunS CueWeather

//	SetWaterType 1
//	SetWaterAnimSpeed 0
//	SetLiquid ALL 1000 0 0

	CachePortrait LILITH.BIN

	ClearDamaged LILITH

END

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

VIG HorribleDemoBodge DEMO_LILITH

	Remove DEMO_LILITH

	PostMsg m_pDESTE
	camcut P

END

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

VIG SkeleDeath gt_CUE_SKELEDEATH

	camnlock 270
	Remove gt_CUE_SKELEDEATH

	Fade 0 0
	FX_GreenFire P
	SetHP ICE_SKEL_00 17
	FireDamageNA ICE_SKEL_00 117
	Capture P cM_V6_LOOK_AROUND2_BETTER
	RunS TeleSkele
	UUComplete P
	Widescreen FALSE

END

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

VIG UpdateLights FIVESEC

	FX_RedFireGlow pRED
	FX_BlueFireGlow pBLUE
	FX_WhiteFireGlow pBONUS_ARCH

	IF gt_ICE_SWITCH=1
		FX_WhiteFireGlow pSWITCH
	ENDIF

	IF gt_ICE_COLOUR=1
		FX_BlueFireGlow pFIRE1
		FX_BlueFireGlow pFIRE2
		FX_BlueFireGlow pFIRE3
		FX_BlueFireGlow pFIRE4
	ELSE
		FX_RedFireGlow pFIRE1
		FX_RedFireGlow pFIRE2
		FX_RedFireGlow pFIRE3
		FX_RedFireGlow pFIRE4
	ENDIF

END

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

VIG HitSwitch MSG-iSWITCH

	Widescreen TRUE
	MoveCDir P pP_TOUCH
	AddControl P Capture cM_POINT
	UUComplete P
	IF gt_ICE_SWITCH=1
		Set gt_ICE_SWITCH 0
	ELSE
		Set gt_ICE_SWITCH 1
	ENDIF
	RunS UpdateLights
	Widescreen FALSE

END

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

VIG UseArch1 INAREA-P-ARCH1

	IF gt_ICE_COLOUR=1
		RunS GotoA
	ELSE
		RunS GotoB
	ENDIF

	Set gt_ICE_COLOUR 0
	RunS TeleSkele

END

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

VIG UseArch2 INAREA-P-ARCH2

	IF gt_ICE_COLOUR=1
		RunS GotoB
	ELSE
		RunS GotoA
	ENDIF

	Set gt_ICE_COLOUR 1
	RunS TeleSkele

END

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

VIG UseArch3 INAREA-P-ARCH3

	IF gt_ICE_SWITCH=1
		IF gt_ICE_COLOUR=1
			RunS GotoD
		ELSE
			RunS GotoE
		ENDIF
	ELSE
		RunS GotoC
	ENDIF

	RunS TeleSkele

END

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

VIG UseArch4 INAREA-P-ARCH4

	IF gt_ICE_SWITCH=1
		RunS GotoC
	ELSE
		IF gt_ICE_COLOUR=1
			RunS GotoE
		ELSE
			RunS GotoC
		ENDIF
	ENDIF

	RunS TeleSkele

END

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

VIG UseBonusArch INAREA-P-BONUS_ARCH

	PostMsg m_pP
	campan p
	FX_GreenFire P

END

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

VIG GotoA FALSE

	PostMsg m_pDESTA
	campan P
	FX_GreenFire P

END

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

VIG GotoB FALSE

	PostMsg m_pDESTB
	campan P
	FX_GreenFire P

END

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

VIG GotoC FALSE

	PostMsg m_pDESTC
	campan P
	FX_GreenFire P

END

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

VIG GotoD FALSE

	PostMsg m_pDESTD
	campan P
	FX_GreenFire P

END

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

VIG GotoE FALSE

	PostMsg m_pDESTE
	campan P
	FX_GreenFire P

END

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

VIG TeleSkele FALSE

	AddTo gt_ICE_SKELES 1
	
	IF gt_ICE_SKELES=1
		PlaceC ICE_SKEL_01 pS01
		FX_GreenFire ICE_SKEL_01
		Wander ICE_SKEL_01
		SwitchOnSightOfPlayer ICE_SKEL_01 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=2
		PlaceC ICE_SKEL_02 pS02
		FX_GreenFire ICE_SKEL_02
		Wander ICE_SKEL_02
		SwitchOnSightOfPlayer ICE_SKEL_02 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=3
		PlaceC ICE_SKEL_03 pS03
		FX_GreenFire ICE_SKEL_03
		Wander ICE_SKEL_03
		SwitchOnSightOfPlayer ICE_SKEL_03 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=4
		PlaceC ICE_SKEL_04 pS04
		FX_GreenFire ICE_SKEL_04
		Wander ICE_SKEL_04
		SwitchOnSightOfPlayer ICE_SKEL_04 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=5
		PlaceC ICE_SKEL_05 pS05
		FX_GreenFire ICE_SKEL_05
		Wander ICE_SKEL_05
		SwitchOnSightOfPlayer ICE_SKEL_05 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=6
		PlaceC ICE_SKEL_06 pS06
		FX_GreenFire ICE_SKEL_06
		Wander ICE_SKEL_06
		SwitchOnSightOfPlayer ICE_SKEL_06 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=7
		PlaceC ICE_SKEL_07 pS07
		FX_GreenFire ICE_SKEL_07
		Wander ICE_SKEL_07
		SwitchOnSightOfPlayer ICE_SKEL_07 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=8
		PlaceC ICE_SKEL_08 pS08
		FX_GreenFire ICE_SKEL_08
		Wander ICE_SKEL_08
		SwitchOnSightOfPlayer ICE_SKEL_08 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=9
		PlaceC ICE_SKEL_09 pS09
		FX_GreenFire ICE_SKEL_09
		Wander ICE_SKEL_09
		SwitchOnSightOfPlayer ICE_SKEL_09 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=10
		PlaceC ICE_SKEL_10 pS10
		FX_GreenFire ICE_SKEL_10
		Wander ICE_SKEL_10
		SwitchOnSightOfPlayer ICE_SKEL_10 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=11
		PlaceC ICE_SKEL_11 pS11
		FX_GreenFire ICE_SKEL_11
		Wander ICE_SKEL_11
		SwitchOnSightOfPlayer ICE_SKEL_11 AttackDemo2
	ELSE
	IF gt_ICE_SKELES=12
		PlaceC ICE_SKEL_12 pS12
		FX_GreenFire ICE_SKEL_12
		Wander ICE_SKEL_12
		SwitchOnSightOfPlayer ICE_SKEL_12 AttackDemo2
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF
	ENDIF

END

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

VIG MeetLilithAgain ONESEC && (INAREA-P-NEAR_LILITH || DAMAGED-LILITH) && !gt_P_V_LILITH_AGAIN && !ISDEAD-LILITH

	FreezeC ICE_SKEL_01
	FreezeC ICE_SKEL_02
	FreezeC ICE_SKEL_03
	FreezeC ICE_SKEL_04
	FreezeC ICE_SKEL_05
	FreezeC ICE_SKEL_06
	FreezeC ICE_SKEL_07
	FreezeC ICE_SKEL_08
	FreezeC ICE_SKEL_09
	FreezeC ICE_SKEL_10
	FreezeC ICE_SKEL_11
	FreezeC ICE_SKEL_12
	Widescreen TRUE

	Engage P LILITH 750

	QuickSay li0010

	IF DAMAGED-LILITH
		WHILE SPEAKING
			SetHP LILITH 2500
			Wait 250
		ENDWHILE
	ENDIF

	DrawSword LILITH

	UUComplete LILITH
	PlayChopCapture LILITH
	FX_UpgradeSword LILITH
	Say li0011

	GiveSightOfPlayerTo LILITH
	DelayControl LILITH 3 2
	AddControl LILITH AttackDemo2
	Add gt_P_V_LILITH_AGAIN

	Widescreen FALSE
	UnFreezeC ICE_SKEL_01
	UnFreezeC ICE_SKEL_02
	UnFreezeC ICE_SKEL_03
	UnFreezeC ICE_SKEL_04
	UnFreezeC ICE_SKEL_05
	UnFreezeC ICE_SKEL_06
	UnFreezeC ICE_SKEL_07
	UnFreezeC ICE_SKEL_08
	UnFreezeC ICE_SKEL_09
	UnFreezeC ICE_SKEL_10
	UnFreezeC ICE_SKEL_11
	UnFreezeC ICE_SKEL_12

END

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

VIG LilithDeath ONESEC && gt_P_V_LILITH_AGAIN && ISDEAD-LILITH

	Widescreen TRUE
	Remove gt_P_V_LILITH_AGAIN
	Say li0012
	Add mj_DEFEAT_LILITH
	Wait 2500
	Widescreen FALSE

	Set gg_FX_LILITH_DEATH 0

END

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

VIG GotMessengerAgain FIVESEC && mj_DEFEAT_LILITH && POS-P-mess4

	Widescreen TRUE
	QLRemove ql403
	Wait 2500
	RunS QPalFadeBLACK
	FX_GreenFire P
	Wait 500
	FX_BurnPerson P
	UUFade
	Widescreen FALSE
	PostMsg t_EM_LI

END

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

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

VIG FlyBy FALSE

	Widescreen TRUE

	// prepare characters for flyby

	RemoveC ICE_SKEL_01
	RemoveC ICE_SKEL_02
	RemoveC ICE_SKEL_03
	RemoveC ICE_SKEL_04
	RemoveC ICE_SKEL_05
	RemoveC ICE_SKEL_06
	RemoveC ICE_SKEL_07
	RemoveC ICE_SKEL_08
	RemoveC ICE_SKEL_09
	RemoveC ICE_SKEL_10
	RemoveC ICE_SKEL_11
	RemoveC ICE_SKEL_12
	PlaceC ICE_SKEL_01 pS01
	PlaceC ICE_SKEL_02 pS02
	PlaceC ICE_SKEL_03 pS03
	PlaceC ICE_SKEL_04 pS04
	PlaceC ICE_SKEL_05 pS05
	PlaceC ICE_SKEL_06 pS06
	PlaceC ICE_SKEL_07 pS07
	PlaceC ICE_SKEL_08 pS08
	PlaceC ICE_SKEL_09 pS09
	PlaceC ICE_SKEL_10 pS10
	PlaceC ICE_SKEL_11 pS11
	PlaceC ICE_SKEL_12 pS12
	Wander ICE_SKEL_01
	Wander ICE_SKEL_02
	Wander ICE_SKEL_03
	Wander ICE_SKEL_04
	Wander ICE_SKEL_05
	Wander ICE_SKEL_06
	Wander ICE_SKEL_07
	Wander ICE_SKEL_08
	Wander ICE_SKEL_09
	Wander ICE_SKEL_10
	Wander ICE_SKEL_11
	Wander ICE_SKEL_12

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

	// I've inserted calls to light up the archways in the centre.
	// You can pan the camera around as you like before and after
	// these calls.
	// Bear in mind that the FireGlow effects only last for five
	// seconds (125 frames) so you might want to put in some extra
	// FX calls.
	// The skeletons are just wandering about randomly, my advice is
	// to ignore them and if they show up in the final video, fine.

	SetCamMoveConstant 20
	FreeCam
	PhotoOn	

// pan across ice and up to the central arches


	camcut flyby04
	UUCameraComplete

	campan flyby05
	UUCameraComplete

	SetCamMoveConstant 10

	campan flyby07
	UUCameraComplete

	Wait 2000

// now light up the archways and look at them
	FX_RedFireGlow pRED
	FX_BlueFireGlow pBLUE

	SetCamMoveConstant 50
	UUCameraComplete

	PhotoOff

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

	Widescreen FALSE

END


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

VIG DoDeathEffectLilith ONESEC && gg_FX_LILITH_DEATH && gg_FX_LILITH_DEATH<4
	AddTo gg_FX_LILITH_DEATH 1

	IF gg_FX_LILITH_DEATH=4
		FX_RevSpiritToPerson LILITH P 4
		AwardEP xp_DEFEAT_LILITH
	ENDIF
END

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