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