// ZZ> This function makes an item fall to the floor when spawned
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				  //
  tmpargument = 0
  SetState
IfHitGround				// Make a sound
  tmpargument = 0			  //
  tmpdistance = rand & 2047 + 10000	  //
  PlaySound				  //
IfNotDropped
  tmpargument = 2
  SendMessageNear
IfNotPutAway
  tmpargument = 3
  SendMessageNear
IfTakenOut
  tmpargument = 1
  SetState
IfGrabbed				// Tell them what they've won...
  SetTargetToWhoeverIsHolding		  //
  IfTargetIsAPlayer			  //
    tmpargument = 0			  //
    SendMessageNear			  //
  tmpargument = 1
  SetState


// Item is held by a foot soldier
IfStateIs1
  IfTargetIsMounted
    // Can the holder joust?
    tmpargument = [JOUS]
    IfTargetHasSkillID
      tmpargument = 0
      CorrectActionForHand
      tmpargument = tmpargument & 2 + ACTIONMH
      DoActionOverride
      KeepAction
      tmpargument = 2
      SetState
      tmpargument = 5
      SendMessageNear
    Else
      // No joust allowed
      tmpargument = 3
      SetState
      tmpargument = 4
      SendMessageNear




// Item is held by a cavalier
IfStateIs2
  IfTargetIsMounted
    // Do a particle spawn based on speed
    SetOldTarget
    SetTargetToLowestTarget
    tmpx = targetspeedx
    tmpy = targetspeedy
    tmpx = xydistance > 2


    // Make sure mount is moving fast enough
    tmpy = 0
    IfXIsMoreThanY
      // Not too fast
      tmpy = 4
      IfXIsMoreThanY
        tmpx = tmpy


      // Now spawn it
      tmpargument = 1 + tmpx
      tmpdistance = 1
      SpawnAttachedParticle
    SetTargetToOldTarget
  Else
    tmpargument = ACTIONMK
    DoActionOverride
    KeepAction
    tmpargument = 1
    SetState


// Item is held by a cavalier that has no clue
IfStateIs2
  IfTargetIsMounted
    GetState // NOP
  Else
    tmpargument = 1
    SetState



End
