IfTimeOut
  tmpargument = rand & 15 + 30
  SetTime

  //Recharge gas attack
  GetContent
  tmpx = tmpargument
  tmpy = 0
  IfXIsMoreThanY
    tmpargument = tmpargument -1
    SetContent

  //Idle
  IfStateIs0
    SetTargetToNearbyEnemy
      tmpargument = 1
      SetState
    Else
      tmpx = selfspawnx
      tmpy = selfspawny
      ClearWaypoints
      AddWaypoint

  //Following enemy
  IfStateIs1
    IfTargetIsOnHatedTeam		//Attack?
      IfFacingTarget
        tmpx = targetdistance
        tmpy = 200
        IfXIsLessThanY
          tmpx = 35 + selfdex < 8
          tmpy = rand % 100
          IfXIsMoreThanY			//Check for attack skill
            tmpargument = ACTIONBA
            DoAction
      //Move towards the enemy
      tmpx = targetx
      tmpy = targety
      tmpdistance = 400
      tmpturn = targetturnto
      Compass
      ClearWaypoints
      AddWaypoint
    Else
      tmpargument = 0
      SetState

//Say ouch
IfAttacked
  tmpargument = rand & 1
  PlaySound
  SetTargetToWhoeverAttacked
    IfTargetIsOnHatedTeam
      tmpargument = 1
      SetState
    Else
      SetTargetToOldTarget

//Explode
IfKilled
  tmpargument = 3
  tmpdistance = selfz
  tmpx = selfx
  tmpy = selfy
  SpawnExactParticle
  IfTargetIsSelf			//Death message
    tmpargument = 1
  Else
    tmpargument = 0
  SendMessageNear

//Counter attack
IfBumped
  SetTargetToWhoeverBumped
  IfTargetIsOnHatedTeam
    IfFacingTarget
      tmpargument = ACTIONBA
      DoAction

      //Spew some paralysis gas
      tmpargument = 0
      IfContentIs
        tmpargument = 150
        SetTargetReloadTime		//Paralyse the target for 3 seconds
        tmpargument = 4
        tmpx = targetx
        tmpy = targety
        tmpdistance = targetz
        SpawnExactParticle
        SpawnExactParticle		//Cloud
        tmpargument = rand & 3 + 5	//Recharge time
        SetContent
        tmpargument = 5			//Gass sound
        PlaySound
        tmpargument = 2
        SendMessageNear
  Else
    SetTargetToOldTarget

End					// All done
