Page 1 of 1

Problem with adding an item

Posted: Mon Jan 23, 2017 3:35 pm
by ShadowScaleFTL
Hi! Im trying to add in mod VersepellesHardStorage a new item - iron crate (so i dont want own mod, just change a bit some stuff), and im realy new in mod writing.

So i copy all code for wooden crate and make iron crate. So you can easely find it (mod is realy little)

But in game a have 2 wooden crates, one from mod and one with my recipe, but they both are wooden crate. So i want wooden with 30 inv.size and iron with 40.

I dont know why my code wont work properly. pls help.

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 3:59 pm
by kinnom
you also need textures/sprites for the iron crate

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 4:26 pm
by ShadowScaleFTL
kinnom wrote:you also need textures/sprites for the iron crate
i add them. Problem is not in sprites.

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 4:32 pm
by daniel34
In recipe.lua:

Code: Select all

  {
   type = "recipe",
   name = "iron-crate",
   enabled = "true",
   ingredients = 
    {
		{"iron-chest", 4},
		{"iron-plate", 10},
	},
	result = "wooden-crate",
	result_count = 1,
  },
The result should be "iron-crate".

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 4:48 pm
by ShadowScaleFTL
daniel34 wrote:In recipe.lua:

Code: Select all

  {
   type = "recipe",
   name = "iron-crate",
   enabled = "true",
   ingredients = 
    {
		{"iron-chest", 4},
		{"iron-plate", 10},
	},
	result = "wooden-crate",
	result_count = 1,
  },
The result should be "iron-crate".

now it looks like my crate in recipes, but gives wooden crate after craft...

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 4:56 pm
by daniel34
ShadowScaleFTL wrote:now it looks like my crate in recipes, but gives wooden crate after craft...
Are you sure? It works for me on a newly started map*. Maybe there's some other mod changing it somehow?

* after removing the "science-pack-4" from technologies.lua. If the mod uses items from another mod you should include that mod in the dependencies.

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 7:22 pm
by ShadowScaleFTL
daniel34 wrote:
ShadowScaleFTL wrote:now it looks like my crate in recipes, but gives wooden crate after craft...
Are you sure? It works for me on a newly started map*. Maybe there's some other mod changing it somehow?

* after removing the "science-pack-4" from technologies.lua. If the mod uses items from another mod you should include that mod in the dependencies.
thx a lot! It works fine in new game. It was a bug in savegame.

Re: Problem with adding an item

Posted: Mon Jan 23, 2017 7:33 pm
by daniel34
ShadowScaleFTL wrote:thx a lot! It works fine in new game. It was a bug in savegame.
I see now what the issue was. When changing recipes in a mod that already exists in a savegame you then have to call LuaForce.reset_recipes to load the changes (or change the version number of the mod, that would call reset_recipes automatically).