Post your modding questions here

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Thu Jun 23, 2016 18:48

darkflamez wrote:I would like to know on how should I start modding the game since I am a newbie. Also I have read a few tutorials on the game but I am still not clear.

I would also like to know on how some of the modders on this forum got started.


If you have enough programming experience in Lua or a similar language, you can come up with a mod idea that interests you and write it while referencing lua_api.txt.
Every time a mod API is left undocumented, a koala dies.
 

darkflamez
New member
 
Posts: 4
Joined: Wed Jun 22, 2016 21:15

Re: Post your modding questions here

by darkflamez » Thu Jun 23, 2016 19:27

Thank you guys for your suggestions.

I will look in to all of them :)
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Thu Jun 23, 2016 21:31

While playing around with the default:furnace code, I have discovered a curious fact - no type of 'processing' node - eg. furnace, workbench, claycrafter - can have more than 1 input (source) item. Is this a limitation of the engine, or was the code deliberately restricted for some reason?
 

red-001
Member
 
Posts: 126
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001

Re: Post your modding questions here

by red-001 » Thu Jun 23, 2016 22:10

KCoombes wrote:While playing around with the default:furnace code, I have discovered a curious fact - no type of 'processing' node - eg. furnace, workbench, claycrafter - can have more than 1 input (source) item. Is this a limitation of the engine, or was the code deliberately restricted for some reason?


Then lua code was just written that way.
 

darkflamez
New member
 
Posts: 4
Joined: Wed Jun 22, 2016 21:15

Re: Post your modding questions here

by darkflamez » Thu Jun 23, 2016 22:35

Byakuren wrote:
darkflamez wrote:I would like to know on ... with a mod idea that interests you and write it while referencing lua_api.txt.


Where is the lua_api.txt
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Thu Jun 23, 2016 22:42

darkflamez wrote:
Byakuren wrote:
darkflamez wrote:I would like to know on ... with a mod idea that interests you and write it while referencing lua_api.txt.


Where is the lua_api.txt


https://github.com/minetest/minetest/blob/master/doc/lua_api.txt
 

darkflamez
New member
 
Posts: 4
Joined: Wed Jun 22, 2016 21:15

Re: Post your modding questions here

by darkflamez » Thu Jun 23, 2016 23:20

Thanks KCoombes
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Fri Jun 24, 2016 06:40

l tried to make the furnace work when it's unloaded, can you tell me if l did mistakes?
https://github.com/HybridDog/minetest_g ... urnace.lua
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Mon Jun 27, 2016 20:50

This code (from the Lua Modding API Reference) does not function correctly. Any ideas?

drop = {
max_items = 1, -- Maximum number of items to drop.
items = { -- Choose max_items randomly from this list.
{
items = {"foo:bar", "baz:frob"}, -- Choose one item randomly from this list.
rarity = 1, -- Probability of getting is 1 / rarity.
},
},
},
As written, the node is dropping 1 of each item in the list, not 1 random item in the list.
 

User avatar
pithy
Member
 
Posts: 252
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Mon Jun 27, 2016 21:13

Is there a way to have world specific textures?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Mon Jun 27, 2016 23:30

KCoombes wrote:This code (from the Lua Modding API Reference) does not function correctly. Any ideas?

drop = {
max_items = 1, -- Maximum number of items to drop.
items = { -- Choose max_items randomly from this list.
{
items = {"foo:bar", "baz:frob"}, -- Choose one item randomly from this list.
rarity = 1, -- Probability of getting is 1 / rarity.
},
},
},
As written, the node is dropping 1 of each item in the list, not 1 random item in the list.

I could be wrong but I think your rarity needs to be higher.
Here is an example from one of my mods.
https://github.com/DonBatman/mytreasure ... nd.lua#L27
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Tue Jun 28, 2016 00:06

Don wrote:
KCoombes wrote:-snip-

I could be wrong but I think your rarity needs to be higher.
Here is an example from one of my mods.
https://github.com/DonBatman/mytreasure ... nd.lua#L27


Your example was exactly what I needed to see! The node is now dropping correctly, except.. (you saw that coming, right?) I have 6 possible items, so I set rarity = 6 (rarity being 1/rarity value) to ensure 1 of the 6 will drop every time - except out of 10 trials, I ended with only 8 drops - have you encountered this? Max_items = 1, for this.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Tue Jun 28, 2016 00:17

KCoombes wrote:
Your example was exactly what I needed to see! The node is now dropping correctly, except.. (you saw that coming, right?) I have 6 possible items, so I set rarity = 6 (rarity being 1/rarity value) to ensure 1 of the 6 will drop every time - except out of 10 trials, I ended with only 8 drops - have you encountered this? Max_items = 1, for this.

I never noticed it happen. Doesn't mean that it hasn't happened though. If it keeps happening then it might be something you should put in the bug forum.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Nightmare_LP
Member
 
Posts: 15
Joined: Fri May 27, 2016 13:31
GitHub: NightmareLP
In-game: Useless

Re: Post your modding questions here

by Nightmare_LP » Tue Jun 28, 2016 16:24

How do I make a biome?
I have tried many ways I found on the Internet bur nothing seems to work. Can anyone help me? And sorry if this has been asked before but I need help.
My english is not perfect!
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

by Hybrid Dog » Tue Jun 28, 2016 18:48

drop = {
max_items = 1,
items = {
{
items = {"default:diamond"},
rarity = 2,
},
{
items = {"default:mese_crystal"},
rarity = 2,
},
}
}

l think this code does this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if math.random(2) == 1 then
return "default:diamond"
end
if math.random(2) == 1 then
return "default:mese_crystal"
end

But you want to make it do this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if math.random(2) == 1 then
return "default:diamond"
else
return "default:mese_crystal"
end


l think if you keep the simple code, the behaviour is similar to the abm behaviour

so instead of this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
drop = {
   max_items = 1,
   items = {
      {
         items = {"default:diamond"},
         rarity = 3,
      },
      {
         items = {"default:mese_crystal"},
         rarity = 3,
      },
      {
         items = {"default:mese"},
         rarity = 3,
      },
   }
}


try this
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
drop = {
   max_items = 1,
   items = {
      {
         items = {
            {
               items = {"default:mese"},
               rarity = 2,
            },
            {
               items = {"default:diamond"},
               rarity = 1,
            },
         },
         rarity = 3/2,
      },
      {
         items = {"default:mese_crystal"},
         rarity = 1,
      },
   }
}


and so on

note that l don't know if it works
Attachments
Unbenannt.png
Unbenannt.png (24.29 KiB) Viewed 2975 times
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Tue Jun 28, 2016 21:08

Nightmare_LP wrote:How do I make a biome?
I have tried many ways I found on the Internet bur nothing seems to work. Can anyone help me? And sorry if this has been asked before but I need help.


Look at the mapgen.lua file in the default minetest_game mods/default folder for example of the vanilla game's biome structure. Duplicate that code, changing what you want. Save as "mapgen.lua" in a folder "myworld" (that's the name of your mod, btw) then start a new world and enable your mod.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: Post your modding questions here

by TumeniNodes » Tue Jun 28, 2016 21:42

KCoombes wrote:
Nightmare_LP wrote:How do I make a biome?
I have tried many ways I found on the Internet bur nothing seems to work. Can anyone help me? And sorry if this has been asked before but I need help.


Look at the mapgen.lua file in the default minetest_game mods/default folder for example of the vanilla game's biome structure. Duplicate that code, changing what you want. Save as "mapgen.lua" in a folder "myworld" (that's the name of your mod, btw) then start a new world and enable your mod.


Yes, definitely DO NOT ever forget to save a backup copy of the original. That is the most important step. : )
Also, make a backup of your changed file because, if an update comes from Minetest..., it will overwrite your custom work. ; )
Flick?... Flick who?
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Wed Jun 29, 2016 14:43

Ok, new problem (I solved the previous problem of non-loading biomes):

All nodes registered
All biomes registered
All decorations registered
Start new map... biomes generate properly, decorations generate properly.... and the default flowers generate as well (debug shows that default:flowers.lua loads after my file)...

How to stop the default flowers from generating in this particular world (short of removing the file, as it's used by other mods in use on other worlds)?
Last edited by KCoombes on Thu Jun 30, 2016 00:44, edited 1 time in total.
 

222
New member
 
Posts: 4
Joined: Thu Mar 24, 2016 03:35

Re: Post your modding questions here

by 222 » Wed Jun 29, 2016 18:49

I was hoping to write recipes for TumeniNodes' angledstairs mod; I was wondering if there was an easier way to write it without listing every single variant.

I saw how 'stairs' has one recipe with 'subname' and "recipeitem" but I don't understand how it works.
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Thu Jun 30, 2016 16:12

Continuation of my previous question:

[img]
screenshot_20160630_115625.png
[/img]

The lighter colored dirt/grass block is my own texture, aliased to replace default textures (which doesn't work as intended), and every node used in my custom biomes uses the custom texture correctly, but the default biomes continue to use the default textures.

Obviously I'm not registering the alias in the correct place, but I can't see to work out where/how to fix this. And yes, I continue to get this error in debug.txt: 2016-06-30 11:52:52: WARNING[Main]: Not registering alias, item with same name is already defined: default:dirt -> custom:dirt
Attachments
screenshot_20160630_115625.png
screenshot_20160630_115625.png (351 KiB) Viewed 2975 times
 

User avatar
Nightmare_LP
Member
 
Posts: 15
Joined: Fri May 27, 2016 13:31
GitHub: NightmareLP
In-game: Useless

Re: Post your modding questions here

by Nightmare_LP » Thu Jun 30, 2016 17:27

KCoombes wrote:Look at the mapgen.lua file in the default minetest_game mods/default folder for example of the vanilla game's biome structure. Duplicate that code, changing what you want. Save as "mapgen.lua" in a folder "myworld" (that's the name of your mod, btw) then start a new world and enable your mod.


Thank you for the advice. But where is this myworld folder suppose to be? I don't know.
My english is not perfect!
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Thu Jun 30, 2016 19:35

Nightmare_LP wrote:
KCoombes wrote:Look at the mapgen.lua file in the default minetest_game mods/default folder for example of the vanilla game's biome structure. Duplicate that code, changing what you want. Save as "mapgen.lua" in a folder "myworld" (that's the name of your mod, btw) then start a new world and enable your mod.


Thank you for the advice. But where is this myworld folder suppose to be? I don't know.


Create a folder called "myworld" in your mods folder.
 

isaiah658
Member
 
Posts: 14
Joined: Sun Jan 24, 2016 14:58

Re: Post your modding questions here

by isaiah658 » Thu Jun 30, 2016 23:17

Topic: Allow breaking a node by hand but only give drops if broken by proper tool?

Edit: Solved. A tool can apparently be defined in the drop of a node. You then just need to make sure the hand is able to break that node.
Last edited by isaiah658 on Fri Jul 01, 2016 15:05, edited 1 time in total.
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: Post your modding questions here

by KCoombes » Thu Jun 30, 2016 23:31

Solved, thanks.
Last edited by KCoombes on Fri Jul 01, 2016 01:10, edited 1 time in total.
 

DoyleChris
Member
 
Posts: 176
Joined: Sat Jul 25, 2015 19:54
In-game: DoyleChris

Re: Post your modding questions here

by DoyleChris » Fri Jul 01, 2016 00:55

Trying to create a recipe to make a modified battery from technic.

the original recipe is this.

minetest.register_craft({
output = 'technic:battery',
recipe = {
{'group:wood', 'default:copper_ingot', 'group:wood'},
{'group:wood', 'moreores:tin_ingot', 'group:wood'},
{'group:wood', 'default:copper_ingot', 'group:wood'},
}
})

I would like to make 9 batteryies by changing the recipe to this

minetest.register_craft({
output = 'technic:battery 9',
recipe = {
{'group:wood 9', 'default:copperblock', 'group:wood 9'},
{'group:wood 9', 'moreores:tin_block', 'group:wood 9'},
{'group:wood 9', 'default:copperblock', 'group:wood 9'},
}
})

But whn i add the 9's to the recipe it dosent work.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Fri Jul 01, 2016 09:50

How can I calculate yaw from a vector?
 

User avatar
Naj
Member
 
Posts: 170
Joined: Sat Sep 19, 2015 21:14
GitHub: pyrollo
In-game: naj

Re: Post your modding questions here

by Naj » Fri Jul 01, 2016 10:07

DoyleChris wrote:But whn i add the 9's to the recipe it dosent work.


Because receipes do not use quantity. When a reciepe needs two or more items, they appear separately in the receipe, never stacked.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: Post your modding questions here

by burli » Fri Jul 01, 2016 12:37

burli wrote:How can I calculate yaw from a vector?


I guess atan2(x,z). Is that right?
 

isaiah658
Member
 
Posts: 14
Joined: Sun Jan 24, 2016 14:58

Re: Post your modding questions here

by isaiah658 » Fri Jul 01, 2016 20:14

Topic: Is it possible to change the font color in a textarea in a formspec?
Reason: I'm trying to change how the default formspec looks for a book and I wanted the font color to be something other than white to make it easier to read.
 

teh_newbz
New member
 
Posts: 3
Joined: Sat Jul 02, 2016 10:48

Re: Post your modding questions here

by teh_newbz » Sat Jul 02, 2016 10:58

Why is player:getpos() returning nil? Whenever I try to use player:getpos() the game crashes with `attempt to call getpos a nil value`

The code

minetest.register_craftitem("magic_mod:summon_monster_stone", {
description = "Summon a stone monster",
inventory_image = "magic_mod_summon_sword.png",
on_use = function(player)
local p = player:getpos()
minetest.spawn_tree(p, treedef)
end})


If I move local `p = player:getpos()` outside of the function I get `attempt to index global player (a nil value)
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 14 guests

cron