Jump to content
Sign in to follow this  
railgun

Random task locations using CfgLocations areas (FlatArea, etc)

Recommended Posts

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

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

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

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 by smacker909
typeo

Share this post


Link to post
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×