//-----------------------------------------------------------------------------
// Gong sound
IfCleanedUp
  tmpargument = 2
  tmpdistance = 8000
  PlayFullSound


//------------------------------------------------------------------------------
//Tell players that the inventory is too small
IfTooMuchBaggage
  tmpargument = 8
  SendMessageNear
  tmpdistance = rand & 2047 + 11000
  tmpargument = 7
  PlaySound
  tmpargument = 50
  SetReloadTime


//------------------------------------------------------------------------------
//Scream and shout when attacking
IfUsed
  tmpdistance = rand & 2047 + 11000
  tmpargument = rand & 1 + 8
  PlaySound


//------------------------------------------------------------------------------
// Booring....
IfBored
  tmpargument = ACTIONMC
  DoAction
    tmpargument = 6
    SendMessageNear
    tmpargument = 7
    SendMessageNear
    tmpargument = 10
    tmpdistance = rand & 2047 + 11000
    PlaySound


//------------------------------------------------------------------------------
//Handle death by sending a message and other stuff
IfKilled
  tmpargument = 5
  tmpdistance = rand & 2047 + 11000
  PlaySound
  tmpargument = 3
  IfArmorIs
    tmpargument = MESSAGECOSTUME
  Else
    tmpargument = MESSAGEDEATH
  IfTargetIsOnSameTeam
    tmpargument = MESSAGEFRAG
    IfTargetIsSelf
      tmpargument = MESSAGEACCIDENT
  SendMessage

  // Drop goodies
  tmpargument = 65535
  DropMoney
  DropKeys

  // Make the character body
  tmpargument = 45
  SetBumpHeight

//Initiate xp penality (tmpargument is amout of xp subtracted)
  SetTargetToSelf
  tmpargument = 0
  tmpx = targetlevel
				//Higher lvl increses penality
  tmpy = 0			//Level 1 (10 xp)
  IfXIsEqualToY
    tmpargument = 0 - 10

  tmpy = 1			//Level 2 (40 xp)
  IfXIsEqualToY
    tmpargument = 0 - 40

  tmpy = 2			//Level 3 (80 Xp)
  IfXIsEqualToY
    tmpargument = 0 - 80

  tmpy = 3			//Level 4 (160 xp)
  IfXIsEqualToY
    tmpargument = 0 - 160

  tmpy = 4			//Level 5 (320 xp)
  IfXIsEqualToY
    tmpargument = 0 -320

  tmpy = 5			//Level 6 (430 xp)
  IfXIsEqualToY
    tmpargument = 0 - 430

  tmpy = targetexp		//This will hinder xp to go below 0
  tmpx = 500			
  IfXIsMoreThanY
    tmpx = targetlevel
    tmpy = 1
    IfXIsMoreThanY		//This doesnt count for lvl 1 or 2 characters
      tmpargument = 0 - 125

  tmpy = targetexp
  tmpx = 101			//Minimum Xp is 100
  IfXIsMoreThanY
    tmpargument = 0

  tmpdistance = EXPROLEPLAY
  GiveExperienceToTarget	//Do it

//------------------------------------------------------------------------------
//Invoke special power if enough xp gained
SetTargetToSelf
tmpx = targetexp
tmpy = 9998
IfXIsMoreThanY
  UndoEnchant		//Hinder looping of same enchant
  SetOwnerToTarget
  EnchantTarget		//Give the special bonus
  tmpargument = 2	//Spawn some fancy sparklies
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  SpawnExactParticle
Else
  UndoEnchant		//Remove if needed xp is lost

//------------------------------------------------------------------------------
//For helper AIs
IfLeaderKilled
  BecomeLeader


//------------------------------------------------------------------------------
//Say ouch
IfAttacked
  SetTargetToWhoeverAttacked
  IfTargetIsOnSameTeam
    tmpargument = 6
    tmpdistance = rand & 2047 + 11000
    PlaySound
    tmpargument = MESSAGEOUCH
    SendMessageNear
  Else
    tmpargument = rand & 1 + 3
    tmpdistance = rand & 2047 + 11000
    PlaySound



//------------------------------------------------------------------------------
End
//------------------------------------------------------------------------------
