// ZZ> This function makes the character wanders around its enemy
IfKilled				// This reduces the height of the char
  tmpargument = 40			  //
  SetBumpSize				  //
  tmpargument = 45			  //
  SetBumpHeight				  //
  tmpargument = 65535			  // Drop money
  DropMoney				  //
  tmpargument = 0			  //
  PlaySound
  SpawnPoof

//  PlaySound				  //
IfAttacked				// Counter attack
  SetTargetToWhoeverAttacked		  //
    IfTargetIsOnHatedTeam		    //
      BecomeLeader			      //
      tmpargument = 1			      // Enter combat mode
      SetState				      //
      SetTurnModeToWatchTarget
    Else				    //
      SetTargetToOldTarget		      //
  tmpargument = rand & 1 + 1		  //
  PlaySound

				  //
IfTargetKilled				// Return to watch mode
  tmpargument = 0			  //
  SetState				  //

IfBumped				// Attack whoever it bumped
  SetTargetToWhoeverBumped		  //
  IfTargetIsOnHatedTeam			  // Make sure it's an enemy
    IfHoldingMeleeWeapon                    // Got Weapon?
      PressLatchButton			      //
  Else					  // Scooch around friendly
    tmpx = rand & 255 + targetx - 128	    //
    tmpy = rand & 255 + targety - 128	    //
    ClearWaypoints			    //
    AddWaypoint				    //
    SetTargetToOldTarget		    //

IfTimeOut				// This is done every so often
  IfStateIs0
    tmpx = selfx
    tmpy = selfy
    SetTargetToNearestEnemy
      IfFacingTarget
        SetTurnModeToWatchTarget
        tmpargument = 1
        SetState
      Else
        SetTurnModeToSpin
  IfStateIs1
    tmpx = targetdistance
    tmpy = 1000
    IfXIsLessThanY
      tmpx = targetx
      tmpy = targety
    Else
      tmpx = selfx
      tmpy = selfy
      tmpargument = 0
      SetState
  ClearWaypoints			  //
  AddWaypoint				  //
  tmpargument = rand & 15 + 30		  // Wait a while and try again
  SetTime				  //

End					// Finished with this character
