Jump to content
pappagoat

Issues with call BIS_fnc_randomPos;

Recommended Posts

Just recently some scrips I had that spawn a group in a random location have stopped working, when they worked before. 

 

The function used to call the location is call BIS_fnc_randomPos;

 

It has started kicking back this error:

 

if (_this I#IisEqualTypeArray {{}, 0, 0, 0, false}) e.....
Error isequaltypearray: Type String, expected Array
File A3\functions_f\Misc\fn_getArea.sqf [BIS_fnc_getArea], line 30

 

Share this post


Link to post
Share on other sites

@pappagoat, how do you call BIS_fnc_randomPos function?

call BIS_fnc_randomPos;

?

If so, try

[] call BIS_fnc_randomPos;

 

Share this post


Link to post
Share on other sites
39 minutes ago, pappagoat said:

File A3\functions_f\Misc\fn_getArea.sqf [BIS_fnc_getArea], line 30

 

There was a wrong code about using this with invalid parameters and i had done the same mistake as well.

 

Same thing in invade and annex

https://github.com/iamlegend23/invade-annex/search?q=bis_fnc_randomPos&unscoped_q=bis_fnc_randomPos

The "out" parameter is invalid.

 

Might be this the problem ?

Share this post


Link to post
Share on other sites

The thing is this used to work perfectly up until recently.

 

This is what I was using and had worked before:
_randomPos = [[[getPos player, (500)],[]],["water","out"]] call BIS_fnc_randomPos;

 

Maybe it should be more like this:

_randomPos = [[[position player, 500]],["water","out"]] call BIS_fnc_randomPos;

 

GF What was the solution around the "out" parameter?

 

  • Like 1

Share this post


Link to post
Share on other sites
10 minutes ago, GEORGE FLOROS GR said:

_pos = [[[position player, 500]],["water"]] call BIS_fnc_randomPos;

 

 

Aha we're back in business! Thanks!

  • Thanks 1

Share this post


Link to post
Share on other sites

 

 

5 hours ago, GEORGE FLOROS GR said:

_pos = [[[position player, 500]],["water"]] call BIS_fnc_randomPos;

 

I am using your missions script George and it is awesome but I was getting too many "residential" or "isflatEmpty" locations too close to water/objects/not flat positions. So when I used findSafePos it worked much better but got the error 90% of the time. If we could use findSafePos after each position is found it would get even better results I believe.

  • Like 1

Share this post


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

"residential" or "isflatEmpty" locations too close to water/objects/not flat positions.

 

The "GF_Missions_Pos_Residential" will give you actually the locations that have buildings.

https://community.bistudio.com/wiki/Location

 

You can set different parameters with "isflatEmpty" but there might be a problem to find the position , or there might not be at all due to the parameters.

https://community.bistudio.com/wiki/isFlatEmpty

I was checking these positions scripts with stratis , which is actually a difficult map , there are not that much or none flat positions !

The last parameter in "isflatEmpty" :

true    //    shoreLine (Optional): Boolean - true: position is over shoreline (< ~25 m from water). false to ignore. Default: false

will give you this ~25 m from water

 

So , when i was creating the GF Missions script , i had in mind to be able to play this in any map.

 

 

Maybe in order to remove the unwanted shore areas , we could blacklist every shore position

https://community.bistudio.com/wiki/BIS_fnc_findSafePos

 

blacklistPos (Optional): List of blacklisted areas in format [area1, area2, area3... areaN] (Default: []). Area could be one of:

Array - in format [topLeftCorner, bottomRightCorner] - top and bottom coordinates of blacklisted area

Object - trigger area

String - marker area

Location - location

Array - array in format [center, distance] or [center, [a, b, angle, rect]] or [center, [a, b, angle, rect, height]]

 

I think it could work like this.

 

So in conclusion it should be possible but then the positions will be significant less.

This will be finally the issue to get the same position all over in a small map.

In my opinion i like to play on the whole map - everywhere and not only in a city and this is actually why arma has this kind of terrain .

  • Thanks 1

Share this post


Link to post
Share on other sites
12 hours ago, GEORGE FLOROS GR said:

The "out" a is wrong parameter and it doesn't exist for this code .

It use to, there use to be several option for randomPos so you could get a position in or out side an area. Got cut back to what it is now some time ago 2013 ish.

  • Thanks 2

Share this post


Link to post
Share on other sites
6 hours ago, Larrow said:

some time ago 2013 ish.

 

# When i was searching for the solution , i noticed an old post that you wrote about the out parameter.

 

Is there a way , to set a certain distance from the water ?

Share this post


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

you could get a position in or out side an area

This is incorrect. Could only have "out" and "out" param could only be used as blacklist to avoid out of map position. But since default search area is map area in 99,99% it was waste of resources with unnecessary additional checks. Even reading this thread it is obvious people just copy paste code with very little idea what it actually does. BIS_fnc_randomPos is already a complicated function with lots of confusing options.

  • Like 2

Share this post


Link to post
Share on other sites

Next question.... how to make it so that there is a % chance of the rest of the script running or not? I tried the below but it is not working so far:

 

If {random 100 <= 20.00} then {

sleep 300;

_randompos = [[[position player, 750]],["water"]] call BIS_fnc_randomPos;
_NVAsf1 = [_randomPos, EAST, ["uns_men_NVA_daccong_SAP3","uns_men_NVA_daccong_AS4","uns_men_NVA_daccong_TRI","uns_men_NVA_daccong_MED","uns_men_NVA_daccong_AS1"], [], [], [0.4, 0.6], [], [0, 0]] call BIS_fnc_spawnGroup;
_NVAsf1 setSpeedMode "LIMITED"; _NVAsf1 setFormation "COLUMN"; _NVAsf1 setBehaviour "STEALTH";
_stalking = [_NVAsf1,rt,60,250] spawn BIS_fnc_stalk;

};

Share this post


Link to post
Share on other sites
8 minutes ago, pappagoat said:

it is not working so far

You have to wait 5 min before you know if it is working or not and there is 1 in 5 chance (doesn't mean it will happen on 5th try the latest BTW, could be 100 tries) it will work anyway, how many times you tried before you decided it was not working?

  • Haha 1

Share this post


Link to post
Share on other sites
59 minutes ago, killzone_kid said:

You have to wait 5 min before you know if it is working or not and there is 1 in 5 chance (doesn't mean it will happen on 5th try the latest BTW, could be 100 tries) it will work anyway, how many times you tried before you decided it was not working?

 

Thanks. I wrote it so know what it's meant to do....when testing I remove the sleep... and it kicks up an error message.

Share this post


Link to post
Share on other sites
2 hours ago, pappagoat said:

If {random 100 <= 20.00} then {

 

-is wrong :

If (random 100 <= 20) then { 

 

  • Haha 1

Share this post


Link to post
Share on other sites
55 minutes ago, HazJ said:

if (20 > random 100) then // BECAUSE SQF HAS THIS, WHY?! { };

 

floor (random 100) < 20

I 'm always using it like this , is it wrong ?

 

Share this post


Link to post
Share on other sites
10 hours ago, killzone_kid said:

This is incorrect. Could only have "out" and "out" param could only be used as blacklist to avoid out of map position.

Ah cool I was just going off of memory, it was 5 years ago. I deleted my extracted Arma delorean backup a couple of months ago, so didn't have that to go back and check on.

  • Haha 1

Share this post


Link to post
Share on other sites

A different thing but I'm having issue with the below. It looks correct to me... bu t is kicking back a boolean error mainly about the 2nd and 3rd lines... any ideas?:

 

FACaircraft = selectRandom (if (year in [1965, 1966) then {["sab_l19_3"];});
FACaircraft = selectRandom (if (year == 1967) && (month in [01, 02]) then {["sab_l19_3"];});
FACaircraft = selectRandom (if (year == 1967) && (month in [03, 04, 05, 06, 07, 08, 09, 10, 11, 12]) then {["sab_l19_3","UNS_skymaster_FAC"];});
FACaircraft = selectRandom (if (year == 1968) then {["sab_l19_3","UNS_skymaster_FAC"];});
FACaircraft = selectRandom (if (year == 1969) then {["UNS_skymaster_FAC","uns_ov10_usaf_FAC"];});

Share this post


Link to post
Share on other sites
On 1/30/2019 at 7:19 PM, pappagoat said:

It looks correct to me

You are wrong. In your code you use if-statement without alternatives. If condition is not met nothing returns to selectRandom, what is wrong. You can use alternatives (using else), but I recommend you use switch command.

Share this post


Link to post
Share on other sites
On 1/8/2019 at 3:07 PM, GEORGE FLOROS GR said:

 


floor (random 100) < 20

I 'm always using it like this , is it wrong ?

 

No problem with that. Floor is just useless.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 1/30/2019 at 4:58 PM, Schatten said:

You are wong. In your code you use if-statement without alternatives. If condition is not met nothing returns to selectRandom, what is wong. You can use alternatives (using else), but I recommend you use switch command.

 

Ah yeah I see now. Thank you.

Share this post


Link to post
Share on other sites

Gents,

 

New one I need some quick help. I have 4 transport helicopters that can be used in the mission and a trigger that should be activated by any of the helicopters that enters the trigger areas when the player is inside. 


I have the below for trigger conditions, but having trouble augmenting so that it also includes IF the player is also inside the helicopter.


this && ({ _x in thislist} count [veh1, veh2, veh3, veh4] > 0)

 

 

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

×