Jump to content

Recommended Posts

The empty space search is done by the command findEmptyPosition. If the search takes too long, reduce the range. Default range is 200, but even 50 might be too large in some areas.

Share this post


Link to post
Share on other sites
The empty space search is done by the command findEmptyPosition. If the search takes too long, reduce the range. Default range is 200, but even 50 might be too large in some areas.

Thanks! I will play with those settings.

Share this post


Link to post
Share on other sites

HI,

is there is a way to have a blacklisted marker, while using Position Based Selection?

Share this post


Link to post
Share on other sites
HI,

is there is a way to have a blacklisted marker, while using Position Based Selection?

Unfortunately, at the moment, not directly.

You can however make your own loop to search positions and with simple IF filter them out with function SHK_pos_fnc_isBlacklisted.

Parameters are rather straightforward:

_bool = [position,blackListMarker] call SHK_pos_fnc_isBlacklisted

There might be a built-in function in A3 to check it as well, but I haven't really kept track of this stuff in a long time.

Share this post


Link to post
Share on other sites

Superb script this, amazing work. Cheers for doing it.

 

This may be a stupid question but re the space for Vehicle part. Can it use any named object or does it have to be an actual vehicle?

 

e.g I spawn a big house somewhere in my init, call it house1 then search for a really big and flat empty space based on that to spawn a base composition for example?

_startT4Pos = [shkOne,[0,3500],random 360,0,[0],[500,house1]] call SHK_pos;

Also, as a beginner, this would really benefit from a more newby friendly and full examples for people to get the most out of it if anyone has the time. The ones in the mission are pretty advanced imho. Took me ages to get my head around it and I still dont think Im getting the best out it

 

I found this type of thing so helpful with EOS for example.

kfuBV1d.png

Share this post


Link to post
Share on other sites

Ok so i'm getting somewhere with spawning a house or 2 by using isFlatEmpty but it sends my PC mental for 30 seconds at the start of the mission looking for a spot and I could use a little help.

 

I'm assuming I've got the values a little out as I don't fully understand them (beginner!). AO is a 5k marker on the west of altis (quite hilly) heli is an empty Huron. house1 is a house of the same the comp im spawning.

call compile preprocessfile "SHK_pos\shk_pos_init.sqf"; 
_pos = ["AO", 0,                         //searches all over the 5k AO Marker, no water
              [],                        //[empty blacklist marrker array],
              [500,heli]] call SHK_pos;  //[finds a spot with 500m, of the pos that will fit a Churon?]

_startTask4Pos = _pos isFlatEmpty[5,     //Check new _pos is not with 5m of anything,
                                  1,     //not 100% sure what this does
                                  0.7,   //0.7 gradient, is that steep?
                                  5,     //not 100% sure what this does
                                  0,     //no water
                                  false, //no water
                                  house1]; //object around the same size as I want to find.
while {(count _startT4Pos) < 1} do { //Loop if it cant find a spot
_pos = ["AO", 0,[],[500,heli]] call SHK_pos;
_startTask4Pos = _pos isFlatEmpty[5, 1, 0.3, 40, 0, false, house1];
};

Any help greatly appreciated :)

 

Share this post


Link to post
Share on other sites

Hi all, I try to use road positions just te same code of the test mission; I changed the player with a marker but don't work, I'm doing something wrong?

 

this is the original code

[player,[0,300],random 360,0,[2,200]] call SHK_pos;

this is how I try, obviously I modify also the trigger on map

["mrkGreen_1",[0,300],random 360,0,[2,200]] call SHK_pos;

Share this post


Link to post
Share on other sites

If I'm remenbering it well, I think it needs an array of position as first parameter or an object:

So it should be:

[getmarkerpos "mrkgreen_1",[0,300],random 360,0,[2,200]] call SHK_pos;

Share this post


Link to post
Share on other sites

If I'm remenbering it well, I think it needs an array of position as first parameter or an object:

So it should be:

[getmarkerpos "mrkgreen_1",[0,300],random 360,0,[2,200]] call SHK_pos;

 

Man, you 100% right  :mellow: 

I need more treaning, thanks!

Share this post


Link to post
Share on other sites

 

Ok so i'm getting somewhere with spawning a house or 2 by using isFlatEmpty but it sends my PC mental for 30 seconds at the start of the mission looking for a spot and I could use a little help.

 

 

This script just uses the BIS function directly, not much you can do to affect the outcome. In every case, it is very CPU heavy search function, especially if used with large areas. I added the feature, because someone really wanted it. However, I don't really like it or think it's fail-proof.

Share this post


Link to post
Share on other sites

Shuko, the 'enough space for a vehicle' bit... I have a composition that is about 20 metres across, how can I use to find enough space for that?

Share this post


Link to post
Share on other sites

Shuko, the 'enough space for a vehicle' bit... I have a composition that is about 20 metres across, how can I use to find enough space for that?

 

Unfortunately the command findEmptyPosition does not accept size requirement in meters. Maybe you can find a vehicle that is big enough, and use it's type as the requirement.

Share this post


Link to post
Share on other sites

That's what I thought you'd say. :) Thank you.

 

If findemptyposition accepts things like buildings or large aircraft like a C130, then we're good. I'll do some tests and report back.

Share this post


Link to post
Share on other sites

Im using this to spawn tasks, im calling like this

_position = [player,[1000,1500],random 360] call SHK_pos;

It all works great except i find that it spawns a lot right on the waters edge, is there anyway to offset it somehow so that it keeps a certain distance from the water?

Share this post


Link to post
Share on other sites

Im using this to spawn tasks, im calling like this

_position = [player,[1000,1500],random 360] call SHK_pos;

It all works great except i find that it spawns a lot right on the waters edge, is there anyway to offset it somehow so that it keeps a certain distance from the water?

 

The script does not have an offset option in those cases. Basically, all the positions that are on the water's edge are usually positions which were originally in water and just moved to nearest land. One workaround is to be more careful/specific with the input parameters/input marker to manually avoid water.

  • Like 1

Share this post


Link to post
Share on other sites

I get this a lot as well. The way to improve it is as follows.

 

<psuedocode>

_drypos = _shkspos;
for "_z" from 0 to 359 step 45 do
{
_testpos = [_shkspos, 5, _z] call BIS_fnc_relpos;
if (surfaceiswater _testpos) then 
{
if (_z < 180) then {_newdir = _z + 180;
__drypos = [_shkspos, 5, _newdir];
if not (surfaceiswater _drypos) exitwith {};
};
};

Basically, from the shore position, look for a position that is definitely in the water, then take a position that is directly opposite to that. If that's dry, then assume it's better than where we started. It's not foolproof, but it almost always improves a position that is half dry to properly dry.

 

disclaimer: Typed on a worklaptop without access to game or usual coding tools, Code may be bollocks. Your home is at risk if you do not keep up repayments on a loan secured on it. Objects in the rearview mirror are closer than they appear. If in doubt, blame Rock-RKSL.

  • Like 1

Share this post


Link to post
Share on other sites

..... If in doubt, blame Rock-RKSL.

Yeah, people seem to like doing that alot.

  • Like 1

Share this post


Link to post
Share on other sites

Because the placement radius is broken in Eden i need to use this but having trouble at basic level..

 

I want use this option to spawn me and my group on a random position on a map http://shuko.kapsi.fi/arma3/scripts/SHK_pos/img/marker_water_not_ok_with_multiple_blacklist.jpg

 

Could someone show me an example of how to call this from the init

 

Edit: ok this kinda works but spreads my group all over the map:

call compile preprocessfilelinenumbers "shk_pos\shk_pos_init.sqf";
{ _x setpos ("spawn1" call SHK_pos) } foreach units six;

Edit2: Ok these below both work but i think the group does not spawn with player due to the above placement bug in the game so back to square one.

{
  if (faction _x == "IND_F") then {
    _p = "spawn1" call SHK_pos;
    _x setpos _p;
  };
} foreach units six;


{ _x setpos ("spawn1" call SHK_pos) } foreach units six;

Note that using getmarkerpos like this {_x setpos (getmarkerpos _spawn_pos)} foreach units six; works when using BIS_fnc_selectRandom with markers.

 

is it possible to somehow use getmarkerpos in the above calls?

Share this post


Link to post
Share on other sites

Ok so I have been using SHK_pos since ages and only now a persistent problem has arisen. I am using the following call line on a marker right in the middle of stratis to choose random spots on land throughout the map:

_rndPos = ["m1", [0,2000], random 360, 0, [0], 300] call SHK_pos;

But there is an error in the line 77 of shk_pos_getposmarker.sqf:

https://postimg.org/image/s59n09ljr/

 

Hey shuko any hints bro?? did the latest update break something?

Share this post


Link to post
Share on other sites
On 12/10/2016 at 6:03 PM, ArmaMan360 said:

Ok so I have been using SHK_pos since ages and only now a persistent problem has arisen. I am using the following call line on a marker right in the middle of stratis to choose random spots on land throughout the map:


_rndPos = ["m1", [0,2000], random 360, 0, [0], 300] call SHK_pos;

But there is an error in the line 77 of shk_pos_getposmarker.sqf:

https://postimg.org/image/s59n09ljr/

 

Hey shuko any hints bro?? did the latest update break something?

 

 

Looks like i have stumbled on the same issue.

 

Just trying one of the simple examples from the first post in this thread.

 

Using "_position = ["my_spawn_pos",[100,300],random 360] call SHK_pos;" where my_spawn_pos is a marker in the salt flats south of Sofia and at least a Kilometre from the coast but each time i run the code i get following error.

10:56:51 ALIVE Profile Handler - Register Profile [OPF_F-entity_49]
10:56:51 Error in expression < {
_exit = true;
};
};
};
} else { 

if !_water then {

if !(surfaceIsWater _pos>
10:56:51   Error position: <!_water then {

if !(surfaceIsWater _pos>
10:56:51   Error !: Type Array, expected Bool
10:56:51 File C:\Users\ic\Documents\Arma 3 - Other Profiles\Ian-C\missions\Quick%20and%20Dirty%202%20ALiVE%20One.Altis\shk_pos\shk_pos_getposmarker.sqf, line 77

Is there a fix for this or is the scrip broken now due to updates in Arma.

Share this post


Link to post
Share on other sites
On 10/12/2016 at 8:03 PM, ArmaMan360 said:

Hey shuko any hints bro?? did the latest update break something?

 

It seems you guys are trying to use the marker based search with the position/anchor based parameters.

 

The 2nd parameter in anchor based search is the wanted distance from the origin/anchor, while on the marker based search the 2nd parameter is the water position.

 

In other words, marker search wants a number 0, 1 or 2 and you are giving it an array (with the min/max distance).

Share this post


Link to post
Share on other sites

I am having a few issues with this and I cannot quite understand them. I have a rectangle marker down for a spawn area then another rectangle marker and 2 circle markers for blacklist as well. Now the circles are doing just fine with blacklisting but the rectangle is not. I used the marker function from your test mission to see where the positions were going but this was the result. 

Spoiler

48c14cab9f219f242474a50734fc02e3.jpg

 
 

 

The function I am using is this 

_pos = ["spawn_area",0,["spawn_blacklist_1","spawn_blacklist_2","spawn_blacklist_3"]] call SHK_pos;

The 2 circles being blacklist 2 and 3 then the darker rectangle being blacklist 1. 

I first thought it was just my markers being weird and really rough (Just really guessed where I want them) but after moving them around, the same thing happened. 

 

I went through and put some debugging code through the functions to see where it is going wrong and it is getting to about the isinrectangle function and saying that it is not in the blacklist rectangle. 

 

So I am basically stuck on what to do here. Is it because I am using both circle and rectangles or am I messing something up?

Edited by ace16huey

Share this post


Link to post
Share on other sites
9 hours ago, ace16huey said:

So I am basically stuck on what to do here. Is it because I am using both circle and rectangles or am I messing something up?

 

I actually reinstalled Arma just to check this out. ;)

 

c490fbb6f606425782a0e044881da949.png

 

Here's the test mission with those markers: https://www.dropbox.com/s/spdysewl5t0lydn/SHK_pos.Stratis.zip?dl=0

  • Like 2

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

×