Page 1 of 1

[Request] Need help with my gun turret mod

Posted: Fri May 26, 2017 5:06 am
by thereaverofdarkness
I want a mod that allows me to research technology to increase gun turret hit points and attack range. Nothing more, just a simple mod to make gun turrets competitive in the late game.

Can someone show me how to build a mod that does this?


I created a mod to add an advanced gun turret but I seem to be missing code and I don't know how to make it work. I copied the gun turret info from the game files and put them into basic mod files and made edits for the advanced gun turret, and the game runs with the mod but nothing changes.
https://mods.factorio.com/mods/thereave ... retUpgrade

Edit: the mod has basic functionality, but the advanced gun turret does not gain damage from gun turret damage research. See post #5.

Re: [Request] Gun turret upgrade

Posted: Fri May 26, 2017 9:38 am
by orzelek
There is no way to do that currently. Modifiers for gun turret hp/range don't exist and they can't be modded in.

Best thing you can get is various Mk versions of gun turret like in bobs warefare.

Re: [Request] Gun turret upgrade

Posted: Fri May 26, 2017 1:18 pm
by thereaverofdarkness
That's what I'm doing. I put that in the mod I started, but I need help to make it work. If you look at the mod, it's pretty clear on the details of how it's supposed to work.

Re: [Request] Need help with my gun turret mod

Posted: Mon May 29, 2017 7:55 am
by PSS
I think you need add technology and entity to data (data:extend) as you did with items and recipies.

Re: [Request] Need help with my gun turret mod

Posted: Mon May 29, 2017 8:53 am
by thereaverofdarkness
PSS wrote:I think you need add technology and entity to data (data:extend) as you did with items and recipies.
I probably needed that, but it hasn't made the mod work.


Edit: I got the mod to work! I added a data file with the following lines:

Code: Select all

require("prototypes.items")
require("prototypes.recipies")
require("prototypes.entities")
require("prototypes.technologies")
I'm now trying to get the advanced gun turret to gain damage from the gun turret damage upgrade research. I put in this code into prototypes/technology-updates:

Code: Select all

table.insert(data.raw.technology["gun-turret-damage-1"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.1})
table.insert(data.raw.technology["gun-turret-damage-2"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.1})
table.insert(data.raw.technology["gun-turret-damage-3"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.2})
table.insert(data.raw.technology["gun-turret-damage-4"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.2})
table.insert(data.raw.technology["gun-turret-damage-5"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.2})
table.insert(data.raw.technology["gun-turret-damage-6"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.4})
table.insert(data.raw.technology["gun-turret-damage-7"].effects,{type = "turret-attack", turret_id = "advanced-gun-turret", modifier = 0.7})
but it isn't doing anything.

Re: [Request] Need help with my gun turret mod

Posted: Tue May 30, 2017 1:20 pm
by PSS
Add this line to data.lua if you didn't:

Code: Select all

require("prototypes.technology-updates")

Re: [Request] Need help with my gun turret mod

Posted: Tue May 30, 2017 5:51 pm
by thereaverofdarkness
It worked! I don't know why I missed that.

Thanks!
The turrets still don't automatically have the damage upgrade if you researched it before the mod was installed.