Page 1 of 1

Help with entities please!!!

PostPosted: Thu Sep 17, 2015 00:24
by Blehmeh98
Hello,
I am a newbie at minetest modding (though not a newbie at Lua in general, as I have a good bit of experience with it having used multiple libraries). I cannot seem to make an entity, no matter how hard I try, and there is nowhere that I can find good documentation online to see what I am doing wrong. I have tried looking at other mods to see what strategy they take, but no cigar. I then see other people excelling at making entities and I wonder what I am doing wrong. Is it because I am using duckduckgo instead of google?

Anyways, can you please tell me what in my code is flagging errors? I have done tests by "commenting out" pieces of code and I know for certain that my attempt at registering an entity is wrong somehow. Please and thank you.

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
minetest.register_entity("sciencing:pug", {
   hp_max = 6,
   weight = 10,
   physical = false,
   timer=0,
   visual = "sprite",
   visual_size = {x=1, y=1},
   textures = {"sciencing:sciencePug"},
   lastpos={},
   collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
   makes_footstep_sound = false,
       automatic_rotate = false
}

Re: Help with entities please!!!

PostPosted: Thu Sep 17, 2015 01:39
by benrob0329
http://dev.minetest.net/minetest.register_entity

I use DDG as well, I doubt that is the problem, actually its probably better than Google :-P

Re: Help with entities please!!!

PostPosted: Thu Sep 17, 2015 14:52
by eduardomezencio
The most obvious thing I can see is forgetting to close the parenthesis at the end, but maybe you just forgot to copy it here?

Re: Help with entities please!!!

PostPosted: Thu Sep 17, 2015 15:08
by 4aiman
Umm.. why not take some entity that already exists?

Here's some basic entity:
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
minetest.register_entity("<mod name>:<entity name>", {
    hp_max = <some value>,
    collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
    textures = {<a texture>},
    visual = <whatever type you want>,
    visual_size = {x=<scale multiplier>,y=<scale multiplier>,z=<scale multiplier>},
    makes_footstep_sound = <true or false>,
})

Re: Help with entities please!!!

PostPosted: Thu Sep 17, 2015 19:38
by blert2112
Just off the top of my head... Have you checked the texture name? You have it listed with a semicolon in it. Is that how you have the actual file name? The texture should just be the file name.

Re: Help with entities please!!!

PostPosted: Fri Sep 18, 2015 01:41
by Blehmeh98
blert2112 wrote:Just off the top of my head... Have you checked the texture name? You have it listed with a semicolon in it. Is that how you have the actual file name? The texture should just be the file name.

Ohhh . . . DId not notice that. Thank you! I will try the other errors listed here. I used Ctrl C Ctrl V so I could not have made a mistake copying it.

Re: Help with entities please!!!

PostPosted: Fri Sep 18, 2015 01:46
by Blehmeh98
eduardomezencio got it right. I had done it correctly, but I forgot to add parentheses at the end. Also, blert2112 was right about me writing the texture name wrong, but it chose to create a dummy immage instead of crash the game. Thank you guys! I will release some mods soon so you can see what I am working on!