Change a recipe

Place to get help with not working mods / modding interface.
Post Reply
Night_Fires
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 15, 2016 10:19 am
Contact:

Change a recipe

Post by Night_Fires »

Is there anyway to change a recipe and/or the technology needed for an item integreted in the game ?

ShinyAfro
Inserter
Inserter
Posts: 27
Joined: Mon Jan 04, 2016 1:27 pm
Contact:

Re: Change a recipe

Post by ShinyAfro »

data.raw["Type"]["Name"]["Property"] = New or revised value.

Say you wanted to change a technology, probably gonna not type the exact names right but you should get the point, say we want to change the express belt to be 4x the speed of the regular belts, instead of 3x? Easy.
Lets start from the beginning, you will probably want to locate to original Lua, so go to Factorio_0.13.5\data\base\prototypes\entity and open entity.lua in notepad++ or whatever you use then search for express, heres the information we need:
{
type = "transport-belt",
name = "express-transport-belt",
blah blah blah,
speed = 0.09375,
blah blah blah,
},
So basically we have all three values

data.raw["transport-belt"]["express-transport-belt"]["speed"] = 0.125
That should work, for technologies and recipes it should be the same however note that the value section only works in the same level where type and name are, so say you want to change a technologies effects, it would be to the effect of this
data.raw["technology"]["military4"]["effects"] = {{type = "unlock-recipe", recipe = "some-random-recipe"}, {type = "unlock-recipe", recipe = "some-other-random-recipe"}}
Just be aware when doing it like so it will replace the value with the new string so if you wanted to change on thing i recommend pasting the original value and removing/adding to it.
data.raws should not have a comma after the end by the way, so if you had these together you would have them like this:

data.raw["technology"]["military4"]["effects"] = {{type = "unlock-recipe", recipe = "some-random-recipe"}, {type = "unlock-recipe", recipe = "some-other-random-recipe"}}
data.raw["transport-belt"]["express-transport-belt"]["speed"] = 0.125
data.extend:({{stuff}})

I have not tested these two in particular but they should work.
This works for other mods too just make sure the mods are listed as required in the info.json so your mod loads after.

Other option that is less elegant is you can straight copy the original lua entry and change it, the last loaded mod will overwrite the previous entry.


Also, if you are modding other mods, you can also add an if statement and add them as optional requirements, say you wanted to add cross comparability.
If data.raw["technology"]["military4"]["effects"] then
require("prototypes.DatCode") -- Its anways nice to label what does what i guess.
end

Pretty sure you can use else as well too so like
if "this" then "that" else "the other thing" end
but i have not needed to try that so far

Night_Fires
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Jul 15, 2016 10:19 am
Contact:

Re: Change a recipe

Post by Night_Fires »

Thank you, it's exactly what i wanted.

I wanted to change the grenade craft because i think it is a little bit overcheat.

Post Reply

Return to “Modding help”