Page 1 of 1
A problem with my mod
Posted: Sun Sep 09, 2012 04:28
by Josh
Ok so i created a simple mod. Iv'e done the init.lua file & everything else textures i have also done. But when i go to see if it works properly it says ModError failed to load & run. Why? im sure iv'e done everything right.
Posted: Sun Sep 09, 2012 04:31
by InfinityProject
Post your debug.
Posted: Sun Sep 09, 2012 04:36
by Josh
How?
Posted: Sun Sep 09, 2012 06:00
by sfan5
1. Delete debug.txt
2. Reproduce the Error
3. Paste Debug.txt to
http://pastie.org
4. Post the Link
Posted: Mon Sep 10, 2012 04:09
by Josh
This is what i have written in init.lua
minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},
Is there anything im missing?
Posted: Mon Sep 10, 2012 08:20
by Echo
where are the final brackets? Just to lazy to post or really missing? Please post the debug output.
Posted: Mon Sep 10, 2012 09:50
by Topywo
Josh wrote:This is what i have written in init.lua
minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},
Is there anything im missing?
I'm a beginner with LUA, so needed to read a bit. I hope experienced modders correct me whenever I'm wrong (I probably forgot something). Edit: found the first (edit: two --> three) errors myself.
I was busy making a longer answer, but then the electricity disappeared for half an hour and I lost everything :-/
Two helpfull links:
http://minetest.net/forum/viewtopic.php?id=1378
http://minetest.net/forum/viewtopic.php?id=2049
I certainly advice to peek into the init.lua of the default mod
1. If you want a nice decorative plant for your house, I don't think craftitem is going to help you. As far as I can see it is used for items with the only purpose to be used in crafting and with only an inventory image. Use node instead of craftitem.
2. Tile_images is deprecated, use: tiles
3. To use an image it needs to be in a textures folder. The names are slightly different from those used in the rest of LUA. Instead of the colon (:) you need to use the underscore(_) to seperate the modname from the item/node name.
So if you use decoplants:decoplant, your textures folder needs to contain decoplants
_decoplant.png and the line you use in init.lua is:
tiles={"
decoplants_decoplant.png"},
4. As far as I know you need to give a value to choppy in groups like this:
groups={choppy=3},
5. close with })
6. use two enters to create a whiteline for readability and then continue with minetest.register_craft etc..
7. output = '"decoplant" 4', --> use ' instead of " and ' and use the modname, like this:
output = 'decoplants:decoplant 4',
8. Try for your receipe the same as the default:sandstone and don't forget the end brackets. Sandstone's receipe is working for sure:
recipe = {
{'default:leaves', 'default:leaves'},
{'default:leaves', 'default:leaves'},
}
})
9. Great that you are trying to use LUA!
Posted: Tue Sep 11, 2012 02:00
by minecraft64
the crafting recepie is a separate line of code then the register; node, craft item, etc.
Posted: Tue Sep 11, 2012 03:28
by Josh
Topywo wrote:Josh wrote:This is what i have written in init.lua
minetest.register_craftitem("decoplants:decoplant", {
tile_images = {"decoplant.png"},
groups={choppy},minetest.register_craft({
output = '"decoplant" 4',
recipe = {
{'default:leaves', 'default:leaves', ''},
{'default:leaves', 'default:leaves', ''},
{'', '', ''},
Is there anything im missing?
I'm a beginner with LUA, so needed to read a bit. I hope experienced modders correct me whenever I'm wrong (I probably forgot something). Edit: found the first (edit: two --> three) errors myself.
I was busy making a longer answer, but then the electricity disappeared for half an hour and I lost everything :-/
Two helpfull links:
http://minetest.net/forum/viewtopic.php?id=1378
http://minetest.net/forum/viewtopic.php?id=2049
I certainly advice to peek into the init.lua of the default mod
1. If you want a nice decorative plant for your house, I don't think craftitem is going to help you. As far as I can see it is used for items with the only purpose to be used in crafting and with only an inventory image. Use node instead of craftitem.
2. Tile_images is deprecated, use: tiles
3. To use an image it needs to be in a textures folder. The names are slightly different from those used in the rest of LUA. Instead of the colon (:) you need to use the underscore(_) to seperate the modname from the item/node name.
So if you use decoplants:decoplant, your textures folder needs to contain decoplants
_decoplant.png and the line you use in init.lua is:
tiles={"
decoplants_decoplant.png"},
4. As far as I know you need to give a value to choppy in groups like this:
groups={choppy=3},
5. close with })
6. use two enters to create a whiteline for readability and then continue with minetest.register_craft etc..
7. output = '"decoplant" 4', --> use ' instead of " and ' and use the modname, like this:
output = 'decoplants:decoplant 4',
8. Try for your receipe the same as the default:sandstone and don't forget the end brackets. Sandstone's receipe is working for sure:
recipe = {
{'default:leaves', 'default:leaves'},
{'default:leaves', 'default:leaves'},
}
})
9. Great that you are trying to use LUA!
Thank's for helping me out Topywo.
Posted: Sat Sep 22, 2012 03:24
by Josh
Good news! i got my mod to work but when i choose it from creative mode it looks like this
https://dl.dropbox.com/u/102401091/scre ... 142873.png
It's not suppost to look like that all i want it to look like is junglegrass.
Posted: Sat Sep 22, 2012 03:50
by InfinityProject
Posted: Sat Sep 22, 2012 04:04
by Josh
Thank's InfinityProject it works! it now look's like this
https://dl.dropbox.com/u/102401091/scre ... 591842.png
Hooray iv'e officially created a mod. Only a few more change's & i will release it to everybody.
Posted: Sat Sep 22, 2012 06:54
by Aqua
Great job can't wait until release been waiting for something like this
Posted: Sun Sep 30, 2012 03:18
by Josh
I have created another mod this will add a sword! but before i release it i would like to know how i can get it to take away all of the players hearts?
Posted: Sun Sep 30, 2012 06:53
by Echo
out of lua_api.txt:
Code: Select all
- get_hp(): returns number of hitpoints (2 * number of hearts)
- set_hp(hp): set number of hitpoints (2 * number of hearts)
Posted: Tue Oct 09, 2012 02:47
by Josh
I am making a new mod that adds differen't types of buckets. These will do the same as normal buckets. Were do i start?
Posted: Tue Oct 09, 2012 03:27
by cornernote
start by making a new mod, and then paste this in the init.lua:
https://github.com/celeron55/minetest_g ... t/init.lua
Change "bucket" to "yourmod", and then do whatever you want to make it work the way you want.
Posted: Tue Oct 09, 2012 03:45
by Josh
Thanks. Ill see what i can do.