How to find the name of a variable/property

Place to get help with not working mods / modding interface.
bl4st
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Sep 06, 2021 7:52 pm
Contact:

How to find the name of a variable/property

Post by bl4st »

Hi, i am very new to this and i am having a hard time searching for information about this. I am trying to make a very simple mod to try to understand how things work.

This is what i have so far. It works, but the "effects" are not the ones i want, in this case i am looking to increase the range of the personal laser defense module.

Code: Select all

data:extend({
	{
		type = "technology",
		name="Personal-Laser-Defense-Range",
		icon="__Personal-Laser-Upgrade__/Laser.png",
		icon_size=256,
		prerequisites={"personal-laser-defense-equipment"},
		effects=
		{
			{
				-- where do i find the right stuff to put there ?
				type = "turret-attack",
				turret_id = "gun-turret",
				modifier=0.3
			}
		},
		unit=
		{
			count_formula="(2^L) * 500",
			ingredients=
			{
				{"automation-science-pack",1},
				{"logistic-science-pack",1},
				{"chemical-science-pack",1},
				{"military-science-pack",1},
				{"utility-science-pack",1},
				{"space-science-pack",1}
			},
			time=60
		},
		max_level="infinite",
		upgrade=true
	},
})
So my question is, how do i find the variable names i am looking for. I started to browse the wiki and this is where i got lost.
I went to https://wiki.factorio.com/Personal_laser_defense
which lead me to https://wiki.factorio.com/Prototype/Act ... eEquipment
which lead me to https://wiki.factorio.com/Types/BaseAttackParameters
where i saw there is a "range" property.

This is very confusing i am probably not even looking at the right place, i didin't really find information about how to find what i am looking for, so here i am asking for your help.

Am i on the right track ? Where should i be looking to find the name of the "effects" i am looking for ?

Thank you for your time and have a nice day !
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 586
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: How to find the name of a variable/property

Post by Silari »

Technology effects you an use are all listed at https://lua-api.factorio.com/latest/Con ... gyModifier . You can't increase the range of a personal laser defense via research - the range is part of the equipment itself, as part of the attack_parameters of an ActiveDefenseEquipment. You'd have to define a new equipment with the longer range instead, which the tech can unlock the recipe for.

You should definitely read through the wiki's modding tutorials which should help explain a lot of the basic concepts and walk you through making a basic mod.
bl4st
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Sep 06, 2021 7:52 pm
Contact:

Re: How to find the name of a variable/property

Post by bl4st »

Thank you very much :)
Post Reply

Return to “Modding help”