// This pops some ghouls in a given area, if the detection area is blocked
IfTimeOut
  // Check the detection passage...
  tmpargument = passage
  SetTargetToWhoeverIsInPassage
    IfTargetIsOnHatedTeam
      // Little music blurb
      tmpargument = 0
      tmpdistance = 11025
      PlayFullSound


      // Pop the baddies
      tmpargument = passage + 1	// The passage to spawn
      tmpdistance = 244		// The tile to find
      tmpx = 0			// Needed for first call
      tmpy = 0			// Needed for first call
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride


      // Pop another
      tmpargument = passage + 1
      tmpdistance = 244
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride


      // Pop another
      tmpargument = passage + 1
      tmpdistance = 244
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride


      // Pop another
      tmpargument = passage + 1
      tmpdistance = 244
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride


      // Pop another
      tmpargument = passage + 1
      tmpdistance = 244
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride


      // Pop another
      tmpargument = passage + 1
      tmpdistance = 244
      FindTileInPassage
        // Replace the tile
        tmpargument = 246
        SetTileXY
        // Spawn a ghoul
        tmpargument = 98
        tmpdistance = 0
        tmpturn = rand
        SpawnExactCharacterXYZ
          tmpargument = 0
          SpawnExactParticle
          tmpargument = ACTIONJB
          ChildDoActionOverride

      // Popper is no longer needed...
      GoPoof


  // Wait a bit before checking again
  tmpargument = 10
  SetTime
End					// All done
