//-------------------------------------------------------------------------------------------
IfSpawned
  tmpargument = STATEGUARD
  SetState
  KeepAction
  tmpargument = 100
  SetTime
  
//-------------------------------------------------------------------------------------------
IfOrdered
  tmpx = selforder
  tmpy = [CHES]
  IfXIsEqualToY
  
    //Activate combat AI
    tmpargument = STATECOMBAT
    SetState
    UnkeepAction
    
    //Allow death
    JoinEvilTeam
    tmpargument = 1
    ChangeArmor
    SetTargetToSelf
    EnchantTarget
    
  //Stop if the game is over
  tmpx = selforder
  tmpy = [DEAD]
  IfXIsEqualToY
    SetTargetToSelf
    KillTarget
    
//-------------------------------------------------------------------------------------------
IfKilled				// This reduces the height of the char
  tmpargument = 0
  PlaySound				//Death sound

  // Last words...
  tmpargument = 0
  SendMessageNear	
  
IfAttacked
  tmpargument = 1
  PlaySound

//-------------------------------------------------------------------------------------------
//Only exist as long as we have a rider
IfTimeOut
  SetTargetToRider
    DoNothing
  Else
    SetTargetToSelf
    KillTarget
  tmpargument = 20
  SetTime
  
End					// Finished with this character
