/* set romance match */
IF %BGT_VAR%
InParty(Myself)
Global("X#XANMatch","GLOBAL",0)
Gender(Player1,FEMALE)
!Global("X#AjantisRomanceActive","GLOBAL",2)
OR(2)
Global("P#CoranLover","GLOBAL",0)
Global("P#CoranRomanceInactive","GLOBAL",1)
OR(2)
Race(Player1,ELF)
Race(Player1,HALF_ELF)
!HasItemEquiped("%tutu_var%BELT05",Player1) //girdle of gender bender
THEN
RESPONSE #100
SetGlobal("X#XANMatch","GLOBAL",1)
RealSetGlobalTimer("X#XaFlirtsTalkTime","GLOBAL",XAROM_TIMER)
END

/* Set Timer for scripted NPC Reactions */
IF %BGT_VAR%
InParty(Myself)
Global("X#XANMatch","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
Global("X#XaReactionTimerSet","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#XaReactionTimerSet","GLOBAL",1)
RealSetGlobalTimer("X#XaReactionTime","GLOBAL",XAROM_TIMER)
END

/* Set Romance Break if Ajantis or Coran are serious */
IF %BGT_VAR%
InParty(Myself)
InParty("ajantis")
Global("X#AjantisRomanceActive","GLOBAL",2)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XanRomCutByOther","GLOBAL",1)
SetGlobal("X#XARomanceInactive","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
InParty("coran")
!Global("P#CoranRomanceInactive","GLOBAL",1)
GlobalGT("P#CoranLover","GLOBAL",0)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XanRomCutByOther","GLOBAL",1)
SetGlobal("X#XARomanceInactive","GLOBAL",1)
END

/* PC cast one of her innate spells */
IF %BGT_VAR%
Global("X#XAFloatTalk1","GLOBAL",0)
InParty(Myself)
GlobalGT("%bgdreams%","GLOBAL",0)
OR(2)
HaveSpellParty(3101)
HaveSpellParty(3102)
OR(2)
Global("X#XARomanceActive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
Global("P#KnowBhaal","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#XAFloatTalk1","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFloatTalk1","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
!Global("X#XARomanceInactive","GLOBAL",1)
OR(2)
Global("X#XARomanceActive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
Global("P#KnowBhaal","GLOBAL",0)
GlobalGT("%bgdreams%","GLOBAL",0)
!HaveSpellParty(3101)
!HaveSpellParty(3102)
THEN
RESPONSE #100
SetGlobal("X#XAFloatTalk1","GLOBAL",2)
END

IF %BGT_VAR%
Global("X#XAFloatTalk1","GLOBAL",2)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* LoveTalks - RA = 1 */
IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",0)
InParty(Myself)
Global("X#XANMatch","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#XALoveTalk","GLOBAL",1)
SetGlobal("X#XARomanceActive","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",1)
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
!AreaCheck("%NashkelMines_L1%")
!AreaCheck("%NashkelMines_L2%")
!AreaCheck("%NashkelMines_L3%")
!AreaCheck("%NashkelMines_L4%")
!AreaCheck("%NashkelMines_MulaheysCave%")
AreaType(OUTDOOR)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XALoveTalkTime","GLOBAL")
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
OR(10)
Global("X#XALoveTalk","GLOBAL",3)
Global("X#XALoveTalk","GLOBAL",5)
Global("X#XALoveTalk","GLOBAL",7)
Global("X#XALoveTalk","GLOBAL",13)
Global("X#XALoveTalk","GLOBAL",15)
Global("X#XALoveTalk","GLOBAL",19)
Global("X#XALoveTalk","GLOBAL",21)
Global("X#XALoveTalk","GLOBAL",23)
Global("X#XALoveTalk","GLOBAL",25)
Global("X#XALoveTalk","GLOBAL",29)
!AreaType(DUNGEON)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

/* LoveTalks - RA = 1 Morning After LT5 */
IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",11)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

/* For LT 9 */
IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",17)
PartyRested()
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",1)
!AreaType(DUNGEON)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

/* LoveTalks - RA = 2 */
IF %BGT_VAR%
RealGlobalTimerExpired("X#XALoveTalkTime","GLOBAL")
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
!AreaType(DUNGEON)
OR(7)
Global("X#XALoveTalk","GLOBAL",31)
Global("X#XALoveTalk","GLOBAL",33)
Global("X#XALoveTalk","GLOBAL",35)
Global("X#XALoveTalk","GLOBAL",43)
Global("X#XALoveTalk","GLOBAL",45)
Global("X#XALoveTalk","GLOBAL",47)
Global("X#XALoveTalk","GLOBAL",49)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

/* LoveTalks - RA = 2 Morning After LT20 */
IF %BGT_VAR%
Global("X#XALoveTalk","GLOBAL",41)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("X#XALoveTalk","GLOBAL",1)
END

/* Triggering... */
IF %BGT_VAR%
RealGlobalTimerExpired("X#XALoveTalkTime","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
OR(24)
Global("X#XALoveTalk","GLOBAL",4)
Global("X#XALoveTalk","GLOBAL",6)
Global("X#XALoveTalk","GLOBAL",8)
Global("X#XALoveTalk","GLOBAL",10)
Global("X#XALoveTalk","GLOBAL",12)
Global("X#XALoveTalk","GLOBAL",14)
Global("X#XALoveTalk","GLOBAL",16)
Global("X#XALoveTalk","GLOBAL",18)
Global("X#XALoveTalk","GLOBAL",20)
Global("X#XALoveTalk","GLOBAL",22)
Global("X#XALoveTalk","GLOBAL",24)
Global("X#XALoveTalk","GLOBAL",26)
Global("X#XALoveTalk","GLOBAL",28)
Global("X#XALoveTalk","GLOBAL",30)
Global("X#XALoveTalk","GLOBAL",32)
Global("X#XALoveTalk","GLOBAL",34)
Global("X#XALoveTalk","GLOBAL",36)
Global("X#XALoveTalk","GLOBAL",38)
Global("X#XALoveTalk","GLOBAL",40)
Global("X#XALoveTalk","GLOBAL",42)
Global("X#XALoveTalk","GLOBAL",44)
Global("X#XALoveTalk","GLOBAL",46)
Global("X#XALoveTalk","GLOBAL",48)
Global("X#XALoveTalk","GLOBAL",50)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Floaters */
/* PC entered FW2626 - Candlekeep Grounds */
IF %BGT_VAR%
Global("X#XAFloatTalk2","GLOBAL",0)
AreaCheck("%Candlekeep_Ch6%")
Global("Chapter","GLOBAL",%tutu_chapter_6%)
Global("X#GainedEntryCandlekeep","GLOBAL",1)
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
THEN
RESPONSE #100
IncrementGlobal("X#XAFloatTalk2","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFloatTalk2","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Three Bhaal Talks */
IF %BGT_VAR%
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
Global("X#XAFloatTalk3","GLOBAL",0)
Global("P#KnowBhaal","GLOBAL",1)
THEN
RESPONSE #100
RealSetGlobalTimer("X#XAFloatTalk3Time","GLOBAL",30)
IncrementGlobal("X#XAFloatTalk3","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XAFloatTalk3Time","GLOBAL")
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
OR(2)
Global("X#XAFloatTalk3","GLOBAL",1)
Global("X#XAFloatTalk3","GLOBAL",5)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
IncrementGlobal("X#XAFloatTalk3","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
RealGlobalTimerExpired("X#XAFloatTalk3Time","GLOBAL")
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
OR(3)
Global("X#XAFloatTalk3","GLOBAL",2)
Global("X#XAFloatTalk3","GLOBAL",4)
Global("X#XAFloatTalk3","GLOBAL",6)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* PC entered FW0123 - Undercity */
IF %BGT_VAR%
Global("X#XAFloatTalk5","GLOBAL",0)
AreaCheck("%Undercity%")
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
THEN
RESPONSE #100
SetGlobal("X#XAFloatTalk5","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFloatTalk5","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Reputation Talks */
/* Reputation Below 9 */
IF %BGT_VAR%
ReputationLT(Player1,9)
Global("X#XanLowRep","GLOBAL",0)
InParty(Myself)
See(Player1)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
Global("X#XanVeryLowRep","GLOBAL",0)
!AreaCheck("%NashkelMines_L4%")
!AreaCheck("%NashkelMines_MulaheysCave%")
OR(2)
AreaType(CITY)
AreaType(OUTDOOR)
THEN
RESPONSE #100
SetGlobal("X#XanLowRep","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XanLowRep","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Reputation Below 5 */
IF %BGT_VAR%
ReputationLT(Player1,5)
RealGlobalTimerExpired("X#XALowRepTalkTime","GLOBAL")
Global("X#XanVeryLowRep","GLOBAL",0)
GlobalGT("X#XanLowRep","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
See(Player1)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!AreaCheck("%NashkelMines_L4%")
!AreaCheck("%NashkelMines_MulaheysCave%")
OR(2)
AreaType(CITY)
AreaType(OUTDOOR)
THEN
RESPONSE #100
SetGlobal("X#XanVeryLowRep","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XanVeryLowRep","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Reputation is high */
IF %BGT_VAR%
ReputationGT(Player1,17)
Global("X#XanHighRep","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
See(Player1)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!AreaCheck("%NashkelMines_L4%")
!AreaCheck("%NashkelMines_MulaheysCave%")
OR(2)
AreaType(CITY)
AreaType(OUTDOOR)
THEN
RESPONSE #100
SetGlobal("X#XanHighRep","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XanHighRep","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* NPC-Initiated Flirts */
IF %BGT_VAR%
Global("X#XanFlirtEarlyCheck","GLOBAL",0)
InParty(Myself)
!Global("X#DisableXaFlirts","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
GlobalGT("X#XALoveTalk","GLOBAL",8)
GlobalLT("X#XALoveTalk","GLOBAL",28)
THEN
RESPONSE #100
RealSetGlobalTimer("X#XAFlirtEarlyTime","GLOBAL",300)
SetGlobal("X#XanFlirtEarlyCheck","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XAFlirtEarlyTime","GLOBAL")
Global("X#XanFlirtEarly","GLOBAL",0)
InParty(Myself)
!Global("X#DisableXaFlirts","GLOBAL",1)
CombatCounter(0)
!See([ENEMY])
See(Player1)
!StateCheck(Myself,CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
!Global("X#XARomanceInactive","GLOBAL",1)
GlobalGT("X#XALoveTalk","GLOBAL",8)
GlobalLT("X#XALoveTalk","GLOBAL",28)
!AreaType(DUNGEON)
THEN
RESPONSE #100
SetGlobal("X#XanFlirtEarly","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XanFlirtEarly","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID) 
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
InParty(Myself)
!Global("X#DisableXaFlirts","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XanFlirtLateCheck","GLOBAL",0)
THEN
RESPONSE #100
RealSetGlobalTimer("X#XAFlirtLateTime","GLOBAL",300)
SetGlobal("X#XanFlirtLateCheck","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XAFlirtLateTime","GLOBAL")
Global("X#XanFlirtLate","GLOBAL",0)
InParty(Myself)
See(Player1)
!Global("X#DisableXaFlirts","GLOBAL",1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
!AreaType(DUNGEON)
THEN
RESPONSE #100
SetGlobal("X#XanFlirtLate","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XanFlirtLate","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID) 
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Morning after Flirt 3 */
IF %BGT_VAR%
Global("X#XAFlirtTalk2","GLOBAL",2)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
IncrementGlobal("X#XAFlirtTalk2","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFlirtTalk2","GLOBAL",3)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Flirt 5, treetops */
IF %BGT_VAR%
RealGlobalTimerExpired("X#XaFlirtsTalkTime","GLOBAL")
Global("X#XAFlirtTalk3","GLOBAL",0)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
GlobalGT("X#XALoveTalk","GLOBAL",40)
PartyRested()
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#DisableXaFlirts","GLOBAL",0)
AreaType(FOREST)
OR(2)
TimeOfDay(MORNING)
TimeOfDay(DAY)
THEN
RESPONSE #100
SetGlobal("X#XAFlirtTalk3","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFlirtTalk3","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Durlyle's Kiss */
IF %BGT_VAR%
Global("X#XADurKiss","GLOBAL",0)
InParty(Myself)
CombatCounter(0)
!See([ENEMY])
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XanRomanceDurKiss","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XADurKiss","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XADurKiss","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Aubade */
IF %BGT_VAR%
Global("X#XAFlirtTalk4","GLOBAL",0)
RealGlobalTimerExpired("X#XaFlirtsTalkTime","GLOBAL")
InParty(Myself)
GlobalGT("X#XALoveTalk","GLOBAL",40)
PartyRested()
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#DisableXaFlirts","GLOBAL",0)
AreaType(FOREST)
OR(2)
TimeOfDay(MORNING)
TimeOfDay(DAY)
THEN
RESPONSE #100
SetGlobal("X#XAFlirtTalk4","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFlirtTalk4","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Flirt 8 in the forest */
IF %BGT_VAR%
RealGlobalTimerExpired("X#XaFlirtsTalkTime","GLOBAL")
Global("X#XAFlirtTalk6","GLOBAL",0)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
GlobalGT("X#XALoveTalk","GLOBAL",34)
PartyRested()
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XARomanceActive","GLOBAL",2)
Global("X#DisableXaFlirts","GLOBAL",0)
AreaType(FOREST)
OR(2)
TimeOfDay(MORNING)
TimeOfDay(DAY)
THEN
RESPONSE #100
SetGlobal("X#XAFlirtTalk6","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#XAFlirtTalk6","GLOBAL",1)
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xarom")
StartDialogueNoSet(Player1)
END

/* Break because learned about BS too early */
IF %BGT_VAR%
Global("X#XABhaalBreak","GLOBAL",0)
Global("X#XARomanceActive","GLOBAL",1)
Global("P#KnowBhaal","GLOBAL",1)
InParty(Myself)
CombatCounter(0)
!See([ENEMY]) 
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
See(Player1)
THEN
RESPONSE #100
SetGlobal("X#XABhaalBreak","GLOBAL",1)
END

IF %BGT_VAR%
InParty(Myself)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#XABhaalBreak","GLOBAL",1)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Romance conflict with Ajantis */
IF %BGT_VAR%
Global("X#XanAjantisConflict","GLOBAL",0)
InParty("ajantis")
InParty(Myself)
Global("X#AjantisRomanceActive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XanAjantisConflict","GLOBAL",1)
RealSetGlobalTimer("X#XaAjReactionTime","GLOBAL",500)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaAjReactionTime","GLOBAL")
InParty("ajantis")
InParty(Myself)
See("ajantis")
CombatCounter(0)
!See([ENEMY])
!StateCheck("ajantis",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#AjantisRomanceActive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
Global("X#XanAjantisConflict","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XanAjantisConflict","GLOBAL",2)
END

IF %BGT_VAR%
Global("X#XanAjantisConflict","GLOBAL",2)
InParty("ajantis")
InParty(Myself)
!StateCheck("ajantis",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
THEN
RESPONSE #100
ActionOverride("ajantis",Interact(Myself))
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaAjReactionTime","GLOBAL")
InParty("ajantis")
InParty(Myself)
See("ajantis")
CombatCounter(0)
!See([ENEMY])
!StateCheck("ajantis",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("X#AjantisRomanceActive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
OR(3)
Global("X#XanAjantisConflict","GLOBAL",3)
Global("X#XanAjantisConflict","GLOBAL",5)
Global("X#XanAjantisConflict","GLOBAL",7)
THEN
RESPONSE #100
IncrementGlobal("X#XanAjantisConflict","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaAjReactionTime","GLOBAL")
InParty("ajantis")
InParty(Myself)
!StateCheck("ajantis",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
OR(3)
Global("X#XanAjantisConflict","GLOBAL",4)
Global("X#XanAjantisConflict","GLOBAL",6)
Global("X#XanAjantisConflict","GLOBAL",8)
THEN
RESPONSE #100
Interact("ajantis")
END

/* Romance conflict with Coran */
IF %BGT_VAR%
Global("X#XanCoranConflict","GLOBAL",0)
InParty("coran")
InParty(Myself)
Global("P#CoranMatch","GLOBAL",1)
!Global("P#CoranRomanceInactive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#XanCoranConflict","GLOBAL",1) 
RealSetGlobalTimer("X#XaCoReactionTime","GLOBAL",500)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaCoReactionTime","GLOBAL")
InParty("coran")
InParty(Myself)
See("coran")
CombatCounter(0)
!See([ENEMY])
!StateCheck("coran",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("P#CoranMatch","GLOBAL",1)
!Global("P#CoranRomanceInactive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
OR(2)
Global("X#XanCoranConflict","GLOBAL",1)
Global("X#XanCoranConflict","GLOBAL",5)
THEN
RESPONSE #100
IncrementGlobal("X#XanCoranConflict","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaCoReactionTime","GLOBAL")
InParty("coran")
InParty(Myself)
!StateCheck("coran",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
OR(2)
Global("X#XanCoranConflict","GLOBAL",2)
Global("X#XanCoranConflict","GLOBAL",6)
THEN
RESPONSE #100
Interact("coran")
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaCoReactionTime","GLOBAL")
InParty("coran")
InParty(Myself)
See("coran")
CombatCounter(0)
!See([ENEMY])
!StateCheck("coran",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
Global("P#CoranMatch","GLOBAL",1)
!Global("P#CoranRomanceInactive","GLOBAL",1)
Global("X#XANMatch","GLOBAL",1)
!Global("X#XARomanceInactive","GLOBAL",1)
OR(2)
Global("X#XanCoranConflict","GLOBAL",3)
Global("X#XanCoranConflict","GLOBAL",7)
THEN
RESPONSE #100
IncrementGlobal("X#XanCoranConflict","GLOBAL",1)
END

IF %BGT_VAR%
RealGlobalTimerExpired("X#XaCoReactionTime","GLOBAL")
InParty("coran")
InParty(Myself)
!StateCheck("coran",CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
OR(2)
Global("X#XanCoranConflict","GLOBAL",4)
Global("X#XanCoranConflict","GLOBAL",8)
THEN
RESPONSE #100
ActionOverride("coran",Interact(Myself))
END
