Core.Object | +--Engine.Actor | +--Engine.Pawn | +--UnrealShare.Bots | +--UnrealI.SkaarjPlayerBot
void
PlayChallenge()
PlayCrawling()
PlayDodge(bool bDuckLeft)
//----------------------------------------------------------------------------- // Animation functions
PlayDuck()
PlayDying(name DamageType, vector HitLoc)
PlayFeignDeath()
PlayFiring()
PlayGutHit(float tweentime)
//FIXME - add death first frames as alternate takehit anims!!!
PlayHeadHit(float tweentime)
PlayInAir()
PlayLanded(float impactVel)
PlayLeftHit(float tweentime)
PlayRightHit(float tweentime)
PlayRising()
PlayRunning()
PlaySwimming()
PlayTurning()
PlayWaiting()
PlayWalking()
PlayWeaponSwitch(Weapon NewWeapon)
simulated
RunStep()
TweenToRunning(float tweentime)
TweenToSwimming(float tweentime)
TweenToWaiting(float tweentime)
TweenToWalking(float tweentime)
WalkStep()
Landed(vector HitNormal)
00001 //============================================================================= 00002 // SkaarjPlayerBot. 00003 //============================================================================= 00004 class SkaarjPlayerBot extends Bots; 00005 00006 #exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Male\UWinjur41.WAV" NAME="MUWHit1" GROUP="Male" 00007 #exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Male\UWinjur42.WAV" NAME="MUWHit2" GROUP="Male" 00008 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\gasp01.WAV" NAME="SKPGasp1" GROUP="Skaarj" 00009 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\drown01.WAV" NAME="SKPDrown1" GROUP="Skaarj" 00010 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\jump01.WAV" NAME="SKPJump1" GROUP="Skaarj" 00011 #exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Cow\walknc.WAV" NAME="walkC" GROUP="Cow" 00012 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur01.WAV" NAME="SKPInjur1" GROUP="Skaarj" 00013 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur02.WAV" NAME="SKPInjur2" GROUP="Skaarj" 00014 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur03.WAV" NAME="SKPInjur3" GROUP="Skaarj" 00015 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur04.WAV" NAME="SKPInjur4" GROUP="Skaarj" 00016 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death01.WAV" NAME="SKPDeath1" GROUP="Skaarj" 00017 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death02.WAV" NAME="SKPDeath2" GROUP="Skaarj" 00018 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death03.WAV" NAME="SKPDeath3" GROUP="Skaarj" 00019 #exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\land01.WAV" NAME="Land1SK" GROUP="Skaarj" 00020 00021 simulated function WalkStep() 00022 { 00023 local sound step; 00024 local float decision; 00025 00026 if ( Role < ROLE_Authority ) 00027 return; 00028 if ( FootRegion.Zone.bWaterZone ) 00029 { 00030 PlaySound(sound 'LSplash', SLOT_Interact, 1, false, 1000.0, 1.0); 00031 return; 00032 } 00033 00034 PlaySound(Footstep1, SLOT_Interact, 0.1, false, 800.0, 1.0); 00035 } 00036 00037 simulated function RunStep() 00038 { 00039 local sound step; 00040 local float decision; 00041 00042 if ( Role < ROLE_Authority ) 00043 return; 00044 if ( FootRegion.Zone.bWaterZone ) 00045 { 00046 PlaySound(sound 'LSplash', SLOT_Interact, 1, false, 1000.0, 1.0); 00047 return; 00048 } 00049 00050 PlaySound(Footstep1, SLOT_Interact, 0.7, false, 800.0, 1.0); 00051 } 00052 00053 //----------------------------------------------------------------------------- 00054 // Animation functions 00055 00056 function PlayDodge(bool bDuckLeft) 00057 { 00058 bCanDuck = false; 00059 Velocity.Z = 200; 00060 if ( bDuckLeft ) 00061 PlayAnim('LeftDodge', 1.35, 0.06); 00062 else 00063 PlayAnim('RightDodge', 1.35, 0.06); 00064 } 00065 00066 function PlayTurning() 00067 { 00068 BaseEyeHeight = Default.BaseEyeHeight; 00069 PlayAnim('Turn', 0.3, 0.3); 00070 } 00071 00072 function TweenToWalking(float tweentime) 00073 { 00074 if ( Physics == PHYS_Swimming ) 00075 { 00076 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00077 TweenToSwimming(tweentime); 00078 else 00079 TweenToWaiting(tweentime); 00080 } 00081 00082 BaseEyeHeight = Default.BaseEyeHeight; 00083 if (Weapon == None) 00084 TweenAnim('Walk', tweentime); 00085 else if ( Weapon.bPointing || (CarriedDecoration != None) ) 00086 TweenAnim('WalkFire', tweentime); 00087 else 00088 TweenAnim('Walk', tweentime); 00089 } 00090 00091 function TweenToRunning(float tweentime) 00092 { 00093 if ( Physics == PHYS_Swimming ) 00094 { 00095 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00096 TweenToSwimming(tweentime); 00097 else 00098 TweenToWaiting(tweentime); 00099 } 00100 00101 BaseEyeHeight = Default.BaseEyeHeight; 00102 if (bIsWalking) 00103 TweenToWalking(0.1); 00104 else if ( (Weapon != None) && Weapon.bPointing ) 00105 TweenAnim('JogFire', tweentime); 00106 else 00107 TweenAnim('Jog', tweentime); 00108 } 00109 00110 function PlayWalking() 00111 { 00112 if ( Physics == PHYS_Swimming ) 00113 { 00114 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00115 PlaySwimming(); 00116 else 00117 PlayWaiting(); 00118 return; 00119 } 00120 00121 BaseEyeHeight = Default.BaseEyeHeight; 00122 if (Weapon == None) 00123 LoopAnim('Walk'); 00124 else if ( Weapon.bPointing || (CarriedDecoration != None) ) 00125 LoopAnim('WalkFire'); 00126 else 00127 LoopAnim('Walk'); 00128 } 00129 00130 function PlayRunning() 00131 { 00132 if ( Physics == PHYS_Swimming ) 00133 { 00134 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00135 PlaySwimming(); 00136 else 00137 PlayWaiting(); 00138 return; 00139 } 00140 00141 BaseEyeHeight = Default.BaseEyeHeight; 00142 if (Weapon == None) 00143 LoopAnim('Jog'); 00144 else if ( Weapon.bPointing ) 00145 LoopAnim('JogFire'); 00146 else 00147 LoopAnim('Jog'); 00148 } 00149 00150 function PlayRising() 00151 { 00152 BaseEyeHeight = 0.4 * Default.BaseEyeHeight; 00153 PlayAnim('Getup', 0.7, 0.1); 00154 } 00155 00156 function PlayFeignDeath() 00157 { 00158 BaseEyeHeight = 0; 00159 PlayAnim('Death2',0.7); 00160 } 00161 00162 function PlayDying(name DamageType, vector HitLoc) 00163 { 00164 local vector X,Y,Z, HitVec, HitVec2D; 00165 local float dotp; 00166 00167 BaseEyeHeight = Default.BaseEyeHeight; 00168 PlayDyingSound(); 00169 00170 if ( FRand() < 0.15 ) 00171 { 00172 PlayAnim('Death',0.7,0.1); 00173 return; 00174 } 00175 00176 // check for big hit 00177 if ( (Velocity.Z > 250) && (FRand() < 0.7) ) 00178 { 00179 PlayAnim('Death2', 0.7, 0.1); 00180 return; 00181 } 00182 00183 // check for head hit 00184 if ( ((DamageType == 'Decapitated') || (HitLoc.Z - Location.Z > 0.6 * CollisionHeight)) 00185 && !Level.Game.bVeryLowGore ) 00186 { 00187 DamageType = 'Decapitated'; 00188 PlayAnim('Death', 0.7, 0.1); 00189 return; 00190 } 00191 00192 00193 if ( FRand() < 0.15) 00194 { 00195 PlayAnim('Death3', 0.7, 0.1); 00196 return; 00197 } 00198 00199 GetAxes(Rotation,X,Y,Z); 00200 X.Z = 0; 00201 HitVec = Normal(HitLoc - Location); 00202 HitVec2D= HitVec; 00203 HitVec2D.Z = 0; 00204 dotp = HitVec2D dot X; 00205 00206 if (Abs(dotp) > 0.71) //then hit in front or back 00207 PlayAnim('Death3', 0.7, 0.1); 00208 else 00209 { 00210 dotp = HitVec dot Y; 00211 if (dotp > 0.0) 00212 PlayAnim('Death', 0.7, 0.1); 00213 else 00214 PlayAnim('Death4', 0.7, 0.1); 00215 } 00216 } 00217 00218 //FIXME - add death first frames as alternate takehit anims!!! 00219 00220 function PlayGutHit(float tweentime) 00221 { 00222 if ( AnimSequence == 'GutHit' ) 00223 { 00224 if (FRand() < 0.5) 00225 TweenAnim('LeftHit', tweentime); 00226 else 00227 TweenAnim('RightHit', tweentime); 00228 } 00229 else 00230 TweenAnim('GutHit', tweentime); 00231 } 00232 00233 function PlayHeadHit(float tweentime) 00234 { 00235 if ( AnimSequence == 'HeadHit' ) 00236 TweenAnim('GutHit', tweentime); 00237 else 00238 TweenAnim('HeadHit', tweentime); 00239 } 00240 00241 function PlayLeftHit(float tweentime) 00242 { 00243 if ( AnimSequence == 'LeftHit' ) 00244 TweenAnim('GutHit', tweentime); 00245 else 00246 TweenAnim('LeftHit', tweentime); 00247 } 00248 00249 function PlayRightHit(float tweentime) 00250 { 00251 if ( AnimSequence == 'RightHit' ) 00252 TweenAnim('GutHit', tweentime); 00253 else 00254 TweenAnim('RightHit', tweentime); 00255 } 00256 00257 function PlayLanded(float impactVel) 00258 { 00259 impactVel = impactVel/JumpZ; 00260 impactVel = 0.1 * impactVel * impactVel; 00261 BaseEyeHeight = Default.BaseEyeHeight; 00262 00263 if ( Role == ROLE_Authority ) 00264 { 00265 if ( impactVel > 0.17 ) 00266 PlaySound(LandGrunt, SLOT_Talk, FMin(5, 5 * impactVel),false,1200,FRand()*0.4+0.8); 00267 if ( !FootRegion.Zone.bWaterZone && (impactVel > 0.01) ) 00268 PlaySound(Land, SLOT_Interact, FClamp(4.5 * impactVel,0.5,6), false, 1000, 1.0); 00269 } 00270 00271 if ( (GetAnimGroup(AnimSequence) == 'Dodge') && IsAnimating() ) 00272 return; 00273 if ( (impactVel > 0.06) || (GetAnimGroup(AnimSequence) == 'Jumping') ) 00274 TweenAnim('Land', 0.12); 00275 else if ( !IsAnimating() ) 00276 { 00277 if ( GetAnimGroup(AnimSequence) == 'TakeHit' ) 00278 AnimEnd(); 00279 else 00280 TweenAnim('Land', 0.12); 00281 } 00282 } 00283 00284 function PlayInAir() 00285 { 00286 BaseEyeHeight = Default.BaseEyeHeight; 00287 TweenAnim('InAir', 0.4); 00288 } 00289 00290 function PlayDuck() 00291 { 00292 BaseEyeHeight = 0; 00293 TweenAnim('Duck', 0.25); 00294 } 00295 00296 function PlayCrawling() 00297 { 00298 BaseEyeHeight = 0; 00299 LoopAnim('DuckWalk'); 00300 } 00301 00302 function TweenToWaiting(float tweentime) 00303 { 00304 if( Physics==PHYS_Swimming ) 00305 { 00306 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00307 TweenAnim('Swim', tweentime); 00308 } 00309 else 00310 { 00311 BaseEyeHeight = Default.BaseEyeHeight; 00312 TweenAnim('Firing', tweentime); 00313 } 00314 } 00315 00316 function PlayWaiting() 00317 { 00318 local name newAnim; 00319 00320 if( Physics==PHYS_Swimming ) 00321 { 00322 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00323 LoopAnim('Swim'); 00324 } 00325 else 00326 { 00327 BaseEyeHeight = Default.BaseEyeHeight; 00328 if ( (Weapon != None) && Weapon.bPointing ) 00329 TweenAnim('Firing', 0.3); 00330 else 00331 { 00332 if ( FRand() < 0.2 ) 00333 newAnim = 'Breath'; 00334 else 00335 newAnim = 'Breath2'; 00336 00337 if ( AnimSequence == newAnim ) 00338 LoopAnim(newAnim, 0.3 + 0.7 * FRand()); 00339 else 00340 PlayAnim(newAnim, 0.3 + 0.7 * FRand(), 0.25); 00341 } 00342 } 00343 } 00344 00345 function PlayFiring() 00346 { 00347 // switch animation sequence mid-stream if needed 00348 if (AnimSequence == 'Jog') 00349 AnimSequence = 'JogFire'; 00350 else if (AnimSequence == 'Walk') 00351 AnimSequence = 'WalkFire'; 00352 else if ( AnimSequence == 'InAir' ) 00353 TweenAnim('JogFire', 0.03); 00354 else if ( (GetAnimGroup(AnimSequence) != 'Attack') 00355 && (GetAnimGroup(AnimSequence) != 'MovingAttack') 00356 && (GetAnimGroup(AnimSequence) != 'Dodge') 00357 && (AnimSequence != 'Swim') ) 00358 TweenAnim('Firing', 0.02); 00359 } 00360 00361 function PlayChallenge() 00362 { 00363 local float decision; 00364 00365 decision = FRand(); 00366 if ( decision < 0.6 ) 00367 TweenToWaiting(0.1); 00368 else 00369 PlayAnim('Button1'); 00370 } 00371 00372 function PlayWeaponSwitch(Weapon NewWeapon) 00373 { 00374 } 00375 00376 function PlaySwimming() 00377 { 00378 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00379 LoopAnim('Swim'); 00380 } 00381 00382 function TweenToSwimming(float tweentime) 00383 { 00384 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00385 TweenAnim('Swim',tweentime); 00386 } 00387 00388 state FallingState 00389 { 00390 ignores Bump, Hitwall, HearNoise, WarnTarget; 00391 00392 function Landed(vector HitNormal) 00393 { 00394 local float landVol; 00395 00396 if ( GetAnimGroup(AnimSequence) == 'Dodge' ) 00397 { 00398 if (Velocity.Z <= -1100) 00399 { 00400 if ( (Velocity.Z < -2000) && (ReducedDamageType != 'All') ) 00401 { 00402 health = -1000; //make sure gibs 00403 Died(None, 'Fell', Location); 00404 } 00405 else if ( Role == ROLE_Authority ) 00406 TakeDamage(-0.15 * (Velocity.Z + 1050), None, Location, vect(0,0,0), 'Fell'); 00407 } 00408 landVol = Velocity.Z/JumpZ; 00409 landVol = 0.008 * Mass * landVol * landVol; 00410 if ( !FootRegion.Zone.bWaterZone ) 00411 PlaySound(Land, SLOT_Interact, FMin(20, landVol)); 00412 GotoState('FallingState', 'FinishDodge'); 00413 } 00414 else 00415 Super.Landed(HitNormal); 00416 } 00417 00418 FinishDodge: 00419 FinishAnim(); 00420 bCanDuck = true; 00421 Goto('Done'); 00422 } 00423 00424 defaultproperties 00425 { 00426 CarcassType=Class'UnrealI.TrooperCarcass' 00427 drown=Sound'UnrealI.Skaarj.SKPDrown1' 00428 breathagain=Sound'UnrealI.Skaarj.SKPGasp1' 00429 Footstep1=Sound'UnrealShare.Cow.walkC' 00430 Footstep2=Sound'UnrealShare.Cow.walkC' 00431 Footstep3=Sound'UnrealShare.Cow.walkC' 00432 HitSound3=Sound'UnrealI.Skaarj.SKPInjur3' 00433 HitSound4=Sound'UnrealI.Skaarj.SKPInjur4' 00434 Die2=Sound'UnrealI.Skaarj.SKPDeath2' 00435 Die3=Sound'UnrealI.Skaarj.SKPDeath3' 00436 Die4=Sound'UnrealI.Skaarj.SKPDeath3' 00437 GaspSound=Sound'UnrealI.Skaarj.SKPGasp1' 00438 UWHit1=Sound'UnrealShare.Male.MUWHit1' 00439 UWHit2=Sound'UnrealShare.Male.MUWHit2' 00440 LandGrunt=Sound'UnrealI.Skaarj.Land1SK' 00441 JumpSound=Sound'UnrealI.Skaarj.SKPJump1' 00442 JumpZ=360.000000 00443 BaseEyeHeight=24.750000 00444 EyeHeight=24.750000 00445 Health=120 00446 HitSound1=Sound'UnrealI.Skaarj.SKPInjur1' 00447 HitSound2=Sound'UnrealI.Skaarj.SKPInjur2' 00448 Die=Sound'UnrealI.Skaarj.SKPDeath1' 00449 Skin=Texture'UnrealI.Skins.sktrooper1' 00450 Mesh=LodMesh'UnrealI.sktrooper' 00451 CollisionRadius=32.000000 00452 CollisionHeight=42.000000 00453 Mass=120.000000 00454 Buoyancy=118.800003 00455 }