Page 9 of 169

Posted: Mon Apr 29, 2013 22:18
by Likwid H-Craft
So never? or maybe in later builds we can?

Posted: Mon Apr 29, 2013 22:19
by ch98
is it possible to have a modpack within a modpack?

Posted: Mon Apr 29, 2013 23:41
by Likwid H-Craft
I think so...

Btw I found out what Likwid Stands for!

Likwid: Like I know what I doing

Posted: Mon Apr 29, 2013 23:45
by ch98
PilzAdam wrote:
Likwid H-Craft wrote:Ok I am making somewhat a useful Mod but I don't know if possible do some stuff.

1.Is it possible make a item glow when holding it, like give off light?

2.How do change the light it give off something else? E.g. Blue Green...

Ok it a Official I tell you my mod I am making a Glow Stick It texture and most of it finish but the craft and such...
Neither of your questions is possible.
Is it also possible to make player glow? It might work that way.

Posted: Tue Apr 30, 2013 10:14
by PilzAdam
ch98 wrote:is it possible to have a modpack within a modpack?
No.
ch98 wrote:
PilzAdam wrote:
Likwid H-Craft wrote:Ok I am making somewhat a useful Mod but I don't know if possible do some stuff.

1.Is it possible make a item glow when holding it, like give off light?

2.How do change the light it give off something else? E.g. Blue Green...

Ok it a Official I tell you my mod I am making a Glow Stick It texture and most of it finish but the craft and such...
Neither of your questions is possible.
Is it also possible to make player glow? It might work that way.
No.

Posted: Tue Apr 30, 2013 20:06
by kpo
Franz wrote:Can anyone make a treeassist mod?
describtion: when you chop down a woodblock from a tree it will kill the complete tree and you get his items.

is it possible? :D
It is indeed possible. Take a look at the technic mod and add my chainsaw modifications to it.
http://forum.minetest.net/viewtopic.php ... 747#p86747

Posted: Tue Apr 30, 2013 22:09
by deivan
Likwid H-Craft, The walking light mod have a code similar of this description, but cause some delay when is operating...
-*-
Franz, the timber mod is doing it, and now the technic to.

Posted: Thu May 02, 2013 03:50
by ShadowNinja
PilzAdam wrote:
ch98 wrote:is it possible to have a modpack within a modpack?
No.
Actualy it is possible, as long as they all have a modpack.txt(I use this feature for organization).

Posted: Thu May 02, 2013 11:43
by Traxie21
It is also possible to have a mod turn into a modpack. That is how my AutoUpdater mod works.

Posted: Thu May 02, 2013 17:11
by pandaro
I tried to do something with minetest.register_on_joinplayer:
minetest.register_on_joinplayer(function(player)
print("hello")
minetest.env:place_node(player:getpos(),{name="default:stone"})

end)
is correctly printed "hello",but the node is not placed
What's wrong?

Posted: Thu May 02, 2013 18:26
by kaeza
pandaro wrote:I tried to do something with minetest.register_on_joinplayer:
minetest.register_on_joinplayer(function(player)
print("hello")
minetest.env:place_node(player:getpos(),{name="default:stone"})

end)
is correctly printed "hello",but the node is not placed
What's wrong?
For some reason, there are some things you can't do from this callback (at least when playing singleplayer).
A quick workaround would be:

Code: Select all

minetest.register_on_joinplayer(function(player)
  print("hello")
  minetest.after(0.1, function()
    minetest.env:place_node(player:getpos(),{name="default:stone"})
  end)
end)
Edit: I think it may be because the player has not "emerged" yet, but not sure. See what happens if you change print("hello") to print(dump(player:getpos()))

Posted: Thu May 02, 2013 19:17
by pandaro
kaeza thanks for your interest, I tried to call "player: GetPos ()" and the output is correct;
I tried, like you said, to call "place_node" after a bit of time but it still does not work.
Does anyone else have any ideas?

Posted: Thu May 02, 2013 20:00
by BlockMen
pandaro wrote:kaeza thanks for your interest, I tried to call "player: GetPos ()" and the output is correct;
I tried, like you said, to call "place_node" after a bit of time but it still does not work.
Does anyone else have any ideas?
I dont know why, but it works if you use "set_node()" instead of "place_node()"

Code: Select all

minetest.register_on_joinplayer(function(player)
  print("hello")
  minetest.after(0.1, function()
    minetest.env:set_node(player:getpos(),{name="default:stone"})
  end)
end)

Posted: Fri May 03, 2013 15:58
by 1244
Can I transfer metadata between nodes? For example I have got node "a" which have metadata "x" and I have node "b" which have metadata "x". Can I transfer "x" from node "a" to node "b"?

Posted: Fri May 03, 2013 16:05
by Nore
Use that:

Code: Select all

function copy_meta(pos1,pos2)
    local meta1 = minetest.env:get_meta(pos1)
    local meta = meta:to_table()
    local meta2 = minetest.env:get_meta(pos2)
    meta2:from_table(meta)
end

Posted: Sat May 04, 2013 13:08
by Excalibur Zero
Topic: How to create mob member at block?
Reason: I want to make a mod with a block that can be used to summon an enemy, and once it does so the block destroys its self.
More Info: I've tried to do it, but I couldn't figure it out.

Posted: Sat May 04, 2013 13:48
by jojoa1997
How would I make a tool do two functions using on_place

Posted: Sat May 04, 2013 13:54
by Traxie21
jojoa1997 wrote:How would I make a tool do two functions using on_place

Code: Select all

on_place = function(ARGS)
function1()

function2()
end
@ExcaliburZero: I know how, but I'm on a kindle and don't remember exactly.
Also, nice of you to read the first post and use correct formatting :3

Posted: Sat May 04, 2013 21:05
by Casimir
Casimir wrote:
12Me21 wrote:no I mean like only generating one mese block in the entire map
Look at the spawn of Minetest-Black.
That's what I came up with. The chanse to generate the node is very high, so it will be generated at the start of the world (that's what I want in this case).
There is the problem that the node can be removed by cavegen. I might have to use minetest.after, but that seems ugly to me.

Code: Select all

minetest.register_on_generated(function(minp, maxp, seed)
    local file = io.open(minetest.get_worldpath().."/wcc.txt", "r")
    if file then
        return
    end
    if maxp.y >= 2 and minp.y <= 0 then
    local pr = PseudoRandom(seed+1)
        local x = pr:next(minp.x, maxp.x)
        local z = pr:next(minp.z, maxp.z)
        -- Find ground level (0...15)
        local ground_y = nil
        for y=30,0,-1 do
            if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air"
            and minetest.env:get_node({x=x,y=y,z=z}).name ~= "default:leaves" 
            and minetest.env:get_node({x=x,y=y,z=z}).name ~= "default:jungleleaves" then
                ground_y = y
                break
            end
        end
    
        if ground_y then
            local p = {x=x,y=ground_y+1,z=z}
            local nn = minetest.env:get_node(p).name
            local nn_ground = minetest.env:get_node({x=x,y=ground_y,z=z}).name
            -- Check if the node can be replaced
            if minetest.registered_nodes[nn] and
            minetest.registered_nodes[nn].buildable_to and
            minetest.registered_nodes[nn_ground].walkable and
            nn_ground ~= "ignore" then
                minetest.env:set_node(p,{name="wcc:wcc"})
                local file = io.open(minetest.get_worldpath().."/wcc.txt", "w")
                file:write(minetest.pos_to_string(p))
                file:close()
                print("[wcc] !")
            end
        end
    end
end)

Posted: Sun May 05, 2013 16:45
by Excalibur Zero
Excalibur Zero wrote:Topic: How to create mob member at block?
Reason: I want to make a mod with a block that can be used to summon an enemy, and once it does so the block destroys its self.
More Info: I've tried to do it, but I couldn't figure it out.
I figured out how to do something like I wanted, where it creates an item which creates an enemy where it would be placed. I found the code in PilzAdam's mob mod. I'll add it here so that others can find it.

Code: Select all

minetest.register_craftitem("mobs:rat", {
    description = "Rat",
    inventory_image = "mobs_rat_inventory.png",
    
    on_place = function(itemstack, placer, pointed_thing)
        if pointed_thing.above then
            minetest.env:add_entity(pointed_thing.above, "mobs:rat")
            itemstack:take_item()
        end
        return itemstack
    end,
})

Posted: Sun May 05, 2013 17:48
by 12Me21
This seems like a stupid question with an obvious answer, but how do you make it so an abm will happen if a node is next to one type of node AND another type, like having an abm happen when a dirt block is next to a stone block AND a water source?

Posted: Mon May 06, 2013 15:58
by ShadowNinja
12Me21 wrote:This seems like a stupid question with an obvious answer, but how do you make it so an abm will happen if a node is next to one type of node AND another type, like having an abm happen when a dirt block is next to a stone block AND a water source?
Use find_nodes_in_area() and check the result.

Posted: Wed May 08, 2013 20:07
by pandaro
some questions about armor_groups:
as always I have some difficulty ...
I try to fully understand the damage system.

I tried to give a armor_groups like this:

"player: set_armor_groups ({fleshy = 1})"

this does not return any errors, GOOD, but...
if I hit the player with any sword, the player receives no damage: for the sword of wood, stone, iron, diamond. NO damage.
Then try to return the player to a level of 0 armor:

"player: set_armor_groups ({fleshy = 0})"

trying to hit him with a sword sword of wood, stone, iron, diamond get NO damage.
So I try to figure out what the armor level through:

"print (dump (player: get_armor_groups ()))"

But Minetest crashes and returns:
attempt to call method 'get_armor_groups' (a nil value)

The main question is:
how to handle armor_groups?
secondary question:
you can create alternative groups of damage? for example: phisical damage or elemental damage?

Thanks to anyone who can answer me

Posted: Wed May 08, 2013 20:31
by deivan
Is the percentage of the damage received no? Like 0 = 0% and 50 = 50%, correct?

Posted: Wed May 08, 2013 21:10
by PilzAdam
deivan wrote:Is the percentage of the damage received no? Like 0 = 0% and 50 = 50%, correct?
Yep.