//Frost breath
tmpargument = 1
IfContentIs
  SetTargetToNearbyEnemy	//Only shoot if he sees a enemy
    IfFacingTarget		//and he is facing it
      SetTargetToSelf
      tmpargument = 17
      CostTargetMana
        SetTargetToOwner	//This stuff makes the breath correctly
        tmpdistance = selfz     //appear out of the lizards mouth
        tmpturn = targetturn
        tmpx = targetx
        tmpy = targety 
        Compass    
        tmpargument = 0
        SpawnExactParticle
      Else			//Out of mana
        SetTargetToOldTarget
  Else				//Nobody there
    tmpargument = 0		//thus stop shooting then
    SetContent

// ZZ> This function makes the character wanders around its enemy
IfCleanedUp				// Respawn
  RespawnCharacter			  // 

IfKilled				// This reduces the height of the char
  tmpargument = 0			    //
  SendMessageNear			    //
  tmpargument = 40			  //
  SetBumpSize				  //
  tmpargument = 45			  //
  SetBumpHeight				  //
  tmpargument = 65535			  // Drop money
  DropMoney				  //
  DropKeys
  tmpargument = 2			  //
  tmpdistance = rand & 4095 + 8000	  //
  PlaySound				  //
  tmpargument = 1
  ChangeArmor

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

IfTargetKilled				// Return to Wander mode
  IfTargetIsOnHatedTeam
    tmpargument = 0			  //
    SetState				  //

//Breathe frost
IfBumped				// Attack whoever it bumped
  SetTargetToWhoeverBumped		  //
  IfTargetIsOnHatedTeam			  // Make sure it's an enemy
    PressLatchButton			//Unleash frost aura if avalible
    tmpargument = 1
    SetState
    IfFacingTarget			//Also use breath attack if avalible
      tmpargument = 1
      SetContent
  Else					  // Scooch around friendly
    SetTargetToOldTarget		    //

IfTimeOut			// This is done every so often		
  SetTargetToNearbyEnemy		  // Look for enemies
    tmpargument = 1			    // Enter combat mode
    SetState				    
    BecomeLeader

  Else			//No enemies?
    tmpargument = 0	//Then wander around again
    SetState			    			    

// State 0 ( Wander )
  IfStateIs0				  
    tmpx = rand & 1023 - 512 + selfspawnx
    tmpy = rand & 1023 - 512 + selfspawny
    tmpargument = rand & 15 + 30
    SetTime		    

// State 1 ( Combat )
  IfStateIs1	
    tmpargument = 15
    SetTime	
    tmpx = targetx                  //Always get in combat position
    tmpy = targety
    tmpturn = targetturnto
    Compass			
    IfFacingTarget			//Can he use breath attack?
      tmpargument = 1
      SetContent

  ClearWaypoints			  
  AddWaypoint				  
			  

// Play a random grunt?
  tmpx = rand & 255			  
  tmpy = 15				  
  IfXIsLessThanY			  
    tmpargument = 5			    
    tmpdistance = rand & 4095 + 9000	    
    PlaySound	

//Unleash frost aura!
IfUsed
  tmpdistance = SPAWNORIGIN
  tmpargument = 5
  SpawnAttachedParticle
  tmpargument = 90
  SetReloadTime

End					// Finished with this character
