Kuantikum
Member
- Joined
- Jul 3, 2015
- Messages
- 219
- Solutions
- 1
- Reaction score
- 20
Hello guys,
Currently what this script does when the server starts is to create an item in a random position. Is it possible to create the same item in more random positions?
PS: I tryied to set something like add more lines this:
But the script takes the same random pos to all items:
Thx you!
Currently what this script does when the server starts is to create an item in a random position. Is it possible to create the same item in more random positions?
Lua:
local STARTUP = {}
STARTUP[#STARTUP + 1] = { -- Quest Stuff
action = function()
local fromPos = {x=3376, y=776, z=6}
local toPos = {x=3390, y=786, z=6}
local pos = {x=math.random(fromPos.x,toPos.x), y=math.random(fromPos.y,toPos.y), z=math.random(fromPos.z,toPos.z)}
addEvent(function()doCreateItem(25457, 1, pos)end, 1000)
end
}
function onStartup()
for _, cmd in pairs(STARTUP) do
if (cmd.msg) then
--print(">> " .. cmd.msg)
local x = os.clock()
cmd.action()
--print(string.format("> Done in %.2f seconds", os.clock() - x))
else
cmd.action()
end
end
table.clear(STARTUP)
STARTUP = nil
--print(">> All done on ".. os.date("%a %b %d %X %Y", os.time()))
return true
end
PS: I tryied to set something like add more lines this:
addEvent(function()doCreateItem(25457, 1, pos)end, 1000)
But the script takes the same random pos to all items:
Thx you!
Last edited: