function onStartup()
local chance = math.random(1, 100)
if chance <= 5 then Game.createItem(2160, 25, Position(1000, 1000, 7)) end
Hello, anyone here have a script for a item respawn in x,y,z area after server save? with a random chance 5% ?
thanks so much
Change:thanks so much ! i'll use
also is possible the item spawn inside a container id in a determinated position?
local chance = math.random(1, 100)
if chance <= 5 then Game.createItem(2160, 25, Position(1000, 1000, 7)) end
local chance = math.random(1, 100)
if chance <= 5 then Game.createItem(CONTAINER_ITEM_ID, 1, Position(1000, 1000, 7)):addItem(ITEM_ID, ITEM_COUNT) end
Yes.Is it possible to do it in a chest that is already on the map?
local chest = Tile(CHEST_POS):getItemById(CHEST_ID)
if chest then
chest:addItem(ITEM_ID, COUNT)
end