Help needed - Increase player inventory size by research

Place to get help with not working mods / modding interface.
Post Reply
Savi-
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jun 28, 2016 4:24 pm
Contact:

Help needed - Increase player inventory size by research

Post by Savi- »

Hello all

First time modder here. I want a mod that increases the players inventory size when you research a certain technology. So far I have managed to make the technology and icons and everything but I can't get the actual logic to work. Where/how should I do this part?

I've checked how other mods increase size and gone through the lua api and found this:

character_inventory_slots_bonus :: uint [RW] the number of additional inventory slots the character main inventory has. -- Info from the LUA api
inventory_size_bonus = 10 -- Used by armors / power armors to increase inventory size
data.raw["player"]["player"].inventory_size = 120 -- Used by LargerInventory mod to set size to 120 at game start.

I'm not sure where/how to use these though, the mod either crashes when researching it or crashes on startup even when I put these rows in the control.lua file or directly in the technology.lua file.


I have a control.lua that triggers on the research done:

Code: Select all


script.on_event(defines.events.on_research_finished, function(event) 
	local research = event.research
	local force = research.force
	local name = research.name

	if name == "larger-inventory-size-1" then
       --something here?
	end      
end
)


And the technology:

Code: Select all


{
    type = "technology",
    name="larger-inventory-size-1",
    icon = "__LargerInventoryResearch__/larger-inventory-size.png",
	icon_size = 128,
	effects =
		{
			{
				--Something here?
			}
		},
    unit =
    {
      count = 1,
      ingredients =
      {
        {"science-pack-1", 1}
      },
      time = 5
	},
	order="c-k-f-a",
},


Many thanks in advance for any help on how to solve this!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Help needed - Increase player inventory size by research

Post by Rseding91 »

You'd want one of these modifier types:

Code: Select all

"character-crafting-speed"
"character-mining-speed"
"character-running-speed"
"character-build-distance"
"character-item-drop-distance"
"character-reach-distance"
"character-resource-reach-distance"
"character-item-pickup-distance"
"character-loot-pickup-distance"
"character-inventory-slots-bonus"
"character-health-bonus"
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”