Jump to content
Sign in to follow this  
legowarz

Custom weapon crashes on respawn

Recommended Posts

Ok, i've spend hours and hours trying to debug this problem!! I'm about to go nuts, so before I do that, I thought about asking for help  

I've made a custom weapon based off of the sniper rifle.  I've also implimented a script that reloads the player's weapons after they die.  Now, for some odd reason...after their second respawn, operation flashpoint dies! Just shuts off! no dialogue box or anything!

Here's the cpp file I made.  It was strange because it didn't die when i respawned with m16, but did evertime with the sniper.  So i switched to m16 with the sniper and having the same probelm if i try to switch to one mode (single, snipermode, whatever).  Here's the code:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// Basic def.

#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

class CfgPatches

{

  class LegoWarz_weapons

  {

     units[]={};

     weapons[]={LEGOWARZ_sniper, LEGOWARZ_smg};

     requiredVersion=1.00000;

  };

};

class CfgModels

{

  class Default{};

  class Weapon: Default{};

  class LEGOWARZ_smg : Weapon{};

  class LEGOWARZ_sniper : Weapon{};

};

class CfgAmmo

{

  class default {};

  class BulletSingle: default {};

  class BulletSniper: BulletSingle {};

  class SniperAmmo: BulletSniper {};

  class SMGAmmo: BulletSniper{};

};

class CfgWeapons

{

  class Default {};

  class MGun: Default {};

  class Riffle: MGun {};  

  class M16: Riffle {};

 

  class LEGOWARZ_sniper: M16

  {

     model="\LEGOWARZ_weapons\LEGOWARZ_sniper";

     modelOptics="\LEGOWARZ_weapons\optic_sniper.p3d";

     displayName="LegoWarz Sniper";

     displayNameMagazine="Sniper Mag";

     magazines[]={"LEGOWARZ_sniper"};

     //ammo=BulletSingleW;

     picture="\LEGOWARZ_weapons\sniper.paa";

     opticsZoomMin=0.04;

     opticsZoomMax=0.12;

     distanceZoomMin=400;

     distanceZoomMax=80;

     modes[] = {Snipemode};

     class Snipemode

     {

        ammo = BulletSniper;

        multiplier=1;

        burst=1;

        displayName="LegoWarz Sniper";

        dispersion=0.00003;

        sound[]={"LEGOWARZ_sniper\sniper",db0,1};

        soundContinuous=false;

        reloadTime=0.15;

        ffCount=1;

        recoil=riffleSniper;

        autoFire = false;

        aiRateOfFire=5.0; // delay between shots at given distance

        aiRateOfFireDistance=500; // at shorter distance delay goes lineary to zero

        useAction = false;

        useActionTitle = "";

     };

     

  };

  class LEGOWARZ_smg: M16

  {

     model="\LEGOWARZ_weapons\LEGOWARZ_smg";

     modelOptics="\LEGOWARZ_weapons\optic_smg.p3d";

     displayName="LegoWarz SMG";

     displayNameMagazine="SMG Mag";

     magazines[]={"LEGOWARZ_smg"};

     ammo=BulletBurst;

     picture="\LEGOWARZ_weapons\smg.paa";  

     

  };

};

class CfgNonAIVehicles

{

  class ProxyWeapon {};

  class ProxyLEGOWARZ_sniper : ProxyWeapon {};

  class ProxyLEGOWARZ_smg : ProxyWeapon {};

}; <span id='postcolor'>

If anyone's familiar with this, thanks for the help!!!

Share this post


Link to post
Share on other sites

I finally solved the problem!!! I coudln't reduce 2 modes down to 1 (and the sniper one just didnt' work...if someone knows why please tell smile.gif ) .... anyhow, my work around involved creating 2 modes for the sniper...but giving them both the same characteristics.  Here's the working code:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">// Basic def.

#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

class CfgPatches

{

class LegoWarz_weapons

{

units[]={};

weapons[]={LEGOWARZ_sni, LEGOWARZ_smg};

requiredVersion=1.00000;

};

};

class CfgModels

{

class Default{};

class Weapon: Default{};

class LEGOWARZ_smg : Weapon{};

class LEGOWARZ_sni : Weapon{};

};

class CfgAmmo

{

class default {};

class BulletSingle: default {};

class BulletSniper: BulletSingle {};

class SniAmmo: BulletSniper {};

class SMGAmmo: BulletSniper{};

};

class CfgWeapons

{

class Default {};

class MGun: Default {};

class Riffle: MGun {};

class M16: Riffle {};

class LEGOWARZ_sni: M16

{

model="\LEGOWARZ_weapons\LEGOWARZ_sniper";

modelOptics="\LEGOWARZ_weapons\optic_sniper.p3d";

displayName="LegoWarz Sni";

displayNameMagazine="Sniper Mag";

magazines[]={"LEGOWARZ_sni"};

//ammo=BulletSingleW;

picture="\LEGOWARZ_weapons\sniper.paa";

count=5;

opticsZoomMin=0.04;

opticsZoomMax=0.12;

distanceZoomMin=400;

distanceZoomMax=80;

modes[] = {Single, Burst};

class Single

{

ammo = BulletSniper;

multiplier=1;

burst=1;

displayName="LW Sniper";

dispersion=0.00003;

sound[]={\LEGOWARZ_weapons\sniper.wav,1,1};

soundContinuous=false;

reloadTime=0.5;

ffCount=1;

recoil=sniperSingle;

autoFire = false;

aiRateOfFire=5.0; // delay between shots at given distance

aiRateOfFireDistance=500; // at shorter distance delay goes lineary to zero

useAction = false;

useActionTitle = "";

};

class Burst

{

ammo = BulletSniper;

multiplier=1;

burst=1;

displayName="LW Sniper";

dispersion=0.00003;

sound[]={\LEGOWARZ_weapons\sniper.wav,1,1};

soundContinuous=false;

reloadTime=0.5;

ffCount=1;

recoil=sniperSingle;

autoFire = false;

aiRateOfFire=5.0; // delay between shots at given distance

aiRateOfFireDistance=500; // at shorter distance delay goes lineary to zero

useAction = false;

useActionTitle = "";

};

};

class LEGOWARZ_smg: M16

{

model="\LEGOWARZ_weapons\LEGOWARZ_smg";

modelOptics="\LEGOWARZ_weapons\optic_smg.p3d";

displayName="LegoWarz SMG";

displayNameMagazine="SMG Mag";

magazines[]={"LEGOWARZ_smg"};

ammo=BulletBurst;

picture="\LEGOWARZ_weapons\smg.paa";

modes[] = {Single, Burst};

class Single

{

ammo = BulletSingleW;

multiplier=1;

burst=1;

displayName="LW SMG Single";

dispersion=0.0002;

sound[]={\LEGOWARZ_weapons\smg.wav,1,1};

soundContinuous=false;

reloadTime=0.15;

ffCount=1;

recoil=riffleSingle;

autoFire = false;

aiRateOfFire=5.0; // delay between shots at given distance

aiRateOfFireDistance=500; // at shorter distance delay goes lineary to zero

useAction = false;

useActionTitle = "";

};

class Burst

{

ammo = BulletBurstW;

multiplier=1;

burst=3;

displayName="LW SMG Burst";

dispersion=0.0004;

sound[]={\LEGOWARZ_weapons\smg_burst.wav,1,1};

//sound[]={"",db0,1};

soundContinuous=false;

reloadTime=0.1;

ffCount=3;

recoil=riffleBurst3;

autoFire = false;

aiRateOfFire=5.0; // delay between shots at given distance

aiRateOfFireDistance=500; // at shorter distance delay goes lineary to zero

useAction = false;

useActionTitle = "";

};

};

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyLEGOWARZ_sni : ProxyWeapon {};

class ProxyLEGOWARZ_smg : ProxyWeapon {};

};<span id='postcolor'>

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×