Page 1 of 1

Revealing map at the start of the game.

Posted: Sat Apr 22, 2017 10:43 pm
by oLaudix
Over a year ago my HDD crashed and i lost all my custom mods for factorio. It made me mad and i left the game but now i want to get back and i want to recreate my custom mods. I know i had mod that revealed larger portion of the map at the start of the game. I know mods used to use similar commands to console commands but they were a little bit different. Now I found this on the wiki:

Code: Select all

/c local radius = 150; 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}})
and turned into this

Code: Select all

local function on_init()
	local radius = 550 
	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}})
end
and put it in control.lua file. It donest work though ... What do i need to change for it to work? Is it even still possible?

Re: Revealing map at the start of the game.

Posted: Sat Apr 22, 2017 11:01 pm
by DaveMcW

Code: Select all

script.on_init(function()
   local radius = 550
   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}})
end)

Re: Revealing map at the start of the game.

Posted: Sat Apr 22, 2017 11:13 pm
by oLaudix
When i used this i got

Code: Select all

attempt to index field 'player' (a nil value)
. When i used

Code: Select all

script.on_event(defines.events.on_player_created
and changed

Code: Select all

game.player
to

Code: Select all

game.players[event.player_index]
it started to work. Looks unelegant though -_-