/* Activate: Ajantis Bhaal talk */
IF %BGT_VAR%
!Global("X#AjantisRomanceActive","GLOBAL",2)
Global("P#KnowBhaal","GLOBAL",1)
Global("X#AjantisKnowBhaalTalkNoRom","GLOBAL",0)
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisKnowBhaalTalkNoRom","GLOBAL",1)
END

/* Initiate: Ajantis Bhaal talk */
IF %BGT_VAR%
!Global("X#AjantisRomanceActive","GLOBAL",2)
Global("X#AjantisKnowBhaalTalkNoRom","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate attacking Drizzt: Ajantis turns hostile */
IF %BGT_VAR%
AreaCheck("%FishermansLake%")
Global("X#PartyAttackedDrizzt","GLOBAL",1)
InParty(Myself) //No "Combatcounter=0" here!
Global("X#AjantisDrizztHostile","GLOBAL",0)
Global("X#AjantisDrizzt3","GLOBAL",0)//auto-set from other Ajantis interjection
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#AjantisDrizztHostile","GLOBAL",1)
END

/* Initiate attacking Drizzt: Ajantis turns hostile */
IF %BGT_VAR%
Global("X#AjantisDrizztHostile","GLOBAL",1)
InParty(Myself) //No "Combatcounter=0" here!
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* attacking Dynaheir */
IF %BGT_VAR%
AreaCheck("%GnollStronghold%")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
!InParty("dynaheir")
See("dynaheir")
!Allegiance("dynaheir",ENEMY)
Global("X#AjantisDefendDyna","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#AjantisDefendDyna","GLOBAL",1)
END

/* Activate battle */
IF %BGT_VAR%
AreaCheck("%GnollStronghold%")
Global("X#AjantisDefendDyna","GLOBAL",1)
Global("X#PartyAttackedDynaheir","GLOBAL",1)
Global("X#AjantisDynaheir","GLOBAL",0) //auto-set from other Ajantis interjection
Global("X#AjantisDynaHostile","GLOBAL",0)
InParty(Myself) //No "Combatcounter=0" here!
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#AjantisDynaHostile","GLOBAL",1)
END

/* Initiate battle */
IF %BGT_VAR%
Global("X#AjantisDynaHostile","GLOBAL",1)
InParty(Myself) //No "Combatcounter=0" here!
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* If Ajantis interjected */
IF %BGT_VAR%
  Global("X#AjantisDynaheir","GLOBAL",1) //auto-set from Ajantis interjection
  InParty(Myself) //No "CombatCounter(0)" here!
  !StateCheck(Myself,CD_STATE_NOTVALID)
  InMyArea(Player1)
  !StateCheck(Player1,CD_STATE_NOTVALID)
THEN
  RESPONSE #100
    SetGlobal("X#AjantisDynaheir","GLOBAL",2)
    SetLeavePartyDialogFile() 
    ChangeAIScript("",DEFAULT) 
    LeaveParty() 
    Enemy()
END


/* Activate Rep 20 */
IF %BGT_VAR%
Reputation(Player1,20)
Global("X#AjantisBestReputationTalk","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#AjantisBestReputationTalk","GLOBAL",1)
END

/* Initiate Rep 20 */
IF %BGT_VAR%
Global("X#AjantisBestReputationTalk","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate Bjornin Area */
IF %BGT_VAR%
AreaCheck("%FishermansLake%")
Global("X#AjantisHelpBjornin","GLOBAL",1)
Global("X#AjantisBjorninArea","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#AjantisBjorninArea","GLOBAL",1)
END

/* Initiate Bjornin Area */
IF %BGT_VAR%
Global("X#AjantisBjorninArea","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate Bjornin Resolved */
IF %BGT_VAR%
AreaCheck("%FishermansLake%")
Global("X#AjantisBjorninOgresKilled","GLOBAL",0)
Global("OgresKilled","GLOBAL",4)
Global("X#AjantisHelpBjornin","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#AjantisBjorninOgresKilled","GLOBAL",1)
END

/* Initiate Bjornin Resolved */
IF %BGT_VAR%
Global("X#AjantisBjorninOgresKilled","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate: If Joseph's ring in mine is found */
IF %BGT_VAR%
AreaCheck("%NashkelMines_L3%")
PartyHasItem("%tutu_var%RINGJOS")
Global("X#AjantisWomanNashkellPromise","GLOBAL",1) //Checkvariable
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisWomanNashkellPromise","GLOBAL",2)
END

/* Initiate: If Joseph's ring in mine is found */
IF %BGT_VAR%
Global("X#AjantisWomanNashkellPromise","GLOBAL",2) //Checkvariable
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate Mirianne's letter found */
IF %BGT_VAR%
AreaCheck("%SouthBeregostRoad%")
Global("X#AjantisMiriannePromise","GLOBAL",1)
Global("X#AjantisMirianneLetter","GLOBAL",0)
PartyHasItem("%tutu_scriptbg%SCRL3I")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisMirianneLetter","GLOBAL",1)
END

/* Initiate Mirianne's letter found */
IF %BGT_VAR%
Global("X#AjantisMirianneLetter","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate Remind to get Samuel to temple */
IF %BGT_VAR%
PartyHasItem("%tutu_var%MISC13") //Samuel
Global("X#AjantisBringSamuel","GLOBAL",0)
GlobalTimerExpired("X#AjantisSamuel","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisBringSamuel","GLOBAL",1)
END

/* Initiate Remind to get Samuel to temple */
IF %BGT_VAR%
Global("X#AjantisBringSamuel","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate found Nathan */
IF %BGT_VAR%
Global("X#AjantisNathanFound","GLOBAL",0)
Global("BrunQuest","GLOBAL",1)
PartyHasItem("%tutu_var%MISC67")
OR(2)
AreaCheck("%FishingVillage_AnkhegPit%")
AreaCheck("%FishingVillage%")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisNathanFound","GLOBAL",1)
StartDialogueNoSet(Player1)
END

/* Initiate found Nathan */
IF %BGT_VAR%
Global("X#AjantisNathanFound","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Thieves Guild */
IF %BGT_VAR%
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
AreaCheck("%EBaldursGate_ThievesGuild%") //main area of thief guild
Global("X#AjantisThievesGuild","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#AjantisThievesGuild","GLOBAL",1)
END

/* Initiate Thieves Guild */
IF %BGT_VAR%
Global("X#AjantisThievesGuild","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate Dopplegangers in Duke's palace */
IF %BGT_VAR%
AreaCheck("%NBaldursGate_DucalPalace_L1%")
Global("NobleDopple","GLOBAL",1)
Global("X#AjantisNobleDopple","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
THEN
RESPONSE #100
SetGlobal("X#AjantisNobleDopple","GLOBAL",1)
END

/* Initiate Dopplegangers in Duke's palace */
IF %BGT_VAR%
Global("X#AjantisNobleDopple","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
THEN
RESPONSE #100
StartDialogueNoSet(Myself)
END

/* Activate Kozah Idol */
IF %BGT_VAR%
AreaCheck("%ArchaeologicalSite_Tomb%")
Global("TalkedToCharleston","GLOBAL",2)
Global("X#AjantisKozahStatue","GLOBAL",0)
PartyHasItem("%tutu_var%MISC48")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisKozahStatue","GLOBAL",1)
END

/* Initiate Kozah Idol */
IF %BGT_VAR%
Global("X#AjantisKozahStatue","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogNoSet(Myself)
END

/* Activate Undercellar */
IF %BGT_VAR%
AreaCheck("%BaldursGate_Undercellars%")
Global("X#AjantisUndercellar","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#AjantisUndercellar","GLOBAL",1)
END

/* Initiate Undercellar */
IF %BGT_VAR%
Global("X#AjantisUndercellar","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate If Nester's dagger was found */
IF %BGT_VAR%
AreaCheck("%WyrmsCrossing%")
Global("X#AjantisNestorsDagger","GLOBAL",0) //Checkvariable
Global("X#AjantisQuinnPromise","GLOBAL",1)
PartyHasItem("%tutu_var%DAGG06")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisNestorsDagger","GLOBAL",1)
END

/* Initiate If Nester's dagger was found */
IF %BGT_VAR%
Global("X#AjantisNestorsDagger","GLOBAL",1) //Checkvariable
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate If baby Peladan was found */
IF %BGT_VAR%
AreaCheck("%IsleofBalduranNShip_D4%")
Global("X#AjantisPeladan","GLOBAL",0)
PartyHasItem("%tutu_var%MISC96")
OR(2)
Global("MaraQuest","GLOBAL",1)
Global("MaraTalk","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#AjantisPeladan","GLOBAL",1)
END

/* Initiate If baby Peladan was found */
IF %BGT_VAR%
Global("X#AjantisPeladan","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate Entrance to CK library (should be called before the iron throne bosses are met) */
IF %BGT_VAR%
AreaCheck("%Candlekeep_Library_L1%")
Global("X#AjantisLibraryCK","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#AjantisLibraryCK","GLOBAL",1)
END

/* Initiate Entrance to CK library (should be called before the iron throne bosses are met) */
IF %BGT_VAR%
Global("X#AjantisLibraryCK","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Set Up Ajantis recognises low rep of a freshly joined group - memory of rep > 11 by joining */
IF %BGT_VAR%
Global("X#AjantisNoBadRepJoinCheck","GLOBAL",0)
Global("X#AjantisNoBadRepJoin","GLOBAL",0)
ReputationGT(Player1,11)
THEN
RESPONSE #100
SetGlobal("X#AjantisNoBadRepJoin","GLOBAL",1)
SetGlobal("X#AjantisNoBadRepJoinCheck","GLOBAL",1)
END

/* Activate bad rep join talk after joining a party with rep < 12 */
IF %BGT_VAR%
Global("X#AjantisNoBadRepJoin","GLOBAL",0)
Global("X#AjantisBadRepJoinTalk","GLOBAL",0)
ReputationLT(Player1,12)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisBadRepJoinTalk","GLOBAL",1)
END

/* Initiate bad rep join talk after joining a party with rep < 12 */
IF %BGT_VAR%
Global("X#AjantisBadRepJoinTalk","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Set Up Reputation lower 12 - long bad rep talk delay for non-evil alignent PC ~and~ if chapter < 3 */
IF %BGT_VAR%
Global("X#AjantisBadRepTimer","GLOBAL",0)
!Alignment(Player1,MASK_EVIL)
!Global("X#AjantisNoBadRepJoin","GLOBAL",1)
InParty(Myself)
GlobalLT("Chapter","GLOBAL",%tutu_chapter_3%)
THEN
RESPONSE #100
SetGlobal("X#AjantisBadRepTimer","GLOBAL",1)
RealSetGlobalTimer("X#AjantisBadRepDelay","GLOBAL",7200) // 2 hour delay
END

/*Set Up  short bad rep talk delay: chapter > 3 ~or~ for evil PC */
IF %BGT_VAR%
Global("X#AjantisBadRepTimer","GLOBAL",0)
!Global("X#AjantisNoBadRepJoin","GLOBAL",1)
OR(2)
Alignment(Player1,MASK_EVIL)
GlobalGT("Chapter","GLOBAL",%tutu_chapter_2%)
InParty(Myself)
THEN
RESPONSE #100
SetGlobal("X#AjantisBadRepTimer","GLOBAL",1)
RealSetGlobalTimer("X#AjantisBadRepDelay","GLOBAL",1800) //30 min delay
END

/* Activate reputation < 12: Ajantis will warn PC */
IF %BGT_VAR%
ReputationLT(Player1,12)
OR(2)
Global("X#AjantisBadReputationWarning","GLOBAL",0)
Global("X#AjantisBadReputationWarning","GLOBAL",2)
OR(2)
Global("X#AjantisNoBadRepJoin","GLOBAL",1)
RealGlobalTimerExpired("X#AjantisBadRepDelay","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisBadReputationIncrease","GLOBAL",0)
SetGlobal("X#AjantisNoBadRepJoin","GLOBAL",2)
SetGlobal("X#AjantisBadReputationWarning","GLOBAL",1)
SetGlobal("X#AjantisBadRepTimer","GLOBAL",0)
END

/* Initiate reputation < 12: Ajantis will warn PC */
IF %BGT_VAR%
Global("X#AjantisBadReputationWarning","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate: Ajantis recognises rep increase after former bad rep talk */
IF %BGT_VAR%
ReputationGT(Player1,11)
OR(2)
Global("X#AjantisBadRepJoinTalk","GLOBAL",2)
Global("X#AjantisBadReputationWarning","GLOBAL",2)
Global("X#AjantisBadReputationIncrease","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
RealSetGlobalTimer("X#AjantisBadRepDelay","GLOBAL",1)
SetGlobal("X#AjantisBadRepJoinTalk","GLOBAL",3) //to prevent from looping
SetGlobal("X#AjantisBadReputationIncrease","GLOBAL",1)
END

/* Initiate: Ajantis recognises rep increase after former bad rep talk */
IF %BGT_VAR%
Global("X#AjantisBadReputationIncrease","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate Ajantis good rep talk for rep >17 */
IF %BGT_VAR%
Global("X#AjantisGoodReputationTalk","GLOBAL",0)
ReputationGT(Player1,17)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisGoodReputationTalk","GLOBAL",1)
END

/* Activate Ajantis good rep talk for rep >17 */
IF %BGT_VAR%
Global("X#AjantisGoodReputationTalk","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate reputation < 12: Ajantis will warn PC */
IF %BGT_VAR%
ReputationLT(Player1,12)
OR(2)
Global("X#AjantisBadReputationWarning","GLOBAL",0)
Global("X#AjantisBadReputationWarning","GLOBAL",2)
OR(2)
Global("X#AjantisNoBadRepJoin","GLOBAL",1)
RealGlobalTimerExpired("X#AjantisBadRepDelay","GLOBAL")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisBadReputationIncrease","GLOBAL",0)
SetGlobal("X#AjantisNoBadRepJoin","GLOBAL",2)
SetGlobal("X#AjantisBadReputationWarning","GLOBAL",1)
SetGlobal("X#AjantisBadRepTimer","GLOBAL",0)
END // fires X#AjantisBadReputationWarning, above. Block above advances to 3 to close. Cool!

/* Activate if the "wanted" letter is found on an opponent */
IF %BGT_VAR%
Global("X#AjantisWantedLetter","GLOBAL",0)
PartyHasItem("%tutu_var%SCRLTAR")
Global("X#AjantisTarnesh","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#AjantisWantedLetter","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#AjantisWantedLetter","GLOBAL",0)
PartyHasItem("%tutu_var%SCRL3B")
Global("X#AjantisNimbul","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#AjantisWantedLetter","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#AjantisWantedLetter","GLOBAL",0)
PartyHasItem("%tutu_var%SCRLNEI")
Global("X#AjantisNeira","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#AjantisWantedLetter","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#AjantisWantedLetter","GLOBAL",0)
Global("X#AjantisKarlat","GLOBAL",1)
PartyHasItem("%tutu_var%SCRLKAR")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisWantedLetter","GLOBAL",1)
END


/* Initiate if the "wanted" letter is found on an opponent(_SCRLKAR.ITM) */
IF %BGT_VAR%
Global("X#AjantisWantedLetter","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("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate if dead Chelak is found */
IF %BGT_VAR%
Global("X#AjantisTiberHelp","GLOBAL",1)
OR(2)
AreaCheck("%CloakwoodNestSpiderNest%")
AreaCheck("%CloakwoodNest%")
PartyHasItem("%tutu_var%MISC90")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#AjantisTiberHelp","GLOBAL",2)
END

/* Initiate if dead Chelak is found */
IF %BGT_VAR%
Global("X#AjantisTiberHelp","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
PlaySong(0)
PlaySound("ajant99")
StartDialogueNoSet(Player1)
END

/* Activate: helmet of alignment change on PC */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
HasItemEquiped("%tutu_var%HELM02",Player1) 
Global("X#AjantisPCHelmet","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#AjantisPCHelmet","GLOBAL",1)
END

/* Initiate: helmet of alignment change on PC */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
HasItemEquiped("%tutu_var%HELM02",Player1) 
Global("X#AjantisPCHelmet","GLOBAL",1)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* set variable: helmet of alignment change on Ajantis */
IF %BGT_VAR%
InParty(Myself)
HasItemEquiped("%tutu_var%HELM02",Myself) 
Global("X#AjantisAjHelmet","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#AjantisAjHelmet","GLOBAL",1)
END

/* Activate: helmet of alignment change off Ajantis */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
!HasItemEquiped("%tutu_var%HELM02",Myself)
Global("X#AjantisAjHelmet","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("X#AjantisAjHelmet","GLOBAL",2)
END

/* Initiate: helmet of alignment change off Ajantis */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
!HasItemEquiped("%tutu_var%HELM02",Myself)
Global("X#AjantisAjHelmet","GLOBAL",2)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

/* Activate: girdle of gender bender on Ajantis */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
HasItemEquiped("%tutu_var%BELT05",Myself) 
Global("X#AjantisAjGirdle","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("X#AjantisAjGirdle","GLOBAL",1)
END

/* Initiate: girdle of gender bender on Ajantis */
IF %BGT_VAR%
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
HasItemEquiped("%tutu_var%BELT05",Myself) 
Global("X#AjantisAjGirdle","GLOBAL",1)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END
