Reskinning a weapon

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
User avatar
Lork
NSF
Posts: 58
Joined: Wed Mar 25, 2009 6:33 pm
Location: The Great White North

Reskinning a weapon

Post by Lork »

Let's say I want to make a new type of grenade using a custom texture on the gas grenade model. What's the best way to go about this? As far as I know, there are two ways to do it, and neither of them are working for me:

1. Using Skin and MultiSkins. This at least gets the grenade into the game with the right textures, but it's prone to annoying glitches. The skin that affects the 3rd person model also changes the colour of JC's arms in first person, for example. Even worse, the 1st person skin has a bad habit of permanently changing back to the original texture after certain animations play.

2. Making a "new" mesh using the same model, but with the new texture. This would be ideal, but I don't think it's possible without having access to the original model outside of a compiled package.

Hopefully I'm just missing something obvious. Anybody?
DDL
Traditional Evil Scientist
Traditional Evil Scientist
Posts: 3791
Joined: Mon Oct 17, 2005 10:03 am

Re: Reskinning a weapon

Post by DDL »

RenderOverlays()

It's a event called every frame, and it's what makes sure your weapon gets drawn properly when it's in your hand (in other words, your weapon is normally drawn in 3rd person quite happily, hence you can see it in reflections, but then it calls renderoverlays and draws the first person view over the top of everything drawn thus far, so it's always at the front of the viewfield -no matter how close to a wall you get, your rifle barrel will never appear to 'penetrate' the wall, as it's drawn on top of the world render).

Long story short, pretty much work out which multiskins correspond to which texture slots, then stick a renderoverlays call in your weaponclass, set the first person skins, super the function (to do all the overdrawing stuff with the first person skins), then reset to 3rd person skins so the next frame of world rendering works ok. Essentially you're flipping the skins back and forth every frame of the game, which actually seems to work ok.

So: let's say multiskins 2 is the nade in 3rd person, but the hands in 1st, and multiskins 1 is the nade in first only.

Code: Select all

function renderoverlays(canvas canvas)
{
     multiskins[1]=texture'mynadetex';
     multiskins[2]=none; //clear the 3rd person nade tex from the hand slot
     super.renderoverlays(canvas);
     multiskins[1]=none;
     multiskins[2]=texture'my3rdpersonNadetex';
}
User avatar
Lork
NSF
Posts: 58
Joined: Wed Mar 25, 2009 6:33 pm
Location: The Great White North

Re: Reskinning a weapon

Post by Lork »

Worked like a charm, thanks.
Post Reply