Swap skins of existing mesh?

Discussions about Coding and Scripting
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Swap skins of existing mesh?

Post by 1337GameDev »

I am currently tinkering with some custom weapons, and want to simply make minor edits to existing skins used by the weapon mesh. My current base weapon is the PulseGun.

I see lines like this:

Code: Select all

#exec MESHMAP SETTEXTURE MESHMAP=PulseGunL NUM=1 TEXTURE=Botpack.Ammocount.Ammoled
#exec MESHMAP SETTEXTURE MESHMAP=PulseGunL NUM=2 TEXTURE=JPulseGun_02
#exec MESHMAP SETTEXTURE MESHMAP=PulseGunL NUM=3 TEXTURE=JPulseGun_03
How would I change the texture for "JPulseGun_02?"

Would I just set the actor's "Texture" property to the new texture I have created after importing?

Code: Select all

Texture = Texture'MyPackage.Skins.MyTex_JPulseGun_02';

Code: Select all

#exec TEXTURE IMPORT NAME=MyTex_JPulseGun_02 FILE=Textures\Weapons\MyTex_JPulseGun_02.png GROUP="Skins" FLAGS=2 MIPS=OFF
User avatar
papercoffee
Godlike
Posts: 10244
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.

Re: Swap skins of existing mesh?

Post by papercoffee »

You want to do this on runtime?
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Swap skins of existing mesh?

Post by 1337GameDev »

Or at compile time for a subclass of an existing bisect with a mesh - IE: subclasses UT weapon class.
User avatar
sektor2111
Godlike
Posts: 6133
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Swap skins of existing mesh?

Post by sektor2111 »

As I recall I changed skin for a stock actor - Monster. Also I could see skins changed in MH-DarkWhite map at weapons. Why would be needed another class ?
MH-KillThemAllAgain_sk uses only STOCK monsters except a Brute "ChiefF...ker" and a "TarydiumTitan". All the rest are dynamically re-skined during run-time when are created in map. I don't get the point of a new Class for the same mesh and modified skins - unless that actor is different.
W_Skin_DW.PNG
What this map has I can "edit" with a code by simply accessing desired variable.
For ON-Line cases, new Texture must be added in ServerPackages.

Title: Swap skins of existing mesh ?
Answer: Yes... Why not ?
You do not have the required permissions to view the files attached to this post.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Swap skins of existing mesh?

Post by 1337GameDev »

No offence, but if you read my original post, I state it's for custom weapons.

I have weapons based off original UT ones that have different functionality, and are subclasses.

I want them to have a different skin when placed on maps.

How is this done -- in code?
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Swap skins of existing mesh?

Post by 1337GameDev »

If anybody else finds this post, you edit the following properties:

Skin, MultiSkin [1] (if it's a mesh) and Texture if it's a sprite / different draw type. The first index (index 0) of MultiSkin doesn't seem to be used generally (as most models are imported with texture indices starting at 1).

Can't prove it'll work in every case, but it works for this gun I had that would show a "ghost" model where you're aiming and I tried a dozen different models and they worked just fine.

In a subclass, just set these in the defaultproperties block.

This can be done at runtime and works well.