The shotgun script has a code for creating a projectile inside a for loop, just take the part inside the for loop.
As for the second idea, try this.
function SimplierProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%distancefromplayer = VectorDist(%obj.getPosition(),%col.getPosition());
if(%distancefromplayer < 100)
{
(function1)
}
else
{
(function2)
}
}