add researh, change item

Place to get help with not working mods / modding interface.
linainverse
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Jan 18, 2014 3:18 pm
Contact:

add researh, change item

Post by linainverse »

Hello. I'm the visual type of person, I better understand if I see something rather then read. So I'm asking for a bit of an example help. I want to add a technology (e.g. "Personal Enhancer"), completely new, which is enabled after researching the personal laser turret, and which adds 2 points of laser damage to the personal laser turret, and it gives access to another research ("Personal Enhancer 2") which adds 2 points more.I think I can do this alone but the "order" thingy and some else confuses me a bit. Can some make me this example? Hope it's not too much.
Thanks.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: add researh, change item

Post by FreeER »

Because the personal laser defense uses an 'electric' type ammo (see data\base\prototypes\equipment\equipment.lua, line 218) what you would do is create a technology using the "ammo-damage" modifier (see data\base\prototypes\laser-turret-upgrades.lua for use and Wiki Technology-Modifier for a list of other available modifiers) and specify the ammo_category as "electric".
Here is an example data.lua file for the tech

Code: Select all

data:extend({
  {
    type = "technology",
    name = "basic-laser-defense-equipment-damage-1",
    icon = "__base__/graphics/technology/laser-turret-damage.png",
    effects =
    {
      {
        type = "ammo-damage",
        ammo_category = "electric",
        modifier = "0.1"
      }
    },
    prerequisites = {"basic-laser-defense-equipment"},
    unit =
    {
      count = 50,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1}
      },
      time = 30
    },
    upgrade = "true",
    order = "e-n-a"
  },
  {
    type = "technology",
    name = "basic-laser-defense-equipment-damage-2",
    icon = "__base__/graphics/technology/laser-turret-damage.png",
    effects =
    {
      {
        type = "ammo-damage",
        ammo_category = "electric",
        modifier = "0.2"
      }
    },
    prerequisites = {"basic-laser-defense-equipment-damage-1"},
    unit =
    {
      count = 50,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1}
      },
      time = 30
    },
    upgrade = "true",
    order = "e-n-a"
  },
})
The "prerequisites" state which technologies must already be researched before the one being defined can be researched (in the first, the personal laser defense, in the second the first damage upgrade). "upgrade" will hide future technologies (upgrade 2 in this example, but if you had a damage-36 it would hide all 37) until the previous upgrade has been researched. "order" is simply a string (aka text) that is used to determine which technology should be shown first in the Research menu (based on alphabetical order, a before b and c after b, when compared to other order strings). Note: I copied the laser turret damage tech for this example and only changed the names, prerequisites, and effects (so icons, research cost and time, and the order are the same).

at least I'm 90% certain that would work, I haven't actually tried this particular code :) Should it give you any issues or you have any other questions just make another post here, I'll be happy to help :D
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
linainverse
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Jan 18, 2014 3:18 pm
Contact:

Re: add researh, change item

Post by linainverse »

ok, i'll try

in between, my second question is - are there limits for the armors' "grid"?
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: add researh, change item

Post by ficolas »

The limit is the screen.
Also adding a modifier to electric will also increase laser turret damage, same as the laser turret damage tech increases the personal laser damage
linainverse
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Jan 18, 2014 3:18 pm
Contact:

Re: add researh, change item

Post by linainverse »

somehow I can't see the "vanilla" damage of the turrets, or am I blind...
User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: add researh, change item

Post by Dysoch »

linainverse wrote:somehow I can't see the "vanilla" damage of the turrets, or am I blind...
you can, check in dytech/prototype/entity/base-edits.lua in my mod.
that will show you the easy way to modify the vanilla items and entities.

basicly you copy the base settings, and modify them to your wishes. the game will then override the base game content on load of the game
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: add researh, change item

Post by ficolas »

Dysoch wrote:
linainverse wrote:somehow I can't see the "vanilla" damage of the turrets, or am I blind...
you can, check in dytech/prototype/entity/base-edits.lua in my mod.
that will show you the easy way to modify the vanilla items and entities.

basicly you copy the base settings, and modify them to your wishes. the game will then override the base game content on load of the game
Thats nit what he means I think...
There is a laser shooting speed and laser damage but I think it is only shown when laser turrets are researched.
linainverse
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Jan 18, 2014 3:18 pm
Contact:

Re: add researh, change item

Post by linainverse »

It's not working.

And
Also adding a modifier to electric will also increase laser turret damage, same as the laser turret damage tech increases the personal laser damage
is not

:(((
Post Reply

Return to “Modding help”