[SOLVED] Edit starting inventory
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
[SOLVED] Edit starting inventory
Help, I've been trying to edit starting inventory.
Remove starter items on Freeplay and add new ones.
I tried pasting code from other discussions but nothing helped
Could anyone help me with code for Control.lua and any other necessary with code and files i need?
(also, if you could explain how it works, that would be great)
Thanks in advance
Remove starter items on Freeplay and add new ones.
I tried pasting code from other discussions but nothing helped
Could anyone help me with code for Control.lua and any other necessary with code and files i need?
(also, if you could explain how it works, that would be great)
Thanks in advance
Last edited by DannyDavidDJ on Mon May 27, 2024 7:43 am, edited 1 time in total.
Re: Edit starting inventory
Maybe you'd have more chance taking example on a mod that does something similar to what you want to achieve, one whose license allows taking example
As of now there is very little information you are giving that could help diagnose the problems
As of now there is very little information you are giving that could help diagnose the problems
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
Re: Edit starting inventory
I want to change players starting inventory when starting a new game.
I tried that.
There's something i'm doing wrong? Maybe i missed something?
I tried that.
No errors or anything, but it doesn't work.script.on_event(defines.events.on_player_created, function(event)
local player = game.players[event.player_index]
player.insert({name="iron-plate", count=800})
end)
There's something i'm doing wrong? Maybe i missed something?
Re: Edit starting inventory
I can't say for sure, but it seem you are not inserting item in the inventory as it's done in this mod :
https://github.com/brevven/CarStart/blo ... ontrol.lua
https://github.com/brevven/CarStart/blo ... ontrol.lua
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
Re: Edit starting inventory
It works! I've been trying for hours haha
Thank you so much!
One more thing, do you also know how to delete starting items? Factorio gives some stuff and i would like to get rid of them
Thank you so much!
One more thing, do you also know how to delete starting items? Factorio gives some stuff and i would like to get rid of them
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
Re: Edit starting inventory
Thank you so much!
although now, the script that delete items won't let me spawn with other items i want ^^;
although now, the script that delete items won't let me spawn with other items i want ^^;
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
Re: Edit starting inventory
SOLVED
If anyone need help with this, here's the code
it was that simple...
Thanks everyone for help!
If anyone need help with this, here's the code
it was that simple...
-- Clear the player inventory
local function clear_inv(e)
local player = game.players[e.player_index]
player.clear_items_inside()
player.insert{name = "car", count = 1}
end
-- Disable the crash site and skip cutscene
local function disable_crash()
-- If we're in freeplay, disable the crash site
if remote.interfaces["freeplay"] then
remote.call("freeplay", "set_disable_crashsite", true)
end
end
script.on_event(defines.events.on_player_created, clear_inv) -- on player created
script.on_init(disable_crash) -- on mod init
Thanks everyone for help!
Re: [SOLVED] Edit starting inventory
There's also a freeplay interface for setting the starting items if you want to use that.
You can check in base/scenarios/freeplay/freeplay.lua for how to call it.
You can check in base/scenarios/freeplay/freeplay.lua for how to call it.
Re: [SOLVED] Edit starting inventory
But this interface will only be available if the "Freeplay" scenario is used. You can get the active scenario by reading script.level.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
-
- Burner Inserter
- Posts: 9
- Joined: Sun May 26, 2024 4:33 pm
- Contact:
Re: [SOLVED] Edit starting inventory
It's fine, It's solved. But thanks for everything
-
- Burner Inserter
- Posts: 5
- Joined: Thu Jun 06, 2024 6:39 pm
- Contact: