AveryTheKitty 2626 Posted November 21, 2014 (edited) I'm porting my first weapon over, the SCAR-L from OA, and I need some help! I don't exactly know how to code weapons. https://www.youtube.com/watch?v=Moh2FqPuctc&feature=youtu.be First off, the textures and attachments are not a problem, I haven't finished setting them up on the model. My problem is, the Muzzle flash is broken, the sounds are gone (supposed to be MX ones for now), the iron sights don't go down, magazine doesn't detach, and possibly other problems. Config: #include "basicdefines_A3.hpp" class DefaultEventhandlers; class CfgPatches { class A3_Aegis_XMR_F { units[]={}; weapons[]={"arifle_XMR_F"}; requiredVersion=0.1; requiredAddons[]={"A3_Weapons_F"}; }; }; class Mode_SemiAuto; class Mode_Burst; class Mode_FullAuto; class SlotInfo; class CowsSlot; class PointerSlot; #include "cfgRecoils.hpp" class CfgWeapons { class Rifle; class Rifle_Base_F: Rifle { class WeaponSlotsInfo; class GunParticles; }; class arifle_XMR_base_F: Rifle_Base_F { magazines[] = {30Rnd_556x45_Stanag, 30Rnd_556x45_Stanag_Tracer_Green, 30Rnd_556x45_Stanag_Tracer_Red, 30Rnd_556x45_Stanag_Tracer_Yellow}; reloadAction = "GestureReloadMX"; discreteDistanceInitIndex = 0; maxRecoilSway=0.0125; swayDecaySpeed=1.25; inertia = 0.5; class GunParticles : GunParticles { class SecondEffect { positionName = "Nabojnicestart"; directionName = "Nabojniceend"; effectName = "CaselessAmmoCloud"; }; }; class WeaponSlotsInfo: WeaponSlotsInfo { class MuzzleSlot: SlotInfo { linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; compatibleItems[] = {"muzzle_snds_M", "muzzle_flash_M"}; }; class CowsSlot: CowsSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\TOP"; compatibleItems[] = {"optic_Aco", "optic_ACO_grn", "optic_ACO_grn_smg", "optic_Aco_smg", "optic_Arco", "optic_DMS", "optic_Hamr", "optic_Holosight", "optic_Holosight_smg", "optic_LRPS", "optic_MRCO", "optic_Nightstalker", "optic_NVS", "optic_SOS", "optic_tws", "optic_tws_mg"}; }; class PointerSlot: PointerSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\SIDE"; compatibleItems[] = {"acc_flashlight", "acc_pointer_IR"}; }; }; opticsZoomMin=0.375; opticsZoomMax=1.1; opticsZoomInit=0.75; distanceZoomMin = 300; distanceZoomMax = 300; descriptionShort = "Testing weapon with grenade launcher"; handAnim[] = {"OFP2_ManSkeleton", "A3\weapons_f\Rifles\mx\data\Anim\MX_dmr.rtm"}; dexterity = 1.8; caseless[] = {"",1,1,1}; soundBullet[] = {caseless,1}; selectionFireAnim = "muzzleFlash"; modes[] = {Single, FullAuto, fullauto_medium, single_medium_optics1, single_far_optics2}; class Single: Mode_SemiAuto { sounds[] = {StandardSound, SilencedSound}; class BaseSoundModeType { weaponSoundEffect = "DefaultRifle"; closure1[]={"A3\sounds_f_weapons\closure\closure_rifle_6", db3, 1,10}; closure2[]={"A3\sounds_f_weapons\closure\closure_rifle_7", db3, 1,10}; soundClosure[]={closure1,0.5, closure2,0.5}; }; class StandardSound: BaseSoundModeType { begin1[] = {"A3\sounds_f_weapons\MX\mx-st-full-1", db3, 1,1200}; begin2[] = {"A3\sounds_f_weapons\MX\mx-st-full-2", db3, 1,1200}; soundBegin[] = {begin1,0.5, begin2,0.5}; }; class SilencedSound: BaseSoundModeType { begin1[]={"A3\sounds_f_weapons\silenced\silent-18", db-2, 1,100}; begin2[]={"A3\sounds_f_weapons\silenced\silent-19", db-2, 1,100}; begin3[]={"A3\sounds_f_weapons\silenced\silent-11", db-2, 1,100}; soundBegin[]={begin1,0.333, begin2,0.333, begin3,0.333}; }; reloadTime = 0.096; dispersion = 0.00087; recoil = "recoil_single_SCAR_L" recoilProne = "recoil_single_prone_SCAR_L"; minRange = 2; minRangeProbab = 0.5; midRange = 200; midRangeProbab = 0.7; maxRange = 400; maxRangeProbab = 0.3; }; class FullAuto: Mode_FullAuto { sounds[] = {StandardSound, SilencedSound}; class BaseSoundModeType { weaponSoundEffect = "DefaultRifle"; closure1[]={"A3\sounds_f_weapons\closure\closure_rifle_6", db3, 1,10}; closure2[]={"A3\sounds_f_weapons\closure\closure_rifle_7", db3, 1,10}; soundClosure[]={closure1,0.5, closure2,0.5}; }; class StandardSound: BaseSoundModeType { begin1[] = {"A3\sounds_f_weapons\MX\mx-st-full-1", db3, 1,1200}; begin2[] = {"A3\sounds_f_weapons\MX\mx-st-full-2", db3, 1,1200}; soundBegin[] = {begin1,0.5, begin2,0.5}; }; class SilencedSound: BaseSoundModeType { begin1[]={"A3\sounds_f_weapons\silenced\silent-18", db-2, 1,100}; begin2[]={"A3\sounds_f_weapons\silenced\silent-19", db-2, 1,100}; begin3[]={"A3\sounds_f_weapons\silenced\silent-11", db-2, 1,100}; soundBegin[]={begin1,0.333, begin2,0.333, begin3,0.333}; }; reloadTime = 0.096; dispersion = 0.00087; recoil = "recoil_auto_SCAR_L"; recoilProne = "recoil_auto_prone_SCAR_L"; minRange = 0; minRangeProbab = 0.9; midRange = 15; midRangeProbab = 0.7; maxRange = 30; maxRangeProbab = 0.1; aiRateOfFire = 0.000001; }; class fullauto_medium: FullAuto { showToPlayer = 0; burst = 3; minRange = 2; minRangeProbab = 0.5; midRange = 75; midRangeProbab = 0.7; maxRange = 150; maxRangeProbab = 0.05; aiRateOfFire = 2.0; aiRateOfFireDistance = 200; }; class single_medium_optics1: Single { requiredOpticType = 1; showToPlayer = 0; minRange = 2; minRangeProbab = 0.2; midRange = 450; midRangeProbab = 0.7; maxRange = 600; maxRangeProbab = 0.2; aiRateOfFire = 6; aiRateOfFireDistance = 600; }; class single_far_optics2: single_medium_optics1 { requiredOpticType = 2; showToPlayer = 0; minRange = 100; minRangeProbab = 0.1; midRange = 500; midRangeProbab = 0.6; maxRange = 700; maxRangeProbab = 0.05; aiRateOfFire = 8; aiRateOfFireDistance = 700; }; aiDispersionCoefY=6.0; aiDispersionCoefX=4.0; drySound[]={"A3\sounds_f_weapons\Other\dry_1", db-5, 1, 10}; reloadMagazineSound[]={"A3\sounds_f_weapons\reloads\new_MX",db-8,1, 30}; }; class arifle_XMR_F: arifle_XMR_base_F { scope = 2; displayName = "XMR-L 5.56 mm"; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmr_F.p3 d"; picture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\ xmr_ca.paa"; UiPicture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\ xmr_ca.paa"; weaponInfoType = "RscWeaponZeroing"; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 100; }; }; }; enum { destructengine = 2, destructdefault = 6, destructwreck = 7, destructtree = 3, destructtent = 4, stabilizedinaxisx = 1, stabilizedinaxesxyz = 4, stabilizedinaxisy = 2, stabilizedinaxesboth = 3, destructno = 0, stabilizedinaxesnone = 0, destructman = 5, destructbuilding = 1 }; This was based off the samples. Edited November 21, 2014 by Nightmare515 Share this post Link to post Share on other sites
slatts 1978 Posted November 21, 2014 Here's my code for the same thing. Also the iron sights and magazine parts are in a model.cfg. I'll post it below. you need to define the iron sights in the Named Selections and add a relevant axis. Check samples. So's the muzzleflash. class CfgPatches { class SCAR_Arma3 { requiredaddons[] = {}; requiredversion = 0.1; units[] = {"SCAR_box"}; weapons[] = {"MK16", "MK17", "MK16_black", "MK17_black"}; }; }; #define magentry(mag, num) \ class _xx_##mag \ { \ magazine = #mag; \ count = num; \ } #define wepentry(wep, num) \ class _xx_##wep \ { \ weapon = #wep; \ count = num; \ } #define itementry(item, num) class _xx_##item { name=#item; count = num; } class Mode_SemiAuto; class Mode_FullAuto; class CfgWeapons { class arifle_Mk20_plain_F; class srifle_EBR_F; class EGLM; class MK16: arifle_Mk20_plain_F { displayName = "MK16 SCAR"; handAnim[] = {"OFP2_ManSkeleton", "SCAR_Arma3\Data\Anim\SCAR.rtm"}; model = "\SCAR_Arma3\mk16.p3d"; picture = "\SCAR_Arma3\Data\Icon\gear_scar_l_x_ca.paa"; descriptionShort = "5.56mm Assault Rifle"; reloadaction = "GestureReloadEBR"; reloadmagazinesound[] = {"A3\sounds_f\weapons\reloads\new_ebr", 0.630957, 1, 35}; }; class Mk17: srifle_EBR_F { displayName = "MK17 SCAR"; handAnim[] = {"OFP2_ManSkeleton", "SCAR_Arma3\Data\Anim\SCAR.rtm"}; model = "\SCAR_Arma3\mk17.p3d"; picture = "\SCAR_Arma3\Data\Icon\gear_scar_h_x_ca.paa"; descriptionShort = "7.62mm Battle Rifle"; }; class Mk16_EGLM: Mk16 { model = "\SCAR_Arma3\mk16_eglm.p3d"; displayName = "MK16 SCAR EGLM"; muzzles[] = {"This", "EGLM"}; }; class Mk17_EGLM: srifle_EBR_F { displayName = "MK17 SCAR EGLM"; handAnim[] = {"OFP2_ManSkeleton", "SCAR_Arma3\Data\Anim\SCAR.rtm"}; model = "\SCAR_Arma3\mk17_eglm.p3d"; picture = "\SCAR_Arma3\Data\Icon\gear_scar_h_x_ca.paa"; descriptionShort = "7.62mm Battle Rifle"; muzzles[] = {"This", "EGLM"}; }; class Mk16_black: Mk16 { displayName = "MK16 SCAR (Black)"; model = "\SCAR_Arma3\mk16_black.p3d"; }; class Mk17_black: Mk17 { model = "\SCAR_Arma3\mk17_black.p3d"; displayName = "MK17 SCAR (Black)"; }; }; class CfgSkeletons { class SCAR_Rifle { isDiscrete = 0; skeletonInherit = ""; skeletonBones[] = { "trigger", "", "bolt", "", "CH", "", "CHH","CH", "magazine", "", "muzzleFlash", "", "OP", "", "ForeSight", "", "BackSight", "" }; }; }; class CfgModels { class SCAR_RifleBase { skeletonName = "SCAR_Rifle"; class Animations { class OP_ROT { type="rotation"; source="zeroing2"; // use second muzzle zeroing for rotation sourceAddress="loop"; // loop when phase out of bounds selection="OP"; // selection we want to rotate axis="OP_axis"; // has its own axis minValue=0; maxValue=3; angle0="rad 0"; angle1="rad 65"; }; class BackSight_optic { type="rotation"; source="hasOptics"; selection="BackSight"; axis="BackSight_axis"; memory=1; minValue=0.0000000; maxValue=1.0000000; angle0=0.000000; angle1=(rad 90); }; class ForeSight_optic: BackSight_optic { selection="ForeSight"; axis="ForeSight_axis"; angle1=(rad 90); }; class trigger { type = "rotationZ"; source = "reload"; selection = "trigger"; axis = "trigger_axis"; minValue = 0; maxValue = "3"; angle0 = "0"; angle1 = "-3"; }; class bolt { type = "translation"; source = "reload"; selection = "bolt"; axis = "bolt_axis"; minValue = 0; maxValue = "1"; offset0 = "0"; offset1 = "1"; }; class bolt_empty: bolt{source = "isEmpty";}; class charging_handle: bolt { selection = "CH"; axis = "CH_axis"; offset1 = "-1"; }; class charging_handle_empty: charging_handle{source = "isEmpty";}; class magazine_hide { type="hide"; source="reloadMagazine"; selection="magazine"; minValue=0.200000; maxValue=0.250000; hideValue=0.100000; }; }; sections[] = {"zasleh"}; sectionsInherit = ""; }; class mk16: SCAR_RifleBase {}; class mk17: SCAR_RifleBase {}; class mk16_eglm: SCAR_RifleBase {}; class mk17_eglm: SCAR_RifleBase {}; class mk16_black: SCAR_RifleBase {}; class mk17_black: SCAR_RifleBase {}; }; Share this post Link to post Share on other sites
AveryTheKitty 2626 Posted November 24, 2014 (edited) Thanks, I've improved on the weapons vastly. I've fixed most problems other than the EGLM's optics not rotating, and the muzzle flash is static. Also does someone happen to know the name of the texture for the GL sight's glass and dot? config.cpp: #include "basicdefines_A3.hpp" class DefaultEventhandlers; class CfgPatches { class A3_Aegis_XMR_F { units[]={}; weapons[]={"arifle_XMR_F", "arifle_XMR_C_F", "arifle_XMR_GL_F", "arifle_XMG_F", "arifle_XMH_GL_F", "arifle_XMM_F"}; requiredVersion=0.1; requiredAddons[]={"A3_Weapons_F"}; }; }; class Mode_SemiAuto; class Mode_Burst; class Mode_FullAuto; class SlotInfo; class CowsSlot; class PointerSlot; #define magentry(mag, num) \ class _xx_##mag \ { \ magazine = #mag; \ count = num; \ } #define wepentry(wep, num) \ class _xx_##wep \ { \ weapon = #wep; \ count = num; \ } #define itementry(item, num) class _xx_##item { name=#item; count = num; } #include "cfgRecoils.hpp" class CfgWeapons { class WeaponSlotsInfo; class UGL_F; class Rifle; class Rifle_Base_F: Rifle { class WeaponSlotsInfo; class GunParticles; }; class arifle_MX_F; class arifle_SCAR_base_F: arifle_MX_F { scope = 0; handAnim[] = {"OFP2_ManSkeleton", "A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\Anim\SCAR.rtm"}; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmr_F.p3d"; class WeaponSlotsInfo: WeaponSlotsInfo { class MuzzleSlot: SlotInfo { linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; compatibleItems[] = {"muzzle_snds_M", "muzzle_flash_M"}; }; class CowsSlot: CowsSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\TOP"; compatibleItems[] = {"optic_Aco", "optic_ACO_grn", "optic_ACO_grn_smg", "optic_Aco_smg", "optic_Arco", "optic_DMS", "optic_Hamr", "optic_Holosight", "optic_Holosight_smg", "optic_LRPS", "optic_MRCO", "optic_Nightstalker", "optic_NVS", "optic_SOS", "optic_tws", "optic_tws_mg"}; }; class PointerSlot: PointerSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\SIDE"; compatibleItems[] = {"acc_flashlight", "acc_pointer_IR"}; }; }; class EGLM: UGL_F { useModelOptics = 0; useExternalOptic = 0; cameraDir = "OP_look"; discreteDistance[] = {50, 75, 100, 150, 200, 250, 300, 350, 400}; discreteDistanceCameraPoint[] = {"OP_eye_50", "OP_eye_75", "OP_eye_100", "OP_eye_150", "OP_eye_200", "OP_eye_250", "OP_eye_300", "OP_eye_350", "OP_eye_400"}; discreteDistanceInitIndex = 1; }; magazines[] = {30Rnd_556x45_Stanag, 30Rnd_556x45_Stanag_Tracer_Green, 30Rnd_556x45_Stanag_Tracer_Red, 30Rnd_556x45_Stanag_Tracer_Yellow}; reloadaction = "GestureReloadMXSniper"; reloadmagazinesound[] = {"A3\sounds_f\weapons\reloads\new_ebr", 0.630957, 1, 35}; }; // XMR class arifle_XMR_F: arifle_SCAR_base_F { author = "Night515"; scope = 2; displayName = "XMR 5.56 mm"; picture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\xmr_ca.paa"; UiPicture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\xmr_ca.paa"; weaponInfoType = "RscWeaponZeroing"; descriptionShort = "WIP"; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 60; }; }; class arifle_XMR_C_F: arifle_XMR_F { author = "Night515"; scope = 2; displayName = "XMR Carbine 5.56 mm"; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmr_C_F.p3d"; descriptionShort = "WIP"; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 40; }; }; class arifle_XMR_GL_F: arifle_XMR_F { displayName = "XMR EGLM 5.56 mm"; handAnim[] = {"OFP2_ManSkeleton", "A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\Anim\M16\M16GL.rtm"}; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmr_GL_F.p3d"; descriptionShort = "WIP"; muzzles[] = {"This", "EGLM"}; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 80; }; }; // XMH class arifle_XMH_F: arifle_SCAR_base_F { author = "Night515"; scope = 2; displayName = "XMH 7.62 mm"; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmh_F.p3d"; picture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\xmh_ca.paa"; UiPicture = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\UI\xmh_ca.paa"; weaponInfoType = "RscWeaponZeroing"; descriptionShort = "WIP"; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 100; }; magazines[] = {20Rnd_762x51_Mag}; }; class arifle_XMH_GL_F: arifle_XMH_F { displayName = "XMH EGLM 7.62 mm"; handAnim[] = {"OFP2_ManSkeleton", "A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\data\Anim\M16\M16GL.rtm"}; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmh_GL_F.p3d"; descriptionShort = "WIP"; muzzles[] = {"This", "EGLM"}; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 120; }; }; // XMM class arifle_XMM_F: arifle_XMH_F { author = "Night515"; scope = 2; displayName = "XMM 7.62 mm"; model = "\A3_Aegis\Aegis\content\BLUFOR\rifles\XMR\xmh_M_F.p3d"; descriptionShort = "WIP"; class WeaponSlotsInfo: WeaponSlotsInfo { mass = 120; }; }; }; enum { destructengine = 2, destructdefault = 6, destructwreck = 7, destructtree = 3, destructtent = 4, stabilizedinaxisx = 1, stabilizedinaxesxyz = 4, stabilizedinaxisy = 2, stabilizedinaxesboth = 3, destructno = 0, stabilizedinaxesnone = 0, destructman = 5, destructbuilding = 1 }; model.cfg: class CfgSkeletons { class XMR_rifle { isDiscrete = 0; skeletonInherit = ""; skeletonBones[] = { "trigger", "", "bolt", "", "safety", "", "CH", "", "CHH","CH", "magazine", "", "muzzleFlash", "", "ForeSight", "", "BackSight", "" }; }; }; class CfgModels { class XMR_base : Default { htMin = 1; htMax = 600; afMax = 0; mfMax = 0; mFact = 1; tBody = 100; skeletonName = "XMR_rifle"; class Animations { class muzzleFlashROT { type="rotationX"; source="ammoRandom"; sourceAddress="loop"; selection="muzzleFlash"; axis=""; centerFirstVertex=true; minValue=0; maxValue=4; angle0="rad 0"; angle1="rad 360"; }; class BackSight_optic { type="rotation"; source="hasOptics"; selection="BackSight"; axis="BackSight_axis"; memory=1; minValue=0.0000000; maxValue=1.0000000; angle0="rad 0"; angle1="rad 90"; }; class OP_ROT { type="rotation"; source="zeroing2"; sourceAddress="loop"; selection="OP"; axis="OP_axis"; minValue=0; maxValue=3; angle0="rad 0"; angle1="rad 65"; }; class ForeSight_optic: BackSight_optic { selection="ForeSight"; axis="ForeSight_axis"; angle1="rad -90"; }; class trigger { type = "rotationZ"; source = "reload"; selection = "trigger"; axis = "trigger_axis"; minValue = 0; maxValue = "3"; angle0 = "0"; angle1 = "-3"; }; class bolt { type = "translation"; source = "reload"; selection = "bolt"; axis = "bolt_axis"; minValue = 0; maxValue = "1"; offset0 = "0"; offset1 = "1"; }; class bolt_empty: bolt{source = "isEmpty";}; class charging_handle: bolt { selection = "CH"; axis = "CH_axis"; offset1 = "-1"; }; class charging_handle_empty: charging_handle{source = "isEmpty";}; class magazine_hide { type="hide"; source="reloadMagazine"; selection="magazine"; minValue=0.000000; maxValue=1.00000; hideValue=0.188; unhideValue = 0.550; }; class no_magazine { type="hide"; source="hasMagazine"; selection="magazine"; minValue=0.000000; maxValue=1.00000; hideValue=0.5; unhideValue = -1.0; }; class magazine_reload_move_1 { type = "translation"; source = "reloadMagazine"; selection = "magazine"; axis = "magazine_axis"; minValue = 0.145; maxValue = 0.170; offset0 = 0.0; offset1 = 0.5; }; class magazine_reload_move_2: magazine_reload_move_1 { minValue = 0.573; maxValue = 0.602; offset0 = 0.0; offset1 = -0.5; }; class safety_mode_rot { type = rotation; source = weaponMode; selection = "safety"; axis = "safety_axis"; memory = 1; minValue = 0; maxValue = 0.25; angle0 = 0; angle1 = (rad -52); }; }; sections[] = {"zasleh"}; sectionsInherit = ""; }; class xmr_F: XMR_base {}; class xmr_GL_F: XMR_base {}; class xmh_GL_F: XMR_base {}; class xmr_C_F: XMR_base {}; class xmh_F: XMR_base {}; class xmh_M_F: XMR_base {}; }; Edited November 25, 2014 by Nightmare515 Share this post Link to post Share on other sites
butterman-bill 10 Posted January 31, 2015 I have been trying to resolve a similar issue, and i still can't get sounds to work. It's impossible to find help with sound for configs Share this post Link to post Share on other sites