Replacing A Weapon Texture
Tutorial showing how to replace a weapon's texture with a custom version.
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 default 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
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)
PICKUPCLASS.default.ItemShortName - string for the item's name (Yes there are 3 variables for this)
PICKUPCLASS.default.PickupMessage - string displayed on weapon pickup.