Revealing map at the start of the game.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Revealing map at the start of the game.

Post 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?
Image

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Revealing map at the start of the game.

Post 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)

User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: Revealing map at the start of the game.

Post 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 -_-
Image

Post Reply

Return to “Modding help”