Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.82 KB | None | 0 0
  1. function SU()
  2. {
  3.     local Pawn Target;
  4.     local Vector NewTargetLoc;
  5.     local Vector OldTargetLoc;
  6.     local Vector MyLoc;
  7.     local Vector DuckLoc;
  8.     local Vector TargetLoc;
  9.     local Pawn NewTarget;
  10.     local Pawn Oldtarget;
  11.     local float newdist;
  12.     local float OldDist;
  13.     local Vector viewDirection;
  14.     local float Pioo;
  15.     local Rotator TargetRot;
  16.     local bool bISvisible;
  17.     local PlayerPawn PP;
  18.  
  19.     PP = ViewPort.Actor;
  20.  
  21.     GetAxes(PP.ViewRotation,Xer,Yer,Zer);
  22.     foreach PP.AllActors(Class'Pawn',Target)
  23.     {
  24.         if ( isavalidtarget(Target) )
  25.         {
  26.             bISvisible=isVisible(Target);
  27.             if ( isEnemy(Target))
  28.             {
  29.                 viewDirection=Target.Location - PP.Location - PP.EyeHeight * vect(0.00,0.00,1.00);
  30.                 if ( bISvisible && IsBehindme(viewDirection,Xer) )
  31.                 {
  32.                     NewTarget=Target;
  33.                     if ( Oldtarget == None )
  34.                     {
  35.                         Oldtarget=NewTarget;
  36.                     }
  37.                     if ( NewTarget != None )
  38.                     {
  39.                         newdist=VSize(NewTarget.Location - PP.Location);
  40.                         OldDist=VSize(Oldtarget.Location - PP.Location);
  41.                         if ( (newdist < OldDist) || (NewTarget.Health / 4 <= Oldtarget.Health) && (newdist < OldDist * 1.30) )
  42.                         {
  43.                             Oldtarget=NewTarget;
  44.                         }
  45.                     }
  46.                 }
  47.             }
  48.         }
  49.     }
  50.     if ( Oldtarget != None )
  51.     {
  52.         TargetLoc=Oldtarget.Location;
  53.         MyLoc=PP.Location;
  54.         TargetLoc.Z=TargetLoc.Z - Oldtarget.Default.BaseEyeHeight + Oldtarget.EyeHeight;
  55.         TargetLoc.Z=TargetLoc.Z + PP.Default.BaseEyeHeight - PP.EyeHeight;
  56.  
  57.             Pioo=PP.PlayerReplicationInfo.Ping + 200;//20;
  58.             TargetLoc += Oldtarget.Velocity * Pioo / 1000 + Oldtarget.Acceleration / 2 * Pioo / 1000 * Pioo / 1000;
  59.             if (PP.PlayerReplicationInfo.Ping > 1)
  60.             {
  61.                 if ( ((Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Jumping') || (Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Ducking')) && (Oldtarget.Velocity.Z < 370) && (Oldtarget.Velocity.Z > -370) )
  62.                 {
  63.                     TargetLoc.Z -= Oldtarget.Velocity.Z * Pioo / 1000 + Oldtarget.Acceleration.Z / 2 * Pioo / 1000 * Pioo / 1000;
  64.                 }
  65.             }
  66.  
  67.         if ( Oldtarget.GetAnimGroup(Oldtarget.AnimSequence) == 'Ducking' )
  68.         {
  69.             TargetLoc.Z -= 10;
  70.         }
  71.  
  72.         DuckLoc=TargetLoc - MyLoc;
  73.         TargetRot=rotator(DuckLoc);
  74.         if ( Oldtarget.Health > 0 )
  75.         {
  76.             if ( false )
  77.             {
  78.             }
  79.             else
  80.             {
  81. /*          if (PP.Weapon.IsA('handaxe')){
  82.                 TargetRot.Yaw *= HandaxeTConfig.YawFactor;
  83.                 TargetRot.Pitch *= HandaxeTConfig.PitchFactor;
  84.             }
  85.             else if (PP.Weapon.IsA('dwarfworkhammer')){
  86.                 TargetRot.Yaw *= DWHTConfig.YawFactor;
  87.                 TargetRot.Pitch *= DWHTConfig.PitchFactor;
  88.             }*/
  89.             PP.ViewRotation.Yaw = TargetRot.Yaw;
  90.             PP.ViewRotation.Pitch = TargetRot.Pitch;
  91.             }
  92.             Oldtarget=None;
  93.             NewTarget=None;
  94.         }
  95.         else
  96.         {
  97.             Oldtarget=None;
  98.             NewTarget=None;
  99.         }
  100.     }
  101. }
  102.  
  103. function bool isAValidTarget (Pawn Target)
  104. {
  105.     if(Target.Health > 0 && Target != ViewPort.Actor)
  106.     {
  107.         return True;
  108.     }
  109.     else
  110.     {
  111.         return False;
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement