IF %BGT_VAR%
Global("X#JaheiraQuest","GLOBAL",4)
!Dead("beador")
InMyArea("jaheira")
!StateCheck("jaheira",CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MarethaResBeadAlive","GLOBAL",1)
SetGlobal("X#JaheiraQuest","GLOBAL",5)
END

IF %BGT_VAR%
Global("X#MarethaResBeadAlive","GLOBAL",1)
See(Player1)
InMyArea("jaheira")
!StateCheck("jaheira",CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

IF %BGT_VAR%
Global("X#JaheiraQuest","GLOBAL",4)
Dead("beador")
Global("X#MarethaResBeadDead","GLOBAL",0)
InMyArea("jaheira")
!StateCheck("jaheira",CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MarethaResBeadDead","GLOBAL",1)
SetGlobal("X#JaheiraQuest","GLOBAL",5)
END

IF %BGT_VAR%
Global("X#MarethaResBeadDead","GLOBAL",1)
See(Player1)
InMyArea("jaheira")
!StateCheck("jaheira",CD_STATE_NOTVALID)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
StartDialogueNoSet(Player1)
END

IF
  Die()
THEN
  RESPONSE #100
    IncrementGlobal("KilledDruids","GLOBAL",1)
END

IF
  !Allegiance(Myself,ENEMY)
THEN
  RESPONSE #100
    NoAction()
END

IF
  HaveSpell(CLERIC_CURE_LIGHT_WOUNDS)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  HPPercentLT(Myself,65)
  !StateCheck(Myself,STATE_SILENCED)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(Myself,CLERIC_CURE_LIGHT_WOUNDS)
END

IF
  HaveSpell(CLERIC_BARKSKIN)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  !StateCheck(Myself,STATE_SILENCED)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(Myself,CLERIC_BARKSKIN)
END

IF
  !See([GOODCUTOFF.0.0.DRUID_ALL])
  !See([GOODCUTOFF.0.0.MAGE_ALL])
  !See([GOODCUTOFF.0.0.CLERIC_ALL])
  !See([GOODCUTOFF.0.0.BARD_ALL])
  !See([GOODCUTOFF.0.0.THIEF_ALL])
  !See([GOODCUTOFF])
  False()
THEN
  RESPONSE #100
    Continue()
END

IF
  HaveSpell(CLERIC_CHARM_PERSON)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  !StateCheck(LastSeenBy(),STATE_SLEEPING)
  !StateCheck(LastSeenBy(),STATE_HELPLESS)
  !StateCheck(LastSeenBy(),STATE_CHARMED)
  !StateCheck(Myself,STATE_SILENCED)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
  !HasBounceEffects(LastSeenBy())
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(LastSeenBy(),CLERIC_CHARM_PERSON)
END

IF
  HaveSpell(CLERIC_ARMOR_OF_FAITH)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  !StateCheck(Myself,STATE_SILENCED)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(Myself,CLERIC_ARMOR_OF_FAITH)
END

IF
  HaveSpell(CLERIC_ENTANGLE)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  !StateCheck(LastSeenBy(),STATE_SLEEPING)
  !StateCheck(LastSeenBy(),STATE_HELPLESS)
  !StateCheck(Myself,STATE_SILENCED)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
  !HasBounceEffects(LastSeenBy())
  !Range(LastSeenBy(),15)
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(LastSeenBy(),CLERIC_ENTANGLE)
END

IF
  HaveSpell(CLERIC_BLESS)
  !GlobalTimerNotExpired("X#RCA","LOCALS")
  !StateCheck(Myself,STATE_SILENCED)
  !StateCheck(Myself,STATE_BLESS)
  !CheckStatGT(Myself,75,SPELLFAILUREPRIEST)
THEN
  RESPONSE #100
    SetGlobalTimer("X#RCA","LOCALS",6)
    Spell(Myself,CLERIC_BLESS)
END

IF
  GlobalTimerNotExpired("X#RCA","LOCALS")
THEN
  RESPONSE #100
    AttackOneRound(LastSeenBy())
END

IF
  !GlobalTimerNotExpired("X#RCA","LOCALS")
THEN
  RESPONSE #100
    Attack(LastSeenBy())
END

IF
  AttackedBy([GOODCUTOFF],DEFAULT)
  !Allegiance(Myself,ENEMY)
THEN
  RESPONSE #100
    Enemy()
END

IF
  AttackedBy([0],DEFAULT)
THEN
  RESPONSE #100
    Attack(LastAttackerOf())
END