Core.Object | +--Engine.Actor | +--Engine.Pawn | +--UnrealShare.FlockPawn | +--UnrealShare.Bird1
float
Angle
CircleRadius
name
GoalTag
bool
bCircle
void
Died(Pawn Killer, name damageType, vector HitLocation)
PlayCall()
PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum)
PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum)
PreBeginPlay()
WhatToDoNext()
Timer()
Landed(vector HitNormal)
TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
ZoneChange(ZoneInfo NewZone)
HitWall(vector HitNormal, Actor Wall)
Trigger(Actor Other, Pawn EventInstigator)
00001 //============================================================================= 00002 // Bird1. 00003 //============================================================================= 00004 class Bird1 extends FlockPawn; 00005 00006 #exec MESH IMPORT MESH=Bird ANIVFILE=MODELS\bird1_a.3D DATAFILE=MODELS\bird1_d.3D LODSTYLE=2 00007 #exec MESH LODPARAMS MESH=Bird STRENGTH=0.25 00008 #exec MESH ORIGIN MESH=Bird X=0 Y=0 Z=0 YAW=64 ROLL=-64 00009 00010 #exec MESH SEQUENCE MESH=Bird SEQ=All STARTFRAME=0 NUMFRAMES=31 00011 #exec MESH SEQUENCE MESH=Bird SEQ=Middle STARTFRAME=0 NUMFRAMES=1 00012 #exec MESH SEQUENCE MESH=Bird SEQ=Dead1 STARTFRAME=1 NUMFRAMES=1 00013 #exec MESH SEQUENCE MESH=Bird SEQ=Dead2 STARTFRAME=2 NUMFRAMES=1 00014 #exec MESH SEQUENCE MESH=Bird SEQ=Hit1 STARTFRAME=3 NUMFRAMES=1 00015 #exec MESH SEQUENCE MESH=Bird SEQ=Hit2 STARTFRAME=4 NUMFRAMES=1 00016 #exec MESH SEQUENCE MESH=Bird SEQ=Ground1 STARTFRAME=5 NUMFRAMES=1 00017 #exec MESH SEQUENCE MESH=Bird SEQ=Ground2 STARTFRAME=6 NUMFRAMES=1 00018 #exec MESH SEQUENCE MESH=Bird SEQ=Flight STARTFRAME=7 NUMFRAMES=24 00019 00020 #exec TEXTURE IMPORT NAME=JBird11 FILE=MODELS\Bird1.PCX GROUP=Skins 00021 #exec MESHMAP SCALE MESHMAP=Bird X=0.06 Y=0.06 Z=0.12 00022 #exec MESHMAP SETTEXTURE MESHMAP=Bird NUM=1 TEXTURE=JBird11 00023 00024 #exec AUDIO IMPORT FILE="Sounds\Manta\injur1a.WAV" NAME="injur1m" GROUP="Manta" 00025 #exec AUDIO IMPORT FILE="Sounds\Manta\call1a.WAV" NAME="call1m" GROUP="Manta" 00026 #exec AUDIO IMPORT FILE="Sounds\Bird\call2bd.WAV" NAME="call2b" GROUP="Bird" 00027 00028 var() name GoalTag; 00029 var actor GoalActor; 00030 var() float CircleRadius; 00031 var float Angle; 00032 var vector CircleCenter; 00033 var() bool bCircle; 00034 00035 function PreBeginPlay() 00036 { 00037 Super.PreBeginPlay(); 00038 CircleCenter = Location; 00039 if ( GoalTag != '' ) 00040 { 00041 AirSpeed = 2 * AirSpeed; 00042 ForEach AllActors(class 'Actor', GoalActor, GoalTag) 00043 Break; 00044 } 00045 } 00046 00047 function PlayCall() 00048 { 00049 if ( FRand() < 0.4 ) 00050 PlaySound(sound'call1m',,1 + FRand(),,, 1 + 0.7 * FRand()); 00051 else 00052 PlaySound(sound'call2b',,1 + FRand(),,, 0.8 + 0.4 * FRand()); 00053 } 00054 00055 function PlayHit(float Damage, vector HitLocation, name damageType, vector Momentum) 00056 { 00057 if ( FRand() < 0.5 ) 00058 TweenAnim('Hit1', 0.1); 00059 else 00060 TweenAnim('Hit2', 0.1); 00061 PlaySound(sound'injur1m',,,,, 1.2); 00062 AirSpeed = 1.5 * Default.AirSpeed; 00063 bCircle = false; 00064 SetPhysics(PHYS_Falling); 00065 GotoState('TakeHit'); 00066 } 00067 00068 function PlayDeathHit(float Damage, vector HitLocation, name damageType, vector Momentum) 00069 { 00070 PlaySound(sound'injur1m'); 00071 if ( FRand() < 0.5 ) 00072 TweenAnim('Dead1', 0.2); 00073 else 00074 TweenAnim('Dead2', 0.2); 00075 } 00076 00077 00078 function Died(pawn Killer, name damageType, vector HitLocation) 00079 { 00080 local Actor A; 00081 00082 if( Event != '' ) 00083 foreach AllActors( class 'Actor', A, Event ) 00084 A.Trigger( Self, Killer ); 00085 00086 if ( Region.Zone.bDestructive && (Region.Zone.ExitActor != None) ) 00087 { 00088 Spawn(Region.Zone.ExitActor); 00089 Destroy(); 00090 return; 00091 } 00092 GotoState('Dying'); 00093 } 00094 00095 function WhatToDoNext() 00096 { 00097 if ( bCircle ) 00098 GotoState('Circle'); 00099 else if ( GoalActor != None ) 00100 GotoState('MoveToGoal'); 00101 else 00102 GotoState('Meander'); 00103 } 00104 00105 auto state startup 00106 { 00107 function Trigger( actor Other, pawn EventInstigator ) 00108 { 00109 if ( GoalActor != None ) 00110 GotoState('MoveToGoal'); 00111 } 00112 00113 Begin: 00114 if ( GoalActor == None ) 00115 WhatToDoNext(); 00116 } 00117 00118 state TakeHit 00119 { 00120 ignores seeplayer, enemynotvisible; 00121 00122 Begin: 00123 FinishAnim(); 00124 Sleep(0.3); 00125 TweenAnim('Flight', 0.1); 00126 WhatToDoNext(); 00127 } 00128 00129 state meander 00130 { 00131 ignores seeplayer, enemynotvisible; 00132 00133 singular function ZoneChange( ZoneInfo NewZone ) 00134 { 00135 if (NewZone.bWaterZone || NewZone.bPainZone) 00136 { 00137 SetLocation(OldLocation); 00138 Velocity = vect(0,0,0); 00139 Acceleration = vect(0,0,0); 00140 MoveTimer = -1.0; 00141 } 00142 } 00143 00144 begin: 00145 SetPhysics(PHYS_Flying); 00146 wander: 00147 if ( FRand() < 0.2 ) 00148 PlayCall(); 00149 Destination = CircleCenter + FRand() * CircleRadius * VRand(); 00150 if ( Abs(Destination.Z - CircleCenter.Z) > 200 ) 00151 Destination.Z = CircleCenter.Z; 00152 if ( (Destination.Z >= Location.Z) || (FRand() < 0.5) ) 00153 LoopAnim('Flight'); 00154 else 00155 TweenAnim('Flight', 1.0); 00156 MoveTo(Destination); 00157 Goto('Wander'); 00158 } 00159 00160 state movetogoal 00161 { 00162 ignores seeplayer, enemynotvisible; 00163 00164 function HitWall(vector HitNormal, actor Wall) 00165 { 00166 GoalActor = None; 00167 GotoState('Meander'); 00168 } 00169 00170 begin: 00171 SetPhysics(PHYS_Flying); 00172 wander: 00173 if ( FRand() < 0.5 ) 00174 PlayCall(); 00175 LoopAnim('Flight', 2.0); 00176 MoveTo(GoalActor.Location); 00177 If ( VSize(Location - GoalActor.Location) < 100 ) 00178 Destroy(); 00179 else 00180 Goto('Wander'); 00181 } 00182 00183 state circle 00184 { 00185 ignores seeplayer, enemynotvisible; 00186 00187 singular function ZoneChange( ZoneInfo NewZone ) 00188 { 00189 if (NewZone.bWaterZone || NewZone.bPainZone) 00190 { 00191 SetLocation(OldLocation); 00192 Velocity = vect(0,0,0); 00193 Acceleration = vect(0,0,0); 00194 MoveTimer = -1.0; 00195 } 00196 } 00197 00198 begin: 00199 SetPhysics(PHYS_Flying); 00200 wander: 00201 if ( FRand() < 0.2 ) 00202 { 00203 LoopAnim('Flight'); 00204 PlayCall(); 00205 } 00206 else 00207 PlayAnim('Flight'); 00208 Angle += 1.0484; //2*3.1415/6; 00209 Destination.X = CircleCenter.X - CircleRadius * Sin(Angle); 00210 Destination.Y = CircleCenter.Y + CircleRadius * Cos(Angle); 00211 Destination.Z = CircleCenter.Z + 30 * FRand() - 15; 00212 MoveTo(Destination); 00213 Goto('Wander'); 00214 } 00215 00216 State Dying 00217 { 00218 ignores seeplayer, enemynotvisible; 00219 00220 function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 00221 Vector momentum, name damageType) 00222 { 00223 destroy(); 00224 } 00225 00226 function Landed(vector HitNormal) 00227 { 00228 local rotator newRot; 00229 00230 newRot = Rotation; 00231 newRot.Pitch = 0; 00232 newRot.Roll = 0; 00233 If ( FRand() < 0.5 ) 00234 TweenAnim('Ground1', 0.2); 00235 else 00236 TweenAnim('Ground2', 0.2); 00237 SetRotation(newRot); 00238 SetPhysics(PHYS_None); 00239 SetTimer(2.0, True); 00240 } 00241 00242 function Timer() 00243 { 00244 if ( !PlayerCanSeeMe() ) 00245 Destroy(); 00246 } 00247 00248 Begin: 00249 SetPhysics(PHYS_Falling); 00250 Sleep(10); 00251 Timer(); 00252 } 00253 00254 defaultproperties 00255 { 00256 CircleRadius=500.000000 00257 AirSpeed=300.000000 00258 AccelRate=800.000000 00259 SightRadius=2000.000000 00260 Health=17 00261 Land=None 00262 DrawType=DT_Mesh 00263 Mesh=LodMesh'UnrealShare.Bird' 00264 bUnlit=True 00265 CollisionHeight=6.000000 00266 RotationRate=(Pitch=12000,Yaw=20000,Roll=12000) 00267 }