My modded rifles keep making all weapons auto fire repeatedly...

Defender

Member
This is modding issue, that started happening after the 12-28-13 patch, that change the laser rifle fire code, and made it charge with one click, then fire on next click..I have 2 energy rifles and one ammo type, they all give me problems now.... if you could point me in the right direction to the changes in the code, you made it would be of great help...



Code:
//-----------------------------------------------------------------------------
// Fallen Empire: Legions
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------


// Projectile for the RailGun.
datablock BeamProjectileData(RailGunProjectile)
{
  passThroughPlayers = true;

  // damage
  beamCount = 2;
  beamRadius[0] = 0.4;
  beamMaterial[0] = "BeamMaterial0";
  beamRepeatLength[0] = 16;
  beamStartFadeTime[0] = 0.1;
  beamEndFadeTime[0] = 1.0;
  beamEndFadeFactor[0] = 1.0;

  beamRadius[1] = 0.5;
  beamMaterial[1] = "PlayerElectricTeam0Material";
  beamRepeatLength[1] = 64;
  beamStartFadeTime[1] = 0.1;
  beamEndFadeTime[1] = 1.0;
  beamEndFadeFactor[1] = 0.0;

  initialFadeDistance = 15.0;

  explosionMidair = "SniperBeamExplosion";
 
  initialDamage = 0;
  directDamage = 0;
  radiusDamage = 0;
  damageRadius = 0;
  areaImpulse = 0;
  damageType = $DamageType::SniperBeam;
  explosionDamageType = $DamageType::SniperExplosion;

  lifetime = 1300;
  isBallistic = false;
  gravityMod = 0.0;
 
  deleteOnExplode = false;
  isAttached = false;
};

datablock BeamProjectileData(RailGunDamageProjectile)
{
  passThroughPlayers = true;

  // damage
  beamCount = 1;
  beamRadius[0] = 0.0;
  beamMaterial[0] = "BeamMaterial0";
  beamRepeatLength[0] = 16;
  beamStartFadeTime[0] = 0.0;
  beamEndFadeTime[0] = 1.0;
  beamEndFadeFactor[0] = 0.0;

  minDamage = 40;
  maxDamage = 50;
  directDamage = 40;
  radiusDamage = 20;
  damageRadius = 5;
  areaImpulse = 2000;
  damageType = $DamageType::SniperBeam;
  explosionDamageType = $DamageType::SniperExplosion;

  lifetime = 15;

  deleteOnExplode = false;
  isAttached = false;
};

new ScriptObject(RailGunIcon)
{
  class = IconInfo;
  name = RailGun;
 
  containerIcon = "client/gui/images/hud/weaponIcons/sniperRifle";
};

new ScriptObject(RailGunReticle)
{
  class = ReticleInfo;
  name = RailGun;
 
  image = "client/gui/images/hud/reticles/SniperReticle_NoZoom";
  frames = "4 1";
 
  normalFrame = 0;
};

datablock ItemData(RailGun)
{
  class = Weapon;
  image = RailGunImage;
 
  iconInfo = RailGunIcon;
  reticleInfo = RailGunReticle;
 
  longName = "RailGun";
  shortName = "RG";
};


// RailGun image
datablock ShapeBaseImageData(RailGunImage)
{
  class = WeaponImage;
  item = RailGun;
 
  aimProjectile = RailGunDamageProjectile;
  projectile = RailGunProjectile;
  projectileType = BeamProjectile;
  optimalRange = 500;
  maxRange = 800; // maximum range in meters

  shapeFile = "legions/data/shapes/Weapons/sniperrifle/sniperrifle.dts";
 
  emap = true;

  reticleImageFile[0] = "client/gui/images/hud/reticles/SniperReticle_NoZoom";
  reticleImageFile[1] = "client/gui/images/hud/reticles/SniperReticle_FullZoom";
  reticleImageFile[2] = "client/gui/images/hud/reticles/SniperReticle_FullZoom";

  reticleStartScale[0] = "1 1";
  reticleStartScale[1] = "0.3 0.3";
  reticleStartScale[2] = "0.5 0.5";

  reticleEndScale[0] = "1 1";
  reticleEndScale[1] = "0.5 0.5";
  reticleEndScale[2] = "1 1";

  reticleScaleTime[0] = 0;
  reticleScaleTime[1] = 0.25;
  reticleScaleTime[2] = 0.25;

  reticleStartAlpha[0] = 255;
  reticleStartAlpha[1] = 50;
  reticleStartAlpha[2] = 255;

  reticleEndAlpha[0] = 255;
  reticleEndAlpha[1] = 255;
  reticleEndAlpha[2] = 255;

  reticleFadeTime[0] = 0;
  reticleFadeTime[1] = 0.3;
  reticleFadeTime[2] = 0.3;

  reticleFrameCount = "4 1";
  cursorTexture = "client/gui/images/hud/targetingCursor";

  mountPoint = $WeaponSlot;
  firstPerson = true;
  eyeOffset = "0.7 0.3 -0.4";
  rotation = "1 0 0 90";
  correctMuzzleVector = true;
  aimBeam = 0;
  shotBeam = 1;

  usesEnergy = true;
  fireEnergy = 1;
  minEnergy = 2;
 

  // Check ammo, do appropriate activate animation
  stateName[0] = "PreActivate";
  stateTransitionOnAmmo[0] = "Activate";
  stateSequence[0] = "activate";
  stateTransitionOnNoAmmo[0] = "ActivateNoAmmo";
 
  stateName[1] = "Activate";
  stateSequence[1] = "activate";
  stateTransitionOnTimeout[1] = "Ready";
  stateTimeoutValue[1] = 0.5;
 
  stateName[2] = "ActivateNoAmmo";
  stateSequence[2] = "activatenoammo";
  stateTransitionOnTimeout[2] = "NoAmmo";
  stateTimeoutValue[2] = 0.5;
 
  stateName[3] = "Ready";
  stateScript[3] = "onReady";
  stateWaitForTimeout[3] = false;
  stateSequence[3] = "ready";
  stateTransitionOnTriggerDown[3] = "Fire";
  stateTransitionOnNoAmmo[3] = "NoAmmo";
 
  stateName[4] = "Fire";
  stateTimeoutValue[4] = 0.4; //was 0.4;
  stateTransitionOnTimeout[4] = "CheckAmmo";
  stateSequence[4] = "fire";
  stateFire[4] = true;
  stateAllowImageChange[4] = false;
  stateFullSound[4] = GrenadeBurstSound00;
  stateScript[4] = "onFire";
 
  stateName[5] = "CheckAmmo";
  stateTransitionOnAmmo[5] = "Reload";
  stateTransitionOnNoAmmo[5] = "NoAmmoStart";
  stateAllowImageChange[5] = false;
 
  stateName[6] = "Reload";
  stateScript[6] = "onReload";
  stateSequence[6] = "cooldown";
  stateSequenceStartPosition[6] = 0.0;
  stateSequenceEndPosition[6] = 0.7;
  stateTransitionOnTimeout[6] = "Reloaded";
  stateAllowImageChange[6] = false;
  stateTimeoutValue[6] = 1.4; // 1.75
 
  stateName[7] = "Reloaded";
  stateScript[7] = "onReloaded";
  stateSequence[7] = "cooldown";
  stateSequenceStartPosition[7] = 0.7;
  stateSequenceEndPosition[7] = 1.0;
  stateTransitionOnTimeout[7] = "Ready";
  stateTimeoutValue[7] = 0.5;
 
  stateName[8] = "NoAmmoStart";
  stateSequence[8] = "cooldown";
  stateTransitionOnTimeout[8] = "NoAmmo";
  stateTimeoutValue[8] = 1.4;
  stateWaitForTimeout[8] = false;
  stateTransitionOnTriggerDown[8] = "DryFire";
  stateTransitionOnAmmo[8] = "Reload";
 
  stateName[9] = "NoAmmo";
  // stateSequence[9] = "cooldown";
  stateTransitionOnTriggerDown[9] = "DryFire";
  stateTransitionOnAmmo[9] = "Reload";
 
  stateName[10] = "DryFire";
  stateTimeoutValue[10] = 0.5;
  stateWaitForTimeout[10] = true;
  stateTransitionOnTimeout[10] = "CheckAmmo";
  stateSequence[10] = "fire";
  stateFullSound[10] = "";
};

function RailGunImage::onReady(%this, %obj, %slot)
{
}

function RailGunImage::onReloaded(%this, %obj, %slot)
{
}

//--------------------------------------------------------------------------
// RailGun
//--------------------------------------------------------------------------

function RailGunImage::onFire(%this, %obj, %slot)
{
  if(getsimtime() <= %obj.RailGunReload) // added by PJ 9/10/2002 Rapid Fire Cheat Fix
     return;
 
  %pct = %obj.getEnergyLevel() / %obj.getDataBlock().maxEnergy;
  %obj.setEnergyLevel(0);
  return %this.createBeam(%obj, %slot, %pct);
}

function RailGunImage::createBeam(%this, %obj, %slot, %pct)
{
  // Create the projectile object
  %p = new (%this.projectileType)() {
  dataBlock  = %this.aimProjectile;
  initialVelocity  = "0 0 0";
  initialPosition  = %obj.getMuzzlePoint(%slot);
  damageFactor  = %pct;
  energyPercentage = %pct;
  sourceObject  = %obj;
  sourcePlayer  = %obj.client;
  sourceSlot  = %slot;
  client  = %obj.client;
  optimalRange  = %this.optimalRange;
  range  = %this.maxRange;
  stats  = %obj.stats.getWeaponStats(%this.aimProjectile.damageType);
  };

  %obj.laserShot[%this.aimBeam] = %p;

  MissionCleanup.add(%p);

  // Create the projectile object
  %p = new (%this.projectileType)() {
  dataBlock  = %this.projectile;
  initialVelocity  = "0 0 0";
  initialPosition  = %obj.getMuzzlePoint(%slot);
  sourceObject  = %obj;
  sourcePlayer  = %obj.client;
  sourceSlot  = %slot;
  client  = %obj.client;
  range  = %this.maxRange;
  };

  %obj.laserShot[%this.shotBeam] = %p;

  %obj.RailGunReload = RailGunImage.stateTimeoutValue[6] * 1000 + getsimtime(); // added by PJ 9/10/2002 Rapid Fire Cheat Fix
  MissionCleanup.add(%p);
  return %p;
}
 
Last edited:

RockeyRex

Legions Developer
Urgh... Yeah slight issue on the client end. Try turning "Sniper Hold Toggle" to yes in options.

Meanwhile I'll go and shout to people. Should be fixed for next update.
 

Defender

Member
Urgh... Yeah slight issue on the client end. Try turning "Sniper Hold Toggle" to yes in options.

Meanwhile I'll go and shout to people. Should be fixed for next update.
Thanks for the reply to my issue, and thank you vary much for all your hard work on this game..
 
Last edited:

Fixious

Test Lead
The auto-fire bug in general seems to have increased. Seeing it quite a bit in pubs these days, though I haven't experienced it myself since the initial sniper patch.
 

Jaymyster

Member
Just so everyone knows, if you get the auto-fire bug while using the LR, all you have to do is switch to LR, click once and it stops
 

Fixious

Test Lead
If it doesn't, open the console (Ctrl + ~) and type fire() and press Enter. Or maybe just fire, I can't remember.
 

Defender

Member
For now, I just removed the extra rifles.
My new deployable cloaking device, witch cloaks all team players in a small area has been taking up my coding energy the last two days..
 

RockeyRex

Legions Developer
Just so everyone knows, if you get the auto-fire bug while using the LR, all you have to do is switch to LR, click once and it stops
This is also fixed for the next update. (You can atm replicate by holding the mouse while FIRING (not charging) the LR and swapping weapons.)
 
Top