Author Topic: Anti-QQ glitch.  (Read 1134 times)

I'm trying to fix up this revolver mod but there is a QQ glitch on it which is devastating because it's a 2 hit kill weapon. How can I prevent this exploit?

Look at the rocket launcher code.

Look at the rocket launcher code.

Code: [Select]
  // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = sfRevolverProjectile;
   projectileType = Projectile;

casing = sfRevolverShellDebris;
shellExitDir        = "1.0 -1.3 1.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 15.0;
shellVelocity       = 7.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;
minShotTime = 1000;   //minimum time allowed between shots (needed to prevent equip/dequip exploit)

I added this and it doesn't work.

stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 1.0;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0]               = weaponSwitchSound;

stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 1.0;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0]               = weaponSwitchSound;

That isn't a solution to the problem, that just puts people actually switching to the rocket launcher at a disadvantage.

So how can I fix it because minshottime does not work.

Try this:
Code: [Select]
stateTimeoutValue[2] = 0.075;

0.075 won't make much of a difference

0.075 won't make much of a difference
except for preventing auto fire with the rapid tools script, which i think is on a 33 schedule instead of something higher than 75

except for preventing auto fire with the rapid tools script, which i think is on a 33 schedule instead of something higher than 75
hes trying to stop them from pressing Q firing then pressing Q again and repeating, the revolver probably already has a delay of atleast 0.075

I added this and it doesn't work.

Are you using a custom OnFire function?

doesn't all of the default stuff have this built in?
i remember looking through the code once and seeing something about sim time which made it work

doesn't all of the default stuff have this built in?
i remember looking through the code once and seeing something about sim time which made it work
You can only do it the way the default stuff does it if you use the default onFire function.

@Tony, try looking at this:
http://forum.returntoblockland.com/dlm/viewFile.php?id=13

this?
i think this is what i saw before, i was looking at the spread for something
Code: [Select]
function shotgunImage::onFire(%this,%obj,%slot)
{
if((%obj.lastFireTime+%this.minShotTime) > getSimTime())
return;
%obj.lastFireTime = getSimTime();
just the top of the function

Code: [Select]
// Weapon Image

datablock ShapeBaseImageData(sfRevolverImage)
{
   // Basic Item properties
   shapeFile = "./revolver.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = BowItem;
   ammo = " ";
   projectile = sfRevolverProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;
minShotTime = 1000;   //minimum time allowed between shots (needed to prevent equip/dequip exploit)


   doColorShift = false;

   //casing = " ";

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.15;
stateTransitionOnTimeout[0]      = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;
stateSequence[1]          = "Ready";

stateName[2]                     = "Fire";
stateTransitionOnTimeout[2]      = "Smoke";
stateTimeoutValue[2]             = 0.14;
stateFire[2]                     = true;
stateAllowImageChange[2]         = false;
stateSequence[2]                 = "Fire";
stateScript[2]                   = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = sfRevolverFlashEmitter;
stateEmitterTime[2] = 0.06;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = sfRevolverShotSound;
stateEjectShell[2]               = true;

stateName[3]                     = "Smoke";
stateEmitter[3] = sfRevolverSmokeEmitter;
stateEmitterTime[3] = 0.05;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3]             = 0.5;
stateTransitionOnTimeout[3]      = "Reload";

stateName[4] = "Reload";
stateSequence[4]                 = "Reload";
stateTransitionOnTriggerUp[4]    = "Ready";
stateSequence[4]          = "Ready";

};

//-----------------------------------------------------------------------------
// Script

function SFRevolverImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
%projectile = %this.projectile;
%spread = 0.00185;
%shellcount = 1;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

Can anyone see what's wrong with it?