Jump to content
Sign in to follow this  
oktyabr

Fast way to place marker in random wilderness position?

Recommended Posts

Still baffled by this one. I'm trying to script together a set of tasks that require placement in the *wilderness*, to be defined as any random location not in the water and a _mindist minimum distance from any buildings or roads. It's the roads part I'm struggling with. I've looked at the shk_pos thread for a solution (and posted there) but it still eludes me. Something like selectBestPlaces will use "houses" as a calculation modifier but I can't seem to find anything similar with road segments?

I can use the center of the map (preferable) or any sort of whitelist/blacklist marker arrangement... The real challenge seems to not only to find the roads, then find a spot a _mindist away from any of them, but also to do it efficiently so it doesn't grind the whole mission down while it tries to find such a location. I could use a predefined array of such locations I find myself but would really like a truly random system for replayability, etc. Currently I'm considering using quite large marker areas that I know do not have any buildings or roads but I think this is a stop gap measure as eventually, as my mission evolves, I'd also like to be able to make the wilderness position oriented from a particular location (task complete, village center, building, etc.) as well.

Any ideas or suggestions would be much appreciated!

Share this post


Link to post
Share on other sites

This would be rather easy to set up, you need to fiddle with the values but it will work.

https://community.bistudio.com/wiki/selectBestPlaces to check for any buildings

https://community.bistudio.com/wiki/nearRoads to get the nearest road from an input position, you can use it to check the distance to the road

Share this post


Link to post
Share on other sites
This would be rather easy to set up, you need to fiddle with the values but it will work.

https://community.bistudio.com/wiki/selectBestPlaces to check for any buildings

https://community.bistudio.com/wiki/nearRoads to get the nearest road from an input position, you can use it to check the distance to the road

Thanks Grumpy. I'll have to revisit those again.

If I was to try and rephrase my desired outcome it would be to pick a village/cluster of buildings (already have markers for such for other purposes that might be re-used) and then find a random location between 500-1500m away from that markers center that does not contain any buildings or roads, and does not have any roads or buildings closer than 500m.

Still trying to wrap my head around the fastest way to do this:

If I use selectBestPlaces to detect for buildings in a 500m radius is there a way to stop the search after it finds one building (and then either adjust marker position away from building or pick a new location entirely) rather than wait for it to find any and all buildings?

Edited by Oktyabr

Share this post


Link to post
Share on other sites

If you already know the location of the town you can use that to use the selectBestplaces command.

You can adjust the amount of results with the sourcescount parameter.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×