Post your modding questions here

wcwyes
Member
 
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Sat Nov 09, 2013 23:49

How do I check for hostile mobs around me?
 

mectus11
Member
 
Posts: 14
Joined: Tue Nov 12, 2013 21:32

by mectus11 » Fri Nov 15, 2013 12:06

How do I form a tree that contains my wood block and my leaf block?
Last edited by mectus11 on Fri Nov 15, 2013 12:12, edited 1 time in total.
Sup, I'm Fadi and you're reading this.
Main project
My mod
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Fri Nov 15, 2013 14:00

mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?


Search for tree in your minetest/doc/lua_api.txt fot the use of L-system trees.


Edit: Typo.
Last edited by Topywo on Fri Nov 15, 2013 14:01, edited 1 time in total.
 

mectus11
Member
 
Posts: 14
Joined: Tue Nov 12, 2013 21:32

by mectus11 » Fri Nov 15, 2013 15:13

Topywo wrote:
mectus11 wrote:How do I form a tree that contains my wood block and my leaf block?


Search for tree in your minetest/doc/lua_api.txt fot the use of L-system trees.


Edit: Typo.


Thank you, I was told this before by kaeza but he didn't really what to put in the tree definition before but I searched more and found it so thanks again, well I never asked him further more about it lol anyway ye thanks
Last edited by mectus11 on Fri Nov 15, 2013 15:14, edited 1 time in total.
Sup, I'm Fadi and you're reading this.
Main project
My mod
 

mectus11
Member
 
Posts: 14
Joined: Tue Nov 12, 2013 21:32

by mectus11 » Fri Nov 15, 2013 18:56

Can I put dibs on a mod idea?
I'm working on this great project and it would go to waste if someone finishes theirs that turns out to be the same concept as mine :/
Sup, I'm Fadi and you're reading this.
Main project
My mod
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Fri Nov 15, 2013 19:46

No you can't :) make it anyway and if in the unlikely event someone else makes something similar just make yours better.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
Gambit
Member
 
Posts: 452
Joined: Sat Oct 29, 2011 19:31

by Gambit » Fri Nov 15, 2013 21:46

What's a good way to generate cocoa in jungle trees? I've thought of generating them using the ore structure I'm not to sure that's the best option to choose. I need the cocoa to generate even if the tree was grown through sapling.

Also, what would be the best method for generating pumpkins at well?
Current Projects: MineToon | PixelBOX
Gambit's Checkmate Server - 43.65.296.232 - port: 30001
 

User avatar
Evergreen
Member
 
Posts: 2131
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Fri Nov 15, 2013 22:04

Gambit wrote:What's a good way to generate cocoa in jungle trees? I've thought of generating them using the ore structure I'm not to sure that's the best option to choose. I need the cocoa to generate even if the tree was grown through sapling.

Also, what would be the best method for generating pumpkins at well?
I'm not sure about the tree, but you can look at the grass spawning code for use in the pumpkins: https://github.com/minetest/minetest_game/blob/master/mods/default/mapgen.lua
Last edited by Evergreen on Fri Nov 15, 2013 22:05, edited 1 time in total.
"Help! I searched for a mod but I couldn't find it!"
http://krock-works.16mb.com/MTstuff/modSearch.php
 

User avatar
Chinchow
Member
 
Posts: 683
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Sat Nov 16, 2013 00:26

For some reason the plant for one of the new biomes won't grow and I can't figure out why. Could anyone more experienced tell me?

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
local function place_seed(itemstack, placer, pointed_thing, plantname)
    local pt = pointed_thing
    -- check if pointing at a node
    if not pt then
        return
    end
    if pt.type ~= "node" then
        return
    end
   
    local under = minetest.get_node(pt.under)
    local above = minetest.get_node(pt.above)
   
    -- return if any of the nodes is not registered
    if not minetest.registered_nodes[under.name] then
        return
    end
    if not minetest.registered_nodes[above.name] then
        return
    end
   
    -- check if pointing at the top of the node
    if pt.above.y ~= pt.under.y+1 then
        return
    end
   
    -- check if you can replace the node above the pointed node
    if not minetest.registered_nodes[above.name].buildable_to then
        return
    end

-- check if pointing at soil
    if minetest.get_item_group(under.name, "soil") <= 1 then
        return
    end

minetest.add_node(pt.above, {name=plantname})
    if not minetest.setting_getbool("creative_mode") then
        itemstack:take_item()
    end
    return itemstack
end


minetest.register_craftitem("ethereal:mushroom_craftingitem", {
    description = "Mushroom",
    groups = {not_in_creative_inventory=1},
    inventory_image = "mushroom.png",
    on_place = function(itemstack, placer, pointed_thing)
        return place_seed(itemstack, placer, pointed_thing, "ethereal:mushroom_garden_1")
    end,
})


for i=1,4 do
    local drop = {
        items = {
            {items = {'ethereal:mushroom'},rarity=9-i},
            {items = {'ethereal:mushroom 9'},rarity=18-i*2},
                    }
    }
minetest.register_node("ethereal:mushroom_garden_"..i, {
        drawtype = "plantlike",
        tiles = {"ethereal_mushroom_garden_"..i..".png"},
        paramtype = "light",
        walkable = false,
        drop = drop,
        buildable_to = true,
        is_ground_content = true,
        drop = drop,
        selection_box = {
            type = "fixed",
            fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
        },
        groups = {snappy=3,flammable=2,plant=1,mushroom=i,attached_node=1},
        sounds = default.node_sound_leaves_defaults(),
    })
end

minetest.register_abm({
    nodenames = {"group:mushroom"},
    neighbors = {"group:soil"},
    interval = 1,
    chance = 10000,
    action = function(pos, node)
        -- return if already full grown
        if minetest.get_item_group(node.name, "mushroom") == 4 then
            return
        end
       
        -- check if on wet soil
        pos.y = pos.y-1
        local n = minetest.get_node(pos)
        if minetest.get_item_group(n.name, "soil") < 3 then
            return
        end
        pos.y = pos.y+1
       
        -- check light
        if not minetest.get_node_light(pos) then
            return
        end
        if minetest.get_node_light(pos) < 13 then
            return
        end
       
        -- grow
        local height = minetest.get_item_group(node.name, "mushroom") + 1
        minetest.set_node(pos, {name="ethereal:mushroom_garden_"..height})
    end
})
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Sat Nov 16, 2013 10:54

Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.

chance = 10000,


Did you try it with a chance = 1 or 2?
 

User avatar
Chinchow
Member
 
Posts: 683
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Sat Nov 16, 2013 11:09

Topywo wrote:
Chinchow wrote:For some reason the plant for one of the new biomes won't grow and I can't figure out why.

chance = 10000,


Did you try it with a chance = 1 or 2?

Oops I forgot chances were inverted thank you.
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

by TenPlus1 » Mon Nov 18, 2013 09:38

How about a person protection block that when placed creates a 5x5 area around it where you cannot be hit, attacked or hurt (ideal for spawn areas until your game loads, or homes)... Of course make them hard to craft, maybe 8 diamond blocks and a mithril block in the centre, otherwise people's whole house will be filled with them...
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

by Casimir » Mon Nov 18, 2013 12:09

Can you somehow get pointed_thing for a given player? I don't mean "function(pointed_thing)", more like "pointed_thing = player.get_pointed_thing".
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Tue Nov 19, 2013 04:14

I realise this sounds derpy, but here goes.

I am trying to make my first mod. It is very simple, only adds two blocks. This is my code:
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
minetest.register_node("troll:troll", {
    tiles = {"troll:troll.png"},
    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
})
minetest.register_node("troll:derp", {
    tiles = {"troll:derp.png"},
    groups = {snappy=1,choppy=3,oddly_breakable_by_han=2,flmmable=1},
})


When I try to test it in my world, I get the following error:
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
22:03:08: ERROR[main]: generateImage(): Could not load image "troll:troll.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:troll.png"
22:03:08: ERROR[main]: generateImage(): Could not load image "troll:derp.png" while building texture
22:03:08: ERROR[main]: generateImage(): Creating a dummy image for "troll:derp.png"


I have the mod enabled and textures created for both blocks, and have them named "troll_troll" and "troll_derp". Could someone help me with this?

(P.S., this mod will not be released, just a little test to see if I can even make mods.)
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Tue Nov 19, 2013 06:41

tiles should be "troll_troll.png" not "troll:troll.png" etc :)
Last edited by paramat on Tue Nov 19, 2013 06:41, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Tue Nov 19, 2013 12:53

paramat wrote:tiles should be "troll_troll.png" not "troll:troll.png" etc :)


*WHAP* I don't know how I missed that. Thank you.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Wed Nov 20, 2013 01:39

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
chance = 10,
make it so that there is a 10% chance or a 90% chance?

*Edit* Okay, working on a real mod. I am trying to register craftitems, and here is my code:
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
minetest.register_craftitem("inlaid:inlaytool", {
    description = "Inlay tool",
    inventory_image = "inlaid_inlaytool.png",
})

minetest.register_craftitem("inlaid:chisel", {
    description = "Chisel",
    inventory_image = "inlaid_chisel.png",
})


and I get this error when I run it:
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
21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'


Can someone explain?
Last edited by Enke on Wed Nov 20, 2013 03:59, edited 1 time in total.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Wed Nov 20, 2013 05:48

It's the last comma in each item's definition. A comma is only there when there is more information to be placed in the definition. Try removing them and try again.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

by paramat » Wed Nov 20, 2013 06:10

No those last commas are fine and should not cause a problem. Can't see anything wrong in the code, might be an error outside the code you have pasted here.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Wed Nov 20, 2013 09:16

Enke wrote:[...] and I get this error when I run it:
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
21:52:48: ERROR[main]: ...minetest-0.4.7-5094a39-win32\bin\..\mods\inlaid\init.lua:15: unfinished string near '"inlaid_chisel.png,'


Can someone explain?


are you sure you posted the relevant part of your code? check line numbers again. The string quoted in the error message is indeed unfinished, and should be closed with and " before the comma.
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Wed Nov 20, 2013 13:08

This is all the code I have, and I have no clue why the error message says that the line is unfinished.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

User avatar
LionsDen
Member
 
Posts: 525
Joined: Thu Jun 06, 2013 03:19

by LionsDen » Wed Nov 20, 2013 17:57

Did you do a direct copy/paste of your code here? Because according to your error you are missing a quote mark " at the end of the line that has inlaid_chisel.png. Maybe while typing it in for the lua file your finger accidentally pressed 2 keys at once which causes some keyboards to send some other key code to the computer. It's very easy to do. I have found that sometimes the only way to fix that type of error is select the line around where the problem is and delete it and then retype it in.
 

jin_xi
Member
 
Posts: 165
Joined: Mon Jul 02, 2012 18:19

by jin_xi » Wed Nov 20, 2013 18:14

Enke wrote:This is all the code I have, and I have no clue why the error message says that the line is unfinished.


...

lol, sry to have bothered you
 

User avatar
Enke
Member
 
Posts: 469
Joined: Fri Nov 15, 2013 02:56
GitHub: NANOsoldierEnke
IRC: Enke
In-game: Enke

by Enke » Wed Nov 20, 2013 23:28

Wow, major derp.... the code I was fiddling with was my backup copy. It did need quote marks in the original code. Thanks guys.

Geez, a derp every day... I'm terribly sorry to have troubled you.
Last edited by Enke on Wed Nov 20, 2013 23:30, edited 1 time in total.
Lush8
ExtraVars for Red Eclipse

<Anarchid> my turn was still the most awesome, yielding all the cripples, two captured paranormals, and death rate of about 30%
<ORCACommander> Anarchid: you need to work harder
<ORCACommander> I am hereby putting you under review until you can increase the casualty rate
 

User avatar
hoodedice
Member
 
Posts: 1372
Joined: Sat Jul 06, 2013 06:33

by hoodedice » Thu Nov 21, 2013 06:52

Where is the code for the default inventory stored?
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
 

User avatar
Neon
Member
 
Posts: 119
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Thu Nov 21, 2013 21:21

I have an atmospheric node that seems to block the growth of trees. What would I need to set so trees will replace the node at the appropriate locations, rather than not grow at those locations?

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
minetest.register_node("luna:oxygen", {
        drawtype = "glasslike",
        tiles = {"atmos.png"},
        paramtype = "light",
        sunlight_propagates = true,
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        post_effect_color = {a=24, r=255, g=255, b=255},
        groups = {not_in_creative_inventory=1, air_like=1}
})
 

modsBr
New member
 
Posts: 1
Joined: Fri Nov 22, 2013 00:30

by modsBr » Fri Nov 22, 2013 00:37

how can I make my own mod?
 

User avatar
hoodedice
Member
 
Posts: 1372
Joined: Sat Jul 06, 2013 06:33

by hoodedice » Fri Nov 22, 2013 02:52

modsBr wrote:how can I make my own mod?


lua_api.txt
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build
 

User avatar
Neon
Member
 
Posts: 119
Joined: Thu Aug 15, 2013 02:03
In-game: Neon

by Neon » Sat Nov 23, 2013 00:14

Thank you HD, but I am already using air for something else.
 

User avatar
Dan Duncombe
Member
 
Posts: 904
Joined: Thu May 09, 2013 21:11

by Dan Duncombe » Sat Nov 23, 2013 00:19

Why not give it draw type air like?
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 13 guests

cron