Jump to content

Recommended Posts

Guys I need help with setting position of object follownig array of coordinates but including negative Z.  https://forums.bohemia.net/forums/topic/153382-shk_pos/ I found this but links are  broken and found this ;


_mystartpositions = [[0,0,0],[5234,7345,0]];
_rndstartposition = _mystartpositions call
object1 setpos _rndstartposition;


but code only place object on those two locations randomly. Eden placement radius is useless because it always place object on surface. I need this:


-moored naval mine to be randomly placed in specific area on the sea (could be marker) but also to randomize depth (z axis). For now, I only manage to place mine randomly X and Y but Z is always the same distance from the bottom so divers alsway know to dont search for mine between surface and bottom -40m. (40m is a chain of naval mine which is always placed on bottom.) - That is what I need! Z randomized axis so the mine could be on any depth between bottom and surface.


Thanks in advance







Edited by Nemanjic

Share this post

Link to post
Share on other sites

Tested now, but it is not random. It place mine on exact coords I put in code. Like this: 

mine1 setPosASL [(getPosASL player select 0) +5, (getPosASL player select 1) +1, (getPosASL player select 2) -40];

so mine is always 5 meters of player by X axis, 1 meter by Y and 40 meters beneth. Also if I put player (lets say anchor for mine position) randomly using knowing way for 2d random placement, it will spawn mine on the same depth as I put in code no matter where the player/anchor is, becouse the player is always on surface.

If this code can be randomized somehow? To make array from 1000,1000,0 to 2000,2000,-100 for example. And then game choose point in that array to place mine counting Z axis also. This way I will have 1000m3 space for random placement. 

This is for community everyday basis training and I have to set it manualy every time, and upload new mission every time when I change depth of mines they need to search for. Thats way I need randomization.

Share this post

Link to post
Share on other sites

Thanks for time sir. Testing now..

_rNumber = random 50;   -does this means that randomization will go from 0 to 50?


mine1 setPos [random 500, random 500, random -200];     -this works well but it only randomize position from 0 up to 500 by X, also 0 to 500 by Y and -200 to 0 by Z. How could I make it not to be from 0 because 0 is always left corner of map? @stanhope

-Or inside marker placed in exact area where divers whould look for mine but with Z random coord..


Share this post

Link to post
Share on other sites
1 hour ago, stanhope said:

Solved!! I put all tree values (min, mid, max) for every axis where minimum is from and maximum is up to coord! Thank you bro, this help a lot also helped learning! 


mine1 setPos [random [500, 550, 600] , random [500, 550, 600], random [-200,-100,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