franze 196 Posted December 6, 2002 Having some problems with my cpp file, I'm trying to define more than one vehicle type (same basic model, maybe some light changes) in a single CPP file. I've seen it done with other addons but I've been having trouble myself. Heres the code I am using: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #define TEast 0 #define TWest 1 #define TGuerrila 2 #define TCivilian 3 #define TSideUnknown 4 #define TEnemy 5 #define TFriendly 6 #define TLogic 7 #define true 1 #define false 0 // type scope #define private 0 #define protected 1 #define public 2 class CfgPatches { class Naga { units[] = {Naga}; weapons[] = {}; requiredVersion = 1.10; }; class MAC { units[] = {}; weapons[] = {MAC}; requiredVersion = 1.20; }; }; class CfgAmmo { class Default {}; class AT3: Default {}; class Hellfire: AT3 {}; class ATM : Hellfire { hit=1600; indirectHit=200; indirectHitRange=2.500000; initTime=0.000000; thrustTime=5.500000; thrust=1200; }; class BulletSingle: Default {}; class MACBullet: BulletSingle { hit=50; indirectHit=10; }; }; class CfgWeapons { class Default {}; class LAWLauncher: Default {}; class CarlGustavLauncher : LAWLauncher {}; class AT3Launcher: CarlGustavLauncher {}; class HellfireLauncher: AT3Launcher {}; class HellfireLauncherCobra : HellfireLauncher {}; class ATM : HellfireLauncherCobra { ammo="ATM"; displayName="Pilum-VI Missile Launcher "; displayNameMagazine="ATM"; shortNameMagazine="ATM"; count=8; }; class MGun: Default {}; class MachineGun7_6: MGun {}; class MachineGun30: MachineGun7_6 {}; class MAC: MachineGun30 { displayName="MT-30 Autocannon Rifle"; displayNameMagazine="MAC"; shortNameMagazine="MAC"; ammo="MACBullet"; count=600; reloadTime=0.1020000; sound[]={"\naga\macshot.wav",0.162278,1}; aiRateOfFire=0; // delay between shots at given distance aiRateOfFireDistance=0; // at shorter distance delay goes lineary to zero }; }; class CfgVehicles { class All {}; class AllVehicles: All {}; class Land: AllVehicles {}; class LandVehicle: Land {}; class Tank: LandVehicle { class TurretBase {}; }; class APC: Tank {}; class M113: APC {}; class Naga: M113 { displayName="Naga"; picture=\naga\nga_icn.paa; icon = antiAC.paa; armor=180; cost=1000000; model=\naga\naga; irScanRange = 4000; // long range radar irScanGround = 4000; // NO IR on ground targets gunnerCanSee = CanSeeOptics+CanSeeEar+CanSeeCompass+CanSeeRadar; weapons[]={MAC,ATM}; magazines[]={MAC,ATM}; class Turret: TurretBase { gunAxis = "OsaHlavne"; turretAxis = "OsaVeze"; soundServo[]={,db-40,1.0}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; minElev=-50; maxElev=+30; minTurn=-110; maxTurn=110; body = "OtocVez"; gun = "OtocHlaven"; }; //threat[] VSoft, VArmor, VAir threat[]={0.5, 1, 0.5}; gunnerOpticsModel = "optika_zsu_gunner"; commanderOpticsModel = "optika_tanke_auxiliary"; gunnerAction = ManActUH60Pilot; gunnerInAction = ManActUH60Pilot; // outGunnerMayFire = true; forceHideGunner = true; viewGunnerInExternal = true; transportSoldier = 0; }; }; <span id='postcolor'> Basically I want to duplicate this part: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class All {}; class AllVehicles: All {}; class Land: AllVehicles {}; class LandVehicle: Land {}; class Tank: LandVehicle { class TurretBase {}; }; class APC: Tank {}; class M113: APC {}; class Naga: M113 { displayName="Naga"; picture=\naga\nga_icn.paa; icon = antiAC.paa; armor=180; cost=1000000; model=\naga\naga; irScanRange = 4000; // long range radar irScanGround = 4000; // NO IR on ground targets gunnerCanSee = CanSeeOptics+CanSeeEar+CanSeeCompass+CanSeeRadar; weapons[]={MAC,ATM}; magazines[]={MAC,ATM}; <span id='postcolor'> And change the weapon types. I tried duplicating it but the vehicle was either unrecognized or the code was not accepted by the game. Share this post Link to post Share on other sites
franze 196 Posted December 6, 2002 Here's the code I'm using now: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #define TEast 0 #define TWest 1 #define TGuerrila 2 #define TCivilian 3 #define TSideUnknown 4 #define TEnemy 5 #define TFriendly 6 #define TLogic 7 #define true 1 #define false 0 // type scope #define private 0 #define protected 1 #define public 2 class CfgPatches { class Naga { units[] = {Naga, LFNaga}; weapons[] = {}; requiredVersion = 1.10; }; class MAC { units[] = {}; weapons[] = {MAC}; requiredVersion = 1.20; }; }; class CfgAmmo { class Default {}; class AT3: Default {}; class Hellfire: AT3 {}; class ATM : Hellfire { hit=1600; indirectHit=20; indirectHitRange=2.500000; initTime=0.000000; thrustTime=5.500000; thrust=1200; }; class BulletSingle: Default {}; class MACBullet: BulletSingle { hit=50; indirectHit=10; }; class Shell: Default {}; class Heat: Shell {}; class Heat73: Heat {}; class Heat105: Heat73 {}; class Heat120: Heat105 {}; class thunderheat: Heat120 { airLock=1; hit=1000; indirectHit=150; indirectHitRange=8; minRange=10; minRangeProbab=0.5; midRange=1500; midRangeProbab=1; maxRange=2500; maxRangeProbab=1; }; class Shell73: Shell {}; class Shell105: Shell73 {}; class Shell120: Shell105 {}; class thundersabot: Shell120 { hit=1200; indirectHit=0; minRange=10; minRangeProbab=0.5; midRange=1500; midRangeProbab=1; maxRange=2500; maxRangeProbab=1; }; class CfgWeapons { class Default {}; class LAWLauncher: Default {}; class CarlGustavLauncher : LAWLauncher {}; class AT3Launcher: CarlGustavLauncher {}; class HellfireLauncher: AT3Launcher {}; class HellfireLauncherCobra : HellfireLauncher {}; class ATM : HellfireLauncherCobra { ammo="ATM"; displayName="Pilum-VI Missile Launcher "; displayNameMagazine="ATM"; shortNameMagazine="ATM"; count=8; }; class MGun: Default {}; class MachineGun7_6: MGun {}; class MachineGun30: MachineGun7_6 {}; class MAC: MachineGun30 { displayName="MT-30 Autocannon Rifle"; displayNameMagazine="MAC"; shortNameMagazine="MAC"; ammo="MACBullet"; count=600; reloadTime=0.1020000; sound[]={"\naga\macshot.wav",0.162278,1}; aiRateOfFire=0; // delay between shots at given distance aiRateOfFireDistance=0; // at shorter distance delay goes lineary to zero }; class Gun73: Default {}; class Gun105: Gun73 {}; class Gun120: Gun105 {}; class srwithunder: Gun120 { displayName="SRWI Thunder"; sound[]={"",0.3,1}; reloadSound[]={"",0.5,0.8}; magazines[]={"thunderheat", "thundersabot"}; aiRateOfFire=0; aiRateOfFireDistance=0; opticsZoomMin=0.333333; opticsZoomMax=0.1; }; class Shell73: Default {}; class Shell105: Shell73 {}; class Shell120: Shell105 {}; class thundersabot: Shell120 { displayName="Thunder 90mm Sobat"; displayNameMagazine="90mm Sobat"; shortNameMagazine="90mm Sobat"; ammo="thundersobat"; count=12; nameSound="heat"; initSpeed=1540; reloadTime=4; sound[]={"",10.000000,1}; aiRateOfFire=0; aiRateOfFireDistance=0; }; class Heat120: Shell120 {}; class thunderheat: Heat120 { count=12; initSpeed=1140; ammo="thunderheat"; displayName="Thunder 90mm HEAT"; displayNameMagazine="90mm HEAT"; shortNameMagazine="90mm HEAT"; nameSound="shell"; reloadTime=4; sound[]={"",10.000000,1}; aiRateOfFire=0; aiRateOfFireDistance=0; }; class CfgVehicles { class All {}; class AllVehicles: All {}; class Land: AllVehicles {}; class LandVehicle: Land {}; class Tank: LandVehicle { class TurretBase {}; }; class APC: Tank {}; class M113: APC {}; class Naga: M113 { displayName="Naga"; picture=\naga\nga_icn.paa; icon = antiAC.paa; armor=180; cost=1000000; model=\naga\naga; weapons[]={MAC,ATM}; magazines[]={MAC,ATM}; irScanRange = 4000; // long range radar irScanGround = 4000; // NO IR on ground targets gunnerCanSee = CanSeeOptics+CanSeeEar+CanSeeCompass+CanSeeRadar; class LFNaga: M113 { displayName="LFNaga"; picture=\naga\nga_icn.paa; icon = antiAC.paa; armor=180; cost=1000000; model=\naga\lfnaga; weapons[]={MAC,srwithunder}; magazines[]={MAC,srwithunder}; class Turret: TurretBase { gunAxis = "OsaHlavne"; turretAxis = "OsaVeze"; soundServo[]={,db-40,1.0}; gunBeg = "usti hlavne"; gunEnd = "konec hlavne"; minElev=-50; maxElev=+30; minTurn=-110; maxTurn=110; body = "OtocVez"; gun = "OtocHlaven"; }; //threat[] VSoft, VArmor, VAir threat[]={0.5, 1, 0.5}; gunnerOpticsModel = "optika_zsu_gunner"; commanderOpticsModel = "optika_tanke_auxiliary"; gunnerAction = ManActUH60Pilot; gunnerInAction = ManActUH60Pilot; // outGunnerMayFire = true; forceHideGunner = true; viewGunnerInExternal = true; transportSoldier = 0; }; }; <span id='postcolor'> Now, when I start OFP it says: "No entry 'Config.bin/CfgAmmo/CfgWeapons.simulation' I don't really understand this error, but there something wrong with my code that I can't see... Share this post Link to post Share on other sites
franze 196 Posted December 6, 2002 Ok, I found out this area was what I needed to modify: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgPatches { class Naga { units[] = {Naga, LFNaga}; weapons[] = {}; requiredVersion = 1.10; }; class MAC { units[] = {}; weapons[] = {MAC}; requiredVersion = 1.20; }; <span id='postcolor'> But when I put it in correctly, IE having the units and weapons all in one class, the units don't show up in the game. Share this post Link to post Share on other sites
DragoFire 0 Posted December 6, 2002 Have a look at this CPP of mine, it'll give you an idea how to do it. </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgPatches {class DrF_ADD {units[] = {DrF_A6E_ATG,DrF_A6E_AB,DrF_A6E_HB,DrF_A6E_RG, DrF_A6E_HRB}; weapons[] = {Mk_82_2, Mk_82_6, Mk_82_12, Mk_82_24, Mk_82_28, MK_81_2, Mk_81_6, MK_81_12, Mk_81_24,MK_81_28, Mk_83_2, Mk_83_3, Mk_83_6, Mk_83_8, Mk_83_10, Mk_83_13, MK_84_1, Mk_84_2, Mk_84_3, Mk_84_4, Mk_84_5 }; requiredVersion = 1.85; }; }; class CfgModels { class Default {}; class weapon: default {}; class vehicle: default {}; class Intruder_ATG: vehicle {sectionsInherit= "Vehicle"; sections[]= {"vrtule staticka","vrtule blur"}; }; class Intruder_AB: Intruder_ATG {}; class Intruder_HB: Intruder_ATG {}; class Intruder_RG: Intruder_ATG {}; class Intruder_HRB: Intruder_ATG {}; class mk_81: weapon {}; class mk_82: weapon {}; class mk_83: weapon {}; class mk_84: weapon {}; };<span id='postcolor'> </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgVehicles { class All {}; class AllVehicles: All {}; class Air: AllVehicles {}; class Plane: Air {}; class A10: Plane {}; class DrF_A6E_ATG: A10 {}; // too much to post here! class DrF_A6E_AB: DrF_A6E_ATG {displayName= "A-6E Intruder Attack Bomber"; model= "\DrF_Intruder\Intruder_AB.P3D"; weapons[]= {MK_83_14}; magazines[]= {MK_83_14}; }; class DrF_A6E_HB: DrF_A6E_ATG {displayName= "A-6E Intruder Hvy Bomber"; model= "\DrF_Intruder\Intruder_HB.P3D"; weapons[]= {mk_84_5}; magazines[]= {mk_84_5}; }; class DrF_A6E_RG: DrF_A6E_ATG {displayName= "A-6E Intruder Rocket Gunship"; model= "\DrF_Intruder\Intruder_rg.P3D"; weapons[]= {LAU10_24,LAU61_114}; magazines[]= {LAU10_24,LAU61_114}; }; class DrF_A6E_HRB: DrF_A6E_ATG {displayName= "A-6E Intruder Hvy Rocket Bomber"; picture = "\DrF_Intruder\Intruder_hrb.paa"; model= "\DrF_Intruder\Intruder_HrB.P3D"; weapons[]= {mk_83_8, LAU10_24}; magazines[]= {mk_83_8, LAU10_24}; }; };<span id='postcolor'> Note you have to have the names the same all the way though your CPP. DragoFire Share this post Link to post Share on other sites
franze 196 Posted December 7, 2002 Thanks for the help, still have some problems but I'll probably figure it out. Now it says that my base class isn't defined at this point (I think): </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Default {}; class weapon: default {}; class vehicle: default {}; class Naga: vehicle { <span id='postcolor'> The vehicle "Naga" is supposed to be in the M113s class. Share this post Link to post Share on other sites
franze 196 Posted December 7, 2002 Lol, well I'm going to start from scratch again, I can't seem to get rid of all these bugs. Get rid of one, another one pops up! Share this post Link to post Share on other sites
DragoFire 0 Posted December 7, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Franze @ Dec. 07 2002,11:22)</td></tr><tr><td id="QUOTE">Thanks for the help, still have some problems but I'll probably figure it out. Now it says that my base class isn't defined at this point (I think): </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Default {}; class weapon: default {}; class vehicle: default {}; class Naga: vehicle { <span id='postcolor'> The vehicle "Naga" is supposed to be in the M113s class.<span id='postcolor'> This is what you should have if you want it under the M113 APC class; </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgVehicle { class Default {}; class all: default {}; class allvehicles: all {}; class land: allvehicles {}; class landvehicle: land {}; class tank: landvehicle {}; class apc: tank {}; class m113: apc {}; class naga: m113 {}; };<span id='postcolor'> But I'd class a Strider more as a walking light/medium tank; </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgVehicle { class Default {}; class all: default {}; class allvehicles: all {}; class land: allvehicles {}; class landvehicle: land {}; class tank: landvehicle {}; class naga: tank {}; };<span id='postcolor'> DragoFire Share this post Link to post Share on other sites
franze 196 Posted December 9, 2002 Currently the code works, and with as touchy as it is, I'd rather not make a major change like that in the middle of development. Share this post Link to post Share on other sites