IF
  TimeOfDay(NIGHT)
  Global("SK#AlgolExists","AR0800",0)
THEN
  RESPONSE #100
    SetGlobal("SK#AlgolExists","AR0800",1)
    CreateCreature("SK#ALGOL",[399.1545],8)  // ~Algol~
END


IF
  OnCreation()
  GlobalGT("Chapter","GLOBAL",5)
  Global("Deactivate0801","AR0800",1)
  InMyArea(Player1)
THEN
  RESPONSE #100
    FadeToColor([1.0],0)
    SetGlobal("Deactivate0801","AR0800",2)
    DayNight(MIDNIGHT)
    FadeFromColor([20.0],0)
    TriggerActivation("Tran0801a",FALSE)
    TriggerActivation("Tran0801b",FALSE)
    TriggerActivation("Tran0801c",FALSE)
    TriggerActivation("Tran0801d",FALSE)
    TriggerActivation("BodhiInfo1",TRUE)
    TriggerActivation("BodhiInfo2",TRUE)
    TriggerActivation("BodhiInfo3",TRUE)
    TriggerActivation("Tran0808",TRUE)
    Unlock("DOOR12")
    CreateCreatureObjectOffScreen("BODHIAMB",Player1,0,0,0)  // ~Bodhi~
END

IF
  GlobalGT("BodhiJob","GLOBAL",0)
  Global("Movie02","GLOBAL",0)
THEN
  RESPONSE #100
    ClearAllActions()
    SetGlobal("Movie02","GLOBAL",1)
    StartCutSceneMode()
    FadeToColor([30.0],0)
    Wait(2)
    EndCutSceneMode()
    TextScreen("SCENE04")
    SmallWait(1)
    StartCutSceneMode()
    StartCutScene("Movie02a")
END

IF
  Global("WorkingForBodhi","GLOBAL",1)
  Global("BodhiJournal","AR0800",0)
THEN
  RESPONSE #100
    SetGlobal("BodhiJournal","AR0800",1)
    AddJournalEntry(6606,QUEST)
    AddJournalEntry(23351,INFO)
END

IF
  Global("Deactivate0801","AR0800",0)
THEN
  RESPONSE #100
    SetGlobal("Deactivate0801","AR0800",1)
    TriggerActivation("BodhiInfo1",FALSE)
    TriggerActivation("BodhiInfo2",FALSE)
    TriggerActivation("BodhiInfo3",FALSE)
    TriggerActivation("Tran0808",FALSE)
END

IF
  GlobalGT("NaliaMessage","GLOBAL",0)
  Global("NaliaWentToFuneral","GLOBAL",0)
  Global("SpawnNaliaFuneral","AR0800",0)
THEN
  RESPONSE #100
    SetGlobal("SpawnNaliaFuneral","AR0800",1)
    CreateCreature("ISAEA",[1842.575],0)  // ~Isaea Roenall~
    CreateCreature("FARTHIN",[1787.581],0)  // ~Lord Farthington Roenall~
    CreateCreature("FUMIN",[2132.780],0)  // ~Minister Adelain~
    CreateCreature("FULADY",[1940.651],0)  // ~Lady Tandolan of Um~
    CreateCreature("FULORD",[1946.726],0)  // ~Lord Milsire Donderbeg~
    CreateCreature("FUAGNON",[1995.757],0)  // ~Hurgan Stoneblade~
END

IF
  False()
  GlobalTimerExpired("Garrick","GLOBAL")
THEN
  RESPONSE #100
    ActionOverride("Cyrando",JumpToPoint([2963.3624]))
    ActionOverride("Irlana",JumpToPoint([2989.3604]))
    ActionOverride("Cyrando",Face(14))
    ActionOverride("Irlana",Face(14))
END

IF
  Global("BodhiAppear","GLOBAL",1)
  InMyArea(Player1)
  GlobalLT("Chapter","GLOBAL",5)
  OR(2)
    !GlobalTimerNotExpired("Bodhi","GLOBAL")
    PartyGoldGT(14999)
  Global("WorkingForAran","GLOBAL",0)
  !Exists("Bodhi")  // ~Bodhi~
  OR(2)
    TimeGT(DUSK_START)
    TimeLT(DAWN_START)
THEN
  RESPONSE #100
    CreateCreature("BODHI",[2165.1724],2)  // ~Bodhi~
END

IF
  Global("WorkingForBodhi","GLOBAL",1)
  OpenState("DOOR12",FALSE)  // DOOR12
  GlobalLT("Chapter","GLOBAL",6)
  !Global("Door12Opened","AR0800",1)
THEN
  RESPONSE #100
    TriggerActivation("Tran0801c",TRUE)
    Unlock("DOOR12")
    OpenDoor("DOOR12")
    SetGlobal("Door12Opened","AR0800",1)
END

IF
  Global("ZarixJumpOn","GLOBAL",1)
  Global("ZarixInParty","GLOBAL",1)
  !InActiveArea("zarix")  // ~Zarix~
  !See("zarix")  // ~Zarix~
  !Dead("zarix")  // ~Zarix~
  !StateCheck("Worgas",STATE_DEAD)  // ~Worgas~
THEN
  RESPONSE #100
    MoveGlobalObject("zarix","Worgas")
END

IF
  Global("ZarixJumpOn","GLOBAL",1)
  !InActiveArea("zarix")  // ~Zarix~
  !See("zarix")  // ~Zarix~
  !Dead("zarix")  // ~Zarix~
  !Global("ZarixInParty","GLOBAL",1)
  StateCheck("Worgas",STATE_DEAD)  // ~Worgas~
THEN
  RESPONSE #100
    MoveGlobalObject("zarix",Protagonist)
END


