So you've created yourself a bad *** skin in photo shop but now want to know how to get it onto a weapon.
Well first off this isn't Source. You can't simply replace your texture file and then go play on servers with the cvar sv_pure set to 0. Unreal just doesn't work that way.
I'm going to show you the easiest way to do this within the limitations of this Engine.
Prerequisites
Creating a Basic Mutator by Benjamin
Modifying Existing Weapons by Benjamin
Importing Textures by Whisky
The Mutator
That was easy wasn't it?
Breakdown
We start by loading the texture package we created into memory so it can find the texture. In this, as it's a small mut, I've told the code to repackage our utx into the mutator package as well. So then we have only to give out one file to clients. This works best on SMALL mods like reskins and hud changes. It's not really suitable for larger mods.
We call upon the PostBeginPlay() function because we want to change variable of the weapon's skin before the game starts. We then edit the weapon's defualt properties to reflect our changes. Something to bare in mind at this point is that there are currently two texture variables used by the weapons. Skins and SkinRef so check which one you need to replace before compiling otherwise you'll just get errors.
In defualt properties:
is set so that a client connecting to a server running this mod downloads the required files. Better than manually adding to the server's config file.
Also the don't forget the group name must be prefixed with KF- otherwise it won't show up in the mutator list.
The following is a bit tricker to explain, so bare with me.
What we are doing here is telling the mutator that server is the boss and that the clients have to follow suit. This is to make sure the weapon var is replicated to the clients. Otherwise the server has a new skin but the client doesn't.
In regards to the 3rd person texture. You can't replace this by one line of code. What you have to do is create a new 3rd person mesh (duplication the existing and a new texture applied in the KFEd should be sufficient) then create a new attachment class and use the PostBeginPlay function to call on that
Extras
Some other variables you maybe interested in:
WEAPONCLASS.default.TraderInfoTexture - the image displayed by the trader
WEAPONCLASS.default.mesh & meshref for the actual 3D model (again depends on the weapon)
WEAPONCLASS.default.ItemName
PICKUPCLASS.default.ItemName
PICKUPCLASS.default.ItemShortName - string for the item's name (Yes there are 3 variables for this)
PICKUPCLASS.default.PickupMessage - string displayed on weapon pickup.
Well first off this isn't Source. You can't simply replace your texture file and then go play on servers with the cvar sv_pure set to 0. Unreal just doesn't work that way.
I'm going to show you the easiest way to do this within the limitations of this Engine.
Prerequisites
Creating a Basic Mutator by Benjamin
Modifying Existing Weapons by Benjamin
Importing Textures by Whisky
The Mutator
Code:
class MutWeapReskin extends Mutator;
#exec obj load file="CUSTOMTEXTUREPACKAGE.utx" PACKAGE=MutWeapReskin
simulated function PostBeginPlay()
{
class'WEAPONCLASS'.default.skins[0] = Combiner'MutWeapReskin.CUSTOMTEXTURE';
}
defaultproperties
{
bAddToServerPackages=True
GroupName="KF-"
FriendlyName=""
Description=""
Role=ROLE_Authority
RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=true
}
That was easy wasn't it?
Breakdown
We start by loading the texture package we created into memory so it can find the texture. In this, as it's a small mut, I've told the code to repackage our utx into the mutator package as well. So then we have only to give out one file to clients. This works best on SMALL mods like reskins and hud changes. It's not really suitable for larger mods.
Code:
#exec obj load file="CUSTOMTEXTUREPACKAGE.utx" PACKAGE=MutWeapReskin
We call upon the PostBeginPlay() function because we want to change variable of the weapon's skin before the game starts. We then edit the weapon's defualt properties to reflect our changes. Something to bare in mind at this point is that there are currently two texture variables used by the weapons. Skins and SkinRef so check which one you need to replace before compiling otherwise you'll just get errors.
Code:
simulated function PostBeginPlay()
{
class'AKFWEAPON'.default.skins[0] = Combiner'MutWeapReskin.CUSTOMTEXTURE';
}
In defualt properties:
Code:
bAddToServerPackages = true
is set so that a client connecting to a server running this mod downloads the required files. Better than manually adding to the server's config file.
Also the don't forget the group name must be prefixed with KF- otherwise it won't show up in the mutator list.
The following is a bit tricker to explain, so bare with me.
Code:
Role=ROLE_Authority
RemoteRole=ROLE_SimulatedProxy
bAlwaysRelevant=true
What we are doing here is telling the mutator that server is the boss and that the clients have to follow suit. This is to make sure the weapon var is replicated to the clients. Otherwise the server has a new skin but the client doesn't.
In regards to the 3rd person texture. You can't replace this by one line of code. What you have to do is create a new 3rd person mesh (duplication the existing and a new texture applied in the KFEd should be sufficient) then create a new attachment class and use the PostBeginPlay function to call on that
Code:
WEAPONCLASS.default.AttachmentClass=Class'MutWeapReskin.NewWeapAttactmentClass'
Extras
Some other variables you maybe interested in:
WEAPONCLASS.default.TraderInfoTexture - the image displayed by the trader
WEAPONCLASS.default.mesh & meshref for the actual 3D model (again depends on the weapon)
WEAPONCLASS.default.ItemName
PICKUPCLASS.default.ItemName
PICKUPCLASS.default.ItemShortName - string for the item's name (Yes there are 3 variables for this)
PICKUPCLASS.default.PickupMessage - string displayed on weapon pickup.
Last edited: