Page 1 of 1

Updating old mod

Posted: Sun Mar 06, 2016 8:32 pm
by Rydell
There was a mod called Quick Start which is now outdated/broken. It basically gave you some items and research upon generating the map that let you skip the very early portion involving manual mining and burner inserters. I'm trying to update the mod for my own use and I really don't know how to mod so I'm having some trouble.

I've tried updating the code and I am left with this. I've trimmed it down to show just the basics of what I am having issues with.

Code: Select all

   if remote.interfaces.freeplay then
    script.on_init(function()
    	
    	game.player.character.insert{name="basic-transport-belt", count = 128}
    	
    end)
    end


I get an error trying to generate "Map doesn't contain 1 player, this function can't be used". I know local_player is only meant for console commands and players[1] is for multiplayer, what am I doing wrong?

Re: Updating old mod

Posted: Sun Mar 06, 2016 8:38 pm
by prg
This could now be done in on_player_created with something like

Code: Select all

script.on_event(defines.events.on_player_created, function(event)
    game.get_player(event.player_index).insert{name="basic-transport-belt", count = 128}
end)