// ZZ> This function makes an item fall to the floor when spawned

//Show its poisoned if its identified
IfNameIsKnown
  tmpargument = 0	//Is it not changed already?
  IfArmorIs
    tmpargument = 1	//Then show poison icon
    ChangeArmor

IfSpawned				//
  tmpargument = ACTIONJB		  //
  DoAction				  //
  KeepAction				  //
  MakeCrushValid
IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 1
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 1
  SendMessageNear
IfDropped				// Make it lie on floor
  KeepAction				  //
IfGrabbed				// Tell them what they've won...
  SetTargetToWhoeverIsHolding		  //
  IfTargetIsAPlayer			  //
    tmpargument = 0			  //
    SendMessageNear			  //
IfHitGround				// Make a sound
  tmpargument = 1			  //
  tmpdistance = rand & 2047 + 10000	  //
  PlaySound				  //
IfNotDropped
  tmpargument = 2
  SendMessageNear
IfTakenOut
  tmpargument = 2
  tmpdistance = rand & 2047 + 10000
  PlaySound
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 4
    SendMessageNear
IfNotPutAway
  tmpargument = 3
  SendMessageNear

//Check if user poisoned himself
IfUsed
  SetTargetToWhoeverIsHolding
  tmpargument = [POIS]
  IfTargetHasSkillID		//Does it have poison use skill?
    DoNothing		//then nothing happens
  Else
    tmpx = rand % 2816 + 1024 	//Wisdom determines the chance, 15 is never and 4 is almost always
    tmpy = rand % 500 + targetwis	//Randomness to decrease chance
    IfXIsMoreThanY
      SetOwnerToTarget
      EnchantTarget		//Give the character some poison damage
      tmpargument = 5
      SendMessageNear		//Tell them what happened
      DetachFromHolder		//Drop the weapon
      MakeNameKnown		//Tell the players its poisoned

//Paladins dont use poisoned weapons
IfGrabbed
  SetTargetToWhoeverIsHolding
  tmpargument = [PALA]
  IfTargetHasID
    DetachFromHolder
    tmpargument = 6		//I refuse to hold this!
    SendMessageNear
    MakeNameKnown		//Its poisoned, yes

End					// All done
