Game Development Community

Help with setSkinName

by Will Burgers · in Technical Issues · 08/03/2005 (9:30 am) · 37 replies

I am not exactly clear on how setSkinName() works. I need to be able to select the texture to use for the player model. At the moment in the GameConnection:createPlayer function I am attempting to set the player's skin with the following line:

%player.setSkinName("TEX0");

and it appears to work in that %player.getSkinName returns "TEX0" afterward, however the texture is unchanged. I am a bit hazy on the naming convention for this system as well. I've tried naming it TEX0.png, TEX0.PLAYER.png, and a few others, but none seem to work. It'd be great if someone could shed some light on this for me.

Thanks,
Will Burgers
Page«First 1 2 Next»
#21
06/26/2007 (9:21 pm)
In the editor?
#22
06/27/2007 (5:30 am)
In the Hex editor, yes. You'll get a warning that what you're doing will change the filesize, but you should be ok with that
#23
09/25/2007 (9:29 am)
I looked up the function setSkinName() and the docs said it accepts a tag parameter which means that the function is called thus: setSkinName('red'); single quote.
not setSkinName("red"); double quote.
#24
10/03/2007 (10:16 am)
Hi all, its not working for me i exported my dts with "bas.dtsname.png" now i m trying to load "text2.dtsname.png" (its tag) but all i can see the dts object with "Nomaterial" . my dts object is showing with "no materials"..
#25
10/03/2007 (2:09 pm)
Just make sure you create a materials.cs in the folder and define each of the materials by hand and rename the material name without a dot:
new Material(text2_dtsname)
{   baseTex[0] = "text2.dtsname";
};

That should work to fix your problem. At least, it did ours.
#26
10/03/2007 (10:09 pm)
Thanks for reply Eric, i have declare my additional material

new Material(shoes4_malefoot)
{
baseTex[0] = "shoes4.malefoot";
};

where 'shoes4' is my texture name and 'malefoot' is dts name.. if i called setSkin then i can't see my object.
i checked the code previously it was not initialize the new material instance. now its initializing the new material instance but no object on screen.
#27
07/17/2008 (10:59 pm)
So, What Engin are you using. I use TGEA, and want to change some object's skin. It really made me crazy that I find the SetSkinName can only take effect once. That means I first use %obj.setSkinName("warm1") , the object does change its skin, but when I use %obj.setSkinName("warm2") in succession , nothing happenes . and this is my issue:
I write an StaticShapeData and want its skin changed at sometime. I know in TGE, it's an easy work to use SetSkinName method. But in TGEA, I get no luck.
My object name is mysensor1, and has 3 skins : base.sensor.png, warm1.sensor.png and warm2.sensor.png.
When I use Console command mysensor1.setSkinName("warm1");the object does change its skin, but when I use %obj.setSkinName("warm2") respectively, nothing happenes . Howerver, if I use mysensor1.setSkinName("warm2"); first, the object changes its skin to warm2.sensor.png, but no matter how many times I use mysensor1.setSkinName("warm1"); , it will never change its skin again.
Can someone give me some suggestins?
#28
07/21/2008 (7:50 pm)
Quote:Just make sure you create a materials.cs in the folder and define each of the materials by hand and rename the material name without a dot:

new Material(text2_dtsname){ baseTex[0] = "text2.dtsname";};

That should work to fix your problem. At least, it did ours.

Does the "materials.cs" have to be in the same folder as the dts shapes or can I put it with the rest of my scripts and just make sure to exec it?
#29
09/05/2008 (10:40 pm)
The materials.cs is a file that is searched globally (I suspect to that you can setup things for shaders next time), so you just have create it in the appropriate folder.
#30
09/06/2008 (5:31 am)
Know any how we can use the "setSkinName" for mounted items on a character?
Like for armour, helmet or gloves?

And some question little difficult and pexuliar..,

A mounted item like an armour dont go after with skin elasticity, in a sequence etc. the
sleeve dont go after the upperarm but upperarm go out of the skin

Know any what is the method that i need to use if(exist)? Thanks prev.:)
#31
01/11/2009 (4:20 pm)
@ChenJian I'm having the exact same problem using 1.8

obj.setskinname("silver");
my object turns silver nicely, I then
obj.setskinname("black");
nothing..

I restart the game
obj.setskinname("black");
and it turns black, then
obj.setskinname("silver");
nothing...

It even shows the correct texture name when using
obj.getskinname();
showing silver but my object remains black onscreen.. *sigh* is setskinname bust in 1.8?
#32
01/11/2009 (4:40 pm)
deleted trebled post
#33
01/11/2009 (4:44 pm)
deleted trebled post
#34
01/11/2009 (5:14 pm)
I know setSkinName, for sure, works in TGE 1.5.2. As for TGEA, I have no idea.

@Dimitris, I had different skins for one of my robots and needed to change the skins of the weapons as well. Remount the shape, for example:
%player.mountImage(GatlingGunImage, 0, false, 'CamoWood');
#35
06/22/2009 (6:20 pm)
I can't believe I'm having troubles with this again... I had this working last summer on some barrels and now I can't get it to work at all. So, quick question:

Does this work with DDS textures?
#36
06/23/2009 (2:32 am)
basic setup is name your texture in 1.8.1, not sure if it works on DDS's

base.something.jpg

red.something.jpg

your materials.cs should contain something like:-
new Material(red)
{
   mapTo = "red.something";
   baseTex[0] = "red.something";

};

then ingame use

%obj.setskinname("red");

note on 1.8.1 you can only do this once unless you have applied the

Making skins work more than once in TGEA 1.8.1

hope that helps
Rob
#37
06/23/2009 (3:58 pm)
Like I said, I already had it working, so I do know how to set it up. I am writing to confirm this does NOT work with DDS textures. I got it working perfectly with PNG.

PS: You don't need the 'mapTo', this works great:
new Material(red)
{
   baseTex[0] = "red.something";
   bumpTex[0] = "something_n";
};
Page«First 1 2 Next»