Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SU()
- {
- local Pawn Target;
- local Vector NewTargetLoc;
- local Vector OldTargetLoc;
- local Vector MyLoc;
- local Vector DuckLoc;
- local Vector TargetLoc;
- local Pawn NewTarget;
- local Pawn Oldtarget;
- local float newdist;
- local float OldDist;
- local Vector viewDirection;
- local float Pioo;
- local Rotator TargetRot;
- local bool bISvisible;
- local PlayerPawn PP;
- PP = ViewPort.Actor;
- GetAxes(PP.ViewRotation,Xer,Yer,Zer);
- foreach PP.AllActors(Class'Pawn',Target)
- {
- if ( isavalidtarget(Target) )
- {
- bISvisible=isVisible(Target);
- if ( isEnemy(Target))
- {
- viewDirection=Target.Location - PP.Location - PP.EyeHeight * vect(0.00,0.00,1.00);
- if ( bISvisible && IsBehindme(viewDirection,Xer) )
- {
- NewTarget=Target;
- if ( Oldtarget == None )
- {
- Oldtarget=NewTarget;
- }
- if ( NewTarget != None )
- {
- newdist=VSize(NewTarget.Location - PP.Location);
- OldDist=VSize(Oldtarget.Location - PP.Location);
- if ( (newdist < OldDist) || (NewTarget.Health / 4 <= Oldtarget.Health) && (newdist < OldDist * 1.30) )
- {
- Oldtarget=NewTarget;
- }
- }
- }
- }
- }
- }
- if ( Oldtarget != None )
- {
- TargetLoc=Oldtarget.Location;
- MyLoc=PP.Location;
- TargetLoc.Z=TargetLoc.Z - Oldtarget.Default.BaseEyeHeight + Oldtarget.EyeHeight;
- TargetLoc.Z=TargetLoc.Z + PP.Default.BaseEyeHeight - PP.EyeHeight;
- Pioo=PP.PlayerReplicationInfo.Ping + 200;//20;
- TargetLoc += Oldtarget.Velocity * Pioo / 1000 + Oldtarget.Acceleration / 2 * Pioo / 1000 * Pioo / 1000;
- if (PP.PlayerReplicationInfo.Ping > 1)
- {
- if ( ((Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Jumping') || (Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Ducking')) && (Oldtarget.Velocity.Z < 370) && (Oldtarget.Velocity.Z > -370) )
- {
- TargetLoc.Z -= Oldtarget.Velocity.Z * Pioo / 1000 + Oldtarget.Acceleration.Z / 2 * Pioo / 1000 * Pioo / 1000;
- }
- }
- if ( Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Ducking' )
- {
- TargetLoc.Z -= 10;
- }
- DuckLoc=TargetLoc - MyLoc;
- TargetRot=rotator(DuckLoc);
- if ( Oldtarget.Health > 0 )
- {
- if ( false )
- {
- }
- else
- {
- /* if (PP.Weapon.IsA('handaxe')){
- TargetRot.Yaw *= HandaxeTConfig.YawFactor;
- TargetRot.Pitch *= HandaxeTConfig.PitchFactor;
- }
- else if (PP.Weapon.IsA('dwarfworkhammer')){
- TargetRot.Yaw *= DWHTConfig.YawFactor;
- TargetRot.Pitch *= DWHTConfig.PitchFactor;
- }*/
- PP.ViewRotation.Yaw = TargetRot.Yaw;
- PP.ViewRotation.Pitch = TargetRot.Pitch;
- }
- Oldtarget=None;
- NewTarget=None;
- }
- else
- {
- Oldtarget=None;
- NewTarget=None;
- }
- }
- }
- function bool isAValidTarget (Pawn Target)
- {
- if(Target.Health > 0 && Target != ViewPort.Actor)
- {
- return True;
- }
- else
- {
- return False;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement