Post your modding questions here
- 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
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!
DMs are always open if you want to get in touch!
-
- Member
- Posts: 818
- Joined: Tue Apr 14, 2015 01:59
- GitHub: raymoo
- IRC: Hijiri
- In-game: Raymoo + Clownpiece
Re: Post your modding questions here
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.pithy wrote:It looks like it uses the same entity for all nodes.azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
I only want to make one node kill you when it falls on your head.
Every time a mod API is left undocumented, a koala dies.
- D00Med
- Member
- Posts: 949
- Joined: Sat Feb 07, 2015 22:49
- GitHub: D00Med
- Location: Australia...somewhere
Re: Post your modding questions here
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
My subgame: viewtopic.php?f=15&t=14051#p207242
Re: Post your modding questions here
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?
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?
- 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
Where are you initializing `fr1`? The only place you set it in your snippet is after you access that variable.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.
[...]
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
Check out my stuff! | Donations greatly appreciated! PayPal
- D00Med
- Member
- Posts: 949
- Joined: Sat Feb 07, 2015 22:49
- GitHub: D00Med
- Location: Australia...somewhere
Re: Post your modding questions here
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?
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
My subgame: viewtopic.php?f=15&t=14051#p207242
- 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
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
Check out my stuff! | Donations greatly appreciated! PayPal
Re: Post your modding questions here
Um, how do I override an entity?azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
Re: Post your modding questions here
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
Is there a good guide to metadata anywhere? The Rubenwardy one isn't too clear
- 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
override_item("builtin_____") or something like thatpithy wrote:Um, how do I override an entity?azekill_DIABLO wrote:when it falls, it's an entity. you should override it. check builtin dir.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Post your modding questions here
Item Metadata: https://github.com/minetest/minetest/bl ... .txt#L2968Icalasari wrote:Is there a good guide to metadata anywhere?
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.
You cannot use minetest.override_item for this. Instead, it's possible to access the data table directly:pithy wrote:Um, how do I override an entity?
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>
-
- Member
- Posts: 14
- Joined: Mon Nov 23, 2015 22:50
Re: Post your modding questions here
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.
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")
Re: Post your modding questions here
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.pithy wrote:Is there a way to make a node kill you when it falls on your head?
- 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
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.PlanetKiller wrote:1. check a specific pixel on the player texture to determine character type (using alpha channel)
See the `set_physics_override` method of player objects (here's some docs)2. give character multi-jumps and low grav based upon type
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).3. swap player model when jumping, or based upon gender
Not possible at the moment, sorry.4. modify/view player hitbox
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
Check out my stuff! | Donations greatly appreciated! PayPal
- 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
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!
DMs are always open if you want to get in touch!
- 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
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
Check out my stuff! | Donations greatly appreciated! PayPal
- 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
thank you :)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!
DMs are always open if you want to get in touch!
Re: Post your modding questions here
Thanks. And yeah it was node metadata - It slipped my mind at the time that item metadata was also a thingKrock wrote:Item Metadata: https://github.com/minetest/minetest/bl ... .txt#L2968Icalasari wrote:Is there a good guide to metadata anywhere?
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.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Post your modding questions here
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#L1405Icalasari wrote:Thanks. And yeah it was node metadata - It slipped my mind at the time that item metadata was also a thing
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>
[colorize:<color>:<ratio>
Is 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?
Code: Select all
[colorize:<color>:<ratio>
- 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
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.
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
Check out my stuff! | Donations greatly appreciated! PayPal
Re: Post your modding questions here
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 waysKrock 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 ;)
- 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
You can use mobs_redo as it is, then use entity_override to add a special override on mob_punch or on_right_clickIcalasari 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?
viewtopic.php?f=9&t=15518
None by default, best bet is mobs_redo for nowIcalasari 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
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...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,
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
- D00Med
- Member
- Posts: 949
- Joined: Sat Feb 07, 2015 22:49
- GitHub: D00Med
- Location: Australia...somewhere
Re: Post your modding questions here
That was my intention - I only want to add fr1 if it doesn't exist alreadykaeza 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.
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242
My subgame: viewtopic.php?f=15&t=14051#p207242
Who is online
Users browsing this forum: No registered users and 11 guests