Post your modding questions here

1244
Member
 
Posts: 45
Joined: Fri Jul 13, 2012 16:40
Location: Poland

by 1244 » Sun Apr 07, 2013 13:45

Thank you kaeza. It's working.
 

ashenk69
Member
 
Posts: 230
Joined: Tue Jul 03, 2012 00:08

by ashenk69 » Sun Apr 07, 2013 16:22

I've been trying to figure out how to get this one to work. I am trying to show another nodes inventory through another node's formspec. I get it to retrieve the inventory properly but I'm not sure how to set its size to display the grid.

Code: Select all
on_construct = function(pos)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("formspec",
                "size[8,9]"..
                "list[nodemeta:"..meta:get_int("x")..","..meta:get_int("y")..","..meta:get_int("z")..";source;0,0;8,4;]"..
                "list[current_player;main;0,5;8,4;]")
        meta:set_string("infotext", "Stockpile")
        --I'm not sure which list I'm supposed to set to get this to work
    end,
 

User avatar
Likwid H-Craft
Member
 
Posts: 1113
Joined: Sun Jan 06, 2013 14:20
Location: Lost in Crypt

by Likwid H-Craft » Sun Apr 07, 2013 20:48

Image
Ok you see the paper at, well that where I would like have the craft, 9 boxs at, but it didn't work so how do I make it work?
My Domain's/others:
http://likwidtest.hj.cx/ (Not Done)
 

oxenfreedan
Member
 
Posts: 218
Joined: Tue Jan 22, 2013 01:39
Location: mars

by oxenfreedan » Wed Apr 10, 2013 02:08

So... can someone post a Utube vid on how to make items move from one chest to another in the tecnic mod.
My Awesome Map please try:
http://forum.minetest.net/viewtopic.php?id=5028
I've played minetest since 0.3.1 came out!
Mostly when on forums I'm using a uniden tablet!
 

1244
Member
 
Posts: 45
Joined: Fri Jul 13, 2012 16:40
Location: Poland

by 1244 » Wed Apr 10, 2013 19:47

In which way I can get pseudo random number in minetest. I know method next() but if I do this:
Code: Select all
local i = next(0,100)

I have error.
 

User avatar
Calinou
Moderator
 
Posts: 3162
Joined: Mon Aug 01, 2011 14:26
Location: Troyes, France
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Wed Apr 10, 2013 20:15

Code: Select all
my_random_number = math.random(10, 100)

This generates a number between 10 and 100.
 

User avatar
quick.dudley
Member
 
Posts: 19
Joined: Fri Apr 12, 2013 09:35

by quick.dudley » Sun Apr 14, 2013 15:45

If a mod which affects map generation is added to an existing map, what happens?
 

Sokomine
Member
 
Posts: 3974
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

by Sokomine » Sun Apr 14, 2013 16:27

Newly generated map chunks will be generated with the mod in effect. Already existing map chunks will remain the same. Depending on how large your world is, you may have to go far out for the new mod to take effect.
A list of my mods can be found here.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Wed Apr 17, 2013 19:53

Hi, I'm back to this topic again. I'm making quartz from minecraft, and I want to know how to register ores, and how to make it as rare as iron. Also, I wanted to know what license the textures from minecraft are under.
Last edited by Evergreen on Wed Apr 17, 2013 19:59, edited 1 time in total.
Back from the dead!
 

User avatar
LionLAD
Member
 
Posts: 308
Joined: Wed Jul 11, 2012 21:50
Location: behind you

by LionLAD » Wed Apr 17, 2013 21:12

Evergreen wrote:Hi, I'm back to this topic again. I'm making quartz from minecraft, and I want to know how to register ores, and how to make it as rare as iron. Also, I wanted to know what license the textures from minecraft are under.



the code to register an ore in order for it to spawn at -*** or what ever you set it to and it's very lanthy one of the more complex codes in minetest
In game names:LAD,captainLAD,LionLAD
This is a signature virus. Add me to your signature so that I can multiply.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Wed Apr 17, 2013 21:22

There is a register ore function.
Back from the dead!
 

ch98
Member
 
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Thu Apr 18, 2013 01:51

I need help.
I need to take away coal from all 18box but I can from only 1st one.
code:
Code: Select all
local function placeNode(pos)
    local n = minetest.env:get_node(pos).name
      if (n == "air") then
    minetest.env:add_node(pos, {name="forcefield:forcefield"})
end
end


local function placeCubicShell(pos, sideLen)
   local s = math.floor(sideLen/2)
   for dx = -s, s do
      for dy = -s, s do
         placeNode({ x = pos.x + dx, y = pos.y + dy, z = pos.z - s })
         placeNode({ x = pos.x + dx, y = pos.y + dy, z = pos.z + s })
      end
   end
   for dy = -s, s do
      for dz = -s, s do
         placeNode({ x = pos.x - s, y = pos.y + dy, z = pos.z + dz })
         placeNode({ x = pos.x + s, y = pos.y + dy, z = pos.z + dz })
      end
   end
   for dz = -s, s do
      for dx = -s, s do
         placeNode({ x = pos.x + dx, y = pos.y - s, z = pos.z + dz })
         placeNode({ x = pos.x + dx, y = pos.y + s, z = pos.z + dz })
      end
   end
end



local function removeNode(pos)
      local n = minetest.env:get_node(pos).name
    if (n == "forcefield:forcefield") then
    minetest.env:add_node(pos, {name="air"})
end
end

local function removeCubicShell(pos, sideLen)
   local s = math.floor(sideLen/2)
   for dx = -s, s do
      for dy = -s, s do
         removeNode({ x = pos.x + dx, y = pos.y + dy, z = pos.z - s })
         removeNode({ x = pos.x + dx, y = pos.y + dy, z = pos.z + s })
      end
   end
   for dy = -s, s do
      for dz = -s, s do
         removeNode({ x = pos.x - s, y = pos.y + dy, z = pos.z + dz })
         removeNode({ x = pos.x + s, y = pos.y + dy, z = pos.z + dz })
      end
   end
   for dz = -s, s do
      for dx = -s, s do
         removeNode({ x = pos.x + dx, y = pos.y - s, z = pos.z + dz })
         removeNode({ x = pos.x + dx, y = pos.y + s, z = pos.z + dz })
      end
   end
end
















minetest.register_node("forcefield:forcefield", {
    tiles = {"forcefield_forcefield.png"},
    drawtype = glasslike,
    sunlight_propagates = true,
    walkable = true,
    diggable = false,
    damage_per_second = 4,
    on_punch = function(pos, node, puncher)
        punch = 1
    end,
    on_construct = function(pos)
        fpos = minetest.env:find_node_near(pos, 10, "forcefield:fmaker")
        local meta1 = minetest.env:get_meta(pos)
        local meta2 = minetest.env:get_meta(fpos)
        local fgen = 1
    end,
})

minetest.register_abm({
    nodenames = {"forcefield:forcefield"},
    interval = 1,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        if  minetest.env:find_node_near(pos, 6, "forcefield:fmaker") == nil then
        minetest.env:add_node(pos, {name="air"})
        end
    end,
})

default.forcefield_formspec =
    "size[8,9]"..
    "list[current_name;coal;2,1;6,3;]"..
    "list[current_player;main;0,5;8,4;]"..
    "field[0,3;2,1;range;range;4]"..
    "button_exit[0,1;2,1;exit;exit]"


minetest.register_node("forcefield:fmaker", {
    description = "Forcefield Generator",
    tiles = {"forcefield_sides.png","forcefield_sides.png","forcefield_front.png","forcefield_sides.png","forcefield_sides.png","forcefield_sides.png"},
    groups = {snappy=2, choppy=2},   
    after_place_node = function(pos, placer)
        local meta = minetest.env:get_meta(pos)
        if fgens then
        table.insert (fgens  , 0)
        meta:set_string("fgen", table.getn (fgens) )
        else
        fgens = {0}
        table.insert (fgens  , 0)
        meta:set_string("fgen", table.getn (fgens))
    end
        meta:set_string("owner", placer:get_player_name() or "")
        meta:set_string("infotext", "Locked Chest (owned by "..meta:get_string("owner").."   #"..meta:get_string("fgen")..")")
    end,
    on_construct = function(pos)
        local meta = minetest.env:get_meta(pos)
        meta:set_string("formspec", default.forcefield_formspec)
        meta:set_string("infotext", "forcefield generator")
        local inv = meta:get_inventory()
        inv:set_size("coal", 18)
    end,

    can_dig = function(pos,player)
        local meta = minetest.env:get_meta(pos);
        local inv = meta:get_inventory()
        if not inv:is_empty("coal", 18) then
            return false
        end
        return true
    end,
 
})




minetest.register_abm({
    nodenames = {"forcefield:fmaker"},
    interval = 1,
    chance = 1,
    action = function(pos, node, active_object_count, active_object_count_wider)
        local meta = minetest.env:get_meta(pos)
        local inv = meta:get_inventory()
        local coallist = inv:get_list("coal")
            if inv:contains_item("coal", "default:coal_lump") then
            coalstack = inv:get_stack("coal", 1)
                    coalstack:take_item()
                    inv:set_stack("coal", 1, coalstack)
                placeCubicShell(pos, 10)
                else
                removeCubicShell(pos, 10)   
        end
            if fgens[meta:get_string("fgen")] >= 1 then
                coalstack = inv:get_stack("coal", 1)
                    coalstack:take_item()
                    inv:set_stack("coal", 1, coalstack)
                    fgens[meta:get_string("fgen")] = 0
        end

    end,
})


minetest.register_craft({
    output = 'forcefield:fmaker',
    recipe = {
        {'default:mese', 'default:mese', 'default:mese'},
        {'default:mese', 'default:furnace', 'default:mese'},
        {'default:mese', 'default:mese', 'default:mese'},
    }
})





part with taking coal is

Code: Select all
                 coalstack = inv:get_stack("coal", 1)
                    coalstack:take_item()
                    inv:set_stack("coal", 1, coalstack)         

I need this for my forcefield mod
Last edited by ch98 on Thu Apr 18, 2013 04:49, edited 1 time in total.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
 

ch98
Member
 
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Thu Apr 18, 2013 02:00

also, is it possible to save table like data after server restart?
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48
Location: McKinney, Texas U.S.A.
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Thu Apr 18, 2013 13:02

Ignore my previous question, I figured it out.
Back from the dead!
 

ch98
Member
 
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Thu Apr 18, 2013 14:46

Traxie21 wrote:write it to a file^

how?
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
 

User avatar
12Me21
Member
 
Posts: 873
Joined: Tue Mar 05, 2013 00:36
Location: (Ignore all of my posts before 2018)
GitHub: 12Me21

by 12Me21 » Fri Apr 19, 2013 18:47

Is it possible to only have one of a certain type of node generate in the entire map?
Shoutouts to Simpleflips
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48
Location: McKinney, Texas U.S.A.

by Traxie21 » Sat Apr 20, 2013 01:32

I could use some help with a timer for a HUD. I need to be able to remove one thing each second,
but I always get ERROR: Nil value, with no code indicator or anything. All variables seem valid.

HELP!

Code: Select all
local player = user

                local function timer(player, str)
                    if cntdown < 1 then
                        user:hud_remove(0)
                        user:hud_remove(1)
                        user:hud_remove(2)
                        user:hud_remove(3)
                    else
                        cntdown = cntdown-1
                        length1 = cntdown+str:len()
                        player:hud_change(0, number, length1*2+1)
                        local tbl = {player, str}
                        minetest.after(1, function(param)
                            timer(param.player, param.str)
                        end, tbl)               
                    end
                end
                timer(user, iname)
 

User avatar
RealBadAngel
Member
 
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Sat Apr 20, 2013 02:03

Traxie21 wrote:I could use some help with a timer for a HUD. I need to be able to remove one thing each second,
but I always get ERROR: Nil value, with no code indicator or anything. All variables seem valid.

HELP!

Code: Select all
local player = user

                local function timer(player, str)
                    if cntdown < 1 then
                        user:hud_remove(0)
                        user:hud_remove(1)
                        user:hud_remove(2)
                        user:hud_remove(3)
                    else
                        cntdown = cntdown-1
                        length1 = cntdown+str:len()
                        player:hud_change(0, number, length1*2+1)
                        local tbl = {player, str}
                        minetest.after(1, function(param)
                            timer(param.player, param.str)
                        end, tbl)               
                    end
                end
                timer(user, iname)


so where is cntdown initialized?
 

User avatar
ShadowNinja
Developer
 
Posts: 199
Joined: Tue Jan 22, 2013 22:35
GitHub: ShadowNinja
IRC: ShadowNinja
In-game: ShadowNinja

by ShadowNinja » Sat Apr 20, 2013 05:49

ch98 wrote:
Traxie21 wrote:write it to a file^

how?


Untested:
Code: Select all
function save(mytable, filename)
    file, error = io.open(filename, "w")
    if error then return error end
    file:write(minetest.serialize(mytable))
    file:close()
end

function load(filename)
    file, error = io.open(filename, "r")
    if error then return error end
    local mytable = minetest.deserialize(file:read("*a"))
    file:close()
    return mytable
end


Edit: added arguments, avoided overwriting the Lua "table" table.
Last edited by ShadowNinja on Sat Apr 20, 2013 22:10, edited 1 time in total.
The best way to contact me is usually IRC (InchraNet, freenode).
 

User avatar
BlockMen
Developer
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen

by BlockMen » Sat Apr 20, 2013 08:53

Traxie21 wrote:I could use some help with a timer for a HUD. I need to be able to remove one thing each second,
but I always get ERROR: Nil value, with no code indicator or anything. All variables seem valid.

HELP!




Code: Select all
local max = 8 --max items to remove
local function timer(cnt, player)
    if cnt <= max then
        minetest.chat_send_all("remove hud item " .. cnt.. " from " ..player:get_player_name())  --removing
        minetest.after(1, timer, cnt+1, player)
    else
        minetest.chat_send_all("all " ..max.. "items are removed. now do want ever you want :P")       
    end
end


start the timer with
Code: Select all
timer(0, player) --or another number
 

User avatar
Traxie21
Member
 
Posts: 753
Joined: Mon Dec 31, 2012 10:48
Location: McKinney, Texas U.S.A.

by Traxie21 » Sat Apr 20, 2013 13:37

Will test blockmen.
RBA: its a local just above that code. it's usually equal to 60
 

User avatar
Evergreen
Member
 
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
Location: A forest in the midwest
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen

by Evergreen » Sat Apr 20, 2013 19:11

Can someone fully explain the API for minetest.register_tool? The wiki article isn't complete.
Back from the dead!
 

ch98
Member
 
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Sun Apr 21, 2013 01:17

Shadow wrote:
ch98 wrote:
Traxie21 wrote:write it to a file^

how?


Untested:
Code: Select all
function save(mytable, filename)
    file, error = io.open(filename, "w")
    if error then return error end
    file:write(minetest.serialize(mytable))
    file:close()
end

function load(filename)
    file, error = io.open(filename, "r")
    if error then return error end
    local mytable = minetest.deserialize(file:read("*a"))
    file:close()
    return mytable
end


Edit: added arguments, avoided overwriting the Lua "table" table.



Thank you. I will try that.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.
 

User avatar
Zsoltisawesome
Member
 
Posts: 180
Joined: Sun Dec 18, 2011 18:07
Location: Utah, USA
GitHub: YellowberryHN
IRC: YellowberryHN
In-game: YellowberryHN

by Zsoltisawesome » Mon Apr 22, 2013 19:51

Hey, How Do You Define An Entity?
Check Out Moontest! http://hnss.gq/moontest
Buddies: Likwid H-Craft, 0gb.us, Death, Starfellow, asie, and many more!
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: MSN [Bot] and 1 guest