//This is special for the grub mom
IfCleanedUp				            // Respawn
  tmpdistance = 128*15
  SetTargetToDistantEnemy
    DoNothing
  Else			                  // Make sure killer is away
    RespawnCharacter

// Make it able to be crushed
IfSpawned				
  MakeCrushValid
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 4
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear
  
// This reduces the height of the char
IfKilled
  IfTargetIsOnHatedTeam			  // Final words
    tmpargument = 0
    SendMessageNear
  tmpargument = 30			  // Dead height
  SetBumpHeight
  tmpargument = 1			  // Sound
  PlaySound
  
// Don't take kindly to attackers
IfAttacked				
  SetTargetToWhoeverAttacked
    tmpargument = 0			    // Sound
    PlaySound

// Attack whoever it bumped
IfBumped
  SetTargetToWhoeverBumped
  IfTargetIsOnHatedTeam			  // Make sure it's an enemy
    tmpargument = LATCHLEFT		    // Bite 'em
    PressLatchButton
  Else					  // Scooch around friendly
    tmpx = rand & 1023 + targetx - 512
    tmpy = rand & 1023 + targety - 512
    ClearWaypoints
    AddWaypoint
    SetTargetToOldTarget

// This is done every so often
IfTimeOut
  SetTargetToNearbyEnemy		  // Look for enemies
    tmpx = rand & 511 - 256 + targetx
    tmpy = rand & 511 - 256 + targety
  Else					  // Wander around home position
    tmpx = rand & 1023 - 512 + selfspawnx
    tmpy = rand & 1023 - 512 + selfspawny
  ClearWaypoints
  AddWaypoint
  tmpargument = rand & 63 + 20		  // Wait a while and try again
  SetTime
  
End					// Finished with this character
