00001
00002 // =============================================================================
00003 //
00004 // dMMMMMMMMb .aMMMb dMMMMb .aMMMMP aMMMb dMP dMP .dMMMb dMMMMMMP dMMMMMP --------
00005 // dMP"dMP"dMP dMP"dMP dMP dMP dMP" dMP"dMP dMP dMP MP" VP dMP dMP ---
00006 // dMP dMP dMP dMMMMMP dMP dMP dMP MMP"dMP dMP dMP dMP VMMMb dMP dMMMP -----
00007 // dMP dMP dMP dMP dMP dMP dMP dMP.dMP dMP.dMP dMP.dMP dP .dMP dMP dMP ---
00008 // dMP dMP dMP dMP dMP dMP dMP VMMMP" VMMMP" VMMMP" VMMMP" dMP dMMMMMP -------- PAWN
00009 // by iKi
00010 //=============================================================================
00011
00012 class MangousteSSH1Pawn extends Cine2
00013 hidecategories(Alliances,BaseSoldier,BaseSoldier_Advanced,Cine_Behavior,Cine_Misc,
00014 Cine_Script,Cine_Shoot,Cine_Sound,GroupeAlarme,Lighting,Pawn);
00015
00016 // ###########################################################################
00017 // ## ####
00018 // ## dMP dMP .aMMMb dMMMMb dMP .aMMMb dMMMMb dMP dMMMMMP .dMMMb ####
00019 // ## dMP dMP dMP"dMP dMP.dMP amr dMP"dMP dMP"dMP dMP dMP dMP" VP ####
00020 // ## dMP dMP dMMMMMP dMMMMK" dMP dMMMMMP dMMMMK" dMP dMMMP VMMMb ####
00021 // ## YMvAP" dMP dMP dMP"AMF dMP dMP dMP dMP.aMF dMP dMP dP .dMP ####
00022 // ## VP" dMP dMP dMP dMP dMP dMP dMP dMMMMP" dMMMMMP dMMMMMP VMMMP" ####
00023 // ## ####
00024 //#############################################################################
00025 // ##########################################################################
00026
00027 VAR(Mangouste) CWndSFXTrigger SFXVapor;
00028 VAR(Mangouste) CWndSFXTrigger SFXSpeach;
00029 VAR(Mangouste) CWndSFXTrigger SFXRun;
00030 VAR(Mangouste) CWndSFXTrigger SFXDeath;
00031 VAR(Mangouste) CWndSFXTrigger SFXBody;
00032 VAR(Mangouste) CWndSFXTrigger SFXBody2;
00033 VAR(Mangouste) DialogueManager DM;
00034
00035 VAR XIIIWeapon Uzis[2];
00036 VAR bool bFireLeft, bFireRight;
00037 VAR Vector vLeftTarget, vRightTarget;
00038 VAR MeshAnimation GenericAnimations;
00039 VAR MeshAnimation SpecificAnimations, SpecificAnimations2, SpecificAnimations3, SpecificAnimations4;
00040 const LEFTARMCHANNEL=12;
00041 const RIGHTARMCHANNEL=13;
00042 const ALPHAON=0.75;
00043 VAR TRANSIENT MangousteSSH1Controller MangousteController;
00044
00045 CONST PHASE_LIMIT1=0.65; // 0.65
00046 CONST PHASE_LIMIT2=0.13; // 0.15
00047 CONST PHASE_LIMIT3=0.03; // 0.03
00048
00049 // #####################################################
00050 // ## ####
00051 // ## .aMMMMP dMP .aMMMb dMMMMb .aMMMb dMP ####
00052 // ## dMP" dMP dMP"dMP dMP"dMP dMP"dMP dMP ####
00053 // ## dMP MMP"dMP dMP dMP dMMMMK" dMMMMMP dMP ####
00054 // ## dMP.dMP dMP dMP.aMP dMP.aMF dMP dMP dMP ####
00055 // ## VMMMP" dMMMMMP VMMMP" dMMMMP" dMP dMP dMMMMMP ####
00056 // ## ####
00057 //########################################################
00058 // #####################################################
00059
00060 auto STATE STA_Init
00061 {
00062 begin:
00063 do
00064 {
00065 sleep(0.1);
00066 if ( XIIIGameInfo(Level.Game) != none )
00067 {
00068 mi = XIIIGameInfo(Level.Game).MapInfo;
00069 if ( mi!=none )
00070 PC = mi.XIIIController;
00071 }
00072 } until (PC!=none);
00073 sleep(1);
00074 bHidden=true;
00075 RefreshDisplaying();
00076 MangousteController = MangousteSSH1Controller(Controller);
00077 SetCollision(false,false,false);
00078 stop;
00079 }
00080 /*
00081 FUNCTION KillVignettes( )
00082 {
00083 LOCAL CWndOnTrigger w;
00084
00085 XIIIBaseHUD( XIIIGameInfo( Level.Game ).MapInfo.XIIIController.MyHud ).EraseCartoonWindows();
00086
00087 foreach DynamicActors ( class'CWndOnTrigger', w )
00088 {
00089 w.Timer();
00090 }
00091 }
00092 */
00093 EVENT Trigger(Actor Other, Pawn EventInstigator)
00094 {
00095 GotoState( 'STA_WaitRealStart' );
00096 // MangousteController.GotoState( 'STA_AntiCharge' );
00097 }
00098
00099 STATE STA_WaitRealStart
00100 {
00101 EVENT BeginState()
00102 {
00103 LOCAL VECTOR vTemp;
00104
00105 vTemp = MangousteController.Missiles[0].Location+560*Normal(MangousteController.Missiles[0].Location-PC.Pawn.Location);
00106 vTemp.Z = Location.Z;
00107 SetLocation( vTemp );
00108 }
00109
00110 EVENT EndState()
00111 {
00112 LOCAL int i;
00113
00114 AnimBlendParams(LEFTARMCHANNEL,0.00,0,0,'x L Clavicle');
00115 AnimBlendParams(RIGHTARMCHANNEL,0.00,0,0,'x R Clavicle');
00116 bHidden=false;
00117 RefreshDisplaying();
00118 SetCollision(true,true,false);
00119 Loopanim('Acquiesce'); //waitpistoletaccroupi');
00120 SFXSpeach.CWndDuration[0] = GetWaveDuration( "SSH102B_Mangouste_00" );
00121 SFXSpeach.animationDuration[0] = SFXSpeach.CWndDuration[0];
00122 SFXSpeach.Trigger( none, Self );
00123 TriggerEvent( 'CombatMangouste', self, self );
00124 for ( i=0; i<DM.Lines.Length; i++ )
00125 {
00126 DM.Lines[i].ExpectedEventBeforeNext=name;
00127 }
00128
00129 DM.StartDialogue( 0 );
00130 bReloadingWeapon=false;
00131
00132 MangousteController.GotoState( 'STA_Phase00' );
00133 }
00134
00135 EVENT Tick( float dt )
00136 {
00137 LOCAL VECTOR vTemp;
00138
00139 vTemp = PC.Pawn.Location - MangousteController.Missiles[0].Location;
00140 vTemp.Z = 0;
00141 // Log( vSize( (PC.Pawn.Location - Missiles[0].Location )*vect(1,1,0)) );
00142
00143 if ( vSize( vTemp )<1750 )
00144 {
00145 PC.GotoState( 'NoControl' );
00146 GotoState( 'STA_Phase00' );
00147 }
00148 /* if ( PC.IsInState( 'NoControl' ) )
00149 PC.SetRotation( PC.Rotation + RotDiff( ROTATOR( Mangouste.Location - PC.Pawn.Location ), PC.Rotation, 90*182*dt ) );
00150
00151 Global.Tick( dt );*/
00152 }
00153 }
00154
00155 STATE STA_Phase00
00156 {
00157 FUNCTION PlayMoving()
00158 {
00159 LOCAL VECTOR vTemp;
00160
00161 if (velocity==vect(0,0,0))
00162 LoopAnim( 'WaitNeutre4', , 0.25 );
00163 else
00164 LoopAnim( 'Run', vSize(Velocity)/RunAnimVelocity , 0.25 );
00165 }
00166 }
00167
00168 STATE STA_STAGGERING
00169 {
00170 EVENT BeginState()
00171 {
00172 LOG ( "STA_STAGGERING :: BeginState(" );
00173 }
00174
00175 EVENT EndState()
00176 {
00177 LOG ( "STA_STAGGERING :: EndState(" );
00178 }
00179
00180 FUNCTION PlayMoving()
00181 {
00182 AnimBlendToAlpha(LEFTARMCHANNEL,0.00,0.25);
00183 AnimBlendToAlpha(RIGHTARMCHANNEL,0.00,0.25);
00184 LoopAnim('morttitube',,0.25);
00185 }
00186 /*
00187 EVENT Hitwall( vector v, actor a )
00188 {
00189 MangousteController.Hitwall( v,a );
00190 }*/
00191 }
00192
00193
00194 FUNCTION TakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType )
00195 {
00196 MangousteController.NotifyTakeDamage( Damage, EventInstigator, HitLocation, Momentum, DamageType );
00197 if (!MangousteController.bInvicible)
00198 {
00199 if ( ( Health-PHASE_LIMIT1*MaxHealth ) * ( Health-Damage-PHASE_LIMIT1*MaxHealth ) < 0 || ( Health-Damage-PHASE_LIMIT1*MaxHealth==0 ))
00200 {
00201 // Log ( "REQUEST PHASE CHANGE 1->2" );
00202 Health=PHASE_LIMIT1*MaxHealth;
00203 Controller.GotoState('STA_Phase01_To_Phase02');
00204 }
00205 else
00206 { //Log( "==>"@( Health-PHASE_LIMIT2*MaxHealth ) * ( Health-Damage-PHASE_LIMIT2*MaxHealth ) );
00207 if ( ( Health-PHASE_LIMIT2*MaxHealth ) * ( Health-Damage-PHASE_LIMIT2*MaxHealth ) < 0 || (Health-Damage-PHASE_LIMIT2*MaxHealth==0) )
00208 {
00209 // Log ( "REQUEST PHASE CHANGE 2->3" );
00210 Health=PHASE_LIMIT2*MaxHealth;
00211 Controller.GotoState('STA_Phase02_To_Phase03');
00212 }
00213 else
00214 { //Log( "==>"@( Health-PHASE_LIMIT2*MaxHealth ) * ( Health-Damage-PHASE_LIMIT2*MaxHealth ) );
00215 if ( ( Health-PHASE_LIMIT3*MaxHealth ) * ( Health-Damage-PHASE_LIMIT3*MaxHealth ) < 0 || (Health-Damage-PHASE_LIMIT3*MaxHealth==0) )
00216 {
00217 // Log ( "REQUEST PHASE CHANGE 2->3" );
00218 Health=PHASE_LIMIT3*MaxHealth;
00219 Controller.GotoState('STA_Phase03_To_Fall');
00220 }
00221 }
00222 }
00223
00224 if (!MangousteController.bInvicible)
00225 {
00226 if ( MangousteController.IsInState('STA_AntiFuite') )
00227 Health-=0.3*Damage;
00228 else
00229 Health-=Damage;
00230
00231 if (Health<0)
00232 {
00233 Log ( 1/0 );
00234 Controller.GotoState('STA_Dying');
00235 }
00236 else
00237 Super.TakeDamage(0, EventInstigator, HitLocation, Momentum, DamageType );
00238 }
00239 }
00240
00241 }
00242
00243 EVENT PostBeginPlay()
00244 {
00245 LOCAL int i;
00246
00247 LinkSkelAnim ( GenericAnimations );
00248 LinkSkelAnim ( SpecificAnimations );
00249 LinkSkelAnim ( SpecificAnimations2 );
00250 LinkSkelAnim ( SpecificAnimations3 );
00251 LinkSkelAnim ( SpecificAnimations4 );
00252
00253 if ( (CineControllerClass != None) && (CineController == None) )
00254 CineController = spawn( CineControllerClass );
00255 if ( CineController != None )
00256 CineController.Possess( self );
00257
00258 Controller = CineController;
00259 CineController.Pawn=Self;
00260 CineController.MyPawn=Self;
00261 CineController.PC=XIIIPlayerController(Level.ControllerList);
00262
00263 InitializeInventory();
00264
00265 MaxHealth = Health;
00266 }
00267
00268 function InitializeInventory()
00269 {
00270 LOCAL Weapon inv;
00271 LOCAL rotator r;
00272 LOCAL vector l;
00273
00274 //initialize two uzis
00275 inv = spawn(class'XIII.MiniUziPlus', self);
00276 if (inv != None)
00277 {
00278 inv.gotostate('');
00279 inv.GiveTo(Self);
00280 inv.SetBase(Self);
00281 Uzis[0]=XIIIWeapon(inv);
00282 inv.AttachToPawn(self);
00283 }
00284 inv = spawn(class'XIII.MiniUziPlus', self);
00285 if (inv != None)
00286 {
00287 inv.gotostate('');
00288 inv.Instigator = Self;
00289 AddInventory( inv );
00290
00291 inv.bTossedOut = false;
00292 inv.GiveAmmo(self); // include GiveAltAmmo(Other);
00293 inv.AmmoType.AddAmmo(inv.ReloadCount);
00294 inv.ClientWeaponSet(true);
00295 inv.bHidden = true;
00296 inv.RefreshDisplaying();
00297
00298 inv.SetBase(Self);
00299 Uzis[1]=XIIIWeapon(inv);
00300 inv.AttachToPawn(self);
00301 r=inv.ThirdPersonActor.RelativeRotation;
00302 r.Roll+=32768;
00303 inv.ThirdPersonActor.SetRelativeRotation(r);
00304 l=inv.ThirdPersonActor.RelativeLocation;
00305 l.Z-=5;
00306 inv.ThirdPersonActor.SetRelativeLocation(l);
00307 }
00308 }
00309
00310 simulated function PlayFiring(float Rate, name FiringMode)
00311 {
00312 WeaponMode = FiringMode;
00313 bWeaponFiring=true;
00314 }
00315
00316 FUNCTION LeftUziFire(vector pos)
00317 {
00318 vLeftTarget = pos;
00319 bFireLeft = true;
00320 }
00321
00322 FUNCTION RightUziFire(vector pos)
00323 {
00324 vRightTarget = pos;
00325 bFireRight = true;
00326 }
00327
00328 EVENT Tick(float dt)
00329 {
00330 Uzis[0].MySlave=none;
00331 Uzis[1].MySlave=none;
00332 Uzis[0].SlaveOf=none;
00333 Uzis[1].SlaveOf=none;
00334 Uzis[0].bEnableSlave=false;
00335 Uzis[1].bEnableSlave=false;
00336
00337 if ( bFireLeft )
00338 {
00339 Controller.SetRotation( ROTATOR( vLeftTarget - Uzis[1].Location ) );
00340 AnimBlendToAlpha(LEFTARMCHANNEL,ALPHAON,0.1);
00341 LoopAnim('TirUziG',,0.1,LEFTARMCHANNEL);
00342 Uzis[1].Fire(0.0);
00343 bFireLeft = false;
00344 }
00345 else
00346 {
00347 AnimBlendToAlpha(LEFTARMCHANNEL,0,0.1);
00348 }
00349
00350 if ( bFireRight )
00351 {
00352 Controller.SetRotation( ROTATOR( vRightTarget - Uzis[0].Location ) );
00353 AnimBlendToAlpha(RIGHTARMCHANNEL,ALPHAON,0.1);
00354 LoopAnim('TirUziD',,0.1,RIGHTARMCHANNEL);
00355 Uzis[0].Fire(0.0);
00356 bFireRight = false;
00357 }
00358 else
00359 {
00360 AnimBlendToAlpha(RIGHTARMCHANNEL,0,0.1);
00361 }
00362 }
00363
00364 EVENT SetInitialState( )
00365 {
00366 MemoColActors = bCollideActors;
00367 MemoBlockActors = bBlockActors;
00368 MemoBlockPlayers = bBlockPlayers;
00369
00370 bScriptInitialized = true;
00371 // MyOldRotYaw = Rotation.Yaw;
00372
00373 GotoState( 'Auto' );
00374 }
00375
00376 EVENT SeePlayer( Pawn Seen )
00377 {
00378 Controller.SeePlayer(Seen);
00379 }
00380
00381 FUNCTION name GetWeaponBoneFor(Inventory I)
00382 {
00383 if (Uzis[0]==XIIIWeapon(I))
00384 return 'X R Hand';
00385 else if (Uzis[1]==XIIIWeapon(I))
00386 return 'X L Hand';
00387 return '';
00388 }
00389
00390 EVENT Bump(actor a)
00391 {
00392 }
00393
00394 EVENT ChangeAnimation()
00395 {
00396 PlayMoving();
00397 }
00398
00399 FUNCTION PlayMoving()
00400 {
00401 LOCAL float fSpeed,fAngle,fFrontBack,fLeftRight;
00402 LOCAL VECTOR vTemp;
00403
00404 // if (health>0)
00405 // {
00406 if (velocity==vect(0,0,0))
00407 LoopAnim( 'WaitNeutre4', , 0.25 );
00408 else
00409 {
00410 fSpeed=vSize(Velocity);
00411
00412 if ( Controller.Focus!=none )
00413 fAngle = ( ( ( ROTATOR( PC.Pawn.Location - Controller.Focus.Location ).Yaw - ROTATOR( Velocity ).Yaw ) + 32768 ) & 65535 ) - 32768;
00414 else
00415 fAngle = ( ( ( ROTATOR( PC.Pawn.Location - Controller.FocalPoint ).Yaw - ROTATOR( Velocity ).Yaw ) + 32768 ) & 65535 ) - 32768;
00416
00417 if ( -12288<fAngle && fAngle<12288 )
00418 {
00419 LoopAnim( 'Run', fSpeed/RunAnimVelocity , 0.25 );
00420 }
00421 else
00422 if ( 12288<fAngle && fAngle<20480 )
00423 {
00424 LoopAnim( 'StrafeGSpeed', 1, 0.25 );
00425 }
00426 else
00427 if ( -12288<fAngle && fAngle<-20480 )
00428 {
00429 LoopAnim( 'StrafeDSpeed', 1, 0.25);
00430 }
00431 else
00432 {
00433 LoopAnim( 'BackPaddle', fSpeed/RunAnimVelocity, 0.25);
00434 }
00435
00436 /*
00437 if ( fFrontBack>=0 )
00438 LoopAnim( 'Run', fSpeed/RunAnimVelocity , 0.25 );
00439 else
00440 LoopAnim( 'BackPaddle', fSpeed/RunAnimVelocity , 0.25 );
00441 */
00442 /* if ( Abs( fLeftRight )>100 )
00443 {
00444 AnimBlendToAlpha(STRAFFECHANNEL,1.0,0.25);
00445
00446 if ( fLeftRight>=0 )
00447 LoopAnim( 'StrafeGSpeed' , 1 , 0.25, STRAFFECHANNEL );
00448 else
00449 LoopAnim( 'StrafeDSpeed' , 1 , 0.25, STRAFFECHANNEL );
00450 }
00451 else
00452 AnimBlendToAlpha(STRAFFECHANNEL,0.00,0.25);
00453 */
00454
00455 // AnimBlendToAlpha(STRAFFECHANNEL,0.00,0.25);
00456 }
00457 // }
00458 // else
00459 // {
00460 // AnimBlendToAlpha(LEFTARMCHANNEL,0.00,0.25);
00461 // AnimBlendToAlpha(RIGHTARMCHANNEL,0.00,0.25);
00462 // LoopAnim(WalkAnim,,0.25);
00463 // }
00464 }
00465
00466 STATE STA_Phase01_VaporPaf
00467 {
00468 EVENT BeginState( )
00469 {
00470 AnimBlendToAlpha( LEFTARMCHANNEL, 0.00, 0.25 );
00471 AnimBlendToAlpha( RIGHTARMCHANNEL, 0.00, 0.25 );
00472 LoopAnim( 'paf1', , 0.25, 0 );
00473 }
00474
00475 /* EVENT EndState( )
00476 {
00477 KillVignettes( );
00478 }*/
00479 Begin:
00480 // KillVignettes( );
00481 Sleep(0.25);
00482 SFXVapor.CWndDuration[0]=3;
00483 SFXVapor.Trigger( none, self );
00484 }
00485
00486
00487
00488 defaultproperties
00489 {
00490 GenericAnimations=MeshAnimation'XIIIPersosG.MigA'
00491 SpecificAnimations=MeshAnimation'XIIIPersos.MANGOUSTEspeA'
00492 SpecificAnimations2=MeshAnimation'XIIIPersos.MCCALLspeA'
00493 SpecificAnimations3=MeshAnimation'XIIIPersos.willardspeA'
00494 SpecificAnimations4=MeshAnimation'XIIIPersos.JOHANSSONspeA'
00495 DefaultAnim="TirUziGD"
00496 Reaction(0)=(eCS_Stimulus=CS_MapStart,TabActionIndex=1,bUneSeuleFois=True)
00497 InitialSpeed=1.800000
00498 InitialRotationSpeed=450.000000
00499 InitialAccelerationFactor=3.000000
00500 CineControllerClass=Class'XIDCine.MangousteSSH1Controller'
00501 ImposedEndMovePosition=False
00502 SightRadius=3000.000000
00503 PawnName="Mangoose"
00504 Health=3000
00505 bBlockPlayers=False
00506 Mesh=SkeletalMesh'XIIIPersos.MangousteM'
00507 }
|