Here's an example, from an old forgotten dead-born addon of mines:
Be advised that it's based on an m16+mortar, because mortar do have an object that is pictured flying. As a mortar you need 2 p3d's files:
- one called "model" (where you can put the visible ball if you like, its the pre-firing image of your gun theorically loaded with the visible mortar at the end of the riffle
-and the second called "modelspecial" wich takes place after the shot, and hence the mortar shell disappears.
With fine-tunig of the speed, thrust, thrustTime & so on, you'll get what you want. More or less.
Note this example even provide you with a VERY Special Operations unit... and group...
At the bottom, attached, a classic in CPP tuning,
the "Jester CPP Explained" stuff.
Notice I called your weapon "GolfGun" and your ammo "GolfBall"
Start of Code:
// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
#define true 1
#define false 0
// type scope
#define private 0
#define protected 1
#define public 2
#define WeaponNoSlot            0// dummy weapons
#define WeaponSlotPrimary         1// primary weapons
#define WeaponSlotSecondary         16// secondary weapons
#define WeaponSlotItem         256// items
#define WeaponSlotBinocular         4096// binocular
#define WeaponHardMounted         65536
class CfgPatches
{
   class GolfGun
   {
      units[] = {GolfGunBlackOp};
      weapons[] = {GolfGun};
      requiredVersion = 1.45;
   };
};
class CfgAmmo
{
  Â
   class default {};
   class BulletSingle : default{};
   class GolfBall : BulletSingle
   {
  Â
   explosive=0; //Like to send explosives potatoes ? it's 1 then
  Â
   minRange=0.5;
   minRangeProbab=0.950000;
   midRange=100;
   midRangeProbab=0.800000;
   maxRange=300;
   maxRangeProbab=0.400000; //How accurate is a french frie on the distance (from the AI point of view)?
  Â
   soundFly[]={"",1,4};
   visibleFire=20;
   audibleFire=5;
   visibleFireTime=20; //How noisy&visible is it to throw an old fish?
  Â
   hit=0.5;
   indirectHit=0.1;
   indirectHitRange=0.05; //Mama 'Im hit ! thoses Tomatoes are painfull
   model= "\GolfGun\GolfBall.p3d";
   maxSpeed=150;
   cartridge= "GolfBall"; //or anyting else...
   irLock=0;
   airLock=0;
   manualControl=0;
   maxControlRange=2000; //Shall your pancake lock on aerial targets?
   initTime=0;
   thrustTime=2.000000;
   thrust=250;
   maneuvrability=7.000000;
   };
  Â
};
class CfgWeapons
{
   class Default {};
   class MGun: Default {};
   class Riffle: MGun {};  Â
   class SniperRiffle : Riffle {};
   class M21 : SniperRiffle{};
   class GolfGun: M21
   {
      scopeWeapon = private;
      scopeMagazine = public;
      weaponType = WeaponSlotPrimary;
      ammo="GolfBall";
      model="\GolfGun\GolfGun.p3d";
      modelSpecial="\GolfGun\GolfGunf.p3d";
     Â
      recoil=sniperSingle;
      recoilFixed=RiffleSingleFixed; //Throwing applePies isn't that easy.
  Â
      displayName = "GolfGun";
      displayNameMagazine = "GolfBall";
      shortNameMagazine = "GolfBall";
  Â
      count=1; //How much clams you throw at the same time ?
      initspeed=330;
      dispersion=0.00020 // No, this is not how much you spoil the carpet...
     Â
  Â
      modelOptics="optika_GolfGun" //Kill this line if you don't build one !
      optics=true;
      opticsFlare=0
      opticsZoomMin=0.020000;
      opticsZoomMax=0.20000;
      distanceZoomMin=400;
      distanceZoomMax=80; //Well, a good GravyLauncher MUST have a decent visor.
  Â
      maxLeadSpeed=330; //Incoming strawberries !
  Â
      drySound[]={"weapons\M16dry",0.010000,1};
      sound[]={"",0.010000,1};
  Â
      reloadTime=0.1;
      reloadMagazineSound[]={"",0.000316,1};
      reloadAction="ManActReloadMortar";
      autoReload=0;
      magazines[]={"GolfBall"};
  Â
      //recoil="LAWSingle";
      aiRateOfFire=0.800000;
      aiRateOfFireDistance=300;
      picture="\GolfGun\picture_GolfGun.pac";
   };
   class GolfBall: GolfGun
   {
      picture="\GolfGun\picture_GolfBall.paa";
   };
};
class CfgVehicles
{
   class All{};
   class AllVehicles : All{};
   class Land : AllVehicles{};
   class Man : Land{};
   class Soldier : Man{};
   class SoldierWB : Soldier{};
   class OfficerW : SoldierWB {};
   class SoldierWSaboteur : SoldierWB{};
   class SoldierWSaboteurPipe: SoldierWSaboteur{};
   class GolfGunBlackOp: SoldierWSaboteurPipe
   {
      displayName="GolfGunBlackOp";
      weapons[]={"GolfGun","Throw","Put","NVGoggles","Binocular"};
      magazines[]={"GolfBall","GolfBall","GolfBall","GolfBall","GolfBall","GolfBall","GolfBall","GolfBall","GolfBall","GolfBall"};
   };
};
class CfgNonAIVehicles
{
   class ProxyWeapon {};
   class ProxyGolfGunBlackOp: ProxyWeapon {};
};
class CfgGroups //Yeah! A Group of Spaghetti-throwing Terrorists !
{
   class West
   {
      name="$STR_WEST";
      class Infantry
      {
         name="$STR_CFG_GRP_INFANTRY";
         class GolfGunBlackOps
         {
            name="Smooth OPerators";
            class Unit0
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="Sergeant";
               position[]={0,2,0};
            };
            class Unit1
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="CORPORAL";
               position[]={2,0,0};
            };
            class Unit2
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="CORPORAL";
               position[]={-2,0,0};
            };
            class Unit3
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="CORPORAL";
               position[]={4,0,0};
            };
            class Unit4
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="CORPORAL";
               position[]={-4,0,0};
            };
            class Unit5
            {
               side=1;
               vehicle="GolfGunBlackOp";
               rank="CORPORAL";
               position[]={6,0,0};
            };     Â
         };
      };
   };
};
End of Code
Now you're facing the next issue: Where did your hotdog disapears after it hit the ground ?
I've got no answer on how to get the object "available again" after being fired.
Sorry.
GoodNight.
Peacepunk
My Tag is DoFP, wich stands for
"Department of Funky Proxies"
So please keep me informed of your progresses, as I strongly support any kind of Delirious Stuff.