Xeno Posted August 12, 2012 Share Posted August 12, 2012 How would I go about doing this? And also, I would like it so it only picks 10 randomly locations from the list to spawn them, is this possible? Link to comment
Castillo Posted August 13, 2012 Share Posted August 13, 2012 local locationsTable = { { 0, 0, 1 }, { 0, 0, 2 }, { 0, 0, 3 }, { 0, 0, 4 }, { 0, 0, 5 }, { 0, 0, 6 }, { 0, 0, 7 }, { 0, 0, 8 }, { 0, 0, 9 }, { 0, 0, 10 }, { 0, 0, 11 }, { 0, 0, 12 }, { 0, 0, 13 }, { 0, 0, 14 }, { 0, 0, 15 }, { 0, 0, 16 }, { 0, 0, 17 }, { 0, 0, 18 }, { 0, 0, 19 }, { 0, 0, 20 } } function getRandomLocations ( ) local found = { } for i = 1, 10 do table.insert ( found, locationsTable [ math.random ( #locationsTable ) ] ) end return found end for index, loc in ipairs ( getRandomLocations ( ) ) do local x, y, z = unpack ( loc ) -- Your pickup creating code here. end 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