XCOM 2
[WOTC] WSR Weapon Skin Replacer - Core
 This topic has been pinned, so it's probably important
Iridar  [developer] 20 Sep, 2018 @ 12:14pm
Detailed Examples
BARE MINIMUM

Let's say you want to make acceptor weapon A look and sound like donor weapon B. First you need to figure out Template Names for both weapons.

Once you have template names, you go into XComWeaponSkinReplacer.ini and put a line in:
+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=AcceptorWeaponA, DONOR_TEMPLATE=DonorTemplateB)
For example:
+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=AssaultRifle_CV, DONOR_TEMPLATE=Cannon_CV)
This is the minimum of what you have to do, and this will make Weapon A look and sound like Weapon B.

CONFIGURING VISUAL WEAPON ATTACHMENTS

In the example above, the Weapon A will keep using the same appearance of its upgrades as the original acceptor weapon, assuming it had them.

So with the Rifle-Cannon example above, the rifle will look like a cannon with weapon attachments for a rifle. Rather silly: https://imgur.com/a/65rljhM

In this case, it would be proper to take the attachment appearance from the donor weapon, like this:
+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=AssaultRifle_CV, DONOR_TEMPLATE=Cannon_CV, COPY_DONOR_ATTACHMENTS=True)
Note that this will do anything only if the donor weapon actually has any visual attachments associated with it.

If you're using a weapon with visual attachments as an acceptor, and a weapon without them as a donor, you can often keep using some of the original attachments, although it will not work with many weapons from mods, because they could be using different attachment sockets, or could have none at all.

Even when it does work, it often looks like this: https://imgur.com/a/9BCIxdV
Here I replaced the appearance of Shard Gun (Magnetic Shotgun) with M23 Katana.
Some attachments fit as if they've been intended for this weapon, while others clearly don't.

This is why I have provided you with several options to configure attachments:
1) Replace the skeletal mesh of the weapon attachments applied to a specific attachment socket:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=Shotgun_MG, SOCKET=Suppressor, REPLACEMENT_MESH="CnvSMG.Meshes.SM_HOR_Cnv_SMG_SuppressorB")
This is the way to go if the attachment socket is roughly where it should be, but the current attachment mesh does not fit. Then you can replace it with a mesh used by a different attachment. You can find mesh names for base game weapon attachments in the ReadMe.txt in lines like this:
Template.AddUpgradeAttachment('Suppressor', 'UIPawnLocation_WeaponUpgrade_Sniper_Suppressor', "ConvSniper.Meshes.SM_ConvSniper_SuppressorB", "", 'SniperRifle_CV', , "img:///UILibrary_Common.ConvSniper.ConvSniper_SuppressorB", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvSniper_SuppressorB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_barrel");
The first "word" in single quotes is the attachment socket name. Second is the attachment preview camera setting for the armory. Third is the attachment mesh name that you can use.

Weapon mods that add their own attachments typically do it in the X2DownloadableContentInfo_ModName.uc, usually in same lines as above, although the exact method may differ from mod to mod.

2) Remove attachments from a specific socket:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=SniperRifle_MG, SOCKET=Stock)
This can be useful if the attachment socket is so misaligned that nothing would fit there.

3) Replace a specific attachment mesh with another mesh:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=SniperRifle_MG, SOCKET=Optic, ORIGINAL_MESH="MagSniper.Meshes.SM_MagSniper_OpticB", REPLACEMENT_MESH="MagSniper.Meshes.SM_MagSniper_OpticC")
This is useful in case one attachment socket can accept different attachments, which is the case for optics and magazine upgrades. It could be that one attachment fits, while the other does not. So you can use this method to replace the skeletal mesh for just one attachment type, instead of making all attachments used in this socket look the same.

If you don't specify the REPLACEMENT_MESH, the attachment with ORIGINAL_MESH will be hidden.

4) You can change the socket used by the acceptor attachment:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=SniperRifle_MG, SOCKET=Optic, SOCKET_REPLACEMENT=Mag, ORIGINAL_MESH="MagSniper.Meshes.SM_MagSniper_OpticC", REPLACEMENT_MESH="CnvReaperRifle.Meshes.SM_HOR_Cnv_ReaperRifle_OpticC")
This can be useful if you're hunting for a perfect attachment position on the weapon mesh, as attachment sockets often have different positions on the weapon's mesh.

One attachment socket can hold any number of attachments. However, most base-game weapons are created to be modular right from the start, and usually they have a base mesh - the "gun itself" - with some default attachments set up, such as the grip/muzzle brake/magazine/etc. If you associate any other attachment with a socket used by a default attachment, it will disappear.

The line from the example above replaces the Gauss Rifle's (Magnetic Sniper Rifle) default Scope mesh with Vektor Rifle's Scope mesh, and now associates it with the socket normally occupied by default magazine attachment. So if you were to use this line and tried to equip a scope on your Guass Rifle, its default magazine would disappear.

5) Just remove all visual attachments from the acceptor weapon:
+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=SniperRifle_MG, DONOR_TEMPLATE=WP_M97Viper_MG, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True, HIDE_ACCEPTOR_ATTACHMENTS=True)
This is just a quick nuclear option, given mostly for convenience.

Note that all of the attachment configuration can be done without replacing weapon archetypes. You can simply take an attachment for any existing weapon and replace its mesh with another one. E.g. you can make a Bullpup Repeater look like a Rifle Repeater instead:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=Bullpup_CV, SOCKET=Suppressor, REPLACEMENT_MESH="CnvSMG.Meshes.SM_HOR_Cnv_SMG_SuppressorB")

CREATING OR MOVING SOCKETS

This is done through SOCKETS_TO_ADD command. For example:
+SOCKETS_TO_ADD=(TEMPLATE=SMG_CV, SOCKET_NAME=BayonetBonus, OFFSET_X=11.375f, OFFSET_Z=0.85f, SCALE_X=0.6f, SCALE_Y=0.55f, SCALE_Z=0.55f)

Full list of arguments:
TEMPLATE - TemplateName of the weapon that will have a new socket created.
BONE - Optional. Which bone of the weapon's skeletal mesh should be used as the base for the new socket. 'root' is used by default.
SOCKET_NAME - Name of the new socket to created, or name of the existing socket to be moved.
OFFSET_X, OFFSET_Y, OFFSET_Z - used to fine-tune the socket's position relative to its base bone.
PITCH, YAW, ROLL - set the rotation angle of the socket. 65536 is 360 degrees, so 65536 / 4 = 16384 is 90 degrees. This value can be negative.
SCALE_X, SCALE_Y, SCALE_Z - You must specify all three. These allow you to resize meshes attached to this socket.

Ony mesh can have only one socket with the same name, so if you try to "add" a socket with a name that already exists, it will "replace" the existing socket, effectively moving it to a different location. There's all kinds of stuff this mechanic can be used for, but mostly for adding new sockets for visual weapon attachments, which is used by my Bayonets mod.

However, in theory, you can build whole weapons using new sockets and defaul attachmens (see below).

ADDING DEFAULT ATTACHMENTS

Most weapons in the base game use the default attachment system. The weapon mesh itself inlcudes only the "gun itself[i.imgur.com]", while its stock/sights/grip/trigger/etc are added to the weapon template as default attachments.

Weapon Skin Replacer too can add default attachments to a weapon using this syntax:
+DEFAULT_ATTACHMENT=(TEMPLATE=Shotgun_MG, SOCKET=Suppressor, MESH="CnvSMG.Meshes.SM_HOR_Cnv_SMG_SuppressorB")
One attachment socket can have any number of default attachments associated with it, but the latest added attachment will disappear if you try to equip a "normal", non-default attachment to that socket. This is how the base game allows you to "replace" certain weapon parts by "upgraded" parts.

So by using DEFAULT_ATTACHMENT, you can modify only the initial shape of the weapon, and let it be changed when you add "normal" attachments.

Alternatively, you can use default attachments to permanently modify the shape of the weapon, regardless of the added attachments. There are two ways:

A. You can add default attachments to a socket that is not used by "normal" attachments.
B. You can add a default attachment to the same socket two times or more, although it could result in visual artifacts, such as flickering mesh, because technically you would have two identical meshes in the same place.

CONFIGURING ARMORY AND ENGINEERING

If you're using a mod-added weapon as a donor, you can hide the donor weapon from the inventory like this:
+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=SniperRifle_MG, DONOR_TEMPLATE=WP_M97Viper_MG, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)
The flags for hiding donor weapon and its schematic are separate and optional to help avoid potential issues. For example, if you were to do this for a conventional cannon, your Grenadiers would be left without a primary weapon option.

You can also quickly hide unwanted weapons like this:
+WEAPONS_TO_HIDE=WP_M97Viper
Engineering schematics for these weapons will be removed automatically.

It's possible that some weapon mods will add some extra upgrades in Engineering that this mod would fail to remove normally. In this case, you can hide them manually like this:
+SCHEMATICS_TO_HIDE=SchematicTemplateName
Schematic template names can be found in mod's source code, usually in a file that has "X2Item" and "Schematic" in its name. For the Coilgun mod mentioned in this example, it would be X2Item_CoilSchematics.uc. Schematic template names can be found in lines like this:
`CREATE_X2TEMPLATE(class'X2SchematicTemplate', Template, 'AssaultRifle_CG_Schematic');
Last edited by Iridar; 23 Mar, 2019 @ 8:52am
< >
Showing 1-15 of 53 comments
PotatoAim2k1 20 Sep, 2018 @ 8:43pm 
I couldn't get this to work. I'm testing by swapping the magazine attachments between the Coil SMG and Coil Cannon, but I don't see any visual changes.

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

Thoughts?
Nephalem 20 Sep, 2018 @ 9:11pm 
is it possible to add attachment to Advent Golden Pistol if its fit?
Nephalem 20 Sep, 2018 @ 9:32pm 
Originally posted by Professor Spank It:
I couldn't get this to work. I'm testing by swapping the magazine attachments between the Coil SMG and Coil Cannon, but I don't see any visual changes.

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

Thoughts?


it should be

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, ORIGINAL_MESH="LWAssaultRifle_CG.Meshes.LW_CoilRifle_MagA", REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

not sure...
PotatoAim2k1 20 Sep, 2018 @ 9:35pm 
Originally posted by PathFinder:

it should be

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, ORIGINAL_MESH="LWAssaultRifle_CG.Meshes.LW_CoilRifle_MagA", REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

not sure...

Tried that too and nothing worked.
Nephalem 20 Sep, 2018 @ 9:39pm 
Originally posted by Professor Spank It:
Originally posted by PathFinder:

it should be

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, ORIGINAL_MESH="LWAssaultRifle_CG.Meshes.LW_CoilRifle_MagA", REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

not sure...

Tried that too and nothing worked.


you might using the HIDE_ACCEPTOR_ATTACHMENTS=""?

not sure...maybe?
PotatoAim2k1 20 Sep, 2018 @ 9:43pm 
Originally posted by PathFinder:

you might using the HIDE_ACCEPTOR_ATTACHMENTS=""?

not sure...maybe?

Nah, trying to swap the attachment was the only thing I did in the .ini. Maybe it's a mod conflict somewhere and a mod is changing the name of a template.
Iridar  [developer] 21 Sep, 2018 @ 12:11am 
Originally posted by PathFinder:
is it possible to add attachment to Advent Golden Pistol if its fit?
Depends on if the Golden Pistol has attachment sockets set up. Pistols typically don't. The reason we can add attachments to other pistols is because Primary Secondaries replaces pistol meshes with its own copies with proper attachment sockets. Which mod adds the Advent Golden Pistols?

Originally posted by Professor Spank It:
I couldn't get this to work. I'm testing by swapping the magazine attachments between the Coil SMG and Coil Cannon, but I don't see any visual changes.

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

Thoughts?

Both ways should work:
Originally posted by Professor Spank It:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")
Originally posted by PathFinder:
+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, ORIGINAL_MESH="LWAssaultRifle_CG.Meshes.LW_CoilRifle_MagA", REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")
The difference is that first one replaces appearence of ALL attachments in the "Mag" socket, while the second replaces only specific one.

If neither is working first method is not working - and not even hiding any attachments from the weapon - it means my mod tries to do its magic before the coilgun mod had a chance to register its weapon attachments. Like I said, moving Weapon Skin Replacer to your local mods folder should fix it, because I tested and this worked for me:

+ATTACHMENT_REPLACEMENT=(TEMPLATE=SMG_CG, SOCKET=Mag, ORIGINAL_MESH="LWAssaultRifle_CG.Meshes.LW_CoilRifle_MagC", REPLACEMENT_MESH="LWCannon_CG.Meshes.LW_CoilCannon_MagA")

https://imgur.com/a/gx1LcIi
Last edited by Iridar; 21 Sep, 2018 @ 12:11am
Nephalem 21 Sep, 2018 @ 2:46am 
Queston. About the Socket thing. Are laser sight and scope both optic socket?
Nephalem 21 Sep, 2018 @ 2:56am 
3 Tiers replacer for SHOTGUN KATANA

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_CV, DONOR_TEMPLATE=WP_M23Katana, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_MG, DONOR_TEMPLATE=WP_M23Katana_MG, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_BM, DONOR_TEMPLATE=WP_M23Katana_BM, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

the problem is I can't hide the donor template..its still shows up in the armory
Iridar  [developer] 21 Sep, 2018 @ 4:08am 
Originally posted by PathFinder:
Queston. About the Socket thing. Are laser sight and scope both optic socket?
Yes.
Originally posted by PathFinder:
3 Tiers replacer for SHOTGUN KATANA

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_CV, DONOR_TEMPLATE=WP_M23Katana, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_MG, DONOR_TEMPLATE=WP_M23Katana_MG, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

+WEAPON_REPLACEMENT=(ACCEPTOR_TEMPLATE=Shotgun_BM, DONOR_TEMPLATE=WP_M23Katana_BM, HIDE_DONOR_TEMPLATE=True, HIDE_DONOR_SCHEMATIC=True)

the problem is I can't hide the donor template..its still shows up in the armory
It works if you start a new campaign. I kinda forgot to make it remove items from campaigns in progress. Gonna update the mod soon to do that.
Iridar  [developer] 21 Sep, 2018 @ 7:10am 
Originally posted by PathFinder:
the problem is I can't hide the donor template..its still shows up in the armory
I've published an update, download it and try again.
PotatoAim2k1 21 Sep, 2018 @ 5:38pm 
@Iridar Thanks for all of the info. I'll play around with the settings today and move some of my mods around to fix the mod load order, and put this mod into the local mods folder.
Nephalem 21 Sep, 2018 @ 9:33pm 
M23 Katana.can add attachments... how about M96 Mattock Assault Rifle and M8 Avenger Assault Rifle... it seems I can't put the attachment.
Iridar  [developer] 22 Sep, 2018 @ 12:30am 
Originally posted by PathFinder:
M23 Katana.can add attachments... how about M96 Mattock Assault Rifle and M8 Avenger Assault Rifle... it seems I can't put the attachment.
Mattock and Avenger have only one attachment socket, Trigger. I'd try using SOCKET_REPLACEMENT=Trigger with all of the original acceptor attachments, though it would probably not work and also made all of the attachments move during firing.
Nephalem 22 Sep, 2018 @ 5:20am 
I have an issue to report. For those who have laser and coilguns mod with cosmetic lasers and coilguns... it will slow the performance of your game means framerate issue. Same with beam grenadier cosmetics.
< >
Showing 1-15 of 53 comments
Per page: 1530 50