Hello
So I was wondering if it was possible to let people automatically spawn at different locations?
So instead of everyone spawning at the same place then have people be moving to like 1500 tiles away
Fx Player 1 spawns at : 1515
and player 2 will then spawn at 3015
Regards
MP Random Spawn Locations
Re: MP Random Spawn Locations
In map editor, make a custom scenario with 2 spawn points.
Re: MP Random Spawn Locations
That doesnt work :/
Atleast I dont find the Custom Scenario in the Multiplayer part :/
Atleast I dont find the Custom Scenario in the Multiplayer part :/
Re: MP Random Spawn Locations
Code: Select all
game.onevent(defines.events.onplayercreated,function(event)
local player = game.getplayer(event.playerindex)
local positionX = math.random(1000,1500)
local positionY = math.random(1000,1500)
local position = game.findnoncollidingposition("player", {positionX,positionY}, 50, 1)
if position ~= nil then player.teleport(position) end
end)
First browses position X and Y between 1000 and 1500, after browses a location where player can be teleport
EDIT: must use util.distance(pos1,pos2) to browse others players and spawn at Z of distance one to other one
Re: MP Random Spawn Locations
Gonna try that
Thanks man :p

Thanks man :p