LinePick...argh

Blitz3D Forums/Blitz3D Beginners Area/LinePick...argh

So, here is a problem I am having and am in hopes someone has an answer :)

Suppose my terrain is "Y" shaped, and I want gems to populate it using the code below.

gem = CreateSprite()
SpriteViewMode gem,4
gemt=LoadTexture("gem.tga",2)
ScaleSprite gem,5,2.25
EntityTexture gem, gemt
EntityFX gem,4
HideEntity gem
EntityPickMode terrain,2
For gem_loop = 1 To 4000
  ccx# = Rand(-110,500) 
  ccz# = Rand(-110,390)
  cccopy = CopyEntity( gem )
LinePick ccx, 20, ccz, 0,-9000,0
  PositionEntity cccopy, ccx,PickedY()+1.5, ccz
Next 
EntityPickMode terrain,0


Now, the code puts gems wonderfully across the "Y" shape, but it ALSO puts
gems in the "empty" parts of the "Y". How do I keep it from creating floating gems in the empty part of the "Y" shape, and ONLY putting gems on the "Y" mesh itself using the code above?

You mean, if no mesh is picked, you don't want to place any entities, right?
Then I think this code would do that:
LinePick ccx, 20, ccz, 0,-9000,0
If PickedEntity() = terrain Then
  cccopy = CopyEntity( gem )
  PositionEntity cccopy, ccx,PickedY()+1.5, ccz
End If


worked perfect, thank you very much :)