/* CONTENTS */
/* Dream Timer */
/* Friendtalks */
///* Setting the timer */
///* Friend Talk 1 */
///* Friend Talk 2 */
///* Friend Talk 2 & 3 */
/* Blanket-folding with Jaheira */

/* 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

/* Friendtalks */
///* Setting the timer */
IF %BGT_VAR%
InParty(Myself)
Global("X#FaPCTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#FaFriendTalkTime","GLOBAL",60)
SetGlobal("X#FaPCTimerStarted","GLOBAL",1)
SetGlobal("X#FaFriendTalk","GLOBAL",1)
END

///* Friend Talk 1 */
IF %BGT_VAR%
AreaCheck("%CloakwoodMines%")
RealGlobalTimerExpired("X#FaFriendTalkTime","GLOBAL")
Global("X#FaFriendTalk","GLOBAL",1)
Global("X#FaFriendCheck","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
THEN
RESPONSE #100
IncrementGlobal("X#FaFriendTalk","GLOBAL",1)
SetGlobal("X#FaFriendCheck","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#FaFriendTalk","GLOBAL",2)
Global("X#FaFriendCheck","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("faldo99")
StartDialogueNoSet(Player1)
END

///* Friend Talk 2 & 3 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#FaFriendTalkTime","GLOBAL")
Global("X#FaFriendCheck","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
CombatCounter(0)
OR(2)
Global("X#FaFriendTalk","GLOBAL",3)
Global("X#FaFriendTalk","GLOBAL",5)
THEN
RESPONSE #100
IncrementGlobal("X#FaFriendTalk","GLOBAL",1)
SetGlobal("X#FaFriendCheck","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#FaFriendCheck","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
CombatCounter(0)
OR(2)
Global("X#FaFriendTalk","GLOBAL",4)
Global("X#FaFriendTalk","GLOBAL",6)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("faldo99")
StartDialogueNoSet(Player1)
END

/* Blanket-folding with Jaheira */
IF %BGT_VAR%
PartyRested()
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
Global("X#FAJA1","LOCALS",0)
Global("X#BlanketTalk","GLOBAL",0)
InParty("jaheira")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck("jaheira",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#BlanketTalk","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#BlanketTalk","GLOBAL",1)
InParty("jaheira")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck("jaheira",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet("jaheira")
END