Home   Help Search Login Register  

Author Topic: weapons replacement and the config.cpp  (Read 2269 times)

0 Members and 1 Guest are viewing this topic.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
weapons replacement and the config.cpp
« on: 21 Jan 2006, 23:15:10 »
Okay, I'm uber-lazy(tm), and to recode the config.cpp (config.bin) for a weapons replacement mod will take several hours/days to do. I don't really want to spend that time doing it.

So frankly, do you need to recode the entire config.cpp (config.bin) to replace certain weapons, or can you do it with an addon or such (i.e. without recoding the config.cpp?)

For example, if I wanted to replace just the M16 with SJB's M16A2, here is the config code:
Code: [Select]
class M16:Riffle
      {
      scopeWeapon=2;
      scopeMagazine=2;
      valueWeapon=0;
      valueMagazine=1;
      model="\SJB_TOSM4\SJB_M16A2_proxy.p3d";
      modelOptics="\SJB_Optics\optic_m16.p3d";
      optics=1;
      opticsZoomMin=0.35;
      opticsZoomMax=0.35;
      displayName="M16A2";
      displayNameMagazine="5.45x45mm M16A2";
      shortNameMagazine="5.45x45mm";
      drySound[]={"\SJB_TOSM4\sound\Dry.ogg",0.01,1};
      magazines[]={"M16","Mortar"};
      modes[]={"Single","Burst"};

      class Single
         {
         ammo="BulletSingleW";
         multiplier=1;
         burst=1;
         displayName="5.45x45mm Semi";
         dispersion=0.0002;
         sound[]={"\SJB_TOSM4\sound\M16_SS.wss","db0",1};
         soundContinuous=0;
         reloadTime=0.07;
         ffCount=1;
         recoil="riffleSingle";
         autoFire=0;
         aiRateOfFire=5.0;
         aiRateOfFireDistance=500;
         useAction=0;
         useActionTitle="";
         };

      class Burst
         {
         ammo="BulletBurstW";
         multiplier=1;
         burst=3;
         displayName="5.45x45mm Burst";
         dispersion=0.0004;
         sound[]={"\SJB_TOSM4\sound\M16B3.ogg",1.0,1};
         soundContinuous=0;
         reloadTime=0.1;
         ffCount=3;
         recoil="riffleBurst3";
         autoFire=0;
         aiRateOfFire=5.0;
         aiRateOfFireDistance=500;
         useAction=0;
         useActionTitle="";
         };
      };

Now do I have to do that for the config.cpp or can I just .pbo that with a little extra code and be finished with it?
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:weapons replacement and the config.cpp
« Reply #1 on: 22 Jan 2006, 16:47:54 »
It should work as an addon pbo if you just keep the original BIS classname(s) on the weapon(s)..
Of course you need the whole shabang of CfgPatches etc to get the config of yers to work, but anyway.....

Why don't you just try it? Not even the Lazy(tm) is that lazy.. ::) ;D
« Last Edit: 22 Jan 2006, 16:48:59 by HateR_Kint »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:weapons replacement and the config.cpp
« Reply #2 on: 22 Jan 2006, 23:10:15 »
Yes, I do need the CfgPatches to make it work apparently.

I replaced that section in the CONFIG.cpp, then stuck it in a mod folder and had a go. The game wouldn't start up...

What would the CfgPatches section require? i.e. How would I use the CfgPatches thing? I'll take a stab and see if I get close...

Code: [Select]
class CfgPatches
{
   class M16
   {
      units[] = {};
      weapons[] = {M16};
      requiredVersion = 1.96;
   };
};

Would that be it possibly?
« Last Edit: 22 Jan 2006, 23:15:55 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:weapons replacement and the config.cpp
« Reply #3 on: 23 Jan 2006, 02:47:44 »
Ahhhh.....well,

Code: [Select]
class CfgPatches
{
   class nameofmypbo
   {
      units[] = {};
      weapons[] = {cfgweaponsclassname};
      requiredVersion = 1.96;
   };
};


That should do it



Planck
I know a little about a lot, and a lot about a little.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:weapons replacement and the config.cpp
« Reply #4 on: 23 Jan 2006, 04:28:50 »
So if I'm replacing the M16 in the game, then it would look like this?

config.cpp
Code: [Select]
class CfgPatches
{
   class WpnReplace
   {
      units[] = {};
      weapons[] = {M16};
      requiredVersion = 1.96;
   };
};

or would it be that inside the WpnReplace.pbo? The latter probably, Im guessing.
« Last Edit: 23 Jan 2006, 04:29:06 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:weapons replacement and the config.cpp
« Reply #5 on: 23 Jan 2006, 13:56:11 »
class nameofmypbo is the name of the pbo containing your model file, and presumably its textures and other related gubbins.

cfgweaponsclassname is the classname you have given the weapon in cfgweapons.

So, if my model was in a pbo called fandabadozie.pbo and the classname given in the cfgweapons section of my config was spudgun, it would look thus:

Code: [Select]
class CfgPatches
{
  class fandabadozie
  {
      units[] = {};
      weapons[] = {spudgun};
      requiredVersion = 1.96;
  };
};

 ;D


Planck
I know a little about a lot, and a lot about a little.

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:weapons replacement and the config.cpp
« Reply #6 on: 24 Jan 2006, 22:42:32 »
Okay, thanks  ;)
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08