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 01067 01068 01069 01070 01071 01072 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01085 01086 01087 01088 01089 01090 01091 01092 01093 01094 01095 01096 01097 01098 01099 01100 01101 01102 01103 01104 01105 01106 01107 01108 01109 01110 01111 01112 01113 01114 01115 01116 01117 01118 01119 01120 01121 01122 01123 01124 01125 01126 01127 01128 01129 01130 01131 01132 01133 01134 01135 01136 01137 01138 01139 01140 01141 01142 01143 01144 01145 01146 01147 01148 01149 01150 01151 01152 01153 01154 01155 01156 01157 01158 01159 01160 01161 01162 01163 01164 01165 01166 01167 01168 01169 01170 01171 01172 01173 01174 01175 01176 01177 01178 01179 01180 01181 01182 01183 01184 01185 01186 01187 01188 01189 01190 01191 01192 01193 01194 01195 01196 01197 01198 01199 01200 01201 01202 01203 01204 01205 01206 01207 01208 01209 01210 01211 01212 01213 01214 01215 01216 01217 01218 01219 01220 01221 01222 01223 01224 01225 01226 01227 01228 01229 01230 01231 01232 01233 01234 01235 01236 01237 01238 01239 01240 01241 01242 01243 01244 01245 01246 01247 01248 01249 01250 01251 01252 01253 01254 01255 01256 01257 01258 01259 01260 01261 01262 01263 01264 01265 01266 01267 01268 01269 01270 01271 01272 01273 01274 01275 01276 01277 01278 01279 01280 01281 01282 01283 01284 01285 01286 01287 01288 01289 01290 01291 01292 01293 01294 01295 01296 01297 01298 01299 01300 01301 01302 01303 01304 01305 01306 01307 01308 01309 01310 01311 01312 01313 01314 01315 01316 01317 01318 01319 01320 01321 01322 01323 01324 01325 01326 01327 01328 01329 01330 01331 01332 01333 01334 01335 01336 01337 01338 01339 01340 01341 01342 01343 01344 01345 01346 01347 01348 01349 01350 01351 01352 01353 01354 01355 01356 01357 01358 01359 01360 01361 01362 01363 01364 01365 01366 01367 01368 01369 01370 01371 01372 01373 01374 01375 01376 01377 01378 01379 01380 01381 01382 01383 01384 01385 01386 01387 01388 01389 01390 01391 01392 01393 01394 01395 01396 01397 01398 01399 01400 01401 01402 01403 01404 01405 01406 01407 01408 01409 01410 01411 01412 01413 01414 01415 01416 01417 01418 01419 01420 01421 01422 01423 01424 01425 01426 01427 01428 01429 01430 01431 01432 01433 01434 01435 01436 01437 01438 01439 01440 01441 01442 01443 01444 01445 01446 01447 01448 01449 01450 01451 01452 01453 01454 01455 01456 01457 01458 01459 01460 01461 01462 01463 01464 01465 01466 01467 01468 01469 01470 01471 01472 01473 01474 01475 01476 01477 01478 01479 01480 01481 01482 01483 01484 01485 01486 01487 01488 01489 01490 01491 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 01505 01506 01507 01508 01509 01510 01511 01512 01513 01514 01515 01516 01517 01518 01519 01520 01521 01522 01523 01524 01525 01526 01527 01528 01529 01530 01531 01532 01533 01534 01535 01536 01537 01538 01539 01540 01541 01542 01543 01544 01545 01546 01547 01548 01549 01550 01551 01552 01553 01554 01555 01556 01557 01558 01559 01560 01561 01562 01563 01564 01565 01566 01567 01568 01569 01570 01571 01572 01573 01574 01575 01576 01577 01578 01579 01580 01581 01582 01583 01584 01585 01586 01587 01588 01589 01590 01591 01592 01593 01594 01595 01596 01597 01598 01599 01600 01601 01602 01603 01604 01605 01606 01607 01608 01609 01610 01611 01612 01613 01614 01615 01616 01617 01618 01619 01620 01621 01622 01623 01624 01625 01626 01627 01628 01629 01630 01631 01632 01633 01634 01635 01636 01637 01638 01639 01640 01641 01642 01643 01644 01645 01646 01647 01648 01649 01650 01651 01652 01653 01654 01655 01656 01657 01658 01659 01660 01661 01662 01663 01664 01665 01666 01667 01668 01669 01670 01671 01672 01673 01674 01675 01676 01677 01678 01679 01680 01681 01682 01683 01684 01685 01686 01687 01688 01689 01690 01691 01692 01693 01694 01695 01696 01697 01698 01699 01700 01701 01702 01703 01704 01705 01706 01707 01708 01709 01710 01711 01712 01713 01714 01715 01716 01717 01718 01719 01720 01721 01722 01723 01724 01725 01726 01727 01728 01729 01730 01731 01732 01733 01734 01735 01736 01737 01738 01739 01740 01741 01742 01743 01744 01745 01746 01747 01748 01749 01750 01751 01752 01753 01754 01755 01756 01757 01758 01759 01760 01761 01762 01763 01764 01765 01766 01767 01768 01769 01770 01771 01772 01773 01774 01775 01776 01777 01778 01779 01780 01781 01782 01783 01784 01785 01786 01787 01788 01789 01790 01791 01792 01793 01794 01795 01796 01797 01798 01799 01800 01801 01802 01803 01804 01805 01806 01807 01808 01809 01810 01811 01812 01813 01814 01815 01816 01817 01818 01819 01820 01821 01822 01823 01824 01825 01826 01827 01828 01829 01830 01831 01832 01833 01834 01835 01836 01837 01838 01839 01840 01841 01842 01843 01844 01845 01846 01847 01848 01849 01850 01851 01852 01853 01854 01855 01856 01857 01858 01859 01860 01861 01862 01863 01864 01865 01866 01867 01868 01869 01870 01871 01872 01873 01874 01875 01876 01877 01878 01879 01880 01881 01882 01883 01884 01885 01886 01887 01888 01889 01890 01891 01892 01893 01894 01895 01896 01897 01898 01899 01900 01901 01902 01903 01904 01905 01906 01907 01908 01909 01910 01911 01912 01913 01914 01915 01916 01917 01918 01919 01920 01921 01922 01923 01924 01925 01926 01927 01928 01929 01930 01931 01932 01933 01934 01935 01936 01937 01938 01939 01940 01941 01942 01943 01944 01945 01946 01947 01948 01949 01950 01951 01952 01953 01954 01955 01956 01957 01958 01959 01960 01961 01962 01963 01964 01965 01966 01967 01968 01969 01970 01971 01972 01973 01974 01975 01976 01977 01978 01979 01980 01981 01982 01983 01984 01985 01986 01987 01988 01989 01990 01991 01992 01993 01994 01995 01996 01997 01998 01999 02000 02001 02002 02003 02004 02005 02006 02007 02008 02009 02010 02011 02012 02013 02014 02015 02016 02017 02018 02019 02020 02021 02022 02023 02024 02025 02026 02027 02028 02029 02030 02031 02032 02033 02034 02035 02036 02037 02038 02039 02040 02041 02042 02043 02044 02045 02046 02047 02048 02049 02050 02051 02052 02053 02054 02055 02056 02057 02058 02059 02060 02061 02062 02063 02064 02065 02066 02067 02068 02069 02070 02071 02072 02073 02074 02075 02076 02077 02078 02079 02080 02081 02082 02083 02084 02085 02086 02087 02088 02089 02090 02091 02092 02093 02094 02095 02096 02097 02098 02099 02100 02101 02102 02103 02104 02105 02106 02107 02108 02109 02110 02111 02112 02113 02114 02115 02116 02117 02118 02119 02120 02121 02122 02123 02124 02125 02126 02127 02128 02129 02130 02131 02132 02133 02134 02135 02136 02137 02138 02139 02140 02141 02142 02143 02144 02145 02146 02147 02148 02149 02150 02151 02152 02153 02154 02155 02156 02157 02158 02159 02160 02161 02162 02163 02164 02165 02166 02167 02168 02169 02170 02171 02172 02173 02174 02175 02176 02177 02178 02179 02180 02181 02182 02183 02184 02185 02186 02187 02188 02189 02190 02191 02192 02193 02194 02195 02196 02197 02198 02199 02200 02201 02202 02203 02204 02205 02206 02207 02208 02209 02210 02211 02212 02213 02214 02215 02216 02217 02218 02219 02220 02221 02222 02223 02224 02225 02226 02227 02228 02229 02230 02231 02232 02233 02234 02235 02236 02237 02238 02239 02240 02241 02242 02243 02244 02245 02246 02247 02248 02249 02250 02251 02252 02253 02254 02255 02256 02257 02258 02259 02260 02261 02262 02263 02264 02265 02266 02267 02268 02269 02270 02271 02272 02273 02274 02275 02276 02277 02278 02279 02280 02281 02282 02283 02284 02285 02286 02287 02288 02289 02290 02291 02292 02293 02294 02295 02296 02297 02298 02299 02300 02301 02302 02303 02304 02305 02306 02307 02308 02309 02310 02311 02312 02313 02314 02315 02316 02317 02318 02319 02320 02321 02322 02323 02324 02325 02326 02327 02328 02329 02330 02331 02332 02333 02334 02335 02336 02337 02338 02339 02340 02341 02342 02343 02344 02345 02346 02347 02348 02349 02350 02351 02352 02353 02354 02355 02356 02357 02358 02359 02360 02361 02362 02363 02364 02365 02366 02367 02368 02369 02370 02371 02372 02373 02374 02375 02376 02377 02378 02379 02380 02381 02382 02383 02384 02385 02386 02387 02388 02389 02390 02391 02392 02393 02394 02395 02396 02397 02398 02399 02400 02401 02402 02403 02404 02405 02406 02407 02408 02409 02410 02411 02412 02413 02414 02415 02416 02417 02418 02419 02420 02421 02422 02423 02424 02425 02426 02427 02428 02429 02430 02431 02432 02433 02434 02435 02436 02437 02438 02439 02440 02441 02442 02443 02444 02445 02446 02447 02448 02449 02450 02451 02452 02453 02454 02455 02456 02457 02458 02459 02460 02461 02462 02463 02464 02465 02466 02467 02468 02469 02470 02471 02472 02473 02474 02475 02476 02477 02478 02479 02480 02481 02482 02483 02484 02485 02486 02487 02488 02489 02490 02491 02492 02493 02494 02495 02496 02497 02498 02499 02500 02501 02502 02503 02504 02505 02506 02507 02508 02509 02510 02511 02512 02513 02514 02515 02516 02517 02518 02519 02520 02521 02522 02523 02524 02525 02526 02527 02528 02529 02530 02531 02532 02533 02534 02535 02536 02537 02538 02539 02540 02541 02542 02543 02544 02545 02546 02547 02548 02549 02550 02551 02552 02553 02554 02555 02556 02557 02558 02559 02560 02561 02562 02563 02564 02565 02566 02567 02568 02569 02570 02571 02572 02573 02574 02575 02576 02577 02578 02579 02580 02581 02582 02583 02584 02585 02586 02587 02588 02589 02590 02591 02592 02593 02594 02595 02596 02597 02598 02599 02600 02601 02602 02603 02604 02605 02606 02607 02608 02609 02610 02611 02612 02613 02614 02615 02616 02617 02618 02619 02620 02621 02622 02623 02624 02625 02626 02627 02628 02629 02630 02631 02632 02633 02634 02635 02636 02637 02638 02639 02640 02641 02642 02643 02644 02645 02646 02647 02648 02649 02650 02651 02652 02653 02654 02655 02656 02657 02658 02659 02660 02661 02662 02663 02664 02665 02666 02667 02668 02669 02670 02671 02672 02673 02674 02675 02676 02677 02678 02679 02680 02681 02682 02683 02684 02685 02686 02687 02688 02689 02690 02691 02692 02693 02694 02695 02696 02697 02698 02699 02700 02701 02702 02703 02704 02705 02706 02707 02708 02709 02710 02711 02712 02713 02714 02715 02716 02717 02718 02719 02720 02721 02722 02723 02724 02725 02726 02727 02728 02729 02730 02731 02732 02733 02734 02735 02736 02737 02738 02739 02740 02741 02742 02743 02744 02745 02746 02747 02748 02749 02750 02751 02752 02753 02754 02755 02756 02757 02758 02759 02760 02761 02762 02763 02764 02765 02766 02767 02768 02769 02770 02771 02772 02773 02774 02775 02776 02777 02778 02779 02780 02781 02782 02783 02784 02785 02786 02787 02788 02789 02790 02791 02792 02793 02794 02795 02796 02797 02798 02799 02800 02801 02802 02803 02804 02805 02806 02807 02808 02809 02810 02811 02812 02813 02814 02815 02816 02817 02818 02819 02820 02821 02822 02823 02824 02825 02826 02827 02828 02829 02830 02831 02832 02833 02834 02835 02836 02837 02838 02839 02840 02841 02842 02843 02844 02845 02846 02847 02848 02849 02850 02851 02852 02853 02854 02855 02856 02857 02858 02859 02860 02861 02862 02863 02864 02865 02866 02867 02868 02869 02870 02871 02872 02873 02874 02875 02876 02877 02878 02879 02880 02881 02882 02883 02884 02885 02886 02887 02888 02889 02890 02891 02892 02893 02894 02895 02896 02897 02898 02899 02900 02901 02902 02903 02904 02905 02906 02907 02908 02909 02910 02911 02912 02913 02914 02915 02916 02917 02918 02919 02920 02921 02922 02923 02924 02925 02926 02927 02928 02929 02930 02931 02932 02933 02934 02935 02936 02937 02938 02939 02940 02941 02942 02943 02944 02945 02946 02947 02948 02949 02950 02951 02952 02953 02954 02955 02956 02957 02958 02959 02960 02961 02962 02963 02964 02965 02966 02967 02968 02969 02970 02971 02972 02973 02974 02975 02976 02977 02978 02979 02980 02981 02982 02983 02984 02985 02986 02987 02988 02989 02990 02991 02992 02993 02994 02995 02996 02997 02998 02999 03000 03001 03002 03003 03004 03005 03006 03007 03008 03009 03010 03011 03012 03013 03014 03015 03016 03017 03018 03019 03020 03021 03022 03023 03024 03025 03026 03027 03028 03029 03030 03031 03032 03033 03034 03035 03036 03037 03038 03039 03040 03041 03042 03043 03044 03045 03046 03047 03048 03049 03050 03051 03052 03053 03054 03055 03056 03057 03058 03059 03060 03061 03062 03063 03064 03065 03066 03067 03068 03069 03070 03071 03072 03073 03074 03075 03076 03077 03078 03079 03080 03081 03082 03083 03084 03085 03086 03087 03088 03089 03090 03091 03092 03093 03094 03095 03096 03097 03098 03099 03100 03101 03102 03103 03104 03105 03106 03107 03108 03109 03110 03111 03112 03113 03114 03115 03116 03117 03118 03119 03120 03121 03122 03123 03124 03125 03126 03127 03128 03129 03130 03131 03132 03133 03134 03135 03136 03137 03138 03139 03140 03141 03142 03143 03144 03145 03146 03147 03148 03149 03150 03151 03152 03153 03154 03155 03156 03157 03158 03159 03160 03161 03162 03163 03164 03165 03166 03167 03168 03169 03170 03171 03172 03173 03174 03175 03176 03177 03178 03179 03180 03181 03182 03183 03184 03185 03186 03187 03188 03189 03190 03191 03192 03193 03194 03195 03196 03197 03198 03199 03200 03201 03202 03203 03204 03205 03206 03207 03208 03209 03210 03211 03212 03213 03214 03215 03216 03217 03218 03219 03220 03221 03222 03223 03224 03225 03226 03227 03228 03229 03230 03231 03232 03233 03234 03235 03236 03237 03238 03239 03240 03241 03242 03243 03244 03245 03246 03247 03248 03249 03250 03251 03252 03253 03254 03255 03256 03257 03258 03259 03260 03261 03262 03263 03264 03265 03266 03267 03268 03269 03270 03271 03272 03273 03274 03275 03276 03277 03278 03279 03280 03281 03282 03283 03284 03285 03286 03287 03288 03289 03290 03291 03292 03293 03294 03295 03296 03297 03298 03299 03300 03301 03302 03303 03304 03305 03306 03307 03308 03309 03310 03311 03312 03313 03314 03315 03316 03317 03318 03319 03320 03321 03322 03323 03324 03325 03326 03327 03328 03329 03330 03331 03332 03333 03334 03335 03336 03337 03338 03339 03340 03341 03342 03343 03344 03345 03346 03347 03348 03349 03350 03351 03352 03353 03354 03355 03356 03357 03358 03359 03360 03361 03362 03363 03364 03365 03366 03367 03368 03369 03370 03371 03372 03373 03374 03375 03376 03377 03378 03379 03380 03381 03382 03383 03384 03385 03386 03387 03388 03389 03390 03391 03392 03393 03394 03395 03396 03397 03398 03399 03400 03401 03402 03403 03404 03405 03406 03407 03408 03409 03410 03411 03412 03413 03414 03415 03416 03417 03418 03419 03420 03421 03422 03423 03424 03425 03426 03427 03428 03429 03430 03431 03432 03433 03434 03435 03436 03437 03438 03439 03440 03441 03442 03443 03444 03445 03446 03447 03448 03449 03450 03451 03452 03453 03454 03455 03456 03457 03458 03459 03460 03461 03462 03463 03464 03465 03466 03467 03468 03469 03470 03471 03472 03473 03474 03475 03476 03477 03478 03479 03480 03481 03482 03483 03484 03485 03486 03487 03488 03489 03490 03491 03492 03493 03494 03495 03496 03497 03498 03499 03500 03501 03502 03503 03504 03505 03506 03507 03508 03509 03510 03511 03512 03513 03514 03515 03516 03517 03518 03519 03520 03521 03522 03523 03524 03525 03526 03527 03528 03529 03530 03531 03532 03533 03534 03535 03536 03537 03538 03539 03540 03541 03542 03543 03544 03545 03546 03547 03548 03549 03550 03551 03552 03553 03554 03555 03556 03557 03558 03559 03560 03561 03562 03563 03564 03565 03566 03567 03568 03569 03570 03571 03572 03573 03574 03575 03576 03577 03578 03579 03580 03581 03582 03583 03584 03585 03586 03587 03588 03589 03590 03591 03592 03593 03594 03595 03596 03597 03598 03599 03600 03601 03602 03603 03604 03605 03606 03607 03608 03609 03610 03611 03612 03613 03614 03615 03616 03617 03618 03619 03620 03621 03622 03623 03624 03625 03626 03627 03628 03629 03630 03631 03632 03633 03634 03635 03636 03637 03638 03639 03640 03641 03642 03643 03644 03645 03646 03647 03648 03649 03650 03651 03652 03653 03654 03655 03656 03657 03658 03659 03660 03661 03662 03663 03664 03665 03666 03667 03668 03669 03670 03671 03672 03673 03674 03675 03676 03677 03678 03679 03680 03681 03682 03683 03684 03685 03686 03687 03688 03689 03690 03691 03692 03693 03694 03695 03696 03697 03698 03699 03700 03701 03702 03703 03704 03705 03706 03707 03708 03709 03710 03711 03712 03713 03714 03715 03716 03717 03718 03719 03720 03721 03722 03723 03724 03725 03726 03727 03728 03729 03730 03731 03732 03733 03734 03735 03736 03737 03738 03739 03740 03741 03742 03743 03744 03745 03746 03747 03748 03749 03750 03751 03752 03753 03754 03755 03756 03757 03758 03759 03760 03761 03762 03763 03764 03765 03766 03767 03768 03769 03770 03771 03772 03773 03774 03775 03776 03777 03778 03779 03780 03781 03782 03783 03784 03785 03786 03787 03788 03789 03790 03791 03792 03793 03794 03795 03796 03797 03798 03799 03800 03801 03802 03803 03804 03805 03806 03807 03808 03809 03810 03811 03812 03813 03814 03815 03816 03817 03818 03819 03820 03821 03822 03823 03824 03825 03826 03827 03828 03829 03830 03831 03832 03833 03834 03835 03836 03837 03838 03839 03840 03841 03842 03843 03844 03845 03846 03847 03848 03849 03850 03851 03852 03853 03854 03855 03856 03857 03858 03859 03860 03861 03862 03863 03864 03865 03866 03867 03868 03869 03870 03871 03872 03873 03874 03875 03876 03877 03878 03879 03880 03881 03882 03883 03884 03885 03886 03887 03888 03889 03890 03891 03892 03893 03894 03895 03896 03897 03898 03899 03900 03901 03902 03903 03904 03905 03906 03907 03908 03909 03910 03911 03912 03913 03914 03915 03916 03917 03918 03919 03920 03921 03922 03923 03924 03925 03926 03927 03928 03929 03930 03931 03932 03933 03934 03935 03936 03937 03938 03939 03940 03941 03942 03943 03944 03945 03946 03947 03948 03949 03950 03951 03952 03953 03954 03955 03956 03957 03958 03959 03960 03961 03962 03963 03964 03965 03966 03967 03968 03969 03970 03971 03972 03973 03974 03975 03976 03977 03978 03979 03980 03981 03982 03983 03984 03985 03986 03987 03988 03989 03990 03991 03992 03993 03994 03995 03996 03997 03998 03999 04000 04001 04002 04003 04004 04005 04006 04007 04008 04009 04010 04011 04012 04013 04014 04015 04016 04017 04018 04019 04020 04021 04022 04023 04024 04025 04026 04027 04028 04029 04030 04031 04032 04033 04034 04035 04036 04037 04038 04039 04040 04041 04042 04043 04044 04045 04046 04047 04048 04049 04050 04051 04052 04053 04054 04055 04056 04057 04058 04059 04060 04061 04062 04063 04064 04065 04066 04067 04068 04069 04070 04071 04072 04073 04074 04075 04076 04077 04078 04079 04080 04081 04082 04083 04084 04085 04086 04087 04088 04089 04090 04091 04092 04093 04094 04095 04096 04097 04098 04099 04100 04101 04102 04103 04104 04105 04106 04107 04108 04109 04110 04111 04112 04113 04114 04115 04116 04117 04118 04119 04120 04121 04122 04123 04124 04125 04126 04127 04128 04129 04130 04131 04132 04133 04134 04135 04136 04137 04138 04139 04140 04141 04142 04143 04144 04145 04146 04147 04148 04149 04150 04151 04152 04153 04154 04155 04156 04157 04158 04159 04160 04161 04162 04163 04164 04165 04166 04167 04168 04169 04170 04171 04172 04173 04174 04175 04176 04177 04178 04179 04180 04181 04182 04183 04184 04185 04186 04187 04188 04189 04190 04191 04192 04193 04194 04195 04196 04197 04198 04199 04200 04201 04202 04203 04204 04205 04206 04207 04208 04209 04210 04211 04212 04213 04214 04215 04216 04217 04218 04219 04220 04221 04222 04223 04224 04225 04226 04227 04228 04229 04230 04231 04232 04233 04234 04235 04236 04237 04238 04239 04240 04241 04242 04243 04244 04245 04246 04247 04248 04249 04250 04251 04252 04253 04254 04255 04256 04257 04258 04259 04260 04261 04262 04263 04264 04265 04266 04267 04268 04269 04270 04271 04272 04273 04274 04275 04276 04277 04278 04279 04280 04281 04282 04283 04284 04285 04286 04287 04288 04289 04290 04291 04292 04293 04294 04295 04296 04297 04298 04299 04300 04301 04302 04303 04304 04305 04306 04307 04308 04309 04310 04311 04312 04313 04314 04315 04316 04317 04318 04319 04320 04321 04322 04323 04324 04325 04326 04327 04328 04329 04330 04331 04332 04333 04334 04335 04336 04337 04338 04339 04340 04341 04342 04343 04344 04345 04346 04347 04348 04349 04350 04351 04352 04353 04354 04355 04356 04357 04358 04359 04360 04361 04362 04363 04364 04365 04366 04367 04368 04369 04370 04371 04372 04373 04374 04375 04376 04377 04378 04379 04380 04381 04382 04383 04384 04385 04386 04387 04388 04389 04390 04391 04392 04393 04394 04395 04396 04397 04398 04399 04400 04401 04402 04403 04404 04405 04406 04407 04408 04409 04410 04411 04412 04413 04414 04415 04416 04417 04418 04419 04420 04421 04422 04423 04424 04425 04426 04427 04428 04429 04430 04431 04432 04433 04434 04435 04436 04437 04438 04439 04440 04441 04442 04443 04444 04445 04446 04447 04448 04449 04450 04451 04452 04453 04454 04455 04456 04457 04458 04459 04460 04461 04462 04463 04464 04465 04466 04467 04468 04469 04470 04471 04472 04473 04474 04475 04476 04477 04478 04479 04480 04481 04482 04483 04484 04485 04486 04487 04488 04489 04490 04491 04492 04493 04494 04495 04496 04497 04498 04499 04500 04501 04502 04503 04504 04505 04506 04507 04508 04509 04510 04511 04512 04513 04514 04515 04516 04517 04518 04519 04520 04521 04522 04523 04524 04525 04526 04527 04528 04529 04530 04531 04532 04533 04534 04535 04536 04537 04538 04539 04540 04541 04542 04543 04544 04545 04546 04547 04548 04549 04550 04551 04552 04553 04554 04555 04556 04557 04558 04559 04560 04561 04562 04563 04564 04565 04566 04567 04568 04569 04570 04571 04572 04573 04574 04575 04576 04577 04578 04579 04580 04581 04582 04583 04584 04585 04586 04587 04588 04589 04590 04591 04592 04593 04594 04595 04596 04597 04598 04599 04600 04601 04602 04603 04604 04605 04606 04607 04608 04609 04610 04611 04612 04613 04614 04615 04616 04617 04618 04619 04620 04621 04622 04623 04624 04625 04626 04627 04628 04629 04630 04631 04632 04633 04634 04635 04636 04637 04638 04639 04640 04641 04642 04643 04644 04645 04646 04647 04648 04649 04650 04651 04652 04653 04654 04655 04656 04657 04658 04659 04660 04661 04662 04663 04664 04665 04666 04667 04668 04669 04670 04671 04672 04673 04674 04675 04676 04677 04678 04679 04680 04681 04682 04683 04684 04685 04686 04687 04688 04689 04690 04691 04692 04693 04694 04695 04696 04697 04698 04699 04700 04701 04702 04703 04704 04705 04706 04707 04708 04709 04710 04711 04712 04713 04714 04715 04716 04717 04718 04719 04720 04721 04722 04723 04724 04725 04726 04727 04728 04729 04730 04731 04732 04733 04734 04735 04736 04737 04738 04739 04740 04741 04742 04743 04744 04745 04746 04747 04748 04749 04750 04751 04752 04753 04754 04755 04756 04757 04758 04759 04760 04761 04762 04763 04764 04765 04766 04767 04768 04769 04770 04771 04772 04773 04774 04775 04776 04777 04778 04779 04780 04781 04782 04783 04784 04785 04786 04787 04788 04789 04790 04791 04792 04793 04794 04795 04796 04797 04798 04799 04800 04801 04802 04803 04804 04805 04806 04807 04808 04809 04810 04811 04812 04813 04814 04815 04816 04817 04818 04819 04820 04821 04822 04823 04824 04825 04826 04827 04828 04829 04830 04831 04832 04833 04834 04835 04836 04837 04838 04839 04840 04841 04842 04843 04844 04845 04846 04847 04848 04849 04850 04851 04852 04853 04854 04855 04856 04857 04858 04859 04860 04861 04862 04863 04864 04865 04866 04867 04868 04869 04870 04871 04872 04873 04874 04875 04876 04877 04878 04879 04880 04881 04882 04883 04884 04885 04886 04887 04888 04889 04890 04891 04892 04893 04894 04895 04896 04897 04898 04899 04900 04901 04902 04903 04904 04905 04906 04907 04908 04909 04910 04911 04912 04913 04914 04915 04916 04917 04918 04919 04920 04921 04922 04923 04924 04925 04926 04927 04928 04929 04930 04931 04932 04933 04934 04935 04936 04937 04938 04939 04940 04941 04942 04943 04944 04945 04946 04947 04948 04949 04950 04951 04952 04953 04954 04955 04956 04957 04958 04959 04960 04961 04962 04963 04964 04965 04966 04967 04968 04969 04970 04971 04972 04973 04974 04975 04976 04977 04978 04979 04980 04981 04982 04983 04984 04985 04986 04987 04988 04989 04990 04991 04992 04993 04994 04995 04996 04997 04998 04999 05000 05001 05002 05003 05004 05005 05006 05007 05008 05009 05010 05011 05012 05013 05014 05015 05016 05017 05018 05019 05020 05021 05022 05023 05024 05025 05026 05027 05028 05029 05030 05031 05032 05033 05034 05035 05036 05037 05038 05039 05040 05041 05042 05043 05044 05045 05046 05047 05048 05049 05050 05051 05052 05053 05054 05055 05056 05057 05058 05059 05060 05061 05062 05063 05064 05065 05066 05067 05068 05069 05070 05071 05072 05073 05074 05075 05076 05077 05078 05079 05080 05081 05082 05083 05084 05085 05086 05087 05088 05089 05090 05091 05092 05093 05094 05095 05096 05097 05098 05099 05100 05101 05102 05103 05104 05105 05106 05107 05108 05109 05110 05111 05112 05113 05114 05115 05116 05117 05118 05119 05120 05121 05122 05123 05124 05125 05126 05127 05128 05129 05130 05131 05132 05133 05134 05135 05136 05137 05138 05139 05140 05141 05142 05143 05144 05145 05146 05147 05148 05149 05150 05151 05152 05153 05154 05155 05156 05157 05158 05159 05160 05161 05162 05163 05164 05165 05166 05167 05168 05169 05170 05171 05172 05173 05174 05175 05176 05177 05178 05179 05180 05181 05182 05183 05184 05185 05186 05187 05188 05189 05190 05191 05192 05193 05194 05195 05196 05197 05198 05199 05200 05201 05202 05203 05204 05205 05206 05207 05208 05209 05210 05211 05212 05213 05214 05215 05216 05217 05218 05219 05220 05221 05222 05223 05224 05225 05226 05227 05228 05229 05230 05231 05232 05233 05234 05235 05236 05237 05238 05239 05240 05241 05242 05243 05244 05245 05246 05247 05248 05249 05250 05251 05252 05253 05254 05255 05256 05257 05258 05259 05260 05261 05262 05263 05264 05265 05266 05267 05268 05269 05270 05271 05272 05273 05274 05275 05276 05277 05278 05279 05280 05281 05282 05283 05284 05285 05286 05287 05288 05289 05290 05291 05292 05293 05294 05295 05296 05297 05298 05299 05300 05301 05302 05303 05304 05305 05306 05307 05308 05309 05310 05311 05312 05313 05314 05315 05316 05317 05318 05319 05320 05321 05322 05323 05324 05325 05326 05327 05328 05329 05330 05331 05332 05333 05334 05335 05336 05337 05338 05339 05340 05341 05342 05343 05344 05345 05346 05347 05348 05349 05350 05351 05352 05353 05354 05355 05356 05357 05358 05359 05360 05361 05362 05363 05364 05365 05366 05367 05368 05369 05370 05371 05372 05373 05374 05375 05376 05377 05378 05379 05380 05381 05382 05383 05384 05385 05386 05387 05388 05389 05390 05391 05392 05393 05394 05395 05396 05397 05398 05399 05400 05401 05402 05403 05404 05405 05406 05407 05408 05409 05410 05411 05412 05413 05414 05415 05416 05417 05418 05419 05420 05421 05422 05423 05424 05425 05426 05427 05428 05429 05430 05431 05432 05433 05434 05435 05436 05437 05438 05439 05440 05441 05442 05443 05444 05445 05446 05447 05448 05449 05450 05451 05452 05453 05454 05455 05456 05457 05458 05459 05460 05461 05462 05463 05464 05465 05466 05467 05468 05469 05470 05471 05472 05473 05474 05475 05476 05477 05478 05479 05480 05481 05482 05483 05484 05485 05486 05487 05488 05489 05490 05491 05492 05493 05494 05495 05496 05497 05498 05499 05500 05501 05502 05503 05504 05505 05506 05507 05508 05509 05510 05511 05512 05513 05514 05515 05516 05517 05518 05519 05520 05521 05522 05523 05524 05525 05526 05527 05528 05529 05530 05531 05532 05533 05534 05535 05536 05537 05538 05539 05540 05541 05542 05543 05544 05545 05546 05547 05548 05549 05550 05551 05552 05553 05554 05555 05556 05557 05558 05559 05560 05561 05562 05563 05564 05565 05566 05567 05568 05569 05570 05571 05572 05573 05574 05575 05576 05577 05578 05579 05580 05581 05582 05583 05584 05585 05586 05587 05588 05589 05590 05591 05592 05593 05594 05595 05596 05597 05598 05599 05600 05601 05602 05603 05604 05605 05606 05607 05608 05609 05610 05611 05612 05613 05614 05615 05616 05617 05618 05619 05620 05621 05622 05623 05624 05625 05626 05627 05628 05629 05630 05631 05632 05633 05634 05635 05636 05637 05638 05639 05640 05641 05642 05643 05644 05645 05646 05647 05648 05649 05650 05651 05652 05653 05654 05655 05656 05657 05658 05659 05660 05661 05662 05663 05664 05665 05666 05667 05668 05669 05670 05671 05672 05673 05674 05675 05676 05677 05678 05679 05680 05681 05682 05683 05684 05685 05686 05687 05688 05689 05690 05691 05692 05693 05694 05695 05696 05697 05698 05699 05700 05701 05702 05703 05704 05705 05706 05707 05708 05709 05710 05711 05712 05713 05714 05715 05716 05717 05718 05719 05720 05721 05722 05723 05724 05725 05726 05727 05728 05729 05730 05731 05732 05733 05734 05735 05736 05737 05738 05739 05740 05741 05742 05743 05744 05745 05746 05747 05748 05749 05750 05751 05752 05753 05754 05755 05756 05757 05758 05759 05760 05761 05762 05763 05764 05765 05766 05767 05768 05769 05770 05771 05772 05773 05774 05775 05776 05777 05778 05779 05780 05781 05782 05783 05784 05785 05786 05787 05788 05789 05790 05791 05792 05793 05794 05795 05796 05797 05798 05799 05800 05801 05802 05803 05804 05805 05806 05807 05808 05809 05810 05811 05812 05813 05814 05815 05816 05817 05818 05819 05820 05821 05822 05823 05824 05825 05826 05827 05828 05829 05830 05831 05832 05833 05834 05835 05836 05837 05838 05839 05840 05841 05842 05843 05844 05845 05846 05847 05848 05849 05850 05851 05852 05853 05854 05855 05856 05857 05858 05859 05860 05861 05862 05863 05864 05865 05866 05867 05868 05869 05870 05871 05872 05873 05874 05875 05876 05877 05878 05879 05880 05881 05882 05883 05884 05885 05886 05887 05888 05889 05890 05891 05892 05893 05894 05895 05896 05897 05898 05899 05900 05901 05902 05903 05904 05905 05906 05907 05908 05909 05910 05911 05912 05913 05914 05915 05916 05917 05918 05919 05920 05921 05922 05923 05924 05925 05926 05927 05928 05929 05930 05931 05932 05933 05934 05935 05936 05937 05938 05939 05940 05941 05942 05943 05944 05945 05946 05947 05948 05949 05950 05951 05952 05953 05954 05955 05956 05957 05958 05959 05960 05961 05962 05963 05964 05965 05966 05967 05968 05969 05970 05971 05972 05973 05974 05975 05976 05977 05978 05979 05980 05981 05982 05983 05984 05985 05986 05987 05988 05989 05990 05991 05992 05993 05994 05995 05996 05997 05998 05999 06000 06001 06002 06003 06004 06005 06006 06007 06008 06009 06010 06011 06012 06013 06014 06015 06016 06017 06018 06019 06020 06021 06022 06023 06024 06025 06026 06027 06028 06029 06030 06031 06032 06033 06034 06035 06036 06037 06038 06039 06040 06041 06042 06043 06044 06045 06046 06047 06048 06049 06050 06051 06052 06053 06054 06055 06056 06057 06058 06059 06060 06061 06062 06063 06064 06065 06066 06067 06068 06069 06070 06071 06072 06073 06074 06075 06076 06077 06078 06079 06080 06081 06082 06083 06084 06085 06086 06087 06088 06089 06090 06091 06092 06093 06094 06095 06096 06097 06098 06099 06100 06101 06102 06103 06104 06105 06106 06107 06108 06109 06110 06111 06112 06113 06114 06115 06116 06117 06118 06119 06120 06121 06122 06123 06124 06125 06126 06127 06128 06129 06130 06131 06132 06133 06134 06135 06136 06137 06138 06139 06140 06141 06142 06143 06144 06145 06146 06147 06148 06149 06150 06151 06152 06153 06154 06155 06156 06157 06158 06159 06160 06161 06162 06163 06164 06165 06166 06167 06168 06169 06170 06171 06172 06173 06174 06175 06176 06177 06178 06179 06180 06181 06182 06183 06184 06185 06186 06187 06188 06189 06190 06191 06192 06193 06194 06195 06196 06197 06198 06199 06200 06201 06202 06203 06204 06205 06206 06207 06208 06209 06210 06211 06212 06213 06214 06215 06216 06217 06218 06219 06220 06221 06222 06223 06224 06225 06226 06227 06228 06229 06230 06231 06232 06233 06234 06235 06236 06237 06238 06239 06240 06241 06242 06243 06244 06245 06246 06247 06248 06249 06250 06251 06252 06253 06254 06255 06256 06257 06258 06259 06260 06261 06262 06263 06264 06265 06266 06267 06268 06269 06270 06271 06272 06273 06274 06275 06276 06277 06278 06279 06280 06281 06282 06283 06284 06285 06286 06287 06288 06289 06290 06291 06292 06293 06294 06295 06296 06297 06298 06299 06300 06301 06302 06303 06304 06305 06306 06307 06308 06309 06310 06311 06312 06313 06314 06315 06316 06317 06318 06319 06320 06321 06322 06323 06324 06325 06326 06327 06328 06329 06330 06331 06332 06333 06334 06335 06336 06337 06338 06339 06340 06341 06342 06343 06344 06345 06346 06347 06348 06349 06350 06351 06352 06353 06354 06355 06356 06357 06358 06359 06360 06361 06362 06363 06364 06365 06366 06367 06368 06369 06370 06371 06372 06373 06374 06375 06376 06377 06378 06379 06380 06381 06382 06383 06384 06385 06386 06387 06388 06389 06390 06391 06392 06393 06394 06395 06396 06397 06398 06399 06400 06401 06402 06403 06404 06405 06406 06407 06408 06409 06410 06411 06412 06413 06414 06415 06416 06417 06418 06419 06420 06421 06422 06423 06424 06425 06426 06427 06428 06429 06430 06431 06432 06433 06434 06435 06436 06437 06438 06439 06440 06441 06442 06443 06444 06445 06446 06447 06448 06449 06450 06451 06452 06453 06454 06455 06456 06457 06458 06459 06460 06461 06462 06463 06464 06465 06466 06467 06468 06469 06470 06471 06472 06473 06474 06475 06476 06477 06478 06479 06480 06481 06482 06483 06484 06485 06486 06487 06488 06489 06490 06491 06492 06493 06494 06495 06496 06497 06498 06499 06500 06501 06502 06503 06504 06505 06506 06507 06508 06509 06510 06511 06512 06513 06514 06515 06516 06517 06518 06519 06520 06521 06522 06523 06524 06525 06526 06527 06528 06529 06530 06531 06532 06533 06534 06535 06536 06537 06538 06539 06540 06541 06542 06543 06544 06545 06546 06547 06548 06549 06550 06551 06552 06553 06554 06555 06556 06557 06558 06559 06560 06561 06562 06563 06564 06565 06566 06567 06568 06569 06570 06571 06572 06573 06574 06575 06576 06577 06578 06579 06580 06581 06582 06583 06584 06585 06586 06587 06588 06589 06590 06591 06592 |
//============================================================================= // ScriptControllerBase.uc // Created By: Mike Fox // Created On: 8/01/00 // $Author: Mfox $ // $Date: 2/11/03 5:53p $ // $Revision: 122 $ //============================================================================= class ScriptControllerBase extends ScriptControllerInterf config(User) native; /*============================================================================= Implements a command interpreter which can be used to script/control NPCs. The script commands are created in a text file which is associated with an instance of this class at run-time. For example, includes support for: +controlling the inventory which NPCs have and use +specifying the stance for NPCs (standing, crouching, prone) +specifying whether the NPC is hurt, alert etc. +specifying a patrol route, and movement speed +controlling the events which NPCs are allowed to react to (e.g. whether they should break off their patrol when they see an enemy) +setting up code which is executed when a specific event occurs +reacting to triggers and dynamically changing the way that triggers are handled +testing the state or properties of actors +enabling/disabling various debug levels in the controlled NPC +playing animations, sounds +integer and boolean "scratch" variables (e.g. do this patrol 3 times, then switch to another patrol; if this is the first time I see the player, play this sound). +destroying (NPC completely removed from level) or killing NPCs (carcass spawned) See U2AIScripting.doc for more info. Note: the native code parsing command appends any line with a "call", "interrupt", or "gotolabel" in it with the line number for that label (so we don't have to scan for it). So commands which include a call, interrupt, or gotolabel section will have an int at the end of their signature. Also, labels aren't stripped out of the code, e.g. to help with debugging -- depending on debugmode setting, a stripped-down version of the script (comments removed) is dumped to the log with the labels and patched-in destination lines shown to make things easier to interpret. Timer Overview -------------- Scripts can use the ontimer command to set up a timer which will cause script execution to jump to the specified label if/when the specified time limit is up. By default (RepeatFrequency = 0.0), the timer will uninstall itself when the timer runs out (and scripts can manually uninstall timers if desired). Currently timers are implemented using a static array in this class. Possible alternatives would have been to implement timers as separate objects (with timer events redirected to the associated script controller), but this was decided against for now for possible performance reasons. Up to 5 timers can be used with ontimer. The first parameter to ontimer (1-5) specified the target timer. Trigger Handler Overview ------------------------ Scripts can use the ontrigger command to associate a script label with a particular event. If/when the event occurs this will cause script execution to jump to the specified label. Triggers can also have a timer associated with them. This is usually used to limit how long the script will wait for the event to occur (e.g. when waiting for a squad leader's signal, the script has to allow for the possibility that the signal (in the form of an event) will never arrive. Timers which are associated with triggers are stored in the 2nd half of the Timers list. Any time that a trigger handler is uninstalled, the associated timer, if any, will also be uninstalled. If a trigger occurs, and the trigger is set to repeat (default), the timer will be reset. If a trigger occurs, and the trigger is set to once-only, the timer will be removed along with the trigger handler. If a timer occurs before the associated trigger event, the timer and the trigger handler will be uninstalled. If a trigger is reset, the associated timer is also reset. =============================================================================*/ const MaxCommandInfoEntries = 128; // size of commands list const MaxEvents = 32; // max number of events in event info list const MaxTriggerEvents = 32; // max number of tracked triggers const MaxPushedCommandIndices = 32; // maximum call/interrupt depth const MaxPatrolSize = 128; // max length of patrol that can be used with resumepatrol const MaxTimers = 10; // max number of timers (ontimer and ontrigger timers) const MaxTriggerTimers = 5; // max number of trigger timers (uses bottom of Timers list) const MaxGeneralTimers = 5; // = MaxTimers - MaxTriggerTimers //NOTE (mdf): don't add wasted overhead by setting up complex calls to DMSC etc. before checking flags to see if enabled const Debug_None = 0x0000; // don't show any debug info const Debug_Info = 0x0001; // show internal debug info const Debug_Commands = 0x0002; // dump commands and log executed commands const Debug_Events = 0x0004; // dump events as they are received const Debug_Jumps = 0x0008; // log control flow changes (gotos, calls, onevents etc.) const DefaultExt = ".u2s"; // supported states const BroadcastErrorState = 'BroadcastError'; const ChangingStanceState = 'ChangingStance'; const DetachingState = 'Detaching'; const ExecuteCommandsState = 'ExecuteCommands'; const FiringState = 'Firing'; const SleepingState = 'Sleeping'; // wait for event states const WaitActorInRangeState = 'WaitActorInRange'; const WaitActorOutOfRangeState = 'WaitActorOutOfRange'; const WaitAnimEndState = 'WaitAnimEnd'; // only really needed for waiting for end of scripted animations const WaitBumpEnemyState = 'WaitBumpEnemy'; const WaitBumpFriendState = 'WaitBumpFriend'; const WaitBumpOtherState = 'WaitBumpOther'; const WaitBumpPlayerState = 'WaitBumpPlayer'; const WaitDestinationReachedState = 'WaitDestinationReached'; const WaitDialogBeginState = 'WaitDialogBegin'; const WaitDialogPausedState = 'WaitDialogPaused'; const WaitDialogFarPausedState = 'WaitDialogFarPaused'; const WaitDiedState = 'WaitDied'; const WaitFinishedRotationState = 'WaitFinishedRotation'; const WaitHearNoiseFriendlyState = 'WaitHearNoiseFriendly'; const WaitHearNoiseOtherState = 'WaitHearNoiseOther'; const WaitHearNoiseThreatState = 'WaitHearNoiseThreat'; const WaitScriptedLandingState = 'WaitScriptedLanding'; const WaitSeeEnemyState = 'WaitSeeEnemy'; const WaitSeeFriendState = 'WaitSeeFriend'; const WaitSeeOtherState = 'WaitSeeOther'; const WaitSeePlayerState = 'WaitSeePlayer'; const WaitTakeDamageState = 'WaitTakeDamage'; const WaitTookDamageState = 'WaitTookDamage'; const WaitTookDamageEnemyState = 'WaitTookDamageEnemy'; const WaitTookDamageFriendState = 'WaitTookDamageFriend'; const WaitTriggerState = 'WaitTrigger'; // events const ActorInRangeEvent = 'ActorInRange'; // generated when the InRangeActor comes within the InRangeDistance const ActorOutOfRangeEvent = 'ActorOutOfRange'; // generated once when the InRangeActor comes goes out of the InRangeDistance const AnimEndEvent = 'AnimEnd'; // goes to Controller unless Pawn has no Controller (dying state) const AutoBeginEvent = 'AutoBegin'; // goes to Controller, generated by U2NPCControllerScriptable const AutoEndEvent = 'AutoEnd'; // goes to Controller, generated by Controller const BumpEnemyEvent = 'BumpEnemy'; // NotifyBump --> Controller --> BumpEnemy/Friend/Other const BumpFriendEvent = 'BumpFriend'; // NotifyBump --> Controller --> BumpEnemy/Friend/Other const BumpOtherEvent = 'BumpOther'; // NotifyBump --> Controller --> BumpEnemy/Friend/Other const BumpPlayerEvent = 'BumpPlayer'; // not an actual event: eventwait BumpPlayer --> BumpEnemy/BumpFriend checked for player const DestinationReachedEvent = 'DestinationReached'; // goes to Controller const DialogBeginEvent = 'DialogBegin'; // generated by Controller before destroyed const DialogUnPauseEvent = 'DialogUnPause'; // generated when dialog unpauses npc's script const DiedEvent = 'Died'; // generated by Controller before destroyed const EnemyNotVisibleEvent = 'EnemyNotVisible'; // goes to Controller const HearNoiseFriendlyEvent = 'HearNoiseFriendly'; // HearNoise --> Controller --> HearNoiseFriendly const HearNoiseOtherEvent = 'HearNoiseOther'; // HearNoise --> Controller --> HearNoiseOther const HearNoiseThreatEvent = 'HearNoiseThreat'; // HearNoise --> Controller --> HearNoiseThreat const InheritEnemyEvent = 'InheritEnemy'; // generated when NPC could inherit another NPC's Enemy const ScriptedLandingEvent = 'ScriptedLanding'; // generated when NPC in scripted state lands (not passed back to NPC) const SeeAlertFriendEvent = 'SeeAlertFriend'; // SeeAlertFriend --> Controller const SeeEnemyEvent = 'SeeEnemy'; // SeeEnemy --> Controller const SeeFriendEvent = 'SeeFriend'; // SeeFriend --> Controller --> SeeFriend const SeeOtherEvent = 'SeeOther'; // SeeOther --> Controller --> SeeOther const SeePlayerEvent = 'SeePlayer'; // not an actual event: eventwait SeePlayer --> SeeEnemy/SeeFriend checked for player const TakeDamageEvent = 'TakeDamage'; // goes to Pawn const TookDamageEvent = 'TookDamage'; // eventTakeDamage --> TookDamage generated by U2NPCControllerScriptable const TookDamageEnemyEvent = 'TookDamageEnemy'; // generated internall from TookDamage for use by scripts only const TookDamageFriendEvent = 'TookDamageFriend'; // generated internall from TookDamage for use by scripts only const TriggerEvent = 'Trigger'; // goes to Pawn then Controller // timers const BroadcastErrorMessageTimerName = 'BroadcastErrorMessage'; const ResumeProcessingTimerName = 'ResumeProcessing'; const StanceChangeDoneTimerName = 'StanceChangeDone'; const StopFiringTimerName = 'StopFiring'; const StopFiringBackupTimerName = 'StopFiringBackup'; //----------------------------------------------------------------------------- // parser related // arguments const MaxArgsByte = 5; const MaxArgsFloat = 5; const MaxArgsInt = 5; const MaxArgsName = 5; const MaxArgsString = 5; const MaxArgsLabel = 2; /*----------------------------------------------------------------------------- Command signatures. Note: use SigO_... for any signature with optional args. This should also help to avoid name clashes (UC isn't case-sensitive). */ const BUpperAscii = 0x42; // obligatory bool (0/1) const FUpperAscii = 0x46; // obligatory float const IUpperAscii = 0x49; // obligatory int const MUpperAscii = 0x4D; // obligatory name (added to name table if not in game) const NUpperAscii = 0x4E; // obligatory name (must already exist in game / name table) const SUpperAscii = 0x53; // obligatory string const TUpperAscii = 0x54; // obligatory target name (must be found in level?) const bLowerAscii = 0x62; // optional bool (0/1) const fLowerAscii = 0x66; // optional float const iLowerAscii = 0x69; // optional int const mLowerAscii = 0x6D; // optional name (added to name table if not in game) const nLowerAscii = 0x6E; // optional name (must already exist in game / name table) const sLowerAscii = 0x73; // optional string const tLowerAscii = 0x74; // optional target name (must be found in level if given?) const Sig_B = "B"; const Sig_F = "F"; const Sig_FFF = "FFF"; const Sig_I = "I"; const Sig_MB = "MB"; const Sig_M = "M"; const Sig_MM = "MM"; const Sig_N = "N"; const Sig_NB = "NB"; const Sig_NF = "NF"; const Sig_NFb = "NFb"; const Sig_NM = "NM"; const Sig_NS = "NS"; const Sig_S = "S"; const Sig_SI = "SI"; const Sig_SM = "SM"; const Sig_SSN = "SSN"; const Sig_SSS = "SSS"; const Sig_T = "T"; const Sig_TM = "TM"; const Sig_TNb = "TNb"; const Sig_TS = "TS"; const Sig_TSS = "TSS"; const SigO_bi = "bi"; const SigO_Bb = "Bb"; const SigO_f = "f"; const SigO_Fs = "Fs"; const SigO_Fss = "Fss"; const SigO_i = "i"; const SigO_Iffssi = "Iffssi"; const SigO_Mb = "Mb"; const SigO_IMfb = "IMfb"; const SigO_IMffb = "IMffb"; const SigO_Mfb = "Mfb"; const SigO_Mffb = "Mffb"; const SigO_MSs = "MSs"; const SigO_Mssbfss = "Mssbfss"; const SigO_Mt = "Mt"; const SigO_TMb = "TMb"; const SigO_ntfn = "ntfn"; const SigO_Nb = "Nb"; const SigO_NFss = "NFss"; const SigO_Nfb = "Nfb"; const SigO_Nn = "Nn"; const SigO_Nssb = "Nssb"; const SigO_s = "s"; const SigO_sffiiiss = "sffiiiss"; const SigO_sm = "sm"; const SigO_Sb = "Sb"; const SigO_Sbi = "Sbi"; const SigO_Si = "Si"; const SigO_SIb = "SIb"; const SigO_Ss = "Ss"; const SigO_t = "t"; const SigO_tib = "tib"; const SigO_Tfb = "Tfb"; const SigO_TFFFb = "TFFFb"; const SigO_TNss = "TNss"; const SigO_TSbss = "TSbss"; const SigO_TSf = "TSf"; const SigO_TSi = "TSi"; const SigO_TSnfbff = "TSnfbff"; const SigO_TSSss = "TSSss"; const Sig_XXX = "X"; // no args (parser will make sure nothing after command) const TextGotoLabel = "gotolabel"; // gotolabel command string literal const TextCall = "call"; // call command string literal const TextInterrupt = "interrupt"; // interrupt command string literal const DefaultPropertyString = "default"; const PlayerSpeakerString = "player"; // speaker string of the player const SelfSpeakerString = "self"; // used to impley npc is talking by himself const SpecialStateAgentInput = 'SpecialState'; // agent input that, when bound, locks the agent const TargetControllerName = 'controller'; // the controlled NPC's controller const TargetEventInstigatorName = 'eventinstigator'; // instigator for most recent event (if applicable) const TargetEventOtherName = 'eventother'; // other for most recent event (if applicable) const TargetFoundName = 'found'; // actor found in previous call to FindActor const TargetPawnName = 'pawn'; // the controlled NPC's pawn const TargetPlayerName = 'player'; // the player const TargetSelfName = 'self'; // the script controller itseld (mainly for accessing scratch variables) //----------------------------------------------------------------------------- const MsgBadOrMissingArgument = "bad or missing parameter"; const MsgBadOrMissingLabel = "bad or missing label"; const MsgBadOrMissingLabelIndex = "bad or missing label index"; const MsgCallInterruptReturnError = "mismatched call/return or interrupt/return error"; // extra junk after last valid argument const MsgGotoLabelInterruptError = "bad or missing gotolabel/interrupt"; const MsgInternalErrorSignature = "internal errors -- bad function signature"; const MsgInvalidArgument = "invalid argument"; // extra junk after last valid argument const MsgInvalidArgumentExtra = "invalid extra argument"; // extra junk after last valid argument const MsgInvalidCommand = "invalid command (u2s commands should be all lower-case)"; const MsgInvalidCommandListIndex = "invalid command list index"; const MsgInvalidEventName = "invalid event name"; const MsgInvalidOrders = "invalid orders (error setting NPC orders)"; const MsgInvalidOrderGiver = "invalid order giver"; const MsgInvalidOrdersObject = "invalid orders object"; const MsgInvalidOrdersNotSupported = "invalid orders (given orders not currently supported)"; const MsgScriptInitError = "error initializing commands!"; const MsgScriptLoadError = "error loading commands!"; const MsgTargetFindError = "can't find given target"; const MsgTargetVerifyError = "internal error - CommandTarget not set while executing commnand"; const CommandsListIndex_Error = -999; const CommandsListIndex_Label = 999; const CommandsListIndex_Stop = -1; const ResumePatrolBest = 'best'; const ResumePatrolClosest = 'closest'; const ResumePatrolRandom = 'random'; const ResumePatrolSaved = 'saved'; //----------------------------------------------------------------------------- enum ECommandCode // operands action { CMD_None, // error CMD_Label, // label CMD_AddAmmo, // ammostring amount [maxclip] gives N units of specified ammo to NPC, if maxclip=1 makes sure clip is as full as possible CMD_AgentBind, // inputname valuename sets and locks an agent input to a given value, for characters with agent-driven meshes CMD_AgentCall, // actionname [wait] calls an agent action of the given name, for characters with agent-driven meshes CMD_AgentExecute, // actiontext [wait] compiles and executes a GAL string on-the-fly as if were inside an action, and calls it CMD_AgentUnbind, // inputname unlocks an agent input previously locked and set with AgentBind CMD_AnimLoop, // name [rate tweentime [wait]] loops specified anim on channel 0 CMD_AnimLoopEx, // channel name [rate tweentime [wait]] loops specified anim on arbitrary channel CMD_AnimPlay, // name [rate tweentime [wait]] plays specified anim on channel 0 CMD_AnimPlayEx, // channel name [rate tweentime [wait]] plays specified anim on arbitrary channel CMD_AnimRelease, // allow NPC to control anims (currently idle only) CMD_AnimTween, // name [tweentime [wait]] tweens specified anim on channel 0 CMD_AnimTweenEx, // channel name [tweentime [wait]] tweens specified anim on arbitrary channel CMD_Call, // label pushes line after current one and jumps to given label CMD_CallScript, // scriptname pushes current script state and switches to specified file CMD_CallEnd, // aborts any previously pushed call (can no longer return) CMD_ClearEvents, // clears any current onevents CMD_ClearTimers, // clears any current general timers CMD_ClearTriggers, // clears any current ontriggers CMD_ConsoleCommand, // command executes given console command CMD_DebugAI, // 0/1 enables/disables debug AI mode in controlled NPC CMD_DebugAIEvents, // 0/1 enables/disables debug events mode in controlled NPC CMD_DebugAIFlags, // ### explicitely sets debug AI flags in controlled NPC CMD_DebugMode, // flags enables/disables various debug modes for the script controller CMD_DecProperty, // name property value [#] decrements (integer) property in named actor by 1 or by # CMD_DeployInventory, // S [1] deploy given inventory item [alt deploy it] CMD_Destroy, // destroy controlled NPC (and controller) CMD_DialogDisable, // topicname disable this dialog node CMD_DialogEnable, // topicname enable this dialog node CMD_DialogFar, // topicname speaker1 [speaker2] starts dialog b/w 2 npcs regardless of distance CMD_DialogFarWait, // topicname speaker1 [speaker2] waits for dialog b/w 2 npcs to finish CMD_DialogInitiate, // speaker topicname tries to initiate given dialog with given target CMD_DialogTerminate, // speaker tries to remove NPC from dialog CMD_DirectionalPatrol, // 0/1 whether NPC faces in direction of patrol destination CMD_Dormant, // 0/1 [1] toggle whether NPC (Pawn and Controller) is dormant (bStasis=true and Physics=PHYS_None) [1] means stay dormant even if script removed? CMD_DropInventory, // S drop given inventory item CMD_EnableProbeEvent, // probename 0|1 enables/disables NPC probe event (for performance) e.g. enableprobeevent seeplayer 0 -> no more seeplayer events CMD_EnableXMPHandling, // 0/1 enables/disables NPC reacting to XMP items (inert 0/1 sets this to 1/0 use enablexmphandling 0/1 to override this). CMD_Error, // used internally CMD_EventDisable, // event disables event CMD_EventEnable, // event enables event CMD_EventWait, // event waits until event occurs CMD_FindActor, // [name Min Max Type Vis Num gotolabel targetlabel] searches for actors in level (all args optional) CMD_Fire, // [duration] fire (weapon / animation-based) for given duration CMD_FireAlt, // [duration] alt fire (weapon / animation-based) for given duration CMD_Gib, // [bDestroy] [gorelevel] gib controlled NPC. If gib fails, bDestroy determines if npc is killed or destroyed. Gore level overrides the gibset's default gore level CMD_GibAll, // targetclass [bDestroy] [gorelevel] gib all actors of the given class. . If gib fails, bDestroy determines if npc is killed or destroyed. Gore level overrides the gibset's default gore level CMD_GiveInventory, // inventorystring gives the specified inventory item to the NPC CMD_GiveItemToPlayer, // inventorystring [ammocount] give item to player, if ammocount treats as ammo and adds this much ammo to player's inventory CMD_GiveTossedItem, // inventorystring add item to tossed items list CMD_GotoActor, // targetname [dist [face]] sends NPC to specifed actor at specified dist (error if target not found), face=1 ==> try to face target (e.g. for initiating dialog) CMD_GotoActorSafe, // targetname [dist [face]] sends NPC to specifed actor at specified dist (not an error if target not found), face=1 ==> try to face target (e.g. for initiating dialog) CMD_GotoLabel, // label jumps to given label CMD_IncProperty, // name property value [#] increments (integer) property in named actor by 1 or by # CMD_Inert, // 0/1 toggles NPC reacting to sensory input -- shorthand for toggling bump, hearnoise, seeplayer, tookdamage CMD_HandlerGroup, // denotes start of a new handler groups (can't be in one currently?) CMD_HandlerGroupEnd, // denotes end of a new handler groups (must be in one currently) CMD_HeadTracking, // 0/1 CMD_Jump, // X Y Z launch NPC in given direction CMD_Kill, // kill controlled NPC (goes into dying state) CMD_KillAll, // targetclass kill all actors of the given class CMD_LockStep, // name [f] maintain given or current distance from named actor (for keeping squads in formation) CMD_Message, // string [0|1|2] displays the given message in-game (surround with "" for multiple words) 0: onscreen 1: log 2: onscreen and log CMD_OnEvent, // xxx [gotolabel ### [clear]] when event xxx occurs, jumps to given label (or disables previous onevent) CMD_OnTimer, // index [delay repeat gotolabel ###] adds a general-purpose timer CMD_OnTrigger, // name [gotolabel ###] when trigger with given event name occurs, jumps to given label (or disables previous ontrigger) CMD_PlaySound, // name sound [slot [volume [bNoOverride [Radius [Pitch]]]]] plays sound through named actor (or self=controlled NPC) CMD_PlaySoundWait, // name sound [slot [volume [bNoOverride [Radius [Pitch]]]]] plays sound through named actor (or self=controlled NPC) and script waits for sound to finish CMD_PlaySoundTableSlot, // name slot play sound belonging to the specified group from named pawn's sound table CMD_PlaySoundTableSlotWait, // name slot play sound belonging to the specified group from named pawn's sound table and script waits for sound to finish CMD_RemoveInventory, // [string] removes all [or the specified] inventory from the NPC CMD_RemoveInventoryFromPlayer, // [string] removes all [or the specified] inventory from the player CMD_RemoveItemFromPlayer, // inventorystring add item to player's inventory CMD_RemoveTossedItem, // inventorystring remove item from tossed items list CMD_ResumePatrol, // startlabel endlabel finds the "best" destination at which the resume patrolling and jumps to that line CMD_Return, // returns to most recently pushed line or script state (error if no applicable) CMD_Rotate, // #.# rotate #.# degrees clockwise (right) relative to forward CMD_SaveDestination, // copies GotoActorTarget into SavedDestination for later use with resumepatrol CMD_SendEvent, // EventName [triggerpawns] triggers all Actors with tag that matches given Event, or all NPCs CMD_SetActorRangeTest, // target distance sets the InRangeActor and InRangeDistance for ActorInRange/ActorOutOfRange events CMD_SetAimOdds, // odds sets odds of hitting target when firing weapon under script control CMD_SetAlert, // 0/1 controls whether NPC uses "alert" animations CMD_SetAmmo, // ammostring amount [maxclip] makes sure NPC has exactly specified amount of given type of ammo, if maxclip=1 makes sure clip is as full as possible CMD_SetFocus, // [name] set scripted focus to given actor or clear focus CMD_SetHealth, // x.x sets controlled NPC's health to x.x CMD_SetInventory, // targetname inventorystring sets target's selected inventory to x.x CMD_SetLocation, // locationname [allowfail] move pawn to location of locationame CMD_SetLocationNamed, // targetname locationname [allowfail] move actor matching targetname to location of locationame CMD_SetLocationVector, // targetname X Y Z move targetname to given coordinates CMD_SetMoveSpeed, // speed [stance] 0.01 to MaxDesiredSpeed (usually 1.0) -- set speed used for scripted movement CMD_SetMoveSpeedAuto, // speed 0.01 to MaxDesiredSpeed (usually 1.0) -- set speed used for autonomous movement CMD_SetOrders, // orders [OrdersObject [fparam [ordergiver]]] sets/clears orders CMD_SetPhysics, // physics CMD_SetProperty, // targetname property value sets property in named actor to value CMD_SetProperties, // classname property value sets given property in all actors which are a classname CMD_SetSatellite, // satellitename [targetname] binds a mesh satellite node of the given name to the given target, for dynamic animations CMD_SetScript, // filename [startlabel] switches over to the given script [at the given label] CMD_SetSkill, // skill set NPC's skill to given value (0.0..1.0) CMD_SetStance, // stand / crouch / prone specifies stance that NPC should use while patrolling CMD_SetStationary, // 1/0 [1] makes NPC immobile/mobile, optionally forever CMD_SetTacticalMoveType, // 0/1/2 sets tactical move type to use during scripted movement (0: none 1: basic 2: serpentine) CMD_SetWeapon, // weaponstring set NPC's weapon to specified one, spawning it if necessary CMD_Shutdown, // 1/0 makes NPC as inert as possible without actually making it dormant or removing its controller CMD_Sleep, // [x.x] puts controller to sleep for x.x seconds (defaults to "forever") CMD_SleepRand, // [x.x] puts controller to sleep for random time in 0..x.x seconds (x.x defaults to 1.0) CMD_Spawn, // targetname S [1 [filename [startlabel]]] spawn given actor at targetname's location, if 1 is given, failure = error, optionally gives spawned NPCs a script CMD_Stop, // stops execution, detaches script controller CMD_StopMovement, // stops NPC movement CMD_StopSound, // slot [bStopNoOverrideSounds] stops any sounds played through the named actor on the specified sound slot CMD_TestActorInRange, // name distance if given actor is outside given distance of pawn ==> next command skipped CMD_TestProperty, // name property value property != value ==> next command skipped (string comparison) CMD_TestPropertyCI, // name property value property != value ==> next command skipped (case-insensitive string comparison) CMD_TestPropertyE, // name property value property != value ==> next command skipped (numerical comparison) CMD_TestPropertyG, // name property value property <= value ==> next command skipped (numerical comparison) CMD_TestPropertyGE, // name property value property < value ==> next command skipped (numerical comparison) CMD_TestPropertyL, // name property value property >= value ==> next command skipped (numerical comparison) CMD_TestPropertyLE, // name property value property > value ==> next command skipped (numerical comparison) CMD_TestRandom, // float (if random number in 0.0..1.0 > value ==> next command skipped) CMD_TestState, // name name (false ==> next command skipped) CMD_TurnToActor, // targetname [LOS [Lock]] turn NPC to face named actor, LOS=0 ==> LOS not needed, LOS=1 ==> LOS needed, LOS=2 ==> LOS not needed but turn anyway, Lock means target actor won't be cleared CMD_Unuse, // name unuse the named actor CMD_Use, // name use the named actor CMD_UsePickups, // 0/1 if 0, won't go after or pickup pickups CMD_WeaponLoad, // load current weapon CMD_WeaponSetAmmoType, // ammoname CMD_WeaponSupportsAltFire, // weaponname 0/1 disables/enables NPC being able to alt fire weapon CMD_WeaponSupportsFire, // weaponname 0/1 disables/enables NPC being able to primary fire weapon }; //----------------------------------------------------------------------------- // for holding parsed arguments: var byte ArgsByte[MaxArgsByte]; // UC doesn't support arrays of bools -- bools use bytes var float ArgsFloat[MaxArgsFloat]; var int ArgsInt[MaxArgsInt]; var name ArgsName[MaxArgsName]; var string ArgsString[MaxArgsString]; var int ArgsLabel[MaxArgsLabel]; //----------------------------------------------------------------------------- // scratch variables (used with set/get/inc/dec property for loop control, // conditional branching etc.)? var int Int1, Int2, Int3, Int4, Int5, Int6, Int7, Int8, Int9; var bool Bool1, Bool2, Bool3, Bool4, Bool5, Bool6, Bool7, Bool8, Bool9; //----------------------------------------------------------------------------- var string ScriptErrorMessage; // last error message // vars for decoded command var int CurrentCommandIndex; // index of current command var int DecodedCount; // count of total number of commands decoded so far var() globalconfig int DebugMode; // script debug mode (use debugmode command or unreal.ini to enable) var() globalconfig float ErrorMessageFrequency; //----------------------------------------------------------------------------- // used for CommandInfo list (list of available commands) struct native CommandInfoT { var string CommandString; var ECommandCode CommandCode; var string Signature; }; var() const CommandInfoT CommandInfo[ MaxCommandInfoEntries ]; // list of commands (token string/code pairs, command signatures) //----------------------------------------------------------------------------- struct native CommandT { var string CommandString; // command string var int CommandIndex; // index into Commands list (stored so don't have to extract from command string each time) var Object CommandTarget; // command target (stored if possible so don't have to extract/find each time) }; var CommandT CurrentCommand; // current command //----------------------------------------------------------------------------- struct native EventT { var name EventName; // event name... var name EventWaitState; // state to use when waiting for the event var bool bEnabled; // event is enabled (default) var bool bCanToggle; // event can be enabled/disabled (false ==> always enabled) var int OnCmdIndex; // index to handler (line # after stripping comments) var bool bClear; // whether to clear handler when event arrives var int Group; // group event handler belongs to var bool bInterrupt; // whether to execute gotolabel (false) or interrupt (true) }; var() EventT Events[MaxEvents]; // list of events (string/name/waitstatename) var int NumEvents; // number of events struct native TimerT { var float InitialFrequency; var float RepeatFrequency; var int TriggerIndex; // index of assosiated trigger event for trigger timers var int OnCmdIndex; var int Group; // group event handler belongs to var bool bInterrupt; // whether to execute gotolabel (false) or interrupt (true) }; var() TimerT Timers[MaxTimers]; // timer list (ontimer and ontrigger timers -- ontrigger timers use bottom of list) struct native TriggerEventT { var name EventName; var int OnCmdIndex; var bool bClear; // whether to clear trigger handler when event arrives var int TimerIndex; // index of associated timer, -1 if none var int Group; // group event handler belongs to var bool bInterrupt; // whether to execute gotolabel (false) or interrupt (true) }; var() TriggerEventT TriggerEvents[ MaxTriggerEvents ]; // list of trigger events which are being tracked (for "ontrigger xxx gotolable yyy" or "waitevent trigger xxx") var int NumTriggerEvents; // number of events currently in list (which is kept packed but not sorted) //----------------------------------------------------------------------------- var int NumPushedCommandIndices; var int PushedCommandIndices[ MaxPushedCommandIndices ]; /*----------------------------------------------------------------------------- Actor references. The CommandTarget in any CommandT structs can also refer to actors. */ var Actor FoundActors[ UtilGame.MaxFilteredActors ]; var Actor SavedEventInstigator; var Actor SavedEventOther; var protected Actor GotoActorTarget; var protected Actor DialogTarget; var protected Actor SavedDestination; // copy of GotoActorTarget (used with savedestination command) var int NumFoundActors; //----------------------------------------------------------------------------- var() string CommandFileName; // name of file with commands var() string StartLabelName; // optional label to start at instead of top of script //----------------------------------------------------------------------------- var protected name WaitTriggerEvent; //----------------------------------------------------------------------------- // event enabling/disabling // indices into Events table for locating corresponding bEnabled flag var int ActorInRangeIndex; var int ActorOutOfRangeIndex; var int AnimEndIndex; var int AutoBeginIndex; var int AutoEndIndex; var int BumpEnemyIndex; var int BumpFriendIndex; var int BumpOtherIndex; var int BumpPlayerIndex; var int DialogBeginIndex; var int DialogUnPauseIndex; var int DiedIndex; var int EnemyNotVisibleIndex; var int HearNoiseFriendlyIndex; var int HearNoiseOtherIndex; var int HearNoiseThreatIndex; var int InheritEnemyIndex; var int ScriptedLandingIndex; var int SeeAlertFriendIndex; var int SeeEnemyIndex; var int SeeFriendIndex; var int SeeOtherIndex; var int SeePlayerIndex; var int TakeDamageIndex; var int TookDamageIndex; var int TookDamageEnemyIndex; var int TookDamageFriendIndex; var int TriggerIndex; // handler groups var int CurrentHandlerGroup; var int NextHandlerGroupIndex; var bool bInHandlerGroup; var bool bXMPHandlingEnabled; // set once Initialized var protected U2NPCControllerScriptable NPCOwner; var protected U2Pawn U2PawnOwner; var array<CommandT> Commands; //----------------------------------------------------------------------------- // native functions native function bool LoadCommandsFromFile( string FileName, LevelInfo Level ); // returns false on error (bad labels etc.) //----------------------------------------------------------------------------- function ResumeProcessing(); //============================================================================= // event handling functions //============================================================================= function int FindEvent( name EventName ) { local int Index; Index = 0; while( Index < NumEvents && !(Events[Index].EventName == EventName) ) Index++; if( Index >= NumEvents ) Index = -1; return Index; } //----------------------------------------------------------------------------- // debug help function DumpTriggers() { local int Index; NPCOwner.DMTNS( "NumTriggerEvents: " $ NumTriggerEvents ); for( Index=0; Index<NumTriggerEvents; Index++ ) NPCOwner.DMTNS( " TriggerEvents # " $ Index $ ": " $ TriggerEvents[Index].EventName $ " Line: " $ TriggerEvents[Index].OnCmdIndex ); } //----------------------------------------------------------------------------- function int FindTrigger( name EventName ) { local int Index; //NPCOwner.DMTNS( "FindTrigger: " $ EventName ); //DumpTriggers(); // look for trigger name in table Index = 0; while( Index < NumTriggerEvents && TriggerEvents[Index].EventName != EventName ) Index++; if( Index >= NumTriggerEvents ) Index = -1; return Index; } //----------------------------------------------------------------------------- // Can be called with TriggerIndex = -1 (e.g. if trigger was already disabled). function ClearTrigger( int TriggerIndex, bool bClearTimer ) { local int Index; //NPCOwner.DMTNS( "ClearTrigger -- TriggerIndex: " $ TriggerIndex $ " NumTriggerEvents: " $ NumTriggerEvents ); if( TriggerIndex != -1 ) { // mdf-tbr:? //NPCOwner.DMTNS( "TriggerEvents[ TriggerIndex ].EventName: " $ TriggerEvents[ TriggerIndex ].EventName ); //NPCOwner.DMTNS( "TriggerEvents[ TriggerIndex ].OnCmdIndex: " $ TriggerEvents[ TriggerIndex ].OnCmdIndex ); #debugbegin NPCOwner.DMAssert( NumTriggerEvents >= 1, "ClearTrigger #1" ); NPCOwner.DMAssert( TriggerEvents[ TriggerIndex ].EventName != '', "ClearTrigger #2" ); NPCOwner.DMAssert( TriggerEvents[ TriggerIndex ].OnCmdIndex != -1, "ClearTrigger #3" ); #debugend TriggerEvents[ TriggerIndex ].EventName = ''; TriggerEvents[ TriggerIndex ].OnCmdIndex = -1; if( bClearTimer && TriggerEvents[ TriggerIndex ].TimerIndex != -1 ) { HandleRemoveTimer( TriggerEvents[ TriggerIndex ].TimerIndex, false ); TriggerEvents[ TriggerIndex ].TimerIndex = -1; } // move rest of list up so it remains packed for( Index=TriggerIndex; Index<NumTriggerEvents-1; Index++ ) TriggerEvents[ Index ] = TriggerEvents[ Index+1 ]; NumTriggerEvents--; } else { // mdf-tbr?: if( NumTriggerEvents <= 0 ) NPCOwner.DM( "Warning -- ClearTrigger called with NumTriggerEvents = " $ NumTriggerEvents $ " is this OK?" ); } } //----------------------------------------------------------------------------- // debug function DumpTimers() { local int Index; for( Index=0; Index<MaxGeneralTimers; Index++ ) NPCOwner.DMTNS( " Timer # " $ Index $ ": " $ " Frequency: " $ Timers[Index].InitialFrequency $ " / " $ Timers[Index].RepeatFrequency $ " Line: " $ Timers[Index].OnCmdIndex ); for( Index=MaxGeneralTimers; Index<MaxTimers; Index++ ) NPCOwner.DMTNS( " TriggerTimer # " $ Index $ ": " $ " Frequency: " $ Timers[Index].InitialFrequency $ " Name: " $ Timers[Index].TriggerIndex $ " Line: " $ Timers[Index].OnCmdIndex ); } //------------------------------------------------------------------------- function bool GetEventIndex( name EventName, out int Index ) { Index = FindEvent( EventName ); if( Index == -1 ) SetScriptError( "Invalid event name: " $ EventName ); return (Index != -1); } //----------------------------------------------------------------------------- function SetEventIndex( name EventName, out int EventIndex ) { EventIndex = FindEvent( EventName ); if( EventIndex == -1 ) Log( "Warning -- error setting EventIndex for " $ EventName ); } //----------------------------------------------------------------------------- // Note: can't use DestinationReached in scripts -- its used implicitely by // gotoactor etc. function InitEventsIndices() { local int EventIndex; NumEvents=0; for( EventIndex=0; EventIndex<MaxEvents && Events[EventIndex].EventName != ''; EventIndex++ ) NumEvents++; SetEventIndex( ActorInRangeEvent, ActorInRangeIndex ); SetEventIndex( ActorOutOfRangeEvent, ActorOutOfRangeIndex ); SetEventIndex( AnimEndEvent, AnimEndIndex ); SetEventIndex( AutoBeginEvent, AutoBeginIndex ); SetEventIndex( AutoEndEvent, AutoEndIndex ); SetEventIndex( BumpEnemyEvent, BumpEnemyIndex ); SetEventIndex( BumpFriendEvent, BumpFriendIndex ); SetEventIndex( BumpOtherEvent, BumpOtherIndex ); SetEventIndex( BumpPlayerEvent, BumpPlayerIndex ); SetEventIndex( DialogBeginEvent, DialogBeginIndex ); SetEventIndex( DialogUnPauseEvent, DialogUnPauseIndex ); SetEventIndex( DiedEvent, DiedIndex ); SetEventIndex( EnemyNotVisibleEvent, EnemyNotVisibleIndex ); SetEventIndex( HearNoiseFriendlyEvent, HearNoiseFriendlyIndex ); SetEventIndex( HearNoiseOtherEvent, HearNoiseOtherIndex ); SetEventIndex( HearNoiseThreatEvent, HearNoiseThreatIndex ); SetEventIndex( InheritEnemyEvent, InheritEnemyIndex ); SetEventIndex( ScriptedLandingEvent, ScriptedLandingIndex ); SetEventIndex( SeeAlertFriendEvent, SeeAlertFriendIndex ); SetEventIndex( SeeEnemyEvent, SeeEnemyIndex ); SetEventIndex( SeeFriendEvent, SeeFriendIndex ); SetEventIndex( SeeOtherEvent, SeeOtherIndex ); SetEventIndex( SeePlayerEvent, SeePlayerIndex ); SetEventIndex( TakeDamageEvent, TakeDamageIndex ); SetEventIndex( TookDamageEvent, TookDamageIndex ); SetEventIndex( TookDamageEnemyEvent, TookDamageEnemyIndex ); SetEventIndex( TookDamageFriendEvent, TookDamageFriendIndex ); SetEventIndex( TriggerEvent, TriggerIndex ); } //----------------------------------------------------------------------------- // Called when an onevent or ontrigger event comes in which has a label to jump // to associated with it. function HandleOnEvent( int NewCommandIndex, optional bool bInterrupt ) { //NPCOwner.DMTNS( "HandleOnEvent: " $ NewCommandIndex ); if( bInterrupt ) // onevent XXX interrupt YYY DoInterrupt( NewCommandIndex ); else DoGoto( NewCommandIndex ); // onevent XXX gotolabel YYY GotoState( ExecuteCommandsState ); } //----------------------------------------------------------------------------- // Disable any onevent/ontimer/ontrigger handlers in same group as the given // one. We assume that the initiating event/timer/trigger has already been // handled prior to calling this function (tbd: support keeping the initiating // event/timer/trigger?). function ClearHandlers( int Group ) { local int ii; if( Group != 0 ) { // clear matching triggers ii = 0; while( ii < NumTriggerEvents ) { if( TriggerEvents[ ii ].Group == Group ) { ClearTrigger( ii, true ); // this will shift list down } else { ii++; } } for( ii=0; ii<MaxGeneralTimers; ii++ ) { if( Timers[ ii ].Group == Group && Timers[ ii ].OnCmdIndex != -1 ) HandleRemoveTimer( ii, true ); } for( ii=0; ii<NumEvents; ii++ ) { if( Events[ ii ].Group == Group && Events[ ii ].OnCmdIndex != -1 ) { // don't disable the event -- just disconnect the handler Events[ ii ].OnCmdIndex = -1; Events[ ii ].Group = 0; } } } } //----------------------------------------------------------------------------- // A .u2s can specify "onevent xxx gotolabel yyy" so that when event xxx occurs, // the script controller will begin processing commands starting at the line after // the given label yyy. // // A .u2s can also specify "onevent xxx interrupt zzz" so that when event xxx occurs // the script controller will process the commands at label zzz until a return is // reached. Processing will then resume by re-executing the line that was executing // at the time the event occurred, hence the name "interrupt". // // Returns true if event is being handled (active onevent xxx). function bool CheckForOnCmdIndex( int EventIndex ) { local bool bResult; if( Events[EventIndex].OnCmdIndex >= 0 ) { //DMSC( "IndexOnCmdIndex: " $ Events[EventIndex].OnCmdIndex ); HandleOnEvent( Events[EventIndex].OnCmdIndex, Events[EventIndex].bInterrupt ); if( Events[EventIndex].bClear ) { // this was a one-time only event handler -- clear it Events[EventIndex].OnCmdIndex = -1; // disable onevent Events[EventIndex].bClear = false; // and make sure bClear is set back to default } // make sure that any handlers in the same group are disabled ClearHandlers( Events[EventIndex].Group ); bResult = true; } return bResult; } //----------------------------------------------------------------------------- function DoPreEventStuff( U2NPCControllerScriptable NPC, int EventIndex, optional Actor Instigator, optional Actor Other ) { if( (DebugMode & Debug_Events) != 0 ) DMSC( GetCommandFile() $ DefaultExt $ " (EVENT) " $ Events[EventIndex].EventName $ ": EventInstigator=" $ Instigator $ ": EventOther=" $ Other ); // squirrel these away in case script wants to use them SavedEventInstigator = Instigator; SavedEventOther = Other; if( NPC.DebugAIEvents() ) NPC.DMT( Events[EventIndex].EventName $ ": " $ byte(Events[EventIndex].bEnabled && !NPC.bStasis) $ "," $ Events[EventIndex].OnCmdIndex $ " " $ GetScriptContextStr() ); } //----------------------------------------------------------------------------- function DoPostEventStuff( U2NPCControllerScriptable NPC, int EventIndex ) { CheckForOnCmdIndex( EventIndex ); } //----------------------------------------------------------------------------- function eventSCActorInRange( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, ActorInRangeIndex ); DoPostEventStuff( NPC, ActorInRangeIndex ); } //----------------------------------------------------------------------------- function eventSCActorOutOfRange( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, ActorOutOfRangeIndex ); DoPostEventStuff( NPC, ActorOutOfRangeIndex ); } //----------------------------------------------------------------------------- function eventSCAnimEnd( U2NPCControllerScriptable NPC, int Channel ) { // mdf-tbd: don't show AnimEnd events (too much spam) // DoPreEventStuff( NPC, AnimEndIndex ); DoPostEventStuff( NPC, AnimEndIndex ); } //----------------------------------------------------------------------------- function eventSCAutoBegin( U2NPCControllerScriptable NPC, name DestinationState, name DestinationLabel ) { DoPreEventStuff( NPC, AutoBeginIndex ); if( Events[AutoBeginIndex].bEnabled ) NPC.eventAutoBegin( DestinationState, DestinationLabel ); if( Events[AutoBeginIndex].OnCmdIndex >= 0 ) { DoPostEventStuff( NPC, AutoBeginIndex ); } else if( Events[AutoBeginIndex].bEnabled ) { // autobegin isn't disabled and there is no autobegin handler so detach the script controller DetachScriptController(); } } //----------------------------------------------------------------------------- function eventSCAutoEnd( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, AutoEndIndex ); // always enabled, never passed back to NPC DoPostEventStuff( NPC, AutoEndIndex ); } //----------------------------------------------------------------------------- // Not a real event -- generated internally by BumpEnemy/Friend and passed back // to NPC as BumpEnemy/Friend if not filtered. Returns true if event handled. function bool eventSCBumpPlayer( U2NPCControllerScriptable NPC, Pawn Other, bool bFriendly ) { DoPreEventStuff( NPC, BumpPlayerIndex, Other ); if( Events[BumpPlayerIndex].bEnabled ) { if( bFriendly ) NPC.eventBumpFriend( Other ); else NPC.eventBumpEnemy( Other ); } return CheckForOnCmdIndex( BumpPlayerIndex ); } //----------------------------------------------------------------------------- function eventSCBumpEnemy( U2NPCControllerScriptable NPC, Pawn Other ) { if( Other.IsRealPlayer() ) { if( !eventSCBumpPlayer( NPC, Other, false ) ) DoPostEventStuff( NPC, BumpEnemyIndex ); } else { DoPreEventStuff( NPC, BumpEnemyIndex, Other ); if( Events[BumpEnemyIndex].bEnabled || (bXMPHandlingEnabled && StationaryPawn(Other) != None)) NPC.eventBumpEnemy( Other ); DoPostEventStuff( NPC, BumpEnemyIndex ); } } //----------------------------------------------------------------------------- function eventSCBumpFriend( U2NPCControllerScriptable NPC, Pawn Other ) { if( Other.IsRealPlayer() ) { if( !eventSCBumpPlayer( NPC, Other, true ) ) DoPostEventStuff( NPC, BumpEnemyIndex ); } else { DoPreEventStuff( NPC, BumpFriendIndex, Other ); if( Events[BumpFriendIndex].bEnabled ) NPC.eventBumpFriend( Other ); DoPostEventStuff( NPC, BumpFriendIndex ); } } //----------------------------------------------------------------------------- function eventSCBumpOther( U2NPCControllerScriptable NPC, Actor Other ) { DoPreEventStuff( NPC, BumpOtherIndex, Other ); if( Events[BumpOtherIndex].bEnabled ) NPC.eventBumpOther( Other ); DoPostEventStuff( NPC, BumpOtherIndex ); } //----------------------------------------------------------------------------- function eventSCDialogBegin( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, DialogBeginIndex ); DoPostEventStuff( NPC, DialogBeginIndex ); } //----------------------------------------------------------------------------- function eventSCDied( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, DiedIndex ); DoPostEventStuff( NPC, DiedIndex ); } //----------------------------------------------------------------------------- function eventSCEnemyNotVisible( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, EnemyNotVisibleIndex ); if( Events[EnemyNotVisibleIndex].bEnabled ) NPC.eventEnemyNotVisible(); DoPostEventStuff( NPC, EnemyNotVisibleIndex ); } //----------------------------------------------------------------------------- function eventSCHearNoiseFriendly( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { DoPreEventStuff( NPC, HearNoiseFriendlyIndex, NoiseMaker.Instigator, NoiseMaker ); if( Events[HearNoiseFriendlyIndex].bEnabled ) NPC.eventHearNoiseFriendly( Loudness, NoiseMaker ); DoPostEventStuff( NPC, HearNoiseFriendlyIndex ); } //----------------------------------------------------------------------------- function eventSCHearNoiseOther( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { DoPreEventStuff( NPC, HearNoiseOtherIndex, NoiseMaker.Instigator, NoiseMaker ); if( Events[HearNoiseOtherIndex].bEnabled ) NPC.eventHearNoiseOther( Loudness, NoiseMaker ); DoPostEventStuff( NPC, HearNoiseOtherIndex ); } //----------------------------------------------------------------------------- function eventSCHearNoiseThreat( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { DoPreEventStuff( NPC, HearNoiseThreatIndex, NoiseMaker.Instigator, NoiseMaker ); if( Events[HearNoiseThreatIndex].bEnabled || (bXMPHandlingEnabled && StationaryPawn(NoiseMaker) != None) ) NPC.eventHearNoiseThreat( Loudness, NoiseMaker ); DoPostEventStuff( NPC, HearNoiseThreatIndex ); } //----------------------------------------------------------------------------- function eventSCInheritEnemy( U2NPCControllerScriptable NPC, Pawn NewEnemy ) { DoPreEventStuff( NPC, InheritEnemyIndex ); if( Events[InheritEnemyIndex].bEnabled ) NPC.eventInheritEnemy( NewEnemy ); DoPostEventStuff( NPC, InheritEnemyIndex ); } //----------------------------------------------------------------------------- function eventSCScriptedLanding( U2NPCControllerScriptable NPC ) { DoPreEventStuff( NPC, ScriptedLandingIndex ); DoPostEventStuff( NPC, ScriptedLandingIndex ); } //----------------------------------------------------------------------------- // Not a real event -- generated internally by SeeEnemy/Friend and passed back // to NPC as SeeEnemy/Friend if not filtered. Returns true if event handled. function bool eventSCSeePlayer( U2NPCControllerScriptable NPC, Pawn Seen, bool bFriendly ) { DoPreEventStuff( NPC, SeePlayerIndex, Seen ); if( Events[SeePlayerIndex].bEnabled ) { if( bFriendly ) NPC.eventSeeFriend( Seen ); else NPC.eventSeeEnemy( Seen ); } return CheckForOnCmdIndex( SeePlayerIndex ); } //----------------------------------------------------------------------------- function eventSCAlertFriend( U2NPCControllerScriptable NPC, Pawn Seen ) { DoPreEventStuff( NPC, SeeAlertFriendIndex, Seen ); if( Events[SeeAlertFriendIndex].bEnabled ) NPC.eventSeeAlertFriend( Seen ); DoPostEventStuff( NPC, SeeAlertFriendIndex ); } //----------------------------------------------------------------------------- function eventSCSeeEnemy( U2NPCControllerScriptable NPC, Pawn Seen ) { if( Seen.IsRealPlayer() ) { if( !eventSCSeePlayer( NPC, Seen, false ) ) DoPostEventStuff( NPC, SeeEnemyIndex ); } else { DoPreEventStuff( NPC, SeeEnemyIndex, Seen ); if( Events[SeeEnemyIndex].bEnabled || (bXMPHandlingEnabled && StationaryPawn(Seen) != None) ) NPC.eventSeeEnemy( Seen ); DoPostEventStuff( NPC, SeeEnemyIndex ); } } //----------------------------------------------------------------------------- function eventSCSeeFriend( U2NPCControllerScriptable NPC, Pawn Seen ) { if( Seen.IsRealPlayer() ) { if( !eventSCSeePlayer( NPC, Seen, true ) ) DoPostEventStuff( NPC, SeeFriendIndex ); } else { DoPreEventStuff( NPC, SeeFriendIndex, Seen ); if( Events[SeeFriendIndex].bEnabled ) NPC.eventSeeFriend( Seen ); DoPostEventStuff( NPC, SeeFriendIndex ); } } //----------------------------------------------------------------------------- function eventSCSeeOther( U2NPCControllerScriptable NPC, Actor Seen ) { DoPreEventStuff( NPC, SeeOtherIndex, Seen ); if( Events[SeeOtherIndex].bEnabled ) NPC.eventSeeOther( Seen ); DoPostEventStuff( NPC, SeeOtherIndex ); } //----------------------------------------------------------------------------- function eventSCTakeDamage( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { DoPreEventStuff( NPC, TakeDamageIndex, EventInstigator ); if( !NPCOwner.bStasis && Events[TakeDamageIndex].bEnabled ) NPC.eventTakeDamage( Damage, EventInstigator, HitLocation, Momentum, DamageType ); DoPostEventStuff( NPC, TakeDamageIndex ); } //----------------------------------------------------------------------------- function eventSCTookDamage( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { DoPreEventStuff( NPC, TookDamageIndex, EventInstigator ); if( !NPCOwner.bStasis && Events[TookDamageIndex].bEnabled ) NPC.eventTookDamage( Damage, EventInstigator, HitLocation, Momentum, DamageType ); if( NPC.GetAttitudeTo( EventInstigator ) == ATTITUDE_Enemy ) eventSCTookDamageEnemy( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); else if( NPC.GetAttitudeTo( EventInstigator ) == ATTITUDE_Friend ) eventSCTookDamageFriend( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); DoPostEventStuff( NPC, TookDamageIndex ); } //----------------------------------------------------------------------------- function eventSCTookDamageEnemy( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { DoPreEventStuff( NPC, TookDamageEnemyIndex, EventInstigator ); DoPostEventStuff( NPC, TookDamageEnemyIndex ); } //----------------------------------------------------------------------------- function eventSCTookDamageFriend( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { DoPreEventStuff( NPC, TookDamageFriendIndex, EventInstigator ); DoPostEventStuff( NPC, TookDamageFriendIndex ); } //----------------------------------------------------------------------------- function eventSCTrigger( U2NPCControllerScriptable NPC, Actor Other, Pawn Instigator, name EventName ) { local int TriggerIndex; local int SavedOnCmdIndex; local bool SavedbInterrupt; //NPCOwner.DMTNS( "eventSCTrigger -- begin" ); // squirrel these away in case script wants to use them SavedEventInstigator = Instigator; SavedEventOther = Other; if( NPC.DebugAIEvents() ) NPC.DM( "eventSCTrigger -- Other=" $ Other $ " Event=" $ EventName $ " Instigator=" $ Instigator $ " " $ GetScriptContextStr() ); /*tbd: not used anywhere currently if( !NPC.bStasis && Events[TriggerIndex].bEnabled ) NPC.eventTrigger( Other, Instigator ); */ // ontrigger can be used to associate specific events with a gotolabel TriggerIndex = FindTrigger( EventName ); if( TriggerIndex != -1 ) { SavedOnCmdIndex = TriggerEvents[ TriggerIndex ].OnCmdIndex; SavedbInterrupt = TriggerEvents[ TriggerIndex ].bInterrupt; if( TriggerEvents[ TriggerIndex ].bClear ) { // trigger is once only -- remove from table //NPC.DMTNS( "eventSCTrigger -- calling ClearTrigger for event " $ EventName $ " TriggerIndex= " $ TriggerIndex ); ClearTrigger( TriggerIndex, true ); // make sure that any handlers in the same group are disabled // (we assume that triggers in a group can't be set up to repeat for now?) ClearHandlers( TriggerEvents[ TriggerIndex ].Group ); } else { // trigger will repeat -- reset timer if any if( TriggerEvents[ TriggerIndex ].TimerIndex != -1 ) { HandleAddTimer( TriggerEvents[ TriggerIndex ].TimerIndex, Timers[ TriggerEvents[ TriggerIndex ].TimerIndex ].InitialFrequency ); } } // mdf-tbd: doing this before calling ClearTrigger can cause // problems because HandleOnEvent can cause script commands to be // executed and this could result in a cleartriggers command or some // other command which will make the current index invalid. // I think that moving this here should fix things -- this will just // let any "cleaning up" for the trigger be done before allowing // further commands to execute. We just need to be sure to save off // the OnCmdIndex before calling ClearTrigger (since it won't be // available any more after this). HandleOnEvent( SavedOnCmdIndex, SavedbInterrupt ); } //NPCOwner.DMTNS( "eventSCTrigger -- end" ); } //----------------------------------------------------------------------------- function HandleRemoveTimer( int Index, bool bClearTrigger ) { Timers[Index].OnCmdIndex = -1; if( bClearTrigger && Timers[Index].TriggerIndex != -1 ) { // make sure associated trigger is removed too //NPCOwner.DMTNS( "HandleRemoveTimer -- calling ClearTrigger for timer " $ Index ); ClearTrigger( Timers[Index].TriggerIndex, false ); Timers[Index].TriggerIndex = -1; } RemoveTimer( StringToName( "eventSCTimer" $ Index, true ) ); } //----------------------------------------------------------------------------- function HandleAddTimer( int Index, float Frequency ) { local name TimerName; TimerName = StringToName( "eventSCTimer" $ Index, true ); //DMSC( "HandleAddTimer " $ TimerName $ " " $ Index $ " Frequency: " $ Frequency ); // Note: have to remove timer first (or will have multiple timers for the same handler //mdf-tbd: call to remove timers should be redundent if I fix AddTimer/S RemoveTimer( TimerName ); AddTimer( TimerName, Frequency ); } //----------------------------------------------------------------------------- function float HandleTimeRemaining( int Index ) { return TimeRemaining( StringToName( "eventSCTimer" $ Index, true) ); } //----------------------------------------------------------------------------- function HandleTimer( int TimerIndex ) { local int SavedOnCmdIndex; local bool SavedbInterrupt; if( Timers[ TimerIndex ].OnCmdIndex != -1 ) { SavedOnCmdIndex = Timers[ TimerIndex ].OnCmdIndex; SavedbInterrupt = Timers[ TimerIndex ].bInterrupt; // reset timer? if( Timers[ TimerIndex ].RepeatFrequency ~= 0.0 ) { DMSC( "removing timer #" $ TimerIndex ); HandleRemoveTimer( TimerIndex, true ); // make sure that any handlers in the same group are disabled // (we assume that timers in a group can't be set up to repeat for now?) ClearHandlers( Timers[ TimerIndex ].Group ); } else { HandleAddTimer( TimerIndex, Timers[ TimerIndex ].RepeatFrequency ); } HandleOnEvent( SavedOnCmdIndex, SavedbInterrupt ); } else { SetScriptError( "invalid timer handler in HandleTimer: " $ TimerIndex ); } } //----------------------------------------------------------------------------- // global timer handlers (only called when active timers are actually associated with these) function eventSCTimer0() { HandleTimer( 0 ); } function eventSCTimer1() { HandleTimer( 1 ); } function eventSCTimer2() { HandleTimer( 2 ); } function eventSCTimer3() { HandleTimer( 3 ); } function eventSCTimer4() { HandleTimer( 4 ); } function eventSCTimer5() { HandleTimer( 5 ); } function eventSCTimer6() { HandleTimer( 6 ); } function eventSCTimer7() { HandleTimer( 7 ); } function eventSCTimer8() { HandleTimer( 8 ); } function eventSCTimer9() { HandleTimer( 9 ); } //----------------------------------------------------------------------------- // mdf-tbi: do we also need to disable the events in the controlled Pawn to // minimize overhead (e.g. could get spammed with SeeEnemy since engine code // will continue to send these if they aren't disabled). // Current Answer: no -- I don't think this is introducing much overhead at // all. function EnableEvents() { local int Index; for( Index=0; Index<NumEvents; Index++ ) { Events[Index].bEnabled = true; } } //============================================================================= // ERROR HANDLING //============================================================================= function SetScriptError( coerce string Msg ) { if( U2PawnOwner != None && !U2PawnOwner.bDisableErrorMessages ) { // don't spam first error? if( Msg == "" || ScriptErrorMessage == "" ) ScriptErrorMessage = Msg; } } //============================================================================= // STARTUP/CLEANUP //============================================================================= function CleanupScriptController() { //Log( Self $ ": CleanupScriptController" ); RemoveAllTimers(); ClearFoundActors(); GotoActorTarget = None; DialogTarget = None; SavedDestination = None; NPCOwner = None; U2PawnOwner = None; } //----------------------------------------------------------------------------- function ResetScriptController() { Int1 = 0; Int2 = 0; Int3 = 0; Int4 = 0; Int5 = 0; Int6 = 0; Int7 = 0; Int8 = 0; Int9 = 0; Bool1 = false; Bool2 = false; Bool3 = false; Bool4 = false; Bool5 = false; Bool6 = false; Bool7 = false; Bool8 = false; Bool9 = false; CleanupScriptController(); InitEventsIndices(); ExecClearEvents(); ExecClearTimers(); ExecClearTriggers(); ClearPushedCommands(); SavedEventInstigator = None; SavedEventOther = None; WaitTriggerEvent = ''; CurrentHandlerGroup = 0; NextHandlerGroupIndex = 1; bInHandlerGroup = false; // set once Initialized NPCOwner = None; U2PawnOwner = None; CurrentCommandIndex = 0; DecodedCount = 0; SetScriptError( "" ); } //----------------------------------------------------------------------------- function bool IdiotCheckCommandsList() { local int ii; for( ii=0; ii<MaxCommandInfoEntries; ii++ ) { if( CommandInfo[ii].CommandString == "" ) break; if( CommandInfo[ii].CommandCode == CMD_None ) { SetScriptError( "invalid command code at " $ ii ); break; } if( CommandInfo[ii].Signature == "" ) { SetScriptError( "invalid signature at " $ ii ); break; } } if( ScriptErrorMessage == "" ) { ii++; while( ii<MaxCommandInfoEntries) { if( CommandInfo[ii].CommandString != "" ) { SetScriptError( "gap in CommandInfo list prior to " $ ii ); break; } ii++; } } return ( ScriptErrorMessage == "" ); } //----------------------------------------------------------------------------- // Initialize the script controller if this hasn't been done already or if this // is a reload request (e.g. if script file changed externally and the // RefreshScripts command was used). Normally called from BeginState once the // controlled NPC enters the Scripted state. function InitializeScriptController( U2NPCControllerScriptable Owner ) { if( (DebugMode & Debug_Commands) != 0 ) DMSC( "InitializeScriptController U2S=" $ GetCommandFile() ); ResetScriptController(); // set this asap since used in debugging code NPCOwner = Owner; U2PawnOwner = U2Pawn(NPCOwner.Pawn); //Log( Self $ " InitializeScriptController NPCOwner: " $ NPCOwner $ " U2PawnOwner: " $ U2PawnOwner ); if( IdiotCheckCommandsList() ) { //mdf-tbr: debug //DMSC( "Initialize -- Outer is: " $ Outer ); //NPCOwner.ConsoleCommand( "trace class=" $ Class ); //ConsoleCommand( "trace funcs" ); //ConsoleCommand( "trace gotos" ); if( LoadCommands() ) { if( InitCommands() ) { GotoState( ExecuteCommandsState ); } } } if( ScriptErrorMessage != "" ) ScriptError(); } //----------------------------------------------------------------------------- function MakeECErrorObvious() { if( ScriptErrorMessage == MsgScriptInitError || ScriptErrorMessage == MsgScriptLoadError ) U2PawnOwner.MakeErrorObvious( ET_ScriptLoad ); else U2PawnOwner.MakeErrorObvious( ET_ScriptRun ); } //----------------------------------------------------------------------------- function ShowWarning( string Msg, int CommandIndex ) { local string CommandStr; NPCOwner.DMT( "U2SWARNING> " $ CommandFileName $ DefaultExt $ ": " $ Msg ); if( CommandIndex >= 0 && CommandIndex < Commands.Length ) { CommandStr = GetCommandStringFromIndex( CommandIndex ); if( CommandStr != "" ) NPCOwner.DMT( "U2SWARNING> " $ " Command: " $ CommandStr ); } } //----------------------------------------------------------------------------- function HandleScriptError() { NPCOwner.DMT( " " ); ShowWarning( ScriptErrorMessage, CurrentCommandIndex ); NPCOwner.DMT( "U2SWARNING> " $ "Pawn: " $ U2PawnOwner.Name $ " script controller: " $ Name ); NPCOwner.DMT( "U2SWARNING> " $ "AIController: " $ NPCOwner.Name $ " State: " $ NPCOwner.GetStateName() $ "CurrentCommandIndex: " $ CurrentCommandIndex ); NPCOwner.DMT( " " ); MakeECErrorObvious(); } //----------------------------------------------------------------------------- function ScriptError() { HandleScriptError(); GotoState( BroadcastErrorState ); } //----------------------------------------------------------------------------- // Look for the given label in the script commands and return its index. function int GetLabelIndex( string LabelName ) { local string CommandString; local int CommandsListIndex; local int CommandIndex; local string Label; local int Index; local int ReturnedIndex; local CommandT LocalCommand; ReturnedIndex = -1; // start at given label -- have to scan for it in the commands list (we don't know the command index) for( Index=0; Index<Commands.Length; Index++ ) { LocalCommand = Commands[ Index ]; CommandString = LocalCommand.CommandString; CommandsListIndex = LocalCommand.CommandIndex; if( CommandsListIndex == CommandsListIndex_Error ) { SetScriptError( MsgInvalidCommandListIndex ); } else if( CommandsListIndex == CommandsListIndex_Label ) { if( Left( CommandString, 1 ) != ":" ) { SetScriptError( "Error parsing label out of " $ CommandString ); } else { CommandString = Mid( CommandString, 1 ); if( class'Util'.static.ParseString( CommandString, Label ) != 1 ) { SetScriptError( "Error parsing label out of " $ CommandString ); break; } else { if( Label ~= LabelName ) { ReturnedIndex = Index; break; } } } } } return ReturnedIndex; } /*----------------------------------------------------------------------------- Reset commands so that the current command is the first one in the list or the one at the specified start label. mdf-tbd: add code to validate gotoactor targets (unless flagged -- add to signature) to make sure these exist (and, tbd, can be pathed to from the start location (unless flagged). This would help detect a lot of pathing issues on startup instead of later in the game. We pbly wouldn't want to do this for scripts which are loaded after the level starts up though so as to not slow things down. What about doing some kind of pathing test on startup? */ function bool InitCommands() { DMSC( "InitCommands -- begin -- StartLabelName=" $ StartLabelName ); DecodedCount = 0; CurrentCommandIndex = 0; if( StartLabelName != "" ) { // script was given a label to start at if( StartLabelName ~= "begin" ) { // support implicit begin label at start of .u2s for StartLabel CurrentCommandIndex = 0; } else { // look for the given label CurrentCommandIndex = GetLabelIndex( StartLabelName ); if( CurrentCommandIndex == -1 ) { SetScriptError( "Error setting start label '" $ StartLabelName $ "'" ); } } } EnableEvents(); //DMSC( "InitCommands -- end" ); return ( ScriptErrorMessage == "" ); } //----------------------------------------------------------------------------- function DumpCommands( coerce string strHeading ) { local int CommandIndex; local CommandT LocalCommand; local string strDump; DMSC( " ", true ); DMSC( " " $ strHeading, true ); for( CommandIndex=0; CommandIndex<Commands.Length; CommandIndex++ ) { LocalCommand = Commands[ CommandIndex ]; strDump = " " $ class'Util'.static.PadString(CommandIndex,3,true,"0"); if( LocalCommand.CommandIndex >= 0 ) strDump = strDump $ " " $ class'Util'.static.PadString(LocalCommand.CommandIndex,3,true,"0"); else strDump = strDump $ " " $ class'Util'.static.PadString(LocalCommand.CommandIndex,3,true); if( LocalCommand.CommandString != "" ) strDump = strDump $ " " $ LocalCommand.CommandString; if( LocalCommand.CommandTarget != None ) strDump = strDump $ " -> " $ LocalCommand.CommandTarget; DMSC( strDump, true ); } } //----------------------------------------------------------------------------- function bool LoadCommands() { local bool bSuccess; bSuccess = LoadCommandsFromFile( CommandFileName, NPCOwner.Level ); if( (DebugMode & Debug_Commands) != 0 ) { DMSC( " ", true ); DMSC( "----------------------------------------", true ); DMSC( CommandFileName $ DefaultExt $ " #Commands: " $ Commands.Length, true ); } // -1 is an error, 0 commands (empty file) is not (so you can disable a script by commenting it out) if( Commands.Length >= 1 ) { if( (DebugMode & Debug_Commands) != 0 ) DumpCommands( "Source commands:" ); // mdf-tbd: // Set all bEnable flags to true (once next cmd executed?) // i.e. reinit everything? // parse all commands without executing them to test for missing or invalid arguments? for( CurrentCommandIndex = 0; CurrentCommandIndex < Commands.Length; CurrentCommandIndex++ ) { if( CompileCommand( CurrentCommandIndex ) ) DecodeCommand( true, false ); if( ScriptErrorMessage != "" ) { // log all warnings at once (first one will appear again at the end) ShowWarning( ScriptErrorMessage, CurrentCommandIndex ); bSuccess = false; } } if( (DebugMode & Debug_Commands) != 0 ) DumpCommands( "Compiled commands:" ); } if( (DebugMode & Debug_Commands) != 0 ) { DMSC( "----------------------------------------", true ); DMSC( " ", true ); } if( !bSuccess ) { SetScriptError( MsgScriptLoadError ); } return ( ScriptErrorMessage == "" ); } //----------------------------------------------------------------------------- function string GetCommandFile() { return CommandFileName; } //----------------------------------------------------------------------------- function SetCommandFile( string NewCommandFileName ) { CommandFileName = NewCommandFileName; } //----------------------------------------------------------------------------- function SetStartLabel( string NewStartLabelName ) { StartLabelName = NewStartLabelName; } //----------------------------------------------------------------------------- function DetachScriptController() { // immediately restore default controller in owner if( NPCOwner != None ) NPCOwner.DetachScriptController(); } //============================================================================= // UTILITY //============================================================================= function Pawn FindPlayer() { local Pawn P; // Scan PawnList instead of ControllerList in case player not possessed // currently (e.g. during matinee). for( P=NPCOwner.Level.PawnList; P!=None; P=P.NextPawn ) if( P.bIsRealPlayer ) return P; return None; } //----------------------------------------------------------------------------- function Object FindTarget( name TargetName, optional bool bOptional ) { local Object ReturnedObject; if( TargetName == TargetFoundName ) ReturnedObject = GetFoundActor(); else if( TargetName == TargetSelfName ) ReturnedObject = Self; else if( TargetName == TargetControllerName ) ReturnedObject = NPCOwner; else if( TargetName == TargetEventInstigatorName ) ReturnedObject = SavedEventInstigator; else if( TargetName == TargetEventOtherName ) ReturnedObject = SavedEventOther; else if( TargetName == TargetPawnName ) ReturnedObject = U2PawnOwner; else if( TargetName == TargetPlayerName ) ReturnedObject = FindPlayer(); else ReturnedObject = class'UtilGame'.static.GetNamedActor( NPCOwner, TargetName ); if( ReturnedObject == None && !bOptional ) SetScriptError( "FindTarget -- Can't find " $ TargetName ); return ReturnedObject; } //----------------------------------------------------------------------------- // Return true if the target name represents a "special" target that can't be // determined at load time. function bool RunTimeTarget( name TargetName ) { return ( TargetName == TargetEventInstigatorName || TargetName == TargetEventOtherName || TargetName == TargetFoundName ); } //----------------------------------------------------------------------------- function bool UpdateTarget( name TargetName ) { local bool bResult; // find and store target bResult = false; if( CurrentCommand.CommandTarget == None ) { CurrentCommand.CommandTarget = FindTarget( TargetName ); bResult = (CurrentCommand.CommandTarget != None); } return bResult; } //----------------------------------------------------------------------------- function Actor.ESoundSlot FindSoundSlot( name SlotName ) { local Actor.ESoundSlot Slot; switch( SlotName ) { case '': Slot = SLOT_Misc; break; case 'SLOT_Misc': Slot = SLOT_Misc; break; case 'SLOT_Pain': Slot = SLOT_Pain; break; case 'SLOT_Interact': Slot = SLOT_Interact; break; case 'SLOT_Ambient': Slot = SLOT_Ambient; break; case 'SLOT_Talk': Slot = SLOT_Talk; break; case 'SLOT_Interface': Slot = SLOT_Interface; break; case 'SLOT_Dialog': Slot = SLOT_Dialog; break; default: SetScriptError( "Invalid slot " $ SlotName ); Slot = SLOT_Misc; break; } //U2PawnOwner.DM("FindSoundSlot -- " @ SlotName @ "result:" @ Slot ); return Slot; } //============================================================================= // "PARSING" //============================================================================= function RegisterDecodeError( string Error ) { SetScriptError( "Warning -- invalid command #" $ class'Util'.static.PadString(CurrentCommandIndex,3,true,"0") $ " (" $ Error $ ")" ); } //----------------------------------------------------------------------------- // Use the current command's signature to determine what kind of arguments // should be present (if any) and shove these into the ArgsXXX arrays for use // when the commands are actually executed. // // Note: T/t args are really names and are stored in ArgsName along with other // names. // // Note: unused ArgsXXX entries aren't cleared. Optional args will be set to // the defaults given below if no argument was supplied. function ParseArgs( bool bStartup ) { local int ArgType; local int Res; // variables for holding results after parsing a single command local string CurrentCommandString; local string Signature; local bool bOptionalFound; local int ByteArgs; local int FloatArgs; local int IntArgs; local int NameArgs; local int StringArgs; local int LabelArgs; local bool bReachedLabel; local ECommandCode CommandCode; local int ii; //DMSC( "ParseArgs -- begin" ); CurrentCommandString = CurrentCommand.CommandString; Signature = CommandInfo[ CurrentCommand.CommandIndex ].Signature; bOptionalFound = false; ByteArgs = 0; FloatArgs = 0; IntArgs = 0; NameArgs = 0; StringArgs = 0; LabelArgs = 0; if( Signature == Sig_XXX ) goto Continue1; while( Signature != "" ) { // DMSC( "CurrentCommandString:" $ CurrentCommandString ); ArgType = Asc( Left( Signature, 1 ) ); // uppercase = obligatory, lowercase = optional if( ArgType <= TUpperAscii ) { // if an optional argument was already processed, all following args have to be optional if( bOptionalFound ) goto SignatureError; switch( ArgType ) { case BUpperAscii: Res = class'Util'.static.ParseBool( CurrentCommandString, ArgsByte[ByteArgs] ); ByteArgs++; break; case FUpperAscii: Res = class'Util'.static.ParseFloat( CurrentCommandString, ArgsFloat[FloatArgs] ); FloatArgs++; break; case IUpperAscii: Res = class'Util'.static.ParseInt( CurrentCommandString, ArgsInt[IntArgs] ); IntArgs++; break; case MUpperAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs], true ); NameArgs++; break; case NUpperAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs] ); NameArgs++; break; case SUpperAscii: Res = class'Util'.static.ParseString( CurrentCommandString, ArgsString[StringArgs] ); StringArgs++; break; case TUpperAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs] ); if( bStartup ) { // compiling commands -- store target if( CurrentCommand.CommandTarget != None ) goto SignatureError; // signature contains multiple targets! if( !RunTimeTarget( ArgsName[NameArgs] ) ) { if( !UpdateTarget( ArgsName[NameArgs] ) ) goto TargetFindError; // can't find target } } else { if( CurrentCommand.CommandTarget == None ) CurrentCommand.CommandTarget = FindTarget( ArgsName[NameArgs] ); // executing commands -- target must be set at this point if( CurrentCommand.CommandTarget == None ) goto TargetVerifyError; // target not set! } NameArgs++; break; default: goto SignatureError; } if( Res != 1 ) goto ParseError; } else { bOptionalFound = true; if( !bReachedLabel ) { // check for reaching a label (indicated by a #) class'Util'.static.StripSpaces( CurrentCommandString, true, false ); if( Left( CurrentCommandString, 1 ) == "#" ) bReachedLabel = true; // finish with signature so missing args cleared } if( bReachedLabel ) { // just set defaults for rest of args (which must be missing since a label was reached) switch( ArgType ) { case bLowerAscii: ArgsByte[ByteArgs++] = 0; break; case fLowerAscii: ArgsFloat[FloatArgs++] = 0.0; break; case iLowerAscii: ArgsInt[IntArgs++] = 0; break; case mLowerAscii: case nLowerAscii: case tLowerAscii: ArgsName[NameArgs++] = ''; break; case sLowerAscii: ArgsString[StringArgs++] = ""; break; default: goto SignatureError; } } else { Res = 1; switch( ArgType ) { case bLowerAscii: Res = class'Util'.static.ParseBool( CurrentCommandString, ArgsByte[ByteArgs], 0 ); ByteArgs++; break; case fLowerAscii: Res = class'Util'.static.ParseFloat( CurrentCommandString, ArgsFloat[FloatArgs], 0.0 ); FloatArgs++; break; case iLowerAscii: Res = class'Util'.static.ParseInt( CurrentCommandString, ArgsInt[IntArgs], 0 ); IntArgs++; break; case mLowerAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs], true, '' ); NameArgs++; break; case nLowerAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs], false, '' ); NameArgs++; break; case sLowerAscii: Res = class'Util'.static.ParseString( CurrentCommandString, ArgsString[StringArgs], "" ); StringArgs++; break; case tLowerAscii: Res = class'Util'.static.ParseName( CurrentCommandString, ArgsName[NameArgs], false, '' ); if( ArgsName[NameArgs] != '' ) { if( bStartup ) { // compiling commands -- store target if( CurrentCommand.CommandTarget != None ) goto SignatureError; // signature contains multiple targets! if( !RunTimeTarget( ArgsName[NameArgs] ) ) { if( !UpdateTarget( ArgsName[NameArgs] ) ) goto TargetFindError; // can't find target } } else { if( CurrentCommand.CommandTarget == None ) CurrentCommand.CommandTarget = FindTarget( ArgsName[NameArgs] ); // executing commands -- target must be set at this point if( CurrentCommand.CommandTarget == None ) goto TargetVerifyError; // target not set! } } NameArgs++; break; default: goto SignatureError; } if( Res == -1 ) goto ParseError; } } // throw away current first character Signature = Mid(Signature, 1 ); } // mdf-tbd: idiot checks in anticipation of pre-compiling some args? if( bStartup ) { if( ByteArgs >= MaxArgsByte || FloatArgs >= MaxArgsFloat || IntArgs >= MaxArgsInt || NameArgs >= MaxArgsName || StringArgs >= MaxArgsString || LabelArgs >= MaxArgsLabel ) { goto SignatureError; } // bit of a hack to check for invalid gotolabels in onevent/ontimer/ontrigger CommandCode = CommandInfo[ CurrentCommand.CommandIndex ].CommandCode; if( CommandCode == CMD_OnEvent ) { if( ArgsString[0] != "" && ( ArgsString[0] != TextGotoLabel && ArgsString[0] != TextInterrupt )) goto MsgGotoLabelInterruptError; } else if( CommandCode == CMD_OnTimer ) { if( ArgsString[0] != "" && ( ArgsString[0] != TextGotoLabel && ArgsString[0] != TextInterrupt )) goto MsgGotoLabelInterruptError; } else if( CommandCode == CMD_OnTrigger ) { if( (ArgsString[0] != "" && ( ArgsString[0] != TextGotoLabel && ArgsString[0] != TextInterrupt )) || (ArgsString[2] != "" && ( ArgsString[2] != TextGotoLabel && ArgsString[2] != TextInterrupt )) ) goto MsgGotoLabelInterruptError; } else if( CommandCode == CMD_EventEnable || CommandCode == CMD_EventDisable ) { if( FindEvent( ArgsName[ 0 ] ) == -1 ) goto MsgInvalidEventName; } } goto Continue1; MsgGotoLabelInterruptError: RegisterDecodeError( MsgGotoLabelInterruptError ); return; MsgInvalidEventName: RegisterDecodeError( MsgInvalidEventName ); return; SignatureError: RegisterDecodeError( MsgInternalErrorSignature ); return; TargetFindError: RegisterDecodeError( MsgTargetFindError ); return; TargetVerifyError: RegisterDecodeError( MsgTargetVerifyError ); return; ParseError: RegisterDecodeError( MsgBadOrMissingArgument ); return; Continue1: if( bStartup ) { // update the command in case any targets were set above Commands[ CurrentCommandIndex ] = CurrentCommand; } class'Util'.static.StripSpaces( CurrentCommandString, true, false ); // clear LabelArgs here since gotolabel is often optional for( ii=0; ii<MaxArgsLabel; ii++ ) ArgsLabel[ ii ] = 0; // extract any labels while( Left( CurrentCommandString, 1 ) == "#" ) { // hit label indieces patched in during pre-processing // skip # CurrentCommandString = Mid( CurrentCommandString, 1 ); if( class'Util'.static.ParseInt( CurrentCommandString, ArgsLabel[LabelArgs] ) != 1 ) goto LabelError; // DMSC( "Added label index #" $ LabelArgs $ ": " $ ArgsLabel[LabelArgs] ); LabelArgs++; class'Util'.static.StripSpaces( CurrentCommandString, true, false ); } goto Continue2; LabelError: RegisterDecodeError( MsgBadOrMissingLabel ); return; Continue2: // make sure nothing remains if( class'Util'.static.ParseString( CurrentCommandString, Signature ) != 0 ) RegisterDecodeError( MsgInvalidArgumentExtra ); //DMSC( "ParseArgs -- end" ); } //----------------------------------------------------------------------------- // Find the index into the CommandInfo list which corresponds to the given command. // At startup, the entire list of commands in the current script file is // "compiled" and these indices are inserted at the front of all script commands // for faster in-game decoding and to have access to the "signature" for the // command -- the arguments (possibly optional) that the command takes. function int DetermineCommandsListIndex( string CommandString ) { local int Index; Index = 1; while( (Index < MaxCommandInfoEntries) && !(CommandInfo[Index].CommandString == CommandString) ) Index++; if( Index >= MaxCommandInfoEntries ) Index = CommandsListIndex_Error; // DMSC( "DetermineCommandsListIndex -- Index for " $ CommandString $ " is " $ Index ); return Index; } //----------------------------------------------------------------------------- // "Compile" the command at the given index. Extracts the command name and // converts this into an index into the CommandInfo list for fast lookups. This // is saved into the native commands list along with the shortened command // string (i.e. sans the command which was extracted). function bool CompileCommand( int CommandIndex ) { local int CommandListIndex; local string CommandListString; local string CommandStr; local CommandT LocalCommand; // parse out command CommandListIndex = CommandsListIndex_Error; LocalCommand = Commands[ CommandIndex ]; CommandListString = LocalCommand.CommandString; // extract the command string if( class'Util'.static.ParseString( CommandListString, CommandStr ) == 1 ) { // determine the command index for the command if( Left(CommandStr,1) == ":" ) { // label CommandListIndex = CommandsListIndex_Label; } else { // other CommandListIndex = DetermineCommandsListIndex( CommandStr ); if( CommandListIndex != CommandsListIndex_Error ) { // replace CommandString with what is left after parsing out command LocalCommand.CommandString = CommandListString; } else { //!!mdf-tbd: why are invalid command no longer generating a proper warning NPCOwner.DM( "#1: " $ LocalCommand.CommandString ); } } LocalCommand.CommandIndex = CommandListIndex; // write out the changes Commands[ CommandIndex ] = LocalCommand; } if( CommandListIndex == CommandsListIndex_Error ) { SetScriptError( MsgInvalidCommand ); } return( CommandListIndex != CommandsListIndex_Error ); } //----------------------------------------------------------------------------- function string GetCommandStringFromIndex( int CommandIndex ) { local int CommandListIndex; local string Msg; local CommandT LocalCommand; LocalCommand = Commands[ CommandIndex ]; CommandListIndex = LocalCommand.CommandIndex; if( CommandListIndex > 0 && CommandListIndex < MaxCommandInfoEntries ) { if( LocalCommand.CommandString == "" ) Msg = CommandInfo[CommandListIndex].CommandString; else Msg = CommandInfo[CommandListIndex].CommandString $ " " $ LocalCommand.CommandString; } return Msg; } //----------------------------------------------------------------------------- function ShowProgress() { //if( NPCOwner != None ) // NPCOwner.BM( "SC: " $ GetCommandFile() $ DefaultExt $ " - Command #" $ class'Util'.static.PadString(CurrentCommandIndex,3,true,"0") $ " (" $ DecodedCount $ "): " $ GetCommandStringFromIndex(CurrentCommandIndex) $ " " $ GetScriptContextStr(false), true ); DMSC( GetCommandFile() $ DefaultExt $ " " $ GetCommandStringFromIndex(CurrentCommandIndex), true ); } //----------------------------------------------------------------------------- // Decode the next command without actually executing it (sets up execution). // Sets ScriptErrorMessage and returns false if an error occurs. function bool DecodeCommand( bool bStartup, bool bShowProgress ) { //Log( "DecodeCommand -- begin CurrentCommandIndex: " $ CurrentCommandIndex ); SetScriptError( "" ); if( CurrentCommandIndex >= 0 && CurrentCommandIndex < Commands.Length ) { DecodedCount++; CurrentCommand = Commands[ CurrentCommandIndex ]; // mdf-tbr: (dev debug) if( bShowProgress && (DebugMode & Debug_Commands) != 0 ) ShowProgress(); if( CurrentCommand.CommandIndex >= 0 && CurrentCommand.CommandIndex < MaxCommandInfoEntries ) { //DMSC( "calling ParseArgs" ); ParseArgs( bStartup ); } else if( CurrentCommand.CommandIndex != CommandsListIndex_Label ) { SetScriptError( "invalid command: '" $ CurrentCommand.CommandString $ "'" ); } } else if( CurrentCommandIndex >= Commands.Length ) { // mdf-tbd: when end of script reached, treat like a halt was reached? CurrentCommand.CommandIndex = CommandsListIndex_Stop; } else { SetScriptError( "DecodeCommand -- CurrentCommandIndex isn't in 0.." $ Commands.Length-1 $ " (" $ CurrentCommandIndex $ ")" ); } //!!!Log( "DecodeCommand -- end" ); return( ScriptErrorMessage == "" ); } //----------------------------------------------------------------------------- function SetCurrentCommandIndex( int DestinationIndex ) { if( (DebugMode & Debug_Jumps) != 0 ) DMSC( GetCommandFile() $ DefaultExt $ " (JUMP) " $ CurrentCommandIndex $ " --> " $ DestinationIndex $ " (" $ Commands[ DestinationIndex ].CommandString $ ")", true ); CurrentCommandIndex = DestinationIndex; } //----------------------------------------------------------------------------- // NOTE: push the next command which will be executed when the script returns function DoCall( int DestinationIndex ) { PushCommandIndex( CurrentCommandIndex ); SetCurrentCommandIndex( DestinationIndex ); } //----------------------------------------------------------------------------- function DoGoto( int DestinationIndex ) { SetCurrentCommandIndex( DestinationIndex ); } //----------------------------------------------------------------------------- // NOTE: push the current command which will be re-executed when the script returns function DoInterrupt( int DestinationIndex ) { PushCommandIndex( CurrentCommandIndex - 1); SetCurrentCommandIndex( DestinationIndex ); } //============================================================================= // "EXECUTION" //============================================================================= function ClearFoundActors() { local int ii; for( ii=0; ii<UtilGame.MaxFilteredActors; ii++ ) FoundActors[ ii ] = None; NumFoundActors = 0; } //----------------------------------------------------------------------------- function Actor GetFoundActor() { local int SelectionIndex; if( NumFoundActors >= 2 ) { // select one of the found actors randomly and make it the only selection SelectionIndex = Rand( NumFoundActors ); FoundActors[ 0 ] = FoundActors[ SelectionIndex ]; NumFoundActors = 1; } if( NumFoundActors == 1 ) return FoundActors[ 0 ]; else return None; } //----------------------------------------------------------------------------- // NOTE: CommandTarget is set at load time if possible, otherwise it is set as // the command is executed (e.g. if the target is 'found'. Either way, the // target should be set at this point. function bool ProcessExecGotoActor( Actor TargetActor ) { //!!!Log( "ProcessExecGotoActor: " $ TargetActor $ " - begin" ); GotoActorTarget = None; if( TargetActor != None ) { NPCOwner.SetSpecialGoal( TargetActor, ArgsFloat[0], (ArgsByte[0] == 1) ); GotoActorTarget = TargetActor; //!!!Log( " going to WaitDestinationReached state" ); GotoState( WaitDestinationReachedState ); //!!!Log( "ProcessExecGotoActor: " $ TargetActor $ " - end #1" ); return true; } //!!!Log( "ProcessExecGotoActor: " $ TargetActor $ " - end #2" ); return false; } //----------------------------------------------------------------------------- function ClearPushedCommands() { local int i; for( i=0; i<MaxPushedCommandIndices; i++ ) PushedCommandIndices[i] = -1; NumPushedCommandIndices = 0; } //----------------------------------------------------------------------------- function PushCommandIndex( int CommandIndex ) { if( NumPushedCommandIndices < MaxPushedCommandIndices ) PushedCommandIndices[NumPushedCommandIndices++] = CommandIndex; else SetScriptError( "PushCommandIndex -- maximum call depth exceeded" ); } //----------------------------------------------------------------------------- function int PopCommandIndex() { local int ReturnedIndex; if( NumPushedCommandIndices >= 1 ) ReturnedIndex = PushedCommandIndices[--NumPushedCommandIndices]; else SetScriptError( "PopCommandIndex -- mismatched return" ); return ReturnedIndex; } //----------------------------------------------------------------------------- function ExecAddAmmo() { if( !class'U2Weapon'.static.AddAmmo( U2PawnOwner, ArgsString[0], ArgsInt[0], (ArgsByte[0] != 0) ) ) { SetScriptError( "Couldn't add ammo " $ ArgsString[0] $ " to NPC" ); } } //----------------------------------------------------------------------------- function ExecAgentBind() { if (U2PawnOwner != None) { U2PawnOwner.MeshAgentSetInputCurValue(ArgsName[0], ArgsName[1]); U2PawnOwner.MeshAgentSetInputLock(ArgsName[0], true); // script is shutting down the default animation behavior of the agent // turn off damage momentum and knockdowns if( ArgsName[0] == SpecialStateAgentInput ) NPCOwner.AgentSpecialStateBegin(); } } //----------------------------------------------------------------------------- function bool ExecAgentCall() { local float Duration; if (U2PawnOwner == None) return false; Duration = U2PawnOwner.MeshAgentCallAction(ArgsName[0]); if (ArgsByte[0] != 0) { if (Duration > 0.0) { ArgsFloat[0] = Duration; } else { SetScriptError( "Unable to wait on agent action " $ ArgsName[0] ); ArgsFloat[0] = 1.0; // just to prevent runaway loops when a wait is expected } class'DialogEngine'.static.SetActorReadyTime( U2PawnOwner, NPCOwner.Level.TimeSeconds + ArgsFloat[0] ); GotoState( SleepingState ); return true; } else return false; } //----------------------------------------------------------------------------- function bool ExecAgentExecute() { local float Duration; if (U2PawnOwner == None) return false; Duration = U2PawnOwner.MeshAgentImmediateAction(ArgsString[0]); if (ArgsByte[0] != 0) { if (Duration > 0.0) { ArgsFloat[0] = Duration; } else { SetScriptError( "Unable to wait on agent execute " $ ArgsString[0] ); ArgsFloat[0] = 1.0; // just to prevent runaway loops when a wait is expected } class'DialogEngine'.static.SetActorReadyTime( U2PawnOwner, NPCOwner.Level.TimeSeconds + ArgsFloat[0] ); GotoState( SleepingState ); return true; } else return false; } //----------------------------------------------------------------------------- function ExecAgentUnbind() { if (U2PawnOwner != None) { U2PawnOwner.MeshAgentSetInputLock(ArgsName[0], false); // restore npc back to original behavior now that the agent is unlocked if( ArgsName[0] == SpecialStateAgentInput ) NPCOwner.AgentSpecialStateEnd(); } } //----------------------------------------------------------------------------- function bool ExecAnim( ECommandCode ECType, int Channel ) { local bool bRetVal; local bool bResult; if( ECType == CMD_AnimLoopEx ) ECType = CMD_AnimLoop; else if( ECType == CMD_AnimPlayEx ) ECType = CMD_AnimPlay; else if( ECType == CMD_AnimTweenEx ) ECType = CMD_AnimTween; if( Channel == 0 ) { // cdh: leave channel zero to use existing controller behavior if( ECType == CMD_AnimLoop ) { bResult = NPCOwner.LPawn.LookupLoopAnim( ArgsName[0], ArgsFloat[0], ArgsFloat[1], 2 ); // tbd: now what -- how long should anim loop for etc. } else if( ECType == CMD_AnimPlay ) { bResult = NPCOwner.LPawn.LookupPlayAnim( ArgsName[0], ArgsFloat[0], ArgsFloat[1], 0 ); } else if( ECType == CMD_AnimTween ) { bResult = NPCOwner.LPawn.LookupTweenAnim( ArgsName[0], ArgsFloat[0], 0 ); } } else { // cdh: auxiliary channels are only used for effects right now, and the controller code // is not really set up to handle multiple animations yet anyway, so just bypass all // of that and call the animation functions directly if( ECType == CMD_AnimLoop ) { NPCOwner.LPawn.LoopAnim( ArgsName[0], ArgsFloat[0], ArgsFloat[1], Channel ); // tbd: now what -- how long should anim loop for etc. } else if( ECType == CMD_AnimPlay ) { NPCOwner.LPawn.PlayAnim( ArgsName[0], ArgsFloat[0], ArgsFloat[1], Channel ); } else if( ECType == CMD_AnimTween ) { NPCOwner.LPawn.TweenAnim( ArgsName[0], ArgsFloat[0], Channel ); } bResult = (NPCOwner.LPawn.GetAnimFrames(ArgsName[0]) > 0); } // tbd: check return value -- false means anim not found so don't ever wait? if( !bResult ) { SetScriptError( "animloop/play/tween -- invalid animation: " $ ArgsName[0] ); } else { NPCOwner.SetScriptedIdleAnims( true ); } if( ArgsByte[0] == 1 ) { bRetVal = true; GotoState( WaitAnimEndState ); } return bRetVal; } //----------------------------------------------------------------------------- function ExecAnimRelease() { NPCOwner.SetScriptedIdleAnims( false ); } //----------------------------------------------------------------------------- function ExecCall() { DoCall( ArgsLabel[0] ); } //----------------------------------------------------------------------------- function ExecCallScript() { // mdf-tbi: /* to do this in the current controller, we need to save all kinds of stuff: current command line any pushed commands trigger settings event settings but, if this simply causes a new script controller to be spawned and set up with a reference to this script controller so it can return to this, we don't have to worry about any of this +spawn new script controller +set its file name to ArgsString[0] and label to ArgsLabel[0] +initialize it? +set its ParentScriptController to Self +switch over to it +hmm, does it inherit anything from this state (and on returning make sure these are updated in the caller?) Yes?: event states (enabled/disabled) DebugMode No?: event handlers (can't -- these refer to labels in the calling script) trigger handlers (can't -- these refer to labels in the calling script) scratch variables (called script shouldn't know/care how these were used) pushed calls current command index ArgsXXX DecodedCount Commands.Length GotoActorTarget WaitTriggerEvent */ } //----------------------------------------------------------------------------- function ExecCallEnd() { ClearPushedCommands(); } //------------------------------------------------------------------------- function ExecClearEvents() { local int Index; for( Index=0; Index<NumEvents; Index++ ) { Events[Index].OnCmdIndex = -1; } } //------------------------------------------------------------------------- function ExecClearTimers() { local int Index; // NPCOwner.DMTNS( "ExecClearTimers" ); for( Index=0; Index<MaxGeneralTimers; Index++ ) HandleRemoveTimer( Index, false ); } //------------------------------------------------------------------------- function ExecClearTriggers() { local int Index; //NPCOwner.DMTNS( "ExecClearTriggers" ); for( Index=0; Index<NumTriggerEvents; Index++ ) { TriggerEvents[Index].EventName = ''; TriggerEvents[Index].OnCmdIndex = -1; } for( Index=MaxGeneralTimers; Index<MaxTimers; Index++ ) HandleRemoveTimer( Index, false ); NumTriggerEvents = 0; } //------------------------------------------------------------------------- function ExecConsoleCommand() { local bool bCheatsEnabledOld; if( NPCOwner.Level.PlayerControllerList != None ) { bCheatsEnabledOld = NPCOwner.Level.PlayerControllerList.bCheatsEnabled; NPCOwner.Level.PlayerControllerList.ConsoleCommand( ArgsString[0] ); NPCOwner.Level.PlayerControllerList.bCheatsEnabled = bCheatsEnabledOld; } // use Actor ConsoleCommand? Doesn't work? //U2PawnOwner.ConsoleCommand( ArgsString[0] ); } //------------------------------------------------------------------------- function ExecDebugAI() { NPCOwner.SetDebugAI( ArgsByte[0] != 0 ); } //------------------------------------------------------------------------- function ExecDebugAIEvents() { NPCOwner.SetDebugAIEvents( ArgsByte[0] != 0 ); } //------------------------------------------------------------------------- function ExecDebugAIFlags() { NPCOwner.SetDebugAIFlags( ArgsInt[0] ); } //------------------------------------------------------------------------- function ExecDebugMode() { DebugMode = ArgsInt[0]; } //------------------------------------------------------------------------- function ExecDecProperty() { local int Val; local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanSetProperty( ArgsString[0] ) ) { Val = int(O.GetPropertyText( ArgsString[0] )); if( ArgsInt[0] == 0 ) O.SetPropertyText( ArgsString[0], string(Val-1) ); else O.SetPropertyText( ArgsString[0], string(Val-ArgsInt[0]) ); } else { SetScriptError( "can't set property " $ ArgsString[0] $ " in " $ O ); } } else { SetScriptError( "can't find target for command" ); } } //----------------------------------------------------------------------------- function ExecDeployInventory() { local U2XMPItem DI; DI = U2XMPItem(class'UtilGame'.static.GiveInventoryString( U2PawnOwner, ArgsString[0] )); if( DI != None ) { if( ArgsByte[ 0 ] == 0 ) { U2PawnOwner.Controller.bFire = 1; DI.Fire(); } else { U2PawnOwner.Controller.bAltFire = 1; DI.AltFire(); } } else { SetScriptError( "Couldn't deploy " $ ArgsString[0] ); } } //------------------------------------------------------------------------- function ExecDestroy() { U2PawnOwner.Destroy(); } //------------------------------------------------------------------------- function ExecDialogDisable() { class'DialogEngine'.static.DisableNode( NPCOwner, ArgsName[0] ); } //------------------------------------------------------------------------- function ExecDialogEnable() { class'DialogEngine'.static.EnableNode( NPCOwner, ArgsName[0] ); } //----------------------------------------------------------------------------- function bool ExecDialogFar( bool bWait ) { local Actor Iter, A, B; local bool bOther, bChangedState; //NPCOwner.DMT("ExecFarDialog: Speakers" @ ArgsString[0] @ ArgsString[1] @ "Topic:" @ ArgsName[0] @ "Waiting:" @ bWait ); bOther = ArgsString[1] != ""; if( ArgsString[0] ~= PlayerSpeakerString ) A = FindPlayer(); if( bOther && ArgsString[1] ~= PlayerSpeakerString ) B = FindPlayer(); if( A == None || B == None ) { //!!MB (mdf) possible performance issue (if called often enough) use target for first arg so pre-loaded once? foreach NPCOwner.DynamicActors( class'Actor', Iter ) { if( Iter.Speaker ~= ArgsString[0] ) A = Iter; if( bOther && Iter.Speaker ~= ArgsString[1] ) B = Iter; if( A != None && B != None ) break; } } if( A != None && B != None && A != B ) class'DialogEngine'.static.Initiate( A, B, ArgsName[0], NPCOwner ); else if( A != None ) class'DialogEngine'.static.Initiate( A, None, ArgsName[0], NPCOwner ); else if( B != None ) class'DialogEngine'.static.Initiate( B, None, ArgsName[0], NPCOwner ); else SetScriptError( "DialogFar -- can't find speakers for '" $ ArgsString[0] $ "' and '" $ ArgsString[1] $ "'" ); if( bWait ) { GotoState( WaitDialogFarPausedState ); bChangedState = true; } return bChangedState; } //----------------------------------------------------------------------------- function ExecDialogInitiate() { local Actor Iter, A; if( U2PawnOwner != None ) { //NPCOwner.DM("ExecDialogInitiate: Other" @ ArgsString[0] @ "Topic:" @ ArgsName[0] ); if( ArgsString[0] ~= PlayerSpeakerString ) A = FindPlayer(); else if( ArgsString[0] != SelfSpeakerString ) { foreach U2PawnOwner.DynamicActors( class'Actor', Iter ) if( Iter.Speaker ~= ArgsString[0] ) { A = Iter; break; } } // pawn is talking solo if( A == U2PawnOwner ) { Warn( "DialogInitiate -- other has the same speaker string as this npc -- use '" $ SelfSpeakerString $ "' instead" ); A = None; } // either talk to someone, or talk to yourself about a topic if( A != None || ArgsName[0] != '' ) { // initiate specified dialog with target class'DialogEngine'.static.Initiate( U2PawnOwner, A, ArgsName[0] ); DialogTarget = A; } else SetScriptError( "DialogInitiate -- can't find speaker '" $ ArgsString[0] $ "' or topic '" $ ArgsName[0] $ "'" ); } } //------------------------------------------------------------------------- function ExecDialogTerminate() { local Actor A; if( ArgsString[0] ~= PlayerSpeakerString ) A = FindPlayer(); else { foreach NPCOwner.DynamicActors( class'Actor', A ) if( A.Speaker ~= ArgsString[0] ) break; } if( A != None ) { // initiate specified dialog with target A.DialogTerminate(); DialogTarget = None; } } //------------------------------------------------------------------------- function ExecDirectionalPatrol() { NPCOwner.SetDirectionalPatrol( bool(ArgsByte[0]) ); } /*------------------------------------------------------------------------- NOTE: even with bStasis -- NPCs can still take damage and go PHYS_Falling etc. so with bStasis set, script generated events events (TakeDamage, Trigger etc.) are implicitely disabled above. Engine events should be automatically disabled if the Pawn/Controller has bStasis=true. Only way to wake up a dormant NPC is through a handled trigger or event (handlers are still called) or through a timer. */ function ExecDormant() { NPCOwner.SetDormant( ArgsByte[0] != 0, ArgsByte[1] != 0 ); } //----------------------------------------------------------------------------- function ExecDropInventory() { local Inventory Inv; Inv = class'UtilGame'.static.GiveInventoryString( U2PawnOwner, ArgsString[0] ); if( Inv != None ) Inv.DropFrom( U2PawnOwner.Location ); else SetScriptError( "Couldn't drop inventory " $ ArgsString[0] ); } //----------------------------------------------------------------------------- function ExecEnableProbeEvent() { NPCOwner.EnableProbeEvent( ArgsName[ 0 ], ArgsByte[ 0 ] == 1 ); } //------------------------------------------------------------------------- function ExecEventDisable() { local int EventIndex; if( GetEventIndex( ArgsName[0], EventIndex ) ) { if( Events[EventIndex].bCanToggle ) Events[EventIndex].bEnabled = false; else SetScriptError( "Can't toggle event " $ ArgsName[0] ); } } //------------------------------------------------------------------------- function ExecEventEnable() { local int EventIndex; if( GetEventIndex( ArgsName[0], EventIndex ) ) { if( Events[EventIndex].bCanToggle ) Events[EventIndex].bEnabled = true; else SetScriptError( "Can't toggle event " $ ArgsName[0] ); } } //------------------------------------------------------------------------- function ExecEventWait() { local int EventIndex; if( GetEventIndex( ArgsName[0], EventIndex ) ) { if( Events[EventIndex].EventWaitState != '' ) GotoState( Events[EventIndex].EventWaitState ); else SetScriptError( "Can't wait for " $ ArgsName[0] ); } } //----------------------------------------------------------------------------- // All args are optional. None --> clear previous found target (if any). Will // only do a gotolabel/call if these were specified. function ExecFindActor() { local float MinDist, MaxDist; local UtilGame.EDistanceFilterType DistanceFilterType; local UtilGame.EVisibilityFilterType VisibilityFilterType; local int FindActorResult; //NPCOwner.DMTNS( "String0 " $ ArgsString[ 0 ] ); //NPCOwner.DMTNS( "String1 " $ ArgsString[ 1 ] ); //NPCOwner.DMTNS( "String2 " $ ArgsString[ 2 ] ); //NPCOwner.DMTNS( "Float0 " $ ArgsFloat[ 0 ] ); //NPCOwner.DMTNS( "Float1 " $ ArgsFloat[ 1 ] ); //NPCOwner.DMTNS( "Int0 " $ ArgsInt[ 0 ] ); //NPCOwner.DMTNS( "Int1 " $ ArgsInt[ 1 ] ); //NPCOwner.DMTNS( "Int2 " $ ArgsInt[ 2 ] ); if( ArgsString[0] == "" ) { ClearFoundActors(); } else { MinDist = ArgsFloat[ 0 ]; MaxDist = ArgsFloat[ 1 ]; if( MinDist > MaxDist ) { SetScriptError( "Min > Max for FindActor" ); return; } // convert ints to enums switch( ArgsInt[ 0 ] ) { case 0: DistanceFilterType = DFT_First; break; case 1: DistanceFilterType = DFT_Closest; break; case 2: DistanceFilterType = DFT_Furthest; break; case 3: DistanceFilterType = DFT_Any; break; default: SetScriptError( "Invalid distance type for FindActor " $ ArgsInt[0] ); return; } switch( ArgsInt[ 1 ] ) { case 0: VisibilityFilterType = VFT_None; break; case 1: VisibilityFilterType = VFT_Visible; break; case 2: VisibilityFilterType = VFT_FOV; break; default: SetScriptError( "Invalid visibility type for FindActor " $ ArgsInt[1] ); return; } if( ArgsInt[2] == 0 ) ArgsInt[2] = UtilGame.MaxFilteredActors; FindActorResult = class'UtilGame'.static.GetFilteredActors( U2PawnOwner, ArgsString[0], FoundActors, ArgsFloat[0], ArgsFloat[1], DistanceFilterType, VisibilityFilterType, ArgsInt[2] ); //DMSC( "Found Actors: " $ FindActorResult ); if( FindActorResult >= 0 ) { // call/jump to destination label or continue with next line NumFoundActors = FindActorResult; //for( FindActorResult=0; FindActorResult<NumFoundActors; FindActorResult++ ) // DMSC( FindActorResult $ ": " $ FoundActors[ FindActorResult ] ); if( ArgsString[1] == TextGotoLabel || ArgsString[1] == TextCall ) HandleCallOrGotoLabel( NumFoundActors != 0, ArgsString[1] ); else if( ArgsString[1] != "" ) SetScriptError( "Invalid FindActor argument (where gotolabel/call should be: " $ ArgsString[1] ); } //note: not an error if no matching actors found - script has to decide this (by branching on success // with call/gotolabel and/or by using gotoactor vs gotoactorsafe) } } //------------------------------------------------------------------------- function ExecGib() { local int SavedGibGoreLevel; // use the specified gore level if( ArgsInt[0] != 0 && U2PawnOwner.GibSetClass != None ) { SavedGibGoreLevel = U2PawnOwner.GibSetClass.default.GoreLevel; U2PawnOwner.GibSetClass.default.GoreLevel = ArgsInt[0]; } if( U2PawnOwner.ShouldGib( class'Gibbed' ) ) U2PawnOwner.ChunkUp(); else if( ArgsByte[0] == 0 ) U2PawnOwner.Died( NPCOwner, None, U2PawnOwner.Location, vect(0,0,0) ); else U2PawnOwner.Destroy(); // restore the default if( ArgsInt[0] != 0 && U2PawnOwner.GibSetClass != None ) U2PawnOwner.GibSetClass.default.GoreLevel = SavedGibGoreLevel; } //------------------------------------------------------------------------- function ExecGibAll() { local class<Pawn> TargetClass; local Controller C; local U2Pawn U2P; local int SavedGibGoreLevel; TargetClass = class<Pawn>(DynamicLoadObject( ArgsString[0], Class'Class')); if( TargetClass != None ) { for( C=NPCOwner.Level.ControllerList; C!=None; C=C.NextController ) { U2P = U2Pawn(C.Pawn); if( U2P != None && ClassIsChildOf( U2P.class, TargetClass ) ) { if( ArgsInt[0] != 0 ) { SavedGibGoreLevel = U2P.GibSetClass.default.GoreLevel; U2P.GibSetClass.default.GoreLevel = ArgsInt[0]; } if( U2P.ShouldGib( class'Gibbed' ) ) U2P.ChunkUp(); else if( ArgsByte[0] == 0 ) U2P.Died( NPCOwner, None, U2P.Location, vect(0,0,0) ); else U2PawnOwner.Destroy(); if( ArgsInt[0] != 0 ) U2P.GibSetClass.default.GoreLevel = SavedGibGoreLevel; } } } else { SetScriptError( "GibAll: invalid class " $ ArgsString[0] ); } } //----------------------------------------------------------------------------- function ExecGiveInventory() { if( class'UtilGame'.static.GiveInventoryString( U2PawnOwner, ArgsString[0] ) == None ) { SetScriptError( "Couldn't give inventory " $ ArgsString[0] $ " to NPC" ); } } //------------------------------------------------------------------------- function ExecGiveItemToPlayer() { if( ArgsInt[0] == 0 ) { if( class'UtilGame'.static.GiveInventoryString( FindPlayer(), ArgsString[0] ) == None ) { SetScriptError( "Couldn't give item " $ ArgsString[0] $ " to player" ); } } else { if( !class'U2Weapon'.static.AddAmmo( FindPlayer(), ArgsString[0], ArgsInt[0] ) ) { SetScriptError( "Couldn't give ammo" $ ArgsString[0] $ " to player" ); } } } //------------------------------------------------------------------------- function ExecGiveTossedItem() { if( !U2PawnOwner.GiveTossedItem( ArgsString[0] ) ) SetScriptError( "Couldn't give tossed item " $ ArgsString[0] $ " to NPC" ); } //----------------------------------------------------------------------------- function ExecGotoActor() { if( !ProcessExecGotoActor( Actor(CurrentCommand.CommandTarget) ) ) SetScriptError( "Can't gotoactor " $ CurrentCommand.CommandTarget ); //DMSC( " GotoActor: " $ A ); } //----------------------------------------------------------------------------- function bool ExecGotoActorSafe() { return ProcessExecGotoActor( Actor(FindTarget( ArgsName[0], true )) ); } //------------------------------------------------------------------------- // Sets NewCmdIndex to line index stored in ArgsInt[0] function ExecGotoLabel() { DoGoto( ArgsLabel[0] ); } //------------------------------------------------------------------------- function ExecIncProperty() { local int Val; local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanSetProperty( ArgsString[0] ) ) { Val = int(O.GetPropertyText( ArgsString[0] )); if( ArgsInt[0] == 0 ) O.SetPropertyText( ArgsString[0], string(Val+1) ); else O.SetPropertyText( ArgsString[0], string(Val+ArgsInt[0]) ); } else { SetScriptError( "can't set property " $ ArgsString[0] $ " in " $ O ); } } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecInert() { local bool bVal; bVal = !bool(ArgsByte[0]); Events[ BumpEnemyIndex ].bEnabled = bVal; Events[ BumpFriendIndex ].bEnabled = bVal; Events[ BumpOtherIndex ].bEnabled = bVal; Events[ BumpPlayerIndex ].bEnabled = bVal; Events[ HearNoiseFriendlyIndex ].bEnabled = bVal; Events[ HearNoiseOtherIndex ].bEnabled = bVal; Events[ HearNoiseThreatIndex ].bEnabled = bVal; Events[ InheritEnemyIndex ].bEnabled = bVal; Events[ SeeAlertFriendIndex ].bEnabled = bVal; Events[ SeeEnemyIndex ].bEnabled = bVal; Events[ SeeFriendIndex ].bEnabled = bVal; Events[ SeeOtherIndex ].bEnabled = bVal; Events[ SeePlayerIndex ].bEnabled = bVal; Events[ TookDamageIndex ].bEnabled = bVal; Events[ TookDamageEnemyIndex ].bEnabled = bVal; Events[ TookDamageFriendIndex ].bEnabled = bVal; // if "inert 1", also clear bXMPHandlingEnabled but don't *set* bXMPHandlingEnabled if "inert 0" if( !bVal ) { bXMPHandlingEnabled = bVal; NPCOwner.SetXMPHandlingEnabled( bXMPHandlingEnabled ); } } //----------------------------------------------------------------------------- function ExecHandlerGroup() { if( !bInHandlerGroup ) { bInHandlerGroup = true; // any subsequent onevent/ontimer/ontrigger in this group CurrentHandlerGroup = NextHandlerGroupIndex++; } else { SetScriptError( "handlergroup -- already in a handler groupe!" ); } } //----------------------------------------------------------------------------- function ExecHandlerGroupEnd() { if( bInHandlerGroup ) { bInHandlerGroup = false; // any subsequent onevent/ontimer/ontrigger not in a group CurrentHandlerGroup = 0; } else { SetScriptError( "handlergroupend -- not in a handler groupe!" ); } } //----------------------------------------------------------------------------- function ExecHeadTracking() { NPCOwner.SetHeadTrackingEnabled( bool( ArgsByte[ 0 ] ) ); } //----------------------------------------------------------------------------- /* function ShowJumpPos() { U2PawnOwner.AddActor( U2PawnOwner, U2PawnOwner.ColorBlue() ); if( U2PawnOwner.Physics == PHYS_Falling ) AddTimer( 'ShowJumpPos', 0.1 ); } */ //----------------------------------------------------------------------------- function ExecJump() { // mdf-tbi: doesn't work if Pawn *just* landed -- phys_falling getting spammed with phys_walking //U2PawnOwner.AddActor( U2PawnOwner, U2PawnOwner.ColorGreen() ); U2PawnOwner.Velocity.X = ArgsFloat[0]; U2PawnOwner.Velocity.Y = ArgsFloat[1]; U2PawnOwner.Velocity.Z = ArgsFloat[2]; U2PawnOwner.SetPhysics( PHYS_Falling ); //AddTimer( 'ShowJumpPos', 0.1 ); } //------------------------------------------------------------------------- function ExecKill() { U2PawnOwner.Died( NPCOwner, None, U2PawnOwner.Location, vect(0,0,0) ); } //------------------------------------------------------------------------- function ExecKillAll() { local class<Actor> TargetClass; local Actor A; TargetClass = class<Actor>(DynamicLoadObject( ArgsString[0], Class'Class')); if( TargetClass != None ) { foreach NPCOwner.DynamicActors( class'Actor', A ) if ( ClassIsChildOf( A.class, TargetClass ) ) A.Destroy(); } else { SetScriptError( "KillAll: invalid class " $ ArgsString[0] ); } } //----------------------------------------------------------------------------- function ExecLockStep() { // mdf-tbi: } //------------------------------------------------------------------------- function ExecMessage() { if( ArgsInt[0] >= 0 && ArgsInt[0] <= 2 ) NPCOwner.DMTNS( ArgsString[0], ArgsInt[0] == 1, ArgsInt[0] != 2, 'SM' ); else SetScriptError( "Message - invalid argument: " $ ArgsInt[0] ); } //----------------------------------------------------------------------------- // Sets up cmd to jump to specified label when event xxx occurs. function ExecOnEvent() { local int EventIndex; if( GetEventIndex( ArgsName[0], EventIndex ) ) { if( ArgsString[1] == "" ) { Events[EventIndex].OnCmdIndex = -1; // onevent xxx (disable onevent) Events[EventIndex].Group = 0; // clear } else { if( ArgsString[0] == TextGotoLabel ) // onevent xxx gotolabel lll (label line # ArgsLabel[0] at this point) { Events[EventIndex].bInterrupt = false; } else if( ArgsString[0] == TextInterrupt ) { Events[EventIndex].bInterrupt = true; // onevent xxx interrupt lll } // "call" command not allowed Events[EventIndex].OnCmdIndex = ArgsLabel[0]; Events[EventIndex].bClear = bool(ArgsByte[0]); // if clear=1, event handler will be automatically removed when the event occurs Events[EventIndex].Group = CurrentHandlerGroup; } } } //----------------------------------------------------------------------------- // Sets up cmd to jump to specified label when time is up occurs. function ExecOnTimer() { local int TimerIndex; local int Index; TimerIndex = ArgsInt[0]-1; if( TimerIndex >= 0 && TimerIndex < MaxGeneralTimers ) { if( ArgsFloat[0] ~= 0.0 ) { HandleRemoveTimer( TimerIndex, false ); Timers[TimerIndex].Group = 0; } else { Timers[TimerIndex].InitialFrequency = ArgsFloat[0]; Timers[TimerIndex].RepeatFrequency = ArgsFloat[1]; Timers[TimerIndex].TriggerIndex = -1; // no trigger event associated with this timer Timers[TimerIndex].Group = CurrentHandlerGroup; if( ArgsString[0] == TextGotoLabel ) // ontrigger xxx gotolabel lll { Timers[TimerIndex].bInterrupt = false; } else if( ArgsString[0] == TextInterrupt ) { Timers[TimerIndex].bInterrupt = true; // ontrigger xxx interrupt lll } // "call" command not allowed Timers[TimerIndex].OnCmdIndex = ArgsLabel[0]; // (label line # ArgsLabel[0] at this point) if( CurrentHandlerGroup != 0 && Timers[TimerIndex].RepeatFrequency > 0.0 ) SetScriptError( "Can't have a repeating timer in a handler group!" ); // set/reset with specified initial frequency HandleAddTimer( TimerIndex, ArgsFloat[0] ); } } else { SetScriptError( "Invalid timer index: " $ TimerIndex ); } } //----------------------------------------------------------------------------- // Sets up cmd to jump to specified label when trigger xxx occurs. If a time // limit was specified, also associates a timer with the trigger handler. // // M s0 s1 b0 f0 s2 s3 l0 l1 // eventname [ [gotolabel|interrupt] labelname [clear [timelimit [gotolabel|interrupt] labelname]]] # # function ExecOnTrigger() { local int TriggerIndex; local int TimerIndex; //NPCOwner.DMTNS( "ExecOnTrigger: " $ ArgsName[0] $ " NumTriggerEvents: " $ NumTriggerEvents ); // look for trigger name in table if( ArgsName[0] != '' ) { TriggerIndex = FindTrigger( ArgsName[0] ); // DMSC( "ExecOnTrigger(): " $ TriggerIndex ); if( ArgsString[0] == "" ) { // no first gotolabel so disabling OnTrigger -- clear if in table //NPCOwner.DMTNS( "ExecOnTrigger -- calling ClearTrigger for event " $ ArgsName[0] $ " TriggerIndex= " $ TriggerIndex ); if( TriggerIndex != -1 ) { ClearTrigger( TriggerIndex, true ); TriggerEvents[ TriggerIndex ].Group = 0; } } else { // update if in table, otherwise add if( TriggerIndex == -1 ) { // not already in table -- add TriggerIndex = NumTriggerEvents++; // DMSC( " adding to table at " $ TriggerIndex ); TriggerEvents[ TriggerIndex ].EventName = ArgsName[0]; TriggerEvents[ TriggerIndex ].TimerIndex = -1; if( ArgsFloat[0] > 0.0 ) { // allocate a timer for( TimerIndex=MaxGeneralTimers; TimerIndex<MaxTimers; TimerIndex++ ) if( Timers[ TimerIndex ].OnCmdIndex == -1 ) break; if( TimerIndex == MaxTimers ) { SetScriptError( "Can't associate timer with ontrigger handler (out of timers)"); TimerIndex = -1; } } } else if( ArgsFloat[0] <= 0.0 ) { // trigger handler already present & no timer this time so remove it TimerIndex = TriggerEvents[ TriggerIndex ].TimerIndex; if( TimerIndex != -1 ) { // DMSC( " removing timer at " $ TimerIndex ); Timers[ TimerIndex ].TriggerIndex = -1; HandleRemoveTimer( TimerIndex, false ); TimerIndex = -1; } } else { // trigger handler already present -- may or may not have a timer TimerIndex = TriggerEvents[ TriggerIndex ].TimerIndex; } // DMSC( " TimerIndex= " $ TimerIndex ); // adding or updating timer if( (TimerIndex != -1) && (ArgsFloat[0] > 0.0) ) { //DMSC( " adding timer " $ ArgsName[0] $ " at " $ TimerIndex $ " OnCmdIndex #1: " $ ArgsLabel[0] $ " OnCmdIndex #2: " $ ArgsLabel[1] ); if( ArgsLabel[1] == 0 ) { //DMSC( "Using same label for timer!" ); ArgsLabel[1] = ArgsLabel[0]; } // set timer Timers[ TimerIndex ].InitialFrequency = ArgsFloat[0]; Timers[ TimerIndex ].RepeatFrequency = 0.0; Timers[ TimerIndex ].TriggerIndex = TriggerIndex; Timers[ TimerIndex ].OnCmdIndex = ArgsLabel[1]; TriggerEvents[ TriggerIndex ].TimerIndex = TimerIndex; if( ArgsString[2] == TextInterrupt ) { Timers[ TimerIndex ].bInterrupt = true; } else if( ArgsString[2] == TextGotoLabel ) { Timers[ TimerIndex ].bInterrupt = false; } // "call" command not allowed // set/reset with specified initial frequency HandleAddTimer( TimerIndex, ArgsFloat[0] ); } // store trigger event destination label index TriggerEvents[ TriggerIndex ].bClear = ( CurrentHandlerGroup != 0 || ArgsByte[0] != 0 ); // triggers can't have bClear=0 in a handler group TriggerEvents[ TriggerIndex ].OnCmdIndex = ArgsLabel[0]; TriggerEvents[ TriggerIndex ].Group = CurrentHandlerGroup; if( ArgsString[0] == TextInterrupt ) { TriggerEvents[ TriggerIndex ].bInterrupt = true; } else if( ArgsString[0] == TextGotoLabel ) { TriggerEvents[ TriggerIndex ].bInterrupt = false; } // "call" command not allowed //DMSC( " adding to trigger to table at: " $ TriggerIndex $ " CmdIndex: " $ ArgsLabel[0] $ " bClear:" $ ArgsByte[0] ); } } else { SetScriptError( "Invalid trigger name " $ ArgsName[0] ); } // NPCOwner.DMTNS( "ExecOnTrigger -- NumTriggerEvents: " $ NumTriggerEvents ); } //----------------------------------------------------------------------------- function bool ExecPlaySound( bool bWait ) { local Actor A; local Sound S; local Actor.ESoundSlot Slot; local bool bChangeState; A = Actor(CurrentCommand.CommandTarget); if( A != None ) { // set defaults from target actor if( ArgsFloat[0] == 0.0 ) ArgsFloat[0] = A.TransientSoundVolume; if( ArgsFloat[1] == 0.0 ) ArgsFloat[1] = A.TransientSoundRadius; if( ArgsFloat[2] == 0.0 ) ArgsFloat[2] = 1.0; Slot = FindSoundSlot( ArgsName[1] ); S = Sound(DynamicLoadObject( ArgsString[0], Class'Sound' )); if( S != None ) { A.PlaySound( S, Slot, ArgsFloat[0], bool(ArgsByte[0]), ArgsFloat[1], ArgsFloat[2] ); if( bWait ) { ArgsFloat[0] = A.GetSoundDuration( S ); GotoState( SleepingState ); bChangeState = true; } } else SetScriptError( "Invalid sound " $ ArgsString[0] ); } return bChangeState; } //------------------------------------------------------------------------- function bool ExecPlaySoundTableSlot( bool bWait ) { local U2Pawn U2P; local sound S; local bool bChangeState; local SoundSlotInterf.ESoundTableSlot SlotIndex; U2P = U2Pawn(CurrentCommand.CommandTarget); if( U2P != None && U2P.SoundTable != None ) { if( U2P.SoundTable.StringToSlot( ArgsString[0], SlotIndex ) ) { S = U2P.SoundTable.PlaySlotSound( U2P, SlotIndex ); if( S != None ) { if( bWait ) { ArgsFloat[0] = U2P.GetSoundDuration( S ); GotoState( SleepingState ); bChangeState = true; } } else SetScriptError( "No sound found for sound table slot: " $ ArgsString[0] ); } else SetScriptError( "Invalid sound table slot: " $ ArgsString[0] $ " for target: " $ U2P $ " using voice package:" @ U2P.VoicePackage ); } else SetScriptError( "Invalid target or target has no sound table" ); return bChangeState; } //------------------------------------------------------------------------- function ExecRemoveInventory() { // don't care if we couldn't remove it because not found? if( !class'UtilGame'.static.RemoveInventoryString( U2PawnOwner, ArgsString[0] ) ) { SetScriptError( "Couldn't remove inventory " $ ArgsString[0] $ " from NPC" ); } } //------------------------------------------------------------------------- function ExecRemoveInventoryFromPlayer() { // don't care if we couldn't remove it because not found? if( !class'UtilGame'.static.RemoveInventoryString( FindPlayer(), ArgsString[0] ) ) { SetScriptError( "Couldn't remove inventory " $ ArgsString[0] $ " from player" ); } } //------------------------------------------------------------------------- function ExecRemoveItemFromPlayer() { // don't care if we couldn't remove it because not found? if( !class'UtilGame'.static.RemoveInventoryString( FindPlayer(), ArgsString[0] ) ) { SetScriptError( "Couldn't remove item " $ ArgsString[0] $ " from player" ); } } //------------------------------------------------------------------------- function ExecRemoveTossedItem() { if( !U2PawnOwner.RemoveTossedItem( ArgsString[0] ) ) { SetScriptError( "Couldn't remove tossed item " $ ArgsString[0] $ " from NPC" ); } } //----------------------------------------------------------------------------- // !!mdf-tbd: could use support for finding spot which is unoccupied... function ExecResumePatrol() { local int ii; local int StartIndex; local int EndIndex; local string CommandString; local int CommandsListIndex; local Actor PatrolList[MaxPatrolSize]; local int CommandIndices[MaxPatrolSize]; local Actor DestinationActor; local name DestinationName; local int Res; local int NumDestinations; local float Dist, ClosestDist; local int SelectedIndex; local Actor NextPath; local string FinalLabel; local CommandT LocalCommand; StartIndex = ArgsLabel[0]; EndIndex = ArgsLabel[1]; //DMSC( "StartIndex:" $ StartIndex ); //DMSC( "EndIndex:" $ EndIndex ); // scan commands from StartIndex+1 to EndIndex-1 looking for gotoactor commands and making a list of destination actors for( ii=StartIndex+1; ii<=EndIndex-1; ii++ ) { LocalCommand = Commands[ ii ]; CommandString = LocaLCommand.CommandString; // DMSC( ii $ ": " $ CommandString ); CommandsListIndex = LocalCommand.CommandIndex; if( CommandsListIndex != CommandsListIndex_Label ) { if( CommandInfo[CommandsListIndex].CommandCode == CMD_GotoActor || CommandInfo[CommandsListIndex].CommandCode == CMD_GotoActorSafe ) { // this is a gotoactor command -- save off the destination if still valid Res = class'Util'.static.ParseName( CommandString, DestinationName ); if( Res == 1 ) { DestinationActor = Actor(LocalCommand.CommandTarget); if( DestinationActor != None ) { PatrolList[ NumDestinations ] = DestinationActor; CommandIndices[ NumDestinations ] = ii; NumDestinations++; } } } else if( (ii==EndIndex-1) && CommandInfo[CommandsListIndex].CommandCode == CMD_GotoLabel ) { // if last command before end label is a gotolabel startlabel ==> circular patrol -- add first actor to end of list Res = class'Util'.static.ParseString( CommandString, FinalLabel ); if( Res == 1 && FinalLabel == ArgsString[0] ) { PatrolList[ NumDestinations ] = PatrolList[ 0 ]; CommandIndices[ NumDestinations ] = CommandIndices[ 0 ]; NumDestinations++; } } } } if( NumDestinations == 0 ) { SetScriptError( "No gotoactors found for resumepatrol?" ); } else { //DMSC( "ExecResumePatrol Destinations:" ); //for( ii=0; ii<NumDestinations; ii++ ) // DMSC( ii $ ": " $ PatrolList[ ii ] $ " Index=" $ CommandIndices[ ii ] ); SelectedIndex = -1; if( ArgsName[0] == ResumePatrolBest || ArgsName[0] == ResumePatrolClosest ) { // pick the closest one to the NPC's current location // mdf-tbd: test reachability + total path distance ClosestDist = 9999999; for( ii=0; ii<NumDestinations; ii++ ) { Dist = VSize( U2PawnOwner.Location - PatrolList[ii].Location ); if( Dist < ClosestDist ) { ClosestDist = Dist; SelectedIndex = ii; } } //DMSC( "Closest=" $ PatrolList[ SelectedIndex ] $ " (" $ SelectedIndex $ ")" ); if( ArgsName[0] == ResumePatrolBest && SelectedIndex < (NumDestinations-1) ) { // best: select next one in list if directly reachable if( NPCOwner.ActorReachable( PatrolList[SelectedIndex+1] ) ) { SelectedIndex++; //DMSC( "next destination is directly reachable: " $ PatrolList[ SelectedIndex ] ); } else { // or if path to next one in list is directly reachable NPCOwner.FindPathToActor( PatrolList[SelectedIndex+1], NextPath, false, true, true ); //DMSC( "Path to" $ PatrolList[ SelectedIndex+1 ] $ " is " $ NextPath ); if( (NextPath != None) && NPCOwner.ActorReachable( NextPath ) ) { SelectedIndex++; //DMSC( "path to next destination is directly reachable: " $ PatrolList[ SelectedIndex ] ); } } } } else if( ArgsName[0] == ResumePatrolSaved ) { // look for destination matching saved one for( ii=0; ii<NumDestinations; ii++ ) { if( PatrolList[ii] == SavedDestination ) { SelectedIndex = ii; break; } } } else if( ArgsName[0] == ResumePatrolRandom ) { SelectedIndex = RandRange( 0, NumDestinations ); } if( SelectedIndex == -1 ) { SetScriptError( "No destination actor selected for resumepatrol?" ); } else { //DMSC( "Want to head to " $ PatrolList[ SelectedIndex ] ); SetCurrentCommandIndex( CommandIndices[ SelectedIndex ] - 1 ); } } } //----------------------------------------------------------------------------- function ExecReturn() { SetCurrentCommandIndex( PopCommandIndex() ); } //----------------------------------------------------------------------------- function ExecRotate() { // mdf-tbi: } //----------------------------------------------------------------------------- function ExecSaveDestination() { SavedDestination = GotoActorTarget; } //----------------------------------------------------------------------------- function ExecSendEvent() { // for now just send given event to all actors with matching tags and to all NPCs // mdf-tbd (opt): make argsbyte an int with 1=trigger NPCs, 2=trigger actors with matching tags, 3=both // if 1 is given, we can call TriggerNPCsStatic() instead which will be MUCH faster // This should pbly also be extended into the triggers themselves class'TriggerHelper'.static.TriggerActors( NPCOwner, class'Actor', NPCOwner, U2PawnOwner, ArgsName[0], bool(ArgsByte[0]) ); } //----------------------------------------------------------------------------- function ExecSetActorRangeTest() { NPCOwner.SetActorRangeTest( Actor( FindTarget( ArgsName[0], true )), ArgsFloat[0], ArgsByte[0] != 0 ); } //----------------------------------------------------------------------------- function ExecSetAimOdds() { NPCOwner.SetAimOdds( ArgsFloat[0] ); } //----------------------------------------------------------------------------- function ExecSetAlert() { NPCOwner.SetAlert( bool(ArgsByte[0]) ); } //----------------------------------------------------------------------------- // Turn this into a utility function? function ExecSetAmmo() { local Ammunition AmmoInv; local class<Ammunition> AmmoClass; AmmoClass = class<Ammunition>(DynamicLoadObject( ArgsString[0], class'class' )); if( AmmoClass != None ) { AmmoInv = Ammunition(U2PawnOwner.FindInventoryType( AmmoClass )); if( AmmoInv == None && ArgsInt[0] > 0 ) { // add it AmmoInv = U2PawnOwner.Spawn( AmmoClass, U2PawnOwner, , , rot(0,0,0) ); if( AmmoInv != None ) { AmmoInv.GiveTo( U2PawnOwner ); } else { SetScriptError( "Invalid ammo type specified for setammo command?" ); } } if( AmmoInv != None ) { AmmoInv.AmmoAmount = ArgsInt[0]; if( ArgsByte[0] != 0 && U2Ammo(AmmoInv) != None ) U2Ammo(AmmoInv).MaximizeClipAmount(); } } else { SetScriptError( "Invalid ammo type specified for setammo command?" ); } } //----------------------------------------------------------------------------- function ExecSetFocus() { local Actor A; if( ArgsName[0] != '' ) { A = Actor(CurrentCommand.CommandTarget); if( A != None ) NPCOwner.SetScriptedFocus( A ); } else { NPCOwner.SetScriptedFocus( None ); } } //----------------------------------------------------------------------------- function ExecSetHealth() { NPCOwner.SetHealth( ArgsInt[0] ); } //----------------------------------------------------------------------------- function ExecSetInventory() { local Pawn TargetPawn; local Inventory Inv; local int OldAutoSwitchPriority; TargetPawn = Pawn(CurrentCommand.CommandTarget); if( TargetPawn != None && TargetPawn.Controller != None ) { Inv = class'UtilGame'.static.GiveInventoryString( TargetPawn, ArgsString[0] ); if( Inv != None ) { if( Weapon(Inv) != None ) { // bit hack-ish -- no command to make a weapon current afaict OldAutoSwitchPriority = Weapon(Inv).AutoSwitchPriority; Weapon(Inv).AutoSwitchPriority = 999999; TargetPawn.Controller.SwitchToBestWeapon(); Weapon(Inv).AutoSwitchPriority = OldAutoSwitchPriority; } else { SetScriptError( "setinventory: can't switch to a non-weapon: " $ ArgsString[ 0 ] ); } } else { SetScriptError( "setinventory: can't give item: " $ ArgsString[ 0 ] ); } } else { SetScriptError( "setinventory: can't find target pawn or has no controller: " $ ArgsName[ 0 ] ); } } //----------------------------------------------------------------------------- function DoSetLocation( Actor LocationActor, Actor TargetActor ) { //NPCOwner.DMTNS( "DoSetLocation: " $ LocationActor $ " " $ TargetActor ); if( LocationActor != None ) { if( !TargetActor.SetLocation( LocationActor.Location ) && ArgsByte[0] == 0 ) SetScriptError( "Couldn't place " $ TargetActor $ " at " $ LocationActor ); } else { SetScriptError( "Invalid target actor " $ TargetActor ); } } //----------------------------------------------------------------------------- function execSetLocation() { DoSetLocation( Actor(FindTarget( ArgsName[0] )), U2PawnOwner ); } //----------------------------------------------------------------------------- function execSetLocationNamed() { DoSetLocation( Actor(FindTarget( ArgsName[1] )), Actor(CurrentCommand.CommandTarget) ); } //----------------------------------------------------------------------------- function execSetLocationVector() { local vector TargetLocation; TargetLocation.X = ArgsFloat[0]; TargetLocation.Y = ArgsFloat[1]; TargetLocation.Z = ArgsFloat[2]; if( !Actor(CurrentCommand.CommandTarget).SetLocation( TargetLocation ) && ArgsByte[0] == 1 ) SetScriptError( "Couldn't place " $ CurrentCommand.CommandTarget $ " at " $ TargetLocation ); } //------------------------------------------------------------------------- function ExecSetMoveSpeed() { local bool bResult; switch( ArgsString[0] ) { case "": bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], U2PawnOwner.GetStance() ); break; case "standing": bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Standing ); break; case "crouching": bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Crouching ); break; case "prone": bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Prone ); break; case "all": bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Standing ); bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Crouching ); bResult = NPCOwner.SetScriptedMoveSpeedMultiplier( ArgsFloat[0], Actor.ST_Prone ); break; default: SetScriptError( "Invalid stance specified " $ ArgsString[0] ); break; } if( !bResult ) SetScriptError( "Invalid movement speed specified " $ ArgsFloat[0] ); } //----------------------------------------------------------------------------- function ExecSetMoveSpeedAuto() { NPCOwner.SetAutoMoveSpeed( ArgsFloat[0] ); } /*----------------------------------------------------------------------------- NOTE: only 1 target can be pre-computed currently. This is done for the OrdersObject (if set) since this will generally take longer to find than the order giver (which can be found in the Controller list and which won't be used that often). mdf-tbd: which orders imply leaving scripted state (go autonomous) +attack +defend +follow (?) +none (freelance) (why use in scripted state -- just use "stop" command, no?) +optionally stay scripted? +hold (can remain in effect on autonomous) */ function ExecSetOrders() { local name Orders; local Object OrderGiver; local Actor OrdersObject; ///NPCOwner.DM( "ExecSetOrders -- Orders:" $ ArgsName[0] $ " OrdersObject: " $ CurrentCommand.CommandTarget $ " fParam:" $ ArgsFloat[0] $ " OrderGiver:" $ ArgsName[2] ); // verify orders Orders = ArgsName[0]; switch( Orders ) { case U2NPCController.OrdersGoto: Orders = U2NPCController.OrdersGoto; break; case U2NPCController.OrdersNone: Orders = U2NPCController.OrdersNone; break; case U2NPCController.OrdersSquad: Orders = U2NPCController.OrdersSquad; break; default: SetScriptError( MsgInvalidOrdersNotSupported $ ": " $ Orders ); return; } if( ArgsName[1] != 'none' ) { OrdersObject = Actor(CurrentCommand.CommandTarget); if( OrdersObject == None ) SetScriptError( MsgInvalidOrdersObject $ ": " $ ArgsName[1] ); } if( ArgsName[2] != '' ) { OrderGiver = FindTarget( ArgsName[2] ); if( Pawn(OrderGiver) != None ) OrderGiver = Pawn(OrderGiver).Controller; if( OrderGiver == None ) SetScriptError( MsgInvalidOrderGiver $ ": " $ ArgsName[2] ); } //NPCOwner.DM( "ExecSetOrders calling SetOrders -- Orders: " $ Orders $ " OrderGiver: " $ OrderGiver $ " OrdersObject: " $ OrdersObject ); if( !NPCOwner.SetOrders( Orders, OrdersObject, ArgsFloat[0], OrderGiver, false ) ) { //NPCOwner.DM( " failed" ); SetScriptError( MsgInvalidOrders $ ": " $ Orders ); } } //----------------------------------------------------------------------------- function ExecSetPhysics() { local Actor.EPhysics NewPhysics; local Actor TargetActor; local bool bError; TargetActor = Actor(FindTarget( ArgsName[0] )); if( TargetActor != None ) { switch( ArgsName[1] ) { case 'PHYS_Falling': NewPhysics = PHYS_Falling; break; case 'PHYS_Flying': NewPhysics = PHYS_Flying; break; case 'PHYS_None': NewPhysics = PHYS_None; break; case 'PHYS_Swimming': NewPhysics = PHYS_Swimming; break; case 'PHYS_Walking': NewPhysics = PHYS_Walking; break; default: SetScriptError( "Invalid slot " $ ArgsName[1] ); bError = true; break; } if( !bError ) TargetActor.SetPhysics( NewPhysics ); } } //----------------------------------------------------------------------------- function ExecSetProperty() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanSetProperty( ArgsString[0] ) ) { if( ArgsString[1] == DefaultPropertyString ) O.SetPropertyTextDefault( ArgsString[0] ); else O.SetPropertyText( ArgsString[0], ArgsString[1] ); } else { SetScriptError( "can't set property " $ ArgsString[0] $ " in " $ O ); } } else { SetScriptError( "can't find target for command" ); } } //----------------------------------------------------------------------------- function ExecSetProperties() { local Actor A; local class<Actor> ActorClass; ActorClass = class<Actor>(DynamicLoadObject( ArgsString[0], class'Class' )); if( ActorClass != None ) { foreach NPCOwner.DynamicActors( ActorClass, A ) { if( A.CanSetProperty( ArgsString[1] ) ) { if( ArgsString[2] == DefaultPropertyString ) A.SetPropertyTextDefault( ArgsString[1] ); else A.SetPropertyText( ArgsString[1], ArgsString[2] ); } else { SetScriptError( "can't set property " $ ArgsString[1] $ " in " $ A ); } } } else { SetScriptError( "Invalid class type for SetProperties: " $ ArgsString[0] ); } } //----------------------------------------------------------------------------- function ExecSetSatellite() { local Actor A; A = Actor(CurrentCommand.CommandTarget); // can be none if( U2PawnOwner != None ) U2PawnOwner.MeshSetSatellite( ArgsName[0], A ); //U2PawnOwner.MeshSetSatellite(ArgsName[0], None, A.Location); } //----------------------------------------------------------------------------- function ExecSetScript() { NPCOwner.SetScript( ArgsString[0], ArgsString[1] ); // we're now executing a new script -- decrement CurrentCommandIndex to // compensate fact that when this call returns it will be incremented // which would cause us to start executing the new script at the line // after the intended line. CurrentCommandIndex--; } //----------------------------------------------------------------------------- function ExecSetSkill() { NPCOwner.SetSkill( ArgsFloat[0] ); } //----------------------------------------------------------------------------- function bool ExecSetStance() { local byte TargetStance; local bool bChangedState; TargetStance = U2PawnOwner.GetStance(); switch( ArgsString[0] ) { case "standing": TargetStance = Actor.ST_Standing; break; case "crouching": TargetStance = Actor.ST_Crouching; break; case "prone": TargetStance = Actor.ST_Prone; break; default: SetScriptError( "Invalid stance specified " $ ArgsString[0] ); break; } if( TargetStance != U2PawnOwner.GetStance() ) { //DMSC( "Setting stance to " $ ArgsString[0] ); if( TargetStance == Actor.ST_Crouching && !U2PawnOwner.bCanCrouch ) SetScriptError( "NPC can't crouch" ); else if( TargetStance == Actor.ST_Prone && !U2PawnOwner.bCanCrawl ) SetScriptError( "NPC can't go prone" ); else { NPCOwner.StopMovement( true, true ); // mdf-tbd: otherwise SetStance won't play drop animation U2PawnOwner.SetStance( TargetStance ); GotoState( ChangingStanceState ); bChangedState = true; } } return bChangedState; } //------------------------------------------------------------------------- function ExecSetStationary() { NPCOwner.SetStationary( ArgsByte[0] == 1, ArgsByte[1] == 1 ); } //----------------------------------------------------------------------------- function ExecSetTacticalMoveType() { switch( ArgsInt[0] ) { case 0: NPCOwner.SetScriptedTacticalMoveType( TMT_None ); break; case 1: NPCOwner.SetScriptedTacticalMoveType( TMT_Basic ); break; case 2: NPCOwner.SetScriptedTacticalMoveType( TMT_Serpentine ); break; default: SetScriptError( "Invalid tactical move type specified " $ ArgsInt[0] ); break; } } //------------------------------------------------------------------------- function ExecSetWeapon() { local Weapon W; W = class'UtilGame'.static.SetCurrentWeaponString( U2PawnOwner, ArgsString[0] ); if( W == None ) SetScriptError( "Couldn't set NPC weapon to " $ ArgsString[0] ); // mdf-tbi: force NPC to use this weapon even if weapon selecting code would select // a different one // else if( ArgsByte[0] != 0 ) // NPCOwner.ForceWeapon( W ); } //----------------------------------------------------------------------------- function ExecShutdown() { NPCOwner.Shutdown( ArgsByte[ 0 ] == 1 ); } //------------------------------------------------------------------------- function ExecSleep() { GotoState( SleepingState ); } //------------------------------------------------------------------------- function ExecSleepRand() { if( ArgsFloat[0] ~= 0.0 ) ArgsFloat[0] = 1.0; // don't want to allow 0.0 or will sleep indefinitely ArgsFloat[0] = RandRange( 0.001, ArgsFloat[0] ); GotoState( SleepingState ); } //----------------------------------------------------------------------------- function ExecSpawn() { local Inventory Inv; local Class<Actor> TargetClass; local Actor A; TargetClass = class<Actor>(DynamicLoadObject( ArgsString[0], class'Class' )); if( TargetClass != None ) A = Actor(CurrentCommand.CommandTarget).Spawn( TargetClass ); if( ArgsString[1] != "" && U2Pawn(A) != None && U2NPCController(U2Pawn(A).Controller) != None ) U2NPCController(U2Pawn(A).Controller).SetScript( ArgsString[1], ArgsString[2] ); if( A == None && ArgsByte[0] == 1 ) SetScriptError( "Spawn: couldn't spawn a " $ ArgsString[0] ); } //------------------------------------------------------------------------- function bool ExecStop() { local bool bSuccess; // mdf-tbd: I think this check make sense // If the command stack isn't empty it means that at least one call // never returned during the current execution phase. It should be // possible to have a subroutine that might not call return (unless // we add return values this is a necessary evil), but this should // be made explicit by clearing the stack so this error won't // occur using the clearcalls command? if( NumPushedCommandIndices != 0 ) { SetScriptError( MsgCallInterruptReturnError ); } else { // mdf-tbd: DetachScriptController(); bSuccess = true; } return bSuccess; } //------------------------------------------------------------------------- function ExecStopMovement() { NPCOwner.StopMovement( true, true ); } //------------------------------------------------------------------------- function ExecStopSound() { local Actor A; local Actor.ESoundSlot Slot; A = Actor(CurrentCommand.CommandTarget); Slot = FindSoundSlot( ArgsName[1] ); U2PawnOwner.DM("ExecStopSound -- Actor:" @ A @ "Slot:" @ Slot @ "bStopNoOverrideSounds:" @ ArgsByte[0] ); A.StopSoundSlot( Slot, bool(ArgsByte[0]) ); } //------------------------------------------------------------------------- function HandleCallOrGotoLabel( bool bResult, string BranchStr ) { // DMSC( "HandleCallOrGotoLabel: '" $ BranchStr $ "'" $ " bResult: " $ bResult ); if( bResult ) { // true: if call/gotolabel given jump to it, otherwise fall through to next line if( BranchStr == TextCall ) DoCall( ArgsLabel[0] ); // call else if( BranchStr != "" ) DoGoto( ArgsLabel[0] ); // gotolabel } else { // false: if gotolabel given fall through to next line, otherwise skip next line if( BranchStr == "" ) CurrentCommandIndex++; } } //------------------------------------------------------------------------- function ExecTestActorInRange() { local Actor TargetActor; TargetActor = Actor(FindTarget( ArgsName[0] )); if( TargetActor != None ) HandleCallOrGotoLabel( NPCOwner.CheckActorInRange( TargetActor, ArgsFloat[0] ), ArgsString[0] ); //DMSC( "ExecTestInRange: " $ ArgsName[0] $ " " $ ArgsFloat[0] $ " " $ ArgsString[0] $ " " $ ArgsString[0] ); } //------------------------------------------------------------------------- // mdf-tbd: add "default" support to all testproperty functions function ExecTestProperty() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( O.GetPropertyText( ArgsString[0] ) == ArgsString[1], ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } //DMSC( "ExecTestProperty: " $ ArgsString[0] $ " " $ O.GetPropertyText( ArgsString[0] ) $ " " $ ArgsString[1] ); } //------------------------------------------------------------------------- function ExecTestPropertyCI() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( O.GetPropertyText( ArgsString[0] ) ~= ArgsString[1], ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecTestPropertyE() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( float(O.GetPropertyText( ArgsString[0] )) == float(ArgsString[1]), ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecTestPropertyG() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( float(O.GetPropertyText( ArgsString[0] )) > float(ArgsString[1]), ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecTestPropertyGE() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( float(O.GetPropertyText( ArgsString[0] )) >= float(ArgsString[1]), ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecTestPropertyL() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( float(O.GetPropertyText( ArgsString[0] )) < float(ArgsString[1]), ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //------------------------------------------------------------------------- function ExecTestPropertyLE() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) { if( O.CanGetProperty( ArgsString[0] ) ) HandleCallOrGotoLabel( float(O.GetPropertyText( ArgsString[0] )) <= float(ArgsString[1]), ArgsString[2] ); else SetScriptError( "can't get property " $ ArgsString[0] $ " in " $ O ); } else { SetScriptError( "can't find target for command" ); } } //----------------------------------------------------------------------------- function ExecTestRandom() { HandleCallOrGotoLabel( FDecision( ArgsFloat[0] ), ArgsString[0] ); } //------------------------------------------------------------------------- function ExecTestState() { local Object O; O = CurrentCommand.CommandTarget; if( O != None ) HandleCallOrGotoLabel( O.IsInState( ArgsName[1] ), ArgsString[0] ); } //----------------------------------------------------------------------------- function bool ExecTurnToActor() { local Actor A; local bool bHasLOS; local bool bChangedState; if( ArgsName[0] != '' ) { A = Actor(CurrentCommand.CommandTarget); if( A != None ) { // make sure Pawn can see actor? bHasLOS = class'UtilGame'.static.ActorCanSeeActor( U2PawnOwner, A, -1.0 ); if( bHasLOS || ArgsInt[0] == 2 ) { NPCOwner.TurnToActor( A, (ArgsByte[0] != 0) ); GotoState( WaitFinishedRotationState ); bChangedState = true; } else if( ArgsInt[0] == 1 ) { SetScriptError( "TurnToActor -- can't see " $ A ); } } else { SetScriptError( "TurnToActor -- can't find " $ ArgsName[0] ); } } else { NPCOwner.ClearScriptTarget(); } return bChangedState; } //------------------------------------------------------------------------- function ExecUse() { local Actor A; A = Actor(CurrentCommand.CommandTarget); if( A != None ) { if( A.IsUsable( NPCOwner ) ) NPCOwner.UseActor( A ); else SetScriptError( "Use: can't use " $ A ); } } //------------------------------------------------------------------------- function ExecUnuse() { local Actor A; A = Actor(CurrentCommand.CommandTarget); if( A != None ) { if( A.IsUsable( NPCOwner ) ) NPCOwner.UnuseActor( A ); else SetScriptError( "Unuse: can't unuse " $ A ); } } //------------------------------------------------------------------------- function ExecUsePickups() { // mdf-tbi: } //------------------------------------------------------------------------- function ExecFire() { ArgsByte[0] = 0; GotoState( FiringState ); } //------------------------------------------------------------------------- function ExecFireAlt() { ArgsByte[0] = 1; GotoState( FiringState ); } //------------------------------------------------------------------------- // Used to enable/disable support for firing/altfiring specific weapons. function WeaponSupports( out array<name> WeaponsList ) { local int WeaponPos; local int ii; // scan U2PawnOwner's DisabledAltFireWeapons list ii=0; WeaponPos = -1; while( ii < WeaponsList.Length ) { if( WeaponsList[ ii ] == ArgsName[ 0 ] ) { WeaponPos = ii; break; } ii++; } if( ArgsByte[0] == 1 ) { // make sure its not in the list if( WeaponPos != -1 ) WeaponsList.Remove( WeaponPos, 1 ); } else { // make sure its in the list if( WeaponPos == -1 ) WeaponsList[ WeaponsList.Length ] = ArgsName[ 0 ]; } //mdf-tbd: generalize? NPCOwner.RefreshWeapon( ArgsName[0] ); } //----------------------------------------------------------------------------- function ExecWeaponLoad() { if( U2Weapon(U2PawnOwner.Weapon) != None ) U2Weapon(U2PawnOwner.Weapon).Reload(); else SetScriptError( "WeaponLoad: Pawn not holding a valid weapon" ); } //----------------------------------------------------------------------------- function ExecWeaponSetAmmoType() { if( !NPCOwner.SetAmmoTypeStr( ArgsString[ 0 ] ) ) SetScriptError( "WeaponSetAmmoType: couldn't select given ammo" ); } //------------------------------------------------------------------------- function ExecWeaponSupportsAltFire() { WeaponSupports( U2PawnAdvanced(U2PawnOwner).DisabledAltFireWeapons ); } //------------------------------------------------------------------------- function ExecWeaponSupportsFire() { WeaponSupports( U2PawnAdvanced(U2PawnOwner).DisabledFireWeapons ); } //------------------------------------------------------------------------- function ExecEnableXMPHandling() { bXMPHandlingEnabled = bool(ArgsByte[0]); NPCOwner.SetXMPHandlingEnabled( bXMPHandlingEnabled ); } //----------------------------------------------------------------------------- function bool ExecuteCommand() { local bool bChangeState; local ECommandCode CurrentCommandCode; //!!!Log( "ExecuteCommand - Begin" ); // tbd: can get rid of bChangeState gunk if use actors or add state code support for objects bChangeState = false; if( CurrentCommand.CommandIndex == CommandsListIndex_Stop ) CurrentCommandCode = CMD_Stop; else CurrentCommandCode = CommandInfo[ CurrentCommand.CommandIndex ].CommandCode; //!!!Log( " CurrentCommandCode: " $ EnumStr( enum'ECommandCode', CurrentCommandCode ) ); //!!!Log( " CurrentCommandIndex: " $ CurrentCommand.CommandIndex ); //!!!Log( " CurrentCommandString: " $ CurrentCommand.CommandString ); //!!!Log( " CurrentCommandTarget: " $ CurrentCommand.CommandTarget ); switch( CurrentCommandCode ) { case CMD_AddAmmo: ExecAddAmmo(); break; case CMD_AgentBind: ExecAgentBind(); break; case CMD_AgentCall: bChangeState = ExecAgentCall(); break; case CMD_AgentExecute: bChangeState = ExecAgentExecute(); case CMD_AgentUnbind: ExecAgentUnbind(); break; case CMD_AnimLoop: case CMD_AnimPlay: case CMD_AnimTween: bChangeState = ExecAnim( CurrentCommandCode, 0 ); break; case CMD_AnimLoopEx: case CMD_AnimPlayEx: case CMD_AnimTweenEx: bChangeState = ExecAnim( CurrentCommandCode, ArgsInt[0] ); break; case CMD_AnimRelease: ExecAnimRelease(); break; case CMD_Call: ExecCall(); break; case CMD_CallScript: ExecCallScript(); break; case CMD_CallEnd: ExecCallEnd(); break; case CMD_ClearEvents: ExecClearEvents(); break; case CMD_ClearTimers: ExecClearTimers(); break; case CMD_ClearTriggers: //NPCOwner.DMTNS( "CMD_ClearTriggers calling ExecClearTriggers" ); ExecClearTriggers(); break; case CMD_ConsoleCommand: ExecConsoleCommand(); break; case CMD_DebugAI: ExecDebugAI(); break; case CMD_DebugAIEvents: ExecDebugAIEvents(); break; case CMD_DebugAIFlags: ExecDebugAIFlags(); break; case CMD_DebugMode: ExecDebugMode(); break; case CMD_DecProperty: ExecDecProperty(); break; case CMD_DeployInventory: ExecDeployInventory(); break; case CMD_Destroy: ExecDestroy(); break; case CMD_DialogDisable: ExecDialogDisable(); break; case CMD_DialogEnable: ExecDialogEnable(); break; case CMD_DialogFar: ExecDialogFar( false ); break; case CMD_DialogFarWait: bChangeState = ExecDialogFar( true ); break; case CMD_DialogInitiate: ExecDialogInitiate(); break; case CMD_DialogTerminate: ExecDialogTerminate(); break; case CMD_DirectionalPatrol: ExecDirectionalPatrol(); break; case CMD_Dormant: ExecDormant(); break; case CMD_DropInventory: ExecDropInventory(); break; case CMD_EnableProbeEvent: ExecEnableProbeEvent(); break; case CMD_EventDisable: ExecEventDisable(); break; case CMD_EventEnable: ExecEventEnable(); break; case CMD_EventWait: ExecEventWait(); bChangeState = true; break; case CMD_FindActor: ExecFindActor(); break; case CMD_Fire: ExecFire(); bChangeState = true; break; case CMD_FireAlt: ExecFireAlt(); bChangeState = true; break; case CMD_Gib: ExecGib(); break; case CMD_GibAll: ExecGibAll(); break; case CMD_GiveInventory: ExecGiveInventory(); break; case CMD_GiveItemToPlayer: ExecGiveItemToPlayer(); break; case CMD_GiveTossedItem: ExecGiveTossedItem(); break; case CMD_GotoActor: ExecGotoActor(); bChangeState = true; break; case CMD_GotoActorSafe: bChangeState = ExecGotoActorSafe(); break; case CMD_GotoLabel: ExecGotoLabel(); break; case CMD_IncProperty: ExecIncProperty(); break; case CMD_Inert: ExecInert(); break; case CMD_EnableXMPHandling: ExecEnableXMPHandling(); break; case CMD_HandlerGroup: ExecHandlerGroup(); break; case CMD_HandlerGroupEnd: ExecHandlerGroupEnd(); break; case CMD_HeadTracking: ExecHeadTracking(); break; case CMD_Jump: ExecJump(); break; case CMD_Kill: ExecKill(); break; case CMD_KillAll: ExecKillAll(); break; case CMD_LockStep: ExecLockStep(); break; case CMD_Message: ExecMessage(); break; case CMD_OnEvent: ExecOnEvent(); break; case CMD_OnTimer: ExecOnTimer(); break; case CMD_OnTrigger: ExecOnTrigger(); break; case CMD_PlaySound: ExecPlaySound( false ); break; case CMD_PlaySoundWait: bChangeState = ExecPlaySound( true ); break; case CMD_PlaySoundTableSlot: ExecPlaySoundTableSlot( false ); break; case CMD_PlaySoundTableSlotWait: bChangeState = ExecPlaySoundTableSlot( true ); break; case CMD_RemoveInventory: ExecRemoveInventory(); break; case CMD_RemoveInventoryFromPlayer: ExecRemoveInventoryFromPlayer(); break; case CMD_RemoveItemFromPlayer: ExecRemoveItemFromPlayer(); break; case CMD_RemoveTossedItem: ExecRemoveTossedItem(); break; case CMD_ResumePatrol: ExecResumePatrol(); break; case CMD_Return: ExecReturn(); break; case CMD_Rotate: ExecRotate(); break; case CMD_SaveDestination: ExecSaveDestination(); break; case CMD_SendEvent: ExecSendEvent(); break; case CMD_SetActorRangeTest: ExecSetActorRangeTest(); break; case CMD_SetAimOdds: ExecSetAimOdds(); break; case CMD_SetAlert: ExecSetAlert(); break; case CMD_SetAmmo: ExecSetAmmo(); break; case CMD_SetFocus: ExecSetFocus(); break; case CMD_SetHealth: ExecSetHealth(); break; case CMD_SetInventory: ExecSetInventory(); break; case CMD_SetLocation: ExecSetLocation(); break; case CMD_SetLocationNamed: ExecSetLocationNamed(); break; case CMD_SetLocationVector: ExecSetLocationVector(); break; case CMD_SetMoveSpeed: ExecSetMoveSpeed(); break; case CMD_SetMoveSpeedAuto: ExecSetMoveSpeedAuto(); break; case CMD_SetOrders: ExecSetOrders(); break; case CMD_SetPhysics: ExecSetPhysics(); break; case CMD_SetProperty: ExecSetProperty(); break; case CMD_SetProperties: ExecSetProperties(); break; case CMD_SetSatellite: ExecSetSatellite(); break; case CMD_SetScript: ExecSetScript(); break; case CMD_SetSkill: ExecSetSkill(); break; case CMD_SetStance: bChangeState = ExecSetStance(); break; case CMD_SetStationary: ExecSetStationary(); break; case CMD_SetTacticalMoveType: ExecSetTacticalMoveType(); break; case CMD_SetWeapon: ExecSetWeapon(); break; case CMD_Shutdown: ExecShutdown(); break; case CMD_Sleep: ExecSleep(); bChangeState = true; break; case CMD_SleepRand: ExecSleepRand(); bChangeState = true; break; case CMD_Spawn: ExecSpawn(); break; case CMD_Stop: bChangeState = ExecStop(); break; case CMD_StopMovement: ExecStopMovement(); break; case CMD_StopSound: ExecStopSound(); break; case CMD_TestActorInRange: ExecTestActorInRange(); break; case CMD_TestProperty: ExecTestProperty(); break; case CMD_TestPropertyCI: ExecTestPropertyCI(); break; case CMD_TestPropertyE: ExecTestPropertyE(); break; case CMD_TestPropertyG: ExecTestPropertyG(); break; case CMD_TestPropertyGE: ExecTestPropertyGE(); break; case CMD_TestPropertyL: ExecTestPropertyL(); break; case CMD_TestPropertyLE: ExecTestPropertyLE(); break; case CMD_TestRandom: ExecTestRandom(); break; case CMD_TestState: ExecTestState(); break; case CMD_TurnToActor: bChangeState = ExecTurnToActor(); break; case CMD_Unuse: ExecUnuse(); break; case CMD_Use: ExecUse(); break; case CMD_UsePickups: ExecUsePickups(); break; case CMD_WeaponLoad: ExecWeaponLoad(); break; case CMD_WeaponSetAmmoType: ExecWeaponSetAmmoType(); break; case CMD_WeaponSupportsAltFire: ExecWeaponSupportsAltFire(); break; case CMD_WeaponSupportsFire: ExecWeaponSupportsFire(); break; default: SetScriptError( "invalid CMD in ExecuteCommand?!" ); break; } if( ScriptErrorMessage != "" ) { ScriptError(); bChangeState = true; } //!!!Log( "ExecuteCommand - End" ); return bChangeState; } // ExecuteCommand //----------------------------------------------------------------------------- // STATES //----------------------------------------------------------------------------- function ResumeExecuting() { if( NPCOwner.IsDialogPaused() ) GotoState( WaitDialogPausedState ); else GotoState( ExecuteCommandsState ); } //----------------------------------------------------------------------------- // Note: no state code since object-derived unless we add support for this. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Some error occured. The controlled NPC should already have been turned red, // but periodically broadcast a message so that its pretty obvious there is a // problem (in case the NPC isn't immediately visible). Also, Trace debugger // should show current error. state @ BroadcastErrorState { //------------------------------------------------------------------------- function BroadcastErrorMessage() { // mdf-tbd: hack fix for ProcessEvent crash if owner killed while not attached to this controller if( NPCOwner != None && U2PawnOwner.Health <= 0 ) { RemoveTimer( BroadcastErrorMessageTimerName ); } else if( NPCOwner != None ) { NPCOwner.BM( ScriptErrorMessage ); } } //------------------------------------------------------------------------- function string GetDebugInformation1() { return Global.GetDebugInformation1() $ " " $ ScriptErrorMessage; } //------------------------------------------------------------------------- event BeginState() { ScriptErrorMessage = U2PawnOwner.Name $ " (" $ CommandFileName $ DefaultExt $ ") " $ ScriptErrorMessage $ " (" $ Commands[ CurrentCommandIndex-1 ].CommandString $ ")"; BroadcastErrorMessage(); // mdf-tbd: I'd like to see bRepeat replaced with a optional float RepeatFrequency for flexibility // also, repeat rate appears to be 1/2 what it should be? if( ErrorMessageFrequency > 0.0 ) AddTimer( BroadcastErrorMessageTimerName, ErrorMessageFrequency, true ); } //------------------------------------------------------------------------- event EndState() { RemoveTimer( BroadcastErrorMessageTimerName ); } } //----------------------------------------------------------------------------- // state ExecuteCommands // // Decode the next command and execute it. For many commands this will involve // switching to another state which will wait for a specific event which // indicates that the command has been completed (e.g. gotoactor). /*tbr: don't want to start in this automatically: auto*/ state @ ExecuteCommandsState { event BeginState() { local bool bChangeState; local bool bDecodeResult; // MAIN SCRIPT CONTROLLER EXECUTION LOOP -- this is where commands are decoded and executed bChangeState = false; while( (NPCOwner != None) && !bChangeState ) { bDecodeResult = DecodeCommand( false, true ); if( bDecodeResult ) { if( CurrentCommand.CommandIndex != CommandsListIndex_Label ) bChangeState = ExecuteCommand(); CurrentCommandIndex++; } else { bChangeState = true; ScriptError(); } } } } //----------------------------------------------------------------------------- // mdf-tbd: sometimes animend is never happening? Maybe adding check for // IsAnimating before going to this state will fix this? state @ ChangingStanceState { function StanceChangeDone() { ResumeExecuting(); } //------------------------------------------------------------------------- event BeginState() { //NPCOwner.DMTNS( "BeginState" ); // just wait a fixed amount of time before continuing since we aren't using animations currently AddTimer( StanceChangeDoneTimerName, 1.0 ); } } //----------------------------------------------------------------------------- state @ DetachingState { event BeginState() { GotoState( NoState ); CleanupScriptController(); } } //----------------------------------------------------------------------------- // If no time was given will sleep indefinitely (an onevent will be needed to // wake up the controller). If a time was given, will sleep for the given // length of time unless an onevent is handled. state @ SleepingState { //------------------------------------------------------------------------- // note: objects can't use script code or latent functions and don't get Ticked or Timer events function ResumeProcessing() { RemoveTimer( ResumeProcessingTimerName ); ResumeExecuting(); } //------------------------------------------------------------------------- function string GetDebugInformation1() { return Global.GetDebugInformation1() $ " " $ class'Util'.static.GetFloatString(TimeRemaining( 'ResumeProcessing' )); } //------------------------------------------------------------------------- event BeginState() { if( ArgsFloat[0] > 0.0 ) { AddTimer( ResumeProcessingTimerName, ArgsFloat[0] ); } } //------------------------------------------------------------------------- event EndState() { RemoveTimer( ResumeProcessingTimerName ); } } //----------------------------------------------------------------------------- // mdf-tbd: pbly more flexible to have fire [0|1] and firealt [0|1] so these // can be used to start firing, navigate to some location and/or sleep etc. // then turn firing off. state @ FiringState { //------------------------------------------------------------------------- function RemoveFiringTimers() { RemoveTimer( StopFiringTimerName ); RemoveTimer( StopFiringBackupTimerName ); } //------------------------------------------------------------------------- function DoStopFiring() { //NPCOwner.DMTNS( "StopFiring BEGIN bFire:" $ NPCOwner.bFire $ " bAltFire: " $ NPCOwner.bAltFire ); RemoveFiringTimers(); #debug NPCOwner.StopFiring( 0.0, SFI_Behavior, GetContext() ); #release NPCOwner.StopFiring( 0.0, SFI_Behavior ); //NPCOwner.DMTNS( "StopFiring END bFire:" $ NPCOwner.bFire $ " bAltFire: " $ NPCOwner.bAltFire ); ResumeExecuting(); } //------------------------------------------------------------------------- function StopFiring() { DoStopFiring(); } //------------------------------------------------------------------------- function StopFiringBackup() { DoStopFiring(); } //------------------------------------------------------------------------- // NPC letting us know that firing has started (NPC rotation is ok and // weapon is prepared to fire). function StartScriptedFiring() { local float StopFiringTime; // firing has started (might have had to wait for rotation), so start timing now if( ArgsFloat[0] < 0.0 ) { if( NPCOwner.IsRepeatFire( ArgsByte[ 0 ] == 0 ) ) StopFiringTime = -ArgsFloat[0]; // fire continuously for repeat fire weapons else StopFiringTime = 0.0; // fire single shot for non-repeating weapons -- stop firing with next tick } else { StopFiringTime = ArgsFloat[0]; } //NPCOwner.DMTNS( "Add StopFiring Timer: " $ StopFiringTime ); AddTimer( StopFiringTimerName, StopFiringTime ); } //------------------------------------------------------------------------- event BeginState() { //NPCOwner.DMTNS( "FiringState.BeginState BEGIN bFire:" $ NPCOwner.bFire $ " bAltFire: " $ NPCOwner.bAltFire ); NPCOwner.MaybeFire( ArgsByte[0] ); AddTimer( StopFiringBackupTimerName, FMax( 2.0, Abs( ArgsFloat[0] ) ) ); // just in case StartScriptedFiring never called //NPCOwner.DMTNS( "FiringState.BeginState END bFire:" $ NPCOwner.bFire $ " bAltFire: " $ NPCOwner.bAltFire ); } //------------------------------------------------------------------------- event EndState() { RemoveFiringTimers(); } } //----------------------------------------------------------------------------- state @ WaitActorInRangeState { //------------------------------------------------------------------------- function eventSCActorInRange( U2NPCControllerScriptable NPC ) { Global.eventSCActorInRange( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitActorOutOfRangeState { //------------------------------------------------------------------------- function eventSCActorOutOfRange( U2NPCControllerScriptable NPC ) { Global.eventSCActorOutOfRange( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitAnimEndState { //------------------------------------------------------------------------- function eventSCAnimEnd( U2NPCControllerScriptable NPC, int Channel ) { Global.eventSCAnimEnd( NPC, Channel ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitBumpEnemyState { //------------------------------------------------------------------------- function eventSCBumpEnemy( U2NPCControllerScriptable NPC, Pawn Other ) { Global.eventSCBumpEnemy( NPC, Other ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitBumpFriendState { //------------------------------------------------------------------------- function eventSCBumpFriend( U2NPCControllerScriptable NPC, Pawn Other ) { Global.eventSCBumpFriend( NPC, Other ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitBumpOtherState { //------------------------------------------------------------------------- function eventSCBumpOther( U2NPCControllerScriptable NPC, Actor Other ) { Global.eventSCBumpOther( NPC, Other ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitBumpPlayerState { //------------------------------------------------------------------------- function bool eventSCBumpPlayer( U2NPCControllerScriptable NPC, Pawn Other, bool bFriendly ) { local bool bResult; bResult = Global.eventSCBumpPlayer( NPC, Other, bFriendly ); ResumeExecuting(); return bResult; } } //----------------------------------------------------------------------------- state @ WaitDestinationReachedState { //------------------------------------------------------------------------- function string GetDebugInformation1() { return Global.GetDebugInformation1() $ " Destination: " $ GotoActorTarget; } //------------------------------------------------------------------------- function eventSCDestinationReached( U2NPCControllerScriptable NPC ) { Global.eventSCDestinationReached( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- // If any latent command (animplay, eventwait, sleep etc.) ends while the NPC // is handling a dialog node with bPauseNPC=true, the script controller is put // into this state rather than resuming the execution of the script. When this // happens, the only way that script execution can resume is // // a) if the dialog ends or is unpaused -- eventSCDialogUnPaused generated // b) a timer expires or an ontrigger event arrives // // TBD: for any given dialog, we don't currently support pausing more than // once and if the script is unpaused (via a or b above), it will not be // paused again (even if a latent function executes and the current dialog // is still paused) until a new dialog starts. TBD: maybe nodes which have // bUnPauseNPC=true can reset this? state @ WaitDialogPausedState { function eventSCDialogUnPause( U2NPCControllerScriptable NPC ) { Global.eventSCDialogUnPause( NPC ); GotoState( ExecuteCommandsState ); } } //----------------------------------------------------------------------------- // This state waits for the current DialogFar command to finish. // Once the dialog between the NPC(s) finishes, resume script execution. state @ WaitDialogFarPausedState { function eventSCDialogUnPause( U2NPCControllerScriptable NPC ) { Global.eventSCDialogUnPause( NPC ); GotoState( ExecuteCommandsState ); } } //----------------------------------------------------------------------------- // Only used through WaitDestinationReached if NPC is using a directional // patrol and the movetarget is bDirectional to wait for the NPC to line itself // up with the movetarget. state @ WaitFinishedRotationState { //------------------------------------------------------------------------- function eventSCFinishedRotation( U2NPCControllerScriptable NPC ) { Global.eventSCFinishedRotation( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitDialogBeginState { //------------------------------------------------------------------------- function eventSCDialogBegin( U2NPCControllerScriptable NPC ) { Global.eventSCDialogBegin( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitDiedState { //------------------------------------------------------------------------- function eventSCDied( U2NPCControllerScriptable NPC ) { Global.eventSCDied( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitHearNoiseFriendlyState { //------------------------------------------------------------------------- function eventSCHearNoiseFriendly( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { Global.eventSCHearNoiseFriendly( NPC, Loudness, NoiseMaker ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitHearNoiseOtherState { //------------------------------------------------------------------------- function eventSCHearNoiseOther( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { Global.eventSCHearNoiseOther( NPC, Loudness, NoiseMaker ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitHearNoiseThreatState { //------------------------------------------------------------------------- function eventSCHearNoiseThreat( U2NPCControllerScriptable NPC, float Loudness, Actor NoiseMaker ) { Global.eventSCHearNoiseThreat( NPC, Loudness, NoiseMaker ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitScriptedLandingState { //------------------------------------------------------------------------- function eventSCScriptedLanding( U2NPCControllerScriptable NPC ) { Global.eventSCScriptedLanding( NPC ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitSeeEnemyState { //------------------------------------------------------------------------- function eventSCSeeEnemy( U2NPCControllerScriptable NPC, Pawn Seen ) { Global.eventSCSeeEnemy( NPC, Seen ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitSeeFriendState { //------------------------------------------------------------------------- function eventSCSeeFriend( U2NPCControllerScriptable NPC, Pawn Seen ) { Global.eventSCSeeFriend( NPC, Seen ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitSeeOtherState { //------------------------------------------------------------------------- function eventSCSeeOther( U2NPCControllerScriptable NPC, Actor Seen ) { Global.eventSCSeeOther( NPC, Seen ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitSeePlayerState { //------------------------------------------------------------------------- function bool eventSCSeePlayer( U2NPCControllerScriptable NPC, Pawn Seen, bool bFriendly ) { local bool bResult; bResult = Global.eventSCSeePlayer( NPC, Seen, bFriendly ); ResumeExecuting(); return bResult; } } //----------------------------------------------------------------------------- state @ WaitTakeDamageState { //------------------------------------------------------------------------- function eventSCTakeDamage( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { Global.eventSCTakeDamage( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitTookDamageState { function eventSCTookDamage( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { Global.eventSCTookDamage( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitTookDamageEnemyState { function eventSCTookDamageEnemy( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { Global.eventSCTookDamageEnemy( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitTookDamageFriendState { function eventSCTookDamageFriend( U2NPCControllerScriptable NPC, int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType ) { Global.eventSCTookDamageFriend( NPC, Damage, EventInstigator, HitLocation, Momentum, DamageType ); ResumeExecuting(); } } //----------------------------------------------------------------------------- state @ WaitTriggerState { //------------------------------------------------------------------------- function eventSCTrigger( U2NPCControllerScriptable NPC, Actor Other, Pawn Instigator, name EventName ) { Global.eventSCTrigger( NPC, Other, Instigator, EventName ); if( WaitTriggerEvent == '' || (EventName == WaitTriggerEvent) ) { ResumeExecuting(); } } //------------------------------------------------------------------------- event BeginState() { WaitTriggerEvent = ArgsName[1]; } } //----------------------------------------------------------------------------- function string GetDebugInformation1() { return string(Name) $ " (State=" $ GetStateName() $ " File=" $ CommandFileName $ DefaultExt $ " Cmd=" $ CurrentCommandIndex $ "/" $ Commands.Length $ "/" $ DecodedCount $ ")"; } //----------------------------------------------------------------------------- function GetEventInformation( out array<string> ReturnedStrings ) { local int ii; local int StrIndex; local int AddedStrs; StrIndex = ReturnedStrings.Length; ReturnedStrings[ StrIndex ] = " Handlers: "; // show events which are being handled if( NumEvents > 0 ) { for( ii=0; ii<NumEvents; ii++ ) { if( Events[ii].OnCmdIndex >= 0 ) { AddedStrs++; if( (AddedStrs % 5) == 0 ) { StrIndex++; ReturnedStrings[ StrIndex ] = " "; } ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ Events[ii].EventName $ "(->" $ Events[ii].OnCmdIndex $ "!" $ Events[ii].Group $ ") "; } } } if( AddedStrs == 0 ) ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ "NA"; } //----------------------------------------------------------------------------- function GetTriggerInformation( out array<string> ReturnedStrings ) { local int ii; local int StrIndex; local int AddedStrs; StrIndex = ReturnedStrings.Length; ReturnedStrings[ StrIndex ] = " Triggers: "; // show triggers which are being handled if( NumTriggerEvents > 0 ) { for( ii=0; ii<NumTriggerEvents; ii++ ) { AddedStrs++; if( (AddedStrs % 5) == 0 ) { StrIndex++; ReturnedStrings[ StrIndex ] = " "; } ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ TriggerEvents[ii].EventName $ "(->" $ TriggerEvents[ii].OnCmdIndex $ "!" $ TriggerEvents[ii].Group $ " "; if( TriggerEvents[ii].TimerIndex != -1 ) ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ " @ " $ class'Util'.static.GetFloatString(HandleTimeRemaining(TriggerEvents[ii].TimerIndex )) $ "->" $ Timers[TriggerEvents[ii].TimerIndex].OnCmdIndex; ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ ") "; } } else { ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ "NA"; } } //----------------------------------------------------------------------------- function GetTimerInformation( out array<string> ReturnedStrings ) { local int ii; local int StrIndex; local int AddedStrs; StrIndex = ReturnedStrings.Length; ReturnedStrings[ StrIndex ] = " Timers: "; // show non-trigger timers which are being handled for( ii=0; ii<MaxGeneralTimers; ii++ ) { if( Timers[ii].OnCmdIndex != -1 ) { AddedStrs++; if( (AddedStrs % 5) == 0 ) { StrIndex++; ReturnedStrings[ StrIndex ] = " "; } ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ ii $ " " $ class'Util'.static.GetFloatString(HandleTimeRemaining( ii )) $ "/" $ class'Util'.static.GetFloatString(Timers[ii].RepeatFrequency) $ "(->" $ Timers[ii].OnCmdIndex $ "!" $ Timers[ii].Group $ ") "; } } if( AddedStrs == 0 ) ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ "NA"; } //----------------------------------------------------------------------------- function GetDisabledInformation( out array<string> ReturnedStrings ) { local int ii; local int StrIndex; local int AddedStrs; StrIndex = ReturnedStrings.Length; ReturnedStrings[ StrIndex ] = " Disabled: "; // show events which are disabled for( ii=0; ii<NumEvents; ii++ ) { if( !Events[ii].bEnabled ) { AddedStrs++; if( (AddedStrs % 10) == 0 ) { StrIndex++; ReturnedStrings[ StrIndex ] = " "; } ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ Events[ii].EventName $ " "; } } if( AddedStrs == 0 ) ReturnedStrings[ StrIndex ] = ReturnedStrings[ StrIndex ] $ "NA"; } //----------------------------------------------------------------------------- function GetDebugInformation( U2NPCControllerScriptable NPC, out array<string> ReturnedStrings ) { ReturnedStrings[ 0 ] = GetDebugInformation1( ); GetEventInformation( ReturnedStrings ); GetTriggerInformation( ReturnedStrings ); GetTimerInformation( ReturnedStrings ); GetDisabledInformation( ReturnedStrings ); } //----------------------------------------------------------------------------- function string GetScriptContextStr( optional bool bMinimal ) { local string ReturnedStr; local string ControllerStr; if( bMinimal ) { if( NPCOwner != None ) { if( NPCOwner.Pawn != None ) ReturnedStr = "Pawn=" $ NPCOwner.Pawn.Name; else ReturnedStr = "Controller=" $ NPCOwner.Name; } else { ReturnedStr = "NPCOwner=None"; } } else { if( NPCOwner != None ) { ControllerStr = "Controller=" $ NPCOwner.Name $ "." $ NPCOwner.GetStateName() $ " SCState=" $ GetStateName(); if( NPCOwner.Pawn != None ) ReturnedStr = "Pawn=" $ NPCOwner.Pawn.Name $ "." $ NPCOwner.Pawn.GetStateName() $ " " $ ControllerStr; else ReturnedStr = "Pawn=None " $ ControllerStr; } else { ReturnedStr = "NPCOwner=None " $ GetStateName(); } } return "(" $ ReturnedStr $ ")"; } //----------------------------------------------------------------------------- function DMH( coerce string Str ) { if( NPCOwner != None ) NPCOwner.BM( "SC: " $ Str ); Log( Str, 'SC' ); } //----------------------------------------------------------------------------- // Script logging helper. All calls to this should be removed/disabled before // shipping with the exception of Debug_Command logs which are always handy. // Note that internal errors should go through DMs/logs or SetScriptError // instead of DMSC so that these aren't only visible when debugging is enabled // and remain after shipping. function DMSC( coerce string Str, optional bool bStrict ) { if( DebugMode != 0 ) { if( bStrict ) { // don't add anything to string if( NPCOwner != None ) NPCOwner.DMT( Str, false, false, 'SC' ); else Log( Str, 'SC' ); } else { Str = Str $ " " $ GetScriptContextStr( true ); if( NPCOwner != None ) NPCOwner.DMT( Str, false, false, 'SC' ); else Log( Str, 'SC' ); } } } //----------------------------------------------------------------------------- defaultproperties { ErrorMessageFrequency=3.000000 CommandInfo(0)=(CommandString="error",CommandCode=CMD_Error,Signature="X") CommandInfo(1)=(CommandString="addammo",CommandCode=CMD_AddAmmo,Signature="SIb") CommandInfo(2)=(CommandString="agentbind",CommandCode=CMD_AgentBind,Signature="MM") CommandInfo(3)=(CommandString="agentcall",CommandCode=CMD_AgentCall,Signature="Mb") CommandInfo(4)=(CommandString="agentexecute",CommandCode=CMD_AgentExecute,Signature="Sb") CommandInfo(5)=(CommandString="agentunbind",CommandCode=CMD_AgentUnbind,Signature="M") CommandInfo(6)=(CommandString="animloop",CommandCode=CMD_AnimLoop,Signature="Mffb") CommandInfo(7)=(CommandString="animloopex",CommandCode=CMD_AnimLoopEx,Signature="IMffb") CommandInfo(8)=(CommandString="animplay",CommandCode=CMD_AnimPlay,Signature="Mffb") CommandInfo(9)=(CommandString="animplayex",CommandCode=CMD_AnimPlayEx,Signature="IMffb") CommandInfo(10)=(CommandString="animrelease",CommandCode=CMD_AnimRelease,Signature="X") CommandInfo(11)=(CommandString="animtween",CommandCode=CMD_AnimTween,Signature="Mfb") CommandInfo(12)=(CommandString="animtweenex",CommandCode=CMD_AnimTweenEx,Signature="IMfb") CommandInfo(13)=(CommandString="call",CommandCode=CMD_Call,Signature="S") CommandInfo(14)=(CommandString="callend",CommandCode=CMD_CallEnd,Signature="X") CommandInfo(15)=(CommandString="clearevents",CommandCode=CMD_ClearEvents,Signature="X") CommandInfo(16)=(CommandString="cleartimers",CommandCode=CMD_ClearTimers,Signature="X") CommandInfo(17)=(CommandString="cleartriggers",CommandCode=CMD_ClearTriggers,Signature="X") CommandInfo(18)=(CommandString="consolecommand",CommandCode=CMD_ConsoleCommand,Signature="S") CommandInfo(19)=(CommandString="debugai",CommandCode=CMD_DebugAI,Signature="B") CommandInfo(20)=(CommandString="debugaievents",CommandCode=CMD_DebugAIEvents,Signature="B") CommandInfo(21)=(CommandString="debugaiflags",CommandCode=CMD_DebugAIFlags,Signature="I") CommandInfo(22)=(CommandString="debugmode",CommandCode=CMD_DebugMode,Signature="I") CommandInfo(23)=(CommandString="decproperty",CommandCode=CMD_DecProperty,Signature="TSf") CommandInfo(24)=(CommandString="deployinventory",CommandCode=CMD_DeployInventory,Signature="Sb") CommandInfo(25)=(CommandString="destroy",CommandCode=CMD_Destroy,Signature="X") CommandInfo(26)=(CommandString="dialogdisable",CommandCode=CMD_DialogDisable,Signature="M") CommandInfo(27)=(CommandString="dialogenable",CommandCode=CMD_DialogEnable,Signature="M") CommandInfo(28)=(CommandString="dialogfar",CommandCode=CMD_DialogFar,Signature="MSs") CommandInfo(29)=(CommandString="dialogfarwait",CommandCode=CMD_DialogFarWait,Signature="MSs") CommandInfo(30)=(CommandString="dialoginitiate",CommandCode=CMD_DialogInitiate,Signature="sm") CommandInfo(31)=(CommandString="dialogterminate",CommandCode=CMD_DialogTerminate,Signature="S") CommandInfo(32)=(CommandString="directionalpatrol",CommandCode=CMD_DirectionalPatrol,Signature="B") CommandInfo(33)=(CommandString="dormant",CommandCode=CMD_Dormant,Signature="Bb") CommandInfo(34)=(CommandString="dropinventory",CommandCode=CMD_DropInventory,Signature="S") CommandInfo(35)=(CommandString="enableprobeevent",CommandCode=CMD_EnableProbeEvent,Signature="NB") CommandInfo(36)=(CommandString="enablexmphandling",CommandCode=CMD_EnableXMPHandling,Signature="B") CommandInfo(37)=(CommandString="eventdisable",CommandCode=CMD_EventDisable,Signature="N") CommandInfo(38)=(CommandString="eventenable",CommandCode=CMD_EventEnable,Signature="N") CommandInfo(39)=(CommandString="eventwait",CommandCode=CMD_EventWait,Signature="Nn") CommandInfo(40)=(CommandString="findactor",CommandCode=CMD_FindActor,Signature="sffiiiss") CommandInfo(41)=(CommandString="fire",CommandCode=CMD_Fire,Signature="f") CommandInfo(42)=(CommandString="firealt",CommandCode=CMD_FireAlt,Signature="f") CommandInfo(43)=(CommandString="gib",CommandCode=CMD_Gib,Signature="bi") CommandInfo(44)=(CommandString="giball",CommandCode=CMD_GibAll,Signature="Sbi") CommandInfo(45)=(CommandString="giveinventory",CommandCode=CMD_GiveInventory,Signature="S") CommandInfo(46)=(CommandString="giveitemtoplayer",CommandCode=CMD_GiveItemToPlayer,Signature="Si") CommandInfo(47)=(CommandString="givetosseditem",CommandCode=CMD_GiveTossedItem,Signature="S") CommandInfo(48)=(CommandString="gotoactor",CommandCode=CMD_GotoActor,Signature="Tfb") CommandInfo(49)=(CommandString="gotoactorsafe",CommandCode=CMD_GotoActorSafe,Signature="Nfb") CommandInfo(50)=(CommandString="gotolabel",CommandCode=CMD_GotoLabel,Signature="S") CommandInfo(51)=(CommandString="incproperty",CommandCode=CMD_IncProperty,Signature="TSf") CommandInfo(52)=(CommandString="inert",CommandCode=CMD_Inert,Signature="B") CommandInfo(53)=(CommandString="handlergroup",CommandCode=CMD_HandlerGroup,Signature="X") CommandInfo(54)=(CommandString="handlergroupend",CommandCode=CMD_HandlerGroupEnd,Signature="X") CommandInfo(55)=(CommandString="headtracking",CommandCode=CMD_HeadTracking,Signature="B") CommandInfo(56)=(CommandString="jump",CommandCode=CMD_Jump,Signature="FFF") CommandInfo(57)=(CommandString="kill",CommandCode=CMD_Kill,Signature="X") CommandInfo(58)=(CommandString="killall",CommandCode=CMD_KillAll,Signature="S") CommandInfo(59)=(CommandString="message",CommandCode=CMD_Message,Signature="Si") CommandInfo(60)=(CommandString="onevent",CommandCode=CMD_OnEvent,Signature="Nssb") CommandInfo(61)=(CommandString="ontimer",CommandCode=CMD_OnTimer,Signature="Iffssi") CommandInfo(62)=(CommandString="ontrigger",CommandCode=CMD_OnTrigger,Signature="Mssbfss") CommandInfo(63)=(CommandString="playsound",CommandCode=CMD_PlaySound,Signature="TSnfbff") CommandInfo(64)=(CommandString="playsoundwait",CommandCode=CMD_PlaySoundWait,Signature="TSnfbff") CommandInfo(65)=(CommandString="playsoundtableslot",CommandCode=CMD_PlaySoundTableSlot,Signature="TS") CommandInfo(66)=(CommandString="playsoundtableslotwait",CommandCode=CMD_PlaySoundTableSlotWait,Signature="TS") CommandInfo(67)=(CommandString="removeinventory",CommandCode=CMD_RemoveInventory,Signature="s") CommandInfo(68)=(CommandString="removeinventoryfromplayer",CommandCode=CMD_RemoveInventoryFromPlayer,Signature="s") CommandInfo(69)=(CommandString="removeitemfromplayer",CommandCode=CMD_RemoveItemFromPlayer,Signature="S") CommandInfo(70)=(CommandString="removetosseditem",CommandCode=CMD_RemoveTossedItem,Signature="s") CommandInfo(71)=(CommandString="resumepatrol",CommandCode=CMD_ResumePatrol,Signature="SSN") CommandInfo(72)=(CommandString="return",CommandCode=CMD_Return,Signature="X") CommandInfo(73)=(CommandString="savedestination",CommandCode=CMD_SaveDestination,Signature="X") CommandInfo(74)=(CommandString="sendevent",CommandCode=CMD_SendEvent,Signature="MB") CommandInfo(75)=(CommandString="setactorrangetest",CommandCode=CMD_SetActorRangeTest,Signature="NFb") CommandInfo(76)=(CommandString="setaimodds",CommandCode=CMD_SetAimOdds,Signature="F") CommandInfo(77)=(CommandString="setalert",CommandCode=CMD_SetAlert,Signature="B") CommandInfo(78)=(CommandString="setammo",CommandCode=CMD_SetAmmo,Signature="SIb") CommandInfo(79)=(CommandString="setfocus",CommandCode=CMD_SetFocus,Signature="t") CommandInfo(80)=(CommandString="sethealth",CommandCode=CMD_SetHealth,Signature="I") CommandInfo(81)=(CommandString="setinventory",CommandCode=CMD_SetInventory,Signature="TS") CommandInfo(82)=(CommandString="setlocation",CommandCode=CMD_SetLocation,Signature="Mb") CommandInfo(83)=(CommandString="setlocationnamed",CommandCode=CMD_SetLocationNamed,Signature="TMb") CommandInfo(84)=(CommandString="setlocationvector",CommandCode=CMD_SetLocationVector,Signature="TFFFb") CommandInfo(85)=(CommandString="setmovespeed",CommandCode=CMD_SetMoveSpeed,Signature="Fs") CommandInfo(86)=(CommandString="setmovespeedauto",CommandCode=CMD_SetMoveSpeedAuto,Signature="f") CommandInfo(87)=(CommandString="setorders",CommandCode=CMD_SetOrders,Signature="ntfn") CommandInfo(88)=(CommandString="setphysics",CommandCode=CMD_SetPhysics,Signature="NM") CommandInfo(89)=(CommandString="setproperty",CommandCode=CMD_SetProperty,Signature="TSS") CommandInfo(90)=(CommandString="setproperties",CommandCode=CMD_SetProperties,Signature="SSS") CommandInfo(91)=(CommandString="setsatellite",CommandCode=CMD_SetSatellite,Signature="Mt") CommandInfo(92)=(CommandString="setscript",CommandCode=CMD_SetScript,Signature="Ss") CommandInfo(93)=(CommandString="setskill",CommandCode=CMD_SetSkill,Signature="F") CommandInfo(94)=(CommandString="setstance",CommandCode=CMD_SetStance,Signature="S") CommandInfo(95)=(CommandString="setstationary",CommandCode=CMD_SetStationary,Signature="Bb") CommandInfo(96)=(CommandString="settacticalmovetype",CommandCode=CMD_SetTacticalMoveType,Signature="I") CommandInfo(97)=(CommandString="setweapon",CommandCode=CMD_SetWeapon,Signature="s") CommandInfo(98)=(CommandString="shutdown",CommandCode=CMD_Shutdown,Signature="B") CommandInfo(99)=(CommandString="sleep",CommandCode=CMD_Sleep,Signature="f") CommandInfo(100)=(CommandString="sleeprand",CommandCode=CMD_SleepRand,Signature="f") CommandInfo(101)=(CommandString="spawn",CommandCode=CMD_Spawn,Signature="TSbss") CommandInfo(102)=(CommandString="stop",CommandCode=CMD_Stop,Signature="X") CommandInfo(103)=(CommandString="stopmovement",CommandCode=CMD_StopMovement,Signature="X") CommandInfo(104)=(CommandString="stopsound",CommandCode=CMD_StopSound,Signature="TNb") CommandInfo(105)=(CommandString="testactorinrange",CommandCode=CMD_TestActorInRange,Signature="NFss") CommandInfo(106)=(CommandString="testproperty",CommandCode=CMD_TestProperty,Signature="TSSss") CommandInfo(107)=(CommandString="testpropertyci",CommandCode=CMD_TestPropertyCI,Signature="TSSss") CommandInfo(108)=(CommandString="testpropertye",CommandCode=CMD_TestPropertyE,Signature="TSSss") CommandInfo(109)=(CommandString="testpropertyg",CommandCode=CMD_TestPropertyG,Signature="TSSss") CommandInfo(110)=(CommandString="testpropertyge",CommandCode=CMD_TestPropertyGE,Signature="TSSss") CommandInfo(111)=(CommandString="testpropertyl",CommandCode=CMD_TestPropertyL,Signature="TSSss") CommandInfo(112)=(CommandString="testpropertyle",CommandCode=CMD_TestPropertyLE,Signature="TSSss") CommandInfo(113)=(CommandString="testrandom",CommandCode=CMD_TestRandom,Signature="Fss") CommandInfo(114)=(CommandString="teststate",CommandCode=CMD_TestState,Signature="TNss") CommandInfo(115)=(CommandString="turntoactor",CommandCode=CMD_TurnToActor,Signature="tib") CommandInfo(116)=(CommandString="use",CommandCode=CMD_Use,Signature="T") CommandInfo(117)=(CommandString="unuse",CommandCode=CMD_Unuse,Signature="T") CommandInfo(118)=(CommandString="weaponload",CommandCode=CMD_WeaponLoad,Signature="X") CommandInfo(119)=(CommandString="weaponsetammotype",CommandCode=CMD_WeaponSetAmmoType,Signature="S") CommandInfo(120)=(CommandString="weaponsupportsaltfire",CommandCode=CMD_WeaponSupportsAltFire,Signature="NB") CommandInfo(121)=(CommandString="weaponsupportsfire",CommandCode=CMD_WeaponSupportsFire,Signature="NB") Events(0)=(EventName=ActorInRange,EventWaitState=WaitActorInRange,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(1)=(EventName=ActorOutOfRange,EventWaitState=WaitActorOutOfRange,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(2)=(EventName=AnimEnd,bEnabled=true,OnCmdIndex=-1) Events(3)=(EventName=AutoBegin,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(4)=(EventName=AutoEnd,bEnabled=true,OnCmdIndex=-1) Events(5)=(EventName=BumpEnemy,EventWaitState=WaitBumpEnemy,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(6)=(EventName=BumpFriend,EventWaitState=WaitBumpFriend,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(7)=(EventName=BumpOther,EventWaitState=WaitBumpOther,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(8)=(EventName=BumpPlayer,EventWaitState=WaitBumpPlayer,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(9)=(EventName=DestinationReached,EventWaitState=WaitDestinationReached,bEnabled=true,OnCmdIndex=-1) Events(10)=(EventName=DialogBegin,EventWaitState=WaitDialogBegin,bEnabled=true,OnCmdIndex=-1) Events(11)=(EventName=DialogUnPause,bEnabled=true,OnCmdIndex=-1) Events(12)=(EventName=Died,EventWaitState=WaitDied,bEnabled=true,OnCmdIndex=-1) Events(13)=(EventName=EnemyNotVisible,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(14)=(EventName=HearNoiseFriendly,EventWaitState=WaitHearNoiseFriendly,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(15)=(EventName=HearNoiseOther,EventWaitState=WaitHearNoiseOther,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(16)=(EventName=HearNoiseThreat,EventWaitState=WaitHearNoiseThreat,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(17)=(EventName=InheritEnemy,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(18)=(EventName=ScriptedLanding,EventWaitState=WaitScriptedLanding,bEnabled=true,OnCmdIndex=-1) Events(19)=(EventName=SeeAlertFriend,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(20)=(EventName=SeeEnemy,EventWaitState=WaitSeeEnemy,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(21)=(EventName=SeeFriend,EventWaitState=WaitSeeFriend,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(22)=(EventName=SeeOther,EventWaitState=WaitSeeOther,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(23)=(EventName=SeePlayer,EventWaitState=WaitSeePlayer,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(24)=(EventName=TakeDamage,EventWaitState=WaitTakeDamage,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(25)=(EventName=TookDamage,EventWaitState=WaitTookDamage,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) Events(26)=(EventName=TookDamageEnemy,EventWaitState=WaitTookDamageEnemy,bEnabled=true,OnCmdIndex=-1) Events(27)=(EventName=TookDamageFriend,EventWaitState=WaitTookDamageFriend,bEnabled=true,OnCmdIndex=-1) Events(28)=(EventName=Trigger,EventWaitState=WaitTrigger,bEnabled=true,bCanToggle=true,OnCmdIndex=-1) NextHandlerGroupIndex=1 bHasScript=true } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |