Enable Enemies Mid-Game

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
LtKronos
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 02, 2018 7:39 pm
Contact:

Enable Enemies Mid-Game

Post by LtKronos »

I have played a while now without enemies (No Enemy bases). But now i have a good running factory and i want to have enemies now. Is it possible to turn them on using the console?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Enable Enemies Mid-Game

Post by eradicator »

Code: Select all

/c 
local s = game.player.surface.map_gen_settings
s["enemy-base"] = {
  frequency = "normal",
  richness = "normal",
  size = "normal"}
game.player.surface.map_gen_settings = s
This will reenable the generation, so when you explore new sectores they will have enemies. If you play with mods that add new enemy spawners additional tweaks might be required.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

LtKronos
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 02, 2018 7:39 pm
Contact:

Re: Enable Enemies Mid-Game

Post by LtKronos »

Tank you for the answer!

I tried it but it did not worked for me. Maybe because of the mods i play with.
But is it possible to just spawn the biter nests manually an then wait till they expand?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Enable Enemies Mid-Game

Post by darkfrei »

Beware enemies!

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

LtKronos
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Nov 02, 2018 7:39 pm
Contact:

Re: Enable Enemies Mid-Game

Post by LtKronos »

Thanks, this one worked. But now i have enemies in every free position on the map :D. Including my base :/.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Enable Enemies Mid-Game

Post by darkfrei »

LtKronos wrote:
Sun Nov 04, 2018 12:50 pm
Thanks, this one worked. But now i have enemies in every free position on the map :D. Including my base :/.
Just kill them all, it's for balance of no-biters-on-start :D

Post Reply

Return to “Technical Help”