//Spawn trap warnings
tmpargument = 1
IfArmorIs
  tmpargument = 4
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle

IfTimeOut

  //Check for trap finders to find it
  tmpargument = 0
  IfArmorIs
    tmpdistance = BLAHPLAYERS + BLAHENEMIES + BLAHFRIENDS + BLAHSKILL
    tmpturn = [DISA]
    tmpargument = [NONE]
    SetTargetToWideBlahID
      tmpx = targetdistance
      tmpy = 500			//Detect range
      IfXIsLessThanY
        tmpx = rand & 255
        tmpy = 25			//How often to check
        IfXIsLessThanY
          tmpx = rand & 255 * 10 + targetint	//0-10 + the characters intelligence
          tmpy = 5888				//need to be more than 23 points added together
          IfXIsMoreThanY
            tmpargument = 1   //Detected!
            SendMessageNear
            tmpargument = 15
            tmpdistance = EXPDARE
            GiveExperienceToTarget		//Award some xp
            tmpargument = 2
            PlaySound				//Play sound effect
            tmpargument = 1
            ChangeArmor				//Mark as detected

            //Draw the text
            tmpdistance = 3         //Duration
            tmpargument = 2         //Message 8
            tmpturn = RED           //Message color
            DrawBillboard
            
  tmpx = selfcontent
  tmpy = 1
  IfXIsEqualToY
    //Stop shooting
    tmpargument = 0
    SetContent

    // Wait a while (reset)
    tmpargument = 75
    SetTime
    tmpargument = 0
    SetContent

  Else

    IfXIsLessThanY
      // Check the passage
      tmpdistance = 200
      SetTargetToDistantEnemy
        tmpargument = 0
        SendMessageNear
        PlaySound
        tmpargument = rand & 2 + 4			//How many arrows to spawn
        SetContent

      //Wait some
      tmpargument = 5
      SetTime

    IfXIsMoreThanY
      // Down the counter
      tmpargument = tmpx - 1
      SetContent

      //Shoot an arrow
      tmpargument = 0
      tmpdistance = 600
      tmpx = selfx
      tmpy = selfy
      SpawnExactParticle
      SpawnExactParticle
      
      //Time between each arrow shot
      tmpargument = 15
      SetTime

// All done
End
