// ZZ> This function makes an item fall to the floor when spawned
IfSpawned				//
  tmpargument = ACTIONJB		  //
  DoAction				  //
  KeepAction				  //
  MakeCrushValid
  MakeAmmoKnown

  IfNameIsKnown
    tmpargument = 1
    ChangeArmor

IfCrushed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 2
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 6
  SendMessageNear
IfDropped				// Make it lie on floor
  KeepAction				  //
IfHitGround				// Make a sound
  tmpargument = 0			  //
  PlaySound				  //
IfInWater
  IfHeld
    DoNothing
  Else
    // Go blank
    GetContent
    tmpx = tmpargument
    tmpy = 0
    IfXIsEqualToY
      tmpargument = 1
      SetContent
      tmpargument = 5
      SendMessageNear
      MakeNameKnown      // To keep messages okay
IfGrabbed				// Tell them what they've won...
  SetTargetToWhoeverIsHolding		  //
  SetOwnerToTarget
  IfTargetIsAPlayer			  //
    GetContent
    SendMessageNear			  //
IfUsed
  GetContent
  tmpx = tmpargument
  tmpy = 0
  IfXIsEqualToY
    // Find Target state
    tmpargument = 1
    SetState

    // Make sparklies around caster
    SetTargetToWhoeverIsHolding
      tmpx = targetx
      tmpy = targety
      tmpdistance = targetz
      tmpargument = 0
      SpawnExactParticle

    // Make sparklies around target
    tmpargument = [NONE]
    tmpdistance = BLAHFRIENDS + BLAHDEAD  // Dead friends
    SetTargetToWideBlahID
      tmpx = targetx
      tmpy = targety
      tmpdistance = targetz
      tmpargument = 0
      SpawnExactParticle
  Else
    // Can't use a blank scroll...
    tmpargument = 0
    SetState
    tmpargument = 7
    SendMessageNear
    tmpargument = 50
    SetReloadTime
Else
  // Has it been charged?
  IfStateIs1
    // Revert to uncharged state
    tmpargument = 0
    SetState

    // Respawn the target
    tmpargument = [NONE]
    tmpdistance = BLAHFRIENDS + BLAHDEAD          // Dead friends
    SetTargetToWideBlahID
      RespawnTarget

      // Play the gong sound
      tmpargument = 1
      PlayFullSound

      // Let all the players know
      tmpargument = 2
      SendMessage

      // Give experience to caster
      IfNameIsKnown
        DoNothing
      Else
        SetTargetToWhoeverIsHolding
        tmpargument = 5
        tmpdistance = EXPSECRET
        GiveExperienceToTarget
        tmpargument = 1
        ChangeArmor
      MakeSimilarNamesKnown
    Else
      // Say that it didn't work...
      tmpargument = 3
      SendMessageNear

    // Don't use a second one right away
    SetTargetToWhoeverIsHolding
    tmpargument = 20
    SetTargetReloadTime

    // Get rid of a scroll
    CostAmmo
    IfAmmoOut
      GoPoof
IfReaffirmed
  tmpx = selfx
  tmpy = selfy
  tmpdistance = selfz
  tmpargument = 2
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  SpawnExactParticle
  GoPoof
  tmpargument = 4
  SendMessageNear
End					// All done
