Home   Help Search Login Register  

Author Topic: Help in ADDON  (Read 854 times)

0 Members and 1 Guest are viewing this topic.

madwolfnemesis

  • Guest
Help in ADDON
« on: 14 Jul 2003, 05:25:05 »
Hi guys, I need help here in regards to add-on. After reading the tutorial, I got a better understanding but still confused.

My objtecives are as follows:
- Create a new unit, equipping it with the normal 10 magazine slots given.
- Create a new skin for that particular unit, changing the uniform.
- Create a new custom group of 7 men, instead of the default 8 men, consisting of specific soldiers.


For a start, I tried to create a soldier with around 14 magazine slots. I created a file namely, "SAFPC" and I typed the following:

#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
// used for show entry

#define private 0 //! item is never visible
#define protected 1 //! "advanced designer" switch must be activated to use it
#define public 2 //! anyone can see/use it

#define ReadAndWrite 0 //! any modifications enabled
#define ReadAndCreate 0 //! only adding new class members is allowed
#define ReadOnly 0 //! no modifications enabled
#define ReadOnlyVerified 0 //! no modifications enabled, CRC test applied


#define Private      1
#define Corporal   2
#define Sergeant   3
#define Lieutnant   4
#define Captain      5
#define Major      6
#define Colonel      7
#define General      8

#define GTHeal      1
#define GTRepair   2
#define GTRefuel   3
#define GTReammo   4

//Starting line
class CfgPacthes
{
   class SAFPC
   {
      units[] = {SAFPC};
      weapons[] = {};
      requiredVersion = 1.85;
   };

};

class CfgVehicles
{
   class All {};
   class AllVehicles : All {};
   class Land : AllVehicles {};
   Class Man : Land {};
   Class Soldier: Man{};
   Class SoldierWB : Soldier{};

   Class SAFPC : SoldierWB
   {
      WeaponSlots = WeaponSlotPrimary + WeaponSlotSecondary + 2*WeaponSlotBinocular + 14*WeaponSlotItem;
   };

};


I created a PBO file (managed to know how to do it). Inside the folder, there's only this file "config.cpp" and I stuffed it to created a SAFPC.pbo using StuffPBO. When I ran Operation Flashpoint, I encountered this error:

"safpc\config.cpp/CfgVehicles.Class': 'M' encountered instead of '='"

What is this error? Please advise. Thank you.

Anyway, I have experience in Object Oriented programming, so dealing with classes shouldn't be much of a problem for me. Thank you.
« Last Edit: 14 Jul 2003, 06:06:31 by madwolfnemesis »

Offline KTottE

  • Former Staff
  • ****
Re:Help in ADDON
« Reply #1 on: 14 Jul 2003, 09:54:05 »
First of all you need to define some things, namely the following:

Code: [Select]
#define WeaponNoSlot            0// dummy weapons
#define WeaponSlotPrimary      1// primary weapons
#define WeaponSlotSidearm      2
#define WeaponSlotSecondary   16// secondary weapons
#define WeaponSlotSideMags   32
#define WeaponSlotItem         256// items
#define WeaponSlotBinocular   4096// binocular
#define WeaponHardMounted      65536

If you haven't defined them, the config won't know what you're refering to by "WeaponSlotItem".

And also, I hate to inform you but OFP will crap out if you do 14 slots, at least it did for me.
I experimented a little with it, you could get 14 slots stable, 15 randomly crashed the game, 16 was impossible. But, I went to sleep (rebooted PC), came back and the addons were farked. I had done no changes at all, not added anything, not removed anything. It was the same PBO.

What happened was that when you tried placing items in the four extra slots the game froze up, and I mean frooooze up. You couldn't even CTRL+ALT+DELETE your way out of it.

I'm considering testing it again today and see if it lets me have 14 slots, but I'm not counting on it.

And since it seems so random if it works or not, I suggest you don't try it.
But by all means, have a go with it :)
I'll keep my fingers crossed for you.

edit
regarding the error, this line might be the problem:
Code: [Select]
Class Soldier: Man{};

Try putting a space between soldier and :

like so:

Code: [Select]
Class Soldier : Man{};

I don't know how OFP treats whitespaces, but that is seemingly the problem, since it's the only place where a M can be the problem.
« Last Edit: 14 Jul 2003, 09:58:22 by KTottE »
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

madwolfnemesis

  • Guest
Re:Help in ADDON
« Reply #2 on: 14 Jul 2003, 10:41:40 »
Thanks for the advise. The booted to the main screen when I tried putting it at 20, hehe. Anyway, I found my mistake. It is case sensitive. Instead of lower case 'c', I typed upper case 'C'. so it was the problem! Haha, anyway, sometimes, they're pretty concerned abt whitespaces...
now working on my addons and that's why I found out abt all these. Thanks for ya help! Really appreciated it! ADios~