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 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 00916 00917 00918 00919 00920 00921 00922 00923 00924 00925 00926 00927 00928 00929 00930 00931 00932 00933 00934 00935 00936 00937 00938 00939 00940 00941 00942 00943 00944 00945 00946 00947 00948 00949 00950 00951 00952 00953 00954 00955 00956 00957 00958 00959 00960 00961 00962 00963 00964 00965 00966 00967 00968 00969 00970 00971 00972 00973 00974 00975 00976 00977 00978 00979 00980 00981 00982 00983 00984 00985 00986 00987 00988 00989 00990 00991 00992 00993 00994 00995 00996 00997 00998 00999 01000 01001 01002 01003 01004 01005 01006 01007 01008 01009 01010 01011 01012 01013 01014 01015 01016 01017 01018 01019 01020 01021 01022 01023 01024 01025 01026 01027 01028 01029 01030 01031 01032 01033 01034 01035 01036 01037 01038 01039 01040 01041 01042 01043 01044 01045 01046 01047 01048 01049 01050 01051 01052 01053 01054 01055 01056 01057 01058 01059 01060 01061 01062 01063 01064 01065 01066 |
//============================================================================= // Mercenary //============================================================================= class Mercenary extends ScriptedPawn; #exec MESH IMPORT MESH=Merc ANIVFILE=MODELS\Merc_a.3D DATAFILE=MODELS\Merc_d.3D X=0 Y=0 Z=0 ZEROTEX=1 #exec MESH ORIGIN MESH=Merc X=00 Y=-230 Z=-40 YAW=64 ROLL=-64 #exec MESH SEQUENCE MESH=Merc SEQ=All STARTFRAME=0 NUMFRAMES=447 #exec MESH SEQUENCE MESH=Merc SEQ=Breath STARTFRAME=0 NUMFRAMES=9 RATE=6 #exec MESH SEQUENCE MESH=Merc SEQ=Button1 STARTFRAME=9 NUMFRAMES=8 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Button2 STARTFRAME=17 NUMFRAMES=8 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Button3 STARTFRAME=25 NUMFRAMES=8 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Button4 STARTFRAME=33 NUMFRAMES=8 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Button5 STARTFRAME=41 NUMFRAMES=10 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Button6 STARTFRAME=51 NUMFRAMES=10 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=MButton1 STARTFRAME=9 NUMFRAMES=24 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=MButton2 STARTFRAME=17 NUMFRAMES=24 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=MButton3 STARTFRAME=25 NUMFRAMES=26 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=MButton4 STARTFRAME=33 NUMFRAMES=28 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Death STARTFRAME=61 NUMFRAMES=33 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Dead2 STARTFRAME=94 NUMFRAMES=16 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Dead3 STARTFRAME=110 NUMFRAMES=18 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Dead4 STARTFRAME=128 NUMFRAMES=16 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Duck STARTFRAME=144 NUMFRAMES=1 Group=Ducking #exec MESH SEQUENCE MESH=Merc SEQ=HeadHit STARTFRAME=145 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=LeftHit STARTFRAME=146 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=GutHit STARTFRAME=147 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=RightHit STARTFRAME=148 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=Jump STARTFRAME=149 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Jump2 STARTFRAME=164 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=Land STARTFRAME=165 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=Punch STARTFRAME=166 NUMFRAMES=10 RATE=15 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Run STARTFRAME=176 NUMFRAMES=10 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Shoot STARTFRAME=186 NUMFRAMES=5 RATE=15 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Spray STARTFRAME=191 NUMFRAMES=15 RATE=15 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Squat1 STARTFRAME=206 NUMFRAMES=10 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Squat2 STARTFRAME=216 NUMFRAMES=18 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Squat3 STARTFRAME=234 NUMFRAMES=7 RATE=6 #exec MESH SEQUENCE MESH=Merc SEQ=Stealth1 STARTFRAME=241 NUMFRAMES=4 RATE=6 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Stealth2 STARTFRAME=245 NUMFRAMES=3 RATE=6 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Swat STARTFRAME=248 NUMFRAMES=10 RATE=15 Group=Attack #exec MESH SEQUENCE MESH=Merc SEQ=Swim STARTFRAME=258 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Talk1 STARTFRAME=273 NUMFRAMES=13 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Talk2 STARTFRAME=286 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Talk3 STARTFRAME=301 NUMFRAMES=23 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Walk STARTFRAME=324 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=WalkFire STARTFRAME=339 NUMFRAMES=15 RATE=15 Group=MovingAttack #exec MESH SEQUENCE MESH=Merc SEQ=WalkSpray STARTFRAME=339 NUMFRAMES=15 RATE=15 Group=MovingAttack #exec MESH SEQUENCE MESH=Merc SEQ=Weapon STARTFRAME=354 NUMFRAMES=10 RATE=6 #exec MESH SEQUENCE MESH=Merc SEQ=Fighter STARTFRAME=166 NUMFRAMES=1 #exec MESH SEQUENCE MESH=Merc SEQ=ChargeUp STARTFRAME=364 NUMFRAMES=16 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=BigDance STARTFRAME=364 NUMFRAMES=31 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Dance STARTFRAME=380 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=Dead5 STARTFRAME=395 NUMFRAMES=26 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=NeckCrak STARTFRAME=421 NUMFRAMES=10 RATE=6 #exec MESH SEQUENCE MESH=Merc SEQ=SwimFire STARTFRAME=431 NUMFRAMES=15 RATE=15 #exec MESH SEQUENCE MESH=Merc SEQ=TiedUp STARTFRAME=446 NUMFRAMES=1 #exec TEXTURE IMPORT NAME=JMerc1 FILE=MODELS\Mercenar.PCX GROUP=Skins #exec TEXTURE IMPORT NAME=Silver FILE=MODELS\Silver.PCX GROUP=Skins #exec MESHMAP SCALE MESHMAP=Merc X=0.082 Y=0.082 Z=0.164 #exec MESHMAP SETTEXTURE MESHMAP=Merc NUM=0 TEXTURE=JMerc1 #exec MESH NOTIFY MESH=Merc SEQ=Swat TIME=0.48 FUNCTION=HitDamageTarget #exec MESH NOTIFY MESH=Merc SEQ=Punch TIME=0.48 FUNCTION=HitDamageTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.16 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.26 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.36 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.46 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.56 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Spray TIME=0.66 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=WalkSpray TIME=0.2 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=WalkSpray TIME=0.3 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=WalkSpray TIME=0.4 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Run TIME=0.3 FUNCTION=Step #exec MESH NOTIFY MESH=Merc SEQ=Run TIME=0.8 FUNCTION=Step #exec MESH NOTIFY MESH=Merc SEQ=Walk TIME=0.33 FUNCTION=WalkStep #exec MESH NOTIFY MESH=Merc SEQ=Walk TIME=0.83 FUNCTION=WalkStep #exec MESH NOTIFY MESH=Merc SEQ=WalkFire TIME=0.2 FUNCTION=SpawnRocket #exec MESH NOTIFY MESH=Merc SEQ=WalkFire TIME=0.83 FUNCTION=Step #exec MESH NOTIFY MESH=Merc SEQ=SwimFire TIME=0.2 FUNCTION=SpawnRocket #exec MESH NOTIFY MESH=Merc SEQ=Death TIME=0.72 FUNCTION=LandThump #exec MESH NOTIFY MESH=Merc SEQ=Dead2 TIME=0.64 FUNCTION=LandThump #exec MESH NOTIFY MESH=Merc SEQ=Dead3 TIME=0.69 FUNCTION=LandThump #exec MESH NOTIFY MESH=Merc SEQ=Dead4 TIME=0.81 FUNCTION=LandThump #exec MESH NOTIFY MESH=Merc SEQ=Dead5 TIME=0.76 FUNCTION=LandThump #exec MESH NOTIFY MESH=Merc SEQ=Dead5 TIME=0.325 FUNCTION=SprayTarget #exec MESH NOTIFY MESH=Merc SEQ=Dead5 TIME=0.5 FUNCTION=SprayTarget #exec AUDIO IMPORT FILE="Sounds\Mercenary\amb1mr.WAV" NAME="amb1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\merspr4a.WAV" NAME="spray1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl01.WAV" NAME="syl1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl02.WAV" NAME="syl2mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl03.WAV" NAME="syl3mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl04.WAV" NAME="syl4mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl05.WAV" NAME="syl5mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\syl11.WAV" NAME="syl6mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\swat1mr.WAV" NAME="swat1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\injur2a.WAV" NAME="injur2mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\injur3a.WAV" NAME="injur3mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\chlng2a.WAV" NAME="chlng2mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\nearbymr.WAV" NAME="nearbymr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\weapon1a.WAV" NAME="weapon1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\chlng3a.WAV" NAME="chlng3mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\land1a.WAV" NAME="land1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\walk2mr.WAV" NAME="walk2mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\death1a.WAV" NAME="death1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\death2b.WAV" NAME="death2mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\death3b.WAV" NAME="death3mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\flip1mr.WAV" NAME="flip1mr" GROUP="Mercenary" #exec AUDIO IMPORT FILE="Sounds\Mercenary\hit1mr.WAV" NAME="hit1mr" GROUP="Mercenary" // FIXME - also have sound breathmr //====================================================================== // Mercenary Functions var() byte PunchDamage; var() byte OrdersGiven; var() bool bButtonPusher; var() bool bTalker; var() bool bSquatter; var bool bPatroling; var() bool bHasInvulnerableShield; var() bool bCanFireWhileInvulnerable; var bool bIsInvulnerable; var bool bAlertedTeam; var(Sounds) sound Punch; var(Sounds) sound PunchHit; var(Sounds) sound Flip; var(Sounds) sound CheckWeapon; var(Sounds) sound WeaponSpray; var(Sounds) sound syllable1; var(Sounds) sound syllable2; var(Sounds) sound syllable3; var(Sounds) sound syllable4; var(Sounds) sound syllable5; var(Sounds) sound syllable6; var(Sounds) sound breath; var(Sounds) sound footstep1; var name phrase; var byte phrasesyllable; var float voicePitch; var int sprayoffset; var float invulnerableTime; var() float invulnerableCharge; //====================================================================== // Mercenary Functions function PreBeginPlay() { bCanSpeak = true; voicePitch = 0.5 + 0.75 * FRand(); Super.PreBeginPlay(); if ( bHasInvulnerableShield ) bHasInvulnerableShield = ( Skill > 2.5 * FRand() - 1 ); bCanDuck = bHasInvulnerableShield; if ( bMovingRangedAttack ) bMovingRangedAttack = ( 0.2 * Skill + 0.3 > FRand() ); } function ZoneChange(ZoneInfo newZone) { bCanSwim = newZone.bWaterZone; //only when it must if ( newZone.bWaterZone ) CombatStyle = 1.0; //always charges when in the water else if (Physics == PHYS_Swimming) CombatStyle = Default.CombatStyle; Super.ZoneChange(newZone); } event FootZoneChange(ZoneInfo newFootZone) { local float OldPainTime; OldPainTime = PainTime; Super.FootZoneChange(newFootZone); if ( bIsInvulnerable && (PainTime <= 0) ) PainTime = FMax(OldPainTime, 0.1); } event HeadZoneChange(ZoneInfo newHeadZone) { local float OldPainTime; OldPainTime = PainTime; Super.HeadZoneChange(newHeadZone); if ( bIsInvulnerable && (PainTime <= 0) ) PainTime = FMax(OldPainTime, 0.1); } function SetMovementPhysics() { if ( Region.Zone.bWaterZone ) SetPhysics(PHYS_Swimming); else if (Physics != PHYS_Walking) SetPhysics(PHYS_Walking); } function TryToDuck(vector duckDir, bool bReversed) { BecomeInvulnerable(); } function BecomeInvulnerable() { if ( bIsInvulnerable ) return; if ( invulnerableTime > 0 ) { InvulnerableCharge += (Level.TimeSeconds - InvulnerableTime)/2; InvulnerableTime = Level.TimeSeconds; } if ( InvulnerableCharge > 4 ) GotoState('Invulnerable'); } function BecomeNormal() { AmbientGlow = 0; bUnlit = false; bMeshEnviroMap = false; LightType = LT_None; InvulnerableTime = Level.TimeSeconds; bIsInvulnerable = false; if ( !Region.Zone.bPainZone ) PainTime = -1.0; } function PainTimer() { if ( Health <= 0 ) return; if ( !bIsInvulnerable ) { if ( bHasInvulnerableShield && Region.Zone.bPainZone && (Region.Zone.DamagePerSec > 0) ) BecomeInvulnerable(); Super.PainTimer(); if ( bIsInvulnerable ) PainTime = 1.0; return; } InvulnerableCharge -= 1.0; if ( (InvulnerableCharge < 0) || (Level.TimeSeconds - InvulnerableTime > 4 + 5 * FRand()) ) BecomeNormal(); else PainTime = 1.0; } function WarnTarget(Pawn shooter, float projSpeed, vector FireDir) { if ( !bIsInvulnerable ) Super.WarnTarget(shooter, projSpeed, FireDir); } function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType) { if ( !bIsInvulnerable ) Super.TakeDamage(Damage, instigatedBy, hitlocation, momentum, damageType); else if ( Damage > 0 ) { InvulnerableCharge = InvulnerableCharge - Damage/100; PainTime = 0.3; //change to take-damage invulnerable skin } } function eAttitude AttitudeToCreature(Pawn Other) { if ( Other.IsA('Mercenary') ) return ATTITUDE_Friendly; else return ATTITUDE_Ignore; } //========================================================================================= // Speech function SpeechTimer() { //last syllable expired. Decide whether to keep the floor or quit if (FRand() < 0.3) { bIsSpeaking = false; if (TeamLeader != None) TeamLeader.bTeamSpeaking = false; } else Speak(); } function SpeakOrderTo(ScriptedPawn TeamMember) { phrase = ''; if ( !TeamMember.bCanSpeak || (FRand() < 0.5) ) Speak(); else { if (Mercenary(TeamMember) != None) Mercenary(TeamMember).phrase = ''; TeamMember.Speak(); } } function SpeakTo(ScriptedPawn Other) { if (Other.bIsSpeaking || ((TeamLeader != None) && TeamLeader.bTeamSpeaking) ) return; phrase = ''; Speak(); } function Speak() { local float decision; //if (phrase != '') // SpeakPhrase(); bIsSpeaking = true; decision = FRand(); if (TeamLeader != None) TeamLeader.bTeamSpeaking = true; if (decision < 0.167) PlaySound(Syllable1,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); else if (decision < 0.333) PlaySound(Syllable2,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); else if (decision < 0.5) PlaySound(Syllable3,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); else if (decision < 0.667) PlaySound(Syllable4,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); else if (decision < 0.833) PlaySound(Syllable5,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); else PlaySound(Syllable6,SLOT_Talk,0.3 + 2 * FRand(),,, FRand() + voicePitch); SpeechTime = 0.1 + 0.3 * FRand(); } //========================================================================================= function Step() { PlaySound(footstep1, SLOT_Interact,,,1500); } function WalkStep() { PlaySound(footstep1, SLOT_Interact,0.2,,500); } function PlayWaiting() { local float decision; local float animspeed; if (Region.Zone.bWaterZone) { PlaySwimming(); return; } animspeed = 0.4 + 0.6 * FRand(); decision = FRand(); if ( bButtonPusher ) { SetAlertness(-1.0); if (decision < 0.3) LoopAnim('Breath', animspeed, 1.0); else if (decision < 0.4) LoopAnim('MButton1', animspeed); else if (decision < 0.5) LoopAnim('MButton2', animspeed); else if (decision < 0.6) LoopAnim('MButton3', animspeed); else if (decision < 0.7) LoopAnim('MButton4', animspeed); else if (decision < 0.75) LoopAnim('Button1', animspeed); else if (decision < 0.80) LoopAnim('Button2', animspeed); else if (decision < 0.85) LoopAnim('Button3', animspeed); else if (decision < 0.90) LoopAnim('Button4', animspeed); else if (decision < 0.95) LoopAnim('Button5', animspeed); else LoopAnim('Button6', animspeed); return; } else if ( bTalker ) { SetAlertness(-0.5); if ( (TeamLeader == None) || TeamLeader.bTeamSpeaking ) { if ( FRand() < 0.1 ) LoopAnim('NeckCrak', animspeed, 0.5); else LoopAnim('Breath', animspeed, 0.5); return; } phrase = ''; Speak(); if (decision < 0.5) LoopAnim('Talk1', animspeed, 0.5); else if (decision < 0.75) LoopAnim('Talk2', animspeed, 0.5); else LoopAnim('Talk3', animspeed, 0.5); return; } else if ( bSquatter ) { SetAlertness(-0.5); if ( (TeamLeader == None) || TeamLeader.bTeamSpeaking ) { LoopAnim('Squat3', animspeed); return; } phrase = ''; Speak(); if (decision < 0.5) LoopAnim('Squat1', animspeed); else LoopAnim('Squat2', animspeed); return; } SetAlertness(0.0); if ( bPatroling ) decision *= 0.4; if ( (AnimSequence == 'Breath') && (decision < 0.15) ) { LoopAnim('Weapon', animspeed); PlaySound(CheckWeapon, SLOT_Interact); } else if ( (AnimSequence == 'Breath') && (decision < 0.25) ) LoopAnim('NeckCrak', animspeed); else LoopAnim('Breath', animspeed); bPatroling = false; } function PlayPatrolStop() { bPatroling = true; PlayWaiting(); } function PlayWaitingAmbush() { PlayWaiting(); } function PlayChallenge() { if (Region.Zone.bWaterZone) { PlaySwimming(); return; } if ( TryToCrouch() ) { TweenAnim('Duck', 0.12); return; } PlayThreateningSound(); if ( FRand() < 0.6 ) PlayAnim('Talk1', 0.7, 0.2); else PlayAnim('Talk2', 0.7, 0.2); } function PlayDive() { TweenToSwimming(0.2); } function TweenToFighter(float tweentime) { bButtonPusher = false; bTalker = false; bSquatter = false; if (Region.Zone.bWaterZone) { TweenToSwimming(tweentime); return; } TweenAnim('Fighter', tweentime); } function TweenToRunning(float tweentime) { bButtonPusher = false; bTalker = false; bSquatter = false; if (Region.Zone.bWaterZone) { TweenToSwimming(tweentime); return; } if (AnimSequence != 'Run' || !bAnimLoop) TweenAnim('Run', tweentime); } function TweenToWalking(float tweentime) { if (Region.Zone.bWaterZone) { TweenToSwimming(tweentime); return; } TweenAnim('Walk', tweentime); } function TweenToWaiting(float tweentime) { if (Region.Zone.bWaterZone) { TweenToSwimming(tweentime); return; } if ( bSquatter ) { TweenAnim('Squat3', tweentime); return; } TweenAnim('Breath', tweentime); } function TweenToPatrolStop(float tweentime) { if (Region.Zone.bWaterZone) { TweenToSwimming(tweentime); return; } TweenAnim('Breath', tweentime); } function PlayRunning() { DesiredSpeed = 1.0; if (Region.Zone.bWaterZone) { PlaySwimming(); return; } if (Focus == Destination) { LoopAnim('Run', -1.0/GroundSpeed,, 0.4); return; } LoopAnim('Run', StrafeAdjust(),,0.3); } function PlayWalking() { if (Region.Zone.bWaterZone) { PlaySwimming(); return; } LoopAnim('Walk', 0.8); } function TweenToSwimming(float tweentime) { if (AnimSequence != 'Swim' || !bAnimLoop) TweenAnim('Swim', tweentime); } function PlaySwimming() { LoopAnim('Swim', -1.0/GroundSpeed,,0.3); } function TweenToFalling() { TweenAnim('Jump2', 0.35); } function PlayInAir() { TweenAnim('Jump2', 0.2); } function PlayOutOfWater() { TweenAnim('Land', 0.8); } function PlayLanded(float impactVel) { TweenAnim('Land', 0.1); } function PlayMovingAttack() { if ( bIsInvulnerable && !bCanFireWhileInvulnerable ) { if ( Level.TimeSeconds - InvulnerableTime < 4 ) { PlayRunning(); return; } else BecomeNormal(); } if (Region.Zone.bWaterZone) { PlayAnim('SwimFire'); return; } DesiredSpeed = 0.4; MoveTimer += 0.2; if ( FRand() < 0.5 ) { if ( GetAnimGroup(AnimSequence) == 'MovingAttack' ) PlayAnim('WalkFire'); else PlayAnim('WalkFire', 1.0, 0.05); } else { sprayoffset = 0; PlaySound(WeaponSpray, SLOT_Interact); if ( GetAnimGroup(AnimSequence) == 'MovingAttack' ) PlayAnim('WalkSpray'); else PlayAnim('WalkSpray', 1.0, 0.05); } } function PlayThreatening() { local float decision, animspeed; if (Region.Zone.bWaterZone) { PlaySwimming(); return; } decision = FRand(); animspeed = 0.6 + 0.4 * FRand(); if ( decision < 0.3 ) PlayAnim('Breath', animspeed, 0.25); else if ( decision < 0.45 ) PlayAnim('Weapon', animspeed, 0.25); else { PlayThreateningSound(); if ( decision < 0.65 ) TweenAnim('Fighter', 0.3); else if ( decision < 0.85 ) PlayAnim('Talk1', animspeed, 0.25); else PlayAnim('Talk2', animspeed, 0.25); } } function PlayTurning() { if (Region.Zone.bWaterZone) { PlaySwimming(); return; } TweenAnim('Walk', 0.3); } function PlayBigDeath(name DamageType) { PlayAnim('Dead2',0.7,0.1); PlaySound(sound'Death3mr', SLOT_Talk, 4 * TransientSoundVolume); } function PlayHeadDeath(name DamageType) { local carcass carc; if ( ((DamageType == 'Decapitated') || ((Health < -20) && (FRand() < 0.5))) && !Level.Game.bVeryLowGore ) { carc = Spawn(class 'CreatureChunks',,, Location + CollisionHeight * vect(0,0,0.8), Rotation + rot(3000,0,16384) ); if (carc != None) { carc.Mesh = mesh'MercHead'; carc.Initfor(self); carc.Velocity = Velocity + VSize(Velocity) * VRand(); carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z); } PlayAnim('Dead5',0.7,0.1); SprayOffset = 0; } else PlayAnim('Death',0.7,0.1); PlaySound(Die, SLOT_Talk, 4 * TransientSoundVolume); } function PlayLeftDeath(name DamageType) { PlayAnim('Dead4',0.7,0.1); PlaySound(sound'Death2mr', SLOT_Talk, 4 * TransientSoundVolume); } function PlayRightDeath(name DamageType) { PlayAnim('Death',0.7,0.1); PlaySound(Die, SLOT_Talk, 4 * TransientSoundVolume); } function PlayGutDeath(name DamageType) { PlayAnim('Dead3',0.7,0.1); PlaySound(sound'Death2mr', SLOT_Talk, 4 * TransientSoundVolume); } function PlayVictoryDance() { //if ( FRand() < 0.5 ) //{ PlaySound(Flip, SLOT_Interact); PlayAnim('Jump', 1.0, 0.1); //} //else // PlayAnim('BigDance', 0.7, 0.25); } function PlayMeleeAttack() { local float decision; decision = FRand(); if (AnimSequence == 'Swat') decision -= 0.2; PlaySound(Punch, SLOT_Interact); If (decision < 0.3) PlayAnim('Punch'); else PlayAnim('Swat'); } function bool CanFireAtEnemy() { local vector HitLocation, HitNormal,X,Y,Z, projStart, EnemyDir, EnemyUp; local actor HitActor; local float EnemyDist; EnemyDir = Enemy.Location - Location; EnemyDist = VSize(EnemyDir); EnemyUp = Enemy.CollisionHeight * vect(0,0,0.9); if ( EnemyDist > 300 ) { EnemyDir = 300 * EnemyDir/EnemyDist; EnemyUp = 300 * EnemyUp/EnemyDist; } GetAxes(Rotation,X,Y,Z); projStart = Location + 0.9 * CollisionRadius * X - 0.6 * CollisionRadius * Y; HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir + EnemyUp, projStart, true); if ( (HitActor == None) || (HitActor == Enemy) || ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) ) return true; HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir, projStart , true); return ( (HitActor == None) || (HitActor == Enemy) || ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) ); } function SpawnRocket() { FireProjectile( vect(0.9, -0.4, 0), 400); } function SprayTarget() { local vector EndTrace, fireDir; local vector HitNormal, HitLocation; local actor HitActor; local rotator AdjRot; local vector X,Y,Z; AdjRot = Rotation; if ( AnimSequence == 'Dead5' ) AdjRot.Yaw += 3000 * (2 - sprayOffset); else AdjRot.Yaw += 1000 * (3 - sprayOffset); sprayoffset++; fireDir = vector(AdjRot); if ( (sprayoffset == 1) || (sprayoffset == 3) || (sprayoffset == 5) ) { GetAxes(Rotation,X,Y,Z); if ( AnimSequence == 'Spray' ) spawn(class'MercFlare', self, '', Location + 1.25 * CollisionRadius * X - CollisionRadius * (0.2 * sprayoffset - 0.3) * Y); else spawn(class'MercFlare', self, '', Location + 1.25 * CollisionRadius * X - CollisionRadius * (0.1 * sprayoffset - 0.1) * Y); } if ( AnimSequence == 'Dead5' ) sprayoffset++; EndTrace = Location + 2000 * fireDir; EndTrace.Z = Target.Location.Z + Target.CollisionHeight * 0.6; HitActor = TraceShot(HitLocation,HitNormal,EndTrace,Location); if (HitActor == Level) // Hit a wall { spawn(class'SmallSpark2',,,HitLocation+HitNormal*5,rotator(HitNormal*2+VRand())); spawn(class'SpriteSmokePuff',,,HitLocation+HitNormal*9); } else if ((HitActor != self) && (HitActor != Owner)) { HitActor.TakeDamage(10, self, HitLocation, 10000.0*fireDir, 'shot'); spawn(class'SpriteSmokePuff',,,HitLocation+HitNormal*9); } } function HitDamageTarget() { if (MeleeDamageTarget(PunchDamage, (PunchDamage * 1000 * Normal(Target.Location - Location)))) PlaySound(PunchHit, SLOT_Interact); } function PlayRangedAttack() { //FIXME - if going to ranged attack need to // TweenAnim('StillFire', 0.2); //What I need is a tween into time for the PlayAnim() if ( bIsInvulnerable && !bCanFireWhileInvulnerable ) { if ( Level.TimeSeconds - InvulnerableTime > 3 ) BecomeNormal(); else if ( FRand() < 0.75 ) { PlayChallenge(); return; } } if (Region.Zone.bWaterZone) { PlayAnim('SwimFire'); return; } MakeNoise(1.0); if (FRand() < 0.35) { PlayAnim('Shoot'); SpawnRocket(); } else { sprayoffset = 0; PlaySound(WeaponSpray, SLOT_Interact); PlayAnim('Spray'); } } function ChooseLeaderAttack() { if ( bReadyToAttack && bHasInvulnerableShield && !bIsInvulnerable && (InvulnerableCharge > 0) ) { BecomeInvulnerable(); if ( IsInState('Invulnerable') ) return; } if ( !bAlertedTeam && (OrdersGiven < 2) ) { OrdersGiven = OrdersGiven + 1; GotoState('SpeakOrders'); } else GotoState('TacticalMove', 'NoCharge'); } state SpeakOrders { ignores SeePlayer, HearNoise, Bump; function Killed(pawn Killer, pawn Other, name damageType) { Super.Killed(Killer, Other, damageType); if ( (Health > 0) && !bTeamLeader ) GotoState('Attacking'); } function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType) { Global.TakeDamage(Damage, instigatedBy, hitlocation, momentum, damageType); if ( health <= 0 ) return; if (NextState == 'TakeHit') { NextState = 'Attacking'; NextLabel = 'Begin'; GotoState('TakeHit'); } } function EnemyNotVisible() { } Begin: bAlertedTeam = true; Acceleration = vect(0,0,0); if (NeedToTurn(enemy.Location)) { PlayTurning(); TurnToward(Enemy); } TweenAnim('Talk2', 0.1); FinishAnim(); phrase = ''; Speak(); if (FRand() < 0.5) PlayAnim('Talk2', 0.6); else PlayAnim('Talk3', 0.6); FinishAnim(); if (FRand() < 0.3) Goto('Done'); if (FRand() < 0.5) PlayAnim('Talk2', 0.9); else PlayAnim('Talk3', 0.9); FinishAnim(); Done: bReadyToAttack = true; GotoState('Attacking'); } state Invulnerable { ignores SeePlayer, HearNoise, Bump; function TryToDuck(vector duckDir, bool bReversed) { } function AnimEnd() { if (AnimSequence == 'Stealth1') { bIsInvulnerable = true; bMeshEnviroMap = true; invulnerableTime = Level.TimeSeconds; PainTime = 1.0; AmbientGlow = 70; bUnlit = true; LightType=LT_Pulse; PlayAnim('Stealth2'); } else GotoState('Attacking'); } Begin: Acceleration = vect(0,0,0); PlayAnim('Stealth1', 1.4, 0.07); KeepTurning: TurnToward(Enemy); Sleep(0.0); Goto('KeepTurning'); } state RangedAttack { ignores SeePlayer, HearNoise; function TryToDuck(vector duckDir, bool bReversed) { if ( bCanFireWhileInvulnerable || (FRand() < 0.5) ) BecomeInvulnerable(); } function BeginState() { Super.BeginState(); if ( !bIsInvulnerable && bHasInvulnerableShield && bCanFireWhileInvulnerable && (InvulnerableCharge > 4) && (FRand() > 0.75) ) { bReadyToAttack = true; BecomeInvulnerable(); } } } defaultproperties { PunchDamage=20 bHasInvulnerableShield=True Punch=Sound'UnrealI.Mercenary.swat1mr' PunchHit=Sound'UnrealI.Mercenary.hit1mr' Flip=Sound'UnrealI.Mercenary.flip1mr' CheckWeapon=Sound'UnrealI.Mercenary.weapon1mr' WeaponSpray=Sound'UnrealI.Mercenary.spray1mr' syllable1=Sound'UnrealI.Mercenary.syl1mr' syllable2=Sound'UnrealI.Mercenary.syl2mr' syllable3=Sound'UnrealI.Mercenary.syl3mr' syllable4=Sound'UnrealI.Mercenary.syl4mr' syllable5=Sound'UnrealI.Mercenary.syl5mr' syllable6=Sound'UnrealI.Mercenary.syl6mr' Footstep1=Sound'UnrealI.Mercenary.walk2mr' invulnerableCharge=9.000000 CarcassType=Class'UnrealI.MercCarcass' Aggressiveness=0.500000 RefireRate=0.500000 bHasRangedAttack=True bMovingRangedAttack=True bGreenBlood=True RangedProjectile=Class'UnrealI.MercRocket' Acquire=Sound'UnrealI.Mercenary.chlng2mr' Fear=Sound'UnrealI.Mercenary.chlng3mr' Roam=Sound'UnrealI.Mercenary.nearbymr' Threaten=Sound'UnrealI.Mercenary.chlng3mr' bCanStrafe=True MeleeRange=50.000000 GroundSpeed=280.000000 AirSpeed=300.000000 AccelRate=800.000000 Health=180 UnderWaterTime=-1.000000 Intelligence=BRAINS_HUMAN HitSound1=Sound'UnrealI.Mercenary.injur2mr' HitSound2=Sound'UnrealI.Mercenary.injur3mr' Land=Sound'UnrealI.Mercenary.land1mr' Die=Sound'UnrealI.Mercenary.death1mr' CombatStyle=0.500000 DrawType=DT_Mesh Texture=Texture'UnrealI.Skins.Silver' Mesh=LodMesh'UnrealI.Merc' AmbientSound=Sound'UnrealI.Mercenary.amb1mr' CollisionRadius=35.000000 CollisionHeight=48.000000 LightEffect=LE_NonIncidence LightBrightness=255 LightHue=170 LightSaturation=96 LightRadius=12 Mass=150.000000 Buoyancy=150.000000 RotationRate=(Pitch=3072,Yaw=65000,Roll=0) } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |