05-22-2015, 01:36 AM 
		
	
	
		I'm open to everything, but one thing I'll do for sure is acid rain (it's not a natural disaster but I want to do it)
	
	
	
	
	
| 
					Lua Challenge: the Catastrophes plugin
				 | 
| 
		
		
		05-22-2015, 01:36 AM 
		
	 
		I'm open to everything, but one thing I'll do for sure is acid rain (it's not a natural disaster but I want to do it)
	 
		
		
		05-22-2015, 02:34 AM 
		
	 
		One question: When using ForEachPlayer, what players are looped first? Is it random? If it isnt, anyway to choose a random player fastly and easily? Also, is there anyway to get a random x, y, z in a loaded chunk without loading it? (Only random between loaded chunks) 
		
		
		05-22-2015, 02:46 AM 
		
	 
		I'm guessing it's in the order the player's joined. What you can do is get the number of players, create a random number between 0 and that number, and then take player <nr> from that number. 
-- NumPlayers is for example 10
local RandomPlayer = math.random(NumPlayers)
local CurrentPlayer = 0
World:ForEachPlayer(
   function()
      CurrentPlayer = CurrentPlayer + 1
      if (CurrentPlayer == RandomPlayer) then
         --- Do things
         return true -- we did what we wanted with the player
      end
   end
)
Get a random x, y, z in a loaded chunk without loading it? Whut? Assuming you meant unloaded chunk. Can't you just use: local X = math.random(15) local Y = math.random(255) local Z = math.random(15) Thanks given by: tonibm19
		 
		
		
		05-22-2015, 04:26 AM 
		
	 
		
		
		05-22-2015, 04:28 AM 
		
	 
		The only method that might work is cWorld:TryGetHeight. With that you can check if a chunk is loaded.
	 
		I suppose it's kinda working: ![[Image: fd1318402c.jpg]](http://puu.sh/hVF2N/fd1318402c.jpg) TOO MUCH! ![[Image: 93d2f7d0f0.jpg]](http://puu.sh/hVFpP/93d2f7d0f0.jpg)  Thanks given by: tonibm19
		 
		
		
		05-22-2015, 06:56 AM 
		
	 
		There's currently no cWorld:ForEachChunk() API function which would help you, but it shouldn't be too difficult to add it.
	 Thanks given by: Serial
		 
		Apache License 2.0 is allowed right?
	 
		
		
		05-23-2015, 02:58 AM 
		
	 
		That moment when you realize you are really cruel for the villagers: ![[Image: e1f05996dc.jpg]](http://puu.sh/hWzGn/e1f05996dc.jpg) It really killed the performance though: ![[Image: 7576860bde.png]](http://puu.sh/hWzJU/7576860bde.png) I'll have to randomize it, but it looks less good if I do that  Btw, I had had a question about the license above here   Thanks given by: Serial
		 
		
		
		05-23-2015, 04:52 AM 
		
	 
		So, we need luajit!    | 
| 
					« Next Oldest | Next Newest »
				 |