Page 1 of 1

I am failing to update the playertexture

PostPosted: Tue Jan 10, 2017 12:52
by Milan*
Heyo,

i've tried to write a little mod which changes the playertexture for each player related to his/her name.
So i looked how it is done in the default mod and how some skinmods handle this.

My current test-code looks like:

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_on_joinplayer(function(player)
     player:set_properties({
         visual = "mesh",
         mesh = "character.b3d",
         visual_size = {x=1, y=1},
         textures = "singleplayer.png",
     })
end)


I am able to change the model and the size but the texture stays on the default one.

Re: I am failing to update the playertexture

PostPosted: Tue Jan 10, 2017 12:56
by TumeniNodes
Milan* wrote:Heyo,

i've tried to write a little mod which changes the playertexture for each player related to his/her name.
So i looked how it is done in the default mod and how some skinmods handle this.

My current test-code looks like:

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_on_joinplayer(function(player)
     player:set_properties({
         visual = "mesh",
         mesh = "character.b3d",
         visual_size = {x=1, y=1},
         textures = "singleplayer.png",
     })
end)


I am able to change the model and the size but the texture stays on the default one.


Just a quick guess here... shouldn't your .png file use the name of your mod, rather than just "singleplayer.png?
Seems to me this mod is just calling to use the default provided image?

edit> nevermind... I'm wrong. please disregard this message

Re: I am failing to update the playertexture

PostPosted: Tue Jan 10, 2017 18:27
by stu
Milan* wrote:Heyo,

i've tried to write a little mod which changes the playertexture for each player related to his/her name.
So i looked how it is done in the default mod and how some skinmods handle this.

My current test-code looks like:

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_on_joinplayer(function(player)
     player:set_properties({
         visual = "mesh",
         mesh = "character.b3d",
         visual_size = {x=1, y=1},
         textures = "singleplayer.png",
     })
end)


I am able to change the model and the size but the texture stays on the default one.


Textures is a table, so It should be written
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
textures = {"character.png"},

Re: I am failing to update the playertexture

PostPosted: Wed Jan 11, 2017 20:14
by Milan*
Hi stu, this is what my code looked like since the beginning - it was only changed while i tried everything possible - anyway, i changed it back, still does not work. But thanks. :)

Re: I am failing to update the playertexture

PostPosted: Wed Jan 11, 2017 23:05
by kaeza
The player code in default mod may be resetting it back to the default texture.

Try using `default.player_set_textures` (you will need to depend on `default`)..