// ZZ> This function makes an item fall to the floor when spawned
IfSpawned
  tmpargument = ACTIONJB
  DoAction
  KeepAction
IfDropped				// Make it lie on floor
  KeepAction
IfGrabbed				// Tell them what they've won, Johnny!
  SetTargetToWhoeverIsHolding
  IfTargetIsAPlayer
    tmpargument = 0
    SendMessageNear
IfHitGround
  tmpargument = 0
  tmpdistance = rand & 2047 + 8000
  PlaySound
  tmpargument = ACTIONDB
  DoAction

//Maybe the character identifies the gem?
IfUsed
  IfStateIs0
      //Intelligence checks show if others find it out
      tmpx = targetint
      tmpy = rand & 2500 + 2750
      IfXIsMoreThanY
        // Character identifies the gem
        tmpargument = 2
        SendMessageNear
        MakeNameKnown
        tmpargument = 10
        tmpdistance = EXPSECRET
        GiveExperienceToTarget
        tmpargument = 2
        SetState
        tmpargument = 100
        SetTime
      Else
        tmpargument = 6
        SendMessageNear
        tmpargument = 4
        SetState
        tmpargument = 100
        SetTime            
        
//This is a ingredient
  IfStateIs1
    tmpargument = 5
    SendMessageNear
    tmpargument = 3
    SetState
    tmpargument = 100
    SetTime

IfTimeOut
  IfStateIs2
    tmpargument = 1
    SetState

  IfStateIs3
    tmpargument = 1
    SetState

  IfStateIs4
    tmpargument = 0
    SetState


End					// All done
