/* CONTENTS */
/* Branwen's sleep aid */
/* Garrick's recital */
/* Imoen - totem animal */
/* Safana's escape */
/* Fighting practice with Shar-Teel */
/* Goodnight Deheriana */

/* Branwen's sleep aid */
IF %BGT_VAR%
Global("X#KivanBran2","GLOBAL",0)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InParty("branwen")
!StateCheck("branwen",CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#KivanBran2","GLOBAL",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("branwen")
END

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


/* Garrick's recital */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
Global("X#KivanGavinRecital","LOCALS",0)
InParty("garrick")
!StateCheck("garrick",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#KivanGavinRecital","LOCALS",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("garrick")
END

IF %BGT_VAR%
Global("X#KivanGavinRecital","LOCALS",1)
InParty("garrick")
!StateCheck("garrick",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("garrick")
END

/* Imoen - totem animal */
IF %BGT_VAR%
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
Global("X#KivImTot","LOCALS",0)
InParty("%IMOEN_DV%")
!StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!AreaType(DUNGEON)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#KivImTot","LOCALS",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("%IMOEN_DV%")
END

IF %BGT_VAR%
Global("X#KivImTot","LOCALS",1)
InParty("%IMOEN_DV%")
!StateCheck("%IMOEN_DV%",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!AreaType(DUNGEON)
CombatCounter(0)
!See([ENEMY])
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("%IMOEN_DV%")
END

/* Safana's escape */
IF %BGT_VAR%
Global("X#KISA1","LOCALS",0)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty("safana")
!StateCheck("safana",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#KISA1","LOCALS",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("safana")
END

IF %BGT_VAR%
Global("X#KISA1","LOCALS",1)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty("safana")
!StateCheck("safana",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("safana")
END

/* Fighting practice with Shar-Teel */
IF %BGT_VAR%
Global("X#KISH1","LOCALS",0)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty("sharteel")
!StateCheck("sharteel",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#KISH1","LOCALS",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("sharteel")
END

IF %BGT_VAR%
Global("X#KISH1","LOCALS",1)
InParty("sharteel")
!StateCheck("sharteel",CD_STATE_NOTVALID)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet("sharteel")
END

/* Goodnight Deheriana */
IF %BGT_VAR%
GlobalGT("P#KiFriendTalk","GLOBAL",10)
Global("X#KIPC8","GLOBAL",0)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#KIPC8","GLOBAL",1)
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
Global("X#KIPC8","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
RealGlobalTimerExpired("X#DreamTalk","GLOBAL")
THEN
RESPONSE #100
RealSetGlobalTimer("X#DreamTalk","GLOBAL",180)
StartDialogueNoSet(Player1)
END
