## XIDPawn
Class Johansson

source: C:\XIII\XIDPawn\Classes\Johansson.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Pawn
             |
             +--XIII.XIIIPawn
                |
                +--XIDPawn.BaseSoldier
                   |
                   +--XIDPawn.Johansson

Direct Known Subclasses:None

class Johansson
extends XIDPawn.BaseSoldier

    //=============================================================================
    // Johansson.
    //=============================================================================

Variables
`name` | `Arme`
`float` | `DispersionJohansson`
`float` | `DistanceAttaque`
`Prock03_FioleDeco` | `Fioles[3]`
`Prock03_GenEffects` | `GenEffects`
`int` | `NbCoupsDansVide` en h2h
`int` | `NbFioles` son
`int` | `NbScalpels` son
`PathNode` | `PointFiole`
`PathNode` | `PointScalpel`
`Prock03_PointPlanque` | `PtsDePlanque[8]`
`vector` | `ScalpelOffset`
`float` | `TimeBeforeEndStateWeapon` son
`float` | `TimerWeapon` son
`Fiole_Attachment` | `VisuelFiole`
`Piquouse_Attachment` | `VisuelPiquouse`
`Scalpels_Attachment` | `VisuelScalpel`
`bool` | `bInEndStateWeapon` arme prete a retirer
`bool` | `bPlayedSound` son
`bool` | `bSerumSound` son
`bool` | `bWeaponReady` arme prete a retirer
`bool` | `bxiiipoisoned` arme prete a retirer
`float` | `timersound` son

States
Dying

Function Summary
`void` | `EndWeaponState()`
`void` | `FioleDansLaMain(bool bNeedToDisplay)`
`void` | `FioleFire()`
`int` | `GetDamageSide(vector HitLocation)`
    //_FRD reecrite pour ne pas l'assomer dans le dos.____________________________________________________________________________
    // ELR CheckDamageLocation
`vector` | `GetScalpelStart(vector X, vector Y, vector Z)`
`void` | `InitFioleAttach()`
`void` | `InitPiquouseAttach()`
`void` | `InitScalpelAttach()`
`void` | `PiquouseDansLaMain(bool bNeedToDisplay)`
`void` | `PiquouseFire()`
`simulated` | `PlayMoving()`
    /*
`void` | `PlayProvoc()`
`void` | `PlayTakeFiole()`
`void` | `PlayTakeScalpels()`
`simulated` | `PlayWaiting()`
    //_____________________________________________________________________________
`void` | `ReleaseAnimControl(optional bool)`
`void` | `ScalpelDansLaMain(bool bNeedToDisplay)`
`void` | `ScalpelH2HFire()`
`void` | `ScalpelsFire()`
`void` | `SpawnCadavre()`
`void` | `TakeAnimControl(bool bMoveAnim)`

State Dying Function Summary

Source Code

    00001	//=============================================================================
    00002	// Johansson.
    00003	//=============================================================================
    00004	class Johansson extends BaseSoldier;
    00005
    00006	// var designers
    00007	var() pathnode PointScalpel;
    00008	var() pathnode PointFiole;
    00009	var() Prock03_fioledeco Fioles[3];
    00010	var() Prock03_PointPlanque PtsDePlanque[8];
    00011	var() Prock03_GenEffects GenEffects;
    00012
    00013
    00014	var Scalpels_Attachment VisuelScalpel;
    00015	var Piquouse_Attachment VisuelPiquouse;
    00016	var Fiole_Attachment VisuelFiole;
    00017
    00018	var vector ScalpelOffset;
    00019
    00020	var name Arme;
    00021
    00022	var float DispersionJohansson;
    00023	var float DistanceAttaque;
    00024	var float timersound;//son
    00025	var float TimerWeapon;
    00026	var float TimeBeforeEndStateWeapon;
    00027
    00028	var int NbScalpels;
    00029	var int NbFioles;
    00030	var int NbCoupsDansVide; //en h2h
    00031
    00032	var bool bWeaponReady; //arme prete a retirer
    00033	var bool bxiiipoisoned;
    00034	var bool bInEndStateWeapon;
    00035
    00036	var bool bSerumSound; //son
    00037	var bool bPlayedSound;   //son
    00038
    00039
    00040	event PostBeginPlay()
    00041	{
    00042		LinkSkelAnim (MeshAnimation'XIIIPersos.JohanssonSpeA');
    00043		LinkSkelAnim (MeshAnimation'XIIIPersos.GardienSPeA');
    00044		LinkSkelAnim (MeshAnimation'XIIIPersosG.MigA');
    00045	    Super.PostBeginPlay();
    00046	}
    00047	event Tick(float DeltaTime)
    00048	{
    00049		local int valeurarmeactuelle;
    00050
    00051		super.tick(DeltaTime);
    00052
    00053		if (bPlayedSound && (level.timeseconds-TimerSound)>4)
    00054		{
    00055			bSerumSound=false;
    00056			bPlayedSound=false;
    00057		}
    00058		if (bInEndStateWeapon && (level.timeseconds-TimerWeapon)>TimeBeforeEndStateWeapon)
    00059		{
    00060			EndWeaponState();
    00061		}
    00062	}
    00063
    00064	event Timer2 ()   //declenchement des degats de l'arme
    00065	{
    00066	    local Vector Start,EndTrace,X,Y,Z;
    00067	    local rotator AdjustedAIm;
    00068	    local Prock03_Scalpels PS;
    00069	    local Prock03_Fioles PF;
    00070	    local vector eyepos,Hitlocation,Hitnormal;
    00071	    local actor other,BLE;
    00072	    local Material HitMat;
    00073
    00074		 if (bisdead)
    00075			return;
    00076	    If (arme=='ScalpelH2H')
    00077	    {
    00078	        GetAxes(GetViewRotation(),X,Y,Z);
    00079	        Start = Location + eyepos;
    00080	        AdjustedAim = controller.AdjustAim(none, Start, 0);
    00081	        Endtrace=Start + 120*vector(AdjustedAim);
    00082	        Other = Trace(HitLocation, HitNormal, EndTrace, Start, True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon);
    00083	        if (XIIIPlayerPawn(other)!=none)
    00084	        {
    00085					NbCoupsDansVide=0;
    00086					if (!bPlayedSound && rand(5)==0)
    00087					{
    00088						bPlayedSound=true;
    00089						timersound=level.timeseconds;
    00090						triggerevent('dial_goute',self,self);
    00091					}
    00092	            Other.TakeDamage(40,  self, HitLocation, 300.0*X, Class'XIII.DTFisted');
    00093	            BLE = Spawn(class'BloodShotEmitter',,, HitLocation+HitNormal, Rotator(HitNormal));
    00094	        }
    00095				else
    00096					NbCoupsDansVide++;
    00097			  //PlayVoice(Sound'XIIIsound.PNJ__Johansson.Johansson__hScalpel',1);
    00098			bInEndStateWeapon=true;
    00099			TimerWeapon=level.timeseconds;
    00100			TimeBeforeEndStateWeapon=0.15;
    00101	    }
    00102	    else if (arme=='Scalpels')
    00103	    {
    00104				//log("je lance le scalpel");
    00105				bispafable=true;
    00106			  if (biscrouched)
    00107	           eyepos=vect(0,0,40);
    00108	        else
    00109	            eyepos=vect(0,0,60);
    00110	        ScalpelDansLaMain(false);
    00111	        GetAxes(GetViewRotation(),X,Y,Z);
    00112	        Start = GetScalpelStart(X,Y,Z) + 16*X;
    00113	        AdjustedAim = controller.AdjustAim(none, Start, 0);
    00114	        Ps=Spawn(class'Prock03_scalpels',self,,Start,AdjustedAim);
    00115	        //PlayVoice(Sound'XIIIsound.PNJ__Johansson.Johansson__hScalpel',0);
    00116	        //log("projectiole"@ps);
    00117	        if ( Ps != none )
    00118	        {
    00119	           Nbscalpels--;
    00120	           PS.instigator=self;
    00121	           PS.SetImpactNoise(0, 0.15);
    00122	        }
    00123	       bInEndStateWeapon=true;
    00124			TimerWeapon=level.timeseconds;
    00125			TimeBeforeEndStateWeapon=0.62;
    00126	    }
    00127	    else if (arme=='piquouse')
    00128	    {
    00129	        GetAxes(GetViewRotation(),X,Y,Z);
    00130	        Start = Location + eyepos;
    00131	        AdjustedAim = controller.AdjustAim(none, Start, 0);
    00132	        Endtrace=Start + 120*vector(AdjustedAim);
    00133			  Other = Trace(HitLocation, HitNormal, EndTrace, Start, True, vect(0,0,0), HitMat, TRACETYPE_DiscardIfCanShootThroughWithRayCastingWeapon);
    00134	        if (Xiiiplayerpawn(other)!=none)
    00135	        {
    00136					 //poisoned
    00137	        		JOhansson(instigator).GenEffects.XIIIPoisoned();
    00138					NbCoupsDansVide=0;
    00139			 		if (controller!=none)
    00140						JohanssonController(controller).XIIIBePoisoned();
    00141	            BLE = Spawn(class'BloodShotEmitter',,, HitLocation+HitNormal, Rotator(HitNormal));
    00142	        }
    00143			  else
    00144					NbCoupsDansVide++;
    00145			   bInEndStateWeapon=true;
    00146				TimerWeapon=level.timeseconds;
    00147				TimeBeforeEndStateWeapon=0.15;
    00148	    }
    00149	    else    //fiole
    00150	    {
    00151					bispafable=true;
    00152			  if (biscrouched)
    00153	           eyepos=vect(0,0,40);
    00154	        else
    00155	            eyepos=vect(0,0,60);
    00156	        GetAxes(GetViewRotation(),X,Y,Z);
    00157	        Start = GetScalpelStart(X,Y,Z) + 16*X;
    00158			  FioleDansLaMain(false);
    00159	        AdjustedAim = controller.AdjustAim(none, Start, 0);
    00160	        PF=Spawn(class'Prock03_Fioles',self,,Start,AdjustedAim);
    00161	        //Pf.velocity.z+=10;
    00162	        //log("projectiole"@ps);
    00163	        if (PF != none)
    00164	        {
    00165	           NbFioles--;
    00166	           PF.instigator=self;
    00167	           PF.SetImpactNoise(0, 0.15);
    00168	        }
    00169	       	bInEndStateWeapon=true;
    00170				TimerWeapon=level.timeseconds;
    00171				TimeBeforeEndStateWeapon=0.7;
    00172	    }
    00173	}
    00174
    00175	function EndWeaponState() //retabli etat de l'arme et remet le visuel dans la main
    00176	{
    00177		bInEndStateWeapon=false;
    00178		releaseanimcontrol();
    00179		bWeaponReady=true;
    00180		If (arme=='ScalpelH2H')
    00181		{
    00182			if (controller!=none)
    00183				JohanssonController(controller).Halteaufeu();
    00184		  //log("rien a faire pour scalpelH2H");
    00185		}
    00186		else if (arme=='Scalpels')
    00187		{
    00188		  ScalpelDansLaMain(true);
    00189		}
    00190		else if (arme=='piquouse')
    00191		{
    00192		   if (controller!=none)
    00193			JohanssonController(controller).Halteaufeu();
    00194		    //log("rien a faire pour piquouse");
    00195		}
    00196		else
    00197		{
    00198		 FioleDansLaMain(true);
    00199		 //log("rien a faire pour fiole");
    00200		}
    00201	}
    00202
    00203	function Died(Controller Killer, class<DamageType> damageType, vector HitLocCode)
    00204	{
    00205		if (Controller != none) controller.bControlanimations=false;
    00206		bSpineControl=true;
    00207		bPhysicsanimupdate=true;
    00208		AnimBlendToAlpha(FIRINGCHANNEL+1,0,0);
    00209		AnimBlendToAlpha(FIRINGCHANNEL+2,0,0);
    00210		super.Died(Killer,damageType,HitLocCode);
    00211	}
    00212
    00213	//_FRD reecrite pour ne pas l'assomer dans le dos.____________________________________________________________________________
    00214	// ELR CheckDamageLocation
    00215	function int GetDamageSide( vector HitLocation )
    00216	{
    00217	    return 3;
    00218	}
    00219
    00220	function TakeAnimControl(bool bMoveAnim)
    00221	{
    00222		bMoving=bMoveAnim;
    00223		bPhysicsanimupdate=false;
    00224		bSpineControl=false;
    00225		if (controller!=none)
    00226			controller.bControlanimations=true;
    00227		AnimBlendToAlpha(FIRINGCHANNEL+1,1,0.2);
    00228		SetBoneDirection(FIRINGBLENDBONE, rot(0,0,0), vect(0,0,0), 0.0 );
    00229	}
    00230
    00231	function ReleaseAnimControl(optional bool bFastTransition)
    00232	{
    00233		if (Controller != none) controller.bControlanimations=false;
    00234		bSpineControl=true;
    00235		bPhysicsanimupdate=true;
    00236		PlayWaiting();
    00237		AnimBlendToAlpha(FIRINGCHANNEL+1,0,0.2);
    00238	}
    00239
    00240
    00241
/*function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) 00242 { 00243 if (bXIIIpoisoned) 00244 Damage*=0.3; 00245 super.TakeDamage(Damage,instigatedBy,hitlocation,momentum,damageType); 00246 }*/ 00247 00248 //[FRD] gestion anim en fonction vitesse deplacement 00249 /*simulated function PlayMoving() 00250 { 00251 local float AnimRate; 00252 00253 if (bisdead) 00254 return; 00255 AnimRate = fmax(0,1*vsize(velocity)/GroundSpeed); 00256 loopanim('courseseringue',AnimRate,0.2); 00257 } */ 00258 00259 //_____________________________________________________________________________ 00260 simulated function PlayWaiting() 00261 { 00262 if ( bDBAnim ) Log("--@ PlayWaiting call for "$self); 00263 00264 if ( (Controller != None) && Controller.bControlAnimations ) 00265 return; 00266 PlayAnim('attente',,0.25); 00267 PlayAnim('attente',,0.25,12); 00268 AnimBlendParams(12,1.0,0.0,0.0,FIRINGBLENDBONE); 00269 } 00270 function PlayTakeScalpels() 00271 { 00272 TakeAnimControl(false); 00273 PlayAnim('takescalpel',,0.4,FIRINGCHANNEL+1); 00274 } 00275 function PlayTakeFiole() 00276 { 00277 TakeAnimControl(false); 00278 PlayAnim('takefiole',2,0.4,FIRINGCHANNEL+1); 00279 } 00280 function PlayProvoc() 00281 { 00282 TakeAnimControl(false); 00283 if (rand(2)==0) 00284 { 00285 PlayAnim('provoc',2,0.4,FIRINGCHANNEL+1); 00286 } 00287 else 00288 { 00289 if (!bSerumSound) 00290 { 00291 bPlayedSound=true; 00292 triggerevent('dial_Ahahah',self,self); 00293 TimerSound=level.timeseconds; 00294 } 00295 PlayAnim('eclatrire',2,0.4,FIRINGCHANNEL+1); 00296 } 00297 } 00298 00299 Function InitScalpelAttach() 00300 { 00301 VisuelScalpel = Spawn(class'Scalpels_Attachment'); 00302 VisuelScalpel.SetDrawType(DT_StaticMesh); 00303 VisuelScalpel.SetDrawScale(1); 00304 AttachToBone(VisuelScalpel,'X R Hand'); 00305 VisuelScalpel.SetRelativeLocation(vect(8,-2,10)); 00306 VisuelScalpel.SetRelativeRotation(rot(+16000,10000,20000)); 00307 } 00308 Function InitPiquouseAttach() 00309 { 00310 VisuelPiquouse = Spawn(class'Piquouse_Attachment'); 00311 VisuelPiquouse.SetDrawType(DT_StaticMesh); 00312 VisuelPiquouse.SetDrawScale(1); 00313 AttachToBone(VisuelPiquouse,'X L Hand'); 00314 VisuelPiquouse.SetRelativeLocation(vect(9,-2,-5)); 00315 VisuelPiquouse.SetRelativeRotation(rot(-15000,0,00)); 00316 } 00317 Function InitFioleAttach() 00318 { 00319 VisuelFiole = Spawn(class'Fiole_Attachment'); 00320 VisuelFiole.SetDrawType(DT_StaticMesh); 00321 VisuelFiole.SetDrawScale(1); 00322 AttachToBone(VisuelFiole,'X R Hand'); 00323 VisuelFiole.SetRelativeLocation(vect(8,-2,4)); 00324 VisuelFiole.SetRelativeRotation(rot(+32000,30000,-30000)); 00325 } 00326 function PiquouseDansLaMain(bool bNeedToDisplay) 00327 { 00328 if (!bNeedToDisplay) 00329 VisuelPiquouse.SetDrawType(DT_none); 00330 else 00331 VisuelPiquouse.SetDrawType(DT_StaticMesh); 00332 } 00333 function ScalpelDansLaMain(bool bNeedToDisplay) 00334 { 00335 if (!bNeedToDisplay) 00336 VisuelScalpel.SetDrawType(DT_none); 00337 else 00338 VisuelScalpel.SetDrawType(DT_StaticMesh); 00339 } 00340 function FioleDansLaMain(bool bNeedToDisplay) 00341 { 00342 if (!bNeedToDisplay) 00343 VisuelFiole.SetDrawType(DT_none); 00344 else 00345 VisuelFiole.SetDrawType(DT_StaticMesh); 00346 } 00347 00348 simulated function vector GetScalpelStart(vector X, vector Y, vector Z) 00349 { 00350 local vector eyepos; 00351 00352 if (biscrouched) 00353 eyepos=vect(0,0,40); 00354 else 00355 eyepos=vect(0,0,60); 00356 return (Location + eyepos/*EyePosition() */+ ScalpelOffset.X * X + ScalpelOffset.Y * Y + ScalpelOffset.Z * Z); 00357 } 00358 00359 function ScalpelsFire() 00360 { 00361 //log("scalpel fire"); 00362 If (NbScalpels<=1) 00363 return; 00364 bispafable=false; 00365 bWeaponReady=false; 00366 TakeAnimControl(false); 00367 PlayAnim('lancer',,0.01,FIRINGCHANNEL+1); 00368 Settimer2(0.38,false); 00369 } 00370 00371 function ScalpelH2HFire() 00372 { 00373 If (NbScalpels<=0) 00374 return; 00375 bWeaponReady=false; 00376 TakeAnimControl(false); 00377 00378 switch(rand(3)) 00379 { 00380 case 0: PlayAnim('coup1',1.5,0.1,FIRINGCHANNEL+1); break; 00381 case 1: PlayAnim('coup2',1.5,0.1,FIRINGCHANNEL+1); break; 00382 case 2: PlayAnim('coup3',1.5,0.1,FIRINGCHANNEL+1); break; 00383 } 00384 Settimer2(0.36,false); 00385 } 00386 00387 function PiquouseFire() 00388 { 00389 bWeaponReady=false; 00390 TakeAnimControl(false); 00391 PlayAnim('planterseringue',1.5,0.4,FIRINGCHANNEL+1); 00392 Settimer2(0.6,false); 00393 } 00394 00395 function FioleFire() 00396 { 00397 If (NbFioles<=0) 00398 return; 00399 bispafable=false; 00400 bWeaponReady=false; 00401 TakeAnimControl(false); 00402 PlayAnim('lancer',,0.01,FIRINGCHANNEL+1); 00403 Settimer2(0.45,false); 00404 } 00405 00406 function SpawnCadavre() 00407 { 00408 //log("gotostate mort"); 00409 Controller.gotostate('mort'); 00410 } 00411 00412 //state dying du xiii pawn 00413 state Dying 00414 { 00415 event Tick (float delta) 00416 { 00417 // super(XIIIPawn).Tick(delta); 00418 } 00419 event Landed(vector HitNormal) 00420 { 00421 LandedSpecial(); 00422 PlaySound(hBodyFallSound); 00423 } 00424 event Touch(actor other) 00425 { 00426 // super(XIIIPawn).Touch(other); 00427 } 00428 event BeginState() 00429 { 00430 bInEndStateWeapon=false; 00431 settimer2(0,false); 00432 enable('tick'); 00433 bForceInUniverse = false; 00434 RefreshDisplaying(); 00435 00436 if ( bTearOff && (Level.NetMode == NM_DedicatedServer) ) 00437 LifeSpan = 1.0; 00438 SetTimer(2.0, false); 00439 00440 SetPhysics(PHYS_Falling); 00441 bInvulnerableBody = true; 00442 00443 if ( Controller != None ) 00444 { 00445 if( Controller.bIsPlayer ) 00446 Controller.PawnDied(); 00447 else 00448 SpawnCadavre(); 00449 if (controller != none) 00450 Controller.bControlAnimations = true; 00451 } 00452 } 00453 Begin: 00454 Sleep(0.5); 00455 bInvulnerableBody=false; 00456 // ELR Added LieStill there 0.5 seconds after state beginning because we don't want the col cyl staying big a long time 00457 LieStill(); 00458 } 00459 00460 00461 00462 defaultproperties 00463 { 00464 ScalpelOffset=(X=40.000000,Y=5.000000,Z=-2.000000) 00465 DistanceAttaque=600.000000 00466 NbScalpels=10 00467 bWeaponReady=True 00468 InitialInventory(0)=(Inventory=Class'XIII.TKnife',Count=2) 00469 bCanBeGrabbed=False 00470 GroundSpeed=650.000000 00471 Health=2000 00472 ControllerClass=Class'XIDPawn.JohanssonController' 00473 HeadShotFactor=1.500000 00474 Mesh=SkeletalMesh'XIIIPersos.JohanssonM' 00475 }

End Source Code