3B00DG4MER Posted April 14, 2014 Share Posted April 14, 2014 Hello,Today I've made a Marker which Create Random,from table Can u fix this plz ?! mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375}, } mineplace = createMarker(mine_pos[1],mine_pos[2],mine_pos[3]) Link to comment
cheez3d Posted April 14, 2014 Share Posted April 14, 2014 local mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375} } local n = math.random(1,#mine_pos) local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3]) Link to comment
3B00DG4MER Posted April 14, 2014 Author Share Posted April 14, 2014 local mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375} } local n = math.random(1,#mine_pos) local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3]) Thanks it's working Link to comment
Vinctus Posted April 15, 2014 Share Posted April 15, 2014 Just addition, you can change 'math.random(1,#mine_pos)' to 'math.random(#mine_pos)', does the same thing Link to comment
Gtagasje Posted April 15, 2014 Share Posted April 15, 2014 If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one) mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375}, } mineplace = createMarker(unpack(minepos[math.random(#mine_pos)])) This will only work if you keep the arrays x, y, z coordinates only though. Link to comment
3B00DG4MER Posted April 16, 2014 Author Share Posted April 16, 2014 If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one) mine_pos = { {271.94140625, 1350.1923828125, 10.5859375}, {275.94140625, 1350.1923828125, 10.5859375}, } mineplace = createMarker(unpack(minepos[math.random(#mine_pos)])) This will only work if you keep the arrays x, y, z coordinates only though. Thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now