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 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 |
//============================================================================= // U2DrakkBossController //============================================================================= class U2DrakkBossController extends U2NPCControllerBasic; #exec OBJ LOAD FILE=..\Sounds\U2AmbientA.uax #exec OBJ LOAD File=..\Sounds\U2DrakkNew.uax #exec OBJ LOAD File=..\System\ParticleRes\DrakkFX.u const ReturnToBaseState = 'ReturnToBase'; const SpinningDeathState = 'SpinningDeath'; var bool bAttached, bElectricActive; var Actor HomeActor; var U2DrakkBoss LowerPawn; //var bool bReactToEnemy; //var float RechargeRate; var ElectricGenerator UpperLeftElectric, UpperRightElectric; var ParticleRadiator DamageEffect; var float ElectricDistance; var float LiteBriteTimer; var float SpinningTimer; var int WingBoneDisabled; var bool bPreventDamage; var() Sound WingExplodeSound; //----------------------------------------------------------------------------- function Possess( Pawn P ) { local Actor A; LowerPawn = U2DrakkBoss(P); Super.Possess( P ); foreach AllActors(class'Actor', A) { if (A.Tag == LowerPawn.HomeActorTag) { HomeActor = A; break; } } if (HomeActor==None) { // allocate a holdspot at the start up location (move it to the floor if needed) HomeActor = Spawn( class'HoldSpot', , , P.Location ); #debug DMAssert( HomeActor != None, GetContext() ); class'UtilGame'.static.PlaceActorOnFloorUnderLocation( HomeActor, HomeActor.Location ); } InitEffects(); } event Destroyed() { ShutdownEffects(); Super.Destroyed(); } function DrkbcTick(float DeltaTime) { // can't use regular Tick for this since Controller.Tick happens before Pawn.Tick, and we need the Pawn for mounting purposes UpperLeftElectric.UpdateMountPhysics(); UpperRightElectric.UpdateMountPhysics(); UpdateElectric(UpperLeftElectric, ((WingBoneDisabled & 1) != 0) ); UpdateElectric(UpperRightElectric, ((WingBoneDisabled & 2) != 0) ); } simulated function UpdateElectric(ElectricGenerator E, bool bWingDisabled) { local vector V; local bool bEnemyInRange; bEnemyInRange = false; if (bElectricActive && (ControllerEnemy?) && (!bWingDisabled)) { V = ControllerEnemy.Location - E.Location; if (VSize(V) < ElectricDistance) bEnemyInRange = true; } if (bEnemyInRange) { E.SetRotation(rotator(Normal(V))); E.AmbientSound = sound'U2AmbientA.Electric.Electricharge03'; //sound'U2AmbientA.Electric.Electricharge02'; E.SoundVolume = 192; E.bOn = true; } else { E.AmbientSound = None; E.bOn = false; } } private final simulated function ElectricGenerator ConstructElectric(string BoneName, bool bChargeEffect) { local ElectricGenerator A; A = spawn(class'ElectricGenerator', Pawn); A.bHidden = true; //A.bResetArcOnReuse = true; //A.Trigger(Pawn, Pawn.Instigator); A.MountParentNode = BoneName; A.SetPhysics(PHYS_MovingBrush); A.MountSetParent(Pawn); if (bChargeEffect) { A.LatchRate = rng(0.1, 0.3); A.ArcLifeSpan = rng(0.1, 1.0); A.AffectedRadius = ElectricDistance * 4.0; A.BeamWidth = rng(2.0, 4.0); A.BeamTextureWidth = rng(4.0, 8.0); } else { A.BeamSegLength = rng(20.0, 40.0); A.MetaBeamSegLength = rng(80.0, 100.0); A.LatchRate = rng(0.5, 1.0); A.ArcLifeSpan = rng(0.2, 0.4); A.AffectedRadius = ElectricDistance; A.SpreadDegrees = 15.0; //A.DamageAmount = 5; //A.DamageTime = 0.15; A.DamageStart = rng(4.0, 8.0); A.DamageType = class'DamageTypeElectrical'; A.bLatchAtOrigin = true; } return(A); } private final simulated function InitEffects() { UpperLeftElectric = ConstructElectric("TopLeftWing13", false); UpperRightElectric = ConstructElectric("TopRightWing13", false); DamageEffect = ParticleRadiator(class'ParticleGenerator'.static.CreateNew(self, ParticleRadiator'DrakkFX.ParticleRadiator0')); DamageEffect.Instigator = Pawn; DamageEffect.MeshOwner = Pawn; } private final simulated function ShutdownEffects() { if (UpperLeftElectric?) { UpperLeftElectric.Destroy(); UpperLeftElectric = None; } if (UpperRightElectric?) { UpperRightElectric.Destroy(); UpperRightElectric = None; } if (DamageEffect!=None) { DamageEffect.Destroy(); DamageEffect=None; } } /* DrakkBoss interface */ function DrkbcAttach(U2DrakkBossUpper InUpperPawn, bool InAttached) { if (bAttached == InAttached) return; bAttached = InAttached; if (bAttached) { SetFrozen(true); LowerPawn.SetCollision(false, false, false); LowerPawn.SetPhysics(PHYS_MovingBrush); LowerPawn.MountParentNode = "ROOTHigh"; //"HighMover"; LowerPawn.SetLocation(InUpperPawn.Location); LowerPawn.SetRotation(InUpperPawn.Rotation); LowerPawn.MountSetParent(InUpperPawn); LowerPawn.MountOrgLocation = vect(0,0,0); LowerPawn.MountOrgRotation = rot(0,16384,0); LowerPawn.SetRotation(InUpperPawn.Rotation); SetRotation(InUpperPawn.Rotation); LowerPawn.UpdateMountPhysics(); LowerPawn.MovementPhysics=PHYS_None;//PHYS_MovingBrush LowerPawn.SetMovementPhysics(false); bElectricActive = false; LowerPawn.MeshAgentSetInputCurValue('WhipsOut', 'False'); } else { SetFrozen(false); LowerPawn.SetCollision(true, false, false); LowerPawn.MountParentNode = ""; LowerPawn.MountSetParent(None); LowerPawn.MovementPhysics=PHYS_Walking; LowerPawn.SetMovementPhysics(true); DrkbcEnableEnemyDetection(true); if (ControllerEnemy?) EnemyAcquired(); bElectricActive = true; LowerPawn.MeshAgentSetInputCurValue('WhipsOut', 'True'); LowerPawn.DrkbSpawnUpperPawn(true); } } function DrkbcEnableEnemyDetection(bool bEnable) { Shutdown(!bEnable); EnableSenses(bEnable); } //----------------------------------------------------------------------------- function EnemyAcquired() { DrkbcEnableEnemyDetection(true); if (!bAttached) Super.EnemyAcquired(); } function CheckWingDamage(int Index, name InputName, string BoneName, Pawn Instigator) { local bool wasDisabled; local int HealthThreshold; local ParticleGenerator P; local vector WingLoc; local int NodeHandle; WingLoc = Pawn.Location; NodeHandle = Pawn.MeshGetNodeNamed(BoneName); if (NodeHandle!=0) WingLoc = Pawn.MeshNodeGetTranslation(NodeHandle, MESHNODEREL_World); wasDisabled = ((WingBoneDisabled & (1<<Index)) != 0); HealthThreshold = (Index+1)*(Pawn.default.Health/5); if ((Pawn.Health < HealthThreshold) && (!wasDisabled)) { P = class'ParticleGenerator'.static.CreateNew(Pawn, ParticleGenerator'DispersionFX.ParticleSalamander3', WingLoc); P.SetRotation(rotator(Normal(Instigator.Location - WingLoc))); P.Trigger(Pawn, Pawn); P.ParticleLifeSpan = P.GetMaxLifeSpan() + 1.0; Pawn.PlaySound(WingExplodeSound, SLOT_Interact, Pawn.TransientSoundVolume*2.0, , Pawn.TransientSoundRadius*2.0); Pawn.MeshAgentSetInputCurValue(InputName, 'False'); WingBoneDisabled = WingBoneDisabled | (1<<Index); Pawn.PlaySound(sound'U2DrakkNew.Explosion_4', SLOT_Misc, Pawn.TransientSoundVolume*2.0, , Pawn.TransientSoundRadius*2.0); Pawn.PlaySound(sound'U2DrakkNew.DrakkBossDeathChattr3', SLOT_Weapon, Pawn.TransientSoundVolume*2.0, , Pawn.TransientSoundRadius*2.0); } } function eventBumpFriend( Pawn Other ) { // makes me go wandering... evil! } function eventTakeDamage( int Damage, Pawn Instigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { local int OldHealth; if (bPreventDamage || (U2DrakkBossUpper(Instigator)!=None)) // don't let my upper body hurt me return; OldHealth = Pawn.Health; Pawn.Health += Pawn.default.Health*5.0; // just to make sure we don't die without a spinning death Super.eventTakeDamage(Damage, Instigator, HitLocation, Momentum, DamageType); if (Pawn.Health <= 0) return; // overkill; no spinning death Pawn.Health -= Pawn.default.Health*5.0; if ( (DamageType!=None) && (!ClassIsChildOf(DamageType, class'DamageTypeThermal')) ) { if ((OldHealth - Pawn.Health) > Pawn.default.Health*0.0225) Pawn.PlaySound(sound'U2DrakkNew.Hit_Impact_10', SLOT_Pain); else Pawn.PlaySound(sound'U2DrakkNew.Hit_Impact_7', SLOT_Pain); } if (Pawn.Health > 0) { DamageEffect.Trigger(Pawn, Instigator); } else { Pawn.Health = 10000; bPreventDamage = true; GotoState(SpinningDeathState); } CheckWingDamage(0, 'UpperLeftWingOut', "TopLeftWing10", Instigator); CheckWingDamage(1, 'UpperRightWingOut', "TopRightWing10", Instigator); CheckWingDamage(2, 'LowerLeftWingOut', "LowerLeftWing10", Instigator); CheckWingDamage(3, 'LowerRightWingOut', "LowerRightWing10", Instigator); } //----------------------------------------------------------------------------- state @ FrozenState { ignores EnemyNotVisible, SeeFriend, SeeOther, SeeAlertFriend; event EnemyRangeTransition( float Distance ) { #debug SetControllerEnemy( None, GetContext() ); // so enemy will be reacquired #release SetControllerEnemy( None ); // so enemy will be reacquired Global.EnemyRangeTransition( Distance ); } function eventBumpEnemy( Pawn Other ) { #debug SetControllerEnemy( None, GetContext() ); // so enemy will be reacquired #release SetControllerEnemy( None ); // so enemy will be reacquired Global.eventBumpEnemy( Other ); } function eventTookDamage( int Damage, Pawn Instigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { #debug SetControllerEnemy( None, GetContext() ); // so enemy will be reacquired #release SetControllerEnemy( None ); // so enemy will be reacquired if( Pawn.Health > 0 ) Global.eventTookDamage( Damage, Instigator, HitLocation, Momentum, DamageType ); } function bool IsMobile() { return true; } event BeginState() { Super.BeginState(); DrkbcAttach(LowerPawn.UpperPawn, true); DrkbcEnableEnemyDetection(false); #debug SetControllerEnemy( None, GetContext() ); #release SetControllerEnemy( None ); Ranges[0] = 1024.0;//LowerPawn.ReactToEnemyRange; RotationRate = rot(0,0,0); EnableRotation( false ); Focus = None; DefaultState = WanderingState; // make it so we don't re-enter the frozenstate undesirably when the player dies (causes infinite mounting recursion) } event EndState() { Focus = ControllerEnemy; RotationRate = default.RotationRate; if ((Pawn?) && !Pawn.bDeleteMe && !Pawn.bPendingDelete) EnableRotation( true ); Super.EndState(); } } // FrozenState //----------------------------------------------------------------------------- state @ ReturnToBaseState extends @ MoveToGoalBaseState { ignores EnemyNotVisible, HearNoise, NotifyBump, SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend; function EnemyAcquired(); function NotifyUpperNeedsRecharge(); //------------------------------------------------------------------------- function PickDestination() { GetPathToActor( HomeActor, MoveTarget, true ); ClearMoveAttempts(); } //------------------------------------------------------------------------- event BeginState() { Super.BeginState(); BehaviorController.SetBCEnabled( false ); #debug SetControllerEnemy(None, GetContext()); // this might not be needed any more #release SetControllerEnemy(None); // this might not be needed any more } //------------------------------------------------------------------------- event EndState() { BehaviorController.SetBCEnabled( true ); Super.EndState(); } //------------------------------------------------------------------------- @ BeginLabel: @ MovePickDestLabel: PickDestination(); @ MoveActiveLabel: MoveToActor( MoveTarget, TMT_None, HomeActor ); if( MoveResult == MR_DestinationReachedFinal ) Goto( ReachedDestinationLabel ); else if( MoveResult == MR_DestinationReached ) Goto( MovePickDestLabel ); else if( MoveAgain() ) Goto( MoveActiveLabel ); else Goto( /*GiveUpLabel*/ReachedDestinationLabel ); // if we can't make it, don't bother in this case, just go from here @ ReachedDestinationLabel: StopMovement( true, true ); /* can't use this... uppercontroller changes when new upperpawns are made, even if old upperpawn is still alive. Don't assume anything. ValidateUpperController(); UpperController.GotoState('SimpleWait', 'WaitActivate'); */ // We don't so much care here about getting into Simplewait, but rather just getting out of Construction. // Construction's EndState will handle the real transition into Simplewait correctly, as the upperbody becomes unfrozen during detachment. LowerPawn.UpperPawn.UpperController.GotoState('SimpleWait'); Stop; } // ReturnToBaseState state @ SpinningDeathState { ignores EnemyNotVisible, EnemyAcquired, HearNoise, NotifyBump, SeeEnemy, SeeFriend, SeeOther, SeeAlertFriend; event BeginState() { local U2DrakkBossUpper A; Super.BeginState(); MoveTarget = None; ClearMoveAttempts(); StopMovement(true, true); BehaviorController.SetBCEnabled( false ); LowerPawn.bStationary=true; #debug SetControllerEnemy(None, GetContext()); #release SetControllerEnemy(None); Focus = None; LowerPawn.AmbientRotationRate=rot(0,0,0); LowerPawn.DrkbDestroyUpperPawn(); Pawn.PlaySound(sound'U2DrakkNew.Self_Destruct_7', SLOT_Weapon, Pawn.TransientSoundVolume*2.0, , Pawn.TransientSoundRadius*2.5); foreach AllActors(class'U2DrakkBossUpper', A) { if (ValidPawn(A) && A.UpperController?) A.UpperController.bKamikaze = true; } class'MusicScriptEvent'.static.CallRoutine(self, "dm005_winning"); } event EndState() { class'MusicScriptEvent'.static.CallRoutine(self, "dm006_victory"); Super.EndState(); } event Tick(float DeltaTime) { Global.Tick(DeltaTime); LowerPawn.AmbientRotationRate.Yaw += 10000.0*DeltaTime; if (SpinningTimer > 0.0) SpinningTimer = FMax(SpinningTimer - DeltaTime, 0.0); if (LiteBriteTimer > 0.0) { LiteBriteTimer = FMax(LiteBriteTimer - DeltaTime, 0.0); if (LiteBriteTimer <= 0.0) { if (!Pawn.bUnlit) { Pawn.bUnlit = true; Pawn.ScaleGlow = 20.0; } else { Pawn.bUnlit = false; Pawn.ScaleGlow = 1.0; } LiteBriteTimer = FRand()*SpinningTimer*0.05; } } } @ BeginLabel: /* BehaviorController.SetBCEnabled( false ); LowerPawn.bStationary=true; #debug SetControllerEnemy(None, GetContext()); #release SetControllerEnemy(None); Focus = None; LowerPawn.AmbientRotationRate=rot(0,0,0); LowerPawn.DrkbDestroyUpperPawn(); Pawn.PlaySound(sound'U2DrakkNew.Self_Destruct_7', SLOT_Weapon, Pawn.TransientSoundVolume*2.0, , Pawn.TransientSoundRadius*2.5); */ Enable(Event_Tick); SpinningTimer = 18.0; LiteBriteTimer = 0.01; Sleep(SpinningTimer); LowerPawn.KillSelf(); } defaultproperties { ElectricDistance=512.000000 WingExplodeSound=Sound'U2WeaponsA.Dispersion.DP_PoweredUpExplode' DefaultState='Frozen' UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |