Jump to content

Recommended Posts

This is a random position generator/selector. It can choose a position from a marker area or by based on direction and distance from a position/object.

 

2021 update, reuploaded after billion years: https://drive.google.com/drive/folders/1XXrSZbu7nCaW2UkOVsaVbKmX0ZmfFUtg?usp=sharing

 

 

Arma 2 thread

Marker Based Selection

Required Parameters:
 0 String   Area marker's name.

Optional Parameters:
 1 Number              Water position. Default is only land positions allowed.
                         0   Find closest land. Search outwards 360 degrees (20 degree steps) and 20m steps.
                         1   Allow water positions.
                         2   Find only water positions.
 2 Array or String   One or multiple blacklist area markers which are excluded from the main marker area.
 3 Array, Number, Object or Vehicle Type         Force finding large enough empty position.
                         0   Max range from the selection position to look for empty space. Default is 200.
                         1   Vehicle or vehicle type to fit into an empty space.

                         Examples:
                           [...,[300,heli]]       Array with distance and vehicle object.
                           [...,350]              Only distance given
                           [...,(typeof heli)]    Only vehicle type given
                           [...,heli]             Only vehicle object given
 

Position Based Selection

Required Parameters:
 0 Object or Position  Anchor point from where the relative position is calculated from.
 1 Array or Number     Distance from anchor.

Optional Parameters:
 2 Array of Number     Direction from anchor. Default is random between 0 and 360.
 3 Number              Water position. Default is only land positions allowed.
                         0   Find closest land. Search outwards 360 degrees (20 degree steps) and 20m steps.
                         1   Allow water positions.
                         2   Find only water positions.
 4 Array               Road positions.
                         0  Number  Road position forcing. Default is 0.
                              0    Do not search for road positions.
                              1    Find closest road position. Return the generated random position if none found.
                              2    Find closest road position. Return empty array if none found.
                         1  Number   Road search range. Default is 200m.
 5 Array, Number, Object or Vehicle Type         Force finding large enough empty position.
                         0   Max range from the selection position to look for empty space. Default is 200.
                         1   Vehicle or vehicle type to fit into an empty space.

                         Examples:
                           [...,[300,heli]]       Array with distance and vehicle object.
                           [...,350]              Only distance given
                           [...,(typeof heli)]    Only vehicle type given
                           [...,heli]             Only vehicle object given

 

Usage

Preprocess the file in init.sqf:
 call compile preprocessfile "SHK_pos\shk_pos_init.sqf";

Actually getting the position:
 pos = [parameters] call SHK_pos;
 
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

anyway to ensure a selected position is safe to spawn a vehicle i.e. has enough space so it won't just explode or spawn through walls etc - have to admit I haven't actually tried to use this script yet but wondered if the functionality is there (or is at least easy to add)

Share this post


Link to post
Share on other sites

Is this any different than your A2 version? Is it just a thread in the A3 forums a people can find it?

Share this post


Link to post
Share on other sites
Is this any different than your A2 version? Is it just a thread in the A3 forums a people can find it?

They are essentially identical (I found one grammar correction in shk_pos_fnc_isblacklisted.sqf and one line break that was removed from shk_pos_init.sqf).

Share this post


Link to post
Share on other sites
Is this any different than your A2 version? Is it just a thread in the A3 forums a people can find it?

I was wondering the same thing (just too chicken to ask). - figured the A2 version worked pretty damn well anyway.

thanks Shuko

Share this post


Link to post
Share on other sites

Someone asked for a test mission. So, I made an A3 test mission, and new example images to fix the syntax error. Thus, this thread is here now.

---------- Post added at 08:59 AM ---------- Previous post was at 08:56 AM ----------

anyway to ensure a selected position is safe to spawn a vehicle i.e. has enough space so it won't just explode or spawn through walls etc - have to admit I haven't actually tried to use this script yet but wondered if the functionality is there (or is at least easy to add)

Unfortunately, no such feature, at the moment. However, I've used it for vehicles and at least A2 engine was quite good at placing them.

Edited by Shuko

Share this post


Link to post
Share on other sites

Ah, great stuff Shuko especially the fix on the example images.

Share this post


Link to post
Share on other sites

Version 0.22

Changed: Water parameter now takes a number instead of a boolean. Now it's possible to force search for positions in water only.

Number              Water position. Default is only land positions allowed.
 0   Find closest land. Search outwards 360 degrees (20 degree steps) and 20m steps.
 1   Allow water positions.
 2   Find only water positions.

Water positions only

Water positions only, from marker

Share this post


Link to post
Share on other sites
anyway to ensure a selected position is safe to spawn a vehicle i.e. has enough space so it won't just explode or spawn through walls etc - have to admit I haven't actually tried to use this script yet but wondered if the functionality is there (or is at least easy to add)

Version 0.23 uploaded.

New parameter to specify empty space requirement for a position.

Position with enough space for a vehicle

3 Array, Number, Object or Vehicle Type         Force finding large enough empty position.
                           0   Max range from the selection position to look for empty space. Default is 200.
                           1   Vehicle or vehicle type to fit into an empty space.

                           Examples:
                             [...,[300,heli]]       Array with distance and vehicle object.
                             [...,350]              Only distance given
                             [...,(typeof heli)]    Only vehicle type given
                             [...,heli]             Only vehicle object given

I know, it looks complicated. However, you can just give the script the vehicle you need space for. For, example:

_p = [anchor,[0,200],random 360,0,[][b],heli[/b]] call SHK_pos;

Disclaimer: The script uses BIS function "findEmptyPosition" and it's probably not 100% proof either. So, there could still be a chance to see exploding choppers. ;)

Share this post


Link to post
Share on other sites

Can i use this script to randomly place eos markers?How do i do that?

Thanks.

Edited by Grillob3

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Adding the ability to check for min empty space makes this script so crazy useful i cant express. thank you v much!

Share this post


Link to post
Share on other sites
Can i use this script to randomly place eos markers?How do i do that?

Thanks.

This is just an example. Make your own adjustments. It's just to show the idea how to do it.

init.sqf

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";

_pos1 = [anyObjectPlacedInEditor,300] call SHK_pos;

_markerName1 = createMarker ["markerName1",_pos1];
_markerName1 setMarkerShape "Ellipse";
_markerName1 setmarkerSize [100,100];
_markerName1 setMarkerAlpha 0;

[["markerName1"],[1,1],[1,1],[2,2],[1,0],[0,1,1],[1,0,250,WEST]] call EOS_Spawn;

Share this post


Link to post
Share on other sites
This is just an example. Make your own adjustments. It's just to show the idea how to do it.

init.sqf

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";

_pos1 = [anyObjectPlacedInEditor,300] call SHK_pos;

_markerName1 = createMarker ["markerName1",_pos1];
_markerName1 setMarkerShape "Ellipse";
_markerName1 setmarkerSize [100,100];
_markerName1 setMarkerAlpha 0;

[["markerName1"],[1,1],[1,1],[2,2],[1,0],[0,1,1],[1,0,250,WEST]] call EOS_Spawn;

Cool! thanks!

I do that for each marker?

Share this post


Link to post
Share on other sites
Cool! thanks!

I do that for each marker?

call compile preprocessfile "SHK_pos\shk_pos_init.sqf";

_pos1 = [anyObjectPlacedInEditor,300] call SHK_pos;
_markerName1 = createMarker ["markerName1",_pos1];
_markerName1 setMarkerShape "Ellipse";
_markerName1 setmarkerSize [100,100];
_markerName1 setMarkerAlpha 0;

_pos2 = [maybeAnotherObject,500] call SHK_pos;
_markerName2 = createMarker ["markerName2",_pos2];
_markerName2 setMarkerShape "Ellipse";
_markerName2 setmarkerSize [150,150];
_markerName2 setMarkerAlpha 0;

_pos3 = [anyObjectPlacedInEditor,200] call SHK_pos;
_markerName3 = createMarker ["markerName3",_pos3];
_markerName3 setMarkerShape "Ellipse";
_markerName3 setmarkerSize [200,200];
_markerName3 setMarkerAlpha 0;


[["markerName1","markerName2","markerName3"],[1,1],[1,1],[2,2],[1,0],[0,1,1],[1,0,250,WEST]] call EOS_Spawn;

And so on.

Share this post


Link to post
Share on other sites

Thanks!

Is there a way to use like houses or something instead of "anyObjectPlacedInEditor" to spawn the markers in the cities? so i could do this _pos1 = [housefromAltismap,0] call SHK_pos;

Edited by Grillob3

Share this post


Link to post
Share on other sites
Thanks!

Is there a way to use like houses or something instead of "anyObjectPlacedInEditor" to spawn the markers in the cities? so i could do this _pos1 = [housefromAltismap,0] call SHK_pos;

Object or position only. But you should be able to get the position of a house someway.

Share this post


Link to post
Share on other sites

Hi, i need some help. I use the lattest ARMA 3 dev build.

I try : _WAG_POS01 = [getmarkerpos _WAG_MARKER01,[100,250],random 360,0,[1,250],Armored] call SHK_pos;

and : _WAG_POS01 = [getmarkerpos _WAG_MARKER01,[100,250],random 360,0,[1,250],(typeof Armored)] call SHK_pos;

Result : Error Undefined variable in expression: armored

I have the same problem if i use heli and car, APC, MRAP.

Any idea?

Edited by fwouedd

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

×