Page 1 of 1
Start in various fields Multiplayer
Posted: Fri Dec 11, 2015 9:44 am
by maisel16
Hello guys,
i play this game in the most time Multiplayer.
What i want ist more Start Options. And friend is in game a Enemy not friendly in Coop Mode set up self a own factory. The Laser tower shoot him and enemy tower shoots to me.
Sorry for my bad english.
With best regards
Maisel16
Re: Start in various fields Multiplayer
Posted: Fri Dec 11, 2015 11:15 am
by ratchetfreak
maisel16 wrote:Hello guys,
i play this game in the most time Multiplayer.
What i want ist more Start Options. And friend is in game a Enemy not friendly in Coop Mode set up self a own factory. The Laser tower shoot him and enemy tower shoots to me.
Sorry for my bad english.
With best regards
Maisel16
a per force spawn point you mean?
seems like this should be modable
turns out it is:
https://forums.factorio.com/wiki/inde ... n_position
the following will set your force's spawn position to your current location
Code: Select all
/c game.local_player.force.set_spawn_position(game.local_player.position, game.local_player.surface);
Re: Start in various fields Multiplayer
Posted: Fri Dec 11, 2015 4:55 pm
by ssilk
Moved from Suggestions to Gameplay Help, cause I don't see this as suggestion (there is nothing specific suggested).
Re: Start in various fields Multiplayer
Posted: Fri Dec 11, 2015 6:56 pm
by MrDoomah
For an arbitrary number of players, this code will create spawnpoint on a 1000 diameter (500 range) circle evenly spread apart for every player in its own force. We used this for our 3 player "space race" type of game.
First you run this: (you can just open the lua console and write /c and then paste this code as it stands here (you can ignore all the spaces)
Code: Select all
game.peaceful_mode = true
r = 500
n_forces = 1
for index,player in pairs(game.players) do
if index > 1 then
local force = game.create_force(player.name)
player.force = force
n_forces = n_forces +1
end
end
n = 0
for name,force in pairs(game.forces) do
if name ~= "neutral" and name ~= "enemy" then
local x = r * math.cos(n*2*math.pi/n_forces)
local y = r * math.sin(n*2*math.pi/n_forces)
force.set_spawn_position({x,y}, force.players[1].surface)
for _,player in pairs(force.players) do
player.teleport({x,y})
end
force.clear_chart()
n = n +1
end
end
You can paste this code into a text editor (notepad, word whatever) and edit the value for r to alter the distance between spawns.
Then after everyone is spawned and the map has generated (takes about 20 seconds) use this command:
Code: Select all
r = 100
for _,player in pairs(game.players) do
local enemies = player.surface.find_entities_filtered{area={{player.position.x-r,player.position.y-r},{player.position.x+r,player.position.y+r}}, force = "enemy"}
for _,enemy in pairs(enemies) do
enemy.destroy()
end
end
game.peaceful_mode = false
again, console /c and paste this code, and alter the value for r for the size of the starting area.
You might find one or more players spawning on water, but in our case it only took 2 restarts before we found a useful map.
Re: Start in various fields Multiplayer
Posted: Thu May 25, 2017 12:24 pm
by l4m3r
maybe this code wont work with 0.16?