function getRandomPositionFrom(fromPosition, toPosition)
return {x = math.random(fromPosition.x, toPosition.x), y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z), stackpos = math.random(fromPosition.stackpos, toPosition.stackpos)}
end
You've got a point here, but I think that theese two scripts should be in this theard.awesome, but you shouldn't care about users who will use invalid positions, script should not hide errors in this case![]()
function postition(t)
--Why use stackpos ?
return (t.x ~= nil and t.y ~= nil and t.z ~= nil) and t or nil
end
function getRandomPositionFrom(fromPosition, toPosition)
local defaultPos = {x = 100, y = 100, z = 7}
return (postition(fromPosition) ~= nil and postition(toPosition) ~= nil) and {x = math.random(fromPosition.x, toPosition.x),y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)} or defaultPos
end
LUA:function postition(t) --Why use stackpos ? return (t.x ~= nil and t.y ~= nil and t.z ~= nil) and t or nil end function getRandomPositionFrom(fromPosition, toPosition) local defaultPos = {x = 100, y = 100, z = 7} return (postition(fromPosition) ~= nil and postition(toPosition) ~= nil) and {x = math.random(fromPosition.x, toPosition.x),y = math.random(fromPosition.y, toPosition.y), z = math.random(fromPosition.z, toPosition.z)} or defaultPos end
no one needs a random stackpos =S
why anyone could need a random stackpos ? =S to get a item from pos? will sure get a error if no item in tile