Jump to content
doomnet

how to make an array with setPosATL & setDir positions for MP respawn ?

Recommended Posts

hello,

 

i have made some positions with setPosATL and setDir

this setPosATL [16559.8,21846.6,1.13549]; this setDir 271.228;

this setPosATL [16560.2,21848.7,1.10291]; this setDir 279.611;

this setPosATL [16556.1,21847.2,0.573884]; this setDir 3.74775;

this setPosATL [16556.8,21850.9,0.636226]; this setDir 268.757;

how to make an array to use in this code for random respawn positions ?

if (isServer) then {
_randomPos = [,,,,] call BIS_fnc_selectRandom;
player setPos (getPos _randomPos);
};

i found a lot of answers for making an array but not for multiple setPos and setDir positions in one array !

Share this post


Link to post
Share on other sites

How about this:

_randomPositions = [
[ [16559.8,21846.6,1.13549],  271.228     ],
[ [16560.2,21848.7,1.10291],  279.611    ],
[ [16556.1,21847.2,0.573884],  3.74775     ],
[ [16556.8,21850.9,0.636226],  268.757     ]
];

_randomPos = [_randomPositions] call BIS_fnc_selectRandom;
player setPos _randomPos select 0;
player setDir _randomPos select 1;
  • Like 1

Share this post


Link to post
Share on other sites

 

How about this:

_randomPositions = [
[ [16559.8,21846.6,1.13549],  271.228     ],
[ [16560.2,21848.7,1.10291],  279.611    ],
[ [16556.1,21847.2,0.573884],  3.74775     ],
[ [16556.8,21850.9,0.636226],  268.757     ]
];

_randomPos = [_randomPositions] call BIS_fnc_selectRandom;
player setPos _randomPos select 0;
player setDir _randomPos select 1;

how to apply this only on one side or on specific player ?

Share this post


Link to post
Share on other sites

is this correct ?

do i use this in init.sqf ?

if (side player == independent) then {
_randomPositions = [
[[16559.5,21869,8.14167],  211.178],
[[16557.9,21870.3,8.00261],  226.471],
[[16560.7,21875.2,12.7323],  126.837],
[[16562.4,21877.1,13.1157],  132.096],
[[16558,21869.8,12.16],  129.362],
[[16560.6,21871.6,12.6094],  218.145],
[[16562.5,21865.9,12.2693],  306.879],
[[16564.1,21867.7,12.6158],  304.886],
[[16566.7,21869.9,13.1771],  307.536],
[[16562.9,21865.3,14.8489],  302.497],
[[16560.5,21865.9,14.7376],   42.072],
[[16563.8,21871,18.1177],     216.84],
[[16563.2,21873.2,18.0566],  36.8008],
[[16564.6,21872,18.1652],  37.3877],
[[16561.6,21873.8,4.65903],  212.266],
[[16559.8,21846.6,1.13549],  271.228],
[[16560.2,21848.7,1.10291],  279.611],
[[16556.1,21847.2,0.573884],  3.74775],
[[16556.8,21850.9,0.636226],  268.757],
[[16551.1,21854.7,0.139358],  94.0942],
[[16558.2,21853,0.703919],  276.99],
[[16558.5,21856,0.755425],  276.752],
[[16539.1,21848.9,4.30646],  224.692],
[[16546.8,21838.7,4.16557],  232.731],
[[16534.3,21873.7,0.0507479],  137.697],
[[16541.9,21876.8,1.03384],  231.068],
[[16537.1,21869.9,0.310155],  53.8498],
[[16539.6,21867.7,0.562572],  54.9779],
[[16544.4,21873.9,1.22441],  234.522],
[[16544,21859.6,0.00121975],  209.127],
[[16547.7,21856.2,0.00130177],  219.739]
];
_randomPos = [_randomPositions] call BIS_fnc_selectRandom;
player setPos _randomPos select 0;
player setDir _randomPos select 1;
};

Share this post


Link to post
Share on other sites

I would use the initPlayerLocal.sqf or if you are doing respawns, place all in the onPlayerRespawn.sqf.

  • Like 1

Share this post


Link to post
Share on other sites

I would use the initPlayerLocal.sqf or if you are doing respawns, place all in the onPlayerRespawn.sqf.

yes i'm using onplayerRespawn.sqf pasted the script above but nothing happens on respawn, i think something is missing in this code above for player to respawn,

because what i understand from this code it just makes an array but no respawn function.

i tried making it a function then call it via description line in respawn module but doesn't work.

how can i use BIS respawn module to use positions array and select them randomly for respawn ?

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

×