Page 1 of 1

[Solved] Error in assignID

Posted: Tue Jan 12, 2021 5:44 pm
by Gamker
I have started modding and I got an error (Error in assignID: item with name 'inserter2' does not exits.)
My code so far (item.lua):

Code: Select all

local inserter2 = table.deepcopy(data.raw["inserter"]["inserter"])

inserter2.name = "inserter2"
inserter2.icons = {
  {
    icon = inserter2.icon,
    tint = {r=1,g=0,b=0,a=0.3}
  },
}

local recipe = table.deepcopy(data.raw["recipe"]["inserter"])
recipe.enabled = true
recipe.name = "inserter2"
recipe.ingredients = {{"copper-plate",200},{"steel-plate",50}}
recipe.result = "inserter2"

data:extend{inserter2,recipe}

Re: Error in assignID

Posted: Tue Jan 12, 2021 5:56 pm
by ptx0
are you doing that in data stage?

Re: Error in assignID

Posted: Wed Jan 13, 2021 8:16 am
by Gamker
ptx0 wrote: Tue Jan 12, 2021 5:56 pm are you doing that in data stage?
No, it's in item.lua. It's the last bit that seems to not work (recepie.result= "inserter2").

Re: Error in assignID

Posted: Wed Jan 13, 2021 9:42 am
by PFQNiet
You have an entity and a recipe, but you need an item.

Re: Error in assignID

Posted: Wed Jan 13, 2021 3:19 pm
by Gamker
PFQNiet wrote: Wed Jan 13, 2021 9:42 am You have an entity and a recipe, but you need an item.
And how do I add an item(I'm a beginner at modding)?

Re: Error in assignID

Posted: Wed Jan 13, 2021 3:33 pm
by PFQNiet
Deepcopy data.raw.item.inserter and change its properties as needed.

Re: Error in assignID

Posted: Wed Jan 13, 2021 3:56 pm
by Gamker
PFQNiet wrote: Wed Jan 13, 2021 3:33 pm Deepcopy data.raw.item.inserter and change its properties as needed.
Ok I'll try that.

Re: Error in assignID

Posted: Wed Jan 13, 2021 4:05 pm
by Gamker
It helped a lot.

Re: Error in assignID

Posted: Thu Jan 14, 2021 7:58 am
by Gamker
I'm going to leave this thread open because I have no idea how to close it so if anyone knows plz tell me.

Re: Error in assignID

Posted: Thu Jan 14, 2021 11:09 am
by ickputzdirwech
Only moderators and admins can close topics. And it’s usually only done when a discussion derailed completely. What I do in a case like this is changing the topic title and adding “[Solved]” at the beginning of it. So people know that there is no further help needed and that there might be an answer in the topic if they have a similar issue.

Re: Error in assignID

Posted: Thu Jan 14, 2021 12:51 pm
by Gamker
Oh ok.