Post your modding questions here

Locked
User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

Re: Only Owner can take/put/move items in an inventory

by stu » Post

Ackirb wrote:Hello

I am trying to create a trade shop.
There will be an inventory slot which displays the item being sold, another slot displaying the item(s) which will traded (the price), a slot in which the user can insert their payment, and finally a slot that allows the user to take their purchased item after paying for it.

It's like this:
[ ] = inventory slot
[item for sale] [price of said item] [payment slot] [product]

example:
[mese pickaxe] [25 cobble stone blocks] [payment slot] [product]

When the user places 25 cobble stone blocks into the "payment slot", then the mese pickaxe will appear in the
"product" slot, and the user will be able to take it.

My question is: how do I make it so that the user cannot take items out of the [item for sale] slot and the [price] slot?
It kind of defeats the purpose of a trade shop if the customer can simply take the item for sale without even having to pay! lol.

If anyone wants a better example of how this is (supposed) to work, please let me know!
Have a look at the trader npc from my npc framework, not suggesting you use that as npcf is still a long-term WIP but the trader npc works very similar to what you describe here (if I read it correctly).

User avatar
Ackirb
Member
Posts: 23
Joined: Thu Mar 27, 2014 21:01
Location: United States

Re: Only Owner can take/put/move items in an inventory

by Ackirb » Post

Have a look at the trader npc from my npc framework, not suggesting you use that as npcf is still a long-term WIP but the trader npc works very similar to what you describe here (if I read it correctly).
I have actually been using your trade NPC for awhile now. Good job on that, by the way - I really like it.
However, your NPC doesn't actually display the items for sale nor the price of said items with an inventory slot, but instead, displays a string (aka, instead of showing a diamond pickaxe in an inventory slot, it would show a string that says "Diamond Pickaxe")

My shop is more like the one from bitchange in that is literally shows the items for sale and the price of said item.
Attachments
Shop.PNG
Shop.PNG (482.28 KiB) Viewed 691 times

User avatar
stu
Member
Posts: 923
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11
Location: United Kingdom

Re: Only Owner can take/put/move items in an inventory

by stu » Post

Ackirb wrote: My question is: how do I make it so that the user cannot take items out of the [item for sale] slot and the [price] slot?
It kind of defeats the purpose of a trade shop if the customer can simply take the item for sale without even having to pay! lol
You can use a detached inventory, just make sure the allow_take function returns 0

Code: Select all

inv = minetest.create_detached_inventory("display", {
	allow_take = function(inv, listname, index, stack, player)
		return 0
	end,
})

iPushButton1997
Member
Posts: 15
Joined: Sun Dec 16, 2012 20:18
Location: Mississippi
Contact:

Re: Post your modding questions here

by iPushButton1997 » Post

How much has modding changed since the initial 0.4 release? And if so, is there any specific place I can go to read up on this new info? I've been out of the loop almost two years now...and I'm aching to get back into it and finish up what I started.

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

Re: Post your modding questions here

by Jordach » Post

iPushButton1997 wrote:How much has modding changed since the initial 0.4 release? And if so, is there any specific place I can go to read up on this new info? I've been out of the loop almost two years now...and I'm aching to get back into it and finish up what I started.
http://dev.minetest.net/

and

https://github.com/minetest/minetest/bl ... ua_api.txt

Are both good places. (And good to see you about)

iPushButton1997
Member
Posts: 15
Joined: Sun Dec 16, 2012 20:18
Location: Mississippi
Contact:

Re: Post your modding questions here

by iPushButton1997 » Post

Jordach wrote:
iPushButton1997 wrote:How much has modding changed since the initial 0.4 release? And if so, is there any specific place I can go to read up on this new info? I've been out of the loop almost two years now...and I'm aching to get back into it and finish up what I started.
http://dev.minetest.net/

and

https://github.com/minetest/minetest/bl ... ua_api.txt

Are both good places. (And good to see you about)
Thanks man. And it feels good being back. Hopefully I can get back to my old work :P

User avatar
ak399g
Member
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR
Contact:

Re: Post your modding questions here

by ak399g » Post

What is the maximum stack_max? I read it was over 50000 but I've tried 50000 and 40000, which don't work, and 25000 does.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Post your modding questions here

by Sokomine » Post

Ackirb wrote: My shop is more like the one from bitchange in that is literally shows the items for sale and the price of said item.
You may also try my mobf_trader mod. It adds traders which can either sell a pre-defined sortiment or be employed by players. Up to four stacks can be bundeld for an offer (or price), and several alternate prices can be offered (i.e. sell 10 tree for 1 steel ingot or 1 copper or 5 cactus etc.). The mod ought to be linked in the posting mentioned in my signature.

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

Re: Post your modding questions here

by RHR » Post

What are the advantages and disadvantages of mapgenV6 and mapgenV7? Which features are supported by them for creating a mod? Is there any comparison or documentation of their features?

Jordach
Member
Posts: 4534
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

Re: Post your modding questions here

by Jordach » Post

RHR wrote:What are the advantages and disadvantages of mapgenV6 and mapgenV7? Which features are supported by them for creating a mod? Is there any comparison or documentation of their features?
Mapgen V6 has two defined biomes, while Mapgen V7 has completely custom biomes which can be made from nyan rainbow to literally lava or even bones.

That choice is yours with V7.

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

Re: Post your modding questions here

by RHR » Post

Jordach wrote: Mapgen V6 has two defined biomes, while Mapgen V7 has completely custom biomes which can be made from nyan rainbow to literally lava or even bones.
That choice is yours with V7.
Yep the custom biomes are awesome, but is that the only difference? Is it for example possible to "mod" the surface(mountains) of mapgenV7?

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: Post your modding questions here

by TenPlus1 » Post

Ackirb, what you need is the money mod as it does just what you request... You can have a shop chest or trade chest that you can configure to your own needs to buy and sell items for money or other items...

viewtopic.php?id=2263

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: Post your modding questions here

by paramat » Post

RHR, lines 390 to 423 here https://github.com/minetest/minetest/bl ... nf.example
You can add those lines (without the #) to your minetest.conf file. Some of those affect mgv7, some are mgv6 only.

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

Re: Post your modding questions here

by RHR » Post

paramat wrote:RHR, lines 390 to 423 here https://github.com/minetest/minetest/bl ... nf.example
You can add those lines (without the #) to your minetest.conf file. Some of those affect mgv7, some are mgv6 only.
thx, I'll give them a try. ^.^

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Post your modding questions here

by Kilarin » Post

Why is it impossible in singleplayer to /revoke a privilege that does not have give_to_singleplayer = false ?

For testing purposes I wanted to /revoke teleport and my new priv I had created, and I can't do it in singleplayer. Was this decision deliberate to reduce the risk of someone revoking the "privs" privilege on singleplayer and making their character unfixable? Or is there some other reason? Or is it just a bug? Because it seems like there would be some better way of protecting privs than locking all of the other privileges.

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

Re: Post your modding questions here

by RHR » Post

Some questions:
1) Is it possible to create colored light? (e.g. red, blue, green)
2) Is it possible to force a fencelike block to connect to other not fencelike blocks?
3) How can I find out how much performance a mod needs? f5 and f6 show lots of information. Where can I look up what it means?

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Post your modding questions here

by Krock » Post

RHR wrote:Some questions:
1) Is it possible to create colored light? (e.g. red, blue, green)
2) Is it possible to force a fencelike block to connect to other not fencelike blocks?
3) How can I find out how much performance a mod needs? f5 and f6 show lots of information. Where can I look up what it means?
1) Discussed a lot be4, answer stayed at No.
2) Maybe - extend the collision block to a regular node and look if it works
3) Idk. add os.time()-things like in serval mapgens to see how much miliseconds it takes
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Casimir
Member
Posts: 1206
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Post

I want to spawn particles when eating something (the way it looks in minecraft). But it uses the whole texture of the item. How can I only use parts of it like when digging something?
RHR wrote:2) Is it possible to force a fencelike block to connect to other not fencelike blocks?
There is a fence mod somewhere that does that, but it is somewhat hacky.

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

Re: Post your modding questions here

by LionsDen » Post

RHR wrote:2) Is it possible to force a fencelike block to connect to other not fencelike blocks?
Yes, look at XDGAMERZzZ skyblock map. One of the mods in the mod zip file is called fences and I have seen these do this.

User avatar
Topywo
Member
Posts: 1721
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Post

RHR wrote:1) Is it possible to create colored light? (e.g. red, blue, green)
- You can make colored air nodes with drawtype airlike and give them a post_effect_color
- Then you change the air around a lightsource that has been placed into a colored air node. While placing the item or through an ABM

Problems:
- When you want to be able to put lights on and off and when removing the lightsource, you'll need to change the air around it (back).
- How to handle the colored air around two different colored lightsources next or near each other (and three and when removing one...)



Edit: At least one typo

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: Post your modding questions here

by philipbenr » Post

@RHR. There are two fence mods.
One is xfences, made by xyz (google "minetest xfences")
The second is fences by Blockmen (google "minetest fences")
xyz's is much more reliable than Blockmens, mainly because with Blockmens, some do not connect fully. So, if xfences is still around and downloadable, take a look. I believe that both are hacky, and neither will be of much use if you wish to have it simple. PM me if there is no copy of xfences avail. I might still have a copy

TG-MyinaWD
Member
Posts: 356
Joined: Thu May 08, 2014 21:22
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .
Location: Far Eden

Re: Post your modding questions here

by TG-MyinaWD » Post

Do anyone like make a Game mode with me?
And I have no idea where else to ask this.
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: Post your modding questions here

by HeroOfTheWinds » Post

Alt. Tester wrote:Do anyone like make a Game mode with me?
And I have no idea where else to ask this.
It will usually depend on what the game you want to make is, and how much work is done, and what you are willing to do. A great place to actively discuss these things is IRC.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Post your modding questions here

by Kilarin » Post

Lua syntax question.
I want to register a new type of door in a mod. So, I figured I'd just need to make my mod depend on doors and then call doors:register_door
But when I do I get:

Code: Select all

09:43:49: ERROR[main]: /usr/share/minetest/builtin/game/register.lua:60: Name doors:door_secret does not follow naming conventions: "modname:" or ":" prefix required
Which means I'm doing something STUPID. Any help here?

User avatar
Kilarin
Member
Posts: 894
Joined: Mon Mar 10, 2014 00:36
GitHub: Kilarin

Re: Post your modding questions here

by Kilarin » Post

Never mind, it's always immediately obvious right after you post the question. wasn't complaining about calling doors:register_door, it was complaining about me naming the door doors:door_secret. duh!

Locked

Who is online

Users browsing this forum: No registered users and 3 guests