Jump to content
Sign in to follow this  
igneous01

Most efficient way to generate random positions?

Recommended Posts

Im working on a mission generator script, but I would like some opinions on which methods I should use when searching for positions to spawn a mission in.

Im looking for positions along roads and buildings where group of soldiers would meet up and talk, or possibly patrol or fortify - Even some remote locations in forests occasionally.

The question is, whats the optimum way of achieving this? There are many different methods:

nearRoads

nearBuildings

selectbestplaces

isFlatEmpty

use markers and randomly select 1, even add priority values to them for difficult missions

any other commands I havn't thought of

In your opinion, what would be the easiest approach for finding random positions, but that are not so random that they are impractical? Two guys meeting in a village makes sense mission wise, but two guys meeting in some extremely dense forest or near the shoreline is not so much.

My attempts with selectBestPlaces has been ok, but the positions it finds are not exactly practical, I have also read the documentation about it (and the thread posted here, so I know how it works for the most part) but if anyone knows more tricks with the command, by all means share it with me.

Share this post


Link to post
Share on other sites

Hi,

Probably what would be better in this case would be using nearestLocations.

Here you can find all the location types available.

Example:

_mainTowns = nearestLocations [getPos player, ["NameCity","NameCityCapital"], 1000];

//_mainTowns contains all Capital, City locations found in 1000m radius

You can then use getPos to get the location position:

_pos = getPos _location;

_neo_

Share this post


Link to post
Share on other sites

Example:

_mainTowns = nearestLocations [getPos player, ["NameCity","NameCityCapital"], 1000];

//_mainTowns contains all Capital, City locations found in 1000m radius

You can then use getPos to get the location position:

_pos = getPos _location;

_neo_

How about increasing the radius? Then you would have more cities and then? how would one select a random one out of the list?

Share this post


Link to post
Share on other sites

While `nearestLocations` et al. might come in handy every now and then, the most valuable information you'll get from the world-config. So learn to read and process it. You get a list of all locations which you can filter and sort. And there might be other defined attributes to locations you might find interessting, such as a list of their neighbours and stuff.

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  

×