Change force of all players items

Find multiplayer games.
Tools/scripts to run a dedicated server.
PeaceDealer
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Nov 06, 2016 1:00 pm
Contact:

Change force of all players items

Post by PeaceDealer »

Hi.

I've been playing on a map for a while, and wanting to start using forces.

Im on the "player" force myself, and created the force "team a". How can I move all my items onto this force?

Map is rather big, around 25 mb in savesize.
betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

Re: Change force of all players items

Post by betrok »

Code: Select all

for _, surface in pairs(game.surfaces) do
	for _, e in pairs(surface.find_entities_filtered{force = "player"}) do
		e.force = "team a"
	end
end
PeaceDealer
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Nov 06, 2016 1:00 pm
Contact:

Re: Change force of all players items

Post by PeaceDealer »

Thanks!
Post Reply

Return to “Multiplayer / Dedicated Server”