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 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 |
//============================================================================= // TeamCannon. //============================================================================= class TeamCannon extends StationaryPawn; #exec MESH IMPORT MESH=cdgunmainM ANIVFILE=MODELS\cdgunmain_a.3D DATAFILE=MODELS\cdgunmain_d.3D X=0 Y=0 Z=0 #exec MESH ORIGIN MESH=cdgunmainM X=0 Y=150 Z=0 PITCH=0 YAW=-64 ROLL=-64 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=All STARTFRAME=0 NUMFRAMES=44 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Error STARTFRAME=0 NUMFRAMES=2 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Activate STARTFRAME=2 NUMFRAMES=18 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire1 STARTFRAME=21 NUMFRAMES=4 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire2 STARTFRAME=25 NUMFRAMES=4 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire3 STARTFRAME=29 NUMFRAMES=4 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire4 STARTFRAME=33 NUMFRAMES=4 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire5 STARTFRAME=37 NUMFRAMES=4 #exec MESH SEQUENCE MESH=cdgunmainM SEQ=Fire6 STARTFRAME=41 NUMFRAMES=4 #exec TEXTURE IMPORT NAME=jcdgunmain FILE=MODELS\cdgunmain.pcx GROUP=Skins #exec MESHMAP SCALE MESHMAP=cdgunmainM X=0.08 Y=0.08 Z=0.16 #exec MESHMAP SETTEXTURE MESHMAP=cdgunmainM NUM=1 TEXTURE=jcdgunmain var() sound FireSound; var() sound ActivateSound; var() sound DeActivateSound; var float SampleTime; // How often we sample Instigator's location var int TrackingRate; // How fast Cannon tracks Instigator var float Drop; // How far down to drop spawning of projectile var() bool bLeadTarget; var bool bShoot; var() Class<Projectile> ProjectileType; var rotator StartingRotation; var() int MyTeam; var Actor GunBase; var() localized string PreKillMessage, PostKillMessage; function PostBeginPlay() { SpawnBase(); Super.PostBeginPlay(); StartingRotation = Rotation; } function string KillMessage( name damageType, pawn Other ) { return (PreKillMessage@Other.PlayerReplicationInfo.PlayerName@PostKillMessage); } simulated function Destroyed() { Super.Destroyed(); if ( GunBase != None ) GunBase.Destroy(); } simulated function Tick(float DeltaTime) { if ( GunBase == None ) SpawnBase(); Disable('Tick'); } simulated function SpawnBase() { GunBase = Spawn(class'CeilingGunBase', self); } function SetTeam(int TeamNum) { MyTeam = TeamNum; } function bool SameTeamAs(int TeamNum) { return (MyTeam == TeamNum); } function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType) { MakeNoise(1.0); Health -= NDamage; if (Health <0) { PlaySound(DeActivateSound, SLOT_None,5.0); NextState = 'Idle'; Enemy = None; Spawn(class'UT_BlackSmoke'); GotoState('DamagedState'); } else if ( instigatedBy == None ) return; else if ( (Enemy == None) && (!instigatedBy.bIsPlayer || !Level.Game.bTeamGame || !SameTeamAs(instigatedBy.PlayerReplicationInfo.Team)) ) { Enemy = instigatedBy; GotoState('ActiveCannon'); } } function Trigger( actor Other, pawn EventInstigator ) { GotoState('DeActivated'); } function StartDeactivate() { SetPhysics(PHYS_Rotating); DesiredRotation = StartingRotation; } function PlayDeactivate() { PlaySound(ActivateSound, SLOT_None,5.0); TweenAnim('Activate', 1.5); } function PlayActivate() { PlayAnim(AnimSequence); PlaySound(ActivateSound, SLOT_None, 2.0); } function ActivateComplete(); function Name PickAnim() { if (DesiredRotation.Pitch < -13400 ) { Drop = 35; return 'Fire6'; } else if (DesiredRotation.Pitch < -10600 ) { Drop = 30; return 'Fire5'; } else if (DesiredRotation.Pitch < -7400 ) { Drop = 25; return 'Fire4'; } else if (DesiredRotation.Pitch < -4200 ) { Drop = 20; return 'Fire3'; } else if (DesiredRotation.Pitch < -1000 ) { Drop = 15; return 'Fire2'; } else { Drop = 10; return 'Fire1'; } } function Shoot() { local Vector FireSpot, ProjStart; local Projectile p; if (DesiredRotation.Pitch < -20000) Return; PlaySound(FireSound, SLOT_None,5.0); PlayAnim(PickAnim()); ProjStart = Location+Vector(DesiredRotation)*100 - Vect(0,0,1)*Drop; if ( bLeadTarget ) { FireSpot = Target.Location + FMin(1, 0.7 + 0.6 * FRand()) * (Target.Velocity * VSize(Target.Location - ProjStart)/ProjectileType.Default.Speed); if ( !FastTrace(FireSpot, ProjStart) ) FireSpot = 0.5 * (FireSpot + Target.Location); DesiredRotation = Rotator(FireSpot - ProjStart); } p = Spawn (ProjectileType,,,ProjStart,DesiredRotation); if ( DeathMatchPlus(Level.Game).bNoviceMode ) P.Damage *= (0.4 + 0.15 * Level.game.Difficulty); if ( Target.IsA('WarShell') ) p.speed *= 2; bShoot=False; SetTimer(0.05,True); } auto state Idle { ignores EnemyNotVisible; function SeePlayer(Actor SeenPlayer) { if ( SeenPlayer.bCollideActors && ((Pawn(SeenPlayer).PlayerReplicationInfo.Team != MyTeam) || !Level.Game.bTeamGame) ) { Enemy = Pawn(SeenPlayer); GotoState('ActiveCannon'); } } function BeginState() { Enemy = None; } Begin: TweenAnim(AnimSequence, 0.25); Sleep(5.0); StartDeactivate(); Sleep(0.0); PlayDeactivate(); Sleep(2.0); SetPhysics(PHYS_None); } state DeActivated { ignores SeePlayer, EnemyNotVisible, TakeDamage; Begin: Health = -1; Enemy = None; StartDeactivate(); Sleep(0.0); PlayDeactivate(); FinishAnim(); Sleep(6.0); SetPhysics(PHYS_None); } state DamagedState { ignores TakeDamage, SeePlayer, EnemyNotVisible; Begin: Enemy = None; StartDeactivate(); Sleep(0.0); PlayDeactivate(); FinishAnim(); Spawn(class'UT_BlackSmoke'); Sleep(1.0); Spawn(class'UT_BlackSmoke'); Sleep(1.0); Spawn(class'UT_BlackSmoke'); Sleep(13.0); Health = Default.Health; GotoState(NextState); } state ActiveCannon { ignores SeePlayer; function EnemyNotVisible() { local Pawn P; Enemy = None; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.bCollideActors && P.bIsPlayer && (!Level.Game.bTeamGame || !SameTeamAs(P.PlayerReplicationInfo.Team)) && (P.Health > 0) && !P.IsA('TeamCannon') && LineOfSightTo(P) ) { Enemy = P; return; } GotoState('Idle'); } function Killed(pawn Killer, pawn Other, name damageType) { if ( Other == Enemy ) EnemyNotVisible(); } function Timer() { local Pawn P; DesiredRotation = rotator(Enemy.Location - Location); DesiredRotation.Yaw = DesiredRotation.Yaw & 65535; if ( bShoot && (DesiredRotation.Pitch < 2000) && ((Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) < 1000) || (Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) > 64535)) ) Shoot(); else { TweenAnim(PickAnim(), 0.25); bShoot=True; SetTimer(SampleTime,True); } } function BeginState() { Target = Enemy; } Begin: Disable('Timer'); FinishAnim(); PlayActivate(); FinishAnim(); ActivateComplete(); Enable('Timer'); SetTimer(SampleTime,True); RotationRate.Yaw = TrackingRate; SetPhysics(PHYS_Rotating); bShoot=True; FaceEnemy: TurnToward(Enemy); Goto('FaceEnemy'); } state TrackWarhead { ignores SeePlayer, EnemyNotVisible; function Timer() { local Pawn P; if ( (Target == None) || Target.bDeleteme ) { FindEnemy(); return; } DesiredRotation = rotator(Target.Location - Location); DesiredRotation.Yaw = DesiredRotation.Yaw & 65535; if ( bShoot && (DesiredRotation.Pitch < 2000) && ((Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) < 2000) || (Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) > 63535)) ) Shoot(); else { TweenAnim(PickAnim(), 0.25); bShoot=True; } SetTimer(SampleTime,True); } function FindEnemy() { local Pawn P; Target = None; Enemy = None; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.bCollideActors && P.bIsPlayer && ((P.PlayerReplicationInfo.Team != MyTeam) || !Level.Game.bTeamGame) && (P.Health > 0) && !P.IsA('TeamCannon') && LineOfSightTo(P) ) { Enemy = P; GotoState('ActiveCannon'); } GotoState('Idle'); } Begin: Disable('Timer'); FinishAnim(); PlayActivate(); FinishAnim(); ActivateComplete(); Enable('Timer'); SetTimer(SampleTime,True); RotationRate.Yaw = TrackingRate; SetPhysics(PHYS_Rotating); bShoot=True; FaceEnemy: if ( (Target == None) || Target.bDeleteme ) FindEnemy(); TurnToward(Target); Goto('FaceEnemy'); } state GameEnded { ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, WarnTarget, Died; function BeginState() { Destroy(); } } defaultproperties { FireSound=Sound'UnrealI.Cannon.CannonShot' ActivateSound=Sound'UnrealI.Cannon.CannonActivate' SampleTime=0.330000 TrackingRate=25000 Drop=60.000000 ProjectileType=Class'Botpack.CannonShot' PostKillMessage="was killed by an automatic cannon!" SightRadius=3000.000000 FovAngle=90.000000 Health=220 MenuName="automatic cannon!" NameArticle="an " RemoteRole=ROLE_SimulatedProxy AnimSequence=Activate Mesh=LodMesh'Botpack.cdgunmainM' CollisionRadius=28.000000 RotationRate=(Yaw=25000) } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |