From Gustavo6046, 2 Weeks ago, written in UnrealScript.
Embed
  1. class TrailSpawner extends Info;
  2.  
  3. var(Trail)  Texture         TrailSkin;
  4. var(Trail)  class<Actor>    TrailType;
  5. var(Trail)  float           UnitLength;
  6. var(Trail)  float           Precision;
  7. var(Trail)  float           TrailLength;
  8. var(Trail)  float           Thickness;
  9. var         Vector          LastPos;
  10. var         Actor           T;
  11.  
  12. /*
  13. simulated function Destroyed()
  14. {
  15.     SetTimer(0.0, false);
  16. }
  17. */
  18.  
  19. simulated static function TrailSpawner MakeTrail(Actor Other)
  20. {
  21.     return Other.Spawn(class'TrailSpawner', Other);
  22. }
  23.  
  24. simulated function PreBeginPlay()
  25. {
  26.     if ( Owner == None || Precision == 0 )
  27.         Destroy();
  28. }
  29.  
  30. simulated function PostBeginPlay()
  31. {
  32.     LastPos = Owner.Location;
  33.     SetTimer(1.0 / Precision, true);
  34.     // Log("Trail interval in seconds:"@1.0 / Precision);
  35. }
  36.  
  37. simulated function Tick(float TimeDelta)
  38. {
  39.     local Actor A;
  40.  
  41.     if ( Owner == None )
  42.     {
  43.         foreach AllActors(TrailType, A)
  44.             if ( A.Owner == self )
  45.    
  46.         Destroy();
  47.     }
  48. }
  49.  
  50. simulated function Timer()
  51. {
  52.     if ( Owner == None )
  53.     {
  54.         Destroy();
  55.         return;
  56.     }
  57.  
  58.     T = Spawn(TrailType, Owner,, LastPos, Rotator(Owner.Location - LastPos));
  59.    
  60.     if ( T == None )
  61.     {
  62.         Destroy();
  63.         return;
  64.     }
  65.    
  66.     T.Lifespan = TrailLength / UnitLength;
  67.     T.DrawScale = VSize(Owner.Location - LastPos) / UnitLength;
  68.    
  69.     if ( Projectile(T) != None )
  70.         Projectile(T).Speed = 0;
  71.        
  72.     T.SetPhysics(PHYS_None);
  73.     T.Velocity = vect(0,0,0);
  74.     T.Skin = TrailSkin;
  75.     T.Texture = TrailSkin;
  76.     T.LightType = LT_None;
  77.    
  78.     // Log("Trail scale for"@Owner@"is"@T.DrawScale@"where distance is"@VSize(Owner.Location - LastPos));
  79.     // Log("Trail lifespan for"@Owner@"is"@T.Lifespan@"where the length in sizes is "@TrailLength/UnitLength$");
  80.    
  81.     LastPos = Owner.Location;
  82. }
  83.  
  84. defaultproperties
  85. {
  86.     TrailSkin=Texture'Botpack.AmmoCount.AmmoCountJunk'
  87.     TrailType=class'UnrealI.Tracer'
  88.     UnitLength=320
  89.     Precision=16
  90.     TrailLength=128
  91.     Thickness=8
  92. }