paranoid_giraffe 14 Posted June 17, 2016 Hello, It has been a long while since I have scripted/changed Configs, so please forgive my mess. I am trying to make a custom optic (just my own aftermarket-type iron sights), and I am having trouble with the model not showing up in the virtual arsenal. When I use the debug console, I can add the item to my inventory, and I can drop it on the ground, but I cannot attach it to any weapons. From what I gather, i have to modify each weapon's slot configs in order to use it, but I cannot find any working code to do so. Firstly, I do not know where my code is going wrong in my configs. And secondly, is there a simple way to allow my optic to be attached to all weapons? I am a total noob when it comes to making weapon addons. I have watched basic tutorials and copied steps, but for some reason it still does not work. Thanks Below is my code for my config.cpp #include "basicDefines_A3.hpp" class CfgPatches { class Test_scope3D_F { units[] = {}; weapons[] = {"Test_scope3D_01"}; requiredVersion = 0.1; requiredAddons[] = {"A3_Data_F"}; }; }; class SlotInfo; class CowsSlot: SlotInfo { linkProxy = "\A3\data_f\proxies\weapon_slots\TOP"; displayName = "$STR_A3_CowsSlot0"; compatibleItems[] = {""}; iconPicture = "\A3\Weapons_F\Data\UI\attachment_top.paa"; iconPinpoint = "Bottom"; }; class cfgWeapons { class ItemCore; class InventoryItem_Base_F; class InventoryOpticsItem_Base_F; class optic_Aco; class Test_scope3D_01: optic_Aco { displayName="Sample of 3D scope"; author=$STR_A3_Bohemia_Interactive; picture="\Test_scope3D_01\Data\uipicture_ca.paa"; model = "\Test_scope3D_01\Test_scope3D_01"; scope = 2; scopeArsenal=2; descriptionShort = "Sample of 3D scope + Holosight combo"; weaponInfoType = "RscWeaponZeroing"; _generalMacro = "optic_Aco"; class ItemInfo: InventoryOpticsItem_Base_F { mass = 4; modelOptics = "\A3\Weapons_F\empty"; optics = 1; class OpticsModes { class ACO { opticsID = 1; useModelOptics = 0; opticsZoomMin = 0.25; opticsZoomMax = 1.25; opticsZoomInit = 0.75; memoryPointCamera = "eye"; opticsFlare = 0; opticsDisablePeripherialVision = 0; distanceZoomMin = 200; distanceZoomMax = 200; cameraDir = ""; visionMode[] = {}; opticsPPEffects[] = {"Default"}; }; }; }; inertia = 0; }; class arifle_MX_F { class WeaponSlotsInfo { mass = 60; allowedSlots[] = {901}; class CowsSlot: CowsSlot {}; }; }; }; Share this post Link to post Share on other sites
da12thMonkey 1943 Posted June 17, 2016 You have to declare it as being compatible with weapons. Either you have to manually add it to the compatibleitems[]= array for every weapon you want to add it to - which is a pain in the arse and means it wont be compatible with most custom community weapons. Or you can make it compatible with Joint Rails which is much easier, but adds a CBA dependency to your addon. The latter uses the improved class compatibleItems system rather than the old array method that BIS use. Example of manually adding compatibility for a custom optic, in this case for BIS' 4Five pistol: class CfgPatches { class RKSL_PMII_4Five { units[] = {}; weapons[] = {"RKSL_optic_PMII_312_sunshade"}; requiredVersion = 0.1; requiredAddons[] = {"A3_Weapons_F_Pistols_Pistol_heavy_01"}; }; }; class CfgWeapons { class Pistol; // External class reference class Pistol_Base_F : Pistol { class WeaponSlotsInfo; // External class reference }; class hgun_Pistol_heavy_01_F : Pistol_Base_F { class WeaponSlotsInfo : WeaponSlotsInfo { class CowsSlot { compatibleItems[] += {"RKSL_optic_PMII_312_sunshade"}; }; }; }; }; Example making the scope compatible with all weapons with a Joint Rails dependency: class CfgPatches { class RKSL_PMII { units[] = {}; weapons[] = {"RKSL_optic_PMII_312_sunshade"}; requiredVersion = 1.0; requiredAddons[] = {"A3_Weapons_F","A3_Weapons_F_Acc","cba_jr"}; }; }; class asdg_OpticRail; // External class reference class asdg_OpticRail1913: asdg_OpticRail { class compatibleItems { RKSL_optic_PMII_312_sunshade = 1; }; }; 1 Share this post Link to post Share on other sites
paranoid_giraffe 14 Posted June 17, 2016 Thanks! I ended up getting it to work, but for some reason I can't get the gun to be held up like my character is using a collimator sight. Finally got it all to work except that. Is there a config page on the wiki with descriptions for each value? I can't seem to find it. images Share this post Link to post Share on other sites
Jackal326 1182 Posted June 17, 2016 You need an 'eye' memory point in the 'Memory' LOD of the optic itself to designate where the players "eye" goes to look through it, as well as correctly linking it up in the config. Share this post Link to post Share on other sites
paranoid_giraffe 14 Posted June 17, 2016 You need an 'eye' memory point in the 'Memory' LOD of the optic itself to designate where the players "eye" goes to look through it, as well as correctly linking it up in the config. Thank you, that is exactly what I needed. For all the tutorials out on the web, I am surprised there is no start-to-finish tutorial for creating an optic from scratch. Share this post Link to post Share on other sites