Search the Community
Showing results for tags 'inheritance'.
Found 8 results
-
Class inheritance not working (baffling!)
rofz posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
class CfgPatches { class BS_Faction { name = "BS"; author = "rofz"; versionStr = "1.1"; versionAr[] = {1,10}; requiredVersion = 1.60; requiredAddons[] = { "A3_Functions_F" }; units[] = { "IP_B_BS_Heli_Transport_01_Tropic_F", "IP_B_BS_Heli_Transport_01_Base_H", "IP_B_BS_Heli_Transport_01_Base_F" }; weapons[] = {}; }; }; class CfgFactionClasses { class BS { displayName = "BS"; side = 1; priority = 2; }; }; class CfgUnitInsignia { }; class CfgVehicles { class B_Heli_Transport_01_F; class IP_B_BS_Heli_Transport_01_Base_F : B_Heli_Transport_01_F { displayName = "BS Heli Transport 01 Base"; scope = 0; class Turrets; }; class IP_B_BS_Heli_Transport_01_Base_H : IP_B_BS_Heli_Transport_01_Base_F { class Turrets : Turrets { class CopilotTurret; class MainTurret; class RightDoorGun; }; }; class IP_B_BS_Heli_Transport_01_Tropic_F : IP_B_BS_Heli_Transport_01_Base_H { author = "rofz"; crew = "B_Fighter_Pilot_F"; displayname = "My Helo (Final)"; faction = "BS"; typicalCargo[] = {"B_recon_F"}; class Turrets : Turrets { class CopilotTurret : CopilotTurret { gunnerType = "B_Fighter_Pilot_F"; }; class MainTurret : MainTurret { gunnerType = "B_helicrew_F"; }; class RightDoorGun : RightDoorGun { gunnerType = "B_recon_LAT_F"; }; }; }; }; class CfgGroups { }; Hello all, I'm trying the simplest thing: replace the unit that operates a particular turret in a helo, but so far I could not make it work. It keeps complaining about missing individual attributes! I also tried with the same code showed here and read the Turret Config Reference multiple times to try to find a clue of what could be wrong to no avail. The issue remais the same. The code (config.cpp) is above. It's 100% reproducible. Things I have already cleared: 1) unloaded all possible mods and DLCs 2) other modules that do the same (change a Turret default unit) - like the KSK mod by IndeedPete (mentioned in the linked forum post) - work fine, regardless of the loaded mods/DLCs 3) the root cause seem to be related to the parent/base class (IP_B_BS_Heli_Transport_01_Base_F) inheritance of the Turrets class to not be working. Its Turrets config is completely blank when viewed with the Config Viewer (which does not happen with IndeedPete's KSK mod - the Turrets' config gets correctly populated) I believe the config.cpp is not correctly written or there could be some other stupid parameter missing, like a #define ENABLE_CLASS_INHERITANCE 1 or something 😠. Any ideas/suggestions would be greatly appreciated. Have a nice day! -
[Solved] Config patches: DLC compatibility vs requirement
Corvine posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Hi, sorry if this is a basic question, I'm kind of new to configs. I've tried searching for this question but couldn't find anything. I'm trying to find out how to make an addon compatible with DLC, without requiring it. I'm making an addon that changes gun feel, and I've achieved it for vanilla, non-DLC weapons. Here's my patch for Weapons_f: https://pastebin.com/L8Dd9JuJ. Here's an example of a modified CfgRecoil setting: And a modified CfgWeapons entry: These work fine. What I want to know is: if I add similar CfgRecoils and CfgWeapons entries for DLC weapons, like this: ...will that cause problems if the mod is used by someone without the DLC? Is this something to do with how you define requiredAddons? Do I have to get people to install compat patches based on what DLC they have? I still don't 100% understand this aspect of making a patch so if anyone could ELI5 that would rock. :) Thanks! -
Like the title says, I'm looking to see if anyone has seen or done this type of edit. Our CTI server is trying to find a solution to heavy artillery use on the server and before I begin messing with configs (which I'm a noob), I'm curious to see if it's already been done. Thanks for any tips/help!
- 3 replies
-
- artillery computer
- max range
- (and 3 more)
-
Hi Is it possible to do Multiple inheritance ? I know you can't do like in C++ and just put a comma to make a single class inherit from multiple classes. But would that work in arma 3; Addon A : Class New_Awesome_Class: Arma3_Base_Class Addon B : *(this one requires addon A) Class New_Awesome_Class : Another_Class_from_a_mod The Idea is that I do not want the Arma 3 Base class or the Other Class from the other mod to inherit from each other. But I still need my new class to inherit from Both. How can I do that? Thanks
-
{SOLVED] strange issue with muzzle flash not showing
eggbeast posted a topic in ARMA 3 - MODELLING - (O2)
ok so I am trying to fix a non-showing muzzle flash on a sub-class of APC. the base vehicle is BI's BTR40 from arma 2. i have a working PK MG in the parent class, and one child down (the m18 recoilless rifle version with PK in copilot seat) however the other children have a glitch - they do not show the muzzle-flash proxy in editor. they work in buldozer, but in editor they only light up the surroundings, the proxy model does not show you can see from below that i am inheriting the PKM turret directly and so do not repeat those parts. In child1 the m18 version, the pkm_zasleh (muzzleflash) appears correctly in all other children, inheriting the EXACT SAME content, they do not show up. Does this mean that the model of the pkm_zasleh proxy in the m40, sp99 and mortar vehicles is somehow borked? or have i missed something ? cheers for any help here are the inheritances skeleton class uns_BTR_turret_PKM: uns_BTR_turret { isDiscrete = 1; skeletonInherit = "uns_BTR_turret"; skeletonBones[]= { "PKM_OtocVez","", "PKM_OtocHlaven","PKM_OtocVez", "PKM_ammobelt","PKM_OtocHlaven", "PKM_shells","PKM_ammobelt", "PKM_bullet06","PKM_shells", "PKM_bullet05","PKM_bullet06", "PKM_bullet04","PKM_bullet05", "PKM_bullet03","PKM_bullet04", "PKM_bullet02","PKM_bullet03", "PKM_bullet01","PKM_bullet02", "PKM_magazine","PKM_OtocHlaven", "PKM_charging_handle","PKM_OtocHlaven", "PKM_topcover","PKM_OtocHlaven", "PKM_trigger","PKM_OtocHlaven", "PKM_zasleh","PKM_OtocHlaven" }; }; class uns_BTR_PKSkeleton: uns_BTR_turret_PKM //pk on only turret { skeletonInherit="uns_BTR_turret_PKM"; skeletonBones[]= { // PKM "PKM_handle_L","PKM_OtocHlaven", "PKM_handle_R","PKM_OtocHlaven" }; }; class uns_BTR_M18Skeleton: uns_BTR_turret_PKM //m18 RR on rear, pk on codriver { skeletonInherit="uns_BTR_turret_PKM"; skeletonBones[]= { // M18 anims // "feedtray_cover","OtocHlaven" }; }; class uns_BTR_M40Skeleton: uns_BTR_turret_PKM //m40 RR on rear, pk on codriver { skeletonInherit="uns_BTR_turret_PKM"; skeletonBones[]= { // M40 anims "MainTurret","", "dial1","MainTurret", "dial2","MainTurret", "MainGun","MainTurret", "magazine","MainGun", "breech","MainGun", "breechblock","breech", "breechhandle","MainGun", "damageGun","MainGun" }; }; class uns_BTR_SPG9Skeleton: uns_BTR_turret_PKM //spg9 RR on rear, pk on codriver { skeletonInherit="uns_BTR_turret_PKM"; skeletonBones[]= { // RR anims "OtocVez","", "OtocHlaven","OtocVez", "ammo_hide","OtocHlaven", "breach","OtocHlaven", "handle","OtocHlaven" }; }; class uns_BTR_MortarSkeleton: uns_BTR_turret_PKM //mortar on rear, pk on codriver { skeletonInherit="uns_BTR_turret_PKM"; skeletonBones[]= { "computer", "OtocHlaven" }; }; model cfg class uns_BTR_PK: uns_BTR { skeletonName="uns_BTR_PKSkeleton"; sectionsInherit="uns_BTR"; sections[]= { "PKM_zasleh" }; class Animations: Animations { // PKM Gun Animations class pk_MuzzleFlashROT { type="rotationZ"; source="muzzle_rot_pk"; selection="PKM_zasleh"; axis="PKM_barrel_axis"; sourceAddress="loop"; centerFirstVertex=true; minValue=0; maxValue=4; angle0="rad 0"; angle1="rad 360"; }; class PKM_Turret { source="PKM_Turret"; selection="PKM_OtocVez"; axis="PKM_OsaVeze"; type="rotationY"; animPeriod=0; minValue="rad -360"; maxValue="rad +360"; angle0="rad -360"; angle1="rad +360"; }; class PKM_Gun: PKM_Turret { type="rotationX"; source="PKM_Gun"; selection="PKM_OtocHlaven"; axis="PKM_OsaHlavne"; }; class PKM_magazine_hide { type="hide"; source="PKM_reloadMagazine"; selection="PKM_magazine"; minValue=0; maxValue=0.1; hideValue=1; }; class PKM_trigger { type = "rotationX"; source = "PKM_reloadAnim"; selection = "PKM_trigger"; axis = "PKM_trigger_axis"; minValue = 0; maxValue = 1; angle0 = "rad 0"; angle1 = "rad 10"; }; class PKM_barrelrecoil_BEGIN { Type = "translation"; Source = "PKM_recoil_source"; Selection = "PKM_barrel"; axis="PKM_barrel_axis"; MinValue = 0.50; MaxValue = 0.80; MinPhase = 0.50; MaxPhase = 0.80; SourceAddress = "clamp"; Offset0 = 0; Offset1 = 0.2; }; class PKM_barrelrecoil_END: PKM_barrelrecoil_BEGIN { MinValue = 0.85; MaxValue = 1; MinPhase = 0.85; MaxPhase = 1; Offset1 = -0.2; }; class PKM_feedtray_cover_up { type="rotation"; source="PKM_reloadMagazine"; selection="PKM_topcover"; axis="PKM_topcover_axis"; minValue=0; maxValue=0.1; angle0="0"; angle1="rad -90"; }; class PKM_feedtray_cover_down: PKM_feedtray_cover_up { minValue=0.9; maxValue=1; angle0="0"; angle1="rad 90"; }; class PKM_ammo_belt_rotation { type="rotationZ"; source="PKM_ReloadAnim"; selection="PKM_ammobelt"; axis="PKM_ammobelt_axis"; memory=1; sourceAddress="loop"; minValue=0.000000; maxValue=1.000000; angle0=-0.087266; angle1=0.174533; }; class PKM_ammobelt_reload { type="hide"; source="PKM_reloadMagazine"; selection="PKM_ammobelt"; minValue=0; maxValue=1; hideValue=0.1; }; class PKM_Charging_handle_reload_begin { type="translation"; source="PKM_reloadMagazine"; memory = 1; animPeriod = 0; selection="PKM_charging_handle"; axis="PKM_charging_handle_axis"; minValue = 0.0; maxValue = 0.02; minPhase = 0.0; maxPhase = 0.02; offset0 = 0.0; offset1 = 0.5; }; class PKM_Charging_handle_reload_end: PKM_Charging_handle_reload_begin { minValue = 0.05; maxValue = 0.07; minPhase = 0.05; maxPhase = 0.07; offset1 = -0.5; }; class PKM_Bullet01 { type="hide"; source="PKM_revolving"; selection="PKM_bullet01"; sourceAddress="mirror"; minValue = -1; maxValue = 0; minphase = -1; maxphase = 0; hideValue = 0.94501; }; class PKM_Bullet02: PKM_Bullet01 { selection="PKM_bullet02"; hideValue = 0.95501; }; class PKM_Bullet03: PKM_Bullet01 { selection="PKM_bullet03"; hideValue = 0.96501; }; class PKM_Bullet04: PKM_Bullet01 { selection="PKM_Bullet04"; hideValue = 0.97501; }; class PKM_Bullet05: PKM_Bullet01 { selection="PKM_Bullet05"; hideValue = 0.98005004; }; class PKM_Bullet06: PKM_Bullet01 { selection="PKM_Bullet06"; hideValue = 0.99001003; }; }; }; class uns_BTR_M18: uns_BTR_PK { skeletonName="uns_BTR_M18Skeleton"; sectionsInherit="uns_BTR_PK"; sections[]= { "G svetlo" //gunner light }; class Animations: Animations { // M18 RR Gun anims class MainTurret { type="rotationY"; source="mainTurret"; selection="OtocVez"; axis="OsaVeze"; animPeriod=0; minValue="rad -360"; maxValue="rad +360"; angle0="rad -360"; angle1="rad +360"; }; class MainGun: MainTurret { type="rotationX"; source="mainGun"; selection="OtocHlaven"; axis="OsaHlavne"; }; }; }; class uns_BTR_M40: uns_BTR_M18 { skeletonName="uns_BTR_M40Skeleton"; sectionsInherit="uns_BTR_M18"; sections[]= {}; class Animations: Animations { // M40 RR Gun anims class MainTurret { type="rotationY"; source="mainTurret"; selection="MainTurret"; axis="MainTurret_axis"; memory=1; minValue="rad -360"; maxValue="rad +360"; angle0="rad -360"; angle1="rad +360"; }; class dial1: MainTurret { selection = "dial1"; angle0 = "rad 3600"; angle1 = "rad -3600"; }; class MainGun: MainTurret { type="rotationX"; source="mainGun"; selection="MainGun"; axis="MainGun_axis"; }; class dial2: MainGun { selection = "dial2"; angle0 = "rad 3600"; angle1 = "rad -3600"; }; //reload anims class magazine_hide { type="hide"; source="ReloadMagazine"; selection="magazine"; minValue=0; maxValue=1; minphase = 0.3; maxphase = 0.6; hideValue=0.6; }; class breech_open { type="rotation"; source="ReloadMagazine"; selection="breech"; axis="breech_axis"; minValue=0.25; maxValue=0.4; angle0="0"; angle1="rad -120"; }; class breech_close: breech_open { minValue=0.6; maxValue=0.75; angle1="rad 120"; }; class breechblock_open { type="rotation"; source="ReloadMagazine"; selection="breechblock"; axis="breechblock_axis"; minValue=0; maxValue=0.25; angle0="0"; angle1="rad -45"; }; class breechblock_close: breechblock_open { minValue=0.75; maxValue=1; angle1="rad 45"; }; class breech_handle_open { type="rotation"; source="ReloadMagazine"; memory = 1; selection="breechhandle"; axis="breechhandle_axis"; minValue = 0; maxValue = 0.25; angle0="0"; angle1="rad -170"; }; class breech_handle_close: breech_handle_open { minValue = 0.75; maxValue = 1; angle1="rad 170"; }; // RR damage class damageGun { type="hide"; source="damage"; selection="damageGun"; minValue = 0.0; maxValue = 1.0; minPhase = 0.0; maxPhase = 1.0; hideValue = 1.0; }; }; }; class uns_BTR_SPG9: uns_BTR_M18 { skeletonName="uns_BTR_SPG9Skeleton"; sectionsInherit="uns_BTR_M18"; sections[]= {}; class Animations: Animations { // RR Gun anims class ammo_hide { type="hide"; source="ReloadMagazine"; selection="ammo_hide"; minValue=0; maxValue=1; hidevalue = 0.1; }; class breech_open { type="rotation"; source="ReloadMagazine"; selection="breach"; axis="breach_axis"; minValue=0.25; maxValue=0.4; angle0="0"; angle1="rad 140"; }; class breech_close: breech_open { minValue=0.6; maxValue=0.75; angle1="rad -140"; }; class breech_handle_open { type="rotation"; source="ReloadMagazine"; memory = 1; selection="handle"; axis="handle_axis"; minValue = 0; maxValue = 0.25; angle0="0"; angle1="rad -90"; }; class breech_handle_close: breech_handle_open { minValue = 0.75; maxValue = 1; angle1="rad 90"; }; }; }; class uns_BTR_MORTAR: uns_BTR_M18 { skeletonName="uns_BTR_MortarSkeleton"; sectionsInherit="uns_BTR_M18"; sections[]= {}; class Animations: Animations { // Mortar anims class camElev { type="rotationX"; source="camElev"; selection="computer"; axis="computer_axis"; animPeriod=0; minValue="rad -360"; maxValue="rad +360"; angle0="rad -360"; angle1="rad +360"; }; class camElev2: camElev { source="mainGun"; angle0="rad +360"; angle1="rad -360"; }; }; }; config.cpp for cfg vehicles class uns_Type55_LMG: uns_Type55_MG_base { scope = 2; displayName = "Type 55 APC (PK)"; model = "\uns_btr\uns_BTR_PK.p3d"; //etc class Turrets: Turrets { class MainTurret: MainTurret { primaryGunner = 0; primaryObserver = 0; proxyType = "CPGunner"; gunnerName = "Gunner"; proxyIndex = 2; commanding = -1; weapons[] = {"uns_pkt2"}; magazines[] = {"uns_250Rnd_762x54_PKT","uns_250Rnd_762x54_PKT","uns_250Rnd_762x54_PKT","uns_250Rnd_762x54_PKT","uns_250Rnd_762x54_PKT"}; selectionFireAnim = "PKM_zasleh"; gunBeg = "PKM_usti_hlavne"; gunEnd = "PKM_konec_hlavne"; body = "PKM_Turret"; gun = "PKM_Gun"; memoryPointGunnerOptics = "PKM_gunnerview"; animationSourceBody = "PKM_Turret"; animationSourceGun = "PKM_Gun"; gunnerLeftHandAnimName = "PKM_handle_L"; gunnerRightHandAnimName = "PKM_handle_R"; turretInfoType = "RscWeaponZeroing"; discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200}; discreteDistanceInitIndex = 2; stabilizedInAxes = "StabilizedInAxesNone"; gunnerAction = "gunner_standup01"; gunnerInAction = "gunner_standup01"; gunnerOpticsModel = "uns_compat\ca\weapons\optika_empty"; initElev = 0; minElev = -18; maxElev = 55; minTurn = -55; maxTurn = 55; initTurn = 0; class ViewOptics { initAngleX = 0; minAngleX = -25; maxAngleX = 80; initAngleY = 0; minAngleY = -75; maxAngleY = 75; initFov = 0.4; minFov = 0.4; maxFov = 0.4; turretInfoType = "RscWeaponZeroing"; discreteDistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200}; discreteDistanceInitIndex = 2; }; class ViewGunner { initAngleX = 0; minAngleX = -25; maxAngleX = 80; initAngleY = 0; minAngleY = -65; maxAngleY = 65; initFov = 0.7; minFov = 0.7; maxFov = 0.7; }; }; }; class AnimationSources: AnimationSources { class PKM_ReloadAnim { source = "reload"; weapon = "uns_pkt2"; }; class PKM_ReloadMagazine: PKM_ReloadAnim { source = "reloadmagazine"; }; class PKM_Revolving: PKM_ReloadAnim { source = "revolving"; }; class muzzle_rot_pk: PKM_ReloadAnim { source = "ammorandom"; }; }; }; /////////////////////////////////// m18 - pk works fine class uns_Type55_RR57: uns_Type55_LMG { displayName = "Type 55 APC (57mm Type36)"; model = "\uns_btr\uns_BTR_M18.p3d"; class Turrets: Turrets { class MainTurret: MainTurret { gunnerName = "Front Gunner"; primaryGunner = 0; proxyType = "CPGunner"; proxyIndex = 1; commanding = 1; gunnerAction = "driver_mid01"; gunnerInAction = "driver_mid01"; //inherits pkm from above gunnerLeftHandAnimName = ""; gunnerRightHandAnimName = ""; }; class RR_turret: MainTurret { gunnerName = "Rear Gunner"; primaryGunner = 1; proxyType = "CPGunner"; proxyIndex = 2; commanding = 2; gunnerForceOptics = 0; gunnerOutOpticsShowCursor = 0; stabilizedInAxes = 0; soundServo[] = {"\uns_compat\ca\sounds\vehicles\servos\turret-1",0.0316228,1,15}; // soundServo[] = {"A3\Sounds_F\vehicles\armor\noises\servo_armor_comm",0.017783,1.0,15}; weapons[] = {"uns_Type36"}; magazines[] = {"uns_Type36_HEATmag","uns_Type36_HEATmag","uns_Type36_HEATmag","uns_Type36_HEATmag","uns_Type36_HEATmag","uns_Type36_HEATmag", "uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_HEmag","uns_Type36_WPmag","uns_Type36_WPmag","uns_Type36_WPmag","uns_Type36_WPmag","uns_Type36_WPmag","uns_Type36_WPmag"}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; body = "MainTurret"; gun = "MainGun"; animationSourceBody = "MainTurret"; animationSourceGun = "MainGun"; selectionFireAnim = "zasleh"; memoryPointGunnerOptics = "gunnerview"; gunnerLeftHandAnimName = ""; gunnerRightHandAnimName = ""; gunnerAction = "uns_btr_m18_gunner_2";//"BTR40_Gunner_EP1"; gunnerInAction = "uns_btr_m18_gunner_2"; ejectDeadGunner = 1; gunnerOpticsModel = "uns_compat\ca\weapons\2Dscope_SPG_4"; minTurn = -360; maxTurn = 360; maxElev = 40; class ViewOptics: ViewOptics { initFov = 0.111; minFov = 0.111; maxFov = 0.111; }; }; }; class AnimationSources: AnimationSources { class reloadMagazine { source = "reloadmagazine"; weapon = "uns_Type36"; }; //inherits pkm anims from above }; }; /////////////////////////////////// spg9 - pk muz flash fails to show up class uns_Type55_RR73: uns_Type55_RR57 { displayName = "Type 55 APC (73mm SPG9)"; model = "\uns_btr\uns_BTR_SPG9.p3d"; class Turrets: Turrets { class MainTurret: MainTurret {}; class RR_turret: MainTurret { gunnerName = "Rear Gunner"; primaryGunner = 1; proxyType = "CPGunner"; proxyIndex = 2; commanding = 2; gunnerForceOptics = 0; gunnerOutOpticsShowCursor = 0; weapons[] = {"uns_SPG9"}; magazines[] = { "uns_OG9_HEmag","uns_OG9_HEmag","uns_OG9_HEmag","uns_OG9_HEmag", "uns_OG9_HEmag","uns_OG9_HEmag","uns_OG9_HEmag","uns_OG9_HEmag", "uns_OG9_HEmag","uns_OG9_HEmag","uns_PG9_ATmag","uns_PG9_ATmag", "uns_PG9_ATmag","uns_PG9_ATmag","uns_PG9_ATmag","uns_PG9_ATmag", "uns_PG9_ATmag","uns_PG9_ATmag","uns_PG9_ATmag","uns_PG9_ATmag" }; gunBeg = "RR_gunBeg"; gunEnd = "RR_gunEnd"; body = "MainTurret"; gun = "MainGun"; memoryPointGunnerOptics = "gunnerview"; animationSourceBody = "MainTurret"; animationSourceGun = "MainGun"; stabilizedInAxes = 0; soundServo[] = {"A3\Sounds_F\vehicles\armor\noises\servo_armor_comm", 0.017783, 1.000000, 15}; gunnerAction = "uns_btr_m18_gunner"; gunnerInAction = "uns_btr_m18_gunner"; ejectDeadGunner = 1; gunnerOpticsModel = "uns_compat\ca\weapons\2Dscope_SPG_4"; minTurn = -360; maxTurn = 360; initTurn = 0; minElev = -20; maxElev = 70; initElev = 0; class ViewGunner { initAngleX = 5; minAngleX = -30; maxAngleX = 30; initAngleY = 0; minAngleY = -100; maxAngleY = 100; initFov = 0.700000; minFov = 0.250000; maxFov = 1.100000; }; class ViewOptics { initAngleX = 0; minAngleX = -30; maxAngleX = 30; initAngleY = 0; minAngleY = -100; maxAngleY = 100; initFov = 0.111000; minFov = 0.111000; maxFov = 0.111000; }; }; }; class AnimationSources: AnimationSources { class ReloadMagazine { source = "reload"; weapon = "uns_SPG9"; animPeriod = 5; }; }; }; /////////////////////////////////// m40 - pk muz flash fails to show up class uns_Type55_M40: uns_Type55_RR57 { displayName = "Type 55 APC (M40)"; model = "\uns_btr\uns_BTR_M40.p3d"; class Turrets: Turrets { class MainTurret: MainTurret {}; class RR_turret: MainTurret { gunnerName = "Rear Gunner"; primaryGunner = 1; proxyType = "CPGunner"; proxyIndex = 2; commanding = 2; gunnerForceOptics = 0; gunnerOutOpticsShowCursor = 0; weapons[] = {"uns_M40RR"}; magazines[] = { "uns_M40_HEATmag","uns_M40_HEATmag","uns_M40_HEATmag","uns_M40_HEATmag", "uns_M40_HEmag","uns_M40_HEmag","uns_M40_HEmag","uns_M40_HEmag", "uns_M40_APERSmag","uns_M40_APERSmag","uns_M40_APERSmag","uns_M40_APERSmag", "uns_M40_WPmag","uns_M40_WPmag" }; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; body = "MainTurret"; gun = "MainGun"; memoryPointGunnerOptics = "gunnerview"; animationSourceBody = "MainTurret"; animationSourceGun = "MainGun"; stabilizedInAxes = 0; soundServo[] = {"A3\Sounds_F\vehicles\armor\noises\servo_armor_comm", 0.017783, 1.000000, 15}; gunnerAction = "uns_btr_m18_gunner_2"; gunnerInAction = "uns_btr_m18_gunner_2"; ejectDeadGunner = 1; gunnerOpticsModel = "uns_compat\ca\weapons\2Dscope_SPG_4"; minTurn = -360; maxTurn = 360; initTurn = 0; minElev = -20; maxElev = 70; initElev = 0; class ViewGunner { initAngleX = 5; minAngleX = -30; maxAngleX = 30; initAngleY = 0; minAngleY = -100; maxAngleY = 100; initFov = 0.700000; minFov = 0.250000; maxFov = 1.100000; }; class ViewOptics { initAngleX = 0; minAngleX = -30; maxAngleX = 30; initAngleY = 0; minAngleY = -100; maxAngleY = 100; initFov = 0.111000; minFov = 0.111000; maxFov = 0.111000; }; }; }; class AnimationSources: AnimationSources { class ReloadMagazine { source = "ReloadMagazine"; weapon = "uns_M40RR"; animPeriod = 5; }; }; }; /////////////////////////////////// mortar - pk muz flash fails to show up class uns_Type55_mortar: uns_Type55_LMG { displayName = "Type 55 APC (82mm Mortar)"; model = "\uns_btr\uns_BTR_mortar.p3d"; class Turrets: Turrets { class MainTurret: MainTurret { gunnerName = "Front Gunner"; primaryGunner = 0; proxyType = "CPGunner"; proxyIndex = 1; commanding = 1; gunnerAction = "driver_mid01"; gunnerInAction = "driver_mid01"; gunnerLeftHandAnimName = ""; gunnerRightHandAnimName = ""; }; class Mortar_turret: MainTurret { gunnerName = "Rear Gunner"; primaryGunner = 1; proxyType = "CPGunner"; proxyIndex = 2; commanding = 2; //weapons weapons[] = {"uns_M1941_82mm_Mortar"}; magazines[] = { "uns_8Rnd_82mmHE_M1941","uns_8Rnd_82mmHE_M1941","uns_8Rnd_82mmHE_M1941", "uns_8Rnd_82mmWP_M1941", "uns_8Rnd_82mmSMOKE_M1941", "uns_8Rnd_82mmILLUM_M1941"}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; animationSourceBody = "MainTurret"; animationSourceGun = "MainGun"; body = "MainTurret"; gun = "MainGun"; gunnerLeftHandAnimName = ""; gunnerRightHandAnimName = ""; //crew gunnerAction = "Mortar_01_F_Turret"; gunnerInAction = "Mortar_01_F_Turret"; ejectDeadGunner = 1; //handling stabilizedInAxes = 0; soundServo[] = {"A3\Sounds_F\vehicles\armor\noises\servo_armor_comm",0.0316228,1,15}; //optics animationSourceCamElev = "camElev"; turretInfoType = "RscWeaponRangeArtillery"; elevationMode = 3; memoryPointGunnerOptics = "computer"; memoryPointGunnerOutOptics = "gunnerview"; discreteDistanceCameraPoint[] = {"eye"}; cameraDir = "look"; initCamElev = 0; minCamElev = -35; maxCamElev = 35; gunnerForceOptics = 1; gunnerOpticsModel = "uns_compat\ca\weapons\2Dscope_SPG_4"; gunnerOutOpticsShowCursor = 0; minTurn = -360; maxTurn = 360; maxElev = 40; class ViewOptics: ViewOptics { initFov = 0.111; minFov = 0.111; maxFov = 0.111; turretInfoType = "RscWeaponRangeArtillery"; }; }; }; class AnimationSources: AnimationSources {}; };- 8 replies
-
- zasleh
- muzzle flash
-
(and 1 more)
Tagged with:
-
SQF Classes for ArmA 3 Edited - release updated with a couple of bugfixes - if you downloaded prior to 6pm GMT on 29 October then please re-download to get the corrected files. "If . . . [the] fact [that brutes abstract not] be made the distinguishing property of that sort of animal, I fear a great many of those that pass for men must be reckoned into their number." -- George Berkeley Many times when scripting in SQF it may occur that implementing object-oriented techniques can simplify or enhance certain abstractions. The technique of using getVariable/setVariable on a unit or gamelogic to store function code or references specific to that unit's situation is a common pattern found in many missions and modules. Here, that idea is taken one step farther: instead of storing functions on game objects, we store an array of class names (representing a chain of inheritance or a mixture of interfaces). Meanwhile, a master Classes array holds a subarray for each defined class, containing a function definition for each class method. With this arrangement and just a handful of primitive functions, an unlimited variety of classes and methods can be declared on-the-fly while a mission is running. Release (.zip): https://github.com/dwringer/a3system/releases/tag/v1.0 Code: http://github.com/dwringer/a3system/tree/master/ClassDemo.Tanoa This is a selection of modules drawn from a larger repository I keep at http://www.github.com/dwringer/a3system/. There, more recent versions of these modules can often be found. I also placed other modules I created over the years, which are of variable quality and may or may not be worth a look. Class layout Lambda Macros Example overview This will demonstrate how to create abstract instances and send messages (method calls) to them. The included example is a mission with four men (crew_1..crew_4) and two vehicles (car_1, car_2). You may easily duplicate it in a different map if you don't have Tanoa available. There is a single Radio Alpha trigger, upon whose activation the following scripts are executed: CG = ["CrewUnitGroup"] call fnc_new; [CG, "assign", crew_1, "driver"] call fnc_tell; [CG, "assign", crew_2, "gunner"] call fnc_tell; [CG, "assign", crew_3, "driver"] call fnc_tell; [CG, "assign", crew_4, "gunner"] call fnc_tell; [CG, "assign", car_1, "vehicle"] call fnc_tell; [CG, "assign", car_2, "vehicle"] call fnc_tell; [CG, "board_instant"] call fnc_tell; Here, fnc_new is how we create a new instance. It accepts the class name and any init parameters appended to it (here there are none). We could also put a Game Logic in the editor instead of using fnc_new, and in its init use the following: _nil = this spawn { waitUntil {not isNil "ClassesInitialized"}; [_this, "CrewUnitGroup"] call fnc_instance; .. rest of code .. }; The method calls are actually made with fnc_tell, which takes as parameters the class instance, method name, and subsequently each method parameter. Thus, all methods to all classes are defined and called using a standardized syntax and set of functions which have been precompiled. Since fnc_instance makes an instance out of an existing object, we can also use it for creating class inheritance. Consider the following: DEFCLASS("MySubClass") ["_self"] DO { [_self, "SuperClass"] call fnc_instance; .. rest of code .. _self } ENDCLASS; Now, MySubClass inherits all the methods from SuperClass. Each game object keeps an ordered list of its class assignments, so if a method is not found on MySubClass it will be looked up on SuperClass. I have provided the macros SUPER and SUPER_ARGS in include\classes.hpp to facilitate subclassing from within classdef header files. If you want to create a subclass method that implements a superclass method under a different name, that can be done by looking up the class alist in the Classes global alist and using the function contained there as a new method. In classdef files, this has a macro called ALIAS(subclass, subclass_method, superclass, superclass_method). Another example Without further ado, the link to the repository containing the above example mission folder and all required modules is: Release (.zip): https://github.com/dwringer/a3system/releases/tag/v1.0 Code: http://github.com/dwringer/a3system/tree/master/ClassDemo.Tanoa Good luck, and if anyone creates some useful classes or a cool class tree, I'd love to hear about it. Even if this just serves as an example of what can be done to (ab)use SQF, I am satisfied. "No point in mentioning these bats, I thought. Poor bastard will see them soon enough." -- Raoul Duke Edited - release updated with a couple of bugfixes - if you downloaded prior to 6pm GMT on 29 October then please redownload to get the corrected files. There were changes made to fnc_tell and fnc_filter related to nil values being passed as parameters. Edited - added another example section
- 6 replies
-
- 2
-
- Classes
- Object-Oriented
- (and 8 more)
-
[SOLVED] Undefined base class but external parent classes defined...
Grester posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Yes this is going to sound weird but I'm trying to create an inheritance from a class yet it's giving me the undefined base class error despite I have literally made the entire parent-child tree which isn't usually necessary. I'm not actually using a "base" class but one of BIS inherited classes but it should still work right? Any idea why this is giving me this error? I also have the necessary required addons defined so I'm clueless. //config.cpp (...) requiredAddons[] = {"A3_characters_f_beta","A3_characters_f","A3_Weapons_F","A3_Data_F"}; (...) class CfgVehicles { class Land; //These shouldn't be necessary class Man; //These shouldn't be necessary class CAManBase; //These shouldn't be necessary class SoldierWB; //These shouldn't be necessary class B_Soldier_base_F; //I wanted to inherit one of the sniper ones preferably B_sniper_f class B_Soldier_sniper_base_F; //Inheriting this one doesn't work either class B_sniper_F; #include "CfgUnits.hpp" }; (...) ///CfgUnits.hpp (...) class BOT_SNIP_Desert: B_sniper_F { //Undefined base class error here //overriden values //no subclasses used }; (...) -
[SOLVED]Partial subclass inheritance issue
Grester posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Without going to much off topic I'll give a bit of background on why such question... I'm working on a clothes mod that creates new uniforms, helmets,etc. The scripts weren't much optimized and were pretty much copy+paste based. Worked but if I wanted to change a value of a type of vest then I had to change them all. So I started adapting the scripts to be based on inheritance so that all I had to change for the childs were textures. However I started to face some issues of many values not being inherited, particularly stats of uniforms which could be perhaps answered with the fact that some stats are present in subclasses which weren't declared in the children. However my vests children don't have subclasses declared and have the correct stats so I'm not sure. As I was doing some research looking for answers I've stumbled upon Macros which seems to be a replacement for my inheritance based system since it just copycats the parent and all I have to do is input the values into the parameters. Thus my question, which should have I used in the first place? May have I miswritten the inheritances? Or perhaps a mix of both? I haven't fixed the problem yet as I was looking for an answer on the best aproach towards the problem. It seems that backpacks, vests and helmets are working correctly but I'm not entirely sure since uniforms stats and some subclasses variables are missing/generating errors. This also brings me doubts wether or not Units are correcly setup despite at first glance they seem to have inherited correctly. Below I'll leave an example of my classes. (For the sake of simplicity for now I'll just take a segment from my vests. If it's due necessary later on I could post segments from the Units/Uniforms files.) //Also authors don't seem to inherit properly. (...) class cfgWeapons { class VestItem; class Vest_Camo_Base: ItemCore { class ItemInfo; }; #include "cfgVest.hpp" }; (...) class VEST_TAC_Desert: Vest_Camo_Base { author = "Example"; //vehicleClass = myVest; side = TWest; scope = 2; displayName = "TacticalVest Desert"; picture = "\A3\characters_f\Data\UI\icon_v_tacvest_blk_ca.paa"; model = "A3\Characters_F\Common\equip_tacticalvest.p3d"; hiddenSelections[] = {"Camo"}; hiddenSelectionsMaterials[] = {"A3\Characters_F\Common\Data\tacticalvest.rvmat"}; hiddenSelectionsTextures[] = {"forces\tex\vest\deserttactical.paa"}; class ItemInfo: VestItem { class HitpointsProtectionInfo { class Chest { HitpointName = "HitChest"; armor = 8; PassThrough = 0.3; }; class Diaphragm { HitpointName = "HitDiaphragm"; armor = 8; PassThrough = 0.3; }; class Abdomen { hitpointName = "HitAbdomen"; armor = 8; passThrough = 0.3; }; class Body { hitpointName = "HitBody"; passThrough = 0.3; }; }; uniformModel = "A3\Characters_F\Common\equip_tacticalvest.p3d"; containerClass = "Supply120"; mass = 80; hiddenSelections[] = {"camo"}; }; }; class VEST_TAC_WoodlandA: VEST_TAC_Desert { author = "Example"; displayName = "TacticalVest Woodland-A"; hiddenSelectionsTextures[] = {"forces\tex\vest\woodlandtactical.paa"}; };- 4 replies
-
- Macros
- Inheritance
-
(and 3 more)
Tagged with: