Core.Object | +--Engine.Actor | +--Engine.Pawn | +--Botpack.Bot | +--Botpack.HumanBotPlus
void
FastInAir()
PlayChallenge()
PlayCrawling()
PlayDodge(bool bDuckLeft)
PlayDuck()
PlayDying(name DamageType, vector HitLoc)
PlayFeignDeath()
PlayFiring()
PlayGutHit(float tweentime)
PlayHeadHit(float tweentime)
PlayInAir()
PlayLanded(float impactVel)
PlayLeftHit(float tweentime)
PlayLookAround()
PlayRecoil(float Rate)
PlayRightHit(float tweentime)
PlayRising()
PlayRunning()
PlaySwimming()
PlayTurning()
//----------------------------------------------------------------------------- // Animation functions
PlayVictoryDance()
PlayWaiting()
PlayWalking()
PlayWaving()
PlayWeaponSwitch(Weapon NewWeapon)
TweenToFighter(float tweentime)
TweenToRunning(float tweentime)
TweenToSwimming(float tweentime)
TweenToWaiting(float tweentime)
TweenToWalking(float tweentime)
00001 //============================================================================= 00002 // HumanBotPlus. 00003 //============================================================================= 00004 class HumanBotPlus extends Bot 00005 abstract; 00006 00007 //----------------------------------------------------------------------------- 00008 // Sound functions 00009 00010 00011 //----------------------------------------------------------------------------- 00012 // Animation functions 00013 00014 function PlayTurning() 00015 { 00016 BaseEyeHeight = Default.BaseEyeHeight; 00017 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00018 PlayAnim('TurnSM', 0.3, 0.3); 00019 else 00020 PlayAnim('TurnLG', 0.3, 0.3); 00021 } 00022 00023 function PlayVictoryDance() 00024 { 00025 PlayAnim('Victory1', 0.7); 00026 } 00027 00028 function PlayWaving() 00029 { 00030 PlayAnim('Wave', 0.7, 0.2); 00031 } 00032 00033 function TweenToWalking(float tweentime) 00034 { 00035 if ( Physics == PHYS_Swimming ) 00036 { 00037 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00038 TweenToSwimming(tweentime); 00039 else 00040 TweenToWaiting(tweentime); 00041 } 00042 00043 BaseEyeHeight = Default.BaseEyeHeight; 00044 if (Weapon == None) 00045 TweenAnim('Walk', tweentime); 00046 else if ( Weapon.bPointing ) 00047 { 00048 if (Weapon.Mass < 20) 00049 TweenAnim('WalkSMFR', tweentime); 00050 else 00051 TweenAnim('WalkLGFR', tweentime); 00052 } 00053 else 00054 { 00055 if (Weapon.Mass < 20) 00056 TweenAnim('WalkSM', tweentime); 00057 else 00058 TweenAnim('WalkLG', tweentime); 00059 } 00060 } 00061 00062 function TweenToRunning(float tweentime) 00063 { 00064 local name newAnim; 00065 00066 if ( Physics == PHYS_Swimming ) 00067 { 00068 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00069 TweenToSwimming(tweentime); 00070 else 00071 TweenToWaiting(tweentime); 00072 return; 00073 } 00074 00075 BaseEyeHeight = Default.BaseEyeHeight; 00076 00077 if (Weapon == None) 00078 newAnim = 'RunSM'; 00079 else if ( Weapon.bPointing ) 00080 { 00081 if (Weapon.Mass < 20) 00082 newAnim = 'RunSMFR'; 00083 else 00084 newAnim = 'RunLGFR'; 00085 } 00086 else 00087 { 00088 if (Weapon.Mass < 20) 00089 newAnim = 'RunSM'; 00090 else 00091 newAnim = 'RunLG'; 00092 } 00093 00094 if ( (newAnim == AnimSequence) && (Acceleration != vect(0,0,0)) && IsAnimating() ) 00095 return; 00096 TweenAnim(newAnim, tweentime); 00097 } 00098 00099 function PlayWalking() 00100 { 00101 if ( Physics == PHYS_Swimming ) 00102 { 00103 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00104 PlaySwimming(); 00105 else 00106 PlayWaiting(); 00107 return; 00108 } 00109 00110 BaseEyeHeight = Default.BaseEyeHeight; 00111 if (Weapon == None) 00112 LoopAnim('Walk'); 00113 else if ( Weapon.bPointing ) 00114 { 00115 if (Weapon.Mass < 20) 00116 LoopAnim('WalkSMFR'); 00117 else 00118 LoopAnim('WalkLGFR'); 00119 } 00120 else 00121 { 00122 if (Weapon.Mass < 20) 00123 LoopAnim('WalkSM'); 00124 else 00125 LoopAnim('WalkLG'); 00126 } 00127 } 00128 00129 function PlayRunning() 00130 { 00131 local float strafeMag; 00132 local vector Focus2D, Loc2D, Dest2D; 00133 local vector lookDir, moveDir, Y; 00134 local name NewAnim; 00135 00136 if ( Physics == PHYS_Swimming ) 00137 { 00138 if ( (vector(Rotation) Dot Acceleration) > 0 ) 00139 PlaySwimming(); 00140 else 00141 PlayWaiting(); 00142 return; 00143 } 00144 BaseEyeHeight = Default.BaseEyeHeight; 00145 00146 if ( bAdvancedTactics && !bNoTact ) 00147 { 00148 if ( bTacticalDir ) 00149 LoopAnim('StrafeL'); 00150 else 00151 LoopAnim('StrafeR'); 00152 return; 00153 } 00154 else if ( Focus != Destination ) 00155 { 00156 // check for strafe or backup 00157 Focus2D = Focus; 00158 Focus2D.Z = 0; 00159 Loc2D = Location; 00160 Loc2D.Z = 0; 00161 Dest2D = Destination; 00162 Dest2D.Z = 0; 00163 lookDir = Normal(Focus2D - Loc2D); 00164 moveDir = Normal(Dest2D - Loc2D); 00165 strafeMag = lookDir dot moveDir; 00166 if ( strafeMag < 0.75 ) 00167 { 00168 if ( strafeMag < -0.75 ) 00169 LoopAnim('BackRun'); 00170 else 00171 { 00172 Y = (lookDir Cross vect(0,0,1)); 00173 if ((Y Dot (Dest2D - Loc2D)) > 0) 00174 LoopAnim('StrafeL'); 00175 else 00176 LoopAnim('StrafeR'); 00177 } 00178 return; 00179 } 00180 } 00181 00182 if (Weapon == None) 00183 newAnim = 'RunSM'; 00184 else if ( Weapon.bPointing ) 00185 { 00186 if (Weapon.Mass < 20) 00187 newAnim = 'RunSMFR'; 00188 else 00189 newAnim = 'RunLGFR'; 00190 } 00191 else 00192 { 00193 if (Weapon.Mass < 20) 00194 newAnim = 'RunSM'; 00195 else 00196 newAnim = 'RunLG'; 00197 } 00198 if ( (newAnim == AnimSequence) && IsAnimating() ) 00199 return; 00200 00201 LoopAnim(NewAnim); 00202 } 00203 00204 function PlayRising() 00205 { 00206 BaseEyeHeight = 0.4 * Default.BaseEyeHeight; 00207 TweenAnim('DuckWlkS', 0.7); 00208 } 00209 00210 function PlayFeignDeath() 00211 { 00212 local float decision; 00213 00214 BaseEyeHeight = 0; 00215 if ( decision < 0.33 ) 00216 TweenAnim('DeathEnd', 0.5); 00217 else if ( decision < 0.67 ) 00218 TweenAnim('DeathEnd2', 0.5); 00219 else 00220 TweenAnim('DeathEnd3', 0.5); 00221 } 00222 00223 function PlayDying(name DamageType, vector HitLoc) 00224 { 00225 local vector X,Y,Z, HitVec, HitVec2D; 00226 local float dotp; 00227 local carcass carc; 00228 00229 BaseEyeHeight = Default.BaseEyeHeight; 00230 PlayDyingSound(); 00231 PlayAnim('Dead3',0.7,0.1); 00232 } 00233 00234 function PlayGutHit(float tweentime) 00235 { 00236 if ( (AnimSequence == 'GutHit') || (AnimSequence == 'Dead2') ) 00237 { 00238 if (FRand() < 0.5) 00239 TweenAnim('LeftHit', tweentime); 00240 else 00241 TweenAnim('RightHit', tweentime); 00242 } 00243 else if ( FRand() < 0.6 ) 00244 TweenAnim('GutHit', tweentime); 00245 else 00246 TweenAnim('Dead2', tweentime); 00247 00248 } 00249 00250 function PlayHeadHit(float tweentime) 00251 { 00252 if ( (AnimSequence == 'HeadHit') || (AnimSequence == 'Dead4') ) 00253 TweenAnim('GutHit', tweentime); 00254 else if ( FRand() < 0.6 ) 00255 TweenAnim('HeadHit', tweentime); 00256 else 00257 TweenAnim('Dead4', tweentime); 00258 } 00259 00260 function PlayLeftHit(float tweentime) 00261 { 00262 if ( (AnimSequence == 'LeftHit') || (AnimSequence == 'Dead3') ) 00263 TweenAnim('GutHit', tweentime); 00264 else if ( FRand() < 0.6 ) 00265 TweenAnim('LeftHit', tweentime); 00266 else 00267 TweenAnim('Dead3', tweentime); 00268 } 00269 00270 function PlayRightHit(float tweentime) 00271 { 00272 if ( (AnimSequence == 'RightHit') || (AnimSequence == 'Dead5') ) 00273 TweenAnim('GutHit', tweentime); 00274 else if ( FRand() < 0.6 ) 00275 TweenAnim('RightHit', tweentime); 00276 else 00277 TweenAnim('Dead5', tweentime); 00278 } 00279 00280 function PlayLanded(float impactVel) 00281 { 00282 impactVel = impactVel/JumpZ; 00283 impactVel = 0.1 * impactVel * impactVel; 00284 BaseEyeHeight = Default.BaseEyeHeight; 00285 00286 if ( impactVel > 0.17 ) 00287 PlaySound(LandGrunt, SLOT_Talk, FMin(4, 5 * impactVel),false,1600,FRand()*0.4+0.8); 00288 if ( !FootRegion.Zone.bWaterZone && (impactVel > 0.01) ) 00289 PlaySound(Land, SLOT_Interact, FClamp(4 * impactVel,0.2,4.5), false,1600, 1.0); 00290 00291 if ( (impactVel > 0.06) || (GetAnimGroup(AnimSequence) == 'Jumping') ) 00292 { 00293 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00294 TweenAnim('LandSMFR', 0.12); 00295 else 00296 TweenAnim('LandLGFR', 0.12); 00297 } 00298 else if ( !IsAnimating() ) 00299 { 00300 if ( GetAnimGroup(AnimSequence) == 'TakeHit' ) 00301 AnimEnd(); 00302 else 00303 { 00304 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00305 TweenAnim('LandSMFR', 0.12); 00306 else 00307 TweenAnim('LandLGFR', 0.12); 00308 } 00309 } 00310 } 00311 00312 function FastInAir() 00313 { 00314 local float TweenTime; 00315 00316 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00317 if ( GetAnimGroup(AnimSequence) == 'Jumping' ) 00318 { 00319 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00320 TweenAnim('DuckWlkS', 1); 00321 else 00322 TweenAnim('DuckWlkL', 1); 00323 return; 00324 } 00325 else if ( GetAnimGroup(AnimSequence) == 'Ducking' ) 00326 TweenTime = 1; 00327 else 00328 TweenTime = 0.3; 00329 00330 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00331 TweenAnim('JumpSMFR', TweenTime); 00332 else 00333 TweenAnim('JumpLGFR', TweenTime); 00334 } 00335 00336 function PlayInAir() 00337 { 00338 local float TweenTime; 00339 00340 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00341 if ( GetAnimGroup(AnimSequence) == 'Jumping' ) 00342 { 00343 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00344 TweenAnim('DuckWlkS', 2); 00345 else 00346 TweenAnim('DuckWlkL', 2); 00347 return; 00348 } 00349 else if ( GetAnimGroup(AnimSequence) == 'Ducking' ) 00350 TweenTime = 2; 00351 else 00352 TweenTime = 0.7; 00353 00354 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00355 TweenAnim('JumpSMFR', TweenTime); 00356 else 00357 TweenAnim('JumpLGFR', TweenTime); 00358 } 00359 00360 function PlayDodge(bool bDuckLeft) 00361 { 00362 if ( bDuckLeft ) 00363 TweenAnim('DodgeL', 0.25); 00364 else 00365 TweenAnim('DodgeR', 0.25); 00366 } 00367 00368 function PlayDuck() 00369 { 00370 BaseEyeHeight = 0; 00371 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00372 TweenAnim('DuckWlkS', 0.25); 00373 else 00374 TweenAnim('DuckWlkL', 0.25); 00375 } 00376 00377 function PlayCrawling() 00378 { 00379 //log("Play duck"); 00380 BaseEyeHeight = 0; 00381 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00382 LoopAnim('DuckWlkS'); 00383 else 00384 LoopAnim('DuckWlkL'); 00385 } 00386 00387 function TweenToWaiting(float tweentime) 00388 { 00389 if ( Physics == PHYS_Swimming ) 00390 { 00391 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00392 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00393 TweenAnim('TreadSM', tweentime); 00394 else 00395 TweenAnim('TreadLG', tweentime); 00396 } 00397 else 00398 { 00399 BaseEyeHeight = Default.BaseEyeHeight; 00400 if ( Enemy != None ) 00401 ViewRotation = Rotator(Enemy.Location - Location); 00402 else 00403 { 00404 if ( GetAnimGroup(AnimSequence) == 'Waiting' ) 00405 return; 00406 ViewRotation.Pitch = 0; 00407 } 00408 ViewRotation.Pitch = ViewRotation.Pitch & 65535; 00409 If ( (ViewRotation.Pitch > RotationRate.Pitch) 00410 && (ViewRotation.Pitch < 65536 - RotationRate.Pitch) ) 00411 { 00412 If (ViewRotation.Pitch < 32768) 00413 { 00414 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00415 TweenAnim('AimUpSm', 0.3); 00416 else 00417 TweenAnim('AimUpLg', 0.3); 00418 } 00419 else 00420 { 00421 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00422 TweenAnim('AimDnSm', 0.3); 00423 else 00424 TweenAnim('AimDnLg', 0.3); 00425 } 00426 } 00427 else if ( (Weapon == None) || (Weapon.Mass < 20) ) 00428 TweenAnim('StillSMFR', tweentime); 00429 else 00430 TweenAnim('StillFRRP', tweentime); 00431 } 00432 } 00433 00434 function TweenToFighter(float tweentime) 00435 { 00436 TweenToWaiting(tweentime); 00437 } 00438 00439 00440 function PlayChallenge() 00441 { 00442 TweenToWaiting(0.17); 00443 } 00444 00445 function PlayLookAround() 00446 { 00447 LoopAnim('Look', 0.3 + 0.7 * FRand(), 0.1); 00448 } 00449 00450 function PlayWaiting() 00451 { 00452 local name newAnim; 00453 00454 if ( Physics == PHYS_Swimming ) 00455 { 00456 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00457 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00458 LoopAnim('TreadSM'); 00459 else 00460 LoopAnim('TreadLG'); 00461 } 00462 else 00463 { 00464 BaseEyeHeight = Default.BaseEyeHeight; 00465 if ( (Weapon != None) && Weapon.bPointing ) 00466 { 00467 if ( Weapon.bRapidFire && ((bFire != 0) || (bAltFire != 0)) ) 00468 LoopAnim('StillFRRP'); 00469 else if ( Weapon.Mass < 20 ) 00470 TweenAnim('StillSMFR', 0.3); 00471 else 00472 TweenAnim('StillFRRP', 0.3); 00473 } 00474 else 00475 { 00476 if ( Level.Game.bTeamGame 00477 && ((FRand() < 0.04) 00478 || ((AnimSequence == 'Chat1') && (FRand() < 0.75))) ) 00479 { 00480 newAnim = 'Chat1'; 00481 } 00482 else if ( FRand() < 0.1 ) 00483 { 00484 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00485 PlayAnim('CockGun', 0.5 + 0.5 * FRand(), 0.3); 00486 else 00487 PlayAnim('CockGunL', 0.5 + 0.5 * FRand(), 0.3); 00488 } 00489 else 00490 { 00491 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00492 { 00493 if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1') || (AnimSequence == 'Breath2')) ) 00494 newAnim = AnimSequence; 00495 else if ( FRand() < 0.5 ) 00496 newAnim = 'Breath1'; 00497 else 00498 newAnim = 'Breath2'; 00499 } 00500 else 00501 { 00502 if ( (FRand() < 0.75) && ((AnimSequence == 'Breath1L') || (AnimSequence == 'Breath2L')) ) 00503 newAnim = AnimSequence; 00504 else if ( FRand() < 0.5 ) 00505 newAnim = 'Breath1L'; 00506 else 00507 newAnim = 'Breath2L'; 00508 } 00509 00510 if ( AnimSequence == newAnim ) 00511 LoopAnim(newAnim, 0.4 + 0.4 * FRand()); 00512 else 00513 PlayAnim(newAnim, 0.4 + 0.4 * FRand(), 0.25); 00514 } 00515 } 00516 } 00517 } 00518 00519 function PlayRecoil(float Rate) 00520 { 00521 if ( Weapon.bRapidFire ) 00522 { 00523 if ( (Weapon.AmmoType != None) && (Weapon.AmmoType.AmmoAmount < 2) ) 00524 TweenAnim('StillFRRP', 0.1); 00525 else if ( !IsAnimating() && (Physics == PHYS_Walking) ) 00526 LoopAnim('StillFRRP', 0.02); 00527 } 00528 else if ( AnimSequence == 'StillSmFr' ) 00529 PlayAnim('StillSmFr', Rate, 0.02); 00530 else if ( (AnimSequence == 'StillLgFr') || (AnimSequence == 'StillFrRp') ) 00531 PlayAnim('StillLgFr', Rate, 0.02); 00532 } 00533 00534 function PlayFiring() 00535 { 00536 // switch animation sequence mid-stream if needed 00537 if ( GetAnimGroup(AnimSequence) == 'MovingFire' ) 00538 return; 00539 else if (AnimSequence == 'RunLG') 00540 AnimSequence = 'RunLGFR'; 00541 else if (AnimSequence == 'RunSM') 00542 AnimSequence = 'RunSMFR'; 00543 else if (AnimSequence == 'WalkLG') 00544 AnimSequence = 'WalkLGFR'; 00545 else if (AnimSequence == 'WalkSM') 00546 AnimSequence = 'WalkSMFR'; 00547 else if ( AnimSequence == 'JumpSMFR' ) 00548 TweenAnim('JumpSMFR', 0.03); 00549 else if ( AnimSequence == 'JumpLGFR' ) 00550 TweenAnim('JumpLGFR', 0.03); 00551 else if ( (GetAnimGroup(AnimSequence) == 'Waiting') || (GetAnimGroup(AnimSequence) == 'Gesture') 00552 && (AnimSequence != 'TreadLG') && (AnimSequence != 'TreadSM') ) 00553 { 00554 if ( Weapon.Mass < 20 ) 00555 TweenAnim('StillSMFR', 0.02); 00556 else if ( !Weapon.bRapidFire || (AnimSequence != 'StillFRRP') ) 00557 TweenAnim('StillFRRP', 0.02); 00558 else if ( !IsAnimating() ) 00559 LoopAnim('StillFRRP'); 00560 } 00561 } 00562 00563 function PlayWeaponSwitch(Weapon NewWeapon) 00564 { 00565 if ( (Weapon == None) || (Weapon.Mass < 20) ) 00566 { 00567 if ( (NewWeapon != None) && (NewWeapon.Mass > 20) ) 00568 { 00569 if ( (AnimSequence == 'RunSM') || (AnimSequence == 'RunSMFR') ) 00570 AnimSequence = 'RunLG'; 00571 else if ( (AnimSequence == 'WalkSM') || (AnimSequence == 'WalkSMFR') ) 00572 AnimSequence = 'WalkLG'; 00573 else if ( AnimSequence == 'JumpSMFR' ) 00574 AnimSequence = 'JumpLGFR'; 00575 else if ( AnimSequence == 'DuckWlkL' ) 00576 AnimSequence = 'DuckWlkS'; 00577 else if ( AnimSequence == 'StillSMFR' ) 00578 AnimSequence = 'StillFRRP'; 00579 else if ( AnimSequence == 'AimDnSm' ) 00580 AnimSequence = 'AimDnLg'; 00581 else if ( AnimSequence == 'AimUpSm' ) 00582 AnimSequence = 'AimUpLg'; 00583 } 00584 } 00585 else if ( (NewWeapon == None) || (NewWeapon.Mass < 20) ) 00586 { 00587 if ( (AnimSequence == 'RunLG') || (AnimSequence == 'RunLGFR') ) 00588 AnimSequence = 'RunSM'; 00589 else if ( (AnimSequence == 'WalkLG') || (AnimSequence == 'WalkLGFR') ) 00590 AnimSequence = 'WalkSM'; 00591 else if ( AnimSequence == 'JumpLGFR' ) 00592 AnimSequence = 'JumpSMFR'; 00593 else if ( AnimSequence == 'DuckWlkS' ) 00594 AnimSequence = 'DuckWlkL'; 00595 else if (AnimSequence == 'StillFRRP') 00596 AnimSequence = 'StillSMFR'; 00597 else if ( AnimSequence == 'AimDnLg' ) 00598 AnimSequence = 'AimDnSm'; 00599 else if ( AnimSequence == 'AimUpLg' ) 00600 AnimSequence = 'AimUpSm'; 00601 } 00602 } 00603 00604 function PlaySwimming() 00605 { 00606 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00607 if ((Weapon == None) || (Weapon.Mass < 20) ) 00608 LoopAnim('SwimSM'); 00609 else 00610 LoopAnim('SwimLG'); 00611 } 00612 00613 function TweenToSwimming(float tweentime) 00614 { 00615 BaseEyeHeight = 0.7 * Default.BaseEyeHeight; 00616 if ((Weapon == None) || (Weapon.Mass < 20) ) 00617 TweenAnim('SwimSM',tweentime); 00618 else 00619 TweenAnim('SwimLG',tweentime); 00620 } 00621 00622 State ImpactJumping 00623 { 00624 function PlayWaiting() 00625 { 00626 TweenAnim('AimDnLg', 0.3); 00627 } 00628 } 00629 00630 defaultproperties 00631 { 00632 Footstep1=Sound'Botpack.FemaleSounds.(All).stone02' 00633 Footstep2=Sound'Botpack.FemaleSounds.(All).stone04' 00634 Footstep3=Sound'Botpack.FemaleSounds.(All).stone05' 00635 bIsHuman=True 00636 BaseEyeHeight=27.000000 00637 EyeHeight=27.000000 00638 CollisionRadius=17.000000 00639 CollisionHeight=39.000000 00640 Buoyancy=99.000000 00641 }