[RESOLVED]New Ammo does nothing?

Place to get help with not working mods / modding interface.
User avatar
Galacticruler
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sat Apr 16, 2016 5:18 pm
Contact:

[RESOLVED]New Ammo does nothing?

Post by Galacticruler »

I've created a new ammunition type and cannot get it to do damage or spawn it's custom on-hit entity.

Code: Select all

data:extend({
{
    type = "ammo",
    name = "corrosive-bullet-magazine",
    icon = "__Utilities-n-More__/graphics/icons/corrosive-bullet-magazine.png",
    flags = {"goes-to-main-inventory"},
    ammo_type =
    {
      category = "bullet",
      action =
      {
        type = "direct",
        action_delivery =
        {
          type = "instant",
          source_effects =
          {
              type = "create-explosion",
              entity_name = "explosion-gunshot"
          },
            {
              target_effects =
              {
                {
                  type = "create-entity",
                  entity_name = "acid-splash-green"
                },
                {
                  type = "damage",
                  damage = { amount = 10 , type = "acid"},
                  damage = { amount = 1, type = "physical"},
                }
              }
            }
        }
      }
    },
    magazine_size = 10,
    subgroup = "ammo",
    order = "a[basic-clips]-c[corrosive-bullet-magazine]",
    stack_size = 100
}
})

Code: Select all

{
    type = "explosion",
    name = "acid-splash-green",
    flags = {"not-on-map"},
    time_before_removed = 5 * 30,
    final_render_layer = "corpse",
    splash =
    {
      {
        filename = "__Utilities-n-More__/graphics/entities/acid-splash-green/splash-1.png",
        line_length = 5,
        width = 199,
        height = 159,
        frame_count = 20,
        shift = {0.484375, -0.171875},
      },
      {
        filename = "__Utilities-n-More__/graphics/entities/acid-splash-green/splash-2.png",
        line_length = 5,
        width = 238,
        height = 157,
        frame_count = 20,
        shift = {0.8125, -0.15625},
      },
      {
        filename = "__Utilities-n-More__/graphics/entities/acid-splash-green/splash-3.png",
        line_length = 5,
        width = 240,
        height = 162,
        frame_count = 20,
        shift = {0.71875, -0.09375},
      },
      {
        filename = "__Utilities-n-More__/graphics/entities/acid-splash-green/splash-4.png",
        line_length = 5,
        width = 241,
        height = 146,
        frame_count = 20,
        shift = {0.703125, -0.375},
      }
    },
    splash_speed = 0.6
  }
Last edited by Galacticruler on Thu Apr 21, 2016 2:38 am, edited 1 time in total.
PC is best.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: New Ammo does nothing?

Post by Adil »

There's excessive pair of curly braces:
Galacticruler wrote:

Code: Select all

data:extend({
{
    type = "ammo",
    name = "corrosive-bullet-magazine",
    icon = "__Utilities-n-More__/graphics/icons/corrosive-bullet-magazine.png",
    flags = {"goes-to-main-inventory"},
    ammo_type =
    {
      category = "bullet",
      action =
      {
        type = "direct",
        action_delivery =
        {
          type = "instant",
          source_effects =
          {
              type = "create-explosion",
              entity_name = "explosion-gunshot"
          },
            {--this one shouldn't be
              target_effects =
              {
                {
                  type = "create-entity",
                  entity_name = "acid-splash-green"
                },
                {
                  type = "damage",
                  damage = { amount = 10 , type = "acid"},
                  damage = { amount = 1, type = "physical"},
                }
              }
            }--this one shouldn't be
        }
      }
    },
    magazine_size = 10,
    subgroup = "ammo",
    order = "a[basic-clips]-c[corrosive-bullet-magazine]",
    stack_size = 100
}
})
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
User avatar
Galacticruler
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sat Apr 16, 2016 5:18 pm
Contact:

Re: New Ammo does nothing?

Post by Galacticruler »

Adil wrote:There's excessive pair of curly braces:
Galacticruler wrote:

Code: Select all

data:extend({
{
    type = "ammo",
    name = "corrosive-bullet-magazine",
    icon = "__Utilities-n-More__/graphics/icons/corrosive-bullet-magazine.png",
    flags = {"goes-to-main-inventory"},
    ammo_type =
    {
      category = "bullet",
      action =
      {
        type = "direct",
        action_delivery =
        {
          type = "instant",
          source_effects =
          {
              type = "create-explosion",
              entity_name = "explosion-gunshot"
          },
            {--this one shouldn't be
              target_effects =
              {
                {
                  type = "create-entity",
                  entity_name = "acid-splash-green"
                },
                {
                  type = "damage",
                  damage = { amount = 10 , type = "acid"},
                  damage = { amount = 1, type = "physical"},
                }
              }
            }--this one shouldn't be
        }
      }
    },
    magazine_size = 10,
    subgroup = "ammo",
    order = "a[basic-clips]-c[corrosive-bullet-magazine]",
    stack_size = 100
}
})
Okay that worked, but its ignoring the acid damage now
PC is best.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: New Ammo does nothing?

Post by Adil »

It's because you set a single field twice in one table, thus overwriting the first assignment.
Here's how relevant bit for cannon-shell is defined in base:

Code: Select all

        
target_effects =
        {
          {
            type = "damage",
            damage = { amount = 150 , type = "physical"}
          },
          {
            type = "damage",
            damage = { amount = 50 , type = "explosion"}
          }
        }
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Modding help”