Post your modding questions here

ultimatemuffin
New member
 
Posts: 3
Joined: Mon Aug 25, 2014 02:16

Re: Post your modding questions here

by ultimatemuffin » Mon Aug 25, 2014 02:30

Hi, I'm new to minetest, and I'm trying to write my first mod. Basically, it's a trade machine mod where the player who places it sets up what he wants to trade and what to trade for, and fills the machine's stock. When another player right clicks on it, they should see a different formspec that only shows what's being traded and a button to perform the trade.

My question is this: How do I make a node show two different formspecs to two different players when they right click on it?
 

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

Re: Post your modding questions here

by prestidigitator » Mon Aug 25, 2014 07:09

ultimatemuffin wrote:Hi, I'm new to minetest, and I'm trying to write my first mod. Basically, it's a trade machine mod where the player who places it sets up what he wants to trade and what to trade for, and fills the machine's stock. When another player right clicks on it, they should see a different formspec that only shows what's being traded and a button to perform the trade.

My question is this: How do I make a node show two different formspecs to two different players when they right click on it?

Instead of using the node's metadata formspec like a chest does, you'll want to use a callback function (e.g. on_rightclick) to call minetest.show_formspec. That way you can vary the formspec each time a player interacts with the node.
 

ultimatemuffin
New member
 
Posts: 3
Joined: Mon Aug 25, 2014 02:16

Re: Post your modding questions here

by ultimatemuffin » Thu Aug 28, 2014 20:21

prestidigitator wrote:
ultimatemuffin wrote:Hi, I'm new to minetest, and I'm trying to write my first mod. Basically, it's a trade machine mod where the player who places it sets up what he wants to trade and what to trade for, and fills the machine's stock. When another player right clicks on it, they should see a different formspec that only shows what's being traded and a button to perform the trade.

My question is this: How do I make a node show two different formspecs to two different players when they right click on it?

Instead of using the node's metadata formspec like a chest does, you'll want to use a callback function (e.g. on_rightclick) to call minetest.show_formspec. That way you can vary the formspec each time a player interacts with the node.


Oh, I see. so then from the callback, how do I refer to the node's inventory when I create the formspec?
when I was calling it from the node's formspec I could just use current_name, but that won't work in the callback and I can't find documentation for the syntax for it.

eg: "list[current_name;sale_memory;1,2;3,3;]"..
What can I replace current_name with?


Edit: After scouring the source, I figured it out. The "inventory_location" part of a list formspec needs to be formatted as one of 5 specific formats:
switch(type){
case InventoryLocation::UNDEFINED:
os<<"undefined";
break;
case InventoryLocation::CURRENT_PLAYER:
os<<"current_player";
break;
case InventoryLocation::PLAYER:
os<<"player:"<<name;
break;
case InventoryLocation::NODEMETA:
os<<"nodemeta:"<<p.X<<","<<p.Y<<","<<p.Z;
break;
case InventoryLocation::DETACHED:
os<<"detached:"<<name;
break;
default:
assert(0);
}

so I just needed to put nodemeta:"..pos["x"]..","..pos["y"]..","..pos["z"].." and then everything was happy.

I also recommend putting this info in the dev wiki under the formspec section, I may take a look at doing it a bit later.
 

User avatar
Semmett9
Member
 
Posts: 149
Joined: Sun Oct 07, 2012 13:48

drunk affect to player

by Semmett9 » Fri Aug 29, 2014 21:49

I was wondering if it is possible to invert a mouse or cover the players screen with an animated image.
After making a beer mod I wondered if you could invert the players mouse or do something which will affect the player if the drink too much.
If anyone know how to do this I will be more than happy.

Meany thanks
 

HANNAHBOO
New member
 
Posts: 2
Joined: Fri Aug 29, 2014 23:13

Re: Post your modding questions here

by HANNAHBOO » Fri Aug 29, 2014 23:22

Ive tried downloading mods. Nothing is working for me. Heres my situation, I cant not afford anything for my brother for his birthday, and he loves minecraft. So I figured I will download minetest for him , at first he liked it but got easily bored due to nothing to do. I tried downloading mods for him but it just doesnt seem to work for me. I know I must be doing something wrong. I tried dowloading the PilzAdam mods and nothings working. SO can I please get step by step instructions. It would be greatly appreciated. :(
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: Post your modding questions here

by Minetestforfun » Sat Aug 30, 2014 00:54

Hi HANNAHBOO,
1) download the mod
2) dezip the mod
3) rename the mod like the author of the mod says to you in his topic
4) move your folder renamed to your minetest/mods folder
5) Launch the game, select your server, click "configure", active your mod(just check the box on the top right of the window configure), launch the world => it's over

(EDIT : @philipbenr thank you for correction, and more details for HANNAHBOO ;))
Last edited by Minetestforfun on Sat Aug 30, 2014 01:12, edited 3 times in total.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Sat Aug 30, 2014 01:00

The post above is a pretty good explanation, except the word server should be replaced with singleplayer world. servers already come with pre-enabled mods.

Image

Image for reference. Ex: castle mod.

@Minetestforfun: It shouldn't be called a server, it should be called a world. Online servers don't allow client side mods.
 

ultimatemuffin
New member
 
Posts: 3
Joined: Mon Aug 25, 2014 02:16

Re: Post your modding questions here

by ultimatemuffin » Tue Sep 02, 2014 03:37

Hi, I am trying to make a soft-protection mod that will make protected nodes harder to dig for other players, but not indestructible. Is there any way to dynamically change the dig times for a particular node?
 

User avatar
jojoa1997
Member
 
Posts: 2890
Joined: Thu Dec 13, 2012 05:11

Re: Post your modding questions here

by jojoa1997 » Thu Sep 04, 2014 15:51

How would one make a gas rise in the air? I was thinking of something like making water with the gravity inversed or that flows upward but I do not think that is possible.
Coding;
1X coding
3X debugging
12X tweaking to be just right
 

User avatar
Esteban
Member
 
Posts: 872
Joined: Sun Sep 08, 2013 13:26
GitHub: Esteban-
IRC: Esteban
In-game: Esteban

Re: Post your modding questions here

by Esteban » Thu Sep 04, 2014 16:11

jojoa1997 wrote:How would one make a gas rise in the air? I was thinking of something like making water with the gravity inversed or that flows upward but I do not think that is possible.


I don't know if that is possible, have you checked moonrealm's air or fake fire's smoke? II think those are close to accomplish your idea.
 

User avatar
SAMIAMNOT
Member
 
Posts: 363
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie

Re: Post your modding questions here

by SAMIAMNOT » Thu Sep 04, 2014 21:47

How wwould I make blocks move? (for custom mobs)
I test mines.
 

User avatar
RHR
Member
 
Posts: 214
Joined: Mon Jan 27, 2014 20:07
GitHub: RHRhino

Re: Post your modding questions here

by RHR » Sat Sep 06, 2014 09:39

SAMIAMNOT wrote:How wwould I make blocks move? (for custom mobs)

I created a mod that adds block-mobs some time ago.
It is a change from pilzadam's simple mobs mod. You can find my mod here:
viewtopic.php?f=9&t=9472 and the code here: https://github.com/RHRhino/ccmobs
A mob can easily defined as block if you change the field "visual" from "mesh" to "cube" like here:
https://github.com/RHRhino/ccmobs/blob/ ... an_cat.lua
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Sun Sep 07, 2014 16:34

where is my 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
tiles = {
        {name="cubetesttop.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
        {name="cubetestbottom.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
        {name="cubetestgreen.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
        {name="cubetestblue.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
        {name="cubetestblack.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
        {name="cubetestred.png",backface_culling=false, animation={type="vertical_frames", aspect_w=10, aspect_h=10, length=3.0},
}
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Tue Sep 09, 2014 16:49

*blushes when noticed a lack of context* I am trying to make a mod with all faces animated, the code I posted was the section of textures.(it works without the code but no texture) why does this code fail? is it bad syntax
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

Re: Post your modding questions here

by AMMOnym » Thu Sep 11, 2014 17:21

Is there any way, how to make a mob flying without remaking API ? (I am using simple mobs)
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Fri Sep 12, 2014 13:11

AFAIK: it depends if the mob is a node or an entity
Entity: Yes
Node: No
I might be wrong but I might not
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Fri Sep 12, 2014 14:06

AMMOnym wrote:Is there any way, how to make a mob flying without remaking API ? (I am using simple mobs)


Simple mobs doesn't support flying animals. Only land animals. Last time I checked. You would need to edit the API.
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

Re: Post your modding questions here

by AMMOnym » Fri Sep 12, 2014 14:19

rubenwardy wrote:
AMMOnym wrote:Is there any way, how to make a mob flying without remaking API ? (I am using simple mobs)


Simple mobs doesn't support flying animals. Only land animals. Last time I checked. You would need to edit the API.


Or change collision box :) Thanks
 

drkwv
Member
 
Posts: 67
Joined: Thu Jun 28, 2012 13:48

Re: Post your modding questions here

by drkwv » Sat Sep 13, 2014 05:46

Block top has the original color from .png texture and sides have some filter applied. How do I make the side color to look like current original? I don't care how the top would look like, but want sides to be exact color of the top now.
Attachments
wallcolour.png
wallcolour.png (571.41 KiB) Viewed 2758 times
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: Post your modding questions here

by Minetestforfun » Tue Sep 16, 2014 22:56

Someone can tell me what is the better "weather mod" for minetest 0.4.10 (compatibility, stability, less performence use) ?

[weather] or [snowdrift] or an other weather mod ?
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Post your modding questions here

by philipbenr » Tue Sep 16, 2014 23:16

Snowdrift would be the better of the two, IMO. It is lighter weight than the other. (At least I think it is/was) I also think it is stable enough.
 

User avatar
SAMIAMNOT
Member
 
Posts: 363
Joined: Wed Sep 03, 2014 00:51
In-game: notanewbie

Re: Post your modding questions here

by SAMIAMNOT » Wed Sep 17, 2014 18:56

Does Snowdrift have rain too? I agree, weather doesn't always rain/snow, you can be playing for hours and have no weather...and be playing for minutes and get a blizzard.
I test mines.
 

User avatar
Achilles
Member
 
Posts: 246
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles

Re: Post your modding questions here

by Achilles » Wed Sep 17, 2014 19:29

Has anyone ever considered making a 'PickPocket' mod?

It would encourage players not to leave their accounts idle for too long a time....
 

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

Re: Post your modding questions here

by Casimir » Wed Sep 17, 2014 19:32

I generally dislike features that force players onto the game.
 

User avatar
Achilles
Member
 
Posts: 246
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles

Re: Post your modding questions here

by Achilles » Wed Sep 17, 2014 19:51

I am not talking about players that dont come online often being pick pocketed, but players who leave their accounts online for a long time even when they are 'away from keyboard'...

If a mod such as the one I said was created it would prevent players from doing that, and allow other players to come online: on many servers the maximum user limit does not allow all the players who wish ,to come online at that point, to do so, something wish would become far more feasible if players did not leave there accounts online unnatended...
The Ironic Thing About Common Sense Is That It Isn't Very Common
 

User avatar
AMMOnym
Member
 
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym

Re: Post your modding questions here

by AMMOnym » Thu Sep 18, 2014 19:04

How to use "on_place" for spawn a node above my placed node ? I am noob and I tried to use something like ABM, but my minetest crashed. :( Please help. Thanks
 

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 » Fri Sep 19, 2014 13:33

AMMOnym wrote:spawn a node above my placed node

You can see init.lua in doors mod in vanilla minetest game.
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/)
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: Post your modding questions here

by Minetestforfun » Fri Sep 19, 2014 14:19

Sometimes, in trees, i can pick a "golden apple", but, i can't do nothing with it...
Is it normal ? I can't eat it :(
 

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

Re: Post your modding questions here

by jin_xi » Fri Sep 19, 2014 14:57

Achilles wrote:Has anyone ever considered making a 'PickPocket' mod?

It would encourage players not to leave their accounts idle for too long a time....


wow thats a really good idea! could be fun to try and come up with some games with that
 

4aiman
Member
 
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

Re: Post your modding questions here

by 4aiman » Fri Sep 19, 2014 15:11

Does anyone know how to get current biome ID?
(e.g. biome ID in some point {x=x,z=z})
I've tried to cache biomes within on_generated but a loop through the get_mapgen_object("biomemap") slows down mapgen up to 20x times...

Any ideas?
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 6 guests

cron