Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
function npc_spawner(pos, SPAWN_TYPE)
local MAX_NPC = 15
local count = table.getn(minetest.env:get_objects_inside_radius(pos, 50))
if count == nil then
count = 0
end
if count <= MAX_NPC then
minetest.env:add_entity({x=pos.x+math.random(-1,1),y=pos.y+math.random(2,3),z=pos.z+math.random(-1,1)}, SPAWN_TYPE)
end
end
Error
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
11:27:03: ERROR[main]: ========== ERROR FROM LUA ===========
11:27:03: ERROR[main]: ...minetest\bin\..\mods\mod_test\peaceful_npc/items.lua:4: attempt to index field 'env' (a nil value)
11:27:03: ERROR[main]: stack traceback:
11:27:03: ERROR[main]: ...minetest\bin\..\mods\mod_test\peaceful_npc/items.lua:4: in function 'npc_spawner'
11:27:03: ERROR[main]: ...minetest\bin\..\mods\mod_test\peaceful_npc/items.lua:53: in main chunk
11:27:03: ERROR[main]: [C]: in function 'dofile'
11:27:03: ERROR[main]: ...\minetest\bin\..\mods\mod_test\peaceful_npc\init.lua:6: in main chunk
11:27:03: ERROR[main]: =======END OF ERROR FROM LUA ========