Jump to content
Sign in to follow this  
RoryRothon

setPos & BIS_fnc_findSafePos loop?

Recommended Posts

An of you gurus out there know whether, and if so, how i could turn this into a loop for each player on the server rather than naming each element and referencing it?

Although this works, just wondering if there is a cleaner way of doing it?

 

_p1StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player1 setPos _p1StartPos;

_p2StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player2 setPos _p2StartPos;

_p3StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player3 setPos _p3StartPos;

_p4StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player4 setPos _p4StartPos;

_p5StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player5 setPos _p5StartPos;

_p6StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player6 setPos _p6StartPos;

_p7StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player7 setPos _p7StartPos;

_p8StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player8 setPos _p8StartPos;

_p9StartPos =[getMarkerpos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos;
player9 setPos _p9StartPos;

Regards

Share this post


Link to post
Share on other sites

Hello, this might work out for you

{_x setPos ([getMarkerPos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos)} forEach playableUnits;

 

  • Like 1

Share this post


Link to post
Share on other sites
35 minutes ago, Nikander said:

Hello, this might work out for you


{_x setPos ([getMarkerPos "Spawn", 1, 900, 3, 0, 45, 0] call BIS_fnc_findSafePos)} forEach playableUnits;

 

 

Worked like a charm, thanks Nikander!

Looks a lot neater too lol

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, RoryRothon said:

45


Max gradient of 45 is almost a vertical wall. If you want position with incline 45 degrees or less, max gradient will be about 1 not 45. You might as well use 0 instead of 45 to speed up the command as result would be almost identical only faster.

All explained here: https://community.bistudio.com/wiki/BIS_fnc_findSafePos

Share this post


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


Max gradient of 45 is almost a vertical wall. If you want position with incline 45 degrees or less, max gradient will be about 1 not 45. You might as well use 0 instead of 45 to speed up the command as result would be almost identical only faster.

All explained here: https://community.bistudio.com/wiki/BIS_fnc_findSafePos

 Yea i know, i was just playing and testing and never reset from 45 lol

Thanks for the heads up though :)

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  

×