Change map generation settings

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
TheRealBecks
Inserter
Inserter
Posts: 33
Joined: Sat Mar 26, 2016 3:47 pm
Contact:

Change map generation settings

Post by TheRealBecks »

Hi,

I totally misinterpreted a setting in the map generation setup: map type is 'island' - I'm stuck on ONE island...

I'm trying to set the the map generation settings with lua commands to 'normal' mode, but I don't get it working. When taking a look at the lui-api I don't get it working:

Code: Select all

/c game.map_settings.property_expression_names.elevation = "0_16-elevation"
I also tried to change the settings via scenario editor, but that's not working. I can change the settings from 'island' to 'normal', but the generation won't change. What do I need to do to change the map generator?

That's my map generation code:

Code: Select all

>>>eNpjYBBkcGIAgwZ7EOZgSc5PzFm9ahWQdwCIHRy4kvMLClKLdPOL
UpGFOZOLSlNSdfMzURWn5qXmVuomJRanwkwEm5pZlJ+HbgJrcUl+Hqp
ISVFqajGQ57B6lZYdSCN3aVFiXmZpLkgvxDCISgbGDU80Xja0yDGA8P
96BoX//0EYyHoA9MsDBig4AFQJFIMCZtnk/LySovwc3eLUkpLMvHSr3
PzM4pLSolSrpMzEYg4DPVMDENDFqSytKLWwNDUvudIqtzSnJLMgJzO1
CKjNCKyPMzUntSyxJDM/j9sg3tBcN7M4JzEvhTU5JzMtjYFBwRGIwWH
NyMg4Ewx22jNCHKbnwDgLReRAkgNUyhPG+IBbCmgkhDJBMscYDD4jMa
pF1rk/rCoBmgNVzuGAYEAkW0CSjIy9b7cu+H7sgh3jn5UfL/kmJdgzG
rqKvPtgtM4OKMkOso8JTqA6HBg5UMYDe6jUTXvGs2dA4I09IytIhwiI
cLAAEge8mRkYBfiArAU9QEJBBtknEIYIzEsf7REBATcPzR8qDowZQCa
jHMiGEyCCFRE4QJcxQpmRDhAJSYQsUKsRgmfnwJiC8NxJWCAehjEuIz
Hg+tFcbofkBTQRFaSA5wLZkwInXjDDHQEMQQTPYb4DFwMCfLBn+Ccf0
g4A02jbTQ==<<<
Thanks for your help!

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Change map generation settings

Post by Bilka »

You're looking for the map GEN settings, not the map settings. Furthermore, the map gen settings are a plain table so you have to write back the entire table to the map gen settings property:

Code: Select all

/c local mgs = game.player.surface.map_gen_settings
mgs.property_expression_names.elevation = "0_16-elevation"
game.player.surface.map_gen_settings = mgs
Note that that sets it to the 0.16 generator, which is not available in the vanilla map generator screen. Furthermore, note that already generated chunks are not affected by changing the map generation settings. You will have to delete the chunks. There are mods available on the mod portal that allow you to delete empty chunks, or you can use another console command: https://wiki.factorio.com/Console#Delete_chunks

If you want to avoid the console command, I can recommend https://mods.factorio.com/mod/ChangeMapSettings for changing the map gen settings.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheRealBecks
Inserter
Inserter
Posts: 33
Joined: Sat Mar 26, 2016 3:47 pm
Contact:

Re: Change map generation settings

Post by TheRealBecks »

I Bilka,

big thanks for your quick help, your mod is real great! :) But... when setting the map generation settings to default and generating more chunks, it's still all water all around:

Code: Select all

/c local radius=2150
game.player.force.chart(game.player.surface, {{game.player.position.x-radius, game.player.position.y-radius}, {game.player.position.x+radius, game.player.position.y+radius}})
I wanted to attach my savegame with 62.7 MB, but I get an error. So here's my savegame: https://nextcloud.exablau.de/s/CeDdCAigWjSWafL

Maybe I'm doing it totally wrong?

Bilka
Factorio Staff
Factorio Staff
Posts: 3129
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Change map generation settings

Post by Bilka »

That save doesn't have the generator changed to non-island. Furthermore, it looks like something generated the chunks around your island in a huge radius, so you will only get water until you go very far out:
Image

You can solve all of this with the console command to delete chunks (or by using a mod). This is the result of running the console command, if you run it after changing the generator, the black area will generate with the new elevation setting:
Image
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

TheRealBecks
Inserter
Inserter
Posts: 33
Joined: Sat Mar 26, 2016 3:47 pm
Contact:

Re: Change map generation settings

Post by TheRealBecks »

Wow, that did the trick!
1) Change the settings with your mod
2) Delete the chunks:

Code: Select all

/c local surface = game.player.surface;
game.player.force.cancel_charting(surface); 
local chunk_radius = 40;
for chunk in surface.get_chunks() do
  if (chunk.x < -chunk_radius or chunk.x > chunk_radius or chunk.y < -chunk_radius or chunk.y > chunk_radius) then
    surface.delete_chunk(chunk)
  end
end
3) Generate new map chunks:

Code: Select all

/c local radius=1500
game.player.force.chart(game.player.surface, {{game.player.position.x-radius, game.player.position.y-radius}, {game.player.position.x+radius, game.player.position.y+radius}})
Tomorrow I will take a look if there's a mod to delete the chunks, so the achievements will still work :)

Thanks a lot!

Post Reply

Return to “Gameplay Help”