Updating old mod

Place to get help with not working mods / modding interface.
Rydell
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Mar 06, 2016 8:15 pm
Contact:

Updating old mod

Post 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?
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Updating old mod

Post 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)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Post Reply

Return to “Modding help”