How can i add new items?
How can i add new items?
Hello Factorio players (:
I try to make a mod and the first item i want to add is a pulverizor.
It should work with electric and should use the gui from the normal stone-furnace.
I made the entity,the icon and some lua scripts but something went wrong.
I did read https://forums.factorio.com/forum/vie ... f=34&t=709 but i did not understand all because i´am from germany and read english is a little bit hard for me^^
And i looked into the treefarm mod to see how it works but that helped me only to understand the control.lua and some other things.
The mod is shown in the mod menu and it is active but i can´t see my item in the world editor.
I think i did everything very false but i can´t find my mistake.
And im a beginner in scripting lua. But i have experience in programming(AutoIt,C,Blitzbasic,Html)
Can you please help me?
I upload my mod folder here.
Iam very happy about every helpful answer (:
And please don´t ask me about the pictures Iam not good at drawing^^
I try to make a mod and the first item i want to add is a pulverizor.
It should work with electric and should use the gui from the normal stone-furnace.
I made the entity,the icon and some lua scripts but something went wrong.
I did read https://forums.factorio.com/forum/vie ... f=34&t=709 but i did not understand all because i´am from germany and read english is a little bit hard for me^^
And i looked into the treefarm mod to see how it works but that helped me only to understand the control.lua and some other things.
The mod is shown in the mod menu and it is active but i can´t see my item in the world editor.
I think i did everything very false but i can´t find my mistake.
And im a beginner in scripting lua. But i have experience in programming(AutoIt,C,Blitzbasic,Html)
Can you please help me?
I upload my mod folder here.
Iam very happy about every helpful answer (:
And please don´t ask me about the pictures Iam not good at drawing^^
- Attachments
-
- MoreItems.rar
- (42.82 KiB) Downloaded 456 times
Last edited by Jani25051 on Sun Aug 04, 2013 12:06 pm, edited 2 times in total.
Re: How can i add new items?
Are you using the Factorio version that matches the tutorial you were following? (v0.3/0.4 I think?) Or at least the Factorio version that matches the version of TreeFarm mod you were looking at?Jani25051 wrote: I did read https://forums.factorio.com/forum/vie ... f=34&t=709 but i did not understand all because i´am from germany and read english is a little bit hard for me^^
And i looked into the treefarm mod to see how it works but that helped me only to understand the control.lua and some other things.
**EDIT
Just looked at the RAR, and your folder structure looks wrong. Look at treefarm mod for reference.
"F**k thy hater"
-George Watsky
Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com
-George Watsky
Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com
Re: How can i add new items?
I use Factorio version 0.5.3.zer0t3ch wrote:
Are you using the Factorio version that matches the tutorial you were following? (v0.3/0.4 I think?) Or at least the Factorio version that matches the version of TreeFarm mod you were looking at?
**EDIT
Just looked at the RAR, and your folder structure looks wrong. Look at treefarm mod for reference.
I can´t find a tutorial for modding in 0.5.3 so i used that tutorial with version 0.4...
I changed the Treefarm version to 0.5.3 to play it and it works fine (:
Thanks for your answer i change the folder structure like it is in the treefarm mod.
Edit://
I´ve changed the file structure and changed it in the .lua files too but the item is not in the game..
Is my "MoreItems\graphics\entity\MoreItems-Mod\electric-pulverizor.png" right?
I saw that in the "15Cyndaquil's electric furnace mod"..
ps.I´ve uploaded the new test mod files in my first comment.
Re: How can i add new items?
I see your problem, and I bet you can fix it in just a few seconds.Jani25051 wrote:I use Factorio version 0.5.3.zer0t3ch wrote:
Are you using the Factorio version that matches the tutorial you were following? (v0.3/0.4 I think?) Or at least the Factorio version that matches the version of TreeFarm mod you were looking at?
**EDIT
Just looked at the RAR, and your folder structure looks wrong. Look at treefarm mod for reference.
I can´t find a tutorial for modding in 0.5.3 so i used that tutorial with version 0.4...
I changed the Treefarm version to 0.5.3 to play it and it works fine (:
Thanks for your answer i change the folder structure like it is in the treefarm mod.
Edit://
I´ve changed the file structure and changed it in the .lua files too but the item is not in the game..
Is my "MoreItems\graphics\entity\MoreItems-Mod\electric-pulverizor.png" right?
I saw that in the "15Cyndaquil's electric furnace mod"..
ps.I´ve uploaded the new test mod files in my first comment.
You need to have a data.lua in the root of your MoreItems folder that loads in all of the other files, because otherwise the game doesn't know what to load. For your folder structure, putting this into a data.lua should do the trick: (and make everything work, provided your code is good)
Code: Select all
require("prototypes.entity.moreitems-mod")
require("prototypes.item.moreitems-mod")
require("prototypes.recipe.moreitems-mod")
require("prototypes.recipe-category.moreitems-mod")
"F**k thy hater"
-George Watsky
Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com
-George Watsky
Feel free to contact me!
Skype: Zer0t3ch
Razer Comms: Zer0t3ch
Email: zer0t3ch@live.com
Re: How can i add new items?
Hey thanks. (:zer0t3ch wrote:I see your problem, and I bet you can fix it in just a few seconds.Jani25051 wrote:I use Factorio version 0.5.3.zer0t3ch wrote:
Are you using the Factorio version that matches the tutorial you were following? (v0.3/0.4 I think?) Or at least the Factorio version that matches the version of TreeFarm mod you were looking at?
**EDIT
Just looked at the RAR, and your folder structure looks wrong. Look at treefarm mod for reference.
I can´t find a tutorial for modding in 0.5.3 so i used that tutorial with version 0.4...
I changed the Treefarm version to 0.5.3 to play it and it works fine (:
Thanks for your answer i change the folder structure like it is in the treefarm mod.
Edit://
I´ve changed the file structure and changed it in the .lua files too but the item is not in the game..
Is my "MoreItems\graphics\entity\MoreItems-Mod\electric-pulverizor.png" right?
I saw that in the "15Cyndaquil's electric furnace mod"..
ps.I´ve uploaded the new test mod files in my first comment.
You need to have a data.lua in the root of your MoreItems folder that loads in all of the other files, because otherwise the game doesn't know what to load. For your folder structure, putting this into a data.lua should do the trick: (and make everything work, provided your code is good)Code: Select all
require("prototypes.entity.moreitems-mod") require("prototypes.item.moreitems-mod") require("prototypes.recipe.moreitems-mod") require("prototypes.recipe-category.moreitems-mod")
This helped me to understand thr data.lua file but the problem is the same.
I think i did anything in the .lua files wrong. Maybe a { or so on...
I´ve changed my lua files like it is in the treefarm mod but this doesn´t help me.
I upload my new files in the first comment.
I know anyone here knows what my problem is. Please help me O:
Re: How can i add new items?
Nice to see a new modder here.
For newbies I highly recommend to look into the data/base folder.
It is the perfect place to see how things can/have to be done and to become familiar with the data structure.
I had just a quick view, but there are several bugs in your files. E.g missing data:extend, wrong entity type, ...
P.S. I am not sure if this is still valid, but I believe that the modfolder name have to be the same than the mod-name in the info.json
For newbies I highly recommend to look into the data/base folder.
It is the perfect place to see how things can/have to be done and to become familiar with the data structure.
I had just a quick view, but there are several bugs in your files. E.g missing data:extend, wrong entity type, ...
P.S. I am not sure if this is still valid, but I believe that the modfolder name have to be the same than the mod-name in the info.json
Re: How can i add new items?
Thanks for your tip with the data/base folder.drs9999 wrote:Nice to see a new modder here.
For newbies I highly recommend to look into the data/base folder.
It is the perfect place to see how things can/have to be done and to become familiar with the data structure.
I had just a quick view, but there are several bugs in your files. E.g missing data:extend, wrong entity type, ...
P.S. I am not sure if this is still valid, but I believe that the modfolder name have to be the same than the mod-name in the info.json
I will now look into it and i hope that i can fix the bugs.
And i will change the info.json (:
Edit://
I´ve made it and now i got errors if i start the game but i think i can fix them.
But the problem isn´t solved ):
Re: How can i add new items?
As an example the *.lua file in the entity folder should look like this:
Code: Select all
data:extend(
{
{
type = "assembling-machine",
name = "electric-pulverizor",
icon = "__Moreitems__/graphics/icons/electric-pulverizor.png",
flags = {"placeable-neutral","player-creation"},
minable = {hardness = 0.2, mining_time = 0.5, result = "electric-pulverizor"},
max_health = 100,
collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
animation =
{
filename = "__MoreItems__/graphics/entity/MoreItems-Mod/electric-pulverizor.png",
priority = "medium",
frame_width = 132,
frame_height = 116,
frame_count = 32,
line_length = 7,
shift = {0.0, 0.0}
},
crafting_categories = {"pulverizing"},
effectivity = 20,
energy_source =
{
type = "electric",
input_priority = "secondary"
},
energy_usage_per_tick = 0.5,
ingredient_count = 1
}
}
)
Re: How can i add new items?
Woah thanks for that!drs9999 wrote:As an example the *.lua file in the entity folder should look like this:
Code: Select all
data:extend( { { type = "assembling-machine", name = "electric-pulverizor", icon = "__Moreitems__/graphics/icons/electric-pulverizor.png", flags = {"placeable-neutral","player-creation"}, minable = {hardness = 0.2, mining_time = 0.5, result = "electric-pulverizor"}, max_health = 100, collision_box = {{-1.4, -1.4}, {1.4, 1.4}}, selection_box = {{-1.5, -1.5}, {1.5, 1.5}}, animation = { filename = "__MoreItems__/graphics/entity/MoreItems-Mod/electric-pulverizor.png", priority = "medium", frame_width = 132, frame_height = 116, frame_count = 32, line_length = 7, shift = {0.0, 0.0} }, crafting_categories = {"pulverizing"}, effectivity = 20, energy_source = { type = "electric", input_priority = "secondary" }, energy_usage_per_tick = 0.5, ingredient_count = 1 } } )
That helped me very very good
But i have problems with the other .lua files..
All i can find in the base mod is hard to understand for me.
And if i copy that and change the path´s and other things, it doesn´t work..
I think i can learn from it if i have my first item ingame (:
Here are the not working lua files:
item.lua
Code: Select all
data:extend(
{
{
type = "item",
name = "electric-pulverizor",
icon = "__MoreItems__\graphics\icons\electric-pulverizor.png",
flags = {"goes-to-quickbar"},
group = "production",
order = "h-b-a",
place-result = "electric-pulverizor",
stack-size = 64,
}
}
)
Code: Select all
Content Title
Cannot load lua script C:/Users\Jan\AppData\Roaming\Factorio\mods\MoreItems\data.lua. Error: error loading module 'prototypes.item.item' from file 'C:/Users\Jan\AppData\Roaming\Factorio\mods\MoreItems\prototypes\item\item.lua':
...Roaming\Factorio\mods\MoreItems\prototypes\item\item.lua:6: invalid escape sequence near '\g'
recipe.lua
Code: Select all
data:extend(
{
{
type = "recipe",
name = "electric-pulverizor",
enabled = "true",
ingredients = {
{"stone-furnace",1},
{"iron-plate",10},
{ "iron-gear-wheel",10},
{"electronic-circuit",4},
},
result = "electric-pulverizor"
},
}
)
Re: How can i add new items?
Actually I think that the following is counterproductive in terms of learning how to mod, but you are lucky that I have to learn for exams, but do not want to
So here is a working example:
So here is a working example:
Re: How can i add new items?
Thanks, Thanks, Thanksdrs9999 wrote:Actually I think that the following is counterproductive in terms of learning how to mod, but you are lucky that I have to learn for exams, but do not want to
So here is a working example:
And now i try the rest by myself (: