map settings lua

Place to get help with not working mods / modding interface.
Post Reply
mohreb
Inserter
Inserter
Posts: 27
Joined: Mon Apr 21, 2014 8:57 am
Contact:

map settings lua

Post by mohreb »

hi all,
i was thinking of modifying map-settings.lua so the questions are:
1) is that the file needed to be modified for sandbox-type map behavior?
2) so i need to copy the file to : <mod-name>/prototypes/map-settings.lua then change whatever in it.
3) if i change to:
enemy_evolution=
{
enabled=true,
-- percentual increase in the evolve factor for every second (60 ticks)
time_factor = 0,
-- percentual increase in the evolve factor for every destroyed spawner
destroy_factor = 0.005,
-- percentual increase in the evolve factor for 1000 PU
pollution_factor = 0
},
does that mean (as i imagine) that spawner do not evolve until you begin to wipe out their bases? but you will still get attacks from them based on your pollution? (last time i played i got huge spawner because of the time factor (not sure if i had enough pollution to trigger, but let the play run for long times) i guess, i do not want to deactivate them completely as i like to have to make defenses but i want them to be more an annoyance then a threat. and i want them to evolve and get larger only when i feel like (and when i get out to take out their buddies), maybe i could even up the destroy_factor ... will see ...

Rahjital
Filter Inserter
Filter Inserter
Posts: 435
Joined: Thu May 29, 2014 10:44 am
Contact:

Re: map settings lua

Post by Rahjital »

Not sure what you mean by question 1. Could you elaborate a bit please?

As for questions 2 and 3, changing the map-settings.lua values by a mod has to be done a bit differently. Your mod needs to have a control.lua file next to its info.json file and it should contain the following:

Code: Select all

game.oninit( function()
	game.mapsettings.enemy_evolution.time_factor = 0
	game.mapsettings.enemy_evolution.pollution_factor = 0
	game.mapsettings.enemy_evolution.destroy_factor = 0.005
end)
Chances are you will be attacked by small biters even in the late game, so increasing the destroy_factor significantly will most likely be a good idea.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: map settings lua

Post by FreeER »

mohreb wrote:1) is that the file needed to be modified for sandbox-type map behavior?
I'm not certain what you mean here, but you can see exactly how the devs created the sandbox by opening the Factorio\data\base\scenarios\sandbox\control.lua file. other than require defines/story and the game.gettext variable the first thing you see is that in oninit (when the scenario is started/initialized) the devs get a reference to the player's character and, after checking that it did exist (with the if statement), they destroy it and then set the player's 'controller' to be 'god'. The rest of the file is for the 'story' content (saying it's the sandbox scenario, asking if you want a chest/tech and telling you to go build). Hopefully that helps answer that question :)

edit:
Rahjital wrote:Chances are you will be attacked by small biters even in the late game, so increasing the destroy_factor significantly will most likely be a good idea.
since it's a percentage increase I'd think it'd still go up fairly quickly once spawners started getting destroyed...but I could be wrong, it is a small percentage (larger than the other two but they also occur more often, especially the first) :lol:

mohreb
Inserter
Inserter
Posts: 27
Joined: Mon Apr 21, 2014 8:57 am
Contact:

Re: map settings lua

Post by mohreb »

Thank you, i will try that way.
[the 1) question was just to be sure that it is the right file for the Play/New Game option, and i do not modify for campaign/scenarios only ...]
EDIT: i doubled up the value, will see what it does, but i guess those modifications are hard to notice anyway ...

Post Reply

Return to “Modding help”