That's a great script. Now we are at "Demolition Ranch"
Looks like if target object is not dynamic -- it won't give you it's number.

Would you like an explodable object? Would you like to add sound?
Find that in it's "properties" tab.
if v.health > 0 then
PlaySound(e,0)
~~line 105-ish
Could you not place a decal at the Entity collision point?
SetPosition(d,rayX,rayY,rayZ)