Core.Object | +--Engine.Actor | +--Engine.Pawn | +--UnrealShare.FlockMasterPawn | +--UnrealShare.HorseFlySwarm
bool
bOnlyIfEnemy
float
swarmradius
byte
swarmsize
void
PreBeginPlay()
SpawnFlies()
ZoneChange(ZoneInfo NewZone)
EnemyNotVisible()
SeePlayer(Actor SeenPlayer)
00001 //============================================================================= 00002 // HorseFlySwarm. 00003 //============================================================================= 00004 class HorseFlySwarm extends FlockMasterPawn; 00005 00006 var() byte swarmsize; //number of horseflies in swarm 00007 var byte totalflies; 00008 var() bool bOnlyIfEnemy; 00009 var() float swarmradius; 00010 00011 function PreBeginPlay() 00012 { 00013 totalflies = swarmsize; 00014 Super.PreBeginPlay(); 00015 } 00016 00017 singular function ZoneChange( ZoneInfo NewZone ) 00018 { 00019 if (NewZone.bWaterZone /* || NewZone.bPainZone */) 00020 { 00021 SetLocation(OldLocation); 00022 Velocity = vect(0,0,0); 00023 Acceleration = vect(0,0,0); 00024 MoveTimer = -1.0; 00025 Enemy = None; 00026 } 00027 } 00028 00029 function SpawnFlies() 00030 { 00031 while (swarmsize > 0) 00032 { 00033 swarmsize--; 00034 spawn(class 'horsefly',self,'', Location + VRand() * CollisionRadius); 00035 } 00036 } 00037 00038 auto state stasis 00039 { 00040 ignores EncroachedBy; 00041 00042 function SeePlayer(Actor SeenPlayer) 00043 { 00044 enemy = Pawn(SeenPlayer); 00045 SpawnFlies(); 00046 Gotostate('wandering'); 00047 } 00048 00049 Begin: 00050 SetPhysics(PHYS_None); 00051 } 00052 00053 state wandering 00054 { 00055 ignores EncroachedBy; 00056 00057 function SeePlayer(Actor SeenPlayer) 00058 { 00059 local actor newfly; 00060 Enemy = Pawn(SeenPlayer); 00061 SpawnFlies(); 00062 Disable('SeePlayer'); 00063 Enable('EnemyNotVisible'); 00064 } 00065 00066 function EnemyNotVisible() 00067 { 00068 Enemy = None; 00069 Disable('EnemyNotVisible'); 00070 } 00071 00072 Begin: 00073 SetPhysics(PHYS_Flying); 00074 00075 Wander: 00076 if (Enemy == None) 00077 Enable('SeePlayer'); 00078 00079 if ( (Enemy != None) && !Enemy.Region.Zone.bWaterZone && !Enemy.Region.Zone.bPainZone ) 00080 { 00081 MoveToward(Enemy); 00082 sleep(2 * FRand()); 00083 } 00084 else 00085 { 00086 Destination = Location + VRand() * 1000; 00087 Destination.Z = 0.5 * (Destination.Z + Location.Z); 00088 MoveTo(Destination); 00089 } 00090 Goto('Wander'); 00091 } 00092 00093 defaultproperties 00094 { 00095 swarmsize=20 00096 bOnlyIfEnemy=True 00097 swarmradius=120.000000 00098 GroundSpeed=200.000000 00099 AirSpeed=200.000000 00100 JumpZ=-1.000000 00101 SightRadius=2000.000000 00102 PeripheralVision=-5.000000 00103 bHidden=True 00104 }