Jump to content

Photo
- - - - -

Pistols and ammo


  • Please log in to reply
9 replies to this topic
Thread Starter
gonk
gonk

    First Sergeant

  • Members
  • 968 posts

#1

Posted 03 November 2002 - 01:37

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

Major Fubar
Major Fubar

    Retired Moderator

  • Members
  • 7889 posts

#2

Posted 03 November 2002 - 02:28

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.

Thread Starter
gonk
gonk

    First Sergeant

  • Members
  • 968 posts

#3

Posted 03 November 2002 - 05:19

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

soul_assassin
soul_assassin

    Chief Warrant Officer

  • Members
  • 3515 posts

#4

Posted 03 November 2002 - 11:37

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 = "";
};


};
[/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[] = {"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 = "";
};
[/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.





Thread Starter
gonk
gonk

    First Sergeant

  • Members
  • 968 posts

#5

Posted 03 November 2002 - 11:56

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. Posted Image 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.
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....:(

der bastler
der bastler

    Master Gunnery Sergeant

  • Members
  • 1295 posts

#6

Posted 03 November 2002 - 12:06

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"};
[/QUOTE]<span id='postcolor'>
FPDR Tempus Fugit.

Thread Starter
gonk
gonk

    First Sergeant

  • Members
  • 968 posts

#7

Posted 04 November 2002 - 00:26

Der Blaster.... Thx.. That worked a treat!! Posted Image I do not understand all your code ..yet. Posted Image 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.
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....:(

der bastler
der bastler

    Master Gunnery Sergeant

  • Members
  • 1295 posts

#8

Posted 04 November 2002 - 17:33

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
[/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,spanish,german,czech
[/QUOTE]<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
FPDR Tempus Fugit.

Major Fubar
Major Fubar

    Retired Moderator

  • Members
  • 7889 posts

#9

Posted 05 November 2002 - 01:13

</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!! Posted Image >[/QUOTE]<span id='postcolor'>
Errr...didn't he post basically the same as what I did? Posted Image

</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"};
[/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[]={"FlareMag","SmokeMag"};
[/QUOTE]<span id='postcolor'>

Oh well, whatever, as long as it works! Posted Image

Thread Starter
gonk
gonk

    First Sergeant

  • Members
  • 968 posts

#10

Posted 05 November 2002 - 09:30

</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!! Posted Image  >[/QUOTE]<span id='postcolor'>
Errr...didn't he post basically the same as what I did?  Posted Image

</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"};
[/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[]={"FlareMag","SmokeMag"};
[/QUOTE]<span id='postcolor'>

Oh well, whatever, as long as it works!  Posted Image[/QUOTE]<span id='postcolor'>
Your right Major but that alone did not work for me. Posted Image 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.... Posted Image
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....:(