Jump to content

Make weapon part require a different part to be attached.


jkruse05

Recommended Posts

Just wondering if there is a way to make so a weapon requires a specific type of attachment before another one can be put on. For example, make so a certain barrel requires that the weapon have a pistol configuration, not rifle.

 

I played around with a few conditions in the recipe requirements, but couldn't get anything to work quite the way I wanted. One of the issues is that I'm not sure what the target of that requirement should be, for Perk requirements it's on Subject, but that can't be the same to check the weapon you're looking at in a crafting menu. Really hoping this doesn't require some kind of script.

Link to comment
Share on other sites

The simplest way is to use dynamic mod association. You can add temporary mod associations using pkKeywords.
Let's say you have a certain grip that makes the weapon into a pistol. And you have a barrel that should only be attached IF the weapon already has the pistol grip attached to it.
1. Create a new Mod Association, something that identifies the conditional, like "ma_myweapon_pistol"
2. Open your "Pistol Grip" omod, add a pkKeyword (ADD) and point it to your "ma_myweapon_pistol" keyword.
3. Open your "Pistol Barrel" omod, and in the "Target Object Mod Association Keywords" box, in addition to your main MA keyword, add your "ma_myweapon_pistol".
4. There are no more steps. I'm just trying to over-complicate this.
5. Profit
The cool thing about this, is that it only adds/removes Pistol Barrel from the Barrel category in the workbench. It doesn't add any extra sub categories, as AP conditionals do. The downside is, once the Pistol Barrel is attached, you may remove the Pistol Grip and the barrel will still be attached. Once you remove the barrel, however, it cannot be reattached until the grip is back (as you'd naturally expect.) If you want the barrel to be automatically removed if you swap to a different grip, it gets a whole lot trickier and probably involves scripting to dynamically remove the existing barrel and attach a rifle barrel in your inventory. It's a can of worms.

It is possible to make pretty elaborate conditionals this way, but what I cannot help with is with the object templates and how to tie MA conditionals with dynamic naming. This is strictly on an attachment level.
Link to comment
Share on other sites

I had light-bulb moment earlier that may solve the issue with the lack of dependency check.


As I wrote in the previous post, an MA conditional doesn't check retroactively, meaning that it's possible for the player to change back to a rifle grip and the pistol barrel will keep staying attached.


In bypassing this problem, I came up with a new dependency check (in addition to the one in previous post).

It works by whenever a pistol barrel gets attached, it hides the rifle grip entries. Only by changing back to a rifle barrel, will the rifle grips show up again. In order to make this work, we need an additional dynamic MA for rifle configurations.


The steps are culminative to the ones in my previous post.


1. Create a new MA, "ma_myweapon_rifle" and add it to the rifle grips' "Target OMOD Association Keywords" box.

Note: Do not add dynamic MAs to the weapon itself. MAs added to weapons cannot be dynamically added/removed, at least not through pkKeywords.

2. For every rifle barrel mod: Add a pkKeyword (ADD) with the new MA ("ma_myweapon_rifle")

3. For every pistol barrel mod: Add a pkKeyword (REM) with the new MA ("ma_myweapon_rifle")



This creates a new dependency, where whenever the pistol barrel is attached, it hides the rifle grip entries until the player swaps back to a rifle barrel.


To avoid confusion, one could add a note to the pistol barrel description stating that they need to swap to rifle barrel to gain access to the rifle grips again. Or, one can use an OnCreate() script (I don't know what it's actually called) to display a notification in the top left corner, or even a dialogue box.

Link to comment
Share on other sites

After some testing I found that there is one more thing. In addition to what ehtyeci has already stated, I had to add a pkKeyword ADD ma_myweapon_rifle to each barrel that CAN use the rifle stocks.

 

Without that they stay permanently removed after equipping a barrel that removes them.

Link to comment
Share on other sites

While I have someone's attention, I've run into a somewhat related issue. I've created two additional attachment categories for a weapon (both internal mods related to damage types and amounts) and done all the proper work to get them showing in the menus and be attachable. The only issue seems to be that they won't show up on enemies' weapons, although I have added them to the modcol lists and into the weapon's Object Template.

I have added their associated keywords to the base Weapon page, which let's them show up to be built, but doesn't seem to make them attached by default. I also tried adding the ap keywords to the Attach Parent Slots list on all the receivers. This made the new parts show up attached on some, but not all weapons, and show up doubled on others.

 

Just realized I missed adding a couple keywords on a couple receivers, am testing now.

Results: It NOW seems to be working with the attach point keywords added to just the base weapon. I think the issue was that the modcol files I made for the new categories did not have the right Attach Point designated. All seems good now.

Edited by jkruse05
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...