does anyone know how to amend the code so that it produces less poly's
Use a smaller Hightmap.
The point of the code is to produce exactly the amount of Polys needed, and not to have LOD "Poly Popup", if its useing too many polies, then you either need to make the map smaller, or.. use a LOD terrain, with then uses the amount of polies its told to.
For Obvious reasons you could just put a step 2 into the lx and lY loops, but this is either making the map less defined, or making it 1/4 of the size depending on how you look at it.
You really are left with two options. 1) Make the map samller, 2) Use the normal terrain commands but with a higher Poly count, (Sort of less than the full mesh version, but more than normal)
And 3) (I suppose) up the min specs of your game.
When all said and done, the way to get less polies on any specific map, is not to use this function, but the original terrain
(Edit: Had another think, you could I suppose not make vertcies of a point, if all the points arround it where the same height.
That is if you had an island, all the surounding seabed level could be one polygon, rather than each square being one polygon.
Dont know if it would make it lots faster without a poly reducer, as at its simplest, you would still have the same number of polygons. And it would probably slowdown any terrain Physics engines, cos it would need to extrapolate the missing verticies for collitions
I would see if you can get the effect/look that you wanted by useing TerrainDetail terrain,detail_level, and upping detail_level before I started messing with solid Mesh terrains)
(If you are going to try, I would look for all the points at a certain height, And make meshes of each group that is distinct. Of the top of my head I couldnt say the simplest way to do this)