"target=player.character" Fix?

Place to get help with not working mods / modding interface.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1456
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

"target=player.character" Fix?

Post by TheSAguy »

What's the fix for target=player.character, that will also be MP compatible?
Not finding it.

Here is my current code:

Code: Select all

	-- Detect killing a Unit spawner.
	if event.entity.type == "unit-spawner" and event.entity.force == game.forces.enemy then
		
	    for i = 1, #game.players, 1 do
			player = game.players[i]
         
			if player.connected and player.character.valid then
				player.surface.set_multi_command{command = {type=defines.command.attack, target=player.character, distraction=defines.distraction.by_enemy},unit_count = (20+math.floor(game.evolution_factor*100/#game.players)), unit_search_distance = 600}
			end
		end
	end
Image
Post Reply

Return to “Modding help”