IPB


Welcome Guest ( Log In | Register )

 Forum Rules Forum Rules
 
Reply to this topicStart new topic
> Creating a class
Generation Killer
post Apr 18 2013, 07:58
Post #1


New Member
*

Group: Members
Posts: 9
Joined: 1-February 10
From: CA, TX, SC, depending on the time of year
Member No.: 7,168



Hey everyone,

I just started playing ArmA again. I want to put a my own class together for from existing units and weapons. Anyone still know how to do that? Any advice would be nice, but videos would especially be great.

To precise if you're interested, what I wanted to do is take the Comms Sgt from the ODA 529 unit pack and it with some various guns from the AimPoint Desert Weapons Pack, maybe create a new SF squad based off it. Just wanted to make some a squad for a Black Hawk Down vid or whatever.
 
Quote Post
D@V£
post Apr 18 2013, 12:52
Post #2


Gee, I wish we had one of them doomsday machines.
Group Icon

Group: Moderators
Posts: 2,037
Joined: 13-November 06
From: Wales
Member No.: 155



Personally speaking, it would probably just use the addweapon, addmagazine, etc. commands in the editor, rather than creating a new class. It'll save you a lot of hassle! tongue.gif

That said, making a new infantry class that's just got different weapons is really easy. You'll want a config.cpp file that looks sort of like this: (lines that start with // are comments, and aren't read by the engine)
CODE
//Basic Definitions
#define true 1
#define false 0

#define VSoft 0
#define VArmor 1
#define VAir 2

#define private 0
#define protected 1
#define public 2

#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 ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3

#define DefaultManWeapons Throw,Put

//All that stuff up there just tells the engine what these terms mean, so your config is easier for you to read.

//Your config MUST start with class CfgPatches. It's recommended you keep the classname (currently MyPBOName) the same as your .PBO file
class CfgPatches
{
    class MyPBOName
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"CAweapons"};
    };
};

//You should add the cfgpatches class of the addons your inheiriting from in the requiredaddons fields, it's not too important
//but if you don't it's possible to crash the engine by having it look for stuff that doesn't exist. Of course, if you do fill it in
//and the stuff doesn't exist, the engine will just refuse to start to begin with. So it's kind of a loose-loose situation.

//Adding a new Vehicle Classes definition will let us keep our new stuff separate from existing stuff, so it's easier to find in the editor.
//It's good practice to put a tag in front of your classnames, as all classes ingame have to have an unique name, otherwise they'll conflict.
//For this tutorial, I'll use "My_", but it's best to make up your own. OFPEC has a database of all the ones currently in use, so you can ensure
//you're not using someone else's.

class CfgVehicleClasses
{
    class My_Addon_Class
    {
        displayName = "My Custom Units";
    };
};


class CfgVehicles
{
    //External class references
    class TheClassImInheiritingFrom;
    //Obviously, replace that with the classname of the unit you want to inherit from.

    class My_NewSoldier1: TheClassImInheiritingFrom
    {
        displayName = "My Super-duper new soldier";
        //The name the class appears in the editor.
        vehicleClass = "My_Addon_Class";
        //The vehicleclass we defined earlier.
        weapons[] = {" AKS_74_U","ItemGPS","NVGoggles","Binocular","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
        magazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East","HandGrenade_East","PipeBomb","PipeBomb"};
        respawnWeapons[] = {" AKS_74_U ","ItemGPS","NVGoggles","Binocular","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
        respawnMagazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East","PipeBomb"};
        //Obviously, replace those classes with the weapon and magazine classes you want.
    };
    //And that's it! If you want to do more soldiers, just add more cfgvehicles classes.
};


Once you're happy with your config, just pack it up using your favourite PBO editor, and you're good to go.


--------------------
The Rules - Nothing too complicated, follow these and we'll have no problems.
Moderation Feedback Thread - Tell everyone how much you hate me love me secretly fear that Mark is watching you while you sleep. secretly wish that Mark is watching you while you sleep.
Site Issues Thread - Complain about site issues here. We might even fix them!
Community Chatter Thread - Furthest Mud-sling gets a free subscription to "JdB Monthly".

QUOTE(Major Mike Shearer)
We can categorically state that we have not released man-eating badgers into the area.
QUOTE(Brace Belden)
A machine gun is like a woman, I donít understand it, Iím afraid of it, and one day Iíll accidentally be killed by one.
 
Quote Post
Generation Killer
post Apr 18 2013, 19:55
Post #3


New Member
*

Group: Members
Posts: 9
Joined: 1-February 10
From: CA, TX, SC, depending on the time of year
Member No.: 7,168



QUOTE(D@V£ @ Apr 18 2013, 12:52) *
Personally speaking, it would probably just use the addweapon, addmagazine, etc. commands in the editor, rather than creating a new class. It'll save you a lot of hassle! tongue.gif

That said, making a new infantry class that's just got different weapons is really easy. You'll want a config.cpp file that looks sort of like this: (lines that start with // are comments, and aren't read by the engine)
CODE
//Basic Definitions
#define true 1
#define false 0

#define VSoft 0
#define VArmor 1
#define VAir 2

#define private 0
#define protected 1
#define public 2

#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 ReadAndWrite 0
#define ReadAndCreate 1
#define ReadOnly 2
#define ReadOnlyVerified 3

#define DefaultManWeapons Throw,Put

//All that stuff up there just tells the engine what these terms mean, so your config is easier for you to read.

//Your config MUST start with class CfgPatches. It's recommended you keep the classname (currently MyPBOName) the same as your .PBO file
class CfgPatches
{
    class MyPBOName
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {"CAweapons"};
    };
};

//You should add the cfgpatches class of the addons your inheiriting from in the requiredaddons fields, it's not too important
//but if you don't it's possible to crash the engine by having it look for stuff that doesn't exist. Of course, if you do fill it in
//and the stuff doesn't exist, the engine will just refuse to start to begin with. So it's kind of a loose-loose situation.

//Adding a new Vehicle Classes definition will let us keep our new stuff separate from existing stuff, so it's easier to find in the editor.
//It's good practice to put a tag in front of your classnames, as all classes ingame have to have an unique name, otherwise they'll conflict.
//For this tutorial, I'll use "My_", but it's best to make up your own. OFPEC has a database of all the ones currently in use, so you can ensure
//you're not using someone else's.

class CfgVehicleClasses
{
    class My_Addon_Class
    {
        displayName = "My Custom Units";
    };
};
class CfgVehicles
{
    //External class references
    class TheClassImInheiritingFrom;
    //Obviously, replace that with the classname of the unit you want to inherit from.

    class My_NewSoldier1: TheClassImInheiritingFrom
    {
        displayName = "My Super-duper new soldier";
        //The name the class appears in the editor.
        vehicleClass = "My_Addon_Class";
        //The vehicleclass we defined earlier.
        weapons[] = {" AKS_74_U","ItemGPS","NVGoggles","Binocular","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
        magazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East","HandGrenade_East","PipeBomb","PipeBomb"};
        respawnWeapons[] = {" AKS_74_U ","ItemGPS","NVGoggles","Binocular","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};
        respawnMagazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East","PipeBomb"};
        //Obviously, replace those classes with the weapon and magazine classes you want.
    };
    //And that's it! If you want to do more soldiers, just add more cfgvehicles classes.
};


Once you're happy with your config, just pack it up using your favourite PBO editor, and you're good to go.


Thanks for all the advice. Unfortunately, I'm a bit rusty on computer programing. Could you tell me how to make a config.cpp file and where to get a PBO editor and maybe direct me to tutorial?
 
Quote Post
D@V£
post Apr 18 2013, 21:26
Post #4


Gee, I wish we had one of them doomsday machines.
Group Icon

Group: Moderators
Posts: 2,037
Joined: 13-November 06
From: Wales
Member No.: 155



To the best of my knowledge, there's no real tutorial on this sort of thing.

You can write .cpp files in notepad, just remember to save them as "config.cpp". If you're having problems, make sure windows isn't hiding extensions, which it likes to do. Nothing sucks like finding out after several days of headaches that the real reason nothing works is because your OS isn't telling you the file is actually named "config.cpp.txt" unsure.gif

IMHO, the best PBO tool is BinPBO, included in the BIS tools suite (which you can grab by clicking here). PBOs are kinda like .zip or .rar files, in that they're compressed folders. To use BinPBO, create a working directory for your addon in the virtual P:\ drive, run BinPBO and punch in your folder name, then it'll create a pbo you can stick in your addon folder.


--------------------
The Rules - Nothing too complicated, follow these and we'll have no problems.
Moderation Feedback Thread - Tell everyone how much you hate me love me secretly fear that Mark is watching you while you sleep. secretly wish that Mark is watching you while you sleep.
Site Issues Thread - Complain about site issues here. We might even fix them!
Community Chatter Thread - Furthest Mud-sling gets a free subscription to "JdB Monthly".

QUOTE(Major Mike Shearer)
We can categorically state that we have not released man-eating badgers into the area.
QUOTE(Brace Belden)
A machine gun is like a woman, I donít understand it, Iím afraid of it, and one day Iíll accidentally be killed by one.
 
Quote Post

Fast ReplyReply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 23rd October 2018 - 21:53