Home   Help Search Login Register  

Author Topic: Maximum Magazine Compatibility  (Read 765 times)

0 Members and 1 Guest are viewing this topic.

Hrvoje

  • Guest
Maximum Magazine Compatibility
« on: 05 Oct 2003, 02:43:35 »
Maximum Magazine Compatibility

I have noticed one problem before and was hoping JAM will finally solve it - the fact that magazine class have a lot of weapons characteristics stored in itself.
Now, although JAM idea is great, I decided to make a proposal for a new system with which magazines (of similar weapons) would be more realistically compatible. I called it Maximum Magazine Compatibility (tag - MMC). This system is far from perfect, but I hope it could improve gameplay even more.

Basically it works like this - you pick up magazine from a similar weapon to yours, and script changes that magazine into your weapon magazine.
Simple!
But, the biggest problem was the fact that AI and player don't want to pick up other weapons magazines. So in order for this system to work I needed to change cpp file of a weapon. That's the reason why I decided to give a tag for this system - MMC.
Example for this is original weapons from the game - Glock and GlockS (silenced Glock). In my cpp file I added two more classes - MMCGlock and MMCGlockS. They all use two magazines - Glockmag and GlockSmag. Now units can pick both types of magazines.
That obviously isn't enough. You also need scripts to make things work. It is also needed to make a trigger which will select all units in the mission.
I made a trigger which can cover mission area and put this in the "On Activation" field - allunits=thislist. Allunits is the only global variable needed.
I added two more triggers with which two scripts are activated (or you can activate them in an init field of some unit). Each script works for one weapon, but you can also make just one script with a lot of loops.
This script checks all units for a certain weapon (in mag_GlockS.sqs it checks for MMCGlockS). When it encounters the weapon it will check units magazine array for Glockmag. If unit have this magazine script will change it with GlockSmag. After one-second delay script checks all units again.
You can easily make a script that will check for more different magazines and change them with desired one.

Problems with this system:
1.   You need to make different cpp file, which means you need to alter the addon! - This I don't like. I hoped I would find another way for this to work, but...
2.   Scripts will delay the game (if you have to many of them)
3.   Sometimes you may encounter an error. This only happens when number of units in allunits variable changes between this two lines:
_allUNum= count allunits
_soldier=(allunits select _Ustart)
and if _Ustart variable is too big.
It happened to me when I placed in the editor more then 150 units (east and west) close to each other and activated seven different scripts. In a moment more then 10 units died (because of that they ware removed from allunits array) and error with zero has been reported. This doesn't cause big problem because script works in a loop, and it is not likely that you will encounter similar problem in a realistic mission.
4.  If your squad member takes a magazine while you are looking at his gear list (in map-view), magazine picture and name will be updated, but when script changes the magazine, it won't be updated! Good thing is that the unit will actually have that magazine.


If this system will be adopted I suggest for MMC tag to be free of use for all addonmakers, and to be put in front of your weapon class - like this:
   
   class Glockbase: HandGunBase {};
   class Glock: Glockbase {};
   class GlockSbase: Glockbase {};
   class GlockS: GlockSbase {};
   class MMCGlock: Glock
        {

      magazines[]={"Glockmag","GlockSmag"};
   };

(MMCyour-tagGlock, BIS doesn't have a tag  ;) )
and in the displayName of the unit:

    class SoldierWB:Soldier{};
    class SoldierWSaboteur: SoldierWB{};
    class MMCSoldierWSaboteur: SoldierWSaboteur
   {
      scope = public;
      displayName="Black Op (Hand Gun) /MMC";
      weapons[]={UZI, MMCGlock, NVGoggles, DefaultManWeapons};
      magazines[]=
      {
         UZIMag, UZIMag, UZIMag, UZIMag,
         PipeBomb, PipeBomb, PipeBomb,
         Glockmag, Glockmag, Glockmag, Glockmag
      };
   };

In that way missionmaker would know what weapon and unit should be used for the mission.

I didn't do that here (because I changed only original classes - not custom addons), but I believe it would be good to add vehicleclass for the units:
      vehicleclass="your-tag /MMC";

I also suggest addonmakers create additional pbo with MMC classes (like my MMCGlock.pbo) in which there will be only cpp file and to put scripts inside the zip file. I think that would be a good idea because there are a lot of addons people have downloaded and would be stupid to download them again just for this little change.
So MMC zip would be small addition to the addon and not necessarily needed.

Main reason why I am suggesting this is that there are a lot of MODs and weapon-packs out there, and their magazines are not compatible to its own weapons and to weapons in original OFP. Also, if you use the same magazine for different weapons it will change weapon characteristics.
I now that implementing this system for all addons of similar weapons to be compatible to each other would be crazy and impassible to achieve, but I hope with this we could make magazines from the same weapon-pack and original game to be compatible.

I've tested it with Glocks and it seems to work fine. I have also made MMC cpp file for FlipeRs M4A1 pack (version 2.1) so I could test this system with more weapons and magazines. For this I made five scripts, and it also worked ok. If MMC will be accepted I'll ask for permition to release that file too.

After this maybe someone will have idea to improve this system even more.

You can see example for this system in the zip file.