// Check the exit passage
IfTimeOut
  tmpargument = passage
  SetTargetToWhoeverIsInPassage
    IfTargetIsAMount
      SetTargetToTargetLeftHand // Rider is held in the mount's left hand...
    IfTargetIsAPlayer
      ClearEndMessage
      tmpargument = [PRIS]  // Did you lead K'nife out?
      tmpdistance = 6
      EnableExport
      BeatModule
      SetTargetToNearestBlahID
        tmpargument = 0
        AddEndMessage
        tmpargument = 1
        AddEndMessage
        tmpargument = 2
        AddEndMessage
        tmpargument = 3
        AddEndMessage
        
        //Special ending, unlock G'nome Starter
        tmpargument = [KNIF]
        AddIDSZ

        //Also, if the player has looted enough, K'nife will offer a job
        tmpx = targetmoney          //225 is total gold in module
        tmpy = 135                  //Need to grab at least 60% of the money
        IfXIsMoreThanY
          tmpargument = 7
          AddEndMessage
          tmpargument = 8
          AddEndMessage
          tmpdistance = 0           //The quest level
          AddQuestAllPlayers        //Add it
        
        //And give some bonus XP
        tmpargument = 50
        tmpdistance = EXPQUEST
        GiveExperienceToGoodTeam
      Else
        tmpargument = 4
        AddEndMessage
        tmpargument = 5
        AddEndMessage
        tmpargument = 6
        AddEndMessage
              
      //Play victory tune
      tmpargument = 14
      tmpdistance = 0
      PlayMusic
      
      tmpargument = [BEAT]
      AddIDSZ
      GoPoof
  tmpargument = 10
  SetTime
End
