OFPEC Forum
Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: eagle-eye on 12 Nov 2003, 13:30:13
-
Is there an example of a very simple config.cpp for iron-sight, no scope, no auto-fire bolt-action rifle somewhere?
Model and textures are ready and I couldn't find simple enough config.cpp by extracting addons already done
My first add-on ever that's why all the questions
-
There you go.
It's from BRSSEB Weapon tut, && as your first addon I recommand you go trough it first. If you end-up using it, ask Brsseb first or at least give credit to it upon ditribution of the addon.
Copy && paste to TXT editor && save as "YourAddonName.cpp"
Note that I haven't asked him authorization to publish his work here, but as it's part of a tute I assume it's free to use.
And BRSSEB tutes are the best. They learn me all.
http://ofp.gamezone.cz/_hosted/brsseb/tutorials.htm
Start Of Example:
// Stalker by BCS (original name, put your own & GIVE CREDIT)
// Basic def.
#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 YourAddonName
   {
      units[]={YourAddonEquippedUnit};
      weapons[]={Your AddonName};
      requiredVersion=1.00000;
   };
};
class CfgModels
{
   class Default{};
   class Weapon: Default{};
   class YourAddonName : Weapon{};
};
class CfgAmmo
{
   class default {};
   class BulletSingle: default {};
   class YourAddonNameAmmor: BulletSingle {};
 };
class CfgWeapons
{
   class Default {};
   class MGun: Default {};
   class Riffle: MGun {};  ÂÂ
   class SniperRiffle: Riffle{};
   class M21 : SniperRiffle{};
  ÂÂ
   class YourAddonName: M21
   {
      model="\YourAddonFolder\YourAddonName.p3d";
      displayName="The Name Displayed";
      displayNameMagazine="Ammo Name to be Displayed";
      magazines[]={"YourAddonName"};
      ammo=BulletSniper;
      picture="\YourAddonFolder\APictureOfIt.pac";  ÂÂ
     ÂÂ
   };
};
// You may forget this, but so easy when the unit is displayed in the editor...
class CfgVehicles
{
   class All{};
   class AllVehicles:All{};
   class Land:AllVehicles{};
   class Man:Land{};
   class Soldier:Man{}
   class Civilian:Soldier{};
   class YourUnitName: Civilian
   {
      access=2
      displayName="Your Unit Name";
      weapons[]={"Throw","Put","YourAddonName"};
      magazines[]={"YourAddonName","YourAddonName","YourAddonName","YourAddonName"};
   };  ÂÂ
};
class CfgNonAIVehicles
{
   class ProxyWeapon {};
   class ProxyYourUnitName : ProxyWeapon {};
};
End of example. && ByeBye
Peacepunk.
-
in actuallity, you do NOT name a .cpp file:
quote:
'youraddonname.cpp'
it is always named 'config.cpp' this is the recognised name of the configuration file, correct me if i'm wrong, but i have never seen an addon with a config named '*.cpp' etc, so i assume it can only be 'config.cpp'
(not meant to be a personal attack in any way)
Lt. Shitkilla