kibaBG 53 Posted November 16, 2023 I am trying to move respawn marker (called "respawn_east") on random position on the map. It does not move anywhere no matter what I try. private _rpos = [] call BIS_fnc_randomPos; _rpos = _rpos resize 1; "respawn_east" setMarkerPos _rpos; This does not work at all, no errors ... Share this post Link to post Share on other sites
Larrow 2821 Posted November 16, 2023 24 minutes ago, kibaBG said: private _rpos = [] call BIS_fnc_randomPos; // [ #, #, # ] _rpos = _rpos resize 1; // [ # ] although _rpos will be nil as resize does not return a value "respawn_east" setMarkerPos _rpos; // setMarkerPos nil Share this post Link to post Share on other sites
kibaBG 53 Posted November 16, 2023 But BIS_fnc_randomPos should return a random position using the whole map, right? I think I manage to complete what I wanted. Instead of a respawn marker I used respawn module named "respawn_east", it moves around the map without a problem. I place this in its init and player respawn on start. _rpos = [] call BIS_fnc_randomPos; this setPosATL _rpos; Why the same named marker does not move is a mystery. Share this post Link to post Share on other sites
Larrow 2821 Posted November 16, 2023 3 minutes ago, kibaBG said: But BIS_fnc_randomPos should return a random position using the whole map, right? Correct, thats why i wrote [ #, #, # ] position 3D, but you then resize the array to one indice so it would now be just [ # ], but you also overwrite _rpos with the return from resize but resize does not return anything so _rpos is nil. Share this post Link to post Share on other sites
kibaBG 53 Posted November 16, 2023 My "genius" idea was to resize the position array to only first two elements. Share this post Link to post Share on other sites
Larrow 2821 Posted November 16, 2023 Try these from the debug console... private _rpos = [] call BIS_fnc_randomPos; _rpos; //[ #, #, # ] private _rpos = [] call BIS_fnc_randomPos; _rpos resize 1; _rpos; // [ # ] private _rpos = [] call BIS_fnc_randomPos; _rpos = _rpos resize 1; isNil "_rpos"; // true 1 Share this post Link to post Share on other sites
kibaBG 53 Posted November 16, 2023 You are right, the correct should be private _rpos = [] call BIS_fnc_randomPos; _rpos resize 2; _rpos; It returns the position array in 2D format. If not you I would never guessed where is the error, thanks! Share this post Link to post Share on other sites