Worst-case scenario: the UEd Goblin wipes the map and burns down your house.
Unreal Wiki:Scratchpad
From Unreal Wiki, The Unreal Engine Documentation Site
This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.
You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is 2008-09-11 08:19:42), you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything you removed.
Clean up after you're done!
//See Timer function for relevant code. Entire class is provided for context purposes. class EONSScorpionEnergyProjectileRed extends Projectile; #exec AUDIO IMPORT FILE="Sounds\DP_Explode.wav" NAME="DP_Explode" GROUP="Scorpion" var vector initialDir; var float FlyingDamageRadius; var class<Emitter> ProjectileEffectClass< SEMI > var Emitter ProjectileEffect; var class<xEmitter> HitEmitterClass< SEMI > var class<Emitter> ExplosionEmitterClass< SEMI > var bool bZap, bEffects; var byte Team; replication { reliable if(bNetDirty && Role==ROLE_Authority) bZap, Team; } simulated function PostBeginPlay() { local Rotator R; if (Level.NetMode != NM_DedicatedServer) { ProjectileEffect = spawn(ProjectileEffectClass, self,, Location, Rotation); ProjectileEffect.SetBase(self); } Super.PostBeginPlay(); Velocity = Speed * Vector(Rotation); R = Rotation; R.Roll = 32768; SetRotation(R); Velocity.z += TossZ; initialDir = Velocity; Team = Instigator.GetTeamNum(); //Use the timer for electromagnetic shocks while travelling SetTimer(0.05, True); //Was 0.05, upping to 0.20 to see if it reduces lag bEffects = false; } simulated function Destroyed() { //If we didn't zap someone, and destroy got called before we hit something (our lifetime probably expired), then explode if (!bZap) { if ( Role == ROLE_Authority ) { HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, Location); } } //If the explosion effects weren't previously called, we can call them now so our projectile always explodes a the end of its life if (!bEffects) SpawnEffects(vect(0,0,0),vect(0,0,0)); if (ProjectileEffect != None) ProjectileEffect.Destroy(); Super.Destroyed(); } simulated function ProcessTouch(Actor Other, Vector HitLocation) { if ( Other != Instigator ) { SpawnEffects(HitLocation, -1 * Normal(Velocity) ); bEffects = true; Explode(HitLocation,Normal(HitLocation-Other.Location)); } } simulated function SpawnEffects( vector HitLocation, vector HitNormal ) { if ( EffectIsRelevant(Location,false) ) { if (bZap) { spawn(class'xEffects.GoopSparks',,,Location); PlaySound(sound'WeaponSounds.BioRifle.BioRifleGoo1',,8*TransientSoundVolume); } else { PlaySound(ImpactSound,,8*TransientSoundVolume); } spawn(ExplosionEmitterClass,,,Location); spawn(class'ONSPlasmaHitGreen',,,Location); if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) ) Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal)); } } simulated function Landed( vector HitNormal ) { SpawnEffects( Location, HitNormal ); bEffects = true; Explode(Location,HitNormal); } simulated function HitWall (vector HitNormal, actor Wall) { Landed(HitNormal); } simulated function Explode(vector HitLocation, vector HitNormal) { Destroy(); } simulated function Timer() { local Vehicle Other; local Controller C, NextC; local xEmitter HitEmitter; local int TempDamage; bZap = false; C = Level.ControllerList; //Instead of using ForEach VisibleCollidingActors, lets traverse the Controller List, it may be faster //ForEach VisibleCollidingActors(class'Vehicle',Other,FlyingDamageRadius) while (C != None) { NextC = C.NextController; if (C.Pawn != None && Vehicle(C.Pawn) != None) log("C.Pawn != None && Vehicle(C.Pawn) != None is true. C.Pawn is a "$C.Pawn.class); else log("C.Pawn != None && Vehicle(C.Pawn) != None is false. C.Pawn is a "$C.Pawn.class); //if (Vehicle(C.Pawn) != None) // log("Vehicle(C.Pawn) != None is true"); //else log("Vehicle(C.Pawn) != None is false"); //if (C.Pawn != Instigator) // log("C.Pawn != Instigator is true"); //else log("C.Pawn != Instigator is false"); //if (C.Pawn.Health > 0) // log("C.Pawn.Health > 0 is true"); //else log("C.Pawn.Health > 0 is false"); if (!C.SameTeamAs(Instigator.Controller)) log("This target is on the opposite team"); else log("This target is on the same team."); if (VSize(C.Pawn.Location - Instigator.Location) < FlyingDamageRadius) log("This target is within the zap distance."); else log("This target is outside the zap distance."); if (FastTrace(C.Pawn.Location, Instigator.Location)) log("There is a clear shot to this target."); else log("There is not a clear shot to this target."); if ((Vehicle(C.Pawn).IsA('ONSHoverBike') || Vehicle(C.Pawn).IsA('ONSAttackCraft') || Vehicle(C.Pawn).IsA('ONSDualAttackCraft') || Vehicle(C.Pawn).IsA('ONSHoverCraft') )) log("This is one of our target vehicles."); else log("This is not one of our target vehicles."); //If the vehicle is not on our team, is being driven, has a clear trace between the projectile and the vehicle, and is of a specified type, then we proceed if ( C.Pawn != None && Vehicle(C.Pawn) != None && C.Pawn != Instigator && C.Pawn.Health > 0 && !C.SameTeamAs(Instigator.Controller) && VSize(C.Pawn.Location - Instigator.Location) < FlyingDamageRadius && FastTrace(C.Pawn.Location, Instigator.Location) && (Vehicle(C.Pawn).IsA('ONSHoverBike') || Vehicle(C.Pawn).IsA('ONSAttackCraft') || Vehicle(C.Pawn).IsA('ONSDualAttackCraft') || Vehicle(C.Pawn).IsA('ONSHoverCraft') ) ) { // log("Success!!!"); if ( Role == ROLE_Authority ) { if (Other.Health < 100 && Other.Health > 25) { TempDamage = Max(1,(Other.Health - 25)); Other.TakeDamage( TempDamage, Instigator, Other.Location, Normal(Location-Other.Location), MyDamageType); Other.DriverRadiusDamage( (TempDamage/3)+Rand(10), DamageRadius, Instigator.Controller, MyDamageType, MomentumTransfer, (Other.Location + VRand()*30) ); //We may need to change Hitlocation to Other.Location Other.EjectDriver(); bZap = true; } else { Other.TakeDamage(Damage, Instigator, Other.Location, Normal(Location-Other.Location), MyDamageType); Other.DriverRadiusDamage( (Damage/3)+Rand(10), DamageRadius, Instigator.Controller, MyDamageType, MomentumTransfer, Other.Location ); bZap = true; } //Log("Applying damage to nearby vehicle: "$(FlyingDamageRadius-(VSize(Location-Other.Location))) * Default.FlyingDamage/FlyingDamageRadius); } //Once this projectile has zapped something, draw the zap and then the projectile goes away. if (bZap) { HitEmitter = spawn(HitEmitterClass,,, Self.Location, rotator(Other.Location - Self.Location)); if (HitEmitter != None) HitEmitter.mSpawnVecA = Other.Location; Other.PlaySound(ImpactSound,,8*TransientSoundVolume); Self.Destroy(); } } C = NextC; } if (Velocity.Z > -1000) { Velocity.Z -= 30; } } defaultproperties { Speed=4500.000000 //4500/5000/4000 Damage=80.000000 DamageRadius=275.000000 //275/220 FlyingDamageRadius=1000.000000 //Because we reduced the frequency of the checks from .05 to .20, we increase the range here simply to increase the odds of it triggering successfully. Was 575/500/525/440 MomentumTransfer=50000.000000 LifeSpan=2.000000 //1.6 ProjectileEffectClass=class'EONSScorpionEnergyProjectileEffectRed' HitEmitterClass=class'EONSScorpionEnergyProjectileZapEmitter' ExplosionEmitterClass=class'ONSPlasmaHitRed' ExplosionDecal=class'LinkBoltScorch' DrawScale=0.3 AmbientGlow=100 CullDistance=+8000.0 TossZ=+0.0 //225.0 bFixedRotationDir=True DesiredRotation=(Pitch=12000,Yaw=5666,Roll=2334) bProjTarget=True bNetTemporary=True ImpactSound=Sound'DP_Explode' AmbientSound=Sound'WeaponSounds.BTranslocatorHoverModule' SoundRadius=100 SoundVolume=255 ForceType=FT_Constant ForceScale=5.0 ForceRadius=60.0 MyDamageType=class'DamTypeEONSScorpionEnergyProjectile' }