Jump to content
Sign in to follow this  
Stirls

I'd really love a hand with my config.cpp! (weapon)

Recommended Posts

Hey everyone! I'm new to this scripting/coding gig, so I was following a tutorial that supplied its own template for a weapon import. Unfortunately, upon running binPBO, it won't binarize the file because of a few errors. I'll post both below.

Code: http://pastebin.com/cgqE2Ctg

Log file: http://pastebin.com/4eZxEW30

Now it's funny because I made a slight change to the name and all of these errors appeared, now when I change it back nothing happens!

I'm sure people here get "fix my config" threads every day, so I'm sorry for that!

Share this post


Link to post
Share on other sites

You have spaces in your CfgPatches classname.

class Resistance AK47 AB

should be more like.

class Resistance_AK47_AB

Share this post


Link to post
Share on other sites

Good catch. I'll have to remember not to add spaces. However, the file still won't binarize. Thanks though.

Edited by Stirls
edited for a change of mind

Share this post


Link to post
Share on other sites

Check all your file paths.

model = "\Addons\PCH_ResistanceWeps\PCH_R_AKAB\PCH_R_AKAB";

Whats the name of the folder you are trying to pack? I'm gonna guess its the PCH_ResistanceWeps folder, there for your file path should look more like this.

model = "\PCH_ResistanceWeps\PCH_R_AKAB\PCH_R_AKAB";

Share this post


Link to post
Share on other sites

One of the first things I would suggest is to use the inherentince system Arma has.

For example, all rifles in Arma come from rifle_base_f as rifle_base_f has all of the things rifles needs.

For example if I wanted to make an AK74 I'd do something like

class rifle_base_f;

class ak74 : rifle_base_f {all the config stuff}

This allows you to only post the things in the config that need changing.

Also, when you create things that have inheritance, they inherited item needs to be defined before the item that calls for it. For example, in your script you have cfgammo's "ammo=xyz" being called in cfgmagazine but then cfgammo's class being defined after cfg magazine. Then you also have cfgweapon asking for cfgmagazine's magazine AFTER.

The ideal way to do it is

cfgpatches > cfgammo > cfgmagazine > cfgweapons > cfgvehicles (for ammoboxes and characters)

Secondly, when you do inherit things it goes like this.

class external_reference;

cfgthingyouaremaking {
class new_class_reference_base : external_class_reference { };

class new_class_ref1 : new_class_reference_base { };
};

A better example would be

cfgweapons 
{
class rifle_base_f; //External Class Reference

class HJ_M16_base : rifle_base f {description=...model=...reloadaction=...];
class HJ_M16A1: HJ_M16_base {model=....description=....};
class HJ_M16A4: HJ_M16A1 {model=....description=....};
class HJ_M4: HJ_M16_base {model=....description=....};
class HJ_M4a1: HJ_M4 {model=....description=....};
};

etc

I tried cleaning some things up here and there. Because you aren't inhereting, you have way more variables than need for a rifle.

http://pastebin.com/eJMvss3m

Share this post


Link to post
Share on other sites

surpher, the folder I'm trying to pack is called PCH_R_AKAB. Perhaps that's why? It goes @ProjectChaos\addons\PCH_ResistanceWeps\PCH_R_AKAB\(data/models/etc are here)

HJohnson, I appreciate the file cleanup, man. That actually removed a lot of my errors! I'm still getting some smaller ones. I'm going to restructure the base classes now. There's an error in regards to the base file which I can fix, thanks to you guys!

Latest errors: http://pastebin.com/BQctQh0h

Any tips on what I could do to get rid of the "end of file" error?

Edited by Stirls

Share this post


Link to post
Share on other sites

Your file paths would look something like this then.

model = "\PCH_R_AKAB\(data/models/etc are here)";

Your CfgAmmo classes are inheriting from each other.

class CfgAmmo {
       /*external*/ class B_556x45_Ball;
       class TB_762x39_FMJ : TB_762x39_Explosive {
               airfriction = -0.001425;
               caliber = 1;
               cost = 1;
               deflecting = 20;
               hit = 8;
               indirecthit = 0;
               indirecthitrange = 0;
               model = "\A3\Weapons_f\Data\bullettracer\tracer_red";
               nvgonly = 1;
               tracerendtime = 1;
               tracerscale = 1.5;
               tracerstarttime = 0.05;
       };
       class TB_762x39_Explosive : TB_762x39_FMJ {
               airfriction = -0.001425;
               caliber = 0.5;
               model = "\A3\Weapons_f\Data\bullettracer\tracer_red";
               nvgonly = 0;
               tracerendtime = 1.4;
               tracerscale = 1;
               tracerstarttime = 0.06;
       };
};

Share this post


Link to post
Share on other sites

Ohohohoh wow, this is a good fucking feeling. No binary errors. All done! Thanks guys!

Now the next part is actually getting it to run in the game.

I compared my config with an example config and found a whole section which I didn't need. Considering that I have no idea how to create airburst explosive ammunition, I removed a whole section from the CfgAmmo line. The problem there was I didn't remove it from my CfgMagazines, so the file was trying to look for a non-existent code. I'll update if I have any troubles getting it into ArmA 3.

Edit #1: Getting the no entry bin config.bin/Cfgweapons.pch_r_akab when I try to put my gun onto a rifleman.

The initialization code is: removeallweapons this; this addweapon "pch_r_akab"

Edited by Stirls
Fixed!

Share this post


Link to post
Share on other sites

There's still an error with the config somewhere, so we'd need to look at it to fix it. Your error looks like it's not recognizing pch_r_akab as a valid entry, so something is still messed up somewhere. By forcing it to be included through initialization if it's not a valid weapon you'll see the error that you have. It could be anything from a messed up config down to your addon not being placed in the proper folder.

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  

×