Page 1 of 1

How to create additional enemy bases?

Posted: Fri Feb 24, 2017 1:39 pm
by DJ_M1k3
Hello. I created the world but as a beginner I have set up a small number of enemy bases because I did not know that I need it to research .. now I can not research because there have little amount of enemies ... I just wanted to somehow reconfigure it :)

Re: Small amount of enemies

Posted: Fri Feb 24, 2017 2:02 pm
by darkfrei
This creates one respawner every 32x32 tiles:

Code: Select all

/c local surface = game.player.surface
for c in surface.get_chunks() do
	local position = surface.find_non_colliding_position("biter-spawner", {x=c.x*32+16, y=c.y*32+16}, 10, 3)
	if position and surface.is_chunk_generated(c) then
		surface.create_entity{name="biter-spawner", position=position}
	end
end

Re: How to create additional enemy bases?

Posted: Sun Feb 26, 2017 8:19 am
by DJ_M1k3
Thanks but i dont know anything about codes.. where do I put that code

Re: How to create additional enemy bases?

Posted: Sun Feb 26, 2017 11:17 am
by darkfrei
DJ_M1k3 wrote:Thanks but i dont know anything about codes.. where do I put that code
Open console, Ctrl+V this code, Enter.
Repeat.

You must create a lot of turrets everywhere. Before you enter this code, yeah.

Re: How to create additional enemy bases?

Posted: Sun Feb 26, 2017 3:01 pm
by DJ_M1k3
I tottaly destroyed my base :D Is there command that create it only 32 block around me not create it on the whole map? :D

Re: How to create additional enemy bases?

Posted: Sun Feb 26, 2017 5:10 pm
by darkfrei
DJ_M1k3 wrote:I tottaly destroyed my base :D Is there command that create it only 32 block around me not create it on the whole map? :D
This creates one respawner every 32x32 tiles, chances around 10:90
old code

Code: Select all

/c local surface = game.player.surface
for c in surface.get_chunks() do
  if (math.random(1,100) < 10) then
    local position = surface.find_non_colliding_position("biter-spawner", {x=c.x*32+16, y=c.y*32+16}, 10, 3)
    if position and surface.is_chunk_generated(c) then
      surface.create_entity{name="biter-spawner", position=position}
    end
  end
end

Re: How to create additional enemy bases?

Posted: Sun Mar 26, 2017 6:01 pm
by DJ_M1k3
It dont work... .D

Re: How to create additional enemy bases?

Posted: Sun Mar 26, 2017 9:33 pm
by darkfrei
DJ_M1k3 wrote:It dont work... .D
You must write it twice, but you get no achievements.

Re: How to create additional enemy bases?

Posted: Tue Mar 27, 2018 12:14 pm
by impetus maximus
does this still work? will this work for a world that has nests set to 'none'?

thanks

Re: How to create additional enemy bases?

Posted: Tue Mar 27, 2018 7:13 pm
by darkfrei
impetus maximus wrote:does this still work? will this work for a world that has nests set to 'none'?

thanks
Yes, try it twice (after the first you get some warning the your achievements will be disabled).

Re: How to create additional enemy bases?

Posted: Wed Mar 28, 2018 3:50 am
by impetus maximus
ok thanks. i tried it (entered twice) and it didn't seem to work for me.
the person i was trying to help on steam had success with the command.

thanks for the help.