IF
  Name("stass1",Myself)
  !AreaCheck("ar0306")
  HasItem("clck01",Myself)
THEN
  RESPONSE #100
    DestroyItem("clck01")
    Continue()
END

IF
  Global("D0InitiateMegaThiefSpawning","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("D0InitiateMegaThiefSpawning","GLOBAL",1)
    SetGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",25)
END

IF
  See(NearestEnemyOf(Myself))
  GlobalGT("SPRITE_IS_DEADd0arbkup","GLOBAL",10)
  Allegiance(Myself,ENEMY)
  !StateCheck(Myself,STATE_REALLY_DEAD)
  AreaCheck("ar0329")
  !Specifics(Myself,241)
  GlobalGT("chapter","GLOBAL",%bg2_chapter_5%)
  Global("SpawnHelp","LOCALS",0)
  !Name("arnman05",Myself)
  GlobalGT("D0Maevar2","GLOBAL",0)
  !GlobalTimerNotExpired("D0SpawnMoreTimer","MYAREA")
  !Name("d0arbkup",Myself)
  !Name("lin",Myself)
  OR(4)
    !Dead("Aran")
    !GlobalGT("D0Maevar","GLOBAL",4)
    Global("D0WarnedAran","GLOBAL",1)
    Dead("d0nightk")
THEN
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",25)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",30)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",25)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",30)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",25)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",30)
    Continue()
END

IF
  See(NearestEnemyOf(Myself))
  GlobalGT("SPRITE_IS_DEADd0arbkup","GLOBAL",10)
  Allegiance(Myself,ENEMY)
  !StateCheck(Myself,STATE_REALLY_DEAD)
  !Specifics(Myself,241)
  AreaCheck("ar0307")
  GlobalGT("chapter","GLOBAL",%bg2_chapter_5%)
  Global("SpawnHelp","LOCALS",0)
  !Name("arnman05",Myself)
  !Difficulty(HARDEST)
  !Global("D0LarellAssault","GLOBAL",0)
  !GlobalTimerNotExpired("D0SpawnMoreTimer","MYAREA")
  !Name("d0arbkup",Myself)
  !Name("lin",Myself)
  OR(4)
    !Dead("Aran")
    !GlobalGT("D0Maevar","GLOBAL",4)
    Global("D0WarnedAran","GLOBAL",1)
    Dead("d0nightk")
THEN
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",12)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    Continue()
END

IF
  See(NearestEnemyOf(Myself))
  GlobalGT("SPRITE_IS_DEADd0arbkup","GLOBAL",10)
  Allegiance(Myself,ENEMY)
  !StateCheck(Myself,STATE_REALLY_DEAD)
  !Specifics(Myself,241)
  AreaCheck("ar0307")
  GlobalGT("chapter","GLOBAL",%bg2_chapter_5%)
  Global("SpawnHelp","LOCALS",0)
  !Name("arnman05",Myself)
  OR(2)
    Difficulty(HARDEST)
    Global("D0LarellAssault","GLOBAL",0)
  !GlobalTimerNotExpired("D0SpawnMoreTimer","MYAREA")
  !Name("d0arbkup",Myself)
  !Name("lin",Myself)
  OR(4)
    !Dead("Aran")
    !GlobalGT("D0Maevar","GLOBAL",4)
    Global("D0WarnedAran","GLOBAL",1)
    Dead("d0nightk")
THEN
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbku2",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-2)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-3)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",12)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",15)
    Continue()
  RESPONSE #100
    SetGlobal("SpawnHelp","LOCALS",1)
    SetGlobalTimer("D0SpawnMoreTimer","MYAREA",18)
    IncrementGlobal("SPRITE_IS_DEADd0arbkup","GLOBAL",-4)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    CreateCreatureObjectOffScreen("d0arbkup",NearestEnemyOf(Myself),1,0,0)
    Continue()
END

//////////////////////////////////////////////////////////////////////
// Powerups

IF
  Global("D0Potions","LOCALS",0)
  !Name("gorch",Myself)
  !Name("tassa",Myself)
  !Name("arnman05",Myself)
  !Name("arnboy01",Myself)
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",1)
    GiveItemCreate("potn10",Myself,1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",1)
    GiveItemCreate("potn10",Myself,1,0,0)
    GiveItemCreate("potn14",Myself,1,0,0)
    Continue()
END

IF
  GlobalLT("D0Potions","LOCALS",2)
  GlobalGT("chapter","GLOBAL",%bg2_chapter_5%)
  !Name("gorch",Myself)
  !Name("tassa",Myself)
  !Name("arnman05",Myself)
  !Name("arnboy01",Myself)
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",2)
    GiveItemCreate("potn10",Myself,1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",2)
    Continue()
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",2)
    GiveItemCreate("potn14",Myself,1,0,0)
    Continue()
  RESPONSE #100
    SetGlobal("D0Potions","LOCALS",2)
    GiveItemCreate("potn11",Myself,1,0,0)
    Continue()
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  See(NearestEnemyOf(Myself))
  OR(2)
    StateCheck(Myself,STATE_INVISIBLE)
    StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  !Name("gorch",Myself)
  !Name("tassa",Myself)
  !Name("arnman05",Myself)
  !Name("arnboy01",Myself)
  Allegiance(Myself,ENEMY)
  Global("D0Poison","LOCALS",0)
  Difficulty(HARD)
  AreaCheck("ar0307")
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Poison","LOCALS",1)
    Continue()
  RESPONSE #100
    SetGlobal("D0Poison","LOCALS",1)
    SetGlobalTimer("Cast","LOCALS",6)
    SpellNoDecRES("spcl423",Myself)
    Continue()
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  See(NearestEnemyOf(Myself))
  OR(2)
    StateCheck(Myself,STATE_INVISIBLE)
    StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  !Name("gorch",Myself)
  !Name("tassa",Myself)
  !Name("arnman05",Myself)
  !Name("arnboy01",Myself)
  Allegiance(Myself,ENEMY)
  Global("D0Poison","LOCALS",0)
  Difficulty(HARDEST)
  AreaCheck("ar0307")
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Poison","LOCALS",1)
    SetGlobalTimer("Cast","LOCALS",6)
    SpellNoDecRES("spcl423",Myself)
    Continue()
  RESPONSE #100
    SetGlobal("D0Poison","LOCALS",1)
    Continue()
END


IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  See(NearestEnemyOf(Myself))
  !StateCheck(Myself,STATE_INVISIBLE)
  !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY)
  !ModalState(STEALTH)
  !GlobalTimerNotExpired("Hide","LOCALS")
  HasItem("potn10",Myself)
THEN
  RESPONSE #100
    SetGlobalTimer("Cast","LOCALS",6)
    DisplayStringHead(Myself,46150) // quaffs a potion
    UseItem("potn10",Myself)
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  See(NearestEnemyOf(Myself))
  !StateCheck(Myself,STATE_HASTED)
  HasItem("potn14",Myself)
THEN
  RESPONSE #100
    SetGlobalTimer("Cast","LOCALS",6)
    DisplayStringHead(Myself,46150) // quaffs a potion
    UseItem("potn14",Myself)
END

IF
  !GlobalTimerNotExpired("Cast","LOCALS")
  See(NearestEnemyOf(Myself))
  CheckStatGT(Myself,0,ARMORCLASS)
  HasItem("potn11",Myself)
THEN
  RESPONSE #100
    SetGlobalTimer("Cast","LOCALS",6)
    DisplayStringHead(Myself,46150) // quaffs a potion
    UseItem("potn11",Myself)
END

//////////////////////////////////////////////////////////////////////
// Mobility

IF
  Name("d0nightk",Myself)
  Global("D0MoveOnce","LOCALS",2)
  Global("D0LarellAssault","GLOBAL",1)
  Specifics(Myself,241)
  AreaCheck("ar0305")
  !Heard([ANYONE],799)
  !See(NearestEnemyOf(Myself))
  !See([0.0.0.0.240])
  !Dead("aran")
  !Global("D0WarnedAran","GLOBAL",1)
THEN
  RESPONSE #100
    SetGlobal("D0MoveOnce","LOCALS",3)
    StartDialogNoSet(LastSeenBy(Myself))
END

IF
  OR(2)
    AreaCheck("ar0307")
    AreaCheck("ar0329")
  Name("d0nightk",Myself)
  !Heard([ANYONE],799)
  !See(NearestEnemyOf(Myself))
  !See([0.0.0.0.240])
  Global("D0InPlace","LOCALS",0)
THEN
  RESPONSE #100
    MoveToPoint([4603.2052])
    SetGlobal("D0InPlace","LOCALS",1)
END

/* IF
OR(2)
  AreaCheck("ar0307")
  AreaCheck("ar0329")
Name("d0night2",Myself)
!Heard([ANYONE],799)
!See(NearestEnemyOf(Myself))
!See([0.0.0.0.240])
THEN
  RESPONSE #100
    MoveToObjectFollow("d0nightk")
    ClearActions(Myself)
END */

IF
  AreaCheck("ar0306")
  Specifics(Myself,241)
  GlobalGT("D0Maevar","GLOBAL",4)
  Global("D0LarellAssault","GLOBAL",1)
  !Dead("aran")
  !Global("D0WarnedAran","GLOBAL",1)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    MoveToPoint([200.500])
    MoveBetweenAreas("ar0305",[300.550],5)
END

IF
  AreaCheck("ar0305")
  Specifics(Myself,241)
  Global("D0LarellAssault","GLOBAL",1)
  !Dead("aran")
  !Global("D0WarnedAran","GLOBAL",1)
  Global("D0MoveOnce","LOCALS",0)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    MoveToPoint([465.578])
    SetGlobal("D0MoveOnce","LOCALS",1)
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    MoveToPoint([584.477])
    SetGlobal("D0MoveOnce","LOCALS",1)
END

IF
  AreaCheck("ar0305")
  Global("D0LarellAssault","GLOBAL",1)
  Specifics(Myself,241)
  !Heard([ANYONE],799)
  !See(NearestEnemyOf(Myself))
  !See([0.0.0.0.240])
  Name("d0nightk",Myself)
  !Dead("aran")
  !Global("D0WarnedAran","GLOBAL",1)
THEN
  RESPONSE #100
    MoveToPoint([926.855])
    SetGlobal("D0MoveOnce","LOCALS",2)
    ClearActions(Myself)
END

IF
  AreaCheck("ar0305")
  Specifics(Myself,241)
  Global("D0LarellAssault","GLOBAL",1)
  !Heard([ANYONE],799)
  !See(NearestEnemyOf(Myself))
  !See([0.0.0.0.240])
  !Name("d0nightk",Myself)
  !Dead("aran")
  !Global("D0WarnedAran","GLOBAL",1)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    MoveToObjectFollow("d0nightk")
    ClearActions(Myself)
END

//////////////////////////////////////////////////////////////////////
// CHOOSING ALLEGIANCES
// Specifics:
// 240 = Aran's
// 241 = Larell's
// 242 = Mae'Var's

IF
  OR(2)
    Specifics(Myself,241)
    Specifics(Myself,242)
  OR(2)
    GlobalGT("D0Maevar","GLOBAL",0)
    GlobalGT("RenalJob","GLOBAL",0)
  !Name("maevar",Myself)
  !Name("mvpries",Myself)
  !Name("Renal Bloodscalp",Myself)
  !Name("aran",Myself)
  Global("D0Soundset","LOCALS",0)
THEN
  RESPONSE #100
    SetGlobal("D0Soundset","LOCALS",1)
    SetPlayerSound(Myself,9,61886)
    SetPlayerSound(Myself,10,-1)
    Continue()
END
//////////////////////////////////////////////////////////////////////

IF
  OR(3)
    AreaCheck("ar0301")
    AreaCheck("ar0302")
    AreaCheck("ar0303")
  Global("D0Allegiance","LOCALS",0)
  !Specifics(Myself,241)
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Allegiance","LOCALS",1)
    ChangeSpecifics(Myself,242)
END

IF
  OR(2)
    AreaCheck("ar0306")
    RandomNum(3,1)
  OR(2)
    AreaCheck("ar0306")
    AreaCheck("ar0305")
  Global("D0Allegiance","LOCALS",0)
  !Specifics(Myself,242)
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Allegiance","LOCALS",1)
    ChangeSpecifics(Myself,241)
END

IF
  Global("D0Allegiance","LOCALS",0)
  !Specifics(Myself,241)
  !Specifics(Myself,242)
  !Name("lin",Myself)
THEN
  RESPONSE #100
    SetGlobal("D0Allegiance","LOCALS",1)
    ChangeSpecifics(Myself,240)
END


//////////////////////////////////////////////////////////////////////
// CHAPTER 2 HOSTILITY STUFF

IF
  Global("AttackedThieves","GLOBAL",1)
  Allegiance(Myself,NEUTRAL)
  GlobalLT("D0MaeVar","GLOBAL",5)
  OR(2)
    !Specifics(Myself,242)
    GlobalGT("D0Maevar","GLOBAL",2)
THEN
  RESPONSE #100
    Enemy()
END

IF
  OR(2)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
  Allegiance(Myself,NEUTRAL)
  Global("AttackedThieves","GLOBAL",0)
  GlobalLT("D0MaeVar","GLOBAL",5)
  OR(2)
    !Specifics(Myself,242)
    GlobalGT("D0Maevar","GLOBAL",2)
THEN
  RESPONSE #100
    SetGlobal("AttackedThieves","GLOBAL",1)
    Enemy()
END

IF
  OR(3)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
    Allegiance(Myself,ENEMY)
  Global("AttackedThieves","GLOBAL",0)
  GlobalLT("D0MaeVar","GLOBAL",5)
  OR(2)
    !Specifics(Myself,242)
    GlobalGT("D0Maevar","GLOBAL",2)
THEN
  RESPONSE #100
    SetGlobal("AttackedThieves","GLOBAL",1)
    Continue()
END

IF
  Allegiance(Myself,ENEMY)
  !Global("WorkingForBodhi","GLOBAL",1)
  Detect([PC])
  Delay(1)
  Global("ArkanisComes","GLOBAL",0)
  Global("AttackedThieves","GLOBAL",1)
  GlobalLT("D0MaeVar","GLOBAL",5)
  GlobalLT("chapter","GLOBAL",%bg2_chapter_6%)
  OR(2)
    !Specifics(Myself,242)
    GlobalGT("D0Maevar","GLOBAL",2)
  Global("D0DisableArkanis","GLOBAL",0)
THEN
  RESPONSE #100
    SetGlobal("ArkanisComes","GLOBAL",1)
    CreateCreatureObject("STDEATH",Player1,0,0,0) // Arkanis Gath
END

//////////////////////////////////////////////////////////////////////
// COUP HOSTILITY STUFF

IF
  Global("D0MaeVarHostile","GLOBAL",1)
  Allegiance(Myself,NEUTRAL)
  Specifics(Myself,242)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    Enemy()
END

IF
  OR(2)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
  Allegiance(Myself,NEUTRAL)
  Global("D0MaeVarHostile","GLOBAL",0)
  Specifics(Myself,242)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0MaeVarHostile","GLOBAL",1)
    Enemy()
END

IF
  OR(3)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
    Allegiance(Myself,ENEMY)
  Global("D0MaeVarHostile","GLOBAL",0)
  Specifics(Myself,242)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0MaeVarHostile","GLOBAL",1)
    Continue()
END

//////////////////////////////////////////////////////////////////////

IF
  Global("D0LarellHostile","GLOBAL",1)
  Allegiance(Myself,NEUTRAL)
  Specifics(Myself,241)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    Enemy()
END

IF
  OR(2)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
  Allegiance(Myself,NEUTRAL)
  Global("D0LarellHostile","GLOBAL",0)
  Specifics(Myself,241)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0LarellHostile","GLOBAL",1)
    Enemy()
END

IF
  OR(3)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
    Allegiance(Myself,ENEMY)
  Global("D0LarellHostile","GLOBAL",0)
  Specifics(Myself,241)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0LarellHostile","GLOBAL",1)
    Continue()
END

//////////////////////////////////////////////////////////////////////

IF
  Global("D0AranHostile","GLOBAL",1)
  Allegiance(Myself,NEUTRAL)
  Specifics(Myself,240)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    Enemy()
END

IF
  OR(2)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
  Allegiance(Myself,NEUTRAL)
  Global("D0AranHostile","GLOBAL",0)
  Specifics(Myself,240)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0AranHostile","GLOBAL",1)
    Enemy()
END

IF
  OR(3)
    AttackedBy([GOODCUTOFF],DEFAULT)
    HitBy([GOODCUTOFF],CRUSHING)
    Allegiance(Myself,ENEMY)
  Global("D0AranHostile","GLOBAL",0)
  Specifics(Myself,240)
THEN
  RESPONSE #100
    ChangeAIScript("stdeath",OVERRIDE)
    SetGlobal("D0AranHostile","GLOBAL",1)
    Continue()
END

//////////////////////////////////////////////////////////////////////
// ASSAULT COMBAT

IF
  See([0.0.0.0.240])
  Global("D0LarellAssault","GLOBAL",1)
  OR(2)
    Specifics(Myself,241)
    Specifics(Myself,242)
  OR(2)
    See(NearestEnemyOf(Myself))
    See([0.0.0.0.240])
THEN
  RESPONSE #100
    Attack(LastSeenBy(Myself))
END

IF
  OR(2)
    See([0.0.0.0.242])
    See([0.0.0.0.241])
  Global("D0LarellAssault","GLOBAL",1)
  Specifics(Myself,240)
  OR(3)
    See(NearestEnemyOf(Myself))
    See([0.0.0.0.242])
    See([0.0.0.0.241])
THEN
  RESPONSE #100
    Attack(LastSeenBy(Myself))
END

IF
  See([0.0.0.0.240])
  Allegiance(LastSeenBy(Myself),ENEMY)
  Allegiance(Myself,NEUTRAL)
  GlobalGT("D0Maevar","GLOBAL",4)
  OR(2)
    Specifics(Myself,241)
    Specifics(Myself,242)
  OR(2)
    See([0.0.0.0.240])
    See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    Attack(LastSeenBy(Myself))
END

IF
  OR(2)
    See([0.0.0.0.242])
    See([0.0.0.0.241])
  Allegiance(LastSeenBy(Myself),ENEMY)
  Allegiance(Myself,NEUTRAL)
  GlobalGT("D0Maevar","GLOBAL",4)
  Specifics(Myself,240)
  OR(3)
    See([0.0.0.0.242])
    See([0.0.0.0.241])
    See(NearestEnemyOf(Myself))
THEN
  RESPONSE #100
    Attack(LastSeenBy(Myself))
END
