Page 1 of 1

Change force of all players items

Posted: Thu May 24, 2018 3:46 pm
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.

Re: Change force of all players items

Posted: Thu May 24, 2018 4:45 pm
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

Re: Change force of all players items

Posted: Fri May 25, 2018 11:01 am
by PeaceDealer
Thanks!