Trying to add custom abilities that utilize pistols to a custom class, need some help.

Post Reply
junk
Posts: 7
Joined: Mon Jan 23, 2017 2:24 pm

Trying to add custom abilities that utilize pistols to a custom class, need some help.

Post by junk »

A custom class that I am trying to update for LW2 uses several custom abilities that affect pistols, such as increasing critical chance or shred. These abilities all work, but in the class data ini I used to have them keyed to eInv secondary, and they still work that way if I force the pistol as a secondary weapon. However, +allow pistol as a secondary weapon you can't use upgraded pistols...

so my current workaround is to swap out the pistol as a secondary weapon for, right now at least, a gauntlet, and tying all the pistol abilities to einv utility, "pistol" as illustrated by the AWC perk uc. However I can't seem to get this to work.

Lets say I have an ability called "Pistoleer" that is supposed to add +Aim and Pierce to pistols. How do I get it to actually apply to utility slot pistols now? How do I write that in the ini for my class, like how do I assign it the way that you would assign an ability to PrimaryWeapon or Secondary Weapon. Or do I have to go back to my ability set UC and make some kind of conditional modifier there, if so what would that look like?
Amineri

Re: Trying to add custom abilities that utilize pistols to a custom class, need some help.

Post by Amineri »

So this is a little bit tricky. XCOM 2 doesn't really have support for items being equippable in different types of equipment slots. Most item template define which slot they can go into via :

Code: Select all

Template.InventorySlot = eInvSlot_PrimaryWeapon;
Template.InventorySlot = eInvSlot_SecondaryWeapon;
Template.InventorySlot = eInvSlot_Utility;
This isn't an array, just a single value. So what I ended up doing was creating a second set of items, "pistols for utility slots". The alternative was to spend a bunch more time redesigning/rewriting the system.

This means that the original pistols are still there (excepting the Hunter Pistol, which we modify via template mod). However, the weapon schematics for upgrading the original pistol items were disabled, and we didn't add the ability to build any of the upgrades to our techs, which is why the secondary slot version can't be upgraded. And since they are different items, they would have to be maintained separately.

I will have to give this whole area more though, I think ...

--------------------------------------------------------------------------------------------------------------------

The only exception to the above are grenades, which can go in both the Utility slot and the GrenadePocket slot. However, this functionality isn't defined in the template, but is hard-coded in. The GrenadePocket slot is hard-coded to display any item that derives from X2GrenadeTemplate. The X2GrenadeTemplate defines as default InventorySlot=eInvSlot_Utility.

Some of this comes down to design decisions made early on. One such decision was that, even though we are making changes to XComGame.upk, these changes would never contain any LongWar2-specific code. We did this to maintain as much compatibility as we could with other mods. Which I think has been fairly successful, although it his its limitations/tradeoffs.
junk
Posts: 7
Joined: Mon Jan 23, 2017 2:24 pm

Re: Trying to add custom abilities that utilize pistols to a custom class, need some help.

Post by junk »

I understand; the scope of the changes to the game for LW2 is really impressive, and the fact that everything fits together so tightly is almost like this was the game Xcom2 was waiting to be, so far other than the sidearm problem which is irksome to a handful of modders, I really love it.

As a quick hack, what do you recommend as a temporary workaround if I wanted a custom class ability tree to affect pistol use?
Here are some things I was thinking but have a limited idea how to implement or if they'll work :

Forcing pistol as Secondary weapon and giving the class GTS upgrades that Upgrade Pistols to Mag and Beam, though this does preclude the class from using hunter pistols, and I'm not sure if its possible to link the GTS upgrades to technology research

Make custom abilities that affect the eInv utility slot without specifying pistols, which limits my design space and may have weird interactions with grenades (i haven't tested this yet and I don't know all the implications). My abilities are pretty straight forward, adding damage, aim, crit, pierce and shred to pistols through separate tiers of abilities, right now I'm using the tags from XMODBASE but I can draw them out the long way if I need to.

Writing the custom abilities with some kind of conditional modifier regarding the pistol and removing the eInvSlot designation from the ability listing in the class and keeping the pistol in the utility slot - Is there a way to make an item slot "Pistol only" or grant a free pistol pocket? if so how would I hook it with an ability?
Post Reply