Weapon won't stop firing or only fire's once when it's automatic

Talk about any Deus Ex game modification here, e.g. maps, package or a total conversion.

Moderator: Forum Guards

Weapon won't stop firing or only fire's once when it's automatic

Postby Vexus » Thu Nov 12, 09 12:29 am

Hi, when I try using my weapon, with an ammo class, it will only fire once per click, but with the ammo class, it won't stop firing, even after you let go of the mouse. Wondering why this happens, please help.
Code: Select all
//=============================================================================
// Gatling.
//=============================================================================
class WGatling extends DeusExWeapon;

simulated function PreBeginPlay()
{
   Super.PreBeginPlay();

   // If this is a netgame, then override defaults
   if ( Level.NetMode != NM_StandAlone )
   {
      HitDamage = mpHitDamage;
      BaseAccuracy = mpBaseAccuracy;
      ReloadTime = mpReloadTime;
      AccurateRange = mpAccurateRange;
      MaxRange = mpMaxRange;
      ReloadCount = mpReloadCount;
   }
}

state NormalFire //(Thanks to JimBowen for this Infinite ammo code)
{
   Begin:
      if ((ClipCount >= ReloadCount) && (ReloadCount != 0))
      {
         if (!bAutomatic)
         {
            bFiring = False;
            FinishAnim();
         }
   
         if (Owner != None)
         {
            if (Owner.IsA('DeusExPlayer'))
            {
               bFiring = False;
            }
            else if (Owner.IsA('ScriptedPawn'))
            {
               bFiring = False;
               ReloadAmmo();
            }
         }
         else
         {
            if (bHasMuzzleFlash)
               EraseMuzzleFlashTexture();
            GotoState('Idle');
         }
      }
      if ( bAutomatic && (( Level.NetMode == NM_DedicatedServer ) || ((Level.NetMode == NM_ListenServer) && Owner.IsA('DeusExPlayer') && !DeusExPlayer(Owner).PlayerIsListenClient())))
         GotoState('Idle');
   
      Sleep(GetShotTime());
      if (bAutomatic)
      {
         GenerateBullet();       // In multiplayer bullets are generated by the client which will let the server know when
         Goto('Begin');
      }
      bFiring = False;
      FinishAnim();
   
   /*      // if ReloadCount is 0 and we're not hand to hand, then this is a
      // single-use weapon so destroy it after firing once
      if ((ReloadCount == 0) && !bHandToHand)
      {
         if (DeusExPlayer(Owner) != None)
            DeusExPlayer(Owner).RemoveItemFromSlot(Self);   // remove it from the inventory grid
         Destroy();
      }
      */              // Do I REALLY need all that crap JUST for infinite ammo?
      ReadyToFire();
   Done:
      bFiring = False;
      Finish();
}

defaultproperties
{
     GoverningSkill=Class'DeusEx.SkillWeaponHeavy'
     EnviroEffective=ENVEFF_Air
     Concealability=CONC_All
     ShotTime=0.100000
     bCanHaveLaser=True
     recoilStrength=0.30000
     MinWeaponAcc=0.200000
    Reloadtime=0.000000
     mpReloadTime=0.000000
    HitDamage=12
     mpHitDamage=12
    BaseAccuracy=0.000000
     mpBaseAccuracy=0.000000
    AccurateRange=99999
     mpAccurateRange=99999
    MaxRange=99999
     mpMaxRange=99999
    bHasMuzzleFlash=True
    bInstantHit=True
    bAltInstantHit=True
    bAutomatic=True
    RefireRate=0.330000
    ReloadCount=0
    PickupAmmoCount=1000
     AmmoName=Class'DeusEx.AmmoPlasma'
     FireOffset=(X=-16.000000,Y=5.000000,Z=11.500000)
     shakemag=50.00000
     FireSound=Sound'DeusExSounds.Weapons.AssaultGunFire'
     AltFireSound=Sound'DeusExSounds.Weapons.AssaultGunReloadEnd'
     CockingSound=Sound'DeusExSounds.Weapons.AssaultGunReload'
     SelectSound=Sound'DeusExSounds.Weapons.AssaultGunSelect'
     InventoryGroup=206
     ItemName="|cCD6839Gatling Gun"
     PlayerViewOffset=(X=46.000000,Y=-22.000000,Z=-30.000000)
     PlayerViewMesh=LodMesh'DeusExDeco.AutoTurretGun'
     PickupViewMesh=LodMesh'DeusExDeco.AutoTurretGun'
     ThirdPersonMesh=LodMesh'DeusExDeco.AutoTurretGun'
     LandSound=Sound'DeusExSounds.Generic.DropLargeWeapon'
     Icon=Texture'Engine.S_Corpse'
     largeIcon=Texture'Engine.S_Corpse'
     largeIconWidth=94
     largeIconHeight=65
     invSlotsX=2
     invSlotsY=2
     Description="A #@$%ing turret."
     beltDescription="GATLING"
     Mesh=LodMesh'DeusExDeco.AutoTurretGun'
     DrawScale=0.300000
     MultiSkins(0)=Texture'VM001.Skins.Gatling1'
     CollisionRadius=22.500000
     CollisionHeight=9.100000
     Mass=30.000000
}


I'm pretty sure it has something to do with the infinite ammo code, but not sure what.
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California

Postby Allan » Thu Nov 12, 09 1:56 am

This:

Code: Select all
      if (bAutomatic)
      {
         GenerateBullet();       // In multiplayer bullets are generated by the client which will let the server know when
         Goto('Begin');
      }


is the part that forces your weapon into an infinite loop. That code is only really designed for non-automatic weapons. AKA: The AllanTeleporter, and BowenTeleporter that code originally came from. Most of that code is either redundant, or legacy.

Try changing that bAutomatic check to this:

Code: Select all
      if (bAutomatic && DeusExPlayer(Owner).bFire==1)
      {
         GenerateBullet();
         Goto('Begin');
      }


It -should- then auto-fire only whilst the fire button is held down. Mind you, you may get bugs relating to switching the weapon whilst still holding the fire button.

Still, try it out. :)
Last edited by Allan on Thu Nov 12, 09 1:57 am, edited 1 time in total.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Vexus » Thu Nov 12, 09 2:46 am

Yay, it works, but how can I make it so the shooting sound loops, too, when shooting
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California

Postby Allan » Fri Nov 13, 09 12:53 am

You'd probably be better off with a single-shot sound if you'd like it looping, like the pistol noise the actual turrets use.

As for how to do it, I'll have to get back to you.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Vexus » Fri Nov 13, 09 3:48 am

Ok, thanks.
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California

Postby Vexus » Thu Nov 19, 09 5:49 am

It's been almost a week, got any leads yet?
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California

Postby Allan » Fri Nov 20, 09 11:50 pm

'fraid not. I'm going to try some other things though.
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Vexus » Thu Nov 26, 09 12:56 am

Haha, lemme know when you got it, bro.

Thanks.
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California

Postby Vexus » Sun May 22, 11 11:53 pm

Still nothing? L0l.
ShadowRunner wrote:lol, the mayhem of this thread is huge...

~][FGS][Nobody~ wrote:Is there anything I can put in your mouth to make you stop talking rubbish? :-s

anax wrote:wow you are amazing. like this woman
http://www.youtube.com/watch?v=bl4B9NA-NLE

[FGS]Kalman wrote:Lol I thought for 2-3 months everybody talks like a sir here, then I realised it's the forum's censorship
User avatar
Vexus
Wannabe
 
Posts: 84
Joined: Wed Oct 14, 09 5:12 am
Location: California


Return to Modifications

Who is online

Users browsing this forum: No registered users and 22 guests