OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: Wildebeest on 06 Dec 2005, 08:45:15

Title: Change of magazine model in game?
Post by: Wildebeest on 06 Dec 2005, 08:45:15
Hi!

Can you have two different magazines for a weapon so that when you reload one magazine type the model of the magazine on the weapon changes? I'm not sure I've seen this on any weapon so far. Is this possible or do I have to make two different versions of the gun? I would like to be able to switch between stick and drum magazines.

Thanks guys :)
Title: Re:Change of magazine model in game?
Post by: Planck on 06 Dec 2005, 14:14:27
Not being an expert on doing weapons, but I believe you would need to code another muzzle.

Much like the Kozlice type of thing.

But, I could be wrong.   ::)


Planck
Title: Re:Change of magazine model in game?
Post by: LoTekK on 06 Dec 2005, 15:37:45
More to the point, like the Mortar. You'll recall that when you "Reload Mortar", the model changes (I can't recall if it's a model change, or an additional proxy). So yeah, magazines sounds like the way to go.

Oh, by the way, the way the weapons are setup, the magazines are typically modelled as part of the weapon (you'll notice that when you reload a weapon, the magazine stays in, while the avatar goes through the motions).
Title: Re:Change of magazine model in game?
Post by: Wildebeest on 08 Dec 2005, 10:49:58
Some weapons have detachable silencers and stuff. I de-pboed one of those weapons and found that it was using scripts to attach and detach it. In the config.cpp I found the following:

      
Code: [Select]
class UserActions
      {
         class Switch_Silencer
         {
            displayName="Silencer On/Off";
            position="driver pos";
            radius=0.05;
            sound={};
            condition="(primaryweapon this) in [""BD_Uzi_S"",""BD_UziStock_S"",""BD_UziSD_S"",""BD_UziSDStock_S""] && (this hasweapon ""BD_UziSilencer"")";
            statement="[this] exec ""\BD_Uzi\Switch_Silencer.sqs""";

Now, this as I understand it, makes an additional action in the players action menu. But could this instead be linked to the players "reload" action? I've never messed around with this before, so I have no idea. If it's possible then I suppose people would have done this already.

Could someone please shed some light on this for me?

Thanks  :)
Title: Re:Change of magazine model in game?
Post by: remcen on 08 Dec 2005, 13:38:15
it's even easier, mate... it has been done for the HK G8 of the HKpack of LoBo, the very first good weapon pack for OFP.

you have to make two different models, one with stick magazine, and one with the drum mag. so you actually need no scripting.

Code: [Select]
class cfgweapons
{
...
class tommygun: rifle  // <- config of the weapon
{
model="gun_with_stickmag";
magazines[]={"tommy_stick", "tommy_drum"};
etc...
};

class tommy_stick: tommygun  // <- config of the magazines
{
magazines[]="tommy_stick";
etc...
};

class tommy_drum: tommygun
{
magazines[]="tommy_drum";
modelspecial="gun_with_drum-mag";
...
};
};

you might wanna look into the config.bin of the HKpack, download CoC's BinViewer for that.
Title: Re:Change of magazine model in game?
Post by: Wildebeest on 12 Dec 2005, 13:29:09
Cool, thanks Remcen. I'm gonna mess around a bit with this, see if I can finally release my tommy :)
Title: Re:Change of magazine model in game?
Post by: remcen on 13 Dec 2005, 01:16:36
ooops, wait a min. i just see that i forgot the curly braces { } before and after the magazine arrays in the magazine classes. sorry.... my bad.