// Get mean if characters wanna be bad
IfAttacked
  CallForHelp
  JoinEvilTeam
IfKilled
  CallForHelp
IfCalledForHelp
  JoinEvilTeam

IfSpawned
  tmpargument = 20
  SetSpeedPercent
  tmpx=selfx
  tmpy=selfy
  tmpargument=1
  SetXY

//------------------------------------------------------------------------------
// ZZ> Handle normal state
IfStateIs0

// See if we haven't moved much
  tmpargument=0
  GetXY
  tmpx=selfx-tmpx
  tmpy=selfy-tmpy

  tmpdistance=tmpy
  tmpy=0
  IfXIsLessThanY
    tmpargument=-tmpx
  Else
    tmpargument=tmpx
  tmpx=tmpdistance
  IfXIsLessThanY
    tmpargument=tmpargument-tmpx
  Else
    tmpargument=tmpargument+tmpx

  tmpx=tmpargument
  tmpy=1
  IfXIsLessThanY
    tmpargument=1
    GetXY
    tmpx = rand % 6400 + tmpx - 3200
    tmpy = rand % 6400 + tmpy - 3200
    ClearWaypoints
    AddWaypoint

  IfAtLastWaypoint
    tmpargument=1
    GetXY
    tmpx = rand % 6400 + tmpx - 3200
    tmpy = rand % 6400 + tmpy - 3200
    ClearWaypoints
    AddWaypoint

  IfBumped
    SetTargetToWhoeverBumped
    IfTargetIsOnHatedTeam
      IfFacingTarget

        // Decide which to whack
        tmpargument = LATCHRIGHT
        PressLatchButton
      Else
        tmpx = targetx
        tmpy = targety
        ClearWaypoints
        AddWaypoint
    Else
      tmpx = rand & 511 - 256 + selfx
      tmpy = rand & 511 - 256 + selfy
      tmpdistance = 100
      tmpturn = targetturnto + 32768
      Compass
      ClearWaypoints
      AddWaypoint
      SetTargetToOldTarget
  IfTimeOut
    SetTargetToWideEnemy
      IfFacingTarget
        tmpx = targetdistance
        tmpy = 100
        IfXIsLessThanY
          // Decide which leg to kick
          tmpargument = LATCHRIGHT
          PressLatchButton
      Else
        tmpx = targetx
        tmpy = targety
        tmpturn = targetturnto
        tmpdistance = 200
        Compass
        ClearWaypoints
        AddWaypoint
    tmpargument = 80
    SetTime

    // Remember where we are
    tmpargument=0
    tmpx=selfx
    tmpy=selfy
    SetXY
//------------------------------------------------------------------------------
End
//------------------------------------------------------------------------------

