Help with research damage boost

Place to get help with not working mods / modding interface.
Post Reply
User avatar
LethargicChii
Inserter
Inserter
Posts: 40
Joined: Fri Dec 23, 2016 5:19 pm
Contact:

Help with research damage boost

Post by LethargicChii »

Hello potentially helpful mod dev / reader. I have a little problem I haven't been able to solve.

I'm trying to increase the damage of a poison cloud that is created by one of my custom rockets via research just like you can with laser and gun turrets. The custom rocket I made acts just like a capsule minus the throwing part. I simply told the rocket to create and entity called "rocket-poison-cloud" at the same time it damages something, which is just the regular poison cloud renamed, scaled down, and duration reduced.

Here is the code for the rocket that creates the cloud (stored in projectiles.lua):

Code: Select all

{
    type = "projectile",
    name = "poison-rocket",
    flags = {"not-on-map"},
    acceleration = 0.003,
    action =
    {
      type = "direct",
      action_delivery =
      {
        type = "instant",
        target_effects =
        {
          {
            type = "create-entity",
            entity_name = "explosion"
          },
          {
            type = "damage",
            damage = {amount = 75, type = "explosion"}
          },
		    {
             type = "create-entity",
             show_in_tooltip = true,
             entity_name = "rocket-poison-cloud"
            },
          {
            type = "create-entity",
            entity_name = "small-scorchmark",
            check_buildability = true
          }
        }
      }
    },
	light = {intensity = 0.5, size = 4},
    animation =
    {
      filename = "__base__/graphics/entity/rocket/rocket.png",
      frame_count = 8,
      line_length = 8,
      width = 9,
      height = 35,
      shift = {0, 0},
      priority = "high"
    },
    shadow =
    {
      filename = "__base__/graphics/entity/rocket/rocket-shadow.png",
      frame_count = 1,
      width = 7,
      height = 24,
      priority = "high",
      shift = {0, 0}
    },
    smoke =
    {
      {
        name = "smoke-fast",
        deviation = {0.15, 0.15},
        frequency = 1,
        position = {0, -1},
        slow_down_factor = 1,
        starting_frame = 3,
        starting_frame_deviation = 5,
        starting_frame_speed = 0,
        starting_frame_speed_deviation = 5
      }
    }
  },
Here is the code for the rocket-poison-cloud entity in entities.lua:

Code: Select all

{
    type = "smoke-with-trigger",
    name = "rocket-poison-cloud",
    flags = {"not-on-map"},
    show_when_smoke_off = true,
    animation =
    {
      filename = "__base__/graphics/entity/cloud/cloud-45-frames.png",
      flags = { "compressed" },
      priority = "low",
      width = 256,
      height = 256,
      frame_count = 45,
      animation_speed = 0.5,
      line_length = 7,
      scale = 2,
    },
    slow_down_factor = 0,
    affected_by_wind = false,
    cyclic = true,
    duration = 60 * 10,
    fade_away_duration = 2 * 60,
    spread_duration = 10,
    color = { r = 0.2, g = 0.9, b = 0.2 },
    action =
    {
      type = "direct",
      action_delivery =
      {
        type = "instant",
        target_effects =
        {
          type = "nested-result",
          action =
          {
            type = "area",
            perimeter = 8,
            entity_flags = {"breaths-air"},
            action_delivery =
            {
              type = "instant",
              target_effects =
              {
                type = "damage",
                damage = { amount = 15, type = "poison"}
              }
            }
          }
        }
      }
    },
    action_cooldown = 30
  }
First I tried giving it a damage boost the same way laser turrets get their damage boost.

Laser Code:

Code: Select all

 {
    type = "technology",
    name = "laser-turret-damage-1",
    icon = "__base__/graphics/technology/laser-turret-damage.png",
    effects =
    {
      {
        type = "ammo-damage",
        ammo_category = "laser-turret",
        modifier = 0.1
      }
    },
    prerequisites = {"laser-turrets"},
    unit =
    {
      count = 50,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1},
        {"military-science-pack", 1}
      },
      time = 30
    },
    upgrade = true,
    order = "e-n-a"
This is where it gets tricky.

Code: Select all

 {
        type = "ammo-damage",
        ammo_category = "laser-turret",
        modifier = 0.1
      }
The entity I am creating doesn't have an ammo_category. So I followed the example of the laser-turret and give it a category, and added categories.lua to my mod, and put the code in, changed the names, made them match the rocket-poison-cloud entity and so forth. I booted up factorio, the tech shows up and everything but when researched, it still does not change the damage of the rocket-poison-cloud.

What I tried is below, but this did not work

Code: Select all

 {
        type = "ammo-damage",
        ammo_category = "rocket-poison-cloud",
        modifier = 0.1
      }
The second and third tries I did just kept the mod from loading, and it pretty much involved just moving the name to type = "poison-rocket-cloud", and the same for ammo_category, etc.

I pretty much just confused the heck out of myself trying to do this, so some help would be greatly appreciated.
My Mods:
Rocket Turret
Discussion Forum: viewtopic.php?f=93&t=47497

Ask me about blender! I don't know a lot, but, I can try and help.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Help with research damage boost

Post by bobingabout »

I'm not sure what you're trying to do is possible. If your projectile is basically a rocket ammo, then the research to boost damage would apply to rocket ammo, ALL rocket ammo. That's just the way it works.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
LethargicChii
Inserter
Inserter
Posts: 40
Joined: Fri Dec 23, 2016 5:19 pm
Contact:

Re: Help with research damage boost

Post by LethargicChii »

I think you are right. I tried lots of different stuff the other day. I did manage to get the damage bonus of rockets when researched to apply to the poison damage as well, but, I had to do this to the projectile:
Projectile

Code: Select all

 ----- Poison Rocket -----
  {
    type = "projectile",
    name = "poison-rocket",
    flags = {"not-on-map"},
    acceleration = 0.003,
    action =
    {
      type = "direct",
      action_delivery =
      {
        type = "instant",
        target_effects =
        {
          {
            type = "create-entity",
            entity_name = "explosion"
          },
          {
            type = "damage",
            damage = {amount = 75, type = "explosion"}
          },
		    {
             type = "create-entity",
             show_in_tooltip = true,
             entity_name = "rocket-poison-cloud"
            },
            {
             type = "nested-result",  ----- Poison Damage -----
             action =
			    {
                 type = "area",
				 perimeter = 8,
                 entity_flags = {"breaths-air"},
                 action_delivery =
                    {
                     type = "instant",
                     target_effects =
                        {
                         type = "damage",
                         damage = { amount = 20, type = "poison"}
                        }
                    }
                }
            } ----- End Poison Damage -----
          
        }
      },
	  
	    {
            type = "create-entity",
            entity_name = "small-scorchmark",
            check_buildability = true
        }
    },
	light = {intensity = 0.5, size = 4},
    animation =
    {
      filename = "__base__/graphics/entity/rocket/rocket.png",
      frame_count = 8,
      line_length = 8,
      width = 9,
      height = 35,
      shift = {0, 0},
      priority = "high"
    },
    shadow =
    {
      filename = "__base__/graphics/entity/rocket/rocket-shadow.png",
      frame_count = 1,
      width = 7,
      height = 24,
      priority = "high",
      shift = {0, 0}
    },
    smoke =
    {
      {
        name = "smoke-fast",
        deviation = {0.15, 0.15},
        frequency = 1,
        position = {0, -1},
        slow_down_factor = 1,
        starting_frame = 3,
        starting_frame_deviation = 5,
        starting_frame_speed = 0,
        starting_frame_speed_deviation = 5
      }
    }
  },
And then remove everything past action= from the poison-rocket-cloud so it just spawns the cloud itself and not any damage.

Code: Select all

 ----- Poison Rocket Cloud -----
  {
    type = "smoke-with-trigger",
    name = "rocket-poison-cloud",
    flags = {"not-on-map"},
    show_when_smoke_off = true,
    animation =
    {
      filename = "__base__/graphics/entity/cloud/cloud-45-frames.png",
      flags = { "compressed" },
      priority = "low",
      width = 256,
      height = 256,
      frame_count = 45,
      animation_speed = 0.5,
      line_length = 7,
      scale = 2,
    },
    slow_down_factor = 0,
    affected_by_wind = false,
    cyclic = true,
    duration = 60 * 10,
    fade_away_duration = 2 * 60,
    spread_duration = 10,
    color = { r = 0.2, g = 0.9, b = 0.2 },
   
   },
But this only achieved half of the result. Yes the rocket damage upgrades get applied to the poison damage as well, so it shows 20+45 poison at max before infinite research, but, it does not affect an "area" like it should, it only effects the target.

So it seems best for me to just leave it the way I have it now, which is, the projectile creates the poison cloud, and the poison cloud does the damage in an area like it's supposed to, and just boost the damage.
My Mods:
Rocket Turret
Discussion Forum: viewtopic.php?f=93&t=47497

Ask me about blender! I don't know a lot, but, I can try and help.

Post Reply

Return to “Modding help”