on_spawn=function(self)
self.object:get_luaentity().base_texture="texture.png"
self.base_texture="texture.png"
self.object.base_texture="texture.png"
end
How do I access the texture of a mob?
edit:
I found the answer in the modding book by rubenwardy (^_^). I need to use set_properties on self.object.
Ive been trying to edit a mob so that it beaches correctly when on land, however when trying to get the objects position minetest crashes complaining that get_pos() returns nil, which would mean that self doesn't exist.... but ive put the code in the do_custom function that has "self" as one of the callbacks. Any help?
(Please ignore the wrong indentation of some variables, the minetest forums are screwing up indentation and no matter what i do i cant get it to come out right)
Stix wrote:when trying to get the objects position minetest crashes complaining that get_pos() returns nil
The exact error would have been more helpful, but I suspect you want "self.object:get_pos()". The game ObjectRef is stored as object.
Thanks duane! for some reason i thought self was the object, not a table holding the object :)
Ten:
Im not sure if this is a bug or a limitation of the api but ive now gotten the beaching to work... somewhat.
I understand that the mob def table is run every server tick for updates (or at least for the do_custom() function) And using some minetest.chat_send_all()'s and dump's seems to confirm that. My problem is however that The mobs stats arent always overrided along with the new animation being set when it gets beached. My if statement turns true every time they are beached, which means the assignement statements within should always run, but the dont, at least not always. Generally if the mob swims on to the shore itself it becomes properly beached, but if I knock it onto land or spawn it there it generally doesnt become beached. And if i restart the game some mobs that wouldnt beach become beached and some beached mobs become un-beached. Any idea what the problem is? (*note that i dont get any errors with the code im using)
-- Aquatic Mobs get beached
do_custom = function(self, dtime)
local pos = self.object:get_pos()
pos.y = pos.y - 1
local node = minetest.get_node_or_nil(pos)
print(dump(node))
if node and self.standing_in ~= self.fly_in and node.name ~= self.fly_in then
minetest.chat_send_all("True")
if self.type ~= "animal" then
self.type = "animal"
end
if self.passive ~= true then
self.passive = true
end
if self.walk_velocity ~= 0 then
self.walk_velocity = 0
end
if self.run_velocity ~= 0 then
self.run_velocity = 0
end
if self.view_range ~= 0 then
self.view_range = 0
end
if self.walk_chance ~= 0 then
self.walk_chance = 0
end
if self.pushable ~= true then
self.pushable = true
end
if self.animation ~= animation_beached then
self.animation = animation_beached
end
return
elseif self.standing_in == self.fly_in then
self.type = "monster"
self.passive = false
self.walk_velocity = 1
self.run_velocity = 3
self.view_range = 4
self.walk_chance = 100
self.animation = animation_swimming
self.pushable = false
return
end
Last edited by Stix on Tue Aug 13, 2019 11:38, edited 1 time in total.
2019-08-12 18:10:26: WARNING[Server]: Call to deprecated function 'settexturemod', please use 'set_texture_mod' at ...o/.minetest/games/endless_dungeon/mods/mobs_redo/api.lua:2240
2019-08-12 18:10:32: WARNING[Server]: Call to deprecated function 'settexturemod', please use 'set_texture_mod' at ...o/.minetest/games/endless_dungeon/mods/mobs_redo/api.lua:2212
I found an issue with the mobs redo api: When baby mobs grow up they are supposed to jump up to prevent them getting stuck inside blocks, however this doesnt always work first try, especially with bigger mobs, so i was thinking perhaps there could be a check for adults (or all mobs in general if wanted) to see if their feet are inside a solid node, and if so, make them jump. the get_pos() function however returns the pos of the middle of the entity, so i wrote a simple calculation to get the feet pos for a mobs api im currently working on, feel free to use it:
This isn't a bug, but i have an issue with the cow mob.
I haven't been around long and I'm learning as i go.. Minetest..., Lua..., Blender are all new to me, gimp also but for around 4 months now.
Since I discovered minetest, i have almost finished the default texture pack at 256x256 and as a break from working images i started taking a look at modding. I have built a couple of things so far, one thing led to another and my mod idea is getting bigger every hour or so. To take thing further and based on a tutorial i saw, can't find it now, i used a mob as an example to try and modify it. All's well so far. Then i decided to build a new mesh for it and here's the hick.
My mesh looks like a tiny beetle running around my feet and i can't see how or where i am supposed to scale it up.
Within blender everything is the right size although just short of the 3 block radius (i believe i have read correctly 3 max?)
The mob i have tried to learn with and modify is the mob_cow.x This was a real pig (cow) to get converted and into blender to have a look but it was sat on it's rear end, bones are there but no animation. I straight built a new mesh (not yet animated) and saved it as .b3d.
Is there something i should do, or is it impossible/very hard to replace the cow.x with a newmesh.b3d at the right scale.
regards
Excellent v-rob that did the trick, thanks man. I've been scratching my head for an hour or so. I just have to make this thing walk and eat like the cow now, I can model almost anything anyone wants, but have never had the need to animate in all my years. LOST! yeah you could say that.
I'll stop here so as to not mess up the thread.
Thanks.again
Hello, dear developer. Installed it yesterday myself, your mod "Mobs Redo v1.5".
At the approach of the mob in the night, when the mob attack, the server is crashing and gives an error.
2019-09-02 09:08:40: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '*builtin*' in callback luaentity_Step(): Runtime error from mod '*builtin*' in callback on_punchplayer(): /usr/share/minetest/builtin/game/knockback.lua:45: attempt to call method 'add_p
2019-09-02 09:08:40: ERROR[Main]: layer_velocity' (a nil value)
2019-09-02 09:08:40: ERROR[Main]: stack traceback:
2019-09-02 09:08:40: ERROR[Main]: /usr/share/minetest/builtin/game/knockback.lua:45: in function </usr/share/minetest/builtin/game/knockback.lua:25>
2019-09-02 09:08:40: ERROR[Main]: /usr/share/minetest/builtin/game/register.lua:417: in function </usr/share/minetest/builtin/game/register.lua:401>
2019-09-02 09:08:40: ERROR[Main]: [C]: in function 'punch'
2019-09-02 09:08:40: ERROR[Main]: ...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:2442: in function 'do_states'
2019-09-02 09:08:40: ERROR[Main]: ...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:3249: in function <...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:3104>
2019-09-02 09:08:40: ERROR[Main]: stack traceback:
2019-09-02 09:08:40: ERROR[Main]: [C]: in function 'punch'
2019-09-02 09:08:40: ERROR[Main]: ...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:2442: in function 'do_states'
2019-09-02 09:08:40: ERROR[Main]: ...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:3249: in function <...hare/minetest/games/minetest_game/mods/mobs_redo/api.lua:3104>
the error looks like its dealing with the new dev release of Minetest and the player knockback feature, not an actual error with the mob api. I'll look into it and see why it happpens though.
Please forgive our inexperience. We run a small server for a few family's worth of kids to play on together and they have been asking for animals. We got Mobs Redo installed with the mobs_animal, mobs_npc and mobs_horse and are testing it before rolling it out to the kids. We've figured most everything out so far (the previous links to documentation provided earlier in this thread don't seem to be working anymore) by reading this thread and some trial and error, but we have not been able to solve the Protection Runes. They visually look like they work, but even after I give one to an animal and the white 'sparkles' come out, my husband can still kill it, for example. So far we're stumped, can you help us out?
If you need details, we're running 0.4.16 in a world that used v6 generator and so far the only other mods we have installed are craftguide, homedecor_modpack, travelnet and moreblocks.
For a long time I have my fork mobs_redo inside MultiCraft_game.
If TenPlus1 is interesting, I can make a PR of my changes. My formatting style is different (according to the Lua standard). However, perhaps there is something interesting here. https://github.com/MultiCraft/MultiCraf ... do/api.lua
TenPlus1: Oh, that would be difficult :) I can do PR, and then you will say what to revert and what to accept. Or I can suggest you use Diff / WinMerge / your favorite utility for comparing code.