• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

On startup script 1.2

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
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
 
data/globalevents/startup.lua
after this part:
Lua:
function onStartup()
add:
Lua:
local chance = math.random(1, 100)
if chance <= 5 then Game.createItem(2160, 25, Position(1000, 1000, 7)) end
2160 id the ID
25 is the Count
(100, 100, 7) is a position

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
 
Last edited:
thanks so much ! i'll use

also is possible the item spawn inside a container id in a determinated position?
Change:
Lua:
local chance = math.random(1, 100)
if chance <= 5 then Game.createItem(2160, 25, Position(1000, 1000, 7)) end
To:
Lua:
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
 
Back
Top