Post your modding questions here

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Post your modding questions here

by azekill_DIABLO » Post

make a new falling node system then.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Byakuren
Member
Posts: 818
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Post

pithy wrote:
azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
It looks like it uses the same entity for all nodes.
I only want to make one node kill you when it falls on your head.
The falling node entity carries information about the node, so you can check the node name to make sure you only kill people if it's your node.
Every time a mod API is left undocumented, a koala dies.

User avatar
D00Med
Member
Posts: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

Does anyone know why this doesn't work when damage is enabled? The problem seems to be the "if player:hud_get(fr1) == nil", but I don't understand why, or how to get around the problem. It works fine on creative.

Code: Select all

function tool_anim(player, interval, frame1, frame2, frame3)
	if player:hud_get(fr1) == nil then
	fr1 = player:hud_add({
    hud_elem_type = "image",
    position = {x = 0.5, y = 0.5},
    scale = {
      x = -100,
      y = -100
    },
    text = frame1
	})
	end
...(continues)
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your modding questions here

by Icalasari » Post

If one wanted to make ambient mobs that at most disappeared and put an item or two in the inventory when a specific tool was used on it, would that be something to code from scratch, or use one of the existing mob APIs for? I'm doing a "bug collecting" mod for my first mod, but other than the tarantula, the others wouldn't need anything complex behaviour wise outside of flight nor a health system, but at the same time I'm not even sure where to begin with making custom AI, and I'm not even sure if Minetest has AI in it as a default

Guess maybe a better way of wording the question is:

If the most complex behaviour a mob may show is flight with a preference of seeking either dark or light along with sky, would it be better to do an AI from scratch to package with the mod, or use MobRedo? And if the former, is there even a resource that would be helpful for that?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

D00Med wrote:Does anyone know why this doesn't work when damage is enabled? The problem seems to be the "if player:hud_get(fr1) == nil", but I don't understand why, or how to get around the problem. It works fine on creative.
[...]
Where are you initializing `fr1`? The only place you set it in your snippet is after you access that variable.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
D00Med
Member
Posts: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

I'm not sure I understand, are you saying that because fr1 doesn't exist at first there is a problem?
And if so, why would that mean it only works without damage enabled?
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

I'm saying that in your snippet, you use the `fr1` variable before it gets a value (in the `if` block), thus its value may be nil. More context is needed.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
Um, how do I override an entity?

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your modding questions here

by Icalasari » Post

Sorry for all the questions, but I've got another one

Is there a good guide to metadata anywhere? The Rubenwardy one isn't too clear

User avatar
dpbqRman
Member
Posts: 44
Joined: Fri Oct 07, 2016 08:15
Contact:

Re: Post your modding questions here

by dpbqRman » Post

would someone make a big screen nintendo?
o__l_ dpbqR o-l&&&&&

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Post your modding questions here

by azekill_DIABLO » Post

pithy wrote:
azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
Um, how do I override an entity?
override_item("builtin_____") or something like that
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

Re: Post your modding questions here

by Krock » Post

Icalasari wrote:Is there a good guide to metadata anywhere?
Item Metadata: https://github.com/minetest/minetest/bl ... .txt#L2968
Use minetest.serialize to convert a table into a string, minetest.deserialize for the reverse.

Node Metadata: lua_api.txt#L2683 and lua_api.txt#L1405

AFAIK, there's no other guide than rubenwardy's and the lua_api.txt file itself. Please specify which metadata type you meant.
pithy wrote:Um, how do I override an entity?
You cannot use minetest.override_item for this. Instead, it's possible to access the data table directly:

Code: Select all

local my_entity_def = minetest.registered_entities["__builtin:<somewhat>"]
my_entity_def.on_step = function(arg1, arg2, foobar)
    -- Things here
end

-- This step is USELESS, 'my_entity_def' is a direct reference to the entity table.
-- These tables are ALWAYS equal, until you call a copy function like 'local foobar = table.copy(blarg)'
minetest.registered_entities["__builtin:<somewhat>"] = my_entity_def
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

PlanetKiller
Member
Posts: 14
Joined: Mon Nov 23, 2015 22:50

Re: Post your modding questions here

by PlanetKiller » Post

I'm going to be making a quadruped player and these are a few things I'd like to add.
1. check a specific pixel on the player texture to determine character type (using alpha channel)
2. give character multi-jumps and low grav based upon type
3. swap player model when jumping, or based upon gender
4. modify/view player hitbox

I'm going to use the default player as the base and add these and a few other things. I already have the model and just need to animate it.
([noun].. " tried to " ..[verb]..[noun].. " at protected position "..[noun].. " with a bucket")

User avatar
pithy
Member
Posts: 251
Joined: Wed Apr 13, 2016 17:34
GitHub: pithydon

Re: Post your modding questions here

by pithy » Post

pithy wrote:Is there a way to make a node kill you when it falls on your head?
Thanks for the answers. I found out how to do this now. Other people can do this the easy way now with my falling_nodes mod.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

PlanetKiller wrote:1. check a specific pixel on the player texture to determine character type (using alpha channel)
There's no way to read image data in the engine. An alternative is to associate data with each texture (I won't go over how to load and/or define that data) separately of the texture file itself. Except on very rare occasions when you really have no other way, you should not store data in the textures.
2. give character multi-jumps and low grav based upon type
See the `set_physics_override` method of player objects (here's some docs)
3. swap player model when jumping, or based upon gender
Detecting when the player is jumping is not trivial (depending on how accurate you want the results), plus it is subject to lag. Changing per gender should be no problem, though. Take a look at `default.player_set_model` (you should depend on `default` mod).
4. modify/view player hitbox
Not possible at the moment, sorry.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Post your modding questions here

by azekill_DIABLO » Post

Is it possible to know the texture of a node like this?

Code: Select all

minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
	local node = minetest.get_node_or_nil(pointed_thing.under)
	local tile = node.textures
--...code...
end)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

Code: Select all

local tiles = minetest.registered_nodes[node.name].tiles
print(tiles[1])
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: Post your modding questions here

by azekill_DIABLO » Post

thank you :)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your modding questions here

by Icalasari » Post

Krock wrote:
Icalasari wrote:Is there a good guide to metadata anywhere?
Item Metadata: https://github.com/minetest/minetest/bl ... .txt#L2968
Use minetest.serialize to convert a table into a string, minetest.deserialize for the reverse.

Node Metadata: lua_api.txt#L2683 and lua_api.txt#L1405

AFAIK, there's no other guide than rubenwardy's and the lua_api.txt file itself. Please specify which metadata type you meant.
Thanks. And yeah it was node metadata - It slipped my mind at the time that item metadata was also a thing

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

Re: Post your modding questions here

by Krock » Post

Icalasari wrote:Thanks. And yeah it was node metadata - It slipped my mind at the time that item metadata was also a thing
There's a good example in the Lua API file, it shows how to set (and save) strings and how to create an inventory: https://github.com/minetest/minetest/bl ... .txt#L1405
You can use these functions basically everywhere but only callback functions like on_place really make sense, because it's when a change happens.

I always recommend to look at the source code of other mods when you're not sure how it works ;)
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

amadin
Member
Posts: 549
Joined: Tue Jun 16, 2015 16:23

[colorize:<color>:<ratio>

by amadin » Post

Is

Code: Select all

[colorize:<color>:<ratio>
decrease a client traffic amount if using "colorize" instead colored textures or not? Server will send to client just text or it will send colored texture created by "colorize"? It not undestand dark_grey and dark_green colors, why?

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: Post your modding questions here

by kaeza » Post

Re: traffic, with `[colorize` the server only sends the "base" texture; the client first creates a copy of the texture (possibly loading it from disk first), then modifies it in memory.

Whether or not `[colorize` uses more data depends on many factors which I won't go over here. Just trust me that for all practical purposes it isn't worth even thinking about it. Just use whatever gives the best results visually.

Re: named colors, the list of supported colors is here (here's the source). You probably meant `darkgrey` and `darkgreen` without underscores.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

Icalasari
Member
Posts: 166
Joined: Tue Sep 23, 2014 05:29
IRC: Icalasari
In-game: Icalasari

Re: Post your modding questions here

by Icalasari » Post

Krock wrote:There's a good example in the Lua API file, it shows how to set (and save) strings and how to create an inventory: https://github.com/minetest/minetest/bl ... .txt#L1405
You can use these functions basically everywhere but only callback functions like on_place really make sense, because it's when a change happens.

I always recommend to look at the source code of other mods when you're not sure how it works ;)
Thanks again. And yeah, I had checked a few mods that have achieved similar things, but they weren't organized in a way that made sense (Default Wool mod = confusing. Meanwhile a tornado mod I end up 99% understanding off the bat x.x). The other one is getting an item once a day on right click, maybe give it a sub inventory so it can store up to three days worth, but other than figuring out how to get it to reliably check at midnight in game, I'll probably manage to figure that one out now that I have these links, at least to the point that I can get help with a code snippet when I end up crashing the game in new and exotic ways

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

Re: Post your modding questions here

by taikedz » Post

Icalasari wrote:If one wanted to make ambient mobs that at most disappeared and put an item or two in the inventory when a specific tool was used on it, would that be something to code from scratch, or use one of the existing mob APIs for?
You can use mobs_redo as it is, then use entity_override to add a special override on mob_punch or on_right_click

viewtopic.php?f=9&t=15518
Icalasari wrote:I'm doing a "bug collecting" mod for my first mod, but other than the tarantula, the others wouldn't need anything complex behaviour wise outside of flight nor a health system, but at the same time I'm not even sure where to begin with making custom AI, and I'm not even sure if Minetest has AI in it as a default
None by default, best bet is mobs_redo for now
Icalasari wrote:If the most complex behaviour a mob may show is flight with a preference of seeking either dark or light along with sky,
To follow the sky/faraway light source would be a tall order... but you could make it fly randomly, checking each node around it for light level, until it found a zone with a light level greater than that of the current node, and cause it to move towards that node...

This would require some significant coding on top of mobs_redo's "mob_step" function, but it would not be insurmountable.... you could use an override, do your light check, if you find better light, move your mob, else if nothing suitable is found, handover to mobs_redo normal code to move randomly...

Will it drop as "fried bug" item if it touches a torch? :D

User avatar
D00Med
Member
Posts: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

Re: Post your modding questions here

by D00Med » Post

kaeza wrote:I'm saying that in your snippet, you use the `fr1` variable before it gets a value (in the `if` block), thus its value may be nil. More context is needed.
That was my intention - I only want to add fr1 if it doesn't exist already
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

Locked

Who is online

Users browsing this forum: No registered users and 11 guests