// Must die in 1 hit to disallow punching it open
IfSpawned
  tmpargument = 512
  SetDamageThreshold

IfHealed
  // Spawn a defense ping
  IfStateIs0
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 0
    SpawnExactParticle
    tmpargument = 1
    SetState
    tmpargument = 1
    SetTime
    tmpargument = 2
    SendMessageNear

//Hit by bashing weapons?
IfAttacked
  
  // Spawn a defense ping
  IfStateIs0
    tmpx = selfx
    tmpy = selfy
    tmpdistance = selfz
    tmpargument = 0
    SpawnExactParticle
    tmpargument = 1
    SetState
    tmpargument = 50
    SetTime
    tmpargument = 2
    SendMessageNear

//Reset message and ping timer
IfTimeOut
  tmpargument = 0
  SetState

IfKilled
  SetTargetToWhoeverAttacked
    
  //Message and such
  tmpargument = 2
  PlaySound
  tmpargument = 1
  SendMessageNear

  //Fancy spell effect
  tmpargument = 4
  SpawnParticle

  // Drop goodies
  DropItems
  tmpargument = selfmoney
  DropMoney
  DropKeys

  // Replace self with an imposter...
  tmpargument = 54
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpturn = selfturn
  SpawnExactCharacterXYZ
  GoPoof

  SetTargetToWhoeverAttacked
  tmpargument = 150			//Award some quest xp
  tmpdistance = EXPQUEST
  GiveExperienceToGoodTeam
  tmpargument = 768			//Give abillity to cast divine spells!
  GiveManaToTarget

  //Make the module spawn monsters!
  tmpargument = [EXIT]
  tmpdistance = [EXIT]
  OrderSpecialID

End
