I edited the post with some instructions, so others that find it can see as well. Hopefully its ok now.
As for the spell, you basically want to check if the terrain is pathable, right? There is IsTerrainPathable but as far as I know its buggy and ignores destructables.
Here is something that may work (dont have access to WE, right now but atleast the concept will be the same)
function CheckPathability takes real x, real y returns boolean
local unit u = CreateUnit(Player(15), 'hpea', x, y, 0)
local real nx = GetUnitX(u)
local real ny = GetUnitY(u)
local boolean result = SquareRoot((nx - x) * (nx - x) + (ny - y) * (ny - y)) < 32
call RemoveUnit(u)
set u = null
return result
endfunction
Whether there are better ways, I do not know.
'hpea' can be any unit. I think it's pathability won't matter, but just in case leave it on.
E: I have read that using an item instead of a unit is better but dont know if its true or not.