Results 1 to 10 of 10

Thread: Pistols and ammo

  1. #1

    Unhappy

    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.
    Intel Core i7 980X EXTREME, 24 Gig RAM, 240 Gig Revo x 2 SSD, 2 X EVGA (SC) 680GTX's, Win 7 64 Pro,
    Single 27 inch Monitor, Oculus Rift V 1.0, Track IR 5, HOTAS Warthog, SIMPEDS Pedals..Arma3 Ready... not....

  2. #2
    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.

  3. #3
    First Sergeant gonk's Avatar
    Join Date
    Jul 3 2001
    Location
    Australia
    Posts
    968
    Author of the Thread

    Question

    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.

  4. #4
    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 = &#34;&#34;;
    optics = 0;
    magazines&#91;&#93; = {&#34;magnames&#34;};
    model = &#34;path to model&#34;;
    displayName = &#34;model display name&#34;;
    displayNameMagazine = &#34;mag display name&#34;;
    shortNameMagazine = &#34;shortnamemag&#34;;
    modes&#91;&#93; = {&#34;Flare&#34;,&#34;Smoke&#34;};
    class Flare
    {
    ammo = &#34;Flare ammo&#34;;
    multiplier = 1;
    burst = 1;
    displayName = &#34;Flare&#34;;
    dispersion = 0.000200;
    sound&#91;&#93;={&#34;Weapons&#92;M16Single&#34;,1 .000000,1};
    soundContinuous = 0;
    reloadTime = 0.150000;
    ffCount = 1;
    recoil = &#34;riffleSingle&#34;;
    autoFire = 0;
    aiRateOfFire = 5.000000;
    aiRateOfFireDistance = 500;
    useAction = 0;
    useActionTitle = &#34;&#34;;
    };
    class Smoke
    {
    ammo = &#34;Smoke ammo&#34;;
    multiplier = 1;
    burst = 1;
    displayName = &#34;Smoke&#34;;
    dispersion = 0.000200;
    sound&#91;&#93;={&#34;Weapons&#92;M16Single&#34;,1 .000000,1};
    soundContinuous = 0;
    reloadTime = 0.150000;
    ffCount = 1;
    recoil = &#34;riffleSingle&#34;;
    autoFire = 0;
    aiRateOfFire = 5.000000;
    aiRateOfFireDistance = 500;
    useAction = 0;
    useActionTitle = &#34;&#34;;
    };


    };
    [/QUOTE]<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&#91;&#93; = {&#34;Flare&#34;,&#34;Smoke&#34;};
    class Flare
    {
    ammo = &#34;Flare ammo&#34;;
    multiplier = 1;
    burst = 1;
    displayName = &#34;Flare&#34;;
    dispersion = 0.000200;
    sound&#91;&#93;={&#34;Weapons&#92;M16Single&#34;,1 .000000,1};
    soundContinuous = 0;
    reloadTime = 0.150000;
    ffCount = 1;
    recoil = &#34;riffleSingle&#34;;
    autoFire = 0;
    aiRateOfFire = 5.000000;
    aiRateOfFireDistance = 500;
    useAction = 0;
    useActionTitle = &#34;&#34;;
    };
    class Smoke
    {
    ammo = &#34;Smoke ammo&#34;;
    multiplier = 1;
    burst = 1;
    displayName = &#34;Smoke&#34;;
    dispersion = 0.000200;
    sound&#91;&#93;={&#34;Weapons&#92;M16Single&#34;,1 .000000,1};
    soundContinuous = 0;
    reloadTime = 0.150000;
    ffCount = 1;
    recoil = &#34;riffleSingle&#34;;
    autoFire = 0;
    aiRateOfFire = 5.000000;
    aiRateOfFireDistance = 500;
    useAction = 0;
    useActionTitle = &#34;&#34;;
    };
    [/QUOTE]<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.



    REDHAMMERSTUDIOS | M109A6 | 3DSMAX ARMA2 TOOLBOX
    ~RHS: AFRF on the or BIF and on Facebook.

  5. #5
    First Sergeant gonk's Avatar
    Join Date
    Jul 3 2001
    Location
    Australia
    Posts
    968
    Author of the Thread

    Arrow

    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. 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.

  6. #6

    Talking

    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&#91;&#93; = {&#34;M41aPR&#34;,&#34;M41aPR_tracer&#34;};
    [/QUOTE]<span id='postcolor'>
    Tempus Fugit.

  7. #7
    First Sergeant gonk's Avatar
    Join Date
    Jul 3 2001
    Location
    Australia
    Posts
    968
    Author of the Thread

    Arrow

    Der Blaster.... Thx.. That worked a treat&#33;&#33; I do not understand all your code ..yet. 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 = "&#036;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.

  8. #8
    Right, displayName="&#036;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,M30 9
    [/QUOTE]<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,spanis h,german,czech
    [/QUOTE]<span id='postcolor'>

    There&#39;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

  9. #9

    Unhappy

    </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&#33;&#33; >[/QUOTE]<span id='postcolor'>
    Errr...didn&#39;t he post basically the same as what I did?

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines&#91;&#93; = {&#34;M41aPR&#34;,&#34;M41aPR_tracer&#34;};
    [/QUOTE]<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&#91;&#93;={&#34;FlareMag&#34;, &#34;SmokeMag&#34;};
    [/QUOTE]<span id='postcolor'>

    Oh well, whatever, as long as it works&#33;

  10. #10
    First Sergeant gonk's Avatar
    Join Date
    Jul 3 2001
    Location
    Australia
    Posts
    968
    Author of the Thread

    Arrow

    </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&#33;&#33; ***>[/QUOTE]<span id='postcolor'>
    Errr...didn&#39;t he post basically the same as what I did? ***

    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">magazines&#91;&#93; = {&#34;M41aPR&#34;,&#34;M41aPR_tracer&#34;};
    [/QUOTE]<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&#91;&#93;={&#34;FlareMag&#34;, &#34;SmokeMag&#34;};
    [/QUOTE]<span id='postcolor'>

    Oh well, whatever, as long as it works&#33; ***[/QUOTE]<span id='postcolor'>
    Your right Major but that alone did not work for me. 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....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •