class SchlonzScorpionRocketProjectile extends Projectile; #exec OBJ LOAD FILE=..\Sounds\VMVehicleSounds-S.uax var Actor HomingTarget; var vector InitialDir; var Emitter SmokeTrailEffect; var Effects Corona; replication { reliable if (bNetInitial && Role == ROLE_Authority) InitialDir, HomingTarget; } simulated function Destroyed() { if ( SmokeTrailEffect != None ) SmokeTrailEffect.Kill(); if ( Corona != None ) Corona.Destroy(); Super.Destroyed(); } simulated function PostBeginPlay() { if (Level.NetMode != NM_DedicatedServer) { SmokeTrailEffect = Spawn(class'SchlonzUT.SchlonzScorpionRocketProjectileTrail',,, Location, Rotation); if ( Instigator.GetTeamNum() == 0 ) // Red Team version { SmokeTrailEffect.Emitters[0].Texture = Texture'AS_FX_TX.Trails.Trail_Red'; //SmokeTrailEffect.Emitters[1].ColorScale[0].Color = class'Canvas'.static.MakeColor(200, 64, 64); //SmokeTrailEffect.Emitters[1].ColorScale[1].Color = class'Canvas'.static.MakeColor(200, 64, 64); } SmokeTrailEffect.SetBase( Self ); Corona = Spawn(class'RocketCorona',self); Corona.SetDrawScale(0.02 * Corona.default.DrawScale); } InitialDir = vector(Rotation); Velocity = InitialDir * Speed; if (PhysicsVolume.bWaterVolume) Velocity = 0.6 * Velocity; SetTimer(0.1, true); Super.PostBeginPlay(); } simulated function Timer() { local float VelMag; local vector ForceDir; if (HomingTarget == None) return; ForceDir = Normal(HomingTarget.Location - Location); if (ForceDir dot InitialDir > 0) { // Do normal guidance to target. VelMag = VSize(Velocity); ForceDir = Normal(ForceDir * 0.75 * VelMag + Velocity); Velocity = VelMag * ForceDir; Acceleration = 5 * ForceDir; // Update rocket so it faces in the direction its going. SetRotation(rotator(Velocity)); } } simulated function Landed( vector HitNormal ) { Explode(Location,HitNormal); } simulated function ProcessTouch (Actor Other, Vector HitLocation) { if ( (Other != instigator) && (!Other.IsA('Projectile') || Other.bProjTarget) ) { Explode(HitLocation, vect(0,0,1)); } } function BlowUp(vector HitLocation) { HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, HitLocation ); MakeNoise(1.0); } simulated function Explode(vector HitLocation, vector HitNormal) { local PlayerController PC; PlaySound(sound'WeaponSounds.BExplosion3',,2.5*TransientSoundVolume); if ( EffectIsRelevant(Location,false) ) { Spawn(class'NewExplosionA',,,HitLocation + HitNormal*20,rotator(HitNormal)); PC = Level.GetLocalPlayerController(); if ( (PC.ViewTarget != None) && VSize(PC.ViewTarget.Location - Location) < 5000 ) Spawn(class'ExplosionCrap',,, HitLocation + HitNormal*20, rotator(HitNormal)); } BlowUp(HitLocation); Destroy(); } defaultproperties { // DrawScale=0.100000 Speed=2500.000000 MaxSpeed=3500.000000 Damage=100.000000 DamageRadius=250.000000 MomentumTransfer=10000.000000 MyDamageType=XWeapons.DamTypeRocket ExplosionDecal=Onslaught.ONSRocketScorch DrawType=DT_StaticMesh StaticMesh=WeaponStaticMesh.RocketProj AmbientSound=VMVehicleSounds-S.HoverTank.IncomingShell LifeSpan=7.000000 DrawScale3D=(Y=0.100000,Z=0.100000) AmbientGlow=96 FluidSurfaceShootStrengthMod=10.000000 SoundVolume=255 bFixedRotationDir=True RotationRate=(Roll=50000) DesiredRotation=(Roll=900000) ForceType=FT_Constant ForceRadius=100.000000 ForceScale=5.000000 } /* //============================================================================= // PROJ_SpaceFighter_Rocket //============================================================================= class SchlonzScorpionRocketProjectile extends Projectile; var bool bHitWater, bWaterStart; var vector Dir; // FX var Emitter TrailEmitter; var class TrailClass; //Homing var Actor HomingTarget; var vector InitialDir; var float HomingAggressivity; var float HomingCheckFrequency, HomingCheckCount; replication { reliable if (bNetInitial && Role==ROLE_Authority) HomingTarget; } simulated function Destroyed() { if ( TrailEmitter != None ) TrailEmitter.Destroy(); Super.Destroyed(); } simulated function PostBeginPlay() { super.PostBeginPlay(); if ( PhysicsVolume.bWaterVolume ) { bHitWater = true; Velocity = 0.6 * Velocity; } } simulated function PostNetBeginPlay() { super.PostNetBeginPlay(); Dir = Vector(Rotation); // Add Instigator's velocity to projectile if ( Instigator != None ) { Speed = 2000 + Instigator.Velocity Dot Dir; Velocity = Speed * Dir + (Vect(0,0,-1)>>Instigator.Rotation) * 100.f; } // Rockets is done falling, now it's flying SpawnTrail(); Velocity = Speed * Dir; GotoState('Flying'); } simulated function SpawnTrail() { if ( Level.NetMode == NM_DedicatedServer || Instigator == None ) return; TrailEmitter = Spawn(TrailClass,,, Location, Rotation); if ( TrailEmitter == None ) return; if ( Instigator.GetTeamNum() == 0 ) // Red Team version { TrailEmitter.Emitters[0].Texture = Texture'AS_FX_TX.Trails.Trail_Red'; TrailEmitter.Emitters[1].ColorScale[0].Color = class'Canvas'.static.MakeColor(200, 64, 64); TrailEmitter.Emitters[1].ColorScale[1].Color = class'Canvas'.static.MakeColor(200, 64, 64); } TrailEmitter.SetBase( Self ); } state Flying { simulated function Tick(float DeltaTime) { local vector ForceDir; local float VelMag; // Homing if ( HomingTarget != None && HomingTarget != Instigator && (default.LifeSpan-LifeSpan) > default.LifeSpan * 0.18 ) { HomingCheckCount += DeltaTime; if ( HomingCheckCount > HomingCheckFrequency ) { HomingCheckCount -= HomingCheckFrequency; if ( InitialDir == vect(0,0,0) ) InitialDir = Normal(Velocity); ForceDir = Normal(HomingTarget.Location - Location); if ( (ForceDir Dot InitialDir ) > 0 ) { VelMag = VSize(Velocity); ForceDir = Normal(ForceDir * HomingAggressivity * VelMag + Velocity); Velocity = VelMag * ForceDir; Acceleration += 5 * ForceDir; HomingAggressivity += HomingAggressivity * 0.03; } else if ( Role == Role_Authority && HomingTarget != None ) { HomingTarget = None; } // Update rocket so it faces in the direction its going. SetRotation( rotator(Velocity) ); } } // Increase Speed progressively Speed += 2000.f * DeltaTime; Acceleration = vector(Rotation) * Speed; } simulated function Landed( vector HitNormal ) { Explode(Location,HitNormal); } function BlowUp(vector HitLocation) { HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, Location ); MakeNoise(1.0); } } simulated function ProcessTouch (Actor Other, Vector HitLocation) { if ( (Other != instigator) && (!Other.IsA('Projectile') || Other.bProjTarget) ) { //log("PROJ_SpaceFighter_Rocket::ProcessTouch Other:"@Other@"bCollideActors:"@Other.bCollideActors@"bBlockActors:"@Other.bBlockActors); Explode(HitLocation,Vect(0,0,1)); } } simulated function Explode(vector HitLocation, vector HitNormal) { local PlayerController PC; PlaySound(sound'WeaponSounds.BExplosion3',, 2.5*TransientSoundVolume); if ( TrailEmitter != None ) { TrailEmitter.Kill(); TrailEmitter = None; } if ( EffectIsRelevant(Location, false) ) { Spawn(class'NewExplosionA',,, HitLocation + HitNormal*16, rotator(HitNormal)); PC = Level.GetLocalPlayerController(); if ( (PC.ViewTarget != None) && VSize(PC.ViewTarget.Location - Location) < 5000 ) Spawn(class'ExplosionCrap',,, HitLocation, rotator(HitNormal)); if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) ) Spawn(ExplosionDecal,self,,Location, rotator(-HitNormal)); } BlowUp( HitLocation + HitNormal * 2.f ); Destroy(); } //============================================================================= // defaultproperties //============================================================================= defaultproperties { TrailClass=UT2k4AssaultFull.FX_SpaceFighter_Rocket_Trail HomingAggressivity=0.250000 HomingCheckFrequency=0.067000 MaxSpeed=20000.000000 Damage=400.000000 DamageRadius=512.000000 MomentumTransfer=50000.000000 MyDamageType=UT2k4AssaultFull.DamTypeSpaceFighterMissile ExplosionDecal=XEffects.RocketMark DrawType=DT_StaticMesh StaticMesh=WeaponStaticMesh.RocketProj AmbientSound=WeaponSounds.RocketLauncher.RocketLauncherProjectile LifeSpan=4.000000 AmbientGlow=32 SoundVolume=255 SoundRadius=100.000000 bFixedRotationDir=True RotationRate=(Roll=50000) DesiredRotation=(Roll=30000) ForceType=FT_Constant ForceRadius=100.000000 ForceScale=5.000000 } */