The mod lets you craft an item called the "scoper," by which the scope of your current weapon can be freely attached and detached. It can be crafted at the industrial workbench if you've completed the first level of optics research.
Use the item like any other consumable, and don't worry: it will not be consumed upon use.
2. How it works
First, equip a weapon with a scope attached. Then, use the scoper to detach the scope from the weapon. Simple as that.
Once detached, the scoper remembers which kind of scope was previously attached. This means that if you've detached a recon scope from your weapon, using the scoper again guarantees the recon scope to be attached, rather than a short, medium, or long one.
If no scope has been attached to the current weapon, nothing will happen: don't expect a free scope. If your weapon lacks an optical attach point, it will do nothing but inform you that no scope is available.
- Quick Demonstration -
- How it works in detail -
It is a well-known feature of the creation engine that inventory (or equipped) items cannot have a reference variable. This poses a substantial problem when dealing with the modified state of an inventory item, as such information is associated with the object reference. Although Script Extenders for the other Bethesda games provide the functionality to associate specific references to inventory items, such a feature hasn't been implemented in SFSE yet.
To circumvent this, the script forces the current weapon to be dropped, yielding an object reference of the weapon. Then, the current state concerning optical sight is evaluated through custom keywords. A scope, if it exists, is replaced with a corresponding `invisible' scope of the same type, which remembers the kind of scope previously attached. Later, upon the use of the item, it is replaced with the corresponding actual scope.
I'm quite sure this is not the most efficient code for implementing such functionality. One might come up with a better one using, e.g., MakeAliasedRefFromInventory function. But I'm still at an early stage in learning Papyrus, so it was beyond my knowledge. That said, I'm happy with the result, as it works more seamlessly than my initial expectation. But please let me know if you have any ideas for improving the mod.
3. Known Issues
Using the scoper on weapons without an iron sights model (e.g., old earth hunting rifle) would do nothing, as it is clearly out of the scope of this mod.
Also, if you have multiple weapons of the same type (e.g., a modified Nova Blast and a converted Nova Blast), there's a chance that a weapon other than the equipped one may be affected by the scoper. This happens because the function AttachMod refers to the base form of the current weapon. While I can't see this causing a significant issue, please let me know if there is any.
4. Compatibility & Patch
I have made considerable efforts to ensure this mod is widely compatible and easily extendable. But there are few mods that directly conflict with my mod. Those are mods that substantially alter the vanilla records of scopes or increase the pool of attachable scopes. The most notable one is Scope Improvements. Although it's not impossible to make them work together, I don't like the idea of populating scopes, so I won't take that on.
Weapon mods need a patch to carry over the mod's functionality to custom weapons. But the patching process is as simple as it gets.
If a custom weapon uses vanilla scopes, you only need to do one thing: Add a "ma_VanillaWeaponName" keyword used by the vanilla scopes to the weapon. For example, if a mod-added Gauss Rifle uses Hard Target's scopes, then add the keyword "ma_HardTarget" to the Gauss Rifle.
When custom scopes are used, it's a bit more involved, but still quite straightforward. First, make sure the weapon has an appropriate "ma" keyword (e.g., ma_GaussRifle), as in the vanilla game. Second, add the same keyword to the custom scopes used by the weapon. Note that even though the scopes already have the keyword as a Target OMOD keyword, you should also manually add it in CK or xEdit. Ignoring this will make the patch ineffective. Lastly, you should fill out my formlists with your own keyword (e.g., add ma_GaussRifle to ma_FLST) and scopes (e.g., add your custom long scope to TS_VanillaScopeLongFLST).
Although I haven't encountered it myself, some mods may use custom templates for their scopes. In this case, in addition to the procedure above, you need to add the same property modifier to the templates as the one in my mod.
5. Recommended Mods
Hivis Scope Replacement
ADS FOV Removed
Zoomed In Weapons Sights ADS Tweak
No Legendary Pick Notification