Two problems with amod - Error assignID and foldername

Place to get help with not working mods / modding interface.
gacek
Inserter
Inserter
Posts: 22
Joined: Tue Mar 31, 2015 5:02 pm
Contact:

Two problems with amod - Error assignID and foldername

Post by gacek »

Hello,

I'm writing a small mod, im new to writing game mods.

I have 2 problems, one I "partially" solved. Game requrires me to make mod folder name: modname_0.1.1 instead of modname. I renamed it to such, but that's not what tutorial says.

Another problem is when I try to define Entity. I get error: Error in assignID 'mygenerator' was not recognized id of entity.

Part of code, that does not let me run game:

Code: Select all

    type = "generator",
    name = "mygenerator",
    icon = "__windenergy__/graphics/generator_icon.png",
    flags = {"placeable-neutral","player-creation"},
    minable = {mining_time = 1, result = "mygenerator"},
    max_health = 300,...
Natha
Fast Inserter
Fast Inserter
Posts: 201
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by Natha »

Game requrires me to make mod folder name: modname_0.1.1 instead of modname. I renamed it to such, but that's not what tutorial says.
what is right, what the game says or a tutorial (that maybe can be outdated).

The other problem: you have to look that your recipe-results, item-place-results and so on have a valid id.
gacek
Inserter
Inserter
Posts: 22
Joined: Tue Mar 31, 2015 5:02 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by gacek »

But this is ID I defined, or ID from game core? As tutorial said, I need to keep same ID (assume thats name: 'mygenerator') in recipe, entity and item.

Require order is:

Code: Select all

require("prototypes.item")
require("prototypes.recipe")
require("prototypes.entity")
All those have same name set. also placeresult and result values are all same across all files.

Code: Select all

data:extend({

 {
    type = "item",
    name = "mygenerator",
    icon = "__mygenerator__/graphics/sprite_icon.png",
    flags = { "goes-to-quickbar" },
    subgroup = "energy",
    place_result="mygenerator",
    stack_size= 1,
  }
})

Code: Select all

data:extend({
    type = "recipe",
    name = "mygenerator",
    enabled = "true",
    ingredients = 
    {
      {"iron-plate",5}
    },
    result = "mygenerator"
})

Code: Select all

data:extend({
    type = "solar-panel",
    name = "mygenerator",
    icon = "__mygenerator__/graphics/sprite_icon.png",
    flags = {"placeable-neutral","player-creation"},
    minable = {mining_time = 1, result = "windturbine"},
    max_health = 300,
    corpse = "big-remnants",
    dying_explosion = "huge-explosion",
    effectivity = 1,
    fluid_usage_per_tick = 0.1,
    resistances =
    {
      {
        type = "fire",
        percent = 70
      }
    },
    collision_box = {{-1.35, -2.35}, {1.35, 2.35}},
    selection_box = {{-1.5, -2.5}, {1.5, 2.5}},
    fluid_box =
    {
      base_area = 1,
      pipe_covers = pipecoverspictures(),
      pipe_connections =
      {
        { position = {0, 3} },
        { position = {0, -3} },
      },
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-output"
    },
    horizontal_animation =
    {
      filename = "__mygenerator__/graphics/sprite.png",
      width = 128,
      height = 128,
      frame_count = 6,
      line_length = 8,
      shift = {1.34, -0.06}
    },
    vertical_animation =
    {
      filename = "__mygenerator__/graphics/sprite.png",
      width = 128,
      height = 128,
      frame_count = 6,
      line_length = 8,
      shift = {0.812, 0.031}
    },
    smoke =
    {
      {
        name = "smoke",
        north_position = {0, -2.2},
        east_position = {-1.9, -1.6},
        deviation = {0.2, 0.2},
        frequency = 2 / 31,
        starting_vertical_speed = 0.05
      }
    }
})
FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by FishSandwich »

Well, you are missing opening and closing {}'s, and commas.

Code: Select all

data:extend({

    {
    type = "recipe",
    name = "mygenerator",
    enabled = "true",
    ingredients = 
    {
      {"iron-plate",5},
    },
    result = "mygenerator",
   }

})

Code: Select all

data:extend({

    {
    type = "solar-panel",
    name = "mygenerator",
    icon = "__mygenerator__/graphics/sprite_icon.png",
    flags = {"placeable-neutral","player-creation"},
    minable = {mining_time = 1, result = "windturbine"},
    max_health = 300,
    corpse = "big-remnants",
    dying_explosion = "huge-explosion",
    effectivity = 1,
    fluid_usage_per_tick = 0.1,
    resistances =
    {
      {
        type = "fire",
        percent = 70,
      },
    },
    collision_box = {{-1.35, -2.35}, {1.35, 2.35}},
    selection_box = {{-1.5, -2.5}, {1.5, 2.5}},
    fluid_box =
    {
      base_area = 1,
      pipe_covers = pipecoverspictures(),
      pipe_connections =
      {
        { position = {0, 3} },
        { position = {0, -3} },
      },
    },
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-output",
    },
    horizontal_animation =
    {
      filename = "__mygenerator__/graphics/sprite.png",
      width = 128,
      height = 128,
      frame_count = 6,
      line_length = 8,
      shift = {1.34, -0.06},
    },
    vertical_animation =
    {
      filename = "__mygenerator__/graphics/sprite.png",
      width = 128,
      height = 128,
      frame_count = 6,
      line_length = 8,
      shift = {0.812, 0.031},
    },
    smoke =
    {
      {
        name = "smoke",
        north_position = {0, -2.2},
        east_position = {-1.9, -1.6},
        deviation = {0.2, 0.2},
        frequency = 2 / 31,
        starting_vertical_speed = 0.05,
      },
    }
})
But after that there are more problems to fix(picture is missing for solar-panel). you can take a look in the game's data/base/prototypes folder for examples on how the lua code is meant to be laid out.
gacek
Inserter
Inserter
Posts: 22
Joined: Tue Mar 31, 2015 5:02 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by gacek »

Thank you. Gonna review it. After looking at code I also see sometimes its data.extend({..}) and sometimes data.extend({{...}}). Maybe it does not parse well and thats what it cant find ID.
gacek
Inserter
Inserter
Posts: 22
Joined: Tue Mar 31, 2015 5:02 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by gacek »

Yes, you were right! Since one of items was only in {} not in {{}}. Didn't notice it had to be in subarray of array (or object of objects. Not sure how it is in LUA).
gacek
Inserter
Inserter
Posts: 22
Joined: Tue Mar 31, 2015 5:02 pm
Contact:

Re: Two problems with amod - Error assignID and foldername

Post by gacek »

Got one more question. Each entity has a type. My test type is solar-panel. Solar panel does not have animations. Can solar Panel have animations, or I need to base it on type that supports animations?

If that's the case, I won't be able to make animated solar panel out of solar-panel entity type. And as I assume, I wont be able to make power generator out of steam machine, that does not need to be connected towater, since this "template" requires it?
Post Reply

Return to “Modding help”