Did that, pimped it.
@Hater
I remember that post well, it was where I got alot of ideas for the script. I had the idea from our mod leader smiley who basically set me the task (slave-driver)
and I got spinors oroginal script idea and adapted it.
@Spinor
It doesn't work for my, then again neither did general barrons script. Classifying cover for the whole island is far too taxing on the PC, remember every time you increase the dimensio0ns of the search box, the number of nearestobject calls increases EXPODENTIALLY hence you get a very high CPU drain. My script only did 5 or 6 calls, but they were well spaced out and seemed to return a piece of cover quite frequently. However the problem arose when I tried to use the array of cover created to move to cover. I basically had a setup like this (randomint is a function by general barron that will return a random integer between 2 given values)
_resultsofcalls = [call1obj, call2obj, call3obj etc .....]
_i = [0, ((count _resultsofcalls)-1)] call randomint
_unit setpos [getpos (_resultsofcalls select _i) select 0, getpos (_resultsofcalls select _i) select 1, 0]
But for some reason the getposcouldn't be called from the object in the array. That lead me to investigate whether u could call getpos off an object w/o a classname.
The ONLY command that would give me any feedback was 'hint format' .. e.g.
_resultsofcalls = [call1obj, call2obj, call3obj etc .....]
_i = [0, ((count _resultsofcalls)-1)] call randomint
hint format ["%1 %2", _resultsofcalls select _i, getpos (_resultsofcalls select _i) select 2]
This would return a height value, and yes, your script in theory should work. What really threw me was when I tried to use this value with the setpos command, No matter what I did the game engine wouldn't take the fix. I tried putting brackets everywhere, I even put the result into a string and then used the call command to try and get a numerical value returned. Nothing seemed to work.
Now, when I said that trees/bushes aren't objects, that wasn't my research but as I've already said some of the guys in work pointed that out to me (and they're smart so I took their word for it).
However you say they are objects, i find that hard to believe, they are part of the map, not the mission so they aren't actually objects. However since the defenition of object is a bit vague we might be talking about slightly different things. Like, you could argue the thle island is an object ... which in essence it is, just a very bit one, but calling getpos off the island wont work!!