/* CONTENTS */
/* Dream Timer */
/* Talk timer */
/* Friend talks */
///* Friend Talk 1 */
///* Friend talks 2 & 3 */
/* Kagain/Yeslick Fight if Kagain Wins */

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

/* Talk timer */
IF %BGT_VAR%
InParty(Myself)
Global("X#KaPCTimerStarted","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#KaFriendTalkTime","GLOBAL",1800)
SetGlobal("X#KaPCTimerStarted","GLOBAL",1)
END

/* Friend talks */
///* Friend Talk 1 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#KaFriendTalkTime","GLOBAL")
Global("X#KaFriendTalk","GLOBAL",0)
Global("X#KaFriendCheck","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#KaFriendTalk","GLOBAL",1)
SetGlobal("X#KaFriendCheck","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#KaFriendTalk","GLOBAL",1)
Global("X#KaFriendCheck","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("kagain99")
StartDialogueNoSet(Player1)
END

///* Friend talks 2 & 3 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#KaFriendTalkTime","GLOBAL")
GlobalGT("Chapter","GLOBAL",%tutu_chapter_3%)
Global("X#KaFriendCheck","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
OR(2)
Global("X#KaFriendTalk","GLOBAL",2)
Global("X#KaFriendTalk","GLOBAL",4)
THEN
RESPONSE #100
IncrementGlobal("X#KaFriendTalk","GLOBAL",1)
SetGlobal("X#KaFriendCheck","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#KaFriendCheck","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
OR(2)
Global("X#KaFriendTalk","GLOBAL",3)
Global("X#KaFriendTalk","GLOBAL",5)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("kagain99")
StartDialogueNoSet(Player1)
END

/* Kagain/Yeslick Fight if Kagain Wins */
IF %BGT_VAR%
Global("X#YeKaFight","GLOBAL",1)
Dead("yeslick")
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
See(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("kagain99")
StartDialogueNoSet(Player1)
END