[PSI]PsySniper
11-26-2007, 09:34 AM
I am trying to bring back an old feature from the old Rifle Mutators for UT2004
( Pro-Sniper Zark Rifle ), I want to be able to change the fire rate, so when
players run, Rifle Rifle Fire-Rate becomes slow, when you crouch, the fire rate
becomes fast.
Here is the problem, I actually managed to Increase and Decrease Fire-Rate,
the problem is, as long I hold the Fire button, Fire-Rate will continue to be fast
or slow no mater what I do...
Example:
When I crouch and fire, fire rate will be fast, but then if I start to run,
it will continue to be fast as long I hold the fire button.
Here is the code I have been working on:
simulated function ProcessInstantHit( byte FiringMode, ImpactInfo Impact )
{
local float Scaling;
local int HeadDamage;
if( (Role == Role_Authority) && !bUsingAimingHelp )
{
if (Instigator == None || VSize(Instigator.Velocity) < Instigator.GroundSpeed * Instigator.CrouchedPct)
{
Scaling = SlowHeadshotScale;
FireInterval[0] = 0.150000;
FireInterval[1] = 0.150000;
}
else
{
Scaling = RunningHeadshotScale;
FireInterval[0] = 0.900000;
FireInterval[1] = 0.900000;
}
HeadDamage = InstantHitDamage[FiringMode]* HeadShotDamageMult;
if ( (UTPawn(Impact.HitActor) != None && UTPawn(Impact.HitActor).TakeHeadShot(Impact, HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) ||
(UTVehicleBase(Impact.HitActor) != None && UTVehicleBase(Impact.HitActor).TakeHeadShot(Impact , HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) )
{
SetFlashLocation(Impact.HitLocation);
return;
}
}
super.ProcessInstantHit( FiringMode, Impact );
}
And here is another version, but with the same results...
simulated function ProcessInstantHit( byte FiringMode, ImpactInfo Impact )
{
local float Scaling;
local int HeadDamage;
If( Instigator.bIsCrouched || VSize(Instigator.Velocity) <= 300.0 )
{
FireInterval[0] = 0.150000;
FireInterval[1] = 0.150000;
}
else
{
FireInterval[0] = 0.900000;
FireInterval[1] = 0.900000;
}
if( (Role == Role_Authority) && !bUsingAimingHelp )
{
if (Instigator == None || VSize(Instigator.Velocity) < Instigator.GroundSpeed * Instigator.CrouchedPct)
{
Scaling = SlowHeadshotScale;
}
else
{
Scaling = RunningHeadshotScale;
}
HeadDamage = InstantHitDamage[FiringMode]* HeadShotDamageMult;
if ( (UTPawn(Impact.HitActor) != None && UTPawn(Impact.HitActor).TakeHeadShot(Impact, HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) ||
(UTVehicleBase(Impact.HitActor) != None && UTVehicleBase(Impact.HitActor).TakeHeadShot(Impact , HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) )
{
SetFlashLocation(Impact.HitLocation);
return;
}
}
super.ProcessInstantHit( FiringMode, Impact );
}
Can anyone tell me what I am doing wrong?
Even if the code I added is bad, I have a feeling the original head-shot scale
function will also be affected by holding the fire button....
( Pro-Sniper Zark Rifle ), I want to be able to change the fire rate, so when
players run, Rifle Rifle Fire-Rate becomes slow, when you crouch, the fire rate
becomes fast.
Here is the problem, I actually managed to Increase and Decrease Fire-Rate,
the problem is, as long I hold the Fire button, Fire-Rate will continue to be fast
or slow no mater what I do...
Example:
When I crouch and fire, fire rate will be fast, but then if I start to run,
it will continue to be fast as long I hold the fire button.
Here is the code I have been working on:
simulated function ProcessInstantHit( byte FiringMode, ImpactInfo Impact )
{
local float Scaling;
local int HeadDamage;
if( (Role == Role_Authority) && !bUsingAimingHelp )
{
if (Instigator == None || VSize(Instigator.Velocity) < Instigator.GroundSpeed * Instigator.CrouchedPct)
{
Scaling = SlowHeadshotScale;
FireInterval[0] = 0.150000;
FireInterval[1] = 0.150000;
}
else
{
Scaling = RunningHeadshotScale;
FireInterval[0] = 0.900000;
FireInterval[1] = 0.900000;
}
HeadDamage = InstantHitDamage[FiringMode]* HeadShotDamageMult;
if ( (UTPawn(Impact.HitActor) != None && UTPawn(Impact.HitActor).TakeHeadShot(Impact, HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) ||
(UTVehicleBase(Impact.HitActor) != None && UTVehicleBase(Impact.HitActor).TakeHeadShot(Impact , HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) )
{
SetFlashLocation(Impact.HitLocation);
return;
}
}
super.ProcessInstantHit( FiringMode, Impact );
}
And here is another version, but with the same results...
simulated function ProcessInstantHit( byte FiringMode, ImpactInfo Impact )
{
local float Scaling;
local int HeadDamage;
If( Instigator.bIsCrouched || VSize(Instigator.Velocity) <= 300.0 )
{
FireInterval[0] = 0.150000;
FireInterval[1] = 0.150000;
}
else
{
FireInterval[0] = 0.900000;
FireInterval[1] = 0.900000;
}
if( (Role == Role_Authority) && !bUsingAimingHelp )
{
if (Instigator == None || VSize(Instigator.Velocity) < Instigator.GroundSpeed * Instigator.CrouchedPct)
{
Scaling = SlowHeadshotScale;
}
else
{
Scaling = RunningHeadshotScale;
}
HeadDamage = InstantHitDamage[FiringMode]* HeadShotDamageMult;
if ( (UTPawn(Impact.HitActor) != None && UTPawn(Impact.HitActor).TakeHeadShot(Impact, HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) ||
(UTVehicleBase(Impact.HitActor) != None && UTVehicleBase(Impact.HitActor).TakeHeadShot(Impact , HeadShotDamageType, HeadDamage, Scaling, Instigator.Controller)) )
{
SetFlashLocation(Impact.HitLocation);
return;
}
}
super.ProcessInstantHit( FiringMode, Impact );
}
Can anyone tell me what I am doing wrong?
Even if the code I added is bad, I have a feeling the original head-shot scale
function will also be affected by holding the fire button....