Posted 02 June 2016 - 09:39 AM
Probably not much use to the bigger servers, but for people who run small - medium servers where they would have periods of time where the server is empty.
So - Using the Admin Locator from Draconic Evolution - to teleport new players to random locations within 10,000 blocks of spawn - this can be laggy when teleporting them to a new area which has not been generated yet.
The solution for this is to pregen your world, however pregen itself is a laggy process, you cannot really play the game while it is on-going.
Note : For this script to work, you need to have ForgeEssentials installed.
Note - the getPlayers command borrowed from here
http://www.computerc...nates-and-more/
The idea of this script is to pregen while everyone is offline, but stop when a player joins, then to resume pregen when the server empties again.
Note - this is reliant on the pregen command from ForgeEssentials, as it has a nice pregen command that resumes where it left off etc.
Im sure it could be improved on.
Script works best as a startup command.
So - Using the Admin Locator from Draconic Evolution - to teleport new players to random locations within 10,000 blocks of spawn - this can be laggy when teleporting them to a new area which has not been generated yet.
The solution for this is to pregen your world, however pregen itself is a laggy process, you cannot really play the game while it is on-going.
Note : For this script to work, you need to have ForgeEssentials installed.
Note - the getPlayers command borrowed from here
http://www.computerc...nates-and-more/
function getPlayers(radius,x,y,z)
if x then x = "x="..x else x = "" end
if y then y = ",y="..y else y = "" end
if z then z = ",z="..z else z = "" end
local command = "0 @a"
if radius then
command = "0 @a["..x..y..z..(",r="..radius).."]"
end
local state,result = commands.xp(command)
local players = {}
for i = 1, #result do
table.insert(players,string.match(result[i],"Given 0 experience to (%w+)"))
end
return #players
end
local inProgress = false;
while true do
if getPlayers() == 0 then
if inProgress == false then
inProgress = true;
commands.say("Pregen starting!");
commands.exec("pregen start false 0");
end
else
if inProgress == true then
inProgress = false;
commands.say("Pregen Stopping as a player has joined");
commands.exec("pregen stop")
end
end
sleep(10)
end
The idea of this script is to pregen while everyone is offline, but stop when a player joins, then to resume pregen when the server empties again.
Note - this is reliant on the pregen command from ForgeEssentials, as it has a nice pregen command that resumes where it left off etc.
Im sure it could be improved on.
Script works best as a startup command.
Edited on 02 June 2016 - 07:40 AM