
//This is the .d file for C#Q01001.CRE (Alanna) and C#Q01002.CRE (Eltolth) 
//slime quest jastey (Q01)

BEGIN ~C#Q01001~

IF ~Global("C#Q01_TalkedOutside","GLOBAL",0)~ THEN alanna_talk
SAY @0
++ @1 + alanna_01
++ @2 + alanna_01
++ @3 + alanna_02
END

IF ~~ THEN alanna_01
SAY @4
IF ~~ THEN DO ~DialogInterrupt(FALSE) SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",1) SetGlobal("C#Q01_TalkedOutside","GLOBAL",1) MoveToPoint([1175.1701]) DestroySelf() DialogInterrupt(TRUE)~ %UNSOLVED_JOURNAL% @63 EXIT
END

IF ~~ THEN alanna_02
SAY @5
IF ~~ THEN DO ~DialogInterrupt(FALSE) SetGlobal("C#Q01_TalkedOutside","GLOBAL",1) MoveToPoint([1175.1701]) DestroySelf() DialogInterrupt(TRUE)~ %UNSOLVED_JOURNAL% @64 EXIT
END

IF ~Global("C#Q01_Retransformation","GLOBAL",0) Global("C#Q01_TalkedOutside","GLOBAL",1) Global("C#Q01_TalkedToAlanna","GLOBAL",0)~ THEN alanna_please
SAY @6
++ @7 DO ~SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",1)~ + alanna_03
++ @8 EXIT
END

IF ~Global("C#Q01_Retransformation","GLOBAL",0) Global("C#Q01_TalkedToAlanna","GLOBAL",1)~ THEN alanna_talk2
SAY @9
++ @10 + alanna_03
++ @8 DO ~SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",0)~ EXIT
END

IF ~~ THEN alanna_03
SAY @11
IF ~~ THEN DO ~GiveItemCreate("C#Q01001",[PC],0,0,0)~ + alanna_04
END

IF ~~ THEN alanna_04
SAY @12
= @13
= @14
++ @70 DO ~SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",2)~ + alanna_04_2
++ @71 DO ~SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",2)~ + alanna_04_1
++ @72 DO ~SetGlobal("C#Q01_TalkedToAlanna","GLOBAL",2)~ EXIT
END

IF ~~ THEN alanna_04_1
SAY @73
++ @74 + alanna_04_2
++ @75 + alanna_04_3
++ @76 EXIT
END

IF ~~ THEN alanna_04_2
SAY @77
IF ~~ THEN EXIT
END

IF ~~ THEN alanna_04_3
SAY @78
IF ~~ THEN DO ~GiveGoldForce(30) SetGlobal("C#Q01_AlannasGold","GLOBAL",1)~ + alanna_04_2
END

IF ~Global("C#Q01_AlannaEnddialog","GLOBAL",3) Global("C#Q01_TransformationFailed","GLOBAL",1)~ THEN failed
SAY @79 
+ ~PartyHasItem("C#Q01003")~ + @80 + failed_01
++ @81 + failed_02
++ @82 + failed_03
++ @83 + failed_02
END

IF ~~ THEN failed_01
SAY @84
IF ~~ THEN DO ~	ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01003")
	Face(10)
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ActionOverride("C#Q01003",DestroySelf())
	SetGlobal("C#Q01_Transformation","GLOBAL",1)
	EndCutSceneMode()
~ EXIT
END

IF ~~ THEN failed_02
SAY @85
+ ~PartyHasItem("C#Q01003")~ + @86 + failed_01
++ @87 + failed_03
+ ~Global("C#Q01_AlannasGold","GLOBAL",0)~ + @88 + failed_05
+ ~GlobalGT("C#Q01_AlannasGold","GLOBAL",0)~ + @88 + failed_06
END

IF ~~ THEN failed_03
SAY @89
++ @90 + failed_04
+ ~PartyHasItem("C#Q01003")~ + @91 + failed_01
++ @92 + failed_07
END

IF ~~ THEN failed_04
SAY @93
IF ~Global("C#Q01_AlannasGold","GLOBAL",0)~ THEN + failed_05
IF ~GlobalGT("C#Q01_AlannasGold","GLOBAL",0)~ THEN + failed_06
END

IF ~~ THEN failed_05
SAY @94
IF ~~ THEN DO ~GiveGoldForce(30)~ + failed_06
END

IF ~~ THEN failed_06
SAY @95
IF ~~ THEN DO ~TakePartyItem("C#Q01002") AddexperienceParty(500) SetGlobal("C#Q01_Retransformation","GLOBAL",3) %ERASEJOURNALENTRY_63% %ERASEJOURNALENTRY_64% %ERASEJOURNALENTRY_66% %ERASEJOURNALENTRY_67% ActionOverride("C#Q01003",EscapeArea()) EscapeArea()~ %SOLVED_JOURNAL% @96 EXIT
END

IF ~~ THEN failed_07
SAY @97
++ @98 + failed_09
++ @99 + failed_08
++ @100 + failed_08
END

IF ~~ THEN failed_08
SAY @101
IF ~~ THEN + failed_09
END

IF ~~ THEN failed_09
SAY @102
IF ~~ THEN DO ~TakePartyItem("C#Q01002") AddexperienceParty(500) SetGlobal("C#Q01_Retransformation","GLOBAL",4) ReputationInc(-1) %ERASEJOURNALENTRY_63% %ERASEJOURNALENTRY_64% %ERASEJOURNALENTRY_66% %ERASEJOURNALENTRY_67% ActionOverride("C#Q01003",EscapeArea()) EscapeArea()~ %SOLVED_JOURNAL% @103 EXIT
END

IF ~Global("C#Q01_Retransformation","GLOBAL",0) Global("C#Q01_TalkedToAlanna","GLOBAL",2)~ THEN alanna_return
SAY @15
+ ~!PartyHasItem("C#Q01003") PartyHasItem("C#Q01002") Global("C#Q01_TalkedToTulbor","GLOBAL",0) Global("C#Q01_AskedAboutTulbor","GLOBAL",0)~ + @68 DO ~SetGlobal("C#Q01_AskedAboutTulbor","GLOBAL",1)~ + alanna_tulbor
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_TalkedToTulbor","GLOBAL",0)~ + @16 EXIT 
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_TalkedToTulbor","GLOBAL",1) Global("C#Q01_AlannasGold","GLOBAL",0)~ + @17 + alanna_05
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_TalkedToTulbor","GLOBAL",1) Global("C#Q01_AlannasGold","GLOBAL",1)~ + @17 + alanna_05b
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_TalkedToTulbor","GLOBAL",1) Global("C#Q01_AlannasGold","GLOBAL",1)~ + @16 EXIT
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_TulborNoHelp","GLOBAL",1) Global("C#Q01_TalkedToTulbor","GLOBAL",0)~ + @19 EXIT 
+ ~!PartyHasItem("C#Q01003") Global("C#Q01_BoughtAntidote","GLOBAL",1) Global("C#Q01_TalkedToTulbor","GLOBAL",2)~ + @60 EXIT
+ ~!PartyHasItem("C#Q01004") Global("C#Q01_BoughtAlternative","GLOBAL",1) Global("C#Q01_TalkedToTulbor","GLOBAL",2)~ + @60 EXIT
+ ~PartyHasItem("C#Q01003")~ + @104 + alanna_07
+ ~PartyHasItem("C#Q01004")~ + @105 + alanna_08
++ @106 EXIT
++ @107 EXIT
END

IF ~~ THEN alanna_tulbor
SAY @69
IF ~~ THEN EXIT
END

IF ~~ THEN alanna_05
SAY @20
++ @21 + alanna_06
++ @22 DO ~GiveGoldForce(30) SetGlobal("C#Q01_AlannasGold","GLOBAL",2)~ EXIT 
END

IF ~~ THEN alanna_05b
SAY @108 
IF ~~ THEN DO ~SetGlobal("C#Q01_AlannasGold","GLOBAL",2)~ EXIT 
END

IF ~~ THEN alanna_06
SAY @23
IF ~~ THEN EXIT
END

IF ~~ THEN alanna_07
SAY @109
IF ~~ THEN DO ~	ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01003")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ActionOverride("C#Q01003",DestroySelf())
	SetGlobal("C#Q01_Transformation","GLOBAL",1)
	EndCutSceneMode()
~ EXIT
END


IF ~~ THEN alanna_08
SAY @109
IF ~RandomNum(5,1)~ THEN DO ~
	ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01004")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ActionOverride("C#Q01003",DestroySelf())
	SetGlobal("C#Q01_Transformation","GLOBAL",1)
	EndCutSceneMode()
~ EXIT
IF ~RandomNum(5,2)~ THEN DO ~
	ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01004")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ActionOverride("C#Q01003",DestroySelf())
	SetGlobal("C#Q01_Transformation","GLOBAL",1)
	EndCutSceneMode()
~ EXIT
IF ~RandomNum(5,3)~ THEN DO ~
	ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01004")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	SetGlobal("C#Q01_TransformationFailed","GLOBAL",1)
	Wait(2)
	EndCutSceneMode()
~ EXIT
IF ~RandomNum(5,4)~ THEN DO ~ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01004")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ForceSpellPoint([357.240],RED_SWIRL)
	Wait(1)
	ForceSpellPoint([357.240],RED_SWIRL)
	DestroySelf()
	SetGlobal("C#Q01_SlimeTransformation","GLOBAL",1)
	ReputationInc(-1) AddexperienceParty(500) 
	SetGlobal("C#Q01_Retransformation","GLOBAL",5) %ERASEJOURNALENTRY_63% %ERASEJOURNALENTRY_64% %ERASEJOURNALENTRY_66% %ERASEJOURNALENTRY_67%
	EndCutSceneMode()
~ %SOLVED_JOURNAL% @110 EXIT
IF ~RandomNum(5,5)~ THEN DO ~ClearAllActions()
	StartCutSceneMode()
	TakePartyItem("C#Q01004")
	MoveToPoint([312.258])
	Wait(2)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	Wait(1)
	ActionOverride("C#Q01003",ForceSpellPoint([357.250],RED_SWIRL))
	ForceSpellPoint([357.240],RED_SWIRL)
	Wait(1)
	ForceSpellPoint([357.240],RED_SWIRL)
	DestroySelf()
	SetGlobal("C#Q01_SlimeTransformation","GLOBAL",1)
	ReputationInc(-1) AddexperienceParty(500) 
	SetGlobal("C#Q01_Retransformation","GLOBAL",5) %ERASEJOURNALENTRY_63% %ERASEJOURNALENTRY_64% %ERASEJOURNALENTRY_66% %ERASEJOURNALENTRY_67%
	EndCutSceneMode()
~ %SOLVED_JOURNAL% @110 EXIT
END

IF ~Global("C#Q01_EltoFriendly","GLOBAL",1) Global("C#Q01_Retransformation","GLOBAL",2)~ THEN alanna_end1
SAY @26
IF ~~ THEN EXIT
END

IF ~Global("C#Q01_EltoFriendly","GLOBAL",2) Global("C#Q01_Retransformation","GLOBAL",2)~ THEN alanna_end2
SAY @27
IF ~~ THEN EXIT
END

IF WEIGHT #1 ~Global("C#Q01_Eltoltdead","GLOBAL",1)~ THEN eltolth_dead
SAY @62
IF ~~ THEN DO ~EscapeArea()~ EXIT
END

CHAIN  
IF ~See("C#Q01002") Global("C#Q01_Retransformation","GLOBAL",1)~ THEN C#Q01001 happy_chain
@28
== C#Q01002 @29
== C#Q01001 @30
== C#Q01002 @31
== C#Q01001 @32
== C#Q01002 @33
== C#Q01001 @34
== C#Q01002 @35
== C#Q01001 @36
== C#Q01002 @37
= @38
= @39
== C#Q01001 @40
== C#Q01002 @41
== C#Q01001 @42
== C#Q01002 @43
== C#Q01001 @44
== C#Q01002 @45
== C#Q01001 @46
== C#Q01002 @47
= @48 
== C#Q01001 @49  
END
++ @50 DO ~SetGlobal("C#Q01_Retransformation","GLOBAL",2) TakePartyItem("C#Q01002")~ EXTERN C#Q01002 elto_01
+ ~Gender(Player1,male)~ + @51 DO ~SetGlobal("C#Q01_Retransformation","GLOBAL",2)~ EXTERN C#Q01002 elto_03
+ ~Gender(Player1,female)~ + @52 DO ~SetGlobal("C#Q01_Retransformation","GLOBAL",2)~ EXTERN C#Q01002 elto_03
++ @53 DO ~SetGlobal("C#Q01_Retransformation","GLOBAL",2)~ EXTERN C#Q01002 elto_03

BEGIN ~C#Q01002~

IF ~Global("C#Q01_EltoFriendly","GLOBAL",1) Global("C#Q01_Retransformation","GLOBAL",2)~ THEN elto_end1
SAY @54 
IF ~~ THEN EXIT
END

IF ~Global("C#Q01_EltoFriendly","GLOBAL",2) Global("C#Q01_Retransformation","GLOBAL",2)~ THEN elto_end2
SAY @55
IF ~~ THEN EXIT
END

IF ~~ THEN elto_01
SAY @56 
IF ~~ THEN DO ~SetGlobal("C#Q01_EltoFriendly","GLOBAL",1) ReputationInc(1) GiveGoldForce(200) AddexperienceParty(500)~ + elto_02
END

IF ~~ THEN elto_02
SAY @57
IF ~~ THEN DO ~%ERASEJOURNALENTRY_63% %ERASEJOURNALENTRY_64% %ERASEJOURNALENTRY_66% %ERASEJOURNALENTRY_67% AddJournalEntry(@65%QUEST_DONE%)~ EXIT
END

IF ~~ THEN elto_03
SAY @58
++ @59 DO ~SetGlobal("C#Q01_EltoFriendly","GLOBAL",2) TakePartyItem("C#Q01002") GiveGoldForce(200) AddexperienceParty(500)~ + elto_02
END

IF WEIGHT #1 ~Global("C#Q01_AlannaDead","GLOBAL",1)~ THEN alanna_dead
SAY @61
IF ~~ THEN DO ~EscapeArea()~ EXIT
END
