Game Development Community

Skin Swapping

by Derrick Austin · in Technical Issues · 12/05/2007 (7:19 am) · 9 replies

I use this code (along with a guiplayerview, obviously) to setup a player model and set his skin.

PlayerView.setmodel("control/data/shapes/player/player.dts","control/data/shapes/player/player.jpg");

It looked to me like it worked fine. However, when I decided to script in the ability to change skins, the second parameter APPEARS to not be working correctly. Instead of using the skin that is in the second parameter, the model is using the model's default skin. Is there a way to swap out skins like I am trying to do?

#1
12/07/2007 (12:28 pm)
The easiest way would probably be to change the one you want (control/data/shapes/player/player.jpg) to the base. Or right after that you chould change the skin from the base to the right one.
#2
12/07/2007 (3:11 pm)
The naming format for the textures maybe the problem.
base.player.jpg
new.player.jpg
or something like that...
#3
12/07/2007 (3:31 pm)
Hey this reminds me of something i thought about. does skin swapping work correctly in tgea? can swapping skins be used to swap shader materials at runtime?
#4
12/07/2007 (3:39 pm)
@Sean, I know there's a resource out there that allows you to swap materials for TGEA. May be under TSE.
#5
12/07/2007 (10:38 pm)
Quote:The easiest way would probably be to change the one you want (control/data/shapes/player/player.jpg) to the base. Or right after that you chould change the skin from the base to the right one.

Is it possible to move files around with torque scripting???

Quote:The naming format for the textures maybe the problem.

base.player.jpg
new.player.jpg


or something like that...
So would it not work with say, player.jpg, player1.jpg, player2.jpg or so?
#6
12/08/2007 (3:59 am)
Quote:
So would it not work with say, player.jpg, player1.jpg, player2.jpg or so?

No, I don't think so. The standard naming convention is base.player.jpg, green.player.jpg, etc. Do a search on GG and it should turn up a few forum threads and at least one code resource.

That or someone with more knowledge than I can jump in :)
#7
12/08/2007 (9:07 am)
I tryed standard.jpg and new.standard.jpg and it still used standard.jpg... Which is the model's default...

Is it in the way I did the model maybe?
#8
12/08/2007 (5:11 pm)
You need to rename your "standard.jpg" to "base.standard.jpg" then reexport your model with that texture.

Then you can use "new.standard.jpg" as the skin. Like this:
playerView.setmodel("control/data/shapes/player/player.dts",[b]"new"[/b]);
#9
12/08/2007 (10:52 pm)
Thanks! I'll give that a try!