Jump to content
Sign in to follow this  
gonk

Pistols and ammo

Recommended Posts

Can a pistol have two types of ammo ? I am currently modelling a flare gun and I can make it shoot Smoke grenades or flares (after I recompile it for either ammo type). Is there a way to make magazines that hold different types of ammo for a pistol to shoot... thanks for your time.

Share this post


Link to post
Share on other sites

I don't know much about modmaking, but I would say yes, there must be a way to do this. I think you would just have to define two types of mag for the weapon:

magazines[]={"FlareMag","SmokeMag"};

Something like that I would guess.

Share this post


Link to post
Share on other sites

Thanks for the response Major but I have tried that... the problem is there is only one class setting for ammo.. So I can tell it to fire Flares if Flare mag fitted and Smoke if Smoke mag fitted.

eg

ammo="Flare_Shell";

I tried to add two types of ammo but it justs crashed.. is this a limitation of the Graphic engine... or what is the correct syntax for add two types of ammo.

Share this post


Link to post
Share on other sites

In CfgWeapons you need to define

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

{

modelOptics = "";

optics = 0;

magazines[] = {"magnames"};

model = "path to model";

displayName = "model display name";

displayNameMagazine = "mag display name";

shortNameMagazine = "shortnamemag";

modes[] = {"Flare","Smoke"};

class Flare

{

ammo = "Flare ammo";

multiplier = 1;

burst = 1;

displayName = "Flare";

dispersion = 0.000200;

sound[]={"Weapons\M16Single",1.000000,1};

soundContinuous = 0;

reloadTime = 0.150000;

ffCount = 1;

recoil = "riffleSingle";

autoFire = 0;

aiRateOfFire = 5.000000;

aiRateOfFireDistance = 500;

useAction = 0;

useActionTitle = "";

};

class Smoke

{

ammo = "Smoke ammo";

multiplier = 1;

burst = 1;

displayName = "Smoke";

dispersion = 0.000200;

sound[]={"Weapons\M16Single",1.000000,1};

soundContinuous = 0;

reloadTime = 0.150000;

ffCount = 1;

recoil = "riffleSingle";

autoFire = 0;

aiRateOfFire = 5.000000;

aiRateOfFireDistance = 500;

useAction = 0;

useActionTitle = "";

};

};

<span id='postcolor'>

The part:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">modes[] = {"Flare","Smoke"};

class Flare

{

ammo = "Flare ammo";

multiplier = 1;

burst = 1;

displayName = "Flare";

dispersion = 0.000200;

sound[]={"Weapons\M16Single",1.000000,1};

soundContinuous = 0;

reloadTime = 0.150000;

ffCount = 1;

recoil = "riffleSingle";

autoFire = 0;

aiRateOfFire = 5.000000;

aiRateOfFireDistance = 500;

useAction = 0;

useActionTitle = "";

};

class Smoke

{

ammo = "Smoke ammo";

multiplier = 1;

burst = 1;

displayName = "Smoke";

dispersion = 0.000200;

sound[]={"Weapons\M16Single",1.000000,1};

soundContinuous = 0;

reloadTime = 0.150000;

ffCount = 1;

recoil = "riffleSingle";

autoFire = 0;

aiRateOfFire = 5.000000;

aiRateOfFireDistance = 500;

useAction = 0;

useActionTitle = "";

};

<span id='postcolor'>

is the important one try it out and tell me if it works, in CfgAmmo ofcource you will need to define two types of ammo.

Share this post


Link to post
Share on other sites

thx Soul_Assassin

I been working on this problem all weekend (only new to modelling) and I hacked someone elses code from a pistol that had automatic/single fire and made some rough code very similar to yours... and it works.. So now I can fire the flare pistol in smoke/flare mode. You got a web page with hints.. could of saved my weekend. biggrin.gif Next problem is how to code it so Flares are in Flare Mags and Smoke is in Smoke Mags. At the moment I can shoot flares / smoke from either mag.

Share this post


Link to post
Share on other sites

Take a look at the config.cpp of my M41aPR (www.ofp-zone.de, search for M41) -it uses ammunition with and without tracer. If you want to change the ammo type you have to load an appropriate mag.

todo:

You have to define two seperate weapon classes with the properties you want (M41aPR, M41aPR_tracer). These classes are combined into the final weapon class (M41aPulse) using:

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

magazines[] = {"M41aPR","M41aPR_tracer"};

<span id='postcolor'>

Share this post


Link to post
Share on other sites

Der Blaster.... Thx.. That worked a treat!! biggrin.gif I do not understand all your code ..yet. biggrin.gif But I got the general idea what was happening. I made only two items and gave the second item all the characterics of the first plus the new ammo. This second item can now shoot either smoke cannisters or flares... I even get two new actions listed when the flare pistol is selected (depending on carried ammo) "Reload Flare" or "Reload Smoke". It is pretty rough code but it works.

Just one quick question... What is does this code do in your CPP file "displayName = "$STR_DN_BASTLER_M309_S"; " I Just put in plain text ... Does this allow the item to change names depending on the langauge setting of Operation Flashpoint ? eg.. your CSV table.

Share this post


Link to post
Share on other sites

Right, displayName="$STR_DN_BASTLER_M309_S" means: display string constant STR_DN_BASTLER_M309_S listed in STRINGTABLE.CSV depending on selected language

Inside STRINGTABLE.CSV, you have several lines like

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

STR_DN_BASTLER_M309_S,M309,M309,M309,M309,M309,M309

<span id='postcolor'>

or

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

STRING_CONSTANT_NAME,english,french,italian,spanish,german,czech

<span id='postcolor'>

There's also a code for the constants (kind of hungarian notation, not mandatory but recommended), e.g.:

- STR_DN means string for displayname

- STR_MN means string for displaynamemagazine

- STR_SN means string for shortnamemagazine

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (gonk @ Nov. 04 2002,01:26)</td></tr><tr><td id="QUOTE">< Der Blaster.... Thx.. That worked a treat!! biggrin.gif ><span id='postcolor'>

Errr...didn't he post basically the same as what I did? confused.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines[] = {"M41aPR","M41aPR_tracer"};

<span id='postcolor'>

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines[]={"FlareMag","SmokeMag"};

<span id='postcolor'>

Oh well, whatever, as long as it works! tounge.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Major Fubar @ Nov. 05 2002,11:13)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (gonk @ Nov. 04 2002,01:26)</td></tr><tr><td id="QUOTE">< Der Blaster.... Thx.. That worked a treat!! biggrin.gif  ><span id='postcolor'>

Errr...didn't he post basically the same as what I did?  confused.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines[] = {"M41aPR","M41aPR_tracer"};

<span id='postcolor'>

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines[]={"FlareMag","SmokeMag"};

<span id='postcolor'>

Oh well, whatever, as long as it works!  tounge.gif<span id='postcolor'>

Your right Major but that alone did not work for me. sad.gif The line of code for ammo would only take one type at a time and therefore I could only make the pistol shoot one type of ammo but take two types of mags. So when I changed to smoke mag and shoot, it would just crash since it could not use that type of ammo. The part that worked was making two weapons and making the second weapon inherited the model of the first plus give the second one some new ammo.. This allow me to use two different types of ammo with the one weapon. Is there a shorter way round ? Syntax for adding two types of ammo on the same weapon ? And is it possible to make two simulations run at once... I.e. shotIlluminating and shotSmoke. That way I can just use a flare that emits smoke.... confused.gif

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  

×