Home   Help Search Login Register  

Author Topic: make a gun shoot something other than bullets?  (Read 1909 times)

0 Members and 1 Guest are viewing this topic.

_hammy_

  • Guest
make a gun shoot something other than bullets?
« on: 03 Jan 2003, 05:12:57 »
how can I have a gun shoot stuff other than bullets? im trying to get a gun I made shoot golf balls.

Skaven

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #1 on: 03 Jan 2003, 11:26:13 »
Make a Golf Ball model in O2, and than declare it as a weapon's MAG in the cpp file, you can than call it GolfMag and it will fire Gold Balls, a strange idea, but funny nevertheless.

_hammy_

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #2 on: 03 Jan 2003, 20:31:32 »
hmm, im kinda new to this cpp editing, this is what the cffgAmmo looks like  and I dont know what u mean by declare as weapon mag:

Code: [Select]
class CfgAmmo
{
     class default{};
     class BulletSIngle : default{};
    sideAirFiction=200;
    model="\gbl\gb.p3d"; //Is this line the one you mean by declare it as the weapons mag?
     maxrange=50;
     maxspeed=50.750;
};

i put it in the game and it just shoots normal bullets

or is it in cfgWeapons on this line:
Code: [Select]
magazines[]={"\gbl\gb.p3d"}; //should it look like this to declare it as weapons mag?
« Last Edit: 03 Jan 2003, 20:33:29 by HAMMY »

M_S_Holder

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #3 on: 04 Jan 2003, 03:41:02 »
That's a good idea :D

I think it is in the ammo section where you set the model (you had it right), but you have to have a really low initspeedto see the golf balls, I think.

BUNTRO

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #4 on: 12 Jan 2003, 10:39:12 »
where you have model...that's correct for telling OFP what model you are using for your ammo...but it doesn't declare it as a mag...i think the section that declare it as a mag is in your cfgWeapons, where you declare a count and the magazine that the weapon uses.  In this you also declare how much ammo is in a mag.  Check out some cpp files to solve your problem.

Tamerch

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #5 on: 15 Jan 2003, 15:04:52 »
I have the same problem (i dont want to shot golf balls but potatoes),
anyway, the pb is that if your launcher inherit rifle weapon class  the "golf ball" (or potatoes) wont be seen....
but if you simulate your weapon as a LAWlauncher for exemple, you will be able to see the ball ....

a problem i havent solved yet is the ammo balistic ... but im a noob !!!


sanam

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #6 on: 20 Nov 2003, 09:45:18 »
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.
« Last Edit: 21 Nov 2003, 04:41:26 by PeacePunk »

DBR_ONIX

  • Guest
Re:make a gun shoot something other than bullets?
« Reply #7 on: 29 Dec 2003, 18:10:43 »
Hmm...
This gives me an idea.. For a bullet time script..
Make a gun fire a model of a bullet :D
Make a bullet model, and use the info above... Maybe some way of speeding up the bullet in real time..?
- Ben