class SchlonzLinkRocket extends RocketProj; var Actor Seeking; var vector InitialDir; var float lockon; var() float AwarenessRadius; var Pawn Victim; replication { reliable if( bNetInitial && (Role==ROLE_Authority) ) Seeking, InitialDir; } simulated function PostBeginPlay() { if ( Level.NetMode != NM_DedicatedServer) { Corona = Spawn( class'RocketCorona',self ); } Dir = vector( Rotation ); Velocity = speed * Dir; if( PhysicsVolume.bWaterVolume ) { bHitWater = True; Velocity=0.6*Velocity; } if( Level.bDropDetail ) { bDynamicLight = false; LightType = LT_None; } Seeking = None; SetTimer( 0.1, true ); } // PostBeginPlay simulated function Explode(vector HitLocation, vector HitNormal) { PlaySound( sound'WeaponSounds.BExplosion3',,2.5*TransientSoundVolume ); if( EffectIsRelevant(Location,false) ) { Spawn( class'SchlonzRocketExplosion',,,HitLocation + HitNormal*16,rotator( HitNormal ) ); Spawn( class'ExplosionCrap',,, HitLocation, rotator( HitNormal ) ); if( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) ) Spawn( ExplosionDecal,self,,Location, rotator(-HitNormal) ); } BlowUp( HitLocation ); Destroy(); } // Explode function ChooseVictim() { local Vector StartTrace; local Rotator Aim; local float BestAim; local float BestDist; local float SeekRange; if( Instigator == None ) { Seeking = None; return; } BestAim = 0.999; // 2 Degree BestDist = 7000; SeekRange = 10000; StartTrace = Instigator.Location + Instigator.EyePosition(); Aim = Instigator.GetViewRotation(); Seeking = Instigator.Controller.PickTarget( BestAim, BestDist, Vector(Aim), StartTrace, SeekRange ); } // ChooseVictim simulated function Timer() { local vector ForceDir; local float VelMag; if( Seeking == None ) ChooseVictim(); if( InitialDir == vect(0,0,0) ) InitialDir = Normal( Velocity ); Acceleration = vect(0,0,0); Super.Timer(); if( (Seeking != None) && (Seeking != Instigator) ) { // Do normal guidance to target. ForceDir = Normal( Seeking.Location - Location ); if( (ForceDir Dot InitialDir) > -0.5 ) { VelMag = VSize( Velocity ); ForceDir = Normal( ForceDir * 2 * VelMag + Velocity ); Velocity = VelMag * ForceDir; Acceleration = 4 * ForceDir; } // Update rocket so it faces in the direction its going. SetRotation( rotator( Velocity ) ); } } // Timer defaultproperties { AwarenessRadius=2000.000000 Speed=3500.000000 MaxSpeed=3500.000000 Damage=50.000000 DamageRadius=250.000000 MomentumTransfer=80000.000000 LifeSpan=10.000000 DrawScale=0.500000 bBounce=True }