Smoke39
16th Dec 2001, 03:35 PM
Why I didn't put my DynamicLoadObject question here is beyond me... Anyway, here's my new question.
This thing fires twice, one after the other, for every time you press fire.
function TraceFire(float accuracy)
{
local vector HitLocation, HitNormal, StartTrace, EndTrace, X, Y, Z;
local actor Other;
Owner.MakeNoise(Pawn(Owner).SoundDampening);
GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z;
AdjustedAim = pawn(owner).AdjustAim(1000000, StartTrace, AimError, False, False);
EndTrace = StartTrace + 120.0 * vector(AdjustedAim);
Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, StartTrace);
ProcessTraceHit(Other, HitLocation, HitNormal, vector(AdjustedAim), Y, Z);
}
function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
local int HitHeight, HitAngle;
if (Other == Level)
{
Spawn(class'SmallSpark2',,, HitLocation+HitNormal, Rotator(HitNormal));
}
else if (Other.IsA('Pawn'))
{
HitHeight = HitLocation.Z - Other.Location.Z;
HitAngle = (Other.Rotation.Yaw - rotator(HitLocation - Other.Location).Yaw) & 65535;
if (HitHeight > 0.72 * Other.CollisionHeight)
{
Other.TakeDamage(150, Pawn(Owner), HitLocation, 35000.0*X, 'Decapitated');
}
else if (HitHeight <= 0.72 * Other.CollisionHeight && HitHeight > 0.36 * Other.CollisionHeight)
{
Other.TakeDamage(40, Pawn(Owner), HitLocation, 32500.0*X, 'shot');
}
else if (HitHeight < 0.10 * Other.CollisionHeight)
{
Other.TakeDamage(10, Pawn(Owner), HitLocation, 27500.0*X, 'shot');
}
else
{
Other.TakeDamage(30, Pawn(Owner), HitLocation, 30000.0*X, 'shot');
}
}
else
Other.TakeDamage(35, Pawn(Owner), HitLocation, 30000.0*X, 'shot');
}
function Fire( float Value )
{
if (Mode=="Blades")
{
GoToState('BladesFire');
}
else
{
GotoState('NormalFire');
if ( PlayerPawn(Owner) != None )
PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
bPointing=True;
// PlayFiring();
if ( !bRapidFire && (FiringSpeed > 0) )
Pawn(Owner).PlayRecoil(FiringSpeed);
ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
if ( Owner.bHidden )
CheckVisibility();
}
}
state BladesFire
{
ignores Fire, AltFire;
Begin:
FinishAnim();
CheckVisibility();
bPointing=True;
PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
PlayAnim( Anim, AnimRate, 0.1);
Owner.MakeNoise(2.0 * Pawn(Owner).SoundDampening);
Owner.PlaySound(FireSound, SLOT_None,Pawn(Owner).SoundDampening*3);
TraceFire(0);
Finish();
}
Anyone know why?
This thing fires twice, one after the other, for every time you press fire.
function TraceFire(float accuracy)
{
local vector HitLocation, HitNormal, StartTrace, EndTrace, X, Y, Z;
local actor Other;
Owner.MakeNoise(Pawn(Owner).SoundDampening);
GetAxes(Pawn(owner).ViewRotation, X, Y, Z);
StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z;
AdjustedAim = pawn(owner).AdjustAim(1000000, StartTrace, AimError, False, False);
EndTrace = StartTrace + 120.0 * vector(AdjustedAim);
Other = Pawn(Owner).TraceShot(HitLocation, HitNormal, EndTrace, StartTrace);
ProcessTraceHit(Other, HitLocation, HitNormal, vector(AdjustedAim), Y, Z);
}
function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
local int HitHeight, HitAngle;
if (Other == Level)
{
Spawn(class'SmallSpark2',,, HitLocation+HitNormal, Rotator(HitNormal));
}
else if (Other.IsA('Pawn'))
{
HitHeight = HitLocation.Z - Other.Location.Z;
HitAngle = (Other.Rotation.Yaw - rotator(HitLocation - Other.Location).Yaw) & 65535;
if (HitHeight > 0.72 * Other.CollisionHeight)
{
Other.TakeDamage(150, Pawn(Owner), HitLocation, 35000.0*X, 'Decapitated');
}
else if (HitHeight <= 0.72 * Other.CollisionHeight && HitHeight > 0.36 * Other.CollisionHeight)
{
Other.TakeDamage(40, Pawn(Owner), HitLocation, 32500.0*X, 'shot');
}
else if (HitHeight < 0.10 * Other.CollisionHeight)
{
Other.TakeDamage(10, Pawn(Owner), HitLocation, 27500.0*X, 'shot');
}
else
{
Other.TakeDamage(30, Pawn(Owner), HitLocation, 30000.0*X, 'shot');
}
}
else
Other.TakeDamage(35, Pawn(Owner), HitLocation, 30000.0*X, 'shot');
}
function Fire( float Value )
{
if (Mode=="Blades")
{
GoToState('BladesFire');
}
else
{
GotoState('NormalFire');
if ( PlayerPawn(Owner) != None )
PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
bPointing=True;
// PlayFiring();
if ( !bRapidFire && (FiringSpeed > 0) )
Pawn(Owner).PlayRecoil(FiringSpeed);
ProjectileFire(ProjectileClass, ProjectileSpeed, bWarnTarget);
if ( Owner.bHidden )
CheckVisibility();
}
}
state BladesFire
{
ignores Fire, AltFire;
Begin:
FinishAnim();
CheckVisibility();
bPointing=True;
PlayerPawn(Owner).ShakeView(ShakeTime, ShakeMag, ShakeVert);
PlayAnim( Anim, AnimRate, 0.1);
Owner.MakeNoise(2.0 * Pawn(Owner).SoundDampening);
Owner.PlaySound(FireSound, SLOT_None,Pawn(Owner).SoundDampening*3);
TraceFire(0);
Finish();
}
Anyone know why?