//============================================================================= // SchlonzShockMagicProj. //============================================================================= class SchlonzShockMagicProj expands ShockProj; var() int detectionRadius; var() float rocketInterval; auto state Flying { function BeginState() { Velocity = vector(Rotation) * speed; if( Instigator.IsA('PlayerPawn') ) { SetTimer( rocketInterval, true ); } else { SetTimer( rocketInterval*2.0, true ); } //Disable( 'Tick' ); } function Timer() { local Pawn p; foreach VisibleActors( class 'Pawn', p, detectionRadius ) { // if( ( p.IsA('PlayerPawn') || p.IsA('Bot') ) && not needed ? if( p != Instigator && p.Health > 0 && ( !Level.Game.bTeamGame || p.PlayerReplicationInfo == None || Instigator.PlayerReplicationInfo.Team != p.PlayerReplicationInfo.Team ) && FastTrace( p.Location ) ) { SpawnRocket( p ); } } } } /* function SpawnRocket( Pawn p ) { local vector Start; local vector rot; local UT_SeekingRocket rocket; Start = Normal(p.Location - Location) * 10 + 2 * VRand(); rocket= Spawn(class'UT_SeekingRocket ',,,Location+Start,Rotator(Start)); //rocket.setTarget( p ); rocket.Seeking = p; } */ function SpawnRocket( Pawn p ) { local vector Start; local vector rot; local UT_SeekingRocket rocket; local bool ok; local float cosine; local float sineSq; local float instDist; ok = true; if( Instigator != None ) { cosine = Normal(Instigator.Location-Location) Dot Normal(p.Location-Location); if( cosine > 0 ) { // enemy might be behind instigator sineSq = 1 - cosine*cosine; instDist = VSize(Instigator.Location-Location); if( (sineSq * instDist * instDist) < 20000 ) { // too near fly by ok = false; } } else { // enemy is away from instigator if( VSize( Instigator.Location - p.Location ) < 150 ) { // distance to the enemy too small ok = false; } } } if( ok ) { Start = Normal(p.Location - Location) * 10 + 2 * VRand(); rocket= Spawn(class'UT_SeekingRocket ',,,Location+Start,Rotator(Start)); rocket.Seeking = p; } } defaultproperties { detectionRadius=600 rocketInterval=0.150000 }