Post your modding questions here

Nubm
Member
 
Posts: 20
Joined: Thu Nov 20, 2014 09:33

Re: Post your modding questions here

by Nubm » Sat May 16, 2015 04:50

I moved the last brdige node to the front and it worked. However, the selction box seems not to adjust. I set it from -,5 to 3.5 in lenght to -1.5 to 2.5, but it still shows the old selection.
Also, i've split the bridge into multiple nodes that can be placed seperately (image attached). One advantage is that the nodes can be placed in two directions, resulting in even more variations on longer bridges.
However, its pretty confusing since the bridge parts look very similar. I could add a number to the inventory image, but i rather have a single block (or tool maybe) that will place one of the nodes at random, and returns the block back to one node if digged. Is it even possible? Its fairly simple with images (for example grass uses this) but can i do it somehow with nodebox blocks?
Attachments
minetest_bridge_02.jpg
minetest_bridge_02.jpg (466.43 KiB) Viewed 3717 times
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: Post your modding questions here

by srifqi » Sun May 17, 2015 12:24

Nubm wrote:However, its pretty confusing since the bridge parts look very similar. I could add a number to the inventory image, but i rather have a single block (or tool maybe) that will place one of the nodes at random, and returns the block back to one node if digged. Is it even possible? Its fairly simple with images (for example grass uses this) but can i do it somehow with nodebox blocks?

What you need is on_place function and drop value (for example: grass)
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

Nubm
Member
 
Posts: 20
Joined: Thu Nov 20, 2014 09:33

Re: Post your modding questions here

by Nubm » Sun May 17, 2015 12:40

Wow, that was easy. Thank you so very very much!
Works perfect. :)
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: Post your modding questions here

by srifqi » Sun May 17, 2015 12:48

Nubm wrote:Wow, that was easy. Thank you so very very much!
Works perfect. :)

You are welcome. Do not be shy to ask! Happy play - ehm - modding!
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

Nubm
Member
 
Posts: 20
Joined: Thu Nov 20, 2014 09:33

Re: Post your modding questions here

by Nubm » Sun May 17, 2015 13:18

Well, there is one question to finalize my plank bridge: Can i rotate the placed tile at random (coin flip) on the z axis? This would double the variations. Not that i really need those since the planks look pretty similar, but i have some more ideas how to put that to use. :)
However, im not sure if it is possible to rotate tiles like that on place.

Also, just as an idea, could i create a block that randomly selects one of five nodes (like the bridge parts) and selects a random texture out of five as well? That should result in 25 unique blocks out of 5 registered nodes and 5 textures, does it? That could be great for objects like stones or maybe bushes or other plants.
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: Post your modding questions here

by srifqi » Sun May 17, 2015 13:50

Nubm wrote:Well, there is one question to finalize my plank bridge: Can i rotate the placed tile at random (coin flip) on the z axis? This would double the variations. Not that i really need those since the planks look pretty similar, but i have some more ideas how to put that to use. :)
However, im not sure if it is possible to rotate tiles like that on place.

To do coin flip you must register another node with flipped nodeboxes (as you mention before). Because if you only do coin flip, the bridge will be floating above the block below.

Nubm wrote:Also, just as an idea, could i create a block that randomly selects one of five nodes (like the bridge parts) and selects a random texture out of five as well? That should result in 25 unique blocks out of 5 registered nodes and 5 textures, does it? That could be great for objects like stones or maybe bushes or other plants.

Nice idea! You may register more node ("b:ridge_1_1","b:ridge_1_2").
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

Nubm
Member
 
Posts: 20
Joined: Thu Nov 20, 2014 09:33

Re: Post your modding questions here

by Nubm » Sun May 17, 2015 14:20

srifqi wrote:To do coin flip you must register another node with flipped nodeboxes (as you mention before). Because if you only do coin flip, the bridge will be floating above the block below.


Sorry, my bad. English isn't my native language. I meant coin flip as a chance (50%), not to flip the nodes like a coin. :p
For example, the bridge parts will all face in the same direction if i place them while walking backwards. If some of them could be facing randomly in the direction of the player instead, it would somewhat look like as if there are 10 different types of bridge parts. Would be most noticable on the one part that has a missing plank.

srifqi wrote:Nice idea! You may register more node ("b:ridge_1_1","b:ridge_1_2").


That looks like an array, didn't know it is possible so easy. Thats not what i had in mind, but very useful to know. I have to do some research how to build multiple nodes at once and link them together, an array with random tile or texture selection could also be pretty useful. Or maybe it can be used to store complete objects like houses that can be placed and randomized on certain dimensions.Thanks for the input! :)
 

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

Re: Post your modding questions here

by LionsDen » Sun May 17, 2015 16:58

Unless there have been engine changes, when you register a node you have to tell it what texture(s) are being used. There is currently no way to change those textures afterwards. You are unfortunately limited to whatever node you register. So if you want 25 different textured nodes, you have to register 25 nodes. The only possible difference I have heard of is the colorization ability which can change the colors (I think). I haven't played with that but I think there are a few mods out there that do and you could possibly find and learn about from them.
 

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

Re: Post your modding questions here

by Sokomine » Tue May 19, 2015 04:05

Nubm wrote:Well, there is one question to finalize my plank bridge: Can i rotate the placed tile at random (coin flip) on the z axis? This would double the variations. Not that i really need those since the planks look pretty similar, but i have some more ideas how to put that to use. :)
However, im not sure if it is possible to rotate tiles like that on place.

The way your bridge looks, you could rotate some parts randomly by 180 degrees if that's what you've got in mind. That would require a diffrent param2. Other than that, if you want a diffrent texture, you need to register a new node.

Maybe you'll also be intrested in my bridges and handrail mod. It has a self-building bridge.

I'm looking forward to see your mod released.
A list of my mods can be found here.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Tue May 19, 2015 04:38

LionsDen wrote:Unless there have been engine changes, when you register a node you have to tell it what texture(s) are being used. There is currently no way to change those textures afterwards. You are unfortunately limited to whatever node you register. So if you want 25 different textured nodes, you have to register 25 nodes. The only possible difference I have heard of is the colorization ability which can change the colors (I think). I haven't played with that but I think there are a few mods out there that do and you could possibly find and learn about from them.

Different colors can use a texture specification to share the same base texture image (e.g. file name), but they are still different textures and must be applied to different registered nodes. It's commonly done in a loop with a template pattern for the name (e.g. "mymod:thing_red", "mymod:thing_blue", etc.).
 

Nubm
Member
 
Posts: 20
Joined: Thu Nov 20, 2014 09:33

Re: Post your modding questions here

by Nubm » Tue May 19, 2015 06:24

LionsDen wrote:Unless there have been engine changes, when you register a node you have to tell it what texture(s) are being used. There is currently no way to change those textures afterwards. You are unfortunately limited to whatever node you register. So if you want 25 different textured nodes, you have to register 25 nodes. The only possible difference I have heard of is the colorization ability which can change the colors (I think). I haven't played with that but I think there are a few mods out there that do and you could possibly find and learn about from them.


Well, im a Newb. Its sometimes (pretty often) hard to understand whats possible and whats not. Was just an idea with the different textures, too bad that it can't be done without additional node registrations.
However, i just red the ToDo list posted in the L-Shape tree list, which includes a possible color value for param2. That would be great for different kind of similar materials, like stones and wood. I'll try to check some mobs for that color thing. :)

Sokomine wrote:
Nubm wrote:Well, there is one question to finalize my plank bridge: Can i rotate the placed tile at random (coin flip) on the z axis? This would double the variations. Not that i really need those since the planks look pretty similar, but i have some more ideas how to put that to use. :)
However, im not sure if it is possible to rotate tiles like that on place.

The way your bridge looks, you could rotate some parts randomly by 180 degrees if that's what you've got in mind. That would require a diffrent param2. Other than that, if you want a diffrent texture, you need to register a new node.

Maybe you'll also be intrested in my bridges and handrail mod. It has a self-building bridge.

I'm looking forward to see your mod released.


Thanks a lot, i will take a closer look into the param2 settings. I've seen your bridge mod, was suggested above somewhere. I do not have it installed yet, but i will take a peek in your code. :)
My bridge wasn't made for bridges though but for place random tiles and add variations. Its a plank mod for learning and testing purposes, and i doubt that much people would be interessted in it. Also i will probably simplify the planks anyways, but i've learned a lot by just modding around.

prestidigitator wrote:Different colors can use a texture specification to share the same base texture image (e.g. file name), but they are still different textures and must be applied to different registered nodes. It's commonly done in a loop with a template pattern for the name (e.g. "mymod:thing_red", "mymod:thing_blue", etc.).

Thank you, i will take a look in that. Overlays would provide as much variations as well, for example some random dirt or fake geometry. Isn't it how dirt with grass is done? Also i think plantlib uses that to add leaves under trees.

I have some more questions:
- How do fences work?
- I made some nodes that have values greater than .5 in the nodeboxes. For example, a stair that is 2 nodes long and a wall that has a little support plank to fit on the stillages. It works (boxes greater than 3 nodes away won't have collision it seems), but it is recommended? Also, is it possible to check for the node i place them on, so it can only be placed on objects from - for example - a specific mod?
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Tue May 19, 2015 07:55

Nubm wrote:- How do fences work?
- I made some nodes that have values greater than .5 in the nodeboxes. For example, a stair that is 2 nodes long and a wall that has a little support plank to fit on the stillages. It works (boxes greater than 3 nodes away won't have collision it seems), but it is recommended? Also, is it possible to check for the node i place them on, so it can only be placed on objects from - for example - a specific mod?

  • Fences have a special draw type. I haven't looked into it yet myself, but for examples you can look at the mods in the default game and I think in the Home Decor modpack for examples (IIRC there are more fences and some iron bars and stuff that act like the default fences).
  • I believe nodes larger than the usual 1x1x1 node box are becoming more acceptable, especially since nodes with a mesh draw type have been added (this was very recent). The kinks might still be being worked out. Not sure.
  • You can certainly check nodes under or generally around a node that's been placed. Use the node's on_place() callback to test nodes in close-by locations using minetest.get_node(), minetest.find_node_near() or minetest.find_nodes_in_area(). If you want to do something no matter how the node is created (e.g. created by a mod rather than a player placing it) you can use the on_construct() callback instead.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Wed May 20, 2015 20:31

I have a tool that places a node, a marker and an arrow, however I want the arrow to point in the direction that the user is pointing when they use the tool. I have the node set so if you place it directly all works as it should, but when using it as a tool it doesn't. Is this possible, am I just missing something really obvious?
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 pointed_thing.type ==  'node' then
     minetest.set_node(pointed_thing.above, (name = 'more_fire:marking'})
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

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 » Wed May 20, 2015 22:28

Nathan.S wrote:I have a tool that places a node, a marker and an arrow, however I want the arrow to point in the direction that the user is pointing when they use the tool. I have the node set so if you place it directly all works as it should, but when using it as a tool it doesn't. Is this possible, am I just missing something really obvious?
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 pointed_thing.type ==  'node' then
     minetest.set_node(pointed_thing.above, (name = 'more_fire:marking'})

Funny you ask that. I was trying to figure out how to convert look dir to a param2.

Can someone give an explanation of what get look dir returns?
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
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: Post your modding questions here

by TeTpaAka » Thu May 21, 2015 12:31

Don wrote:
Nathan.S wrote:I have a tool that places a node, a marker and an arrow, however I want the arrow to point in the direction that the user is pointing when they use the tool. I have the node set so if you place it directly all works as it should, but when using it as a tool it doesn't. Is this possible, am I just missing something really obvious?
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 pointed_thing.type ==  'node' then
     minetest.set_node(pointed_thing.above, (name = 'more_fire:marking'})

Funny you ask that. I was trying to figure out how to convert look dir to a param2.

Can someone give an explanation of what get look dir returns?

https://github.com/minetest/minetest/bl ... i.txt#L526
https://github.com/minetest/minetest/bl ... i.txt#L526
I hope, this helps.

@Nathan.S:
In your code, there is a false bracket (. To set the facedir, you would also need to specify it as param2.
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 pointed_thing.type ==  'node' then
     minetest.set_node(pointed_thing.above, {name = 'more_fire:marking', param2=minetest.dir_to_facedir(player:get_look_dir())})
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Thu May 21, 2015 12:32

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 13:02, edited 1 time in total.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Thu May 21, 2015 12:40

Rui wrote:What minutes one day in the game?


The default is 20 minutes, but generally it is:

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 time_speed = tonumber(minetest.setting_get("time_speed")) or 72;
local minutes_per_day = 24 * 60 / time_speed;
 

User avatar
Rui
Member
 
Posts: 255
Joined: Wed Oct 01, 2014 12:59
GitHub: Rui-Minetest

[DELETED]

by Rui » Thu May 21, 2015 13:20

[DELETED]
Last edited by Rui on Fri Nov 04, 2016 13:02, edited 1 time in total.
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Thu May 21, 2015 14:47

Thank you TeTpaAka, its working now as it should.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

User avatar
maikerumine
Member
 
Posts: 946
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: Post your modding questions here

by maikerumine » Fri May 22, 2015 13:23

Quick question about changing nodes with a mod...

What is the best way to change nodes on event?
Currently I am using register abm and light value to change nodes, it works and all but I think u am asking for way too much CPU power and lag.

Is there an efficient way to change nodes?

Any help would be greatly appreciated.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Fri May 22, 2015 20:07

maikerumine wrote:Quick question about changing nodes with a mod...

What is the best way to change nodes on event?
Currently I am using register abm and light value to change nodes, it works and all but I think u am asking for way too much CPU power and lag.

Is there an efficient way to change nodes?

It depends on the context. If you want to change each node after a particular amount of time has elapsed, then an ABM or node timer is probably what you want. If you want to do a bunch of them all at once, you probably want to use a VoxelManip. If you want to do it in other circumstances, there are all kinds of global, node-specific, or tool specific callbacks, and there's always minetest.after() if you know exactly what you want to do but don't want to do it immediately.
 

ABJ
Member
 
Posts: 2344
Joined: Sun Jan 18, 2015 13:02
GitHub: ABJ-MV
In-game: ABJ

Re: Post your modding questions here

by ABJ » Mon May 25, 2015 16:04

How do I attach a node to an entity?
And I would like to know how to make an entity explode when an event occurs.
 

DanteLives
Member
 
Posts: 25
Joined: Fri Jul 13, 2012 06:35

Re: Post your modding questions here

by DanteLives » Mon May 25, 2015 21:43

topic: How do I have the nodes checked above and below the node that the player places and then change those nodes depending on their identities? In other words, the mod consists of one block. If that block is placed either above or below a previously placed block of that type then the mod will change that node and the neighboring node into another type.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Mon May 25, 2015 23:48

ABJ wrote:How do I attach a node to an entity?
And I would like to know how to make an entity explode when an event occurs.

I believe entities can be attached to entities, but not nodes to entities. You'd have to create an entity that looks like the node. As for explosions, you really have to define what you mean by, "explosion." Does it do damage to entities/players? Destroy/transform nodes? Knock back entities/players? Have a particle effect? Emit a sound? You'll just want to implement each effect you want to include.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Post your modding questions here

by prestidigitator » Tue May 26, 2015 00:23

DanteLives wrote:topic: How do I have the nodes checked above and below the node that the player places and then change those nodes depending on their identities? In other words, the mod consists of one block. If that block is placed either above or below a previously placed block of that type then the mod will change that node and the neighboring node into another type.


Probably something like:
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(...
   {
      ...
      after_place_node = function(pos, placer, itemStack, pointedThing)
         local topPos    = { x = pos.x, y = pos.y + 1, z = pos.z };
         local bottomPos = { x = pos.x, y = pos.y + 1, z = pos.z };
         if minetest.get_node(topPos).name == ... then
            ...
            minetest.set_node(topPos, { name = ... });
            ...
         end
         if minetest.get_node(bottomPos).name == ... then
            ...
            minetest.set_node(bottomPos, { name = ... });
            ...
         end
      end,
      ...
   };


There are plenty of other possibilities, like testing for nodes' groups and stuff like that, or the properties in the nodes' definitions by looking at the minetest.registered_nodes table.
 

User avatar
Oussamarer
Member
 
Posts: 49
Joined: Sat Jan 10, 2015 14:56
GitHub: Oussamarer
IRC: Oussamarer
In-game: Oussamarer

Re: Post your modding questions here

by Oussamarer » Tue May 26, 2015 08:45

hey guys i got a question
i need to know how to make a spawner for a monster that i got in my mod , a block that spawns monsters

another question please , how do i make chests with loot spawn in the dungeon
I make lets plays on minetest and other games , feel free to check me out and drop some suggestions : https://www.youtube.com/watch?v=g-tWCtruQAQ
 

ABJ
Member
 
Posts: 2344
Joined: Sun Jan 18, 2015 13:02
GitHub: ABJ-MV
In-game: ABJ

Re: Post your modding questions here

by ABJ » Tue May 26, 2015 14:32

Can anyone explain to me how to use minetest.add_particlespawner? I want to know more about it bc I'm making a mod with explosions.
 

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

Re: Post your modding questions here

by TenPlus1 » Tue May 26, 2015 15:33

This example is from my Mobs Redo mod and adds a handy function which creates a particle spawner with your own textures...

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
function effect(pos, amount, texture, max_size)
    minetest.add_particlespawner({
        amount = amount, -- how many particles do you want
        time = 0.25, -- spawner stops after this time (use 0 for infinite)
        minpos = {x=pos.x-2, y=pos.y-2, z=pos.z-2}, -- minimum offset
        maxpos = {x=pos.x+2, y=pos.y+2, z=pos.z+2}, -- maximum offset
        minvel = {x=-2, y=-2, z=-2}, -- minimum velocity
        maxvel = {x=2,  y=2,  z=2}, -- maximum velocity
        minacc = {x=-4, y=-4, z=-4}, -- minimum acceleration
        maxacc = {x=4, y=4, z=4}, -- maximim acceleration
        minexptime = 0.1, -- minimum expiration time
        maxexptime = 1, -- maximum expiration time
        minsize = 0.5, -- minimum size (0.5 = half size)
        maxsize = (max_size or 1), -- maximum size (1=full resolution)
        collisiondetection = false, -- do particles stop when they hit solid node
        texture = texture, -- image to use (e.g. "bubble.png" )
        vertical = false, -- upright/vertical image for rain
        playername = "singleplayer", -- particles only appear for this player
    })
end
 

User avatar
Nathan.S
Member
 
Posts: 679
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21

Re: Post your modding questions here

by Nathan.S » Fri May 29, 2015 20:55

Question related to particles, I'm adding them to my more_fire mod, and they are working great, however when I want to remove a particle spawner I end up deleting them all. according to the wiki I need to use
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.delete_particlespawner(id, player)
and in the description it says 'Deletes ParticleSpawner with id (return value from add_particlespawner)' How do I know what the id is though, I don't see anything in the particle spawner that says what the id will be. Currently I'm using an id of 1, which just deletes all spawners.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website.
 

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

Re: Post your modding questions here

by Hybrid Dog » Sat May 30, 2015 08:55

Nathan.S wrote:Question related to particles, I'm adding them to my more_fire mod, and they are working great, however when I want to remove a particle spawner I end up deleting them all. according to the wiki I need to use
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.delete_particlespawner(id, player)
and in the description it says 'Deletes ParticleSpawner with id (return value from add_particlespawner)' How do I know what the id is though, I don't see anything in the particle spawner that says what the id will be. Currently I'm using an id of 1, which just deletes all spawners.

add_particlespawner returns the id, so just write id = minetest.add_particlespawner({<properties>})
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron