Home   Help Search Login Register  

Author Topic: Problems with making grenade launchers and magazines  (Read 2143 times)

0 Members and 1 Guest are viewing this topic.

Yij

  • Guest
Hi,
   I'm making a weapon for Opflash: Resistance (OICW, for personal use) and I've got a few problems with it. I've made many weapons before, but this is my first time making one with a grenade launcher clip, and it's taken many months and effort, different styles of configs and what not. I can make one with a single shot grenade launcher, but a clip sized grenade launcher and the whole thing bugs up with errors.

1. The thing is stuck at single fire, burst and grenade launcher. I added full auto but for some reason it's not selecting it ingame. It goes from single to burst to grenade. I have no idea why this is, I've checked over hundreds of times and full auto should work, but it's not.

2. I want to make seperate magazines for the gun(30 round rifle rounds and 6 grenade rounds) so it will have it's own reload sound (currently it keeps playing the original one for all rifles in the game) and a clip for the grenades that can hold 6 rounds. I've tried making my own clips but it keeps coming up with errors this can't be found, undefined base class this and that, blah de blah. I
 normally use this config:


Code: [Select]
class YIJ_OICWMag : YIJ_OICW
{
scopeWeapon=0;
scopeMagazine=2;
picture="\dtaext\equip\m\m_m4.paa";
displayNameMagazine = "OICW Magazine";
shortNameMagazine = "OICW";
                count=30;
};
};
[/b]
but then that keeps bugging me about undefined base class, so I didn't use it. If someone could tell me how to write a new magazine properly that would be great. A link to a still working tutorial would be ace.

Thanks very much for the help! If you need me to send you the actual weapon to work in the game I will do so.

Here's my config.cpp file
Code: [Select]
[b]

//------------------------------------------------------
//OICW by Yij
//------------------------------------------------------
// some basic defines
#define TEast 1
#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
//------------------------------------------------------
//Patches
//------------------------------------------------------
class CfgPatches
{
class YIJ_OICWSoldier
{
units[] = {OICWSoldier};
weapons[] = {};
requiredVersion = 1.30;
};

//------------------------------------------------------
//Weapons
//------------------------------------------------------
class YIJ_OICW
{
units[] = {YIJ_OICW};
weapons[] = {};
requiredVersion = 1.30;
};
};
//------------------------------------------------------
//Models
//------------------------------------------------------
class CfgModels
   {
   class Default
   {
   sections[]={};
   sectionsInherit="";
   };
   class Weapon: Default
   {
   sections[]={"zasleh"};
   };
   class OICW: Weapon{};
};
//------------------------------------------------------
//Recoils
//------------------------------------------------------
class CfgRecoils
{
OICWrec[]={0.05,0.02,0.04, 0.05,0,0};
OICW20mmrec[]={0.05,0.06,0.08, 0.1,0,0};
};
//------------------------------------------------------
//Ammo
//------------------------------------------------------

class CfgAmmo
{

class default {};
class BulletSingle : default{};
class BulletBurst: BulletSingle{};
class BulletFullAuto: BulletBurst{};
class BulletSingleW: BulletSingle{};
class BulletBurstW: BulletBurst{};
class BulletFullAutoW: BulletFullAuto{};
};

//------------------------------------------------------
//Weapons
//------------------------------------------------------

class CfgWeapons

{
class Default {};
class MGun: Default {};
class Riffle: MGun {};
class M16: Riffle {};

class YIJ_OICW: M16
{
displayName="OICW";
scopeWeapon=2;
scopeMagazine=2;
weaponType=1;
picture="\dtaext\equip\m\m_m4.paa";
model="\OICW\OICW.p3d";
modelOptics = "optika_snpierw";
optics=1;
opticsZoomMin=0.300000;
opticsZoomMax=0.300000;
displayNameMagazine="OICW Mag";
shortNameMagazine="OICW";
reloadMagazineSound[]={"\OICW\OICW_reload.wav",db-70,1};
drySound[]={"\OICW\OICW_Dry.wav",db-70,1};
initSpeed=950;
maxLeadSpeed=500;
count=30;
modes[]={"Single","Burst","FullAuto"};
magazines[]={"YIJ_OICW"};
   class Single
   {
ammo="BulletSingleW";
multiplier=1;
burst=1;
displayName="OICW Single";
dispersion=0.0002;
sound[]={"\OICW\OICW_Fire.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
autoFire=0;
recoil="OICWrec";
aiRateOfFire=5.000000;
aiRateOfFireDistance=500;
useAction=0;
useActionTitle="";
   };
   class Burst
   {
ammo="BulletBurstW";
multiplier=1;
burst=3;
displayName="OICW Burst";
dispersion=0.0005;
sound[]={"\OICW\OICW_Burst.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
autoFire=0;
recoil="OICWrec";
aiRateOfFire=5.0;
aiRateOfFireDistance=700;
useAction=0;
useActionTitle="";
   };
class FullAuto
{
ammo="BulletFullAutoW";
multiplier=1;
burst=1;
displayName="OICW Auto";
dispersion=0.0008;
sound[]={"\OICW\OICW_Fire.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
recoil="OICWrec";
autoFire=1;
aiRateOfFire=5.0;
aiRateOfFireDistance=700;
useAction=0;
useActionTitle="";
};

};
class GrenadeLauncher: Default {};
class YIJ_OICWGL
{
scopeWeapon=2;
scopeMagazine=0;
weaponType=1;
displayName="OICW 20mmGL";
model="\OICW\OICW.p3d";
picture="\dtaext\equip\m\m_m4.paa";
muzzles[]={"YIJ_OICWMuzzle","YIJ_OICWGLMuzzle"};
recoil="OICW20mmrec";

class YIJ_OICWMuzzle: M16
{
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
displayNameMagazine="OICW Mag";
shortNameMagazine="OICW";
magazines[]={"YIJ_OICW"};
};

class YIJ_OICWGLMuzzle: GrenadeLauncher
{
displayName="OICW 20mmGL";
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
sound[]={"weapons\M16GrenadeLaunch",0.000316,1};
magazines[]={"GrenadeLauncher"};
recoil="OICW20mmrec";
};

};
//------------------------------------------------------
//Vehicles
//------------------------------------------------------
};

class CfgVehicles
{
class all {};
class AllVehicles: All {};
class Land: AllVehicles {};
class Man: Land {};
class Soldier: Man {};
class SoldierWB: Soldier {};

class YIJ_OICWGLSoldier: SoldierWB
{
displayName="Soldier, OICW";
vehicleclass = "Yij";
weapons[]={"Throw","Put","NVGoggles","YIJ_OICWGL"};
magazines[]={"YIJ_OICW","YIJ_OICW","YIJ_OICW","GrenadeLauncher","GrenadeLauncher"};

class CfgNonAIVehicles
{
class ProxyWeapon {};
class ProxyYIJ_OICW: ProxyWeapon {};
};

[/b]
« Last Edit: 16 Jul 2006, 20:03:57 by Planck »

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
Re: Problems with making grenade launchers and magazines
« Reply #1 on: 18 Jul 2006, 00:34:58 »
your class YIJ_OICWGL looks a bit lonely to me...
we're looking for members: IM:UC MOD

Yij

  • Guest
Re: Problems with making grenade launchers and magazines
« Reply #2 on: 19 Jul 2006, 20:27:45 »
What's that supposed to mean?

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
Re: Problems with making grenade launchers and magazines
« Reply #3 on: 19 Jul 2006, 22:04:18 »
that's supposed to mean that YIJ_OICWGL needs a parent class which is doesn't have ;)
therefore you're getting this undefined class base error.

Quote
class GrenadeLauncher: Default {};
   class YIJ_OICWGL: Grenadelauncher
we're looking for members: IM:UC MOD

Yij

  • Guest
Re: Problems with making grenade launchers and magazines
« Reply #4 on: 20 Jul 2006, 03:34:13 »
Parent class, you mean something like


Quote
   class Default   {};
   class MGun: Default {};
   class Riffle: MGun {};
   class M16: Riffle {};

How would I make one for this grenade launcher? Everything I did seems to have an error message everytime or if not, not appearing in the game. I've tried searching everywhere for a simple grenade launcher making tutorial but strangely enough, there is non.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Problems with making grenade launchers and magazines
« Reply #5 on: 20 Jul 2006, 07:37:29 »
Look at the bold text in remcen's post, he means that your config which you posted is missing that line and therefore the weapon does not inherit from anything (any parent class) and gives errors..

I don't like to post working configs/etc. because part of learning is to discover yourself why something does not work ;) , but try this:

Code: [Select]
class GrenadeLauncher: Default {};
class RiffleGrenadeLauncher: GrenadeLauncher {};

class YIJ_OICWGL: RiffleGrenadeLauncher
{
scopeWeapon=2;
scopeMagazine=0;
weaponType=1;
displayName="OICW 20mmGL";
model="\OICW\OICW.p3d";
picture="\dtaext\equip\m\m_m4.paa";
muzzles[]={"YIJ_OICWMuzzle","YIJ_OICWGLMuzzle"};
recoil="OICW20mmrec";

class YIJ_OICWMuzzle: M16
{
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
displayNameMagazine="OICW Mag";
shortNameMagazine="OICW";
magazines[]={"YIJ_OICW"};
};
class YIJ_OICWGLMuzzle: GrenadeLauncher
{
displayName="OICW 20mmGL";
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
sound[]={"weapons\M16GrenadeLaunch",0.000316,1};
magazines[]={"GrenadeLauncher"};
recoil="OICW20mmrec";
};
};

Not sure if that helps..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Yij

  • Guest
Re: Problems with making grenade launchers and magazines
« Reply #6 on: 21 Jul 2006, 04:27:37 »
Thanks for the help, HateR_Kint & Remcen. With a bit of modification it helped, and I managed to finally add 2 seperate magazine classes without it crashing (all I needed to do was put it somewhere else). Here is what the weaponcfg looks like.

Code: [Select]
class CfgWeapons

{
class Default {};
class MGun: Default {};
class Riffle: MGun {};
class M16: Riffle {};

class YIJ_OICW: M16
{
displayName="OICW";
scopeWeapon=2;
scopeMagazine=2;
weaponType=1;
picture="\dtaext\equip\m\m_m4.paa";
model="\OICW\OICW.p3d";
modelOptics = "optika_snpierw";
optics=1;
opticsZoomMin=0.300000;
opticsZoomMax=0.300000;
displayNameMagazine="OICW Mag";
shortNameMagazine="OICW";
reloadMagazineSound[]={"\OICW\OICW_reload.wav",db-70,1};
drySound[]={"\OICW\OICW_Dry.wav",db-70,1};
initSpeed=950;
maxLeadSpeed=500;
modes[]={"Single","Burst","FullAuto"};
magazines[]={"YIJ_OICWmag"};
   class Single
   {
ammo="BulletSingleW";
multiplier=1;
burst=1;
displayName="OICW Single";
dispersion=0.0002;
sound[]={"\OICW\OICW_Fire.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
autoFire=0;
recoil="OICWrec";
aiRateOfFire=5.0;
aiRateOfFireDistance=500;
useAction=0;
useActionTitle="";
   };
   class Burst
   {
ammo="BulletBurstW";
multiplier=1;
burst=3;
displayName="OICW Burst";
dispersion=0.0005;
sound[]={"\OICW\OICW_Burst.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
autoFire=0;
recoil="OICWrec";
aiRateOfFire=5.0;
aiRateOfFireDistance=500;
useAction=0;
useActionTitle="";
   };
class FullAuto
{
ammo="BulletFullAutoW";
multiplier=1;
burst=1;
displayName="OICW Auto";
dispersion=0.0008;
sound[]={"\OICW\OICW_Fire.wav",db0,1};
soundContinuous=0;
reloadTime=0.08;
ffCount=1;
recoil="OICWrec";
autoFire=1;
aiRateOfFire=5.0;
aiRateOfFireDistance=500;
useAction=0;
useActionTitle="";
};

};
class YIJ_OICWmag : YIJ_OICW
{
scopeWeapon=0;
scopeMagazine=2;
picture="\dtaext\equip\m\m_m4.paa";
displayNameMagazine = "OICW Magazine";
shortNameMagazine = "OICW";
                count=30;
};
class YIJ_OICWGLmag : YIJ_OICWmag
{
scopeWeapon=0;
scopeMagazine=2;
picture="\dtaext\equip\m\m_m4.paa";
displayNameMagazine = "OICW GL Magazine";
shortNameMagazine = "OICW GL";
                count=10;
};
};
class Default {};
class GrenadeLauncher: Default {};
class RiffleGrenadeLauncher: GrenadeLauncher {};

class YIJ_OICWGL: RiffleGrenadeLauncher
{
scopeWeapon=2;
scopeMagazine=0;
weaponType=1;
displayName="OICW 20mmGL";
model="\OICW\OICW.p3d";
picture="\dtaext\equip\m\m_m4.paa";
muzzles[]={"YIJ_OICWMuzzle","YIJ_OICWGLMuzzle"};
recoil="OICW20mmrec";

class MGun: Default {};
class Riffle: MGun {};
class M16: Riffle {};
class YIJ_OICWMuzzle: M16
{
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
displayNameMagazine="OICW Mag";
shortNameMagazine="OICW";
magazines[]={"YIJ_OICWmag"};
};
class YIJ_OICWGLMuzzle: GrenadeLauncher
{
displayName="OICW 20mmGL";
modelOptics = "optika_snpierw";
optics = true;
opticsZoomMin=0.04;
opticsZoomMax=0.12;
sound[]={"weapons\M16GrenadeLaunch",0.000316,1};
magazines[]={"GrenadeLauncher"};
recoil="OICW20mmrec";
};
//------------------------------------------------------
//Vehicles
//------------------------------------------------------
};

class CfgVehicles
{
class all {};
class AllVehicles: All {};
class Land: AllVehicles {};
class Man: Land {};
class Soldier: Man {};
class SoldierWB: Soldier {};

class YIJ_OICWGLSoldier: SoldierWB
{
displayName="Soldier, OICW";
vehicleclass = "Yij";
weapons[]={"Throw","Put","NVGoggles","YIJ_OICW"};
magazines[]={"YIJ_OICWmag","YIJ_OICWmag","YIJ_OICWmag"};

What I want is to have the weapon also use the grenade launcher clip
Code: [Select]
class YIJ_OICWGLmag but so far my efforts haven't been succesful. I think I might need to add
Code: [Select]
muzzles[]={"YIJ_OICWMuzzle","YIJ_OICWGLMuzzle"}; somewhere but I don't know where.
« Last Edit: 21 Jul 2006, 04:29:15 by Yij »