//This object does some module updates
IfTimeOut
  CleanUp
  tmpargument = 50
  SetTime
  
  //Players escaped the crypt?
  tmpargument = passage
  SetTargetToWhoeverIsInPassage
    IfTargetIsAPlayer
      ClearEndMessage
      tmpargument = 1
      AddEndMessage
      tmpargument = 2
      AddEndMessage
      tmpargument = 3
      AddEndMessage
      EnableExport
      BeatModule
      tmpargument = [BEAT]
      AddIDSZ
      EndModule

//This starts the music
IfSpawned
  tmpargument = 10
  tmpdistance = 0
  PlayMusic  
  DisableExport
  
//Spawn monsters?
IfOrdered
  tmpx = selforder
  tmpy = [EXIT]
  IfXIsEqualToY
    tmpargument = 0
    SendMessage
    
    // Little music blurb
    tmpargument = 0
    PlayFullSound

    // Spawn ghouls
    tmpargument = 56
    tmpx = 41*128
    tmpy = 38*128
    tmpdistance = 20
    tmpturn = rand
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
      tmpargument = ACTIONJB
      ChildDoActionOverride

    // Spawn grub bug monsters
    tmpargument = 59
    tmpx = 38*128
    tmpy = 48*128
    tmpdistance = 20
    tmpturn = rand
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ
    SpawnExactCharacterXYZ

End					// All done
