Need help with my first mod

Place to get help with not working mods / modding interface.
Post Reply
iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Need help with my first mod

Post by iCamper »

Hey Guys

First my english is not thaaaaaat good i think

A short discribtion
My mod is in the mod folder (the game does not crash) so i think i missed somethink

but I cant find what is missing xD

I would be happy if anyone can have a look at it :)

The mod just should decrase item costs for the circuits

with the best greetings
iCamper

DL Link:
http://www.file-upload.net/download-114 ... 0.rar.html

YoloJoe
Inserter
Inserter
Posts: 34
Joined: Wed Apr 13, 2016 2:56 pm
Contact:

Re: Need help with my first mod

Post by YoloJoe »

Did you take a look at the modding tutorial? If everything is set up correctly, you should just be able to add a "recipe.lua" and add this code to it:

Code: Select all

data:extend({

{
    type = "recipe",
    name = "YOUR_ITEM_NAME",
    enabled = "true",
    ingredients = 
	{
		{"steel-plate", 1},
	},
    result = "YOUR_ITEM_NAME"
  },  
})
replace "YOUR_ITEM_NAME" with the item you want. (see the item.lua file under D:\Steam\steamapps\common\Factorio\data\base\prototypes\item)

all you need to do then is to require it in the "data.lua" file ;)

YoloJoe
Inserter
Inserter
Posts: 34
Joined: Wed Apr 13, 2016 2:56 pm
Contact:

Re: Need help with my first mod

Post by YoloJoe »

Add this to the data.lua file:

Code: Select all

require ("prototypes.recipe")

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Thanks for youre answer
I did what u say but my mod isnt running yet ._.

Code: Select all

require ("prototypes.demo-item")
require ("prototypes.item")
require ("prototypes.entity")
require ("prototypes.recipe")
require ("prototypes.technology")

Code: Select all

"name": "Advanced_Item_Costs"
"version": "0.1.1",
"title": "Advanced_Item_Costs"
"author": "iCamper"
"contact": "",
"homepage": "",
"description": "This mod reduces costs of some items like the prosessing unit"
}

Code: Select all

data:extend({
  {
    type = "item",
    name = "electronic-circuit",
    icon = "__base__/graphics/icons/electronic-circuit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "intermediate-product",
    order = "c[electronic-circuit]",
    stack_size = 200
  },
)}
This is entity

Code: Select all

data:extend({


})

Code: Select all

data:extend({
  {
    type = "item",
    name = "advanced-circuit",
    icon = "__base__/graphics/icons/advanced-circuit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "intermediate-product",
    order = "d[advanced-circuit]",
    stack_size = 200
  },
  {
    type = "item",
    name = "processing-unit",
    icon = "__base__/graphics/icons/processing-unit.png",
    flags = {"goes-to-main-inventory"},
    subgroup = "intermediate-product",
    order = "e[processing-unit]",
    stack_size = 100
   }
)}

Code: Select all

data:extend({
 {
    type = "recipe",
    name = "electronic-circuit",
    ingredients =
    {
      {"iron-plate", 1},
      {"copper-cable", 1},
    },
    result = "electronic-circuit"
 },
 {
    type = "recipe",
    name = "advanced-circuit",
    enabled = false,
    energy_required = 4,
    ingredients =
    {
      {"electronic-circuit", 1},
      {"plastic-bar", 1},
      {"copper-cable", 1},
    },
    result = "advanced-circuit"
  },
  {
    type = "recipe",
    name = "processing-unit",
    category = "crafting-with-fluid",
    enabled = false,
    energy_required = 8,
    ingredients =
    {
      {"electronic-circuit", 1},
      {"advanced-circuit", 1},
      {type="fluid", name = "sulfuric-acid", amount = 0.1},
    },
    result = "processing-unit"
  }
)}

Code: Select all

data:extend({
   {
    type = "technology",
    name = "advanced-electronics-3",
    icon = "__base__/graphics/technology/advanced-electronics.png",
    effects =
    {
      {
        type = "unlock-recipe",
        recipe = "advanced-advanced-circuit"
      },
      {
        type = "unlock-recipe",
        recipe = "advanced-processing-unit"
      }
    },
    prerequisites = {"advanced-electronics-2"},
    unit =
    {
      count = 200,
      ingredients =
      {
        {"science-pack-1", 1},
        {"science-pack-2", 1}
      },
      time = 45
    },
    order = "a-d-b",
   }
)}
and this is my locale

Code: Select all

[item-name]
advanced-electronic-circuit = Electronic circuit
advanced-advanced-circuit = Advanced circuit
advanced-processing-unit = Processing-unit




[technology-name]
advanced-electronics-3 = Advanced-electronics-3



[entity-name]
advanced-electronic-circuit = Electronic circuit
advanced-advanced-circuit = Advanced-circuit
advanced-processing-unit = Processing-unit



[item-description]




[recipe-name]
advanced-electronic-circuit = Electronic-circuit
advanced-advanced-circuit = Advanced-circuit
advanced-processing-unit = Processing-unit

User avatar
bloc97
Inserter
Inserter
Posts: 47
Joined: Sat Apr 16, 2016 4:57 am
Contact:

Re: Need help with my first mod

Post by bloc97 »

Are you overwriting some recipes? If you want to do that, its better to use control.lua instead of using data:extend...
Image-Vehicles, Defense, Energy & More!
Image-Keep inventory on death!

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Yes thats i want to do
how i have to configurate the control.lua ? :o

User avatar
bloc97
Inserter
Inserter
Posts: 47
Joined: Sat Apr 16, 2016 4:57 am
Contact:

Re: Need help with my first mod

Post by bloc97 »

I don't have an example right now since I have never done this, but there are many tools available.

There's an example to modify the recipes in this thread, and for technologies, you should just need to change data.raw.recipes to data.raw.technology or something like that.
viewtopic.php?f=25&t=1221

Factorio API page:
http://lua-api.factorio.com/0.12.30/LuaTechnology.html
Image-Vehicles, Defense, Energy & More!
Image-Keep inventory on death!

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Ok
i tryed all what u say guys but the mod dont want to work
when i click on modifications (main menu)
i cant find my mod there ._.

User avatar
bloc97
Inserter
Inserter
Posts: 47
Joined: Sat Apr 16, 2016 4:57 am
Contact:

Re: Need help with my first mod

Post by bloc97 »

Oh you can't even find your mod? Are you sure the folder is in /mods and it has a info.json file?
Image-Vehicles, Defense, Energy & More!
Image-Keep inventory on death!

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Yeah I have that

Code: Select all

{
"name": "Advanced_Item_Crafting_Costs",
"version": "0.1.1",
"title": "Advanced_Item_Crafting_Costs",
"author": "iCamper",
"contact": "",
"homepage": "",
"description": "This mod reduces costs of some items like the prosessing unit"
}
Thats why i am a bit confused ._.

If u want to have a look at the things i've tryed here is the dl link with my mod
http://www.file-upload.net/download-114 ... s.rar.html

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: Need help with my first mod

Post by Arch666Angel »

You need to have it in .zip format not in .rar format.

if you change recipes/items/etc via data.raw...it needs to be in the data phase, so best be put into data-updates.lua which loads second after data.lua or even data-final-fixes.lua which loads last in the data phase.

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Ok
Thanks ;D ;D
but now it says JSON parser error: expected object name

Code: Select all

{
"name": "Advanced_Item_Costs",
"version": "0.1.1",
"title": "Advanced_Item_Costs",
"author": "iCamper",
"contact": "",
"homepage": "",
"description": "This mod reduces costs of some items like the prosessing unit",
}
You sayed it would be better to do it in another way ?
Im just a beginner in modding could you give me an example ? :)



but this mod is running
http://www.file-upload.net/download-114 ... 1.zip.html
buuuuut it didnt change the costs after all

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Need help with my first mod

Post by prg »

iCamper wrote:but now it says JSON parser error: expected object name

Code: Select all

{
"name": "Advanced_Item_Costs",
"version": "0.1.1",
"title": "Advanced_Item_Costs",
"author": "iCamper",
"contact": "",
"homepage": "",
"description": "This mod reduces costs of some items like the prosessing unit",
}
That's not valid JSON, the last element in an object or array must not be followed by a comma. Also you might want to add a dependency on a certain version of the base game that the mod is known to work with, like "dependencies": ["base >= 0.12.30"].
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Well thanks....
I watched the tutorials i found..... but i dont understand it I need more help ._.

User avatar
bloc97
Inserter
Inserter
Posts: 47
Joined: Sat Apr 16, 2016 4:57 am
Contact:

Re: Need help with my first mod

Post by bloc97 »

Fixed your code, there was multiple mistakes. Extract this in your mods folder.
Though I haven't tested your mod yet.

for example
data:extend({}) is correct, you wrote data:extend({)}, which is not.
And the info.json, all items in the list has to finish with a "," which you forgot multiple times.

And don't forget, your mods have to be each individually packed in a different .zip, otherwise the user has to extract them.

http://s000.tinyupload.com/index.php?fi ... 8925238557
Image-Vehicles, Defense, Energy & More!
Image-Keep inventory on death!

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Thank you very much ^^
so now i have a last problem
i have another mod (5dim) and it changes this recipes too so how could i make it not load for this items ? :D

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Nvm its running

iCamper
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Apr 16, 2016 11:04 pm
Contact:

Re: Need help with my first mod

Post by iCamper »

Ok i have one more question :D :D
How can i change it that i can put a productive chip in the assambling machine when i want to create advanced circuits and prossesing units ? :)

Post Reply

Return to “Modding help”