Jump to content

Random points on the map


AMARANT

Recommended Posts

You can use this code, however the co-ordinates I have placed in 'theCoordinates' table are just imaginary, you will have to replace them with your own.

local theCoordinates =  
{  
    [1] = { a, b, c } 
    [2] = { d, e, f } 
    [3] = { g, h, i } 
    [4] = { j, k, l } 
} 
  
local lastCoordinate = nil 
function getRandomCoordinate( ) 
     
    local index = tonumber( math.random( 1, 4 ) ) 
    if ( index ~= lastCoordinate ) then 
         
        lastCoordinate = index 
         
        local x, y, z = unpack( theCoordinates[ index ] ) 
        return x, y, z 
    else 
        getRandomCoordinate( ) 
    end  
end 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...