Page 44 of 125

Re: Post your modding questions here

PostPosted: Mon Aug 25, 2014 02:30
by ultimatemuffin
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?

Re: Post your modding questions here

PostPosted: Mon Aug 25, 2014 07:09
by prestidigitator
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.

Re: Post your modding questions here

PostPosted: Thu Aug 28, 2014 20:21
by ultimatemuffin
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.

drunk affect to player

PostPosted: Fri Aug 29, 2014 21:49
by Semmett9
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

Re: Post your modding questions here

PostPosted: Fri Aug 29, 2014 23:22
by HANNAHBOO
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. :(

Re: Post your modding questions here

PostPosted: Sat Aug 30, 2014 00:54
by Minetestforfun
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 ;))

Re: Post your modding questions here

PostPosted: Sat Aug 30, 2014 01:00
by philipbenr
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.

Re: Post your modding questions here

PostPosted: Tue Sep 02, 2014 03:37
by ultimatemuffin
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?

Re: Post your modding questions here

PostPosted: Thu Sep 04, 2014 15:51
by jojoa1997
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.

Re: Post your modding questions here

PostPosted: Thu Sep 04, 2014 16:11
by Esteban
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.

Re: Post your modding questions here

PostPosted: Thu Sep 04, 2014 21:47
by SAMIAMNOT
How wwould I make blocks move? (for custom mobs)

Re: Post your modding questions here

PostPosted: Sat Sep 06, 2014 09:39
by RHR
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

Re: Post your modding questions here

PostPosted: Sun Sep 07, 2014 16:34
by DeepGaze
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},
}

Re: Post your modding questions here

PostPosted: Tue Sep 09, 2014 16:49
by DeepGaze
*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

Re: Post your modding questions here

PostPosted: Thu Sep 11, 2014 17:21
by AMMOnym
Is there any way, how to make a mob flying without remaking API ? (I am using simple mobs)

Re: Post your modding questions here

PostPosted: Fri Sep 12, 2014 13:11
by DeepGaze
AFAIK: it depends if the mob is a node or an entity
Entity: Yes
Node: No
I might be wrong but I might not

Re: Post your modding questions here

PostPosted: Fri Sep 12, 2014 14:06
by rubenwardy
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.

Re: Post your modding questions here

PostPosted: Fri Sep 12, 2014 14:19
by AMMOnym
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

Re: Post your modding questions here

PostPosted: Sat Sep 13, 2014 05:46
by drkwv
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.

Re: Post your modding questions here

PostPosted: Tue Sep 16, 2014 22:56
by Minetestforfun
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 ?

Re: Post your modding questions here

PostPosted: Tue Sep 16, 2014 23:16
by philipbenr
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.

Re: Post your modding questions here

PostPosted: Wed Sep 17, 2014 18:56
by SAMIAMNOT
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.

Re: Post your modding questions here

PostPosted: Wed Sep 17, 2014 19:29
by Achilles
Has anyone ever considered making a 'PickPocket' mod?

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

Re: Post your modding questions here

PostPosted: Wed Sep 17, 2014 19:32
by Casimir
I generally dislike features that force players onto the game.

Re: Post your modding questions here

PostPosted: Wed Sep 17, 2014 19:51
by Achilles
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...

Re: Post your modding questions here

PostPosted: Thu Sep 18, 2014 19:04
by AMMOnym
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

Re: Post your modding questions here

PostPosted: Fri Sep 19, 2014 13:33
by srifqi
AMMOnym wrote:spawn a node above my placed node

You can see init.lua in doors mod in vanilla minetest game.

Re: Post your modding questions here

PostPosted: Fri Sep 19, 2014 14:19
by Minetestforfun
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 :(

Re: Post your modding questions here

PostPosted: Fri Sep 19, 2014 14:57
by jin_xi
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

Re: Post your modding questions here

PostPosted: Fri Sep 19, 2014 15:11
by 4aiman
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?