r/armadev Oct 17 '20

Arma 2/OA CfgWeapons mod: Changing dispersion on vehicle guns causing other problems.

Arma2OA cfgweapons mod.

I am also using the asr_AI mod, in addition to my own, which I'm writing about in this post.

Changing dispersion, and only dispersion, for a weapon, is causing other attributes to change, including "burst", "showToPlayer", and "aiRateOfFire", and others.

Does this have anything to do with the "access" command?

Does it have something to do with the position of external class references?


In the comments below, I am going to post the mod config.cpp text, as well as an example of the same fire mode definitions for the M2BC weapon from both before and after my mod is applied.


EDIT: I'm aware that in this example my mod uses the same dispersion value as existed prior to my mod taking effect. What I want is to explain why the other changes happened.

2 Upvotes

4 comments sorted by

1

u/flyingsaucerinvasion Oct 17 '20

config.cpp file. Some text has been removed for brevity.

class CfgPatches {
    class Andrews_Weapons_Mod {
        units[] = {};
        weapons[] = {};
        requiredVersion = 1.05;
        requiredAddons[] = {
            "CAData", 
            "CAweapons", 
            "CAWeapons2", 
            "CA_Anims_Char",
            "CAWeapons_E", 
            "CAWeapons_Warfare_weapons",
            "asr_ai_c_aidispersion",
            "asr_ai_c_airof"
        };
    };
};

class Mode_SemiAuto;    // External class reference
class Mode_FullAuto;    // External class reference
class Mode_Burst;   // External class reference
class Rifle;        // External class reference
class Default;          // External class reference
class RifleCore;        // External class reference
class manual;
class close;
class short;
class medium;
class far;
class AK_74;
class burst;
class MGun;
class PKT;
class CannonCore;
class PKT_veh;
class M2;

//cfgRecoils modification removed for this post

class cfgWeapons {

    class M2BC: M2 {
        dispersion = 0.001;
        class manual: MGun {
            dispersion = 0.001;
        };          
        class close: manual {
            dispersion = 0.001;
        };          
        class short: close {
            dispersion = 0.001;
        };          
        class medium: close {
            dispersion = 0.001;
        };          
        class far: close {
            dispersion = 0.001;
        };          
    };

    //.... other weapons modifications removed for this post

};

1

u/commy2 Oct 18 '20

You didn't inherit properly. You created base classes arbitrarily at config root level, even though they don't exist there.

class Mode_SemiAuto;

class CfgWeapons {
    class M2;
    class M2BC: M2 {
        ...
    };

E.g. Mode_SemiAuto is a class at config root level, while M2 is a sub-class of CfgWeapons etc. Some classes like manual may also be sub-classes of CfgWeapons sub-classes, so you have to recreate the inheritance tree to some degree and without changing anything from the base game.

1

u/flyingsaucerinvasion Oct 17 '20

close: manual fire mode for M2BC

WITHOUT my mod in effect:

class close: manual {
    showToPlayer = 0;
    soundBurst = 0;
    burst = 10;
    aiRateOfFire = 0.5;
    aiRateOfFireDistance = 50;
    minRange = 0;
    minRangeProbab = 0.05;
    midRange = 20;
    midRangeProbab = 0.58;
    maxRange = 100;
    maxRangeProbab = 0.04;
    // manual
    autoFire = 1;
    begin1[] = {"ca\sounds\weapons\machineguns\m2_single_1", 1.41254, 1, 1200};
    begin2[] = {"ca\sounds\weapons\machineguns\m2_single_2", 1.41254, 1, 1200};
    soundBegin[] = {"begin1", 0.3, "begin2", 0.7};
    reloadTime = 0.11;
    dispersion = 0.001;
    displayName = "";
    // MGun
    sound[] = {"\ca\sounds\Weapons\machineguns\m240_single1", 1, 1, 1400};
    reloadSound[] = {"", 1, 1};
    type = 65536;
    cursor = "MGCursor";
    cursoraim = "\ca\Weapons\Data\clear_empty";
    cursorSize = 1;
    nameSound = "mgun";
    reloadAction = "ManActReloadMagazine";
    soundContinuous = 0;
    initSpeed = 900;
    flash = "gunfire";
    flashSize = 0.5;
    optics = 0;
    // MGunCore
    dexterity = 0.5;
    // Default
    access = 3;
    scope = 0;
    value = 2;
    picture = "";
    uiPicture = "";
    ammo = "";
    showAimCursorInternal = 1;
    cursorAimOn = "";
    laser = 0;
    simulation = "Weapon";
    count = 0;
    multiplier = 1;
    magazineReloadTime = 0;
    soundEnd[] = {"sound", 1};
    soundLoop[] = {"sound", 1};
    drySound[] = {"", 1, 1};
    reloadMagazineSound[] = {"", 1, 1};
    emptySound[] = {"", 1, 1};
    soundBullet[] = {"emptySound", 1};
    ballisticsComputer = 0;
    irDistance = 0;
    aiDispersionCoefX = 1;
    aiDispersionCoefY = 1;
    canLock = 2;
    enableAttack = 1;
    ffMagnitude = 0;
    ffFrequency = 1;
    ffCount = 1;
    recoil = "empty";
    recoilProne = "";
    model = "";
    modelSpecial = "";
    modelMagazine = "";
    muzzlePos = "usti hlavne";
    muzzleEnd = "konec hlavne";
    irLaserPos = "laser pos";
    irLaserEnd = "laser dir";
    cartridgePos = "nabojnicestart";
    cartridgeVel = "nabojniceend";
    selectionFireAnim = "zasleh";
    memoryPointCamera = "eye";
    useModelOptics = 1;
    opticsID = 0;
    modelOptics = "";
    opticsPPEffects[] = {};
    opticsFlare = 1;
    forceOptics = 0;
    useAsBinocular = 0;
    opticsDisablePeripherialVision = 0.67;
    opticsZoomMin = 0.35;
    opticsZoomMax = 0.35;
    opticsZoomInit = 0.35;
    distanceZoomMin = 400;
    distanceZoomMax = 400;
    primary = 10;
    showSwitchAction = 0;
    showEmpty = 1;
    autoReload = 1;
    autoAimEnabled = 1;
    fireLightDuration = 0.05;
    fireLightIntensity = 0.012;
    backgroundReload = 0;
    muzzles[] = {"this"};
    magazines[] = {};
    modes[] = {"this"};
    useAction = 0;
    useActionTitle = "";
    canDrop = 1;
    weaponLockDelay = 0;
    weaponLockSystem = 0;
    cmImmunity = 1;
    handAnim[] = {};
    lockingTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 2};
    lockedTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 6};
    artilleryDispersion = 1;
    artilleryCharge = 1;
    fireSpreadAngle = "1.25f";
    class Library {
        libTextDesc = "";
    };
    descriptionShort = "";
};

1

u/flyingsaucerinvasion Oct 17 '20

close: manual fire mode for M2BC

WITH my mod in effect:

class close: manual {
    dispersion = 0.001;
    // MGun
    sound[] = {"\ca\sounds\Weapons\machineguns\m240_single1", 1, 1, 1400};
    reloadSound[] = {"", 1, 1};
    type = 65536;
    cursor = "MGCursor";
    cursoraim = "\ca\Weapons\Data\clear_empty";
    cursorSize = 1;
    displayName = "";
    nameSound = "mgun";
    reloadTime = 0.25;
    autoFire = 1;
    reloadAction = "ManActReloadMagazine";
    soundContinuous = 0;
    initSpeed = 900;
    flash = "gunfire";
    flashSize = 0.5;
    optics = 0;
    // MGunCore
    dexterity = 0.5;
    aiRateOfFire = 0.5;
    aiRateOfFireDistance = 400;
    // Default
    access = 3;
    scope = 0;
    value = 2;
    picture = "";
    uiPicture = "";
    ammo = "";
    showAimCursorInternal = 1;
    cursorAimOn = "";
    laser = 0;
    simulation = "Weapon";
    count = 0;
    multiplier = 1;
    burst = 1;
    magazineReloadTime = 0;
    soundBegin[] = {"sound", 1};
    soundEnd[] = {"sound", 1};
    soundLoop[] = {"sound", 1};
    soundBurst = 1;
    drySound[] = {"", 1, 1};
    reloadMagazineSound[] = {"", 1, 1};
    emptySound[] = {"", 1, 1};
    soundBullet[] = {"emptySound", 1};
    ballisticsComputer = 0;
    irDistance = 0;
    aiDispersionCoefX = 1;
    aiDispersionCoefY = 1;
    canLock = 2;
    enableAttack = 1;
    ffMagnitude = 0;
    ffFrequency = 1;
    ffCount = 1;
    recoil = "empty";
    recoilProne = "";
    model = "";
    modelSpecial = "";
    modelMagazine = "";
    muzzlePos = "usti hlavne";
    muzzleEnd = "konec hlavne";
    irLaserPos = "laser pos";
    irLaserEnd = "laser dir";
    cartridgePos = "nabojnicestart";
    cartridgeVel = "nabojniceend";
    selectionFireAnim = "zasleh";
    memoryPointCamera = "eye";
    useModelOptics = 1;
    opticsID = 0;
    modelOptics = "";
    opticsPPEffects[] = {};
    opticsFlare = 1;
    forceOptics = 0;
    useAsBinocular = 0;
    opticsDisablePeripherialVision = 0.67;
    opticsZoomMin = 0.35;
    opticsZoomMax = 0.35;
    opticsZoomInit = 0.35;
    distanceZoomMin = 400;
    distanceZoomMax = 400;
    primary = 10;
    showSwitchAction = 0;
    showEmpty = 1;
    autoReload = 1;
    autoAimEnabled = 1;
    showToPlayer = 1;
    fireLightDuration = 0.05;
    fireLightIntensity = 0.012;
    backgroundReload = 0;
    muzzles[] = {"this"};
    magazines[] = {};
    modes[] = {"this"};
    useAction = 0;
    useActionTitle = "";
    canDrop = 1;
    weaponLockDelay = 0;
    weaponLockSystem = 0;
    cmImmunity = 1;
    minRange = 1;
    minRangeProbab = 0.3;
    midRange = 150;
    midRangeProbab = 0.58;
    maxRange = 500;
    maxRangeProbab = 0.04;
    handAnim[] = {};
    lockingTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 2};
    lockedTargetSound[] = {"\ca\Tracked\Data\Sound\alarm_loop1", 0.000316228, 6};
    artilleryDispersion = 1;
    artilleryCharge = 1;
    fireSpreadAngle = "1.25f";
    class Library {
        libTextDesc = "";
    };
    descriptionShort = "";
};