I am failing to update the playertexture

User avatar
Milan*
Member
 
Posts: 203
Joined: Thu May 28, 2015 06:45
GitHub: tchncs
IRC: Passant
In-game: Milan Passant

I am failing to update the playertexture

by Milan* » Tue Jan 10, 2017 12:52

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.
 

User avatar
TumeniNodes
Member
 
Posts: 1335
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes

Re: I am failing to update the playertexture

by TumeniNodes » Tue Jan 10, 2017 12:56

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
Flick?... Flick who?
 

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: I am failing to update the playertexture

by stu » Tue Jan 10, 2017 18:27

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"},
 

User avatar
Milan*
Member
 
Posts: 203
Joined: Thu May 28, 2015 06:45
GitHub: tchncs
IRC: Passant
In-game: Milan Passant

Re: I am failing to update the playertexture

by Milan* » Wed Jan 11, 2017 20:14

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. :)
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: I am failing to update the playertexture

by kaeza » Wed Jan 11, 2017 23:05

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`)..
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 | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 7 guests