railgun 10 Posted February 25, 2013 Hi there! I'm not very good at programming ans scripting and stuff (don't have the mind for it :P) and while I've been able to circumvent that by hacking up other scripts and such in the past, I'm running into a wall here. The idea for the mission is thus: A Task will spawn, with a large (say, a kilometre) radius marker. Inside that area, I would like a FlatArea (or similar) to be selected randomly for a group of enemies to spawn on (in the context of the mission, it will be a scud launcher and escort). Once the scud is killed, the task will finish and the script would restart, thus spawning another task etc. I've looked at the code in Patrol Ops, but it's all a little over my head, so I was wondering if anyone would be able to hold my hand and walk me through how it would be achieved! Thanks for your time! Share this post Link to post Share on other sites
smacker909 3 Posted February 25, 2013 You could try this; waitUntil {!isNil 'bis_fnc_init'}; _flatLocs = nearestLocations [getMarkerPos "Marker1", ["FlatArea"], 1000]; _location = (_flatLocs call BIS_fnc_selectRandom); edit -- requires functions module Share this post Link to post Share on other sites
railgun 10 Posted February 26, 2013 Hey, thanks for your reply! My limited grasp on arma script tells me that looks promising, but I'm not entirely sure how I would implement that into the context I need? Should it be in it's own script (ie scudspawn.sqf). I gather I then use "_location" as the position for spawned units. Share this post Link to post Share on other sites
smacker909 3 Posted February 26, 2013 (edited) in your script, _location would become the random choice from the list (_flatLocs) of FlatArea's within 1000 around "Marker1". You could then spawn on 'getPos _location'. This assumes there are flatAreas within 1000 of the marker. If not, you'd have to expand the range or move the marker. Edited February 26, 2013 by smacker909 typeo Share this post Link to post Share on other sites
nimrod_z 8 Posted February 27, 2013 you could also use the "isFlatEmpty" command to make sure your object isnt set in a place where it now has a tree sticking thru it.. :) http://community.bistudio.com/wiki/isFlatEmpty Share this post Link to post Share on other sites
railgun 10 Posted February 27, 2013 Hi guys, thanks for your replies! I got the code smacker posted working pretty good (thankyou!), but it looks like I wasn't paying attention when I looked at the Locations on the map (Reshmaan), as there isn't very many FlatAreas at all! Nimrod, I took a look at isFlatEmpty, but the syntax for the parameters is a little confusing... Would you be able to give a relevant example? It just needs space for a Scud launcher, a few trucks and their infantry defences. Share this post Link to post Share on other sites
nimrod_z 8 Posted February 28, 2013 heres an example then just refer to wiki again to see what each one stands for. _location isFlatEmpty [0.5,0,0,4,0,false,player] http://community.bistudio.com/wiki/isFlatEmpty it basiclly check if area is clear, how much of a grade something should spawn on, and what objects to ignore. it can come in handy for random spawning.. Share this post Link to post Share on other sites