/* CONTENTS */
/* Dream timer */
/* PC talk timer */
/* PC talks 1 and 2 */
/* PC talk 3 - requires Minsc */
/* Skipping PC talk 3 if no Minsc */
/* Bhaal talk */
/* Dynaheir-Branwen talk 1 */

/* Dream timer */
IF %BGT_VAR%
InParty(Myself)
Global("X#DreamTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
SetGlobal("X#DreamTimerStarted","GLOBAL",1)
END

/* PC talk timer */
IF %BGT_VAR%
InParty(Myself)
Global("X#DyPCTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#DyFriendTalkTime","GLOBAL",1800)
SetGlobal("X#DyPCTimerStarted","GLOBAL",1)
END

/* PC talks 1 and 2 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DyFriendTalkTime","GLOBAL")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
OR(2)
Global("X#DyFriendTalk","GLOBAL",0)
Global("X#DyFriendTalk","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("X#DyFriendTalk","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
OR(2)
Global("X#DyFriendTalk","GLOBAL",1)
Global("X#DyFriendTalk","GLOBAL",3)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("dynah99")
StartDialogNoSet(Player1)
END

/* PC talk 3 - requires Minsc */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DyFriendTalkTime","GLOBAL")
InParty(Myself)
InParty("minsc")
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
Global("X#DyFriendTalk","GLOBAL",4)
THEN
RESPONSE #100
IncrementGlobal("X#DyFriendTalk","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
InParty("minsc")
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
Global("X#DyFriendTalk","GLOBAL",5)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("dynah99")
StartDialogNoSet(Player1)
END

/* Skipping PC talk 3 if no Minsc */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DyFriendTalkTime","GLOBAL")
InParty(Myself)
!InParty("minsc")
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
Global("X#DyFriendTalk","GLOBAL",4)
THEN
RESPONSE #100
SetGlobal("X#DyFriendTalk","GLOBAL",6)
END

/* Bhaal talk */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DyFriendTalkTime","GLOBAL")
Global("P#KnowBhaal","GLOBAL",1)
Global("X#DyFriendTalk","GLOBAL",6)
OR(2)
!Global("X#DynahMatch","GLOBAL",1)
Global("X#DynaheirRomanceInactive","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
CombatCounter(0)
THEN
RESPONSE #100
IncrementGlobal("X#DyFriendTalk","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#DyFriendTalk","GLOBAL",7)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
CombatCounter(0)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("dynah99")
StartDialogueNoSet(Player1)
END

/* Dynaheir-Branwen talk 1 */
IF %BGT_VAR%
PartyRested()
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty("minsc")
InParty("branwen")
Global("X#DYBR1","GLOBAL",0)
InParty(Myself)
!StateCheck("branwen",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck("minsc",CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#DYBR1","GLOBAL",1)
END

IF %BGT_VAR%
InParty("minsc")
InParty("branwen")
Global("X#DYBR1","GLOBAL",1)
InParty(Myself)
!StateCheck("branwen",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck("minsc",CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
PlaySong(0)
PlaySound("dynah99")
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("branwen")
END
