Jump to content
Sign in to follow this  
Ex-RoNiN

Need help with an addon-edit

Recommended Posts

Hey guys, I am currently trying to edit an addon so I can get it to work in my new campaign wink_o.gif

I won't release it until the original author has given me his ok. If he doesn't write back, I will release it (with full credits) when I release my campaign.

So anyway, I have just decrypted the pbo and found two files which I need to mess about with (I think):

- config.cpp

- stringtable.cpp

I assume the Stringtable only contains the editor name and in-game name, is that correct?

As for the config.cpp, I am trying to increase the armour values, and I want to add a gun, but with changed properties.

My first attempt was to simply replace the value of <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">armor=300; with a value of 900, whilst leaving everything else to do with armour alone <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">armorHull=2.0;

armorStructural=4.0;

armorLights=0.4;

armorEngine=0.8;

armorGlass=1.0;

I then went down to weapons, and did the following changes:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

weapons[]={}; //changed to: weapons[]={ZSUcannon};

minFireTime=0; //changed to minFireTime=8;

magazines[]={}; //changed to magazines[]={ZSUcannon};

I also changed maxspeed and accuracy.

I then packed the pbo and I realised that the new PBO was only half the size of the original one crazy_o.gif When I tried it out in the editor, it said that some textures were missing.

Ok, here are my questions:

1) What can I do in the make-PBO process to keep the original file size and textures etc.

2) Am I correct in assuming that I have to create a class cfgweapon if I want to edit the properties of the Weapon? I assume I copy the properties of the Shilka cannon, then edit around?

3) How do I make my addon compatible with the original one?

Any help appreciated lads. Its my first addon too smile_o.gif

Share this post


Link to post
Share on other sites

First of all, what tool are you using to decrypt and re-pack the .pbo file?  I use PBO Decryptor v1.5 to unpack and PBO Tool to re-pack the files.  Make all the changes you want to the config.cpp file, just make sure that you include the sounds, textures, scripts etc.... when you re-pack the .pbo file.

As for the weapon that you are wanting to add, you just make a cfgWeapons section in the config.cpp and insert the data for the ZSU.  This is where the official commented configs come in handy as you can see exactly how weapons, ammo and vehicles are set up.

The stringtable is for when you want people to be able to use your mod in different languages.  I've seen several addons that did not have a stringtable, so I was left wondering what #($&S! was for in the action menu.  biggrin_o.gif

Good luck with your modifications.

Share this post


Link to post
Share on other sites

I am using PBO Decryptor 1.5 and MakePBO.

Just looking through the .cpp, and the pathnames to the picture files are given as

\addonname\texture.pac

Is that correct? Do I have to change anything when PBO'ing it again?

I'll try again, this time step by step.

Share this post


Link to post
Share on other sites

stuff pbo works best for me, also col klinks stellar works very well too

Share this post


Link to post
Share on other sites

If you are only going to be changing some of the weapon and armor values in the config.cpp, do not change the paths to the models and textures. If you do the textures will not show on the model or the model will not even work at all.

Leave the paths to the textures and models from the original .pbo intact. Lets say that you are wanting to change an addon called M1A2.pbo. The path to the textures would be "\M1A2\texture.pac". Now lets say that you want to modify it and make your own addon called M1A2D.pbo. If you change the path to your new .pbo file, the model will still be looking for the textures in the original .pbo file (unless you change the paths using O2, but that's a whole other story).

Share this post


Link to post
Share on other sites

There is an error though with Col. Klink's Stellar Compiler:

If you link on header files (.hpp) in the config.cpp with #include <myhpp.hpp> it won't work (rather the hpps are not included in the PBO or the lines in the config are altered by the compiler, I don't know)

Share this post


Link to post
Share on other sites

So in other words, the paths to the textures is determined by the model name? This seems to be giving me a headache at the moment crazy_o.gif

Share this post


Link to post
Share on other sites

Yes, it can give you a headache real quick. The path to the textures is determined by the model. The only way you can change that is to open up the .p3d model in O2 and change the path to the textures to whatever you are wanting it to be.

Other than that, you will have to include the original .pbo file in addition to your modification if you want to use it.

Share this post


Link to post
Share on other sites

Ok, I leave the pbo name alone, I leave the paths alone, I leave the class name alone, but I can change the Stringtable name.

This seems to work without requiring the original pbo. That is an improvement. crazy_o.gif

Ok, apart from "maxspeed", what else controls speed and acceleration, as it doesn't seem to go much faster.

Share this post


Link to post
Share on other sites
Quote[/b] ]Ok, apart from "maxspeed", what else controls speed and acceleration, as it doesn't seem to go much faster.

It depends on which vehicle class you are trying to modify.  There are limits to each class.  If you have reached the limit on the class you are currently trying to modify, then there is only one other way to do it.  Break out O2 and change the mass of the model.

By the way, "maxspeed" does almost nothing in the config. Change it to "0" and the vehicle will still haul ass. Same goes for fuelCapacity. Change it to "0" and the vehicle should have absolutely no fuel right? Wrong. When you start the game it will have a full tank. There are several variables in the config.cpp that seem to do absolutely nothing.

Share this post


Link to post
Share on other sites
Quote[/b] ]Ok, apart from "maxspeed", what else controls speed and acceleration, as it doesn't seem to go much faster.

It depends on which vehicle class you are trying to modify.  There are limits to each class.  If you have reached the limit on the class you are currently trying to modify, then there is only one other way to do it.  Break out O2 and change the mass of the model.

By the way, "maxspeed" does almost nothing in the config.  Change it to "0" and the vehicle will still haul ass.  Same goes for fuelCapacity.  Change it to "0" and the vehicle should have absolutely no fuel right?  Wrong.  When you start the game it will have a full tank.  There are several variables in the config.cpp that seem to do absolutely nothing.

crazy_o.gif

So I suppose the only thing I can change (without going into the whole O2 mess) is the armour and the weapons and the sounds crazy_o.gif

Ah well sad_o.gif

Share this post


Link to post
Share on other sites

Yep. You can change the armor, weapons and the paths to sounds, scripts and animations. Anything other than that will require editing of the .p3d model itself.

Share this post


Link to post
Share on other sites

maxSpeed does indeed something, as well as fuelCapacity

The lower fuelCapacity, the faster your tank will be empty. And with maxSpeed, mess around with it a bit, as for me it works fine.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">armor=900;

armorHull=1;

armorStructural=4.0;

armorLights=0.4;

armorEngine=0.8;

armorGlass=0.5;

This can not stop a LAW crazy_o.gif WHY crazy_o.gif

This is quickly annoying the heck outta me mad_o.gif And my respect for real addon makers has risen unmeasurably in the past hour wow_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]The lower fuelCapacity, the faster your tank will be empty. And with maxSpeed, mess around with it a bit, as for me it works fine.

That is true about the fuel, but I can put fuelCapacity "0" (which means that it should not have ANY fuel at all) and it will still have fuel.

I was trying to modify a chopper one time so that it would only fly at a maximum of 200mph.  No matter what number I put for maxSpeed, the damn thing still flew at over 350mph!

Quote[/b] ]And my respect for real addon makers has risen unmeasurably in the past hour.

Definitely. I can script, make sounds and animations, but I cannot model to save my life. I am, however, very good at modifying existing addons that would otherwise be crap into something that is enjoyable.

Share this post


Link to post
Share on other sites
Definitely.  I can script, make sounds and animations, but I cannot model to save my life.  I am, however, very good at modifying existing addons that would otherwise be crap into something that is enjoyable.

Can you help me with the armour values then please biggrin_o.gif

Those values are mostly from the Abrams and other tanks, yet it explodes after I hit it with 1 Law crazy_o.gif

Or is the helicopter class limiting me yet again!? crazy_o.gif

Share this post


Link to post
Share on other sites

You are trying to add armor to a helicopter?  I don't care how much armor you put on that thing, a LAW IS going to take down a chopper.  There's no reason why it shouldn't, although a LAW wasn't meant to be an AA weapon. rock.gif

Share this post


Link to post
Share on other sites
You are trying to add armor to a helicopter?  I don't care how much armor you put on that thing, a LAW IS going to take down a chopper.  There's no reason why it shouldn't.

Because its a UFO, not a chopper tounge_o.gif

The orig. author merely used the chopper config as a base.

So I can not change this either?? crazy_o.gif

Share this post


Link to post
Share on other sites

It's probably a limitation of the chopper class. I have an armor value of 900 on one of my tanks that I've modified and it can take several hits from a LAW.

Share this post


Link to post
Share on other sites
It's probably a limitation of the chopper class.  I have an armor value of 900 on one of my tanks that I've modified and it can take several hits from a LAW.

Oh well. sad_o.gif

Share this post


Link to post
Share on other sites

By the way, I've seen that old UFO addon before. What possible use could you have for that thing?

Share this post


Link to post
Share on other sites
There is an error though with Col. Klink's Stellar Compiler:

If you link on header files (.hpp) in the config.cpp with #include <myhpp.hpp> it won't work (rather the hpps are not included in the PBO or the lines in the config are altered by the compiler, I don't know)

Actually if you go to Stellar's setup options I'm sure you can add *.hpp in to the compiler file list.

Share this post


Link to post
Share on other sites

Ok Mr Ronin, listen up, and listen good. Here comes your crash course in config editing wink_o.gif

As you are making a new version of the unit, and want to keep it compatible with the old, you will want to define your own set of class names for it.

First, you start with the config patches.

This will look like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class TAG_Addon

{

units[] = {TAG_Unit};

weapons[] = {};

requiredVersion = 1.85;

requiredAddons[] = {};

};

};

This defines the unit, so that the game engine is aware of its presence, and is able to ensure that no addons exist with the same class names.

You will need to edit this, in your own config, to read

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

{

class ExR_Addon

{

units[] = {ExR_Unit};

weapons[] = {ExR_ZSUCannon};

requiredVersion = 1.85;

requiredAddons[] = {TAG_Addon};

};

};

<span style='font-size:12pt;line-height:100%'><span style='color:red'>CAUTION!!!</span></span>

Ensure that you copy across any entries from the existing unit's required addons array (the bit in {...};) This will ensure that the game engine is aware of any other addons it needs in order to work.

Otherwise you will get the "cannot load mission, missing addons..." error.

Ok. Now your config patches is all cool, we move onto the next step (as long as you dont edit the model, you will not need a class CfgModels, as it is already defined in the original units config)

Next, since you want to add your own cannon, we will define some ammo for it.

Create a standard ammo section to your config by copying this below your "cfgPatches" (leave a space or two)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgAmmo

{

class Default {};

class BulletSingle: Default {};

class ExplosiveBullet: BulletSingle {};

class Bullet4x23: ExplosiveBullet {};

class ExR_Bullet4x23: Bullet4x23 {};

{

hit=40; indirectHit=20; indirectHitRange=2;

minRange=20;minRangeProbab=0.80;

midRange=500;midRangeProbab=0.95;

maxRange=3000;maxRangeProbab=0.05;

cost=30;

};

};

Now you can change the dam(m)age values for the bullets, altering them to your personal "tastes" All the entries are quite self explanatory, the easy way to modify them is to tweak them, then let the AI rip with it and see what effects you get.

NOTE: Any value you do not change, you do not need to define. E.g. If you do not edit the range and range probabilities, you can delete them from the config as they are allready defined in the BIS standard ammo.

Now we've got some ammo for your new cannons, we can define them. Again, create a standard cfg weapons entry, and inherit your new weapon from the ZSU's weapon entry:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgWeapons

{

class Default {};

class MGun: Default {};

class MachineGun7_6: MGun {};

class MachineGun30: MachineGun7_6 {};

class ZsuCannon: MachineGun30 {};

class ExR_ZsuCannon: ZsuCannon

{

ammo = "ExR_Bullet4x23";

count = 2000;

multiplier = 4;

initSpeed = 900;

flashSize = 1.2;

reloadTime = 0.1;

displayName = "ZSU Cannon new name";

displayNameMagazine = "ZSU Cannon new name";

shortNameMagazine = ZSU Cannon new short name;

dispersion = 0.0015;

maxLeadSpeed = 900;

aiRateOfFire = 0.3;

aiRateOfFireDistance = 3000;

};

};

Now you can edit the properties of your new cannon, giving it a faster RoF, more or less dispertion, more ammo, whatever you feel like wink_o.gif

NOTE: Any value you do not change, you do not need to define. E.g. If you do not edit the range and range probabilities, you can delete them from the config as they are allready defined in the BIS standard ammo.

Next, onto your vehicle's config. Again, create the basic entries, then inherit from the original addon:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class LandVehicle: Land {};

class Tank: LandVehicle {};

class ZSU: Tank {};

class TAG_Unit: ZSU {};

class ExR_Unit: TAG_Unit

{

<span style='font-size:12pt;line-height:100%'><span style='color:red'>CAUTION!!!</span></span>

I don't know what the original unit is, so I have guessed as to what it inherits from. You need to ensure that you copy the correct class names for the inherit list, else you're addon will be all fubar.

Now, the cfgVehicles entry will continue on to define all the details of the unit. Again, the names and things can be left, or changed, its up to you, and this part of the config will not cause any ingame errors (tho having 2 units with the same name gets confusing...)

Here is where you encorporate your armor changes, along with any other changes you wish to make to the unit.

Quote[/b] ]Just looking through the .cpp, and the pathnames to the picture files are given as

\addonname\texture.pac

That is the little picture that appears in the command bar, when you are in control of the unit. If you do not want to change the picture (colour, overall looks or whatever) just leave that alone. (if you dont change it, you can delete it all together.)

Now, the config SHOULD have an entry for weapons and magazines, and it should look like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> weapons[]={ZsuCannon};

magazines[]={ZsuCannon};

OR

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> weapons[]={};

magazines[]={};

OR

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> weapons[]={TAG_Weapon};

magazines[]={TAG_Weapon};

Change this to read

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> weapons[]={ExR_ZsuCannon};

magazines[]={ExR_ZsuCannon};

Quote[/b] ]Ok, apart from "maxspeed", what else controls speed and acceleration, as it doesn't seem to go much faster.

The only thing that controls this is the model's mass. The lighter the model, the faster it accelerates. Otherwise, its all hard coded into the physics engine.

Your config is complete, go and have fun wink_o.gif

Some other stuff:

Where dharbert was confusing you, is that the textures which appear ON the model, are controled by the model.

The textures that you want(?) to change are the ones displayed in the editor and the command bar. These are NOT controled by the model, but by the config - see explanation above.

If all you want to do to the addon is change the config attributes, then you do NOT need to have a copy of the original model and textures in your pbo. You can simply reference them from the old one (this is the easiest way of doing it without causing the headache of having to re-path the textures on the model.

Anything else, just ask, and I will do my best to explain it for you smile_o.gif

Share this post


Link to post
Share on other sites

I bet he's gone through a whole bottle of Aspirin by now.  biggrin_o.gif

DeadMeat is right about the textures.  Sorry for the confusion, I thought you were talking about the textures that were physically on the model.  The paths to the picture and icon can be changed without having to alter the model.

And as I said before, to increase the speed you will have to change the mass of the model in O2, which will require yet another bottle of Aspirin and a strong drink to go with it.  biggrin_o.gif

Share this post


Link to post
Share on other sites

There's smoke coming out of my ears and eyes crazy_o.gifbiggrin_o.gif

Ok, apparently there's a mistake here:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgAmmo

{

class Default {};

class BulletSingle: Default {};

class ExplosiveBullet: BulletSingle {};

class Bullet4x23: ExplosiveBullet {};

class ExR_Bullet4x23: Bullet4x23 {};

{

hit=40; indirectHit=20; indirectHitRange=2;

minRange=20;minRangeProbab=0.80;

midRange=500;midRangeProbab=0.95;

maxRange=3000;maxRangeProbab=0.05;

cost=30;

};

};

"Encountered '{' instead of '=' crazy_o.gif

Is there a proper compiler that tells me WHERE this was encountered?

By the way deadmeat, I copied your pieces of code 1:1, I assume they should work that way?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×