Haymaker 13 Posted November 21, 2016 So I'm working on an insurgency type mission, I'm not ready to reveal my code quite yet, but I'm trying to make it very complex and unpredictable. Right now with my system, I divide the map into 4 quadrants, each quadrant with a marker. Then, the script gets the position of those markers and creates a random amount of outposts in randoms locations within 3000m of the marker. Then a randomly sized squad with random units from a unit pool are spawned with a random patrol pattern at each flag. I like how things are working right now, and I'm ready to create new features (like caches, static weapons, garrisoned buildings, IED factories, random convoys, etc.), and even randomize the amount of groups to be spawned at each outpost, but before I do that, I want to refine the outpost spawning system. Things work okay right now, but I want flags to randomly spawn in respect to buildings. I still want outposts to spawn in random areas, even not by buildings, but I want buildings to become a factor and for these outposts to more likely spawn near them. So far things are pretty simplistic, I figure this will get rid of my pointless 4 quadrant system as well. I'd like to keep things as simplistic as possible. Thanks guys. Share this post Link to post Share on other sites
Rydygier 1298 Posted November 21, 2016 SelectBestPlaces is your best friend on such occasions. Share this post Link to post Share on other sites
Haymaker 13 Posted November 21, 2016 Original code for random output (or flag): // Set the marker to quadrant 1 _quadrantMarker = 'quadrant1'; // Randomize the relative position for the flag _position = (getMarkerPos _quadrantMarker) getpos [random 2000, random 2000]; // Spawn a flag in a location relative to quadrant 1 _spawn = _flag createVehicle _position; So something like: // Find position for flag _position = selectBestPlaces [position _quadrantMarker, 2000, "meadow + forest + houses + 2*hills", 1, 5]; // Spawn a flag in the location _spawn = _flag createVehicle _position; This can't be done in .sqf though, correct? isn't this a config? And won't this return an array? Wiki doesn't give much clarity. Share this post Link to post Share on other sites
Grumpy Old Man 3535 Posted November 21, 2016 Original code for random output (or flag): // Set the marker to quadrant 1 _quadrantMarker = 'quadrant1'; // Randomize the relative position for the flag _position = (getMarkerPos _quadrantMarker) getpos [random 2000, random 2000]; // Spawn a flag in a location relative to quadrant 1 _spawn = _flag createVehicle _position; So something like: // Find position for flag _position = selectBestPlaces [position _quadrantMarker, 2000, "meadow + forest + houses + 2*hills", 1, 5]; // Spawn a flag in the location _spawn = _flag createVehicle _position; This can't be done in .sqf though, correct? isn't this a config? And won't this return an array? Wiki doesn't give much clarity. Why would this be a config? Wiki not giving much clarity? Might wanna read it again then, since it also contains a link to a thread by glorious rübe explaining selectBestPlaces in detail. Cheers 1 Share this post Link to post Share on other sites
Haymaker 13 Posted November 21, 2016 Why would this be a config? Wiki not giving much clarity? Might wanna read it again then, since it also contains a link to a thread by glorious rübe explaining selectBestPlaces in detail. Cheers Good looks, your help is much appreciated! Share this post Link to post Share on other sites