Guest User

Untitled

a guest
Dec 24th, 2012
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use_mesecons = false
  2.  
  3. function npc_spawner(pos)
  4. 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)}, "peaceful_npc:npc")
  5.  
  6.     -- Count the number of times a value occurs in a table
  7.     function table_count(tt, item)
  8.       local count
  9.       count = 0
  10.       for ii,xx in pairs(tt) do
  11.         if item == xx then count = count + 1 end
  12.       end
  13.       return count
  14.     end
  15.  
  16. --[[    local count = minetest.env:get_objects_inside_radius(pos, 20)
  17.         local MAX_NPC = 3
  18.  
  19.         if count>MAX_NPC then
  20.                 action_off = 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)}, "peaceful_npc:npc")
  21.                 end
  22.         end]]--
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×