/* Activate: XzarShlum */
IF
%BGT_VAR%
AreaCheck("%WSewers%")
Dead("schlumpsa")
Global("X#XzarShlum","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarShlum","GLOBAL",2)
END

/* Initiate: XzarShlum */
IF
%BGT_VAR%
Global("X#XzarShlum","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Xzar Slaves dialogue */
IF
%BGT_VAR%
AreaCheck("%CloakwoodMines_L3%")
Dead("cmogremage")
Global("X#XzarSlaves","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarSlaves","GLOBAL",1)
END

/* Initiate: Xzar Slaves dialogue */
IF
%BGT_VAR%
Global("X#XzarSlaves","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Sewer Ogre dialogue */
IF
%BGT_VAR%
AreaCheck("%ESewers%")
Global("X#XzarOgreBA","GLOBAL",0)
Dead("sewerogre")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarOgreBA","GLOBAL",1)
END

/* Initiate: Sewer Ogre dialogue */
IF
%BGT_VAR%
Global("X#XzarOgreBA","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Xzar Mellincamp */
IF
%BGT_VAR%
AreaCheck("%RedCanyons%")
Global("X#XzarChicken","GLOBAL",0)
PartyHasItem("%tutu_var%MISC49")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarChicken","GLOBAL",1)
END

/* Initiate: Xzar Mellincamp */
IF
%BGT_VAR%
Global("X#XzarChicken","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Timer Setup: Xzar mourns Montaron */
IF
%BGT_VAR%
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
Global("X#XzarMourns","GLOBAL",0)
Dead("montaron")
THEN
RESPONSE #100
SetGlobal("X#XzarMourns","GLOBAL",1)
SetGlobalTimer("X#XZMourns","GLOBAL",28800)
END

/* Activate: Xzar mourns Montaron */
IF
%BGT_VAR%
Global("X#XzarMourns","GLOBAL",1)
GlobalTimerExpired("X#XZMourns","GLOBAL")
Dead("montaron")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarMourns","GLOBAL",2)
END

/* Initiate: Xzar mourns Montaron */
IF
%BGT_VAR%
Global("X#XzarMourns","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Slimes */
IF
%BGT_VAR%
Global("Chapter","GLOBAL",%tutu_chapter_7%)
AreaCheck("%BaldursGate_Undercellars%")
Global("X#XzarSlime","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarSlime","GLOBAL",2)
END

/* Initiate: Slimes */
IF
%BGT_VAR%
Global("X#XzarSlime","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Slime Quest Final Talk */
IF
%BGT_VAR%
AreaCheck("%BaldursGate_Undercellars%")
PartyHasItem("%tutu_var%MISC78")
Global("X#XzUnder","GLOBAL",0)
OR(10)
See("xzslime")
See("xzjelly")
Dead("xzslime")
Dead("xzjelly")
AttackedBy([EVILBUTBLUE],DEFAULT)
Race(LastSeenBy(),SLIME)
See("x#zizi1")
See("x#zizi2")
See("x#zizi3")
See("x#zizi4")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzUnder","GLOBAL",1)
END

/* Initiate: Slime Quest Final Talk */
IF
%BGT_VAR%
Global("X#XzUnder","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Firewine Xzar */
IF
%BGT_VAR%
AreaCheck("%FirewineBridge%")
Global("X#XzarKahrk","GLOBAL",0)
Dead("carsa")
Dead("kahrk")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarKahrk","GLOBAL",1)
END

/* Initiate: Firewine Xzar */
IF
%BGT_VAR%
Global("X#XzarKahrk","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Revenant Dagger */
IF
%BGT_VAR%
AreaCheck("%ValleyoftheTombs%")
PartyHasItem("%tutu_var%DAGG03")
Dead("reven")
Global("X#XzarDagger","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarDagger","GLOBAL",1)
END

/* Initiate: Revenant Dagger */
IF
%BGT_VAR%
Global("X#XzarDagger","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Zombie Fillets */
IF
%BGT_VAR%
AreaCheck("%Farmlands%")
GlobalGT("SPRITE_IS_DEADZOMBIEW","GLOBAL",3)
Global("X#XzarZombie","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarZombie","GLOBAL",1)
END

/* Initiate: Zombie Fillets */
IF
%BGT_VAR%
Global("X#XzarZombie","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END

/* Activate: Xzar Boss Encounter if killed them */
IF
%BGT_VAR%
AreaCheck("%EBaldursGate_SorcerousSundries_L2%")
Global("X#XzarBoss","GLOBAL",4)
Dead("oulam")
Dead("wheber")
Dead("william")
Dead("niemain")
!Dead("xzar")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#XzarBoss","GLOBAL",7)
END

/* Initiate: Xzar Boss Encounter if killed them */
IF
%BGT_VAR%
Global("X#XzarBoss","GLOBAL",7)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
PlaySong(0)
PlaySound("xzar99")
StartDialogueNoSet(Player1)
END
