Jump to content
Sign in to follow this  
ArmaGuy

Need help writing a Config for an unit

Recommended Posts

Hi,

I just started editing earlier this week and I have run into a problem. I made a simple retexture of the BIS Russian soldier to make a Belarus soldier, but I have no idea how to write a config so I can get it into the game. I searched the forum and looked at examples, but I can’t understand any of them because I have never done anything like this before. Can someone please help me write a config?

I am trying to put the soldier in Side:Opfor, Faction:Belarus, Class:Men and arm him with an AK-74.

Right now I have the following files (not sure if I have all the correct ones) in a folder named “ptr_belarusâ€:

Soldier.p3d

flora_vsr_vest_co.paa (this is the texture I changed)

flora_vsr_vest_nohq.paa

flora_vsr_vest_smdi.paa

equip_pioneer_co.paa

equip_pioneer_nohq.paa

equip_pioneer_smdi.paa

pioneervest_as.paa

pioneervest_co.paa

pioneervest_nohq.paa

pioneervest_smdi.paa

Thank you, any help would be appreciated.

Share this post


Link to post
Share on other sites

I'm also a newbie at addon editing (though not at mission editing), but I have succeeded in making configs now. Unfortunately it looks as though there are no really in-depth tutorials for addon editing. There's this and this if you haven't found them already.

My suggestion: start with configging really simple stuff, like adding a unit with a new weapons loadout or extra hit points, and work your way up one step at a time.

Here's an example of a really simple addon that I made that creates a Chedaki insurgent with an M16A2. The stuff after // is comments and are not (supposed to be) read by the engine.

class cfgPatches // data to help other addons identify this addon
{
class InsurgentM16 // name of addon
{
	units[] = {"Ins_Soldier_M16"}; // classnames of units added, multiple entries would be separated by a comma like {"Ins_Soldier_M16","Ins_Obnoxious_Telemarketer"}
	weapons[] = {};
	requiredVersion = 0.1;
	requiredAddons[] = {};
};
}; // these semi-colons are really important if you hadn't guessed

class cfgVehicleClasses // sets how to find this unit in the editor
{
class Modified_Insurgents // making a brand new editor class, on the same level as cars or trucks, for my "modified insurgents"
{
	displayName = "Modified Insurgents"; // the name text that actually appears in the editor
};
};

class cfgVehicles // defines the characteristics of your unit, even if it's not actually a "vehicle"

{
class Ins_Soldier_1; // this is a "base" class that already exists which we will use as a sort of template for our new unit

// the next part creates a new unit class, Ins_Soldier_M16, and the colon tells the engine that it's exactly like Ins_Soldier_1 except for the differences that we are about to specify after the braces
class Ins_Soldier_M16 : Ins_Soldier_1 
{
	displayName = "Rifleman (M16)"; // name of the unit that shows up in the editor
	vehicleClass = "Modified_Insurgents"; // vehicle class that was defined after the word "class" under cfgVehicleClasses above
	weapons[] =
	{
		"M16A2", 
		"Throw", 
		"Put", 
		"ItemMap", 
		"ItemCompass", 
		"ItemWatch", 
		"ItemRadio"
	}; // define unit weapons
	magazines[] =
	{
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"HandGrenade_East",
		"HandGrenade_East",
		"HandGrenade_East",
		"HandGrenade_East"
	}; // define magazines
	respawnWeapons[] = 
	{
		"M16A2", 
		"Throw", 
		"Put", 
		"ItemMap", 
		"ItemCompass", 
		"ItemWatch", 
		"ItemRadio"
	};
	respawnMagazines[] =
	{
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"30Rnd_556x45_Stanag",
		"HandGrenade_East",
		"HandGrenade_East",
		"HandGrenade_East",
		"HandGrenade_East"
	}; // respawn weapons and magazines
};
}; // hooray we're done

A list of all (or at least most) possible cfgVehicles characteristics, such as weapons[] or displayname, is available here. Note that it is only necessary to specify the characteristics unique to the new unit class. That's the beauty of the "class Ins_Soldier_M16 : Ins_Soldier_1" part.

When you've written your config code, stick it in a standard text file, rename it config.cpp, put it in a folder, and use binPBO to binarize the folder. Add the new PBO to a modfolder like any other addon and there you go. :yay:

Share this post


Link to post
Share on other sites

Thank you, that information was helpful, but for some reason I can not get the unit into editor. So I decided to experiment with your example.

When I typed the following into a config.cpp file and made it a pbo it worked correctly, and an insurgent with an M16 showed up in the editor.

class cfgPatches

{

class BelarusM16

{

units[] = {"Bel_Soldier_M16"};

weapons[] = {};

requiredVersion = 0.1;

requiredAddons[] = {};

};

};

class cfgVehicleClasses

{

class Belarus_Men

{

displayName = "Belarus Rifleman";

};

};

class cfgVehicles

{

class Ins_Soldier_1;

class Bel_Soldier_M16 : Ins_Soldier_1

{

displayName = "Belarus Rifleman";

vehicleClass = "Belarus_Men";

weapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

magazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

respawnWeapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

respawnMagazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

};

};

When I typed the exact same thing except with Soldier(the p3d file for the Russian Soldier) instead of Ins_Soldier_1 it came up with the error "No entry 'bin\config.bin/Cfgvehicles/Soldier.scope'."

class cfgPatches

{

class BelarusM16

{

units[] = {"Bel_Soldier_M16"};

weapons[] = {};

requiredVersion = 0.1;

requiredAddons[] = {};

};

};

class cfgVehicleClasses

{

class Belarus_Men

{

displayName = "Belarus Rifleman";

};

};

class cfgVehicles

{

class Soldier;

class Bel_Soldier_M16 : Soldier

{

displayName = "Belarus Rifleman";

vehicleClass = "Belarus_Men";

weapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

magazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

respawnWeapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

respawnMagazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

};

};

I am not sure what I am doing wrong. Can you help?

Share this post


Link to post
Share on other sites

Make sure the unit you base your new unit on has all config parameters defined. So the error does exactly mean what it says: class soldier has no "scope" defined nor does your new unit have said config entry.

Especially when inheriting from a pretty low base class (like you do with "soldier" class), you have to take care that all config entry are defined in the end. Best way to achieve this is to take a existing class inherited from "Soldier" as template and change the config entries to your needs.

Share this post


Link to post
Share on other sites

Thank you Myke, that did work. I switched out "Soldier" for "RU_Soldier", and I did not recieve any errors.

I am sorry for bothering everyone, but I do have one more question. I did some texture modifications to the "flora_vsr_vest_co.paa" (one of the textures for the Russian soldier)and I want the modified texture to show up on my unit in the game. How and where in the config do a do this?

Share this post


Link to post
Share on other sites

Texture paths are stored in the model file (.p3d), can be switched via Oxygen² (unbinarized models) or hexeditor (binarized models, plus some strings attached..not going into detail).

It´s not going to work through config.

Share this post


Link to post
Share on other sites

I downloaded Hex Editor and successfully changed the texture for soldier.p3d and renamed it Belsoldier.p3d to avoid any conflicts with the original. To make sure I had all the config parameters, I based my new config off the BIS config in the characters2 pbo.

Here it is:

class cfgPatches

{

class BelarusRifleman

{

units[] = {"Bel_Rifleman"};

weapons[] = {};

requiredVersion = 0.1;

requiredAddons[] = {};

};

};

class cfgVehicleClasses

{

class Belarus_Men

{

displayName = "Belarus Rifleman";

};

};

class cfgVehicles

{

class Belsoldier;

class Bel_Soldier_Base : Belsoldier {

scope = 1;

side = 0;

vehicleClass = "Men";

faction = "Belarus";

genericNames = "RussianMen";

cost = 80000;

accuracy = 1.5;

camouflage = 1.8;

identityTypes[] = {"Head_RU", "RU_Glasses"};

faceType = "Man";

portrait = "\Ca\characters\data\portraits\comBarHead_ru_soldier_ca";

model = "\ca\characters2\Rus\Soldier";

picture = "\Ca\characters\data\Ico\i_null_CA.paa";

icon = "\Ca\characters2\data\icon\i_soldier_CA.paa";

weapons[] = {"AK_107_kobra", "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"};

respawnWeapons[] = {"AK_107_kobra", "Throw", "Put", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio"};

respawnMagazines[] = {"30Rnd_545x39_AK", "30Rnd_545x39_AK", "30Rnd_545x39_AK", "30Rnd_545x39_AK", "HandGrenade_East"};

class HitPoints : HitPoints {

class HitHead : HitHead {

armor = 0.85;

};

class HitBody : HitBody {

armor = 1;

passThrough = 0.8;

};

};

class Wounds {

tex[] = {};

mat[] = {"ca\characters2\Rus\DATA\soldier_flora_vsr_vest.RVmat", "ca\characters2\Rus\DATA\soldier_flora_vsr_vest_w1.RVmat", "ca\characters2\Rus\DATA\soldier_flora_vsr_vest_w2.RVmat", "ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest.RVmat", "ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest_w1.RVmat", "ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest_w2.RVmat", "ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest.RVmat", "ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest_w1.RVmat", "ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest_w2.RVmat", "ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest.RVmat", "ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest_w1.RVmat", "ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest_w2.RVmat", "ca\characters2\Rus\DATA\soldier_pilot_flora_vsr.RVmat", "ca\characters2\Rus\DATA\soldier_pilot_flora_vsr_w1.RVmat", "ca\characters2\Rus\DATA\soldier_pilot_flora_vsr_w2.RVmat", "ca\characters2\Rus\DATA\soldier_crew_flora_vsr.RVmat", "ca\characters2\Rus\DATA\soldier_crew_flora_vsr_w1.RVmat", "ca\characters2\Rus\DATA\soldier_crew_flora_vsr_w2.RVmat", "ca\characters2\Rus\DATA\Commander.rvmat", "ca\characters2\Rus\DATA\W1_Commander.rvmat", "ca\characters2\Rus\DATA\W2_Commander.rvmat"};

};

class TalkTopics : TalkTopics {

core_ru = "Core_Full";

};

languages[] = {"RU"};

};

class Bel_Rifleman : Bel_Soldier_Base

{

displayName = "Belarus Rifleman";

vehicleClass = "Belarus_Men";

weapons[] = {"AK_107_kobra", "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"};

respawnWeapons[] = {"AK_107_kobra", "Throw", "Put", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio"};

respawnMagazines[] = {"30Rnd_545x39_AK", "30Rnd_545x39_AK", "30Rnd_545x39_AK", "30Rnd_545x39_AK", "HandGrenade_East"};

};

};

When I use Binpbo to pack it, an config error pops up, and the log shows the following:

Error reading binary file 'm:\arma addons\world armies mod\belarus\ptr_belarus4\config.cpp'

File m:\arma addons\world armies mod\belarus\ptr_belarus4\config.cpp, line 46: /cfgVehicles/Bel_Soldier_Base.HitPoints: Undefined base class 'HitPoints'

Config : some input after EndOfFile.

Error 3 while parsing

Error in config m:\arma addons\world armies mod\belarus\ptr_belarus4\config.cpp

W:\c\Poseidon\El\ParamFile\paramFile.cpp(753) : Class destroyed, but still locked

File m:\arma addons\world armies mod\belarus\ptr_belarus4\config.cpp, line 46: /cfgVehicles/Bel_Soldier_Base.HitPoints: Undefined base class 'HitPoints'

Config : some input after EndOfFile.

Error 3 while parsing

Error in config m:\arma addons\world armies mod\belarus\ptr_belarus4\config.cpp

W:\c\Poseidon\El\ParamFile\paramFile.cpp(753) : Class destroyed, but still locked

Cannot load font core\data\fonts\lucidaconsoleb8

Fonts file \core\data\fonts\lucidaConsoleB8 not found

Cannot load font core\data\fonts\lucidaconsoleb11

Fonts file \core\data\fonts\lucidaConsoleB11 not found

<model = "m:\arma addons\world armies mod\belarus\ptr_belarus4\Belsoldier.p3d">

I am not sure what I am missing in the config.

Share this post


Link to post
Share on other sites

It is not allowed to hex-editing BIS p3d files.

Only chance to use different textures is if the model is prepared for hiddenSelectionsTextures:

hiddenSelections[] = {};
hiddenSelectionsTextures[] = {};

Unfortunately not all models are prepred for such a retexture, you have to try it out if it works for your selected model.

Share this post


Link to post
Share on other sites

Change

class cfgVehicles {
class Belsoldier;

class Bel_Soldier_Base : Belsoldier {

to

class cfgVehicles {
class RU_Soldier;

class Bel_Soldier_Base : RU_Soldier {

Haven´t looked further into the config, but that at least fixes the bogus inheritance you tried to pull off.

Inheriting like this you then can also remove most of the entries under class Bel_Soldier_Base, because you already fetched them from Ru_Soldier.

*SNIP*

Edited by Max Power
no howtos about hex editing, please.

Share this post


Link to post
Share on other sites

why would you need to HEX edit the sample model in the first place?

Share this post


Link to post
Share on other sites

You know ArmAGuy, there's also a modelling forum for questions more strictly related to modelling.

But if you need help with writing the config to put a new model on a unit, you can also try dePBOing and reverse-engineering a well-working model replacement pack like this one (note that the actual model is contained in this addon).

Again, since documentation is kinda thin, reverse-engineering stuff seems to be the main way that ppl lrn 2 addons.

Share this post


Link to post
Share on other sites

I finally was able to get the model ingame, but experienced a problem.

Here is the config:

class cfgPatches

{

class BelarusRifleman

{

units[] = {"Bel_Rifleman"};

weapons[] = {};

requiredVersion = 0.1;

requiredAddons[] = {};

};

};

class cfgVehicleClasses

{

class Belarus_Men

{

displayName = "Belarus Rifleman";

};

};

class cfgVehicles

{

class RU_Soldier;

class Bel_Rifleman : RU_Soldier

{

model = "ptr_belarus\BelSoldier.p3d";

displayName = "Belarus Rifleman";

vehicleClass = "Belarus_Men";

weapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

magazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

respawnWeapons[] =

{

"M16A2",

"Throw",

"Put",

"ItemMap",

"ItemCompass",

"ItemWatch",

"ItemRadio"

};

respawnMagazines[] =

{

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"30Rnd_556x45_Stanag",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East",

"HandGrenade_East"

};

};

};

(The BelSoldier.p3d is what I named the p3d I changed in hexeditor.)

I believe I have run into one last problem. A get the following error when trying to use the unit in the editor:

Cannot load texture

be\belarussian\rus\data\flora_vsr_vest_co.paa

In the first person view the unit appears to have a plain white texture, while in over the shoulder view it has its orginal texture. The be\bela...paa is the file setup I used to keep it the same length as Mr. Burns said.

Any ideas to what is causing this?

Share this post


Link to post
Share on other sites

I fixed what I did wrong:

1. I was not using the p drive, so I reinstalled all of the bis tools there and tried again.

2. I had the wrong file path for the texture.

Thank you, RKDmitriyev. I took your advice and looked through many other peoples' work and saw what I was doing wrong. It seems like that is the only way to do it, as there aren't many good, basic tutorials.

*SNIP*

Edited by Max Power
No discussions relating to the problems of and solutions to hex editing, please.

Share this post


Link to post
Share on other sites

Hex editing binarized models is not allowed. There is no reason for you to hex edit a non-binarized model. Thread closed until this IP issue is resolved.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×