加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
NPCs.bb 254.25 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461
;[Block]
Global Curr173.NPCs, Curr106.NPCs, Curr096.NPCs, Curr5131.NPCs
Const NPCtype173% = 1, NPCtypeOldMan% = 2, NPCtypeGuard% = 3, NPCtypeD% = 4
Const NPCtype372% = 6, NPCtypeApache% = 7, NPCtypeMTF% = 8, NPCtype096 = 9
Const NPCtype049% = 10, NPCtypeZombie% = 11, NPCtype5131% = 12, NPCtypeTentacle% = 13
Const NPCtype860% = 14, NPCtype939% = 15, NPCtype066% = 16, NPCtypePdPlane% = 17
Const NPCtype966% = 18, NPCtype1048a = 19, NPCtype1499% = 20, NPCtype008% = 21, NPCtypeClerk% = 22
;[End Block]
Type NPCs
Field obj%, obj2%, obj3%, obj4%, Collider%
Field NPCtype%, ID%
Field DropSpeed#, Gravity%
Field State#, State2#, State3#, PrevState%
Field MakingNoise%
Field Frame#
Field Angle#
Field Sound%, SoundChn%, SoundTimer#
Field Sound2%, SoundChn2%
Field Speed#, CurrSpeed#
Field texture$
Field Idle#
Field Reload#
Field LastSeen%, LastDist#
Field PrevX#, PrevY#, PrevZ#
Field Target.NPCs, TargetID%
Field EnemyX#, EnemyY#, EnemyZ#
Field Path.WayPoints[20], PathStatus%, PathTimer#, PathLocation%
Field NVX#,NVY#,NVZ#,NVName$
Field GravityMult# = 1.0
Field MaxGravity# = 0.2
Field MTFVariant%
Field MTFLeader.NPCs
Field IsDead%
Field BlinkTimer# = 1.0
Field IgnorePlayer%
Field ManipulateBone%
Field ManipulationType%
Field BoneToManipulate$
Field BonePitch#
Field BoneYaw#
Field BoneRoll#
Field NPCNameInSection$
Field InFacility% = True
Field CanUseElevator% = False
Field CurrElevator.ElevatorObj
Field HP%
Field PathX#,PathZ#
Field Model$
Field ModelScaleX#,ModelScaleY#,ModelScaleZ#
Field HideFromNVG
Field TextureID%=-1
Field CollRadius#
Field IdleTimer#
Field SoundChn_IsStream%,SoundChn2_IsStream%
Field FallingPickDistance#
End Type
Function CreateNPC.NPCs(NPCtype%, x#, y#, z#)
Local n.NPCs = New NPCs, n2.NPCs
Local temp#, i%, diff1, bump1, spec1
Local sf, b, t1
n\NPCtype = NPCtype
n\GravityMult = 1.0
n\MaxGravity = 0.2
n\CollRadius = 0.2
n\FallingPickDistance = 10
Select NPCtype
Case NPCtype173
;[Block]
n\NVName = "SCP-173"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.23, 0.32
EntityType n\Collider, HIT_PLAYER
n\Gravity = True
n\obj = LoadMesh_Strict("GFX\npcs\173_2.b3d")
;On Halloween set jack-o-latern texture.
If (Left(CurrentDate(), 7) = "31 Oct ") Then
HalloweenTex = True
Local texFestive = LoadTexture_Strict("GFX\npcs\173h.pt", 1)
EntityTexture n\obj, texFestive, 0, 0
FreeTexture texFestive
EndIf
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-173", "scale") / MeshDepth(n\obj))
ScaleEntity n\obj, temp,temp,temp
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-173", "speed") / 100.0)
n\obj2 = LoadMesh_Strict("GFX\173box.b3d")
ScaleEntity n\obj2, RoomScale, RoomScale, RoomScale
HideEntity n\obj2
n\CollRadius = 0.32
;[End Block]
Case NPCtypeOldMan
;[Block]
n\NVName = "SCP-106"
n\Collider = CreatePivot()
n\GravityMult = 0.0
n\MaxGravity = 0.0
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\106_2.b3d")
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-106", "scale") / 2.2)
ScaleEntity n\obj, temp, temp, temp
Local OldManEyes% = LoadTexture_Strict("GFX\npcs\oldmaneyes.jpg")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-106", "speed") / 100.0)
n\obj2 = CreateSprite()
ScaleSprite(n\obj2, 0.03, 0.03)
EntityTexture(n\obj2, OldManEyes)
EntityBlend (n\obj2, 3)
EntityFX(n\obj2, 1 + 8)
SpriteViewMode(n\obj2, 2)
FreeTexture OldManEyes%
;[End Block]
Case NPCtypeGuard
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
;EntityRadius Collider, 0.15, 0.30
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(GuardObj) ;LoadAnimMesh_Strict("GFX\npcs\mtf.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "Guard", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "Guard", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(GuardObj), -MeshHeight(GuardObj), -MeshDepth(GuardObj), MeshWidth(GuardObj)*2, MeshHeight(GuardObj)*2, MeshDepth(GuardObj)*2)
;[End Block]
Case NPCtypeMTF
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
;EntityRadius Collider, 0.15, 0.30
EntityType n\Collider, HIT_PLAYER
;EntityPickMode n\Collider, 1
n\obj = CopyEntity(MTFObj) ;LoadAnimMesh_Strict("GFX\npcs\mtf.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "MTF", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "MTF", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(MTFObj), -MeshHeight(MTFObj), -MeshDepth(MTFObj), MeshWidth(MTFObj)*2, MeshHeight(MTFObj)*2, MeshDepth(MTFObj)*2)
If MTFSFX(0)=0 Then
MTFSFX(0)=LoadSound_Strict("SFX\Character\MTF\ClassD1.ogg")
MTFSFX(1)=LoadSound_Strict("SFX\Character\MTF\ClassD2.ogg")
MTFSFX(2)=LoadSound_Strict("SFX\Character\MTF\ClassD3.ogg")
MTFSFX(3)=LoadSound_Strict("SFX\Character\MTF\ClassD4.ogg")
;MTFSFX(4)=LoadSound_Strict("SFX\Character\MTF\Tesla0.ogg")
MTFSFX(5)=LoadSound_Strict("SFX\Character\MTF\Beep.ogg")
MTFSFX(6)=LoadSound_Strict("SFX\Character\MTF\Breath.ogg")
EndIf
If MTFrooms[6]=Null Then
For r.Rooms = Each Rooms
Select Lower(r\RoomTemplate\Name)
Case "room106"
MTFrooms[0]=r
Case "roompj"
MTFrooms[1]=r
Case "room079"
MTFrooms[2]=r
Case "room2poffices"
MTFrooms[3]=r
Case "914"
MTFrooms[4]=r
Case "coffin"
MTFrooms[5]=r
Case "start"
MTFrooms[6]=r
End Select
Next
EndIf
;[End Block]
Case NPCtypeD
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.32
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(ClassDObj)
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(ClassDObj), -MeshHeight(ClassDObj), -MeshDepth(ClassDObj), MeshWidth(ClassDObj)*2, MeshHeight(ClassDObj)*2, MeshDepth(ClassDObj)*2)
n\CollRadius = 0.32
;[End Block]
Case NPCtype372
;[Block]
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = LoadAnimMesh_Strict("GFX\npcs\372.b3d")
temp# = 0.35 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
;[End Block]
Case NPCtype5131
;[Block]
n\NVName = "SCP-513-1"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = LoadAnimMesh_Strict("GFX\npcs\bll.b3d")
n\obj2 = CopyEntity (n\obj)
EntityAlpha n\obj2, 0.6
temp# = 1.8 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
ScaleEntity n\obj2, temp, temp, temp
;[End Block]
Case NPCtype096
;[Block]
n\NVName = "SCP-096"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.26
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp096.b3d")
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-096", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-096", "scale") / 3.0)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj)*2, -MeshHeight(n\obj)*2, -MeshDepth(n\obj)*2, MeshWidth(n\obj)*2, MeshHeight(n\obj)*4, MeshDepth(n\obj)*4)
n\CollRadius = 0.26
;[End Block]
Case NPCtype049
;[Block]
n\NVName = "SCP-049"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
;n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-049.b3d")
n\obj = CopyEntity(NPC049OBJ)
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-049", "speed") / 100.0)
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-049", "scale")
ScaleEntity n\obj, temp, temp, temp
n\Sound = LoadSound_Strict("SFX\Horror\Horror12.ogg")
If HorrorSFX(13)=0 Then HorrorSFX(13)=LoadSound_Strict("SFX\Horror\Horror13.ogg")
n\CanUseElevator = True
;[End Block]
Case NPCtypeZombie
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
;For n2.NPCs = Each NPCs
; If n\NPCtype = n2\NPCtype And n<>n2 Then
; n\obj = CopyEntity (n2\obj)
; Exit
; EndIf
;Next
If n\obj = 0 Then
;n\obj = LoadAnimMesh_Strict("GFX\npcs\zombie1.b3d")
n\obj = CopyEntity(NPC0492OBJ)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-049-2", "scale") / 2.5)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj), -MeshHeight(n\obj), -MeshDepth(n\obj), MeshWidth(n\obj)*2, MeshHeight(n\obj)*2, MeshDepth(n\obj)*2)
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-049-2", "speed") / 100.0)
SetAnimTime(n\obj, 107)
n\Sound = LoadSound_Strict("SFX\SCP\049\0492Breath.ogg")
n\HP = 100
;[End Block]
Case NPCtypeApache
;[Block]
n\NVName = "Human"
n\GravityMult = 0.0
n\MaxGravity = 0.0
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
n\obj = CopyEntity(ApacheObj);LoadAnimMesh_Strict("GFX\apache.b3d")
n\obj2 = CopyEntity(ApacheRotorObj);LoadAnimMesh_Strict("GFX\apacherotor.b3d",n\obj)
EntityParent n\obj2,n\obj
For i = -1 To 1 Step 2
Local rotor2 = CopyEntity(n\obj2,n\obj2)
RotateEntity rotor2,0,4.0*i,0
EntityAlpha rotor2, 0.5
Next
n\obj3 = LoadAnimMesh_Strict("GFX\apacherotor2.b3d",n\obj)
PositionEntity n\obj3, 0.0, 2.15, -5.48
EntityType n\Collider, HIT_APACHE
EntityRadius n\Collider, 3.0
For i = -1 To 1 Step 2
Local Light1 = CreateLight(2,n\obj)
;room\LightDist[i] = range
LightRange(Light1,2.0)
LightColor(Light1,255,255,255)
PositionEntity(Light1, 1.65*i, 1.17, -0.25)
Local lightsprite = CreateSprite(n\obj)
PositionEntity(lightsprite, 1.65*i, 1.17, 0, -0.25)
ScaleSprite(lightsprite, 0.13, 0.13)
EntityTexture(lightsprite, LightSpriteTex(0))
EntityBlend (lightsprite, 3)
EntityFX lightsprite, 1+8
Next
temp# = 0.6
ScaleEntity n\obj, temp, temp, temp
;[End Block]
Case NPCtypeTentacle
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
For n2.NPCs = Each NPCs
If n\NPCtype = n2\NPCtype And n<>n2 Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\NPCs\035tentacle.b3d")
ScaleEntity n\obj, 0.065,0.065,0.065
EndIf
SetAnimTime n\obj, 283
;[End Block]
Case NPCtype860
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.25
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\forestmonster.b3d")
EntityFX(n\obj, 1)
tex = LoadTexture_Strict("GFX\npcs\860_eyes.png",1+2)
n\obj2 = CreateSprite()
ScaleSprite(n\obj2, 0.1, 0.1)
EntityTexture(n\obj2, tex)
FreeTexture tex
EntityFX(n\obj2, 1 + 8)
EntityBlend(n\obj2, BLEND_ADD)
SpriteViewMode(n\obj2, 2)
n\Speed = (GetINIFloat("DATA\NPCs.ini", "forestmonster", "speed") / 100.0)
temp# = (GetINIFloat("DATA\NPCs.ini", "forestmonster", "scale") / 20.0)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(n\obj)*2, -MeshHeight(n\obj)*2, -MeshDepth(n\obj)*2, MeshWidth(n\obj)*2, MeshHeight(n\obj)*4, MeshDepth(n\obj)*4)
n\CollRadius = 0.25
;[End Block]
Case NPCtype939
;[Block]
;i = 53
;For n2.NPCs = Each NPCs
; If (n\NPCtype = n2\NPCtype) And (n<>n2) Then i=i+36
;Next
;n\NVName = "SCP-939-"+i
Local amount939% = 0
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2)
amount939% = amount939% + 1
EndIf
Next
If amount939% = 0 Then i = 53
If amount939% = 1 Then i = 89
If amount939% = 2 Then i = 96
n\NVName = "SCP-939-"+i
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.3
EntityType n\Collider, HIT_PLAYER
For n2.NPCs = Each NPCs
If n\NPCtype = n2\NPCtype And n<>n2 Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\NPCs\scp-939.b3d")
;If BumpEnabled Then
; bump1 = LoadTexture_Strict("GFX\npcs\scp-939_licker_normal.png")
; ;TextureBlend bump1, FE_BUMP ;USE DOT3
;
; For i = 2 To CountSurfaces(n\obj)
; sf = GetSurface(n\obj,i)
; b = GetSurfaceBrush( sf )
; If b<>0 Then
; t1 = GetBrushTexture(b,0)
; If t1<>0 Then
; Select Lower(StripPath(TextureName(t1)))
; Case "scp-939-licker_diffusetest01.png"
;
; ;BrushTexture b, bump1, 0, 0
; BrushTexture b, t1, 0, 1
; PaintSurface sf,b
;
; ;If StripPath(TextureName(t1)) <> "" Then FreeTexture t1
; ;FreeBrush b
; End Select
; FreeTexture t1
; EndIf
; FreeBrush b
; EndIf
; Next
; FreeTexture bump1
;EndIf
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-939", "scale")/2.5
ScaleEntity n\obj, temp, temp, temp
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-939", "speed") / 100.0)
n\CollRadius = 0.3
;[End Block]
Case NPCtype066
;[Block]
n\NVName = "SCP-066"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\NPCs\scp-066.b3d")
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-066", "scale")/2.5
ScaleEntity n\obj, temp, temp, temp
;If BumpEnabled Then
; diff1 = LoadTexture_Strict("GFX\npcs\scp-066_diffuse01.jpg")
; bump1 = LoadTexture_Strict("GFX\npcs\scp-066_normal.png")
; ;TextureBlend bump1, FE_BUMP ;USE DOT3
; EntityTexture n\obj, bump1, 0, 1
; EntityTexture n\obj, diff1, 0, 2
; FreeTexture diff1
; FreeTexture bump1
;EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-066", "speed") / 100.0)
;[End Block]
Case NPCtype966
;[Block]
i = 1
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then i=i+1
Next
n\NVName = "SCP-966-"+i
n\Collider = CreatePivot()
EntityRadius n\Collider,0.2
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-966.b3d")
EndIf
EntityFX n\obj,1
temp# = GetINIFloat("DATA\NPCs.ini", "SCP-966", "scale")/40.0
ScaleEntity n\obj, temp, temp, temp
;EntityColor n\obj,Rnd(0,50),0,Rnd(50,100)
SetAnimTime n\obj,15.0
EntityType n\Collider,HIT_PLAYER
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-966", "speed") / 100.0)
;[End Block]
Case NPCtype1048a
;[Block]
n\NVName = "SCP-1048-A"
n\obj = LoadAnimMesh_Strict("GFX\npcs\scp-1048a.b3d")
ScaleEntity n\obj, 0.05,0.05,0.05
SetAnimTime(n\obj, 2)
n\Sound = LoadSound_Strict("SFX\SCP\1048A\Shriek.ogg")
n\Sound2 = LoadSound_Strict("SFX\SCP\1048A\Growth.ogg")
;[End Block]
Case NPCtype1499
;[Block]
n\NVName = "Unidentified"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
For n2.NPCs = Each NPCs
If (n\NPCtype = n2\NPCtype) And (n<>n2) Then
n\obj = CopyEntity (n2\obj)
Exit
EndIf
Next
If n\obj = 0 Then
n\obj = LoadAnimMesh_Strict("GFX\npcs\1499-1.b3d")
EndIf
n\Speed = (GetINIFloat("DATA\NPCs.ini", "SCP-1499-1", "speed") / 100.0) * Rnd(0.9,1.1)
temp# = (GetINIFloat("DATA\NPCs.ini", "SCP-1499-1", "scale") / 4.0) * Rnd(0.8,1.0)
ScaleEntity n\obj, temp, temp, temp
EntityFX n\obj,1
EntityAutoFade n\obj,HideDistance*2.5,HideDistance*2.95
;[End Block]
Case NPCtype008
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.2
EntityType n\Collider, HIT_PLAYER
n\obj = LoadAnimMesh_Strict("GFX\npcs\zombiesurgeon.b3d")
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(n\obj), -MeshHeight(n\obj), -MeshDepth(n\obj), MeshWidth(n\obj)*2, MeshHeight(n\obj)*2, MeshDepth(n\obj)*2)
SetNPCFrame n,11
n\Sound = LoadSound_Strict("SFX\SCP\049\0492Breath.ogg")
n\HP = 120
;[End Block]
Case NPCtypeClerk
;[Block]
n\NVName = "Human"
n\Collider = CreatePivot()
EntityRadius n\Collider, 0.32
EntityType n\Collider, HIT_PLAYER
n\obj = CopyEntity(ClerkOBJ)
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
n\Speed = 2.0 / 100
MeshCullBox (n\obj, -MeshWidth(ClerkOBJ), -MeshHeight(ClerkOBJ), -MeshDepth(ClerkOBJ), MeshWidth(ClerkOBJ)*2, MeshHeight(ClerkOBJ)*2, MeshDepth(ClerkOBJ)*2)
n\CollRadius = 0.32
;[End Block]
End Select
PositionEntity(n\Collider, x, y, z, True)
PositionEntity(n\obj, x, y, z, True)
ResetEntity(n\Collider)
n\ID = 0
n\ID = FindFreeNPCID()
DebugLog ("Created NPC "+n\NVName+" (ID: "+n\ID+")")
NPCSpeedChange(n)
Return n
End Function
Function RemoveNPC(n.NPCs)
If n=Null Then Return
If n\obj2 <> 0 Then
FreeEntity n\obj2
n\obj2 = 0
EndIf
If n\obj3 <> 0 Then
FreeEntity n\obj3
n\obj3 = 0
EndIf
If n\obj4 <> 0 Then
FreeEntity n\obj4
n\obj4 = 0
EndIf
If (Not n\SoundChn_IsStream)
If (n\SoundChn <> 0 And ChannelPlaying(n\SoundChn)) Then
StopChannel(n\SoundChn)
EndIf
Else
If (n\SoundChn <> 0)
StopStream_Strict(n\SoundChn)
EndIf
EndIf
If (Not n\SoundChn2_IsStream)
If (n\SoundChn2 <> 0 And ChannelPlaying(n\SoundChn2)) Then
StopChannel(n\SoundChn2)
EndIf
Else
If (n\SoundChn2 <> 0)
StopStream_Strict(n\SoundChn2)
EndIf
EndIf
If n\Sound<>0 Then FreeSound_Strict n\Sound
If n\Sound2<>0 Then FreeSound_Strict n\Sound2
FreeEntity(n\obj) : n\obj = 0
FreeEntity(n\Collider) : n\Collider = 0
Delete n
End Function
Function UpdateNPCs()
CatchErrors("Uncaught (UpdateNPCs)")
Local n.NPCs, n2.NPCs, d.Doors, de.Decals, r.Rooms, eo.ElevatorObj, eo2.ElevatorObj
Local i%, dist#, dist2#, angle#, x#, y#, z#, prevFrame#, PlayerSeeAble%, RN$
Local target
For n.NPCs = Each NPCs
;A variable to determine if the NPC is in the facility or not
n\InFacility = CheckForNPCInFacility(n)
Select n\NPCtype
Case NPCtype173
;[Block]
If Curr173\Idle <> 3 Then
dist# = EntityDistance(n\Collider, Collider)
n\State3 = 1
If n\Idle < 2 Then
If n\IdleTimer > 0.1
n\Idle = 1
n\IdleTimer = Max(n\IdleTimer-FPSfactor,0.1)
ElseIf n\IdleTimer = 0.1
n\Idle = 0
n\IdleTimer = 0
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.32, EntityZ(n\Collider))
RotateEntity (n\obj, 0, EntityYaw(n\Collider)-180, 0)
If n\Idle = False Then
Local temp% = False
Local move% = True
If dist < 15 Then
If dist < 10.0 Then
If EntityVisible(n\Collider, Collider) Then
temp = True
n\EnemyX = EntityX(Collider, True)
n\EnemyY = EntityY(Collider, True)
n\EnemyZ = EntityZ(Collider, True)
EndIf
EndIf
Local SoundVol# = Max(Min((Distance(EntityX(n\Collider), EntityZ(n\Collider), n\PrevX, n\PrevZ) * 2.5), 1.0), 0.0)
n\SoundChn = LoopSound2(StoneDragSFX, n\SoundChn, Camera, n\Collider, 10.0, n\State)
n\PrevX = EntityX(n\Collider)
n\PrevZ = EntityZ(n\Collider)
If (BlinkTimer < - 16 Or BlinkTimer > - 6) And (IsNVGBlinking=False) Then
If EntityInView(n\obj, Camera) Then move = False
EndIf
EndIf
If NoTarget Then move = True
;player is looking at it -> doesn't move
If move=False Then
BlurVolume = Max(Max(Min((4.0 - dist) / 6.0, 0.9), 0.1), BlurVolume)
CurrCameraZoom = Max(CurrCameraZoom, (Sin(Float(MilliSecs2())/20.0)+1.0)*15.0*Max((3.5-dist)/3.5,0.0))
If dist < 3.5 And MilliSecs2() - n\LastSeen > 60000 And temp Then
PlaySound_Strict(HorrorSFX(Rand(3,4)))
n\LastSeen = MilliSecs2()
EndIf
If dist < 1.5 And Rand(700) = 1 Then PlaySound2(Scp173SFX(Rand(0, 2)), Camera, n\obj)
If dist < 1.5 And n\LastDist > 2.0 And temp Then
CurrCameraZoom = 40.0
HeartBeatRate = Max(HeartBeatRate, 140)
HeartBeatVolume = 0.5
Select Rand(5)
Case 1
PlaySound_Strict(HorrorSFX(1))
Case 2
PlaySound_Strict(HorrorSFX(2))
Case 3
PlaySound_Strict(HorrorSFX(9))
Case 4
PlaySound_Strict(HorrorSFX(10))
Case 5
PlaySound_Strict(HorrorSFX(14))
End Select
EndIf
n\LastDist = dist
n\State = Max(0, n\State - FPSfactor / 20)
Else
;more than 6 room lengths away from the player -> teleport to a room closer to the player
If dist > 50 Then
If Rand(70)=1 Then
If PlayerRoom\RoomTemplate\Name <> "exit1" And PlayerRoom\RoomTemplate\Name <> "gatea" And PlayerRoom\RoomTemplate\Name <> "pocketdimension" Then
For w.waypoints = Each WayPoints
If w\door=Null And Rand(5)=1 Then
x = Abs(EntityX(Collider)-EntityX(w\obj,True))
If x < 25.0 And x > 15.0 Then
z = Abs(EntityZ(Collider)-EntityZ(w\obj,True))
If z < 25 And z > 15.0 Then
DebugLog "MOVING 173 TO "+w\room\roomtemplate\name
PositionEntity n\Collider, EntityX(w\obj,True), EntityY(w\obj,True)+0.25,EntityZ(w\obj,True)
ResetEntity n\Collider
Exit
EndIf
EndIf
EndIf
Next
EndIf
EndIf
ElseIf dist > HideDistance*0.8 ;3-6 rooms away from the player -> move randomly from waypoint to another
If Rand(70)=1 Then TeleportCloser(n)
Else ;less than 3 rooms away -> actively move towards the player
n\State = CurveValue(SoundVol, n\State, 3)
;try to open doors
If Rand(20) = 1 Then
For d.Doors = Each Doors
If (Not d\locked) And d\open = False And d\Code = "" And d\KeyCard=0 Then
For i% = 0 To 1
If d\buttons[i] <> 0 Then
If Abs(EntityX(n\Collider) - EntityX(d\buttons[i])) < 0.5 Then
If Abs(EntityZ(n\Collider) - EntityZ(d\buttons[i])) < 0.5 Then
If (d\openstate >= 180 Or d\openstate <= 0) Then
pvt = CreatePivot()
PositionEntity pvt, EntityX(n\Collider), EntityY(n\Collider) + 0.5, EntityZ(n\Collider)
PointEntity pvt, d\buttons[i]
MoveEntity pvt, 0, 0, n\Speed * 0.6
If EntityPick(pvt, 0.5) = d\buttons[i] Then
PlaySound_Strict (LoadTempSound("SFX\Door\DoorOpen173.ogg"))
UseDoor(d,False)
EndIf
FreeEntity pvt
EndIf
EndIf
EndIf
EndIf
Next
EndIf
Next
EndIf
If NoTarget
temp = False
n\EnemyX = 0
n\EnemyY = 0
n\EnemyZ = 0
EndIf
;player is not looking and is visible from 173's position -> attack
If temp Then
If dist < 0.65 Then
If KillTimer >= 0 And (Not GodMode) Then
Select PlayerRoom\RoomTemplate\Name
Case "lockroom", "room2closets", "coffin"
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. The surveillance tapes confirm that the subject was killed by SCP-173."
Case "173"
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. According to Security Chief Franklin who was present at SCP-173's containment "
DeathMSG = DeathMSG + "chamber during the breach, the subject was killed by SCP-173 as soon as the disruptions in the electrical network started."
Case "room2doors"
DeathMSG = Chr(34)+"If I'm not mistaken, one of the main purposes of these rooms was to stop SCP-173 from moving further in the event of a containment breach. "
DeathMSG = DeathMSG + "So, who's brilliant idea was it to put A GODDAMN MAN-SIZED VENTILATION DUCT in there?"+Chr(34)
Default
DeathMSG = "Subject D-9341. Cause of death: Fatal cervical fracture. Assumed to be attacked by SCP-173."
End Select
If (Not GodMode) Then n\Idle = True
PlaySound_Strict(NeckSnapSFX(Rand(0,2)))
If Rand(2) = 1 Then
TurnEntity(Camera, 0, Rand(80,100), 0)
Else
TurnEntity(Camera, 0, Rand(-100,-80), 0)
EndIf
Kill()
EndIf
Else
PointEntity(n\Collider, Collider)
RotateEntity n\Collider, 0, EntityYaw(n\Collider), EntityRoll(n\Collider)
;MoveEntity(n\Collider, 0, 0, n\Speed * FPSfactor)
TranslateEntity n\Collider,Cos(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor,0.0,Sin(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor
EndIf
Else ;player is not visible -> move to the location where he was last seen
If n\EnemyX <> 0 Then
If Distance(EntityX(n\Collider), EntityZ(n\Collider), n\EnemyX, n\EnemyZ) > 0.5 Then
AlignToVector(n\Collider, n\EnemyX-EntityX(n\Collider), 0, n\EnemyZ-EntityZ(n\Collider), 3)
MoveEntity(n\Collider, 0, 0, n\Speed * FPSfactor)
If Rand(500) = 1 Then n\EnemyX = 0 : n\EnemyY = 0 : n\EnemyZ = 0
Else
n\EnemyX = 0 : n\EnemyY = 0 : n\EnemyZ = 0
End If
Else
If Rand(400)=1 Then RotateEntity (n\Collider, 0, Rnd(360), 10)
TranslateEntity n\Collider,Cos(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor,0.0,Sin(EntityYaw(n\Collider)+90.0)*n\Speed*FPSfactor
End If
EndIf
EndIf ; less than 2 rooms away from the player
EndIf
EndIf ;idle = false
PositionEntity(n\Collider, EntityX(n\Collider), Min(EntityY(n\Collider),0.35), EntityZ(n\Collider))
Else ;idle = 2
If n\Target <> Null Then
Local tmp = False
If dist > HideDistance*0.7
If EntityVisible(n\obj,Collider)=False
tmp = True
EndIf
EndIf
If (Not tmp)
PointEntity n\obj, n\Target\Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0), 0, True
dist = EntityDistance(n\Collider, n\Target\Collider)
;MoveEntity n\Collider, 0, 0, 0.008*FPSfactor*Max(Min((dist*2-1.0)*0.5,1.0),-0.5)
MoveEntity n\Collider, 0, 0, 0.016*FPSfactor*Max(Min((dist*2-1.0)*0.5,1.0),-0.5)
n\GravityMult = 1.0
Else
PositionEntity n\Collider,EntityX(n\Target\Collider),EntityY(n\Target\Collider)+0.3,EntityZ(n\Target\Collider)
ResetEntity n\Collider
n\DropSpeed = 0
n\GravityMult = 0.0
;PointEntity n\Collider, n\Target\Collider
;RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0), 0, True
;dist = EntityDistance(n\Collider, n\Target\Collider)
;MoveEntity n\Collider, 0, 0, dist-0.6
EndIf
;For r.Rooms = Each Rooms
; If r\RoomTemplate\Name = "start" Then
; If Distance(EntityX(n\Collider),EntityZ(n\Collider),EntityX(r\obj,True)+1024*RoomScale,EntityZ(r\obj,True)+384*RoomScale)<1.6 Then
; n\Idle = 3
; n\Target = Null
; EndIf
; Exit
; EndIf
;Next
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) + 0.05 + Sin(MilliSecs2()*0.08)*0.02, EntityZ(n\Collider))
RotateEntity (n\obj, 0, EntityYaw(n\Collider)-180, 0)
ShowEntity n\obj2
PositionEntity(n\obj2, EntityX(n\Collider), EntityY(n\Collider) - 0.05 + Sin(MilliSecs2()*0.08)*0.02, EntityZ(n\Collider))
RotateEntity (n\obj2, 0, EntityYaw(n\Collider)-180, 0)
EndIf
EndIf
;[End block]
Case NPCtypeOldMan ;------------------------------------------------------------------------------------------------------------------
;[Block]
If Contained106 Then
n\Idle = True
HideEntity n\obj
HideEntity n\obj2
PositionEntity n\obj, 0,500.0,0, True
Else
dist = EntityDistance(n\Collider, Collider)
Local spawn106% = True
;checking if 106 is allowed to spawn
If PlayerRoom\RoomTemplate\Name$ = "dimension1499" Then spawn106% = False
For e.Events = Each Events
If e\EventName = "room860"
If e\EventState = 1
spawn106% = False
EndIf
Exit
EndIf
Next
If PlayerRoom\RoomTemplate\Name$ = "room049" And EntityY(Collider) <= -2848*RoomScale Then
spawn106% = False
EndIf
;GateA event has been triggered - don't make 106 disapper!
;The reason why this is a seperate For loop is because we need to make sure that room860 would not be able to overwrite the "spawn106%" variable
For e.events = Each Events
If e\EventName = "gatea"
If e\EventState <> 0
spawn106% = True
If PlayerRoom\RoomTemplate\Name$ = "dimension1499" Then
n\Idle = True
Else
n\Idle = False
EndIf
EndIf
Exit
EndIf
Next
If (Not spawn106%) And n\State <= 0 Then
n\State = Rand(22000, 27000)
PositionEntity n\Collider,0,500,0
EndIf
If (Not n\Idle) And spawn106%
If n\State <= 0 Then ;attacking
If EntityY(n\Collider) < EntityY(Collider) - 20.0 - 0.55 Then
If Not PlayerRoom\RoomTemplate\DisableDecals Then
de.Decals = CreateDecal(0, EntityX(Collider), 0.01, EntityZ(Collider), 90, Rand(360), 0)
de\Size = 0.05 : de\SizeChange = 0.001 : EntityAlpha(de\obj, 0.8) : UpdateDecals
EndIf
n\PrevY = EntityY(Collider)
SetAnimTime n\obj, 110
If PlayerRoom\RoomTemplate\Name <> "coffin"
PositionEntity(n\Collider, EntityX(Collider), EntityY(Collider) - 15, EntityZ(Collider))
EndIf
PlaySound_Strict(DecaySFX(0))
End If
If Rand(500) = 1 Then PlaySound2(OldManSFX(Rand(0, 2)), Camera, n\Collider)
n\SoundChn = LoopSound2(OldManSFX(4), n\SoundChn, Camera, n\Collider, 8.0, 0.8)
If n\State > - 10 Then
ShouldPlay = 66
If n\Frame<259 Then
PositionEntity n\Collider, EntityX(n\Collider), n\PrevY-0.15, EntityZ(n\Collider)
PointEntity n\obj, Collider
RotateEntity (n\Collider, 0, CurveValue(EntityYaw(n\obj),EntityYaw(n\Collider),100.0), 0, True)
AnimateNPC(n, 110, 259, 0.15, False)
Else
n\State = -10
EndIf
Else
If PlayerRoom\RoomTemplate\Name <> "gatea" Then ShouldPlay = 10
Local Visible% = False
If dist < 8.0 Then
Visible% = EntityVisible(n\Collider, Collider)
EndIf
If NoTarget Then Visible = False
If Visible Then
If PlayerRoom\RoomTemplate\Name <> "gatea" Then n\PathTimer = 0
If EntityInView(n\Collider, Camera) Then
GiveAchievement(Achv106)
;Achievements(Achv106) = True
BlurVolume = Max(Max(Min((4.0 - dist) / 6.0, 0.9), 0.1), BlurVolume)
CurrCameraZoom = Max(CurrCameraZoom, (Sin(Float(MilliSecs2())/20.0)+1.0) * 20.0 * Max((4.0-dist)/4.0,0))
If MilliSecs2() - n\LastSeen > 60000 Then
CurrCameraZoom = 40
PlaySound_Strict(HorrorSFX(6))
n\LastSeen = MilliSecs2()
EndIf
EndIf
Else
n\State=n\State-FPSfactor
End If
If dist > 0.8 Then
If (dist > 25.0 Or PlayerRoom\RoomTemplate\Name = "pocketdimension" Or Visible Or n\PathStatus <> 1) And PlayerRoom\RoomTemplate\Name <> "gatea" Then
If (dist > 40 Or PlayerRoom\RoomTemplate\Name = "pocketdimension") Then
TranslateEntity n\Collider, 0, ((EntityY(Collider) - 0.14) - EntityY(n\Collider)) / 50.0, 0
EndIf
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,10.0)
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 10.0), 0
If KillTimer >= 0 Then
prevFrame# = n\Frame
AnimateNPC(n, 284, 333, n\CurrSpeed*43)
;Animate2(n\obj, AnimTime(n\obj), 284, 333, n\CurrSpeed*43)
If prevFrame =< 286 And n\Frame>286 Then
PlaySound2(Step2SFX(Rand(0,2)),Camera, n\Collider, 6.0, Rnd(0.8,1.0))
ElseIf prevFrame=<311 And n\Frame>311.0
PlaySound2(Step2SFX(Rand(0,2)),Camera, n\Collider, 6.0, Rnd(0.8,1.0))
EndIf
Else
n\CurrSpeed = 0
EndIf
n\PathTimer = Max(n\PathTimer-FPSfactor,0)
If n\PathTimer =< 0 Then
n\PathStatus = FindPath (n, EntityX(Collider,True), EntityY(Collider,True), EntityZ(Collider,True))
n\PathTimer = 70*10
EndIf
Else
If n\PathTimer <= 0 Then
n\PathStatus = FindPath (n, EntityX(Collider,True), EntityY(Collider,True), EntityZ(Collider,True))
n\PathTimer = 70*10
n\CurrSpeed = 0
Else
n\PathTimer = Max(n\PathTimer-FPSfactor,0)
If n\PathStatus = 2 Then
n\CurrSpeed = 0
ElseIf n\PathStatus = 1
While n\Path[n\PathLocation]=Null
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Exit
Else
n\PathLocation = n\PathLocation + 1
EndIf
Wend
If n\Path[n\PathLocation]<>Null Then
TranslateEntity n\Collider, 0, ((EntityY(n\Path[n\PathLocation]\obj,True) - 0.11) - EntityY(n\Collider)) / 50.0, 0
PointEntity n\obj, n\Path[n\PathLocation]\obj
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), Min(20.0,dist2*10.0)), 0
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,10.0)
prevFrame# = AnimTime(n\obj)
AnimateNPC(n, 284, 333, n\CurrSpeed*43)
;Animate2(n\obj, AnimTime(n\obj), 284, 333, n\CurrSpeed*43)
If prevFrame =< 286 And n\Frame>286 Then
PlaySound2(Step2SFX(Rand(0,2)),Camera, n\Collider, 6.0, Rnd(0.8,1.0))
ElseIf prevFrame=<311 And n\Frame>311.0
PlaySound2(Step2SFX(Rand(0,2)),Camera, n\Collider, 6.0, Rnd(0.8,1.0))
EndIf
If dist2 < 0.2 Then n\PathLocation = n\PathLocation + 1
EndIf
ElseIf n\PathStatus = 0
If n\State3=0 Then AnimateNPC(n, 334, 494, 0.3)
;Animate2(n\obj, AnimTime(n\obj), 334, 494, 0.3)
n\CurrSpeed = CurveValue(0,n\CurrSpeed,10.0)
EndIf
EndIf
EndIf
ElseIf PlayerRoom\RoomTemplate\Name <> "gatea" And (Not NoTarget) ;dist < 0.8
If dist > 0.5 Then
n\CurrSpeed = CurveValue(n\Speed * 2.5,n\CurrSpeed,10.0)
Else
n\CurrSpeed = 0
EndIf
AnimateNPC(n, 105, 110, 0.15, False)
;Animate2(n\obj, AnimTime(n\obj), 105, 110, 0.15, False)
;If Floor(AnimTime(n\obj)) = 43 Then SetAnimTime(n\obj, 43)
If KillTimer >= 0 And FallTimer >= 0 Then
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 10.0), 0
If Ceil(n\Frame) = 110 And (Not GodMode) Then
PlaySound_Strict(DamageSFX(1))
PlaySound_Strict(HorrorSFX(5))
If PlayerRoom\RoomTemplate\Name = "pocketdimension" Then
DeathMSG = "Subject D-9341. Body partially decomposed by what is assumed to be SCP-106's "+Chr(34)+"corrosion"+Chr(34)+" effect. Body disposed of via incineration."
Kill()
Else
PlaySound_Strict(OldManSFX(3))
FallTimer = Min(-1, FallTimer)
PositionEntity(Head, EntityX(Camera, True), EntityY(Camera, True), EntityZ(Camera, True), True)
ResetEntity (Head)
RotateEntity(Head, 0, EntityYaw(Camera) + Rand(-45, 45), 0)
EndIf
EndIf
EndIf
EndIf
EndIf
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
If n\State <= Rand(-3500, -3000) Then
If Not EntityInView(n\obj,Camera) And dist > 5 Then
n\State = Rand(22000, 27000)
PositionEntity n\Collider,0,500,0
EndIf
EndIf
If FallTimer < -250.0 Then
MoveToPocketDimension()
n\State = 250 ;make 106 idle for a while
EndIf
If n\Reload = 0 Then
If dist > 10 And PlayerRoom\RoomTemplate\Name <> "pocketdimension" And PlayerRoom\RoomTemplate\Name <> "gatea" And n\State <-5 Then ;timer idea by Juanjpro
If (Not EntityInView(n\obj,Camera))
TurnEntity Collider,0,180,0
pick = EntityPick(Collider,5)
TurnEntity Collider,0,180,0
If pick<>0
TeleportEntity(n\Collider,PickedX(),PickedY(),PickedZ(),n\CollRadius)
PointEntity(n\Collider,Collider)
RotateEntity(n\Collider,0,EntityYaw(n\Collider),0)
MoveEntity(n\Collider,0,0,-2)
PlaySound2(OldManSFX(3),Camera,n\Collider)
n\SoundChn2 = PlaySound2(OldManSFX(6+Rand(0,2)),Camera,n\Collider)
n\PathTimer = 0
n\Reload = (70*10.0)/(SelectedDifficulty\otherFactors+1)
DebugLog "Teleported 106 (Distance: "+EntityDistance(n\Collider,Collider)+")"
EndIf
EndIf
EndIf
EndIf
n\Reload = Max(0, n\Reload - FPSfactor)
DebugLog "106 in... "+n\Reload
UpdateSoundOrigin(n\SoundChn2,Camera,n\Collider)
Else ;idling outside the map
n\CurrSpeed = 0
MoveEntity n\Collider, 0, ((EntityY(Collider) - 30) - EntityY(n\Collider)) / 200.0, 0
n\DropSpeed = 0
n\Frame = 110
;SetAnimTime n\obj, 110.0
If (Not PlayerRoom\RoomTemplate\DisableDecals) Then
If PlayerRoom\RoomTemplate\Name <> "gatea"
If (SelectedDifficulty\aggressiveNPCs) Then
n\State=n\State-FPSfactor*2
Else
n\State=n\State-FPSfactor
EndIf
EndIf
EndIf
End If
ResetEntity(n\Collider)
n\DropSpeed = 0
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.15, EntityZ(n\Collider))
RotateEntity n\obj, 0, EntityYaw(n\Collider), 0
PositionEntity(n\obj2, EntityX(n\obj), EntityY(n\obj) , EntityZ(n\obj))
RotateEntity(n\obj2, 0, EntityYaw(n\Collider) - 180, 0)
MoveEntity(n\obj2, 0, 8.6 * 0.11, -1.5 * 0.11)
If PlayerRoom\RoomTemplate\Name = "pocketdimension" Or PlayerRoom\RoomTemplate\Name = "gatea" Then
HideEntity n\obj2
Else
If dist < CameraFogFar*LightVolume*0.6 Then
HideEntity n\obj2
Else
ShowEntity n\obj2
EntityAlpha (n\obj2, Min(dist-CameraFogFar*LightVolume*0.6,1.0))
EndIf
EndIf
Else
HideEntity n\obj2
EndIf
EndIf
;[End Block]
Case NPCtype096
;[Block]
dist = EntityDistance(Collider, n\Collider)
Select n\State
Case 0
;[Block]
If dist<8.0 Then
GiveAchievement(Achv096)
;If n\Sound = 0 Then
; n\Sound = LoadSound_Strict("SFX\Music\096.ogg")
;Else
; n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 8.0, 1.0)
;EndIf
If n\SoundChn = 0
n\SoundChn = StreamSound_Strict("SFX\Music\096.ogg",0)
n\SoundChn_IsStream = True
Else
UpdateStreamSoundOrigin(n\SoundChn,Camera,n\Collider,8.0,1.0)
EndIf
If n\State3 = -1
AnimateNPC(n,936,1263,0.1,False)
If n\Frame=>1262.9
n\State = 5
n\State3 = 0
n\Frame = 312
EndIf
Else
AnimateNPC(n,936,1263,0.1)
If n\State3 < 70*6
n\State3=n\State3+FPSfactor
Else
If Rand(1,5)=1
n\State3 = -1
Else
n\State3=70*(Rand(0,3))
EndIf
EndIf
EndIf
;AnimateNPC(n, 1085,1412, 0.1) ;sitting
angle = WrapAngle(DeltaYaw(n\Collider, Collider));-EntityYaw(n\Collider,True))
If (Not NoTarget)
If angle<90 Or angle>270 Then
CameraProject Camera,EntityX(n\Collider), EntityY(n\Collider)+0.25, EntityZ(n\Collider)
If ProjectedX()>0 And ProjectedX()<GraphicWidth Then
If ProjectedY()>0 And ProjectedY()<GraphicHeight Then
If EntityVisible(Collider, n\Collider) Then
If (BlinkTimer < - 16 Or BlinkTimer > - 6)
PlaySound_Strict LoadTempSound("SFX\SCP\096\Triggered.ogg")
CurrCameraZoom = 10
n\Frame = 194
;n\Frame = 307
StopStream_Strict(n\SoundChn) : n\SoundChn=0
n\Sound = 0
n\State = 1
n\State3 = 0
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
;[End Block]
Case 4
;[Block]
CurrCameraZoom = CurveValue(Max(CurrCameraZoom, (Sin(Float(MilliSecs2())/20.0)+1.0) * 10.0),CurrCameraZoom,8.0)
If n\Target = Null Then
;If n\Sound = 0 Then
; n\Sound = LoadSound_Strict("SFX\SCP\096\Scream.ogg")
;Else
; n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 7.5, 1.0)
;EndIf
If n\SoundChn = 0
n\SoundChn = StreamSound_Strict("SFX\SCP\096\Scream.ogg",0)
n\SoundChn_IsStream = True
Else
UpdateStreamSoundOrigin(n\SoundChn,Camera,n\Collider,7.5,1.0)
EndIf
;If n\Sound2 = 0 Then
; n\Sound2 = LoadSound_Strict("SFX\Music\096Chase.ogg")
;Else
; If n\SoundChn2 = 0 Then
; n\SoundChn2 = PlaySound_Strict (n\Sound2)
; Else
; If (Not ChannelPlaying(n\SoundChn2)) Then n\SoundChn2 = PlaySound_Strict(n\Sound2)
; ChannelVolume(n\SoundChn2, Min(Max(8.0-dist,0.6),1.0)*SFXVolume#)
; EndIf
;EndIf
If n\SoundChn2 = 0
n\SoundChn2 = StreamSound_Strict("SFX\Music\096Chase.ogg",0)
n\SoundChn2_IsStream = 2
Else
SetStreamVolume_Strict(n\SoundChn2,Min(Max(8.0-dist,0.6),1.0)*SFXVolume#)
EndIf
EndIf
If NoTarget And n\Target = Null Then n\State = 5
If KillTimer =>0 Then
If MilliSecs2() > n\State3 Then
n\LastSeen=0
If n\Target=Null Then
If EntityVisible(Collider, n\Collider) Then n\LastSeen=1
Else
If EntityVisible(n\Target\Collider, n\Collider) Then n\LastSeen=1
EndIf
n\State3=MilliSecs2()+3000
EndIf
If n\LastSeen=1 Then
n\PathTimer=Max(70*3, n\PathTimer)
n\PathStatus=0
If n\Target<> Null Then dist = EntityDistance(n\Target\Collider, n\Collider)
If dist < 2.8 Or n\Frame<150 Then
If n\Frame>193 Then n\Frame = 2.0 ;go to the start of the jump animation
AnimateNPC(n, 2, 193, 0.7)
If dist > 1.0 Then
n\CurrSpeed = CurveValue(n\Speed*2.0,n\CurrSpeed,15.0)
Else
n\CurrSpeed = 0
If n\Target=Null Then
If (Not GodMode) Then
PlaySound_Strict DamageSFX(4)
pvt = CreatePivot()
CameraShake = 30
BlurTimer = 2000
DeathMSG = "A large amount of blood found in [DATA REDACTED]. DNA indentified as Subject D-9341. Most likely [DATA REDACTED] by SCP-096."
Kill()
KillAnim = 1
For i = 0 To 6
PositionEntity pvt, EntityX(Collider)+Rnd(-0.1,0.1),EntityY(Collider)-0.05,EntityZ(Collider)+Rnd(-0.1,0.1)
TurnEntity pvt, 90, 0, 0
EntityPick(pvt,0.3)
de.Decals = CreateDecal(Rand(15,16), PickedX(), PickedY()+0.005, PickedZ(), 90, Rand(360), 0)
de\Size = Rnd(0.2,0.6) : EntityAlpha(de\obj, 1.0) : ScaleSprite de\obj, de\Size, de\Size
Next
FreeEntity pvt
EndIf
EndIf
EndIf
If n\Target=Null Then
PointEntity n\Collider, Collider
Else
PointEntity n\Collider, n\Target\Collider
EndIf
Else
If n\Target=Null Then
PointEntity n\obj, Collider
Else
PointEntity n\obj, n\Target\Collider
EndIf
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 5.0), 0
;1000
If n\Frame>847 Then n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
If n\Frame<906 Then ;1058
AnimateNPC(n,737,906,n\Speed*8,False)
;AnimateNPC(n, 892,1058, n\Speed*8, False)
Else
AnimateNPC(n,907,935,n\CurrSpeed*8)
;AnimateNPC(n, 1059,1084, n\CurrSpeed*8)
EndIf
EndIf
RotateEntity n\Collider, 0, EntityYaw(n\Collider), 0, True
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
Else
If n\PathStatus = 1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 5.0), 0
;1000
If n\Frame>847 Then n\CurrSpeed = CurveValue(n\Speed*1.5,n\CurrSpeed,15.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
If n\Frame<906 Then ;1058
AnimateNPC(n,737,906,n\Speed*8,False)
;AnimateNPC(n, 892,1058, n\Speed*8, False)
Else
AnimateNPC(n,907,935,n\CurrSpeed*8)
;AnimateNPC(n, 1059,1084, n\CurrSpeed*8)
EndIf
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If dist2 < 0.8 Then ;0.4
If n\Path[n\PathLocation]\door <> Null Then
If n\Path[n\PathLocation]\door\open = False Then
n\Path[n\PathLocation]\door\open = True
n\Path[n\PathLocation]\door\fastopen = 1
PlaySound2(OpenDoorFastSFX, Camera, n\Path[n\PathLocation]\door\obj)
EndIf
EndIf
If dist2 < 0.7 Then n\PathLocation = n\PathLocation + 1 ;0.2
EndIf
EndIf
Else
;AnimateNPC(n, 892,972, 0.2)
AnimateNPC(n,737,822,0.2)
n\PathTimer = Max(0, n\PathTimer-FPSfactor)
If n\PathTimer=<0 Then
If n\Target<>Null Then
n\PathStatus = FindPath(n, EntityX(n\Target\Collider),EntityY(n\Target\Collider)+0.2,EntityZ(n\Target\Collider))
Else
n\PathStatus = FindPath(n, EntityX(Collider),EntityY(Collider)+0.2,EntityZ(Collider))
EndIf
n\PathTimer = 70*5
EndIf
EndIf
EndIf
If dist > 32.0 Or EntityY(n\Collider)<-50 Then
If Rand(50)=1 Then TeleportCloser(n)
EndIf
Else ;play the eating animation if killtimer < 0
AnimateNPC(n, Min(27,AnimTime(n\obj)), 193, 0.5)
;Animate2(n\obj, AnimTime(n\obj), Min(27,AnimTime(n\obj)), 193, 0.5)
EndIf
;[End Block]
Case 1,2,3
;[Block]
;If n\Sound = 0 Then
; n\Sound = LoadSound_Strict("SFX\Music\096Angered.ogg")
;Else
; n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 10.0, 1.0)
;EndIf
If n\SoundChn = 0
n\SoundChn = StreamSound_Strict("SFX\Music\096Angered.ogg",0)
n\SoundChn_IsStream = True
Else
UpdateStreamSoundOrigin(n\SoundChn,Camera,n\Collider,10.0,1.0)
EndIf
If n\State=1 Then ; get up
If n\Frame<312
AnimateNPC(n,193,311,0.3,False)
If n\Frame > 310.9 Then n\State = 2 : n\Frame = 737
ElseIf n\Frame>=312 And n\Frame<=422
AnimateNPC(n,312,422,0.3,False)
If n\Frame > 421.9 Then n\Frame = 677
Else
AnimateNPC(n,677,736,0.3,False)
If n\Frame > 735.9 Then n\State = 2 : n\Frame = 737
EndIf
;If n\Frame>1085 Then
; AnimateNPC(n, 1085, 1412, 0.3,False)
; If n\Frame> 1411.9 Then n\Frame = 307
;Else
; AnimateNPC(n, 307, 424, 0.3, False)
; If n\Frame > 423.9 Then n\State = 2 : n\Frame = 892
;EndIf
ElseIf n\State=2
AnimateNPC(n,737,822,0.3,False)
If n\Frame=>822 Then n\State=3 : n\State2=0
;AnimateNPC(n, 833, 972, 0.3, False)
;If n\Frame=>972 Then n\State = 3 : n\State2=0
ElseIf n\State=3
n\State2 = n\State2+FPSfactor
If n\State2 > 70*18 Then
AnimateNPC(n,823,847,n\Speed*8,False)
;AnimateNPC(n, 973, 1001, 0.5, False)
If n\Frame>846.9 Then ;1000.9
n\State = 4
StopStream_Strict(n\SoundChn) : n\SoundChn=0
EndIf
Else
AnimateNPC(n,737,822,0.3)
;AnimateNPC(n, 892,978, 0.3)
EndIf
EndIf
;[End Block]
Case 5
;[Block]
If dist < 16.0 Then
If dist < 4.0 Then
GiveAchievement(Achv096)
EndIf
;If n\Sound = 0 Then
; n\Sound = LoadSound_Strict("SFX\Music\096.ogg")
;Else
; n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 14.0, 1.0)
;EndIf
If n\SoundChn = 0
n\SoundChn = StreamSound_Strict("SFX\Music\096.ogg",0)
n\SoundChn_IsStream = True
Else
UpdateStreamSoundOrigin(n\SoundChn,Camera,n\Collider,14.0,1.0)
EndIf
If n\Frame>=422
n\State2=n\State2+FPSfactor
If n\State2>1000 Then ;walking around
If n\State2>1600 Then n\State2=Rand(0,500) ;: n\Frame = 1457 ;1652
;1652
If n\Frame<1382 Then ;idle to walk
n\CurrSpeed = CurveValue(n\Speed*0.1,n\CurrSpeed,5.0)
AnimateNPC(n,1369,1382,n\CurrSpeed*45,False)
;AnimateNPC(n, 1638,1652, n\CurrSpeed*45,False)
Else
n\CurrSpeed = CurveValue(n\Speed*0.1,n\CurrSpeed,5.0)
AnimateNPC(n,1383,1456,n\CurrSpeed*45)
;AnimateNPC(n, 1653,1724, n\CurrSpeed*45) ;walk
EndIf
If MilliSecs2() > n\State3 Then
n\LastSeen=0
If EntityVisible(Collider, n\Collider) Then
n\LastSeen=1
Else
HideEntity n\Collider
EntityPick(n\Collider, 1.5)
If PickedEntity() <> 0 Then
n\Angle = EntityYaw(n\Collider)+Rnd(80,110)
EndIf
ShowEntity n\Collider
EndIf
n\State3=MilliSecs2()+3000
EndIf
If n\LastSeen Then
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),130.0),0
If dist < 1.5 Then n\State2=0
Else
RotateEntity n\Collider, 0, CurveAngle(n\Angle,EntityYaw(n\Collider),50.0),0
EndIf
Else
;1638
If n\Frame>472 Then ;walk to idle
n\CurrSpeed = CurveValue(n\Speed*0.05,n\CurrSpeed,8.0)
AnimateNPC(n,1383,1469,n\CurrSpeed*45,False)
If n\Frame=>1468.9 Then n\Frame=423
;AnimateNPC(n, 1652, 1638, -n\CurrSpeed*45,False)
Else ;idle
n\CurrSpeed = CurveValue(0,n\CurrSpeed,4.0)
AnimateNPC(n,423,471,0.2)
;AnimateNPC(n, 585, 633, 0.2) ;idle
EndIf
EndIf
MoveEntity n\Collider,0,0,n\CurrSpeed*FPSfactor
Else
AnimateNPC(n,312,422,0.3,False)
EndIf
angle = WrapAngle(DeltaYaw(n\Collider, Camera));-EntityYaw(n\Collider))
If (Not NoTarget)
If angle<55 Or angle>360-55 Then
CameraProject Camera,EntityX(n\Collider), EntityY(Collider)+5.8*0.2-0.25, EntityZ(n\Collider)
If ProjectedX()>0 And ProjectedX()<GraphicWidth Then
If ProjectedY()>0 And ProjectedY()<GraphicHeight Then
If EntityVisible(Collider, n\Collider) Then
If (BlinkTimer < - 16 Or BlinkTimer > - 6)
PlaySound_Strict LoadTempSound("SFX\SCP\096\Triggered.ogg")
CurrCameraZoom = 10
If n\Frame >= 422
n\Frame = 677 ;833
EndIf
StopStream_Strict(n\SoundChn) : n\SoundChn=0
n\Sound = 0
n\State = 2
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
;[End Block]
End Select
;ResetEntity(n\Collider)
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider)-0.03, EntityZ(n\Collider)) ;-0.07
RotateEntity n\obj, EntityPitch(n\Collider), EntityYaw(n\Collider), 0
;[End Block]
Case NPCtype049
;[Block]
;n\state = the "main state" of the NPC
;n\state2 = attacks the player when the value is above 0.0
;n\state3 = timer for updating the path again
prevFrame# = n\Frame
dist = EntityDistance(Collider, n\Collider)
n\BlinkTimer# = 1.0
If n\Idle > 0.1
If PlayerRoom\RoomTemplate\Name$ <> "room049"
n\Idle = Max(n\Idle-(1+SelectedDifficulty\aggressiveNPCs)*FPSfactor,0.1)
EndIf
n\DropSpeed = 0
If ChannelPlaying(n\SoundChn) Then StopChannel(n\SoundChn)
If ChannelPlaying(n\SoundChn2) Then StopChannel(n\SoundChn2)
PositionEntity n\Collider,0,-500,0
PositionEntity n\obj,0,-500,0
Else
If n\Idle = 0.1 Then
If PlayerInReachableRoom() Then
For i = 0 To 3
If PlayerRoom\Adjacent[i]<>Null Then
For j = 0 To 3
If PlayerRoom\Adjacent[i]\Adjacent[j]<>Null Then
TeleportEntity(n\Collider,PlayerRoom\Adjacent[i]\Adjacent[j]\x,0.5,PlayerRoom\Adjacent[i]\Adjacent[j]\z,n\CollRadius,True)
Exit
EndIf
Next
Exit
EndIf
Next
n\Idle = 0.0
DebugLog "SCP-049 not idle"
EndIf
EndIf
Select n\State
Case 0 ;nothing (used for events)
Case 1 ;looking around before getting active
;[Block]
If n\Frame=>538 Then
AnimateNPC(n, 659, 538, -0.45, False)
If n\Frame > 537.9 Then n\Frame = 37
;Animate2(n\obj, AnimTime(n\obj), 659, 538, -0.45, False)
;If AnimTime(n\obj)=538 Then SetAnimTime(n\obj, 37)
Else
AnimateNPC(n, 37, 269, 0.7, False)
If n\Frame>268.9 Then n\State = 2
;Animate2(n\obj, AnimTime(n\obj), 37, 269, 0.7, False)
;If AnimTime(n\obj)=269 Then n\State = 2
EndIf
;[End Block]
Case 2 ;being active
;[Block]
If (dist < HideDistance*2) And (Not n\Idle) And PlayerInReachableRoom(True) Then
n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider)
PlayerSeeAble% = MeNPCSeesPlayer(n)
If PlayerSeeAble%=True Or n\State2>0 Then ;Player is visible for 049's sight - attacking
GiveAchievement(Achv049)
;Playing a sound after detecting the player
If n\PrevState <= 1 And ChannelPlaying(n\SoundChn2)=False
If n\Sound2 <> 0 Then FreeSound_Strict(n\Sound2)
n\Sound2 = LoadSound_Strict("SFX\SCP\049\Spotted"+Rand(1,7)+".ogg")
n\SoundChn2 = LoopSound2(n\Sound2,n\SoundChn2,Camera,n\obj)
n\PrevState = 2
EndIf
n\PathStatus = 0
n\PathTimer# = 0.0
n\PathLocation = 0
If PlayerSeeAble%=True Then n\State2 = 70*2
PointEntity n\obj,Collider
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0),0
If dist < 0.5 Then
If WearingHazmat>0 Then
BlurTimer = BlurTimer+FPSfactor*2.5
If BlurTimer>250 And BlurTimer-FPSfactor*2.5 <= 250 And n\PrevState<>3 Then
If n\SoundChn2 <> 0 Then StopChannel(n\SoundChn2)
n\SoundChn2 = PlaySound_Strict(LoadTempSound("SFX\SCP\049\TakeOffHazmat.ogg"))
n\PrevState=3
ElseIf BlurTimer => 500
For i = 0 To MaxItemAmount-1
If Inventory(i)<>Null Then
If Instr(Inventory(i)\itemtemplate\tempname,"hazmatsuit") And WearingHazmat<3 Then
If Inventory(i)\state2 < 3 Then
Inventory(i)\state2 = Inventory(i)\state2 + 1
BlurTimer = 260.0
CameraShake = 2.0
Else
RemoveItem(Inventory(i))
WearingHazmat = False
EndIf
Exit
EndIf
EndIf
Next
EndIf
ElseIf Wearing714 Then
BlurTimer = BlurTimer+FPSfactor*2.5
If BlurTimer>250 And BlurTimer-FPSfactor*2.5 <= 250 And n\PrevState<>3 Then
If n\SoundChn2 <> 0 Then StopChannel(n\SoundChn2)
n\SoundChn2 = PlaySound_Strict(LoadTempSound("SFX\SCP\049\714Equipped.ogg"))
n\PrevState=3
ElseIf BlurTimer => 500
Wearing714=False
EndIf
Else
CurrCameraZoom = 20.0
BlurTimer = 500.0
If (Not GodMode) Then
If PlayerRoom\RoomTemplate\Name$ = "room049"
DeathMSG = "Three (3) active instances of SCP-049-2 discovered in the tunnel outside SCP-049's containment chamber. Terminated by Nine-Tailed Fox."
For e.events = Each Events
If e\EventName = "room049" Then e\EventState=-1 : Exit
Next
Else
DeathMSG = "An active instance of SCP-049-2 was discovered in [REDACTED]. Terminated by Nine-Tailed Fox."
Kill()
EndIf
PlaySound_Strict HorrorSFX(13)
If n\Sound2 <> 0 Then FreeSound_Strict(n\Sound2)
n\Sound2 = LoadSound_Strict("SFX\SCP\049\Kidnap"+Rand(1,2)+".ogg")
n\SoundChn2 = LoopSound2(n\Sound2,n\SoundChn2,Camera,n\obj)
n\State = 3
EndIf
EndIf
Else
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
If n\PrevState = 3 Then n\PrevState = 2
If dist < 3.0 Then
AnimateNPC(n, Max(Min(AnimTime(n\obj),428.0),387), 463.0, n\CurrSpeed*38)
Else
If n\Frame>428.0 Then
AnimateNPC(n, Min(AnimTime(n\obj),463.0), 498.0, n\CurrSpeed*38,False)
If n\Frame>497.9 Then n\Frame = 358
Else
AnimateNPC(n, Max(Min(AnimTime(n\obj),358.0),346), 393.0, n\CurrSpeed*38)
EndIf
EndIf
EndIf
Else ;Finding a path to the player
If n\PathStatus = 1 ;Path to player found
While n\Path[n\PathLocation]=Null
If n\PathLocation > 19
n\PathLocation = 0 : n\PathStatus = 0 : Exit
Else
n\PathLocation = n\PathLocation + 1
EndIf
Wend
If n\Path[n\PathLocation]<>Null Then
;closes doors behind him
If n\PathLocation>0 Then
If n\Path[n\PathLocation-1] <> Null Then
If n\Path[n\PathLocation-1]\door <> Null Then
If (Not n\Path[n\PathLocation-1]\door\IsElevatorDoor) Then
If EntityDistance(n\Path[n\PathLocation-1]\obj,n\Collider)>0.3 Then
If (n\Path[n\PathLocation-1]\door\MTFClose) And (n\Path[n\PathLocation-1]\door\open) And (n\Path[n\PathLocation-1]\door\buttons[0]<>0 Or n\Path[n\PathLocation-1]\door\buttons[1]<>0) Then
UseDoor(n\Path[n\PathLocation-1]\door, False)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
PointEntity n\obj,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0),0
MoveEntity n\Collider,0,0,n\CurrSpeed*FPSfactor
;opens doors in front of him
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If dist2 < 0.6 Then
temp = True
If n\Path[n\PathLocation]\door <> Null Then
If (Not n\Path[n\PathLocation]\door\IsElevatorDoor)
If (n\Path[n\PathLocation]\door\locked Or n\Path[n\PathLocation]\door\KeyCard<>0 Or n\Path[n\PathLocation]\door\Code<>"") And (Not n\Path[n\PathLocation]\door\open) Then
temp = False
Else
If n\Path[n\PathLocation]\door\open = False And (n\Path[n\PathLocation]\door\buttons[0]<>0 Or n\Path[n\PathLocation]\door\buttons[1]<>0) Then
UseDoor(n\Path[n\PathLocation]\door, False)
EndIf
EndIf
EndIf
EndIf
If dist2#<0.2 And temp
n\PathLocation = n\PathLocation + 1
ElseIf dist2#<0.5 And (Not temp)
;Breaking up the path when the door in front of 049 cannot be operated by himself
n\PathStatus = 0
n\PathTimer# = 0.0
EndIf
EndIf
AnimateNPC(n, Max(Min(AnimTime(n\obj),358.0),346), 393.0, n\CurrSpeed*38)
;Playing a sound if he hears the player
If n\PrevState = 0 And ChannelPlaying(n\SoundChn2)=False
If n\Sound2 <> 0 Then FreeSound_Strict(n\Sound2)
If Rand(30)=1
n\Sound2 = LoadSound_Strict("SFX\SCP\049\Searching7.ogg")
Else
n\Sound2 = LoadSound_Strict("SFX\SCP\049\Searching"+Rand(1,6)+".ogg")
EndIf
n\SoundChn2 = LoopSound2(n\Sound2,n\SoundChn2,Camera,n\obj)
n\PrevState = 1
EndIf
;Resetting the "PrevState" value randomly, to make 049 talking randomly
If Rand(600)=1 And ChannelPlaying(n\SoundChn2)=False Then n\PrevState = 0
If n\PrevState > 1 Then n\PrevState = 1
EndIf
Else ;No Path to the player found - stands still and tries to find a path
;[Block]
n\PathTimer# = n\PathTimer# + FPSfactor
If n\PathTimer# > 70*(5-(2*SelectedDifficulty\aggressiveNPCs)) Then
n\PathStatus = FindPath(n, EntityX(Collider),EntityY(Collider),EntityZ(Collider))
n\PathTimer# = 0.0
n\State3 = 0
;Attempt to find a room (the Playerroom or one of it's adjacent rooms) for 049 to go to but select the one closest to him
If n\PathStatus <> 1 Then
Local closestdist# = EntityDistance(PlayerRoom\obj,n\Collider)
Local closestRoom.Rooms = PlayerRoom
Local currdist# = 0.0
For i = 0 To 3
If PlayerRoom\Adjacent[i]<>Null Then
currdist = EntityDistance(PlayerRoom\Adjacent[i]\obj,n\Collider)
If currdist < closestdist Then
closestdist = currdist
closestRoom = PlayerRoom\Adjacent[i]
EndIf
EndIf
Next
n\PathStatus = FindPath(n,EntityX(closestRoom\obj),0.5,EntityZ(closestRoom\obj))
DebugLog "Find path for 049 in another room (pathstatus: "+n\PathStatus+")"
EndIf
;Making 3 attempts at finding a path
While Int(n\State3) < 3
;Breaking up the path if no "real" path has been found (only 1 waypoint and it is too close)
If n\PathStatus = 1 Then
If n\Path[1]<>Null Then
If n\Path[2]=Null And EntityDistance(n\Path[1]\obj,n\Collider)<0.4 Then
n\PathLocation = 0
n\PathStatus = 0
DebugLog "Breaking up path for 049 because no waypoint number 2 has been found and waypoint number 1 is too close."
EndIf
EndIf
If n\Path[0]<>Null And n\Path[1]=Null Then
n\PathLocation = 0
n\PathStatus = 0
DebugLog "Breaking up path for 049 because no waypoint number 1 has been found."
EndIf
EndIf
;No path could still be found, just make 049 go to a room (further away than the very first attempt)
If n\PathStatus <> 1 Then
closestdist# = 100.0 ;Prevent the PlayerRoom to be considered the closest, so 049 wouldn't try to find a path there
closestRoom.Rooms = PlayerRoom
currdist# = 0.0
For i = 0 To 3
If PlayerRoom\Adjacent[i]<>Null Then
currdist = EntityDistance(PlayerRoom\Adjacent[i]\obj,n\Collider)
If currdist < closestdist Then
closestdist = currdist
For j = 0 To 3
If PlayerRoom\Adjacent[i]\Adjacent[j]<>Null Then
If PlayerRoom\Adjacent[i]\Adjacent[j]<>PlayerRoom Then
closestRoom = PlayerRoom\Adjacent[i]\Adjacent[j]
Exit
EndIf
EndIf
Next
EndIf
EndIf
Next
n\PathStatus = FindPath(n,EntityX(closestRoom\obj),0.5,EntityZ(closestRoom\obj))
DebugLog "Find path for 049 in another further away room (pathstatus: "+n\PathStatus+")"
EndIf
;Making 049 skip waypoints for doors he can't interact with, but only if the actual path is behind him
If n\PathStatus = 1 Then
If n\Path[1]<>Null Then
If n\Path[1]\door<>Null Then
If (n\Path[1]\door\locked Or n\Path[1]\door\KeyCard<>0 Or n\Path[1]\door\Code<>"") And (Not n\Path[1]\door\open) Then
Repeat
If n\PathLocation > 19
n\PathLocation = 0 : n\PathStatus = 0 : Exit
Else
n\PathLocation = n\PathLocation + 1
EndIf
If n\Path[n\PathLocation]<>Null Then
If Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation]\obj))>(45.0-Abs(DeltaYaw(n\Collider,n\Path[1]\obj))) Then
DebugLog "Skip until waypoint number "+n\PathLocation
n\State3 = 3
Exit
EndIf
EndIf
Forever
Else
n\State3 = 3
EndIf
Else
n\State3 = 3
EndIf
EndIf
EndIf
n\State3 = n\State3 + 1
Wend
EndIf
AnimateNPC(n, 269, 345, 0.2)
;[End Block]
EndIf
EndIf
If n\CurrSpeed > 0.005 Then
If (prevFrame < 361 And n\Frame=>361) Or (prevFrame < 377 And n\Frame=>377) Then
PlaySound2(StepSFX(3,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.8,1.0))
ElseIf (prevFrame < 431 And n\Frame=>431) Or (prevFrame < 447 And n\Frame=>447) Then
PlaySound2(StepSFX(3,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.8,1.0))
EndIf
EndIf
If ChannelPlaying(n\SoundChn2)
UpdateSoundOrigin(n\SoundChn2,Camera,n\obj)
EndIf
ElseIf (Not n\Idle)
If ChannelPlaying(n\SoundChn) Then
StopChannel(n\SoundChn)
EndIf
If PlayerInReachableRoom(True) And InFacility=1 Then ;Player is in a room where SCP-049 can teleport to
If Rand(1,3-SelectedDifficulty\otherFactors)=1 Then
TeleportCloser(n)
DebugLog "SCP-049 teleported closer due to distance"
Else
n\Idle = 60*70
DebugLog "SCP-049 is now idle"
EndIf
EndIf
EndIf
;[End Block]
Case 3 ;The player was killed by SCP-049
;[Block]
AnimateNPC(n, 537, 660, 0.7, False)
;Animate2(n\obj, AnimTime(n\obj), 537, 660, 0.7, False)
PositionEntity n\Collider, CurveValue(EntityX(Collider),EntityX(n\Collider),20.0),EntityY(n\Collider),CurveValue(EntityZ(Collider),EntityZ(n\Collider),20.0)
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(Collider)-180.0,EntityYaw(n\Collider),40), 0
;[End Block]
Case 4 ;Standing on catwalk in room4
;[Block]
If dist < 8.0 Then
AnimateNPC(n, 18, 19, 0.05)
;Animate2(n\obj, AnimTime(n\obj), 18, 19, 0.05)
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 45.0), 0
n\State3 = 1
ElseIf dist > HideDistance*0.8 And n\State3 > 0 Then
n\State = 2
n\State3 = 0
For r.Rooms = Each Rooms
If EntityDistance(r\obj,n\Collider)<4.0 Then
TeleportEntity(n\Collider,EntityX(r\obj),0.1,EntityZ(r\obj),n\CollRadius,True)
Exit
EndIf
Next
EndIf
;[End Block]
Case 5 ;used for "room2sl"
;[Block]
n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider)
PlayerSeeAble% = MeNPCSeesPlayer(n,True)
If PlayerSeeAble% = True
n\State = 2
n\PathStatus = 0
n\PathLocation = 0
n\PathTimer = 0
n\State3 = 0
n\State2 = 70*2
n\PrevState = 0
PlaySound_Strict LoadTempSound("SFX\Room\Room2SL049Spawn.ogg")
ElseIf PlayerSeeAble% = 2 And n\State3 > 0.0
n\PathStatus = FindPath(n,EntityX(Collider),EntityY(Collider),EntityZ(Collider))
Else
If n\State3 = 6.0
If EntityDistance(n\Collider,Collider)>HideDistance
n\State = 2
n\PathStatus = 0
n\PathLocation = 0
n\PathTimer = 0
n\State3 = 0
n\PrevState = 0
Else
If n\PathStatus <> 1 Then n\PathStatus = FindPath(n,EntityX(Collider),EntityY(Collider),EntityZ(Collider))
EndIf
EndIf
If n\PathStatus = 1
If n\Path[n\PathLocation]=Null
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
PointEntity n\obj,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0),0
MoveEntity n\Collider,0,0,n\CurrSpeed*FPSfactor
;closes doors behind him
If n\PathLocation>0 Then
If n\Path[n\PathLocation-1] <> Null
If n\Path[n\PathLocation-1]\door <> Null Then
If n\Path[n\PathLocation-1]\door\KeyCard=0
If EntityDistance(n\Path[n\PathLocation-1]\obj,n\Collider)>0.3
If n\Path[n\PathLocation-1]\door\open Then UseDoor(n\Path[n\PathLocation-1]\door, False)
EndIf
EndIf
EndIf
EndIf
EndIf
;opens doors in front of him
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If dist2 < 0.6 Then
If n\Path[n\PathLocation]\door <> Null Then
If n\Path[n\PathLocation]\door\open = False Then UseDoor(n\Path[n\PathLocation]\door, False)
EndIf
EndIf
If dist2#<0.2
n\PathLocation = n\PathLocation + 1
EndIf
AnimateNPC(n, Max(Min(AnimTime(n\obj),358.0),346), 393.0, n\CurrSpeed*38)
EndIf
Else
Select n\PrevState
Case 0
AnimateNPC(n, 269, 345, 0.2)
Case 1
AnimateNPC(n, 661, 891, 0.4, False)
Case 2
AnimateNPC(n, 892, 1119, 0.4, False)
End Select
EndIf
EndIf
If PlayerRoom\RoomTemplate\Name = "room2sl" Then
ShouldPlay = 20
EndIf
If n\CurrSpeed > 0.005 Then
If (prevFrame < 361 And n\Frame=>361) Or (prevFrame < 377 And n\Frame=>377) Then
PlaySound2(StepSFX(3,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.8,1.0))
ElseIf (prevFrame < 431 And n\Frame=>431) Or (prevFrame < 447 And n\Frame=>447)
PlaySound2(StepSFX(3,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.8,1.0))
EndIf
EndIf
If ChannelPlaying(n\SoundChn2)
UpdateSoundOrigin(n\SoundChn2,Camera,n\obj)
EndIf
;[End Block]
End Select
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider)-0.22, EntityZ(n\Collider))
RotateEntity n\obj, 0, EntityYaw(n\Collider), 0
n\LastSeen = Max(n\LastSeen-FPSfactor,0)
n\State2 = Max(n\State2-FPSfactor,0)
;[End Block]
Case NPCtypeZombie
;[Block]
If Abs(EntityY(Collider)-EntityY(n\Collider))<4.0 Then
prevFrame# = n\Frame
If (Not n\IsDead)
Select n\State
Case 0
;[Block]
AnimateNPC(n, 719, 777, 0.2, False)
If n\Frame=777 Then
If Rand(700)=1 Then
If EntityDistance(Collider, n\Collider)<5.0 Then
n\Frame = 719
EndIf
EndIf
EndIf
;[End Block]
Case 1 ;stands up
;[Block]
If n\Frame=>682 Then
AnimateNPC(n, 926, 935, 0.3, False)
If n\Frame = 935 Then n\State = 2
;Animate2(n\obj, AnimTime(n\obj), 926, 935, 0.3, False)
;If AnimTime(n\obj)=935 Then n\State = 2
Else
AnimateNPC(n, 155, 682, 1.5, False)
;Animate2(n\obj, AnimTime(n\obj), 155, 682, 1.5, False)
EndIf
;[End Block]
Case 2 ;following the player
;[Block]
If n\State3 < 0 Then ;check if the player is visible every three seconds
If EntityDistance(Collider, n\Collider)<5.0 Then
If EntityVisible(Collider, n\Collider) Then n\State2 = 70*5
EndIf
n\State3=70*3
Else
n\State3=n\State3-FPSfactor
EndIf
If n\State2 > 0 And (Not NoTarget) Then ;player is visible -> attack
n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 6.0, 0.6)
n\PathStatus = 0
dist = EntityDistance(Collider, n\Collider)
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 30.0), 0
If dist < 0.7 Then
n\State = 3
If Rand(2)=1 Then
n\Frame = 2
;SetAnimTime n\obj, 2
Else
n\Frame = 66
;SetAnimTime n\obj, 66
EndIf
Else
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
AnimateNPC(n, 936, 1017, n\CurrSpeed*60)
;Animate2(n\obj, AnimTime(n\obj), 936, 1017, n\CurrSpeed*60)
EndIf
n\State2=n\State2-FPSfactor
Else
If n\PathStatus = 1 Then ;path found
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 30.0), 0
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
AnimateNPC(n, 936, 1017, n\CurrSpeed*60)
;Animate2(n\obj, AnimTime(n\obj), 936, 1017, n\CurrSpeed*60)
If EntityDistance(n\Collider,n\Path[n\PathLocation]\obj) < 0.2 Then
n\PathLocation = n\PathLocation + 1
EndIf
EndIf
Else ;no path to the player, stands still
n\CurrSpeed = 0
AnimateNPC(n, 778, 926, 0.1)
;Animate2(n\obj, AnimTime(n\obj), 778, 926, 0.1)
n\PathTimer = n\PathTimer-FPSfactor
If n\PathTimer =< 0 Then
n\PathStatus = FindPath(n, EntityX(Collider),EntityY(Collider)+0.1,EntityZ(Collider))
n\PathTimer = n\PathTimer+70*5
EndIf
EndIf
EndIf
;65, 80, 93, 109, 123
If n\CurrSpeed > 0.005 Then
If (prevFrame < 977 And n\Frame=>977) Or (prevFrame > 1010 And n\Frame<940) Then
;PlaySound2(StepSFX(0,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
EndIf
EndIf
;[End Block]
Case 3
;[Block]
If NoTarget Then n\State = 2
If n\Frame < 66 Then
AnimateNPC(n, 2, 65, 0.7, False)
;Animate2(n\obj, AnimTime(n\obj), 2, 65, 0.7, False)
If prevFrame < 23 And n\Frame=>23 Then
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
PlaySound_Strict DamageSFX(Rand(5,8))
Injuries = Injuries+Rnd(0.4,1.0)
DeathMSG = "Subject D-9341. Cause of death: multiple lacerations and severe blunt force trauma caused by an instance of SCP-049-2."
EndIf
EndIf
ElseIf n\Frame=65 Then
n\State = 2
EndIf
Else
AnimateNPC(n, 66, 132, 0.7, False)
;Animate2(n\obj, AnimTime(n\obj), 66, 132, 0.7, False)
If prevFrame < 90 And n\Frame=>90 Then
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
PlaySound_Strict DamageSFX(Rand(5,8))
Injuries = Injuries+Rnd(0.4,1.0)
DeathMSG = "Subject D-9341. Cause of death: multiple lacerations and severe blunt force trauma caused by an instance of SCP-049-2."
EndIf
EndIf
ElseIf n\Frame=132 Then
n\State = 2
EndIf
EndIf
;[End Block]
End Select
Else
AnimateNPC(n, 133, 157, 0.5, False)
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.2, EntityZ(n\Collider))
RotateEntity n\obj, -90, EntityYaw(n\Collider), 0
EndIf
;[End Block]
Case NPCtypeGuard ;------------------------------------------------------------------------------------------------------------------
;[Block]
prevFrame# = n\Frame
n\BoneToManipulate = ""
;n\BoneToManipulate2 = ""
n\ManipulateBone = False
n\ManipulationType = 0
n\NPCNameInSection = "Guard"
Select n\State
Case 1 ;aims and shoots at the player
;[Block]
If n\Frame < 39 Or (n\Frame > 76 And n\Frame < 245) Or (n\Frame > 248 And n\Frame < 302) Or n\Frame > 344
AnimateNPC(n,345,357,0.2,False)
If n\Frame >= 356 Then SetNPCFrame(n,302)
EndIf
;Animate2(n\obj, AnimTime(n\obj), 1539, 1553, 0.2, False)
If KillTimer => 0 Then
dist = EntityDistance(n\Collider,Collider)
Local ShootAccuracy# = 0.4+0.5*SelectedDifficulty\aggressiveNPCs
Local DetectDistance# = 11.0
;If at Gate B increase his distance so that he can shoot the player from a distance after they are spotted.
If PlayerRoom\RoomTemplate\Name = "exit1" Then
DetectDistance = 21.0
ShootAccuracy = 0.0
If Rand(1,8-SelectedDifficulty\aggressiveNPCs*4)<2 Then ShootAccuracy = 0.03
;increase accuracy if the player is going slow
ShootAccuracy = ShootAccuracy + (0.5 - CurrSpeed*20)
EndIf
If dist < DetectDistance Then
pvt% = CreatePivot()
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider), EntityZ(n\Collider))
PointEntity(pvt, Collider)
RotateEntity(pvt, Min(EntityPitch(pvt), 20), EntityYaw(pvt), 0)
RotateEntity(n\Collider, CurveAngle(EntityPitch(pvt), EntityPitch(n\Collider), 10), CurveAngle(EntityYaw(pvt), EntityYaw(n\Collider), 10), 0, True)
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider)+0.8, EntityZ(n\Collider))
PointEntity(pvt, Collider)
RotateEntity(pvt, Min(EntityPitch(pvt), 40), EntityYaw(n\Collider), 0)
If n\Reload = 0 ;And n\Frame>1550 Then
DebugLog "entitypick"
EntityPick(pvt, dist)
If PickedEntity() = Collider Or n\State3=1 Then
Local instaKillPlayer% = False
If PlayerRoom\RoomTemplate\Name = "start" Then
DeathMSG = "Subject D-9341. Cause of death: Gunshot wound to the head. The surveillance tapes confirm that the subject was terminated by Agent Ulgrin shortly after the site lockdown was initiated."
instaKillPlayer = True
ElseIf PlayerRoom\RoomTemplate\Name = "exit1" Then
DeathMSG = Chr(34)+"Agent G. to control. Eliminated a Class D escapee in Gate B's courtyard."+Chr(34)
Else
DeathMSG = ""
EndIf
PlaySound2(GunshotSFX, Camera, n\Collider, 35)
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
PointEntity pvt, Collider
Shoot(EntityX(pvt), EntityY(pvt), EntityZ(pvt), ShootAccuracy, False, instaKillPlayer)
n\Reload = 7
Else
n\CurrSpeed = n\Speed
End If
EndIf
If n\Reload > 0 And n\Reload <= 7
AnimateNPC(n,245,248,0.35,True)
Else
If n\Frame < 302
AnimateNPC(n,302,344,0.35,True)
EndIf
EndIf
FreeEntity(pvt)
Else
AnimateNPC(n,302,344,0.35,True)
EndIf
n\ManipulateBone = True
If n\State2 = 10 Then ;Hacky way of applying spine pitch to specific guards.
n\BoneToManipulate = "Chest"
n\ManipulationType = 3
Else
n\BoneToManipulate = "Chest"
n\ManipulationType = 0
EndIf
Else
n\State = 0
EndIf
;[End Block]
Case 2 ;shoots
;[Block]
AnimateNPC(n,245,248,0.35,True)
;DebugLog "shoot"
;Animate2(n\obj, AnimTime(n\obj), 1539, 1553, 0.35, False)
If n\Reload = 0 ;And n\Frame > 1545 Then
PlaySound2(GunshotSFX, Camera, n\Collider, 20)
p.Particles = CreateParticle(EntityX(n\obj, True), EntityY(n\obj, True), EntityZ(n\obj, True), 1, 0.2, 0.0, 5)
PositionEntity(p\pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
RotateEntity(p\pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
MoveEntity (p\pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
n\Reload = 7
End If
;[End Block]
Case 3 ;follows a path
;[Block]
If n\PathStatus = 2 Then
n\State = 0
n\CurrSpeed = 0
ElseIf n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
AnimateNPC(n,1,38,n\CurrSpeed*40)
;Animate2(n\obj, AnimTime(n\obj), 1614, 1641, n\CurrSpeed*30)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
If EntityDistance(n\Collider,n\Path[n\PathLocation]\obj) < 0.2 Then
n\PathLocation = n\PathLocation + 1
EndIf
EndIf
Else
n\CurrSpeed = 0
n\State = 4
EndIf
;[End Block]
Case 4
;[Block]
AnimateNPC(n,77,201,0.2)
;Animate2(n\obj, AnimTime(n\obj), 923, 1354, 0.2)
If Rand(400) = 1 Then n\Angle = Rnd(-180, 180)
RotateEntity(n\Collider, 0, CurveAngle(n\Angle + Sin(MilliSecs2() / 50) * 2, EntityYaw(n\Collider), 150.0), 0, True)
dist# = EntityDistance(n\Collider, Collider)
If dist < 15.0 Then
If WrapAngle(EntityYaw(n\Collider)-DeltaYaw(n\Collider, Collider))<90 Then
If EntityVisible(pvt,Collider) Then n\State = 1
EndIf
EndIf
;[End Block]
Case 5 ;following a target
;[Block]
RotateEntity n\Collider, 0, CurveAngle(VectorYaw(n\EnemyX-EntityX(n\Collider), 0, n\EnemyZ-EntityZ(n\Collider))+n\Angle, EntityYaw(n\Collider), 20.0), 0
dist# = Distance(EntityX(n\Collider),EntityZ(n\Collider),n\EnemyX,n\EnemyZ)
AnimateNPC(n,1,38,n\CurrSpeed*40)
If dist > 2.0 Or dist < 1.0 Then
n\CurrSpeed = CurveValue(n\Speed*Sgn(dist-1.5)*0.75, n\CurrSpeed, 10.0)
Else
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 10.0)
EndIf
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
;[End Block]
Case 7
;[Block]
AnimateNPC(n,77,201,0.2)
;Animate2(n\obj, AnimTime(n\obj), 923, 1354, 0.2)
;[End Block]
Case 8
Case 9
;[Block]
AnimateNPC(n,77,201,0.2)
n\BoneToManipulate = "head"
n\ManipulateBone = True
n\ManipulationType = 0
n\Angle = EntityYaw(n\Collider)
;[End Block]
Case 10
;[Block]
AnimateNPC(n, 1, 38, n\CurrSpeed*40)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
;[End Block]
Case 11
;[Block]
If n\Frame < 39 Or (n\Frame > 76 And n\Frame < 245) Or (n\Frame > 248 And n\Frame < 302) Or n\Frame > 344
AnimateNPC(n,345,357,0.2,False)
If n\Frame >= 356 Then SetNPCFrame(n,302)
EndIf
If KillTimer => 0 Then
dist = EntityDistance(n\Collider,Collider)
Local SearchPlayer% = False
If dist < 11.0
If EntityVisible(n\Collider,Collider)
SearchPlayer = True
EndIf
EndIf
If SearchPlayer
pvt% = CreatePivot()
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider), EntityZ(n\Collider))
PointEntity(pvt, Collider)
RotateEntity(pvt, Min(EntityPitch(pvt), 20), EntityYaw(pvt), 0)
RotateEntity(n\Collider, CurveAngle(EntityPitch(pvt), EntityPitch(n\Collider), 10), CurveAngle(EntityYaw(pvt), EntityYaw(n\Collider), 10), 0, True)
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider)+0.8, EntityZ(n\Collider))
PointEntity(pvt, Collider)
RotateEntity(pvt, Min(EntityPitch(pvt), 40), EntityYaw(n\Collider), 0)
If n\Reload = 0
DebugLog "entitypick"
EntityPick(pvt, dist)
If PickedEntity() = Collider Or n\State3=1 Then
instaKillPlayer% = False
DeathMSG = ""
PlaySound2(GunshotSFX, Camera, n\Collider, 35)
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
PointEntity pvt, Collider
Shoot(EntityX(pvt), EntityY(pvt), EntityZ(pvt), 1.0, False, instaKillPlayer)
n\Reload = 7
Else
n\CurrSpeed = n\Speed
End If
EndIf
If n\Reload > 0 And n\Reload <= 7
AnimateNPC(n,245,248,0.35,True)
Else
If n\Frame < 302
AnimateNPC(n,302,344,0.35,True)
EndIf
EndIf
FreeEntity(pvt)
Else
If n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
AnimateNPC(n,39,76,n\CurrSpeed*40)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
If EntityDistance(n\Collider,n\Path[n\PathLocation]\obj) < 0.2 Then
n\PathLocation = n\PathLocation + 1
EndIf
EndIf
Else
If n\PathTimer = 0 Then n\PathStatus = FindPath(n,EntityX(Collider),EntityY(Collider)+0.5,EntityZ(Collider))
Local wayPointCloseToPlayer.WayPoints
wayPointCloseToPlayer = Null
For wp.WayPoints = Each WayPoints
If EntityDistance(wp\obj,Collider)<2.0
wayPointCloseToPlayer = wp
Exit
EndIf
Next
If wayPointCloseToPlayer<>Null
n\PathTimer = 1
If EntityVisible(wayPointCloseToPlayer\obj,n\Collider)
If Abs(DeltaYaw(n\Collider,wayPointCloseToPlayer\obj))>0
PointEntity n\obj, wayPointCloseToPlayer\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
EndIf
EndIf
Else
n\PathTimer = 0
EndIf
If n\PathTimer = 1
AnimateNPC(n,39,76,n\CurrSpeed*40)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
EndIf
EndIf
If prevFrame < 43 And n\Frame=>43 Then
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
ElseIf prevFrame < 61 And n\Frame=>61
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
EndIf
EndIf
Else
n\State = 0
EndIf
;[End Block]
Case 12
;[Block]
If n\Frame < 39 Or (n\Frame > 76 And n\Frame < 245) Or (n\Frame > 248 And n\Frame < 302) Or n\Frame > 344
AnimateNPC(n,345,357,0.2,False)
If n\Frame >= 356 Then SetNPCFrame(n,302)
EndIf
If n\Frame < 345
AnimateNPC(n,302,344,0.35,True)
EndIf
pvt% = CreatePivot()
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider), EntityZ(n\Collider))
If n\State2 = 1.0
PointEntity(pvt, Collider)
Else
RotateEntity pvt,0,n\Angle,0
EndIf
RotateEntity(pvt, Min(EntityPitch(pvt), 20), EntityYaw(pvt), 0)
RotateEntity(n\Collider, CurveAngle(EntityPitch(pvt), EntityPitch(n\Collider), 10), CurveAngle(EntityYaw(pvt), EntityYaw(n\Collider), 10), 0, True)
PositionEntity(pvt, EntityX(n\Collider), EntityY(n\Collider)+0.8, EntityZ(n\Collider))
If n\State2 = 1.0
PointEntity(pvt, Collider)
n\ManipulateBone = True
n\BoneToManipulate = "Chest"
n\ManipulationType = 0
Else
RotateEntity pvt,0,n\Angle,0
EndIf
RotateEntity(pvt, Min(EntityPitch(pvt), 40), EntityYaw(n\Collider), 0)
FreeEntity(pvt)
UpdateSoundOrigin(n\SoundChn,Camera,n\Collider,20)
;[End Block]
Case 13
;[Block]
AnimateNPC(n,202,244,0.35,True)
;[End Block]
Case 14
;[Block]
If n\PathStatus = 2 Then
n\State = 13
n\CurrSpeed = 0
ElseIf n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
AnimateNPC(n,39,76,n\CurrSpeed*40)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
If EntityDistance(n\Collider,n\Path[n\PathLocation]\obj) < 0.2 Then
n\PathLocation = n\PathLocation + 1
EndIf
EndIf
Else
n\CurrSpeed = 0
n\State = 13
EndIf
If prevFrame < 43 And n\Frame=>43 Then
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
ElseIf prevFrame < 61 And n\Frame=>61
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
EndIf
;[End Block]
Default
;[Block]
If Rand(400) = 1 Then n\PrevState = Rnd(-30, 30)
n\PathStatus = 0
AnimateNPC(n,77,201,0.2)
RotateEntity(n\Collider, 0, CurveAngle(n\Angle + n\PrevState + Sin(MilliSecs2() / 50) * 2, EntityYaw(n\Collider), 50), 0, True)
;[End Block]
End Select
If n\CurrSpeed > 0.01 Then
If prevFrame < 5 And n\Frame>=5
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
ElseIf prevFrame < 23 And n\Frame>=23
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
EndIf
EndIf
If n\Frame > 286.5 And n\Frame < 288.5
n\IsDead = True
EndIf
n\Reload = Max(0, n\Reload - FPSfactor)
;RotateEntity(n\Collider, 0, EntityYaw(n\Collider), 0, True)
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.2, EntityZ(n\Collider))
;RotateEntity n\obj, EntityPitch(n\Collider)-90, EntityYaw(n\Collider), 0
RotateEntity n\obj, 0, EntityYaw(n\Collider)+180, 0
;[End Block]
Case NPCtypeMTF ;------------------------------------------------------------------------------------------------------------------
;[Block]
UpdateMTFUnit(n)
;[End Block]
Case NPCtypeD,NPCtypeClerk ;------------------------------------------------------------------------------------------------------------------
;[Block]
RotateEntity(n\Collider, 0, EntityYaw(n\Collider), EntityRoll(n\Collider), True)
prevFrame = AnimTime(n\obj)
Select n\State
Case 0 ;idle
n\CurrSpeed = CurveValue(0.0, n\CurrSpeed, 5.0)
Animate2(n\obj, AnimTime(n\obj), 210, 235, 0.1)
Case 1 ;walking
If n\State2 = 1.0
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
Else
n\CurrSpeed = CurveValue(0.015, n\CurrSpeed, 5.0)
EndIf
Animate2(n\obj, AnimTime(n\obj), 236, 260, n\CurrSpeed * 18)
Case 2 ;running
n\CurrSpeed = CurveValue(0.03, n\CurrSpeed, 5.0)
Animate2(n\obj, AnimTime(n\obj), 301, 319, n\CurrSpeed * 18)
End Select
If n\State2 <> 2
If n\State = 1
If n\CurrSpeed > 0.01 Then
If prevFrame < 244 And AnimTime(n\obj)=>244 Then
PlaySound2(StepSFX(GetStepSound(n\Collider),0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
ElseIf prevFrame < 256 And AnimTime(n\obj)=>256
PlaySound2(StepSFX(GetStepSound(n\Collider),0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
EndIf
EndIf
ElseIf n\State = 2
If n\CurrSpeed > 0.01 Then
If prevFrame < 309 And AnimTime(n\obj)=>309
PlaySound2(StepSFX(GetStepSound(n\Collider),1,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
ElseIf prevFrame =< 319 And AnimTime(n\obj)=<301
PlaySound2(StepSFX(GetStepSound(n\Collider),1,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
EndIf
EndIf
EndIf
EndIf
If n\Frame = 19 Or n\Frame = 60
n\IsDead = True
EndIf
If AnimTime(n\obj)=19 Or AnimTime(n\obj)=60
n\IsDead = True
EndIf
MoveEntity(n\Collider, 0, 0, n\CurrSpeed * FPSfactor)
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.32, EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider), EntityYaw(n\Collider)-180.0, 0
;[End Block]
Case NPCtype5131
;[Block]
;If KeyHit(48) Then n\Idle = True : n\State2 = 0
If PlayerRoom\RoomTemplate\Name <> "pocketdimension" Then
If n\Idle Then
HideEntity(n\obj)
HideEntity(n\obj2)
If Rand(200)=1 Then
For w.WayPoints = Each WayPoints
If w\room<>PlayerRoom Then
x = Abs(EntityX(Collider)-EntityX(w\obj,True))
If x>3 And x < 9 Then
z = Abs(EntityZ(Collider)-EntityZ(w\obj,True))
If z>3 And z < 9 Then
PositionEntity(n\Collider, EntityX(w\obj,True), EntityY(w\obj,True), EntityZ(w\obj,True))
PositionEntity(n\obj, EntityX(w\obj,True), EntityY(w\obj,True), EntityZ(w\obj,True))
ResetEntity n\Collider
ShowEntity(n\obj)
ShowEntity(n\obj2)
n\LastSeen = 0
n\Path[0]=w
n\Idle = False
n\State2 = Rand(15,20)*70
n\State = Max(Rand(-1,2),0)
n\PrevState = Rand(0,1)
Exit
EndIf
EndIf
EndIf
Next
End If
Else
dist = EntityDistance(Collider, n\Collider)
;use the prev-values to do a "twitching" effect
n\PrevX = CurveValue(0.0, n\PrevX, 10.0)
n\PrevZ = CurveValue(0.0, n\PrevZ, 10.0)
If Rand(100)=1 Then
If Rand(5)=1 Then
n\PrevX = (EntityX(Collider)-EntityX(n\Collider))*0.9
n\PrevZ = (EntityZ(Collider)-EntityZ(n\Collider))*0.9
Else
n\PrevX = Rnd(0.1,0.5)
n\PrevZ = Rnd(0.1,0.5)
EndIf
EndIf
temp = Rnd(-1.0,1.0)
PositionEntity n\obj2, EntityX(n\Collider)+n\PrevX*temp, EntityY(n\Collider) - 0.2 + Sin((MilliSecs2()/8-45) Mod 360)*0.05, EntityZ(n\Collider)+n\PrevZ*temp
RotateEntity n\obj2, 0, EntityYaw(n\obj), 0
If (Floor(AnimTime(n\obj2))<>Floor(n\Frame)) Then SetAnimTime n\obj2, n\Frame
If n\State = 0 Then
If n\PrevState=0
AnimateNPC(n,2,74,0.2)
Else
AnimateNPC(n,75,124,0.2)
EndIf
;AnimateNPC(n, 229, 299, 0.2)
If n\LastSeen Then
PointEntity n\obj2, Collider
RotateEntity n\obj, 0, CurveAngle(EntityYaw(n\obj2),EntityYaw(n\obj),40), 0
If dist < 4 Then n\State = Rand(1,2)
Else
If dist < 6 And Rand(5)=1 Then
If EntityInView(n\Collider,Camera) Then
If EntityVisible(Collider, n\Collider) Then
n\LastSeen = 1
PlaySound_Strict LoadTempSound("SFX\SCP\513\Bell"+Rand(2,3)+".ogg")
EndIf
EndIf
EndIf
EndIf
Else
If n\Path[0]=Null Then
;move towards a waypoint that is:
;1. max 8 units away from 513-1
;2. further away from the player than 513-1's current position
For w.WayPoints = Each WayPoints
x = Abs(EntityX(n\Collider,True)-EntityX(w\obj,True))
If x < 8.0 And x > 1.0 Then
z = Abs(EntityZ(n\Collider,True)-EntityZ(w\obj,True))
If z < 8.0 And z > 1.0 Then
If EntityDistance(Collider, w\obj) > dist Then
n\Path[0]=w
Exit
EndIf
EndIf
EndIf
Next
;no suitable path found -> 513-1 simply disappears
If n\Path[0] = Null Then
n\Idle = True
n\State2 = 0
EndIf
Else
If EntityDistance(n\Collider, n\Path[0]\obj) > 1.0 Then
PointEntity n\obj, n\Path[0]\obj
RotateEntity n\Collider, CurveAngle(EntityPitch(n\obj),EntityPitch(n\Collider),15.0), CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),15.0), 0, True
n\CurrSpeed = CurveValue(0.05*Max((7.0-dist)/7.0,0.0),n\CurrSpeed,15.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
If Rand(200)=1 Then MoveEntity n\Collider, 0, 0, 0.5
RotateEntity n\Collider, 0, EntityYaw(n\Collider), 0, True
Else
For i = 0 To 4
If n\Path[0]\connected[i] <> Null Then
If EntityDistance(Collider, n\Path[0]\connected[i]\obj) > dist Then
If n\LastSeen = 0 Then
If EntityInView(n\Collider,Camera) Then
If EntityVisible(Collider, n\Collider) Then
n\LastSeen = 1
PlaySound_Strict LoadTempSound("SFX\SCP\513\Bell"+Rand(2,3)+".ogg")
EndIf
EndIf
EndIf
n\Path[0]=n\Path[0]\connected[i]
Exit
EndIf
EndIf
Next
If n\Path[0]=Null Then n\State2 = 0
EndIf
EndIf
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.2 + Sin((MilliSecs2()/8) Mod 360)*0.1, EntityZ(n\Collider))
Select n\State
Case 1
If n\PrevState=0
AnimateNPC(n,125,194,n\CurrSpeed*20)
Else
AnimateNPC(n,195,264,n\CurrSpeed*20)
EndIf
;AnimateNPC(n, 458, 527, n\CurrSpeed*20)
RotateEntity n\obj, 0, EntityYaw(n\Collider), 0
Case 2
If n\PrevState=0
AnimateNPC(n,2,74,0.2)
Else
AnimateNPC(n,75,124,0.2)
EndIf
;AnimateNPC(n, 229, 299, 0.2)
RotateEntity n\obj, 0, EntityYaw(n\Collider), 0
End Select
If n\State2 > 0 Then
If dist < 4.0 Then n\State2 = n\State2-FPSfactor*4
n\State2 = n\State2-FPSfactor
Else
n\Path[0]=Null
n\Idle = True
n\State2=0
EndIf
End If
EndIf
n\DropSpeed = 0
ResetEntity(n\Collider)
;[End Block]
Case NPCtype372 ;------------------------------------------------------------------------------------------------------------------
;[Block]
RN$ = PlayerRoom\RoomTemplate\Name
If RN$ <> "pocketdimension" And RN$ <> "dimension1499" Then
If n\Idle Then
HideEntity(n\obj)
If Rand(50) = 1 And (BlinkTimer < -5 And BlinkTimer > -15) Then
ShowEntity(n\obj)
angle# = EntityYaw(Collider)+Rnd(-90,90)
dist = Rnd(1.5, 2.0)
PositionEntity(n\Collider, EntityX(Collider) + Sin(angle) * dist, EntityY(Collider)+0.2, EntityZ(Collider) + Cos(angle) * dist)
n\Idle = False
n\State = Rand(20, 60)
If Rand(300)=1 Then PlaySound2(RustleSFX(Rand(0,2)),Camera, n\obj, 8, Rnd(0.0,0.2))
End If
Else
PositionEntity(n\obj, EntityX(n\Collider) + Rnd(-0.005, 0.005), EntityY(n\Collider)+0.3+0.1*Sin(MilliSecs2()/2), EntityZ(n\Collider) + Rnd(-0.005, 0.005))
RotateEntity n\obj, 0, EntityYaw(n\Collider), ((MilliSecs2()/5) Mod 360)
AnimateNPC(n, 32, 113, 0.4)
;Animate2(n\obj, AnimTime(n\obj), 32, 113, 0.4)
If EntityInView(n\obj, Camera) Then
GiveAchievement(Achv372)
If Rand(30)=1 Then
If (Not ChannelPlaying(n\SoundChn)) Then
If EntityVisible(Camera, n\obj) Then
n\SoundChn = PlaySound2(RustleSFX(Rand(0,2)),Camera, n\obj, 8, 0.3)
EndIf
EndIf
EndIf
temp = CreatePivot()
PositionEntity temp, EntityX(Collider), EntityY(Collider), EntityZ(Collider)
PointEntity temp, n\Collider
angle = WrapAngle(EntityYaw(Collider)-EntityYaw(temp))
If angle < 180 Then
RotateEntity n\Collider, 0, EntityYaw(Collider)-80, 0
Else
RotateEntity n\Collider, 0, EntityYaw(Collider)+80, 0
EndIf
FreeEntity temp
MoveEntity n\Collider, 0, 0, 0.03*FPSfactor
n\State = n\State-FPSfactor
EndIf
n\State=n\State-(FPSfactor/80.0)
If n\State <= 0 Then n\Idle = True
End If
EndIf
n\DropSpeed = 0
ResetEntity(n\Collider)
;[End Block]
Case NPCtypeApache ;------------------------------------------------------------------------------------------------------------------
;[Block]
dist = EntityDistance(Collider, n\Collider)
If dist<60.0 Then
If PlayerRoom\RoomTemplate\Name = "exit1" Then
dist2 = Max(Min(EntityDistance(n\Collider, PlayerRoom\Objects[3])/(8000.0*RoomScale),1.0),0.0)
Else
dist2 = 1.0
EndIf
n\SoundChn = LoopSound2(ApacheSFX, n\SoundChn, Camera, n\Collider, 25.0, dist2)
EndIf
n\DropSpeed = 0
Select n\State
Case 0,1
TurnEntity(n\obj2,0,20.0*FPSfactor,0)
TurnEntity(n\obj3,20.0*FPSfactor,0,0)
If n\State=1 And (Not NoTarget) Then
If Abs(EntityX(Collider)-EntityX(n\Collider))< 30.0 Then
If Abs(EntityZ(Collider)-EntityZ(n\Collider))<30.0 Then
If Abs(EntityY(Collider)-EntityY(n\Collider))<20.0 Then
If Rand(20)=1 Then
If EntityVisible(Collider, n\Collider) Then
n\State = 2
PlaySound2(AlarmSFX(2), Camera, n\Collider, 50, 1.0)
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
Case 2,3 ;player located -> attack
If n\State = 2 Then
target = Collider
ElseIf n\State = 3
target=CreatePivot()
PositionEntity target, n\EnemyX, n\EnemyY, n\EnemyZ, True
EndIf
If NoTarget And n\State = 2 Then n\State = 1
TurnEntity(n\obj2,0,20.0*FPSfactor,0)
TurnEntity(n\obj3,20.0*FPSfactor,0,0)
If Abs(EntityX(target)-EntityX(n\Collider)) < 55.0 Then
If Abs(EntityZ(target)-EntityZ(n\Collider)) < 55.0 Then
If Abs(EntityY(target)-EntityY(n\Collider))< 20.0 Then
PointEntity n\obj, target
RotateEntity n\Collider, CurveAngle(Min(WrapAngle(EntityPitch(n\obj)),40.0),EntityPitch(n\Collider),40.0), CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),90.0), EntityRoll(n\Collider), True
PositionEntity(n\Collider, EntityX(n\Collider), CurveValue(EntityY(target)+8.0,EntityY(n\Collider),70.0), EntityZ(n\Collider))
dist# = Distance(EntityX(target),EntityZ(target),EntityX(n\Collider),EntityZ(n\Collider))
n\CurrSpeed = CurveValue(Min(dist-6.5,6.5)*0.008, n\CurrSpeed, 50.0)
;If Distance(EntityX(Collider),EntityZ(Collider),EntityX(n\collider),EntityZ(n\collider)) > 6.5 Then
; n\currspeed = CurveValue(0.08,n\currspeed,50.0)
;Else
; n\currspeed = CurveValue(0.0,n\currspeed,30.0)
;EndIf
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
If n\PathTimer = 0 Then
n\PathStatus = EntityVisible(n\Collider,target)
n\PathTimer = Rand(100,200)
Else
n\PathTimer = Min(n\PathTimer-FPSfactor,0.0)
EndIf
If n\PathStatus = 1 Then ;player visible
RotateEntity n\Collider, EntityPitch(n\Collider), EntityYaw(n\Collider), CurveAngle(0, EntityRoll(n\Collider),40), True
If n\Reload =< 0 Then
If dist<20.0 Then
pvt = CreatePivot()
PositionEntity pvt, EntityX(n\Collider),EntityY(n\Collider), EntityZ(n\Collider)
RotateEntity pvt, EntityPitch(n\Collider), EntityYaw(n\Collider),EntityRoll(n\Collider)
MoveEntity pvt, 0, 8.87*(0.21/9.0), 8.87*(1.7/9.0) ;2.3
PointEntity pvt, target
If WrapAngle(EntityYaw(pvt)-EntityYaw(n\Collider))<10 Then
PlaySound2(Gunshot2SFX, Camera, n\Collider, 20)
If PlayerRoom\RoomTemplate\Name = "exit1" Then
DeathMSG = Chr(34)+"CH-2 to control. Shot down a runaway Class D at Gate B."+Chr(34)
Else
DeathMSG = Chr(34)+"CH-2 to control. Shot down a runaway Class D at Gate A."+Chr(34)
EndIf
Shoot( EntityX(pvt),EntityY(pvt), EntityZ(pvt),((10/dist)*(1/dist))*(n\State=2),(n\State=2))
n\Reload = 5
EndIf
FreeEntity pvt
EndIf
EndIf
Else
RotateEntity n\Collider, EntityPitch(n\Collider), EntityYaw(n\Collider), CurveAngle(-20, EntityRoll(n\Collider),40), True
EndIf
MoveEntity n\Collider, -EntityRoll(n\Collider)*0.002,0,0
n\Reload=n\Reload-FPSfactor
EndIf
EndIf
EndIf
If n\State = 3 Then FreeEntity target
Case 4 ;crash
If n\State2 < 300 Then
TurnEntity(n\obj2,0,20.0*FPSfactor,0)
TurnEntity(n\obj3,20.0*FPSfactor,0,0)
TurnEntity n\Collider,0,-FPSfactor*7,0;Sin(MilliSecs2()/40)*FPSfactor
n\State2=n\State2+FPSfactor*0.3
target=CreatePivot()
PositionEntity target, n\EnemyX, n\EnemyY, n\EnemyZ, True
PointEntity n\obj, target
MoveEntity n\obj, 0,0,FPSfactor*0.001*n\State2
PositionEntity(n\Collider, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
If EntityDistance(n\obj, target) <0.3 Then
;If TempSound2 <> 0 Then FreeSound_Strict TempSound2 : TempSound2 = 0
;TempSound2 = LoadSound_Strict("SFX\Character\Apache\Crash"+Rand(1,2)+".ogg")
CameraShake = Max(CameraShake, 3.0)
;PlaySound_Strict TempSound2
PlaySound_Strict LoadTempSound("SFX\Character\Apache\Crash"+Rand(1,2)+".ogg")
n\State = 5
EndIf
FreeEntity target
EndIf
End Select
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider), EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider), EntityYaw(n\Collider), EntityRoll(n\Collider), True
;[End Block]
Case NPCtypeTentacle
;[Block]
dist = EntityDistance(n\Collider,Collider)
If dist < HideDistance
Select n\State
Case 0 ;spawn
If n\Frame>283 Then
HeartBeatVolume = Max(CurveValue(1.0, HeartBeatVolume, 50),HeartBeatVolume)
HeartBeatRate = Max(CurveValue(130, HeartBeatRate, 100),HeartBeatRate)
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),25.0), 0
AnimateNPC(n, 283, 389, 0.3, False)
;Animate2(n\obj, AnimTime(n\obj), 283, 389, 0.3, False)
If n\Frame>388 Then
n\State = 1
FreeSound_Strict n\Sound2 : n\Sound2 = 0
EndIf
Else
If dist < 2.5 Then
SetNPCFrame(n, 284)
n\Sound2 = LoadSound_Strict("SFX\Room\035Chamber\TentacleSpawn.ogg")
PlaySound_Strict(n\Sound2)
EndIf
EndIf
;spawn 283,389
;attack 2, 32
;idle 33, 174
Case 1 ;idle
If n\Sound2=0 Then
FreeSound_Strict n\Sound2 : n\Sound2=0
n\Sound2 = LoadSound_Strict("SFX\Room\035Chamber\TentacleIdle.ogg")
EndIf
n\SoundChn2 = LoopSound2(n\Sound2,n\SoundChn2,Camera,n\Collider)
If dist < 1.8 Then
If Abs(DeltaYaw(n\Collider, Collider))<20 Then
n\State = 2
If n\Sound<>0 Then FreeSound_Strict n\Sound : n\Sound = 0
;If n\Sound2<>0 Then FreeSound_Strict n\Sound2 : n\Sound2 = 0
EndIf
EndIf
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),25.0), 0
AnimateNPC(n, 33, 174, 0.3, True)
;Animate2(n\obj, AnimTime(n\obj), 33, 174, 0.3, True)
Case 2
;finish the idle animation before playing the attack animation
If n\Frame>33 And n\Frame<174 Then
AnimateNPC(n, 33, 174, 2.0, False)
;Animate2(n\obj, AnimTime(n\obj), 33, 174, 2.0, False)
Else
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),10.0), 0
If n\Frame>33 Then
;SetAnimTime(n\obj,2)
If n\Sound2<>0 Then FreeSound_Strict n\Sound2 : n\Sound2 = 0
n\Frame = 2
n\Sound = LoadSound_Strict("SFX\Room\035Chamber\TentacleAttack"+Rand(1,2)+".ogg")
PlaySound_Strict(n\Sound)
EndIf
AnimateNPC(n, 2, 32, 0.3, False)
;Animate2(n\obj, AnimTime(n\obj), 2, 32, 0.3, False)
If n\Frame>=5 And n\Frame<6 Then
If dist < 1.8 Then
If Abs(DeltaYaw(n\Collider, Collider))<20 Then
If WearingHazmat Then
Injuries = Injuries+Rnd(0.5)
PlaySound_Strict(LoadTempSound("SFX\General\BodyFall.ogg"))
Else
BlurTimer = 100
Injuries = Injuries+Rnd(1.0,1.5)
PlaySound_Strict DamageSFX(Rand(2,3))
If Injuries > 3.0 Then
If PlayerRoom\RoomTemplate\Name = "room2offices" Then
DeathMSG = Chr(34)+"One large and highly active tentacle-like appendage seems "
DeathMSG = DeathMSG + "to have grown outside the dead body of a scientist within office area [REDACTED]. Its level of aggression is "
DeathMSG = DeathMSG + "unlike anything we've seen before - it looks like it has "
DeathMSG = DeathMSG + "beaten some unfortunate Class D to death at some point during the breach."+Chr(34)
Else
DeathMSG = Chr(34)+"We will need more than the regular cleaning team to take care of this. "
DeathMSG = DeathMSG + "Two large and highly active tentacle-like appendages seem "
DeathMSG = DeathMSG + "to have formed inside the chamber. Their level of aggression is "
DeathMSG = DeathMSG + "unlike anything we've seen before - it looks like they have "
DeathMSG = DeathMSG + "beaten some unfortunate Class D to death at some point during the breach."+Chr(34)
EndIf
Kill()
EndIf
EndIf
EndIf
EndIf
n\Frame = 6
;SetAnimTime(n\obj, 6)
ElseIf n\Frame=32
n\State = 1
n\Frame = 173
;SetAnimTime(n\obj, 173)
EndIf
EndIf
End Select
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider), EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider)-90, EntityYaw(n\Collider)-180, EntityRoll(n\Collider), True
n\DropSpeed = 0
ResetEntity n\Collider
;[End Block]
Case NPCtype860
;[Block]
If PlayerRoom\RoomTemplate\Name = "room860" Then
Local fr.Forest=PlayerRoom\fr;Object.Forest(e\room\Objects[1])
dist = EntityDistance(Collider,n\Collider)
If ForestNPC<>0
If ForestNPCData[2]=1
ShowEntity ForestNPC
If n\State<>1
If (BlinkTimer<-8 And BlinkTimer >-12) Or (Not EntityInView(ForestNPC,Camera))
ForestNPCData[2]=0
HideEntity ForestNPC
EndIf
EndIf
Else
HideEntity ForestNPC
EndIf
EndIf
Select n\State
Case 0 ;idle (hidden)
HideEntity n\Collider
HideEntity n\obj
HideEntity n\obj2
n\State2 = 0
PositionEntity(n\Collider, 0, -100, 0)
Case 1 ;appears briefly behind the trees
n\DropSpeed = 0
If EntityY(n\Collider)<= -100 Then
;transform the position of the player to the local coordinates of the forest
TFormPoint(EntityX(Collider),EntityY(Collider),EntityZ(Collider),0,fr\Forest_Pivot)
;calculate the indices of the forest cell the player is in
x = Floor((TFormedX()+6.0)/12.0)
z = Floor((TFormedZ()+6.0)/12.0)
;step through nearby cells
For x2 = Max(x-1,1) To Min(x+1,gridsize) Step 2
For z2 = Max(z-1,1) To Min(z+1,gridsize) Step 2
;choose an empty cell (not on the path)
If fr\grid[(z2*gridsize)+x2]=0 Then
;spawn the monster between the empty cell and the cell the player is in
TFormPoint(((x2+x)/2)*12.0,0,((z2+z)/2)*12.0,fr\Forest_Pivot,0)
;in view -> nope, keep searching for a more suitable cell
If EntityInView(n\Collider, Camera) Then
PositionEntity n\Collider, 0, -110, 0
DebugLog("spawned monster in view -> hide")
Else ; not in view -> all good
DebugLog("spawned monster successfully")
PositionEntity n\Collider, TFormedX(), EntityY(fr\Forest_Pivot,True)+2.3, TFormedZ()
x2 = gridsize
Exit
EndIf
EndIf
Next
Next
If EntityY(n\Collider)> -100 Then
PlaySound2(Step2SFX(Rand(3,5)), Camera, n\Collider, 15.0, 0.5)
If ForestNPCData[2]<>1 Then ForestNPCData[2]=0
Select Rand(3)
Case 1
PointEntity n\Collider, Collider
n\Frame = 2
;SetAnimTime(n\obj, 2)
Case 2
PointEntity n\Collider, Collider
n\Frame = 201
;SetAnimTime(n\obj, 201)
Case 3
PointEntity n\Collider, Collider
TurnEntity n\Collider, 0, 90, 0
n\Frame = 299
;SetAnimTime(n\obj, 299)
End Select
n\State2 = 0
EndIf
Else
ShowEntity n\obj
ShowEntity n\Collider
PositionEntity n\Collider, EntityX(n\Collider), EntityY(fr\Forest_Pivot,True)+2.3, EntityZ(n\Collider)
;[TODO]
If ForestNPC<>0
If ForestNPCData[2]=0
Local docchance% = 0
Local docamount% = 0
For i = 0 To MaxItemAmount-1
If Inventory(i)<>Null
Local docname$ = Inventory(i)\itemtemplate\name
If docname = "Log #1" Or docname = "Log #2" Or docname = "Log #3"
;860,850,830,800
docamount% = docamount% + 1
docchance = docchance + 10*docamount%
EndIf
EndIf
Next
If Rand(1,860-docchance)=1
ShowEntity ForestNPC
ForestNPCData[2]=1
If Rand(2)=1
ForestNPCData[0]=0
Else
ForestNPCData[0]=2
EndIf
ForestNPCData[1]=0
PositionEntity ForestNPC,EntityX(n\Collider),EntityY(n\Collider)+0.5,EntityZ(n\Collider)
RotateEntity ForestNPC,0,EntityYaw(n\Collider),0
MoveEntity ForestNPC,0.75,0,0
RotateEntity ForestNPC,0,0,0
EntityTexture ForestNPC,ForestNPCTex,ForestNPCData[0]
Else
ForestNPCData[2]=2
EndIf
ElseIf ForestNPCData[2]=1
If ForestNPCData[1]=0.0
If Rand(200)=1
ForestNPCData[1]=FPSfactor
EntityTexture ForestNPC,ForestNPCTex,ForestNPCData[0]+1
EndIf
ElseIf ForestNPCData[1]>0.0 And ForestNPCData[1]<5.0
ForestNPCData[1]=Min(ForestNPCData[1]+FPSfactor,5.0)
Else
ForestNPCData[1]=0
EntityTexture ForestNPC,ForestNPCTex,ForestNPCData[0]
EndIf
EndIf
EndIf
If n\State2 = 0 Then ;don't start moving until the player is looking
If EntityInView(n\Collider, Camera) Then
n\State2 = 1
If Rand(8)=1 Then
PlaySound2(LoadTempSound("SFX\SCP\860\Cancer"+Rand(0,2)+".ogg"), Camera, n\Collider, 20.0)
EndIf
EndIf
Else
If n\Frame<=199 Then
AnimateNPC(n, 2, 199, 0.5,False)
If n\Frame=199 Then n\Frame = 298 : PlaySound2(Step2SFX(Rand(3,5)), Camera, n\Collider, 15.0)
ElseIf n\Frame <= 297
PointEntity n\Collider, Collider
AnimateNPC(n, 200, 297, 0.5, False)
If n\Frame=297 Then n\Frame=298 : PlaySound2(Step2SFX(Rand(3,5)), Camera, n\Collider, 15.0)
Else
angle = CurveAngle(point_direction(EntityX(n\Collider),EntityZ(n\Collider),EntityX(Collider),EntityZ(Collider)),EntityYaw(n\Collider)+90,20.0)
RotateEntity n\Collider, 0, angle-90, 0, True
AnimateNPC(n, 298, 316, n\CurrSpeed*10)
;Animate2(n\obj, AnimTime(n\obj), 298, 316, n\CurrSpeed*10)
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 10.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
If dist>15.0 Then
PositionEntity n\Collider, 0,-110,0
n\State = 0
n\State2 = 0
EndIf
EndIf
EndIf
EndIf
ResetEntity n\Collider
Case 2 ;appears on the path and starts to walk towards the player
ShowEntity n\obj
ShowEntity n\Collider
prevFrame = n\Frame
If EntityY(n\Collider)<= -100 Then
;transform the position of the player to the local coordinates of the forest
TFormPoint(EntityX(Collider),EntityY(Collider),EntityZ(Collider),0,fr\Forest_Pivot)
;calculate the indices of the forest cell the player is in
x = Floor((TFormedX()+6.0)/12.0)
z = Floor((TFormedZ()+6.0)/12.0)
For x2 = Max(x-1,1) To Min(x+1,gridsize)
For z2 = Max(z-1,1) To Min(z+1,gridsize)
;find a nearby cell that's on the path and NOT the cell the player is in
If fr\grid[(z2*gridsize)+x2]>0 And (x2<>x Or z2<>z) And (x2=x Or z2=z) Then
;transform the position of the cell back to world coordinates
TFormPoint(x2*12.0, 0,z2*12.0, fr\Forest_Pivot,0)
PositionEntity n\Collider, TFormedX(), EntityY(fr\Forest_Pivot,True)+1.0,TFormedZ()
DebugLog(TFormedX()+", "+TFormedZ())
If EntityInView(n\Collider, Camera) Then
BlinkTimer=-10
Else
x2 = gridsize
Exit
EndIf
EndIf
Next
Next
Else
angle = CurveAngle(Find860Angle(n, fr),EntityYaw(n\Collider)+90,80.0)
RotateEntity n\Collider, 0, angle-90, 0, True
n\CurrSpeed = CurveValue(n\Speed*0.3, n\CurrSpeed, 50.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
AnimateNPC(n, 494, 569, n\CurrSpeed*25)
If n\State2 = 0 Then
If dist<8.0 Then
If EntityInView(n\Collider,Camera) Then
PlaySound_Strict LoadTempSound("SFX\SCP\860\Chase"+Rand(1,2)+".ogg")
PlaySound2(LoadTempSound("SFX\SCP\860\Cancer"+Rand(0,2)+".ogg"), Camera, n\Collider)
n\State2 = 1
EndIf
EndIf
EndIf
If CurrSpeed > 0.03 Then ;the player is running
n\State3 = n\State3 + FPSfactor
If Rnd(5000)<n\State3 Then
temp = True
If n\SoundChn <> 0 Then
If ChannelPlaying (n\SoundChn) Then temp = False
EndIf
If temp Then
n\SoundChn = PlaySound2(LoadTempSound("SFX\SCP\860\Cancer"+Rand(0,2)+".ogg"), Camera, n\Collider)
EndIf
EndIf
Else
n\State3 = Max(n\State3 - FPSfactor,0)
EndIf
If dist<4.5 Or n\State3 > Rnd(200,250) Then
n\SoundChn = PlaySound2(LoadTempSound("SFX\SCP\860\Cancer"+Rand(3,5)+".ogg"), Camera, n\Collider)
n\State = 3
EndIf
If dist > 20.0 Then
n\State = 0
n\State2 = 0
PositionEntity n\Collider, 0,-110,0
EndIf
EndIf
;535, 568
If (prevFrame < 533 And n\Frame=>533) Or (prevFrame > 568 And n\Frame<2) Then
PlaySound2(Step2SFX(Rand(3,5)), Camera, n\Collider, 15.0, 0.6)
EndIf
Case 3 ;runs towards the player and attacks
ShowEntity n\obj
ShowEntity n\Collider
prevFrame = n\Frame
angle = CurveAngle(Find860Angle(n, fr),EntityYaw(n\Collider)+90,40.0)
RotateEntity n\Collider, 0, angle-90, 0, True
If n\Sound = 0 Then n\Sound = LoadSound_Strict("SFX\General\Slash1.ogg")
If n\Sound2 = 0 Then n\Sound2 = LoadSound_Strict("SFX\General\Slash2.ogg")
;if close enough to attack OR already attacking, play the attack anim
If (dist<1.1 Or (n\Frame>451 And n\Frame<493) Or KillTimer < 0) Then
DeathMSG = ""
n\CurrSpeed = CurveValue(0.0, n\CurrSpeed, 5.0)
AnimateNPC(n, 451,493, 0.5, False)
;Animate2(n\obj, AnimTime(n\obj), 451,493, 0.5, False)
If (prevFrame < 461 And n\Frame=>461) Then
If KillTimer => 0 Then Kill() : KillAnim = 0
PlaySound_Strict(n\Sound)
EndIf
If (prevFrame < 476 And n\Frame=>476) Then PlaySound_Strict(n\Sound2)
If (prevFrame < 486 And n\Frame=>486) Then PlaySound_Strict(n\Sound2)
Else
n\CurrSpeed = CurveValue(n\Speed*0.8, n\CurrSpeed, 10.0)
AnimateNPC(n, 298, 316, n\CurrSpeed*10)
;Animate2(n\obj, AnimTime(n\obj), 298, 316, n\CurrSpeed*10)
If (prevFrame < 307 And n\Frame=>307) Then
PlaySound2(Step2SFX(Rand(3,5)), Camera, n\Collider, 10.0)
EndIf
EndIf
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
End Select
If n\State <> 0 Then
RotateEntity n\Collider, 0, EntityYaw(n\Collider), 0, True
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider)-0.1, EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider)-90, EntityYaw(n\Collider), EntityRoll(n\Collider), True
If dist > 8.0 Then
ShowEntity n\obj2
EntityAlpha n\obj2, Min(dist-8.0,1.0)
PositionEntity(n\obj2, EntityX(n\obj), EntityY(n\obj) , EntityZ(n\obj))
RotateEntity(n\obj2, 0, EntityYaw(n\Collider) - 180, 0)
MoveEntity(n\obj2, 0, 30.0*0.025, -33.0*0.025)
;render distance is set to 8.5 inside the forest,
;so we need to cheat a bit to make the eyes visible if they're further than that
pvt = CreatePivot()
PositionEntity pvt, EntityX(Camera),EntityY(Camera),EntityZ(Camera)
PointEntity pvt, n\obj2
MoveEntity pvt, 0,0,8.0
PositionEntity n\obj2, EntityX(pvt),EntityY(pvt),EntityZ(pvt)
FreeEntity pvt
Else
HideEntity n\obj2
EndIf
EndIf
EndIf
;[End Block]
Case NPCtype939
;[Block]
If PlayerRoom\RoomTemplate\Name <> "room3storage"
n\State = 66
EndIf
;state is set to 66 in the room3storage-event if player isn't inside the room
If n\State < 66 Then
Select n\State
Case 0
AnimateNPC(n, 290,405,0.1)
;Animate2(n\obj,AnimTime(n\obj),290,405,0.1)
Case 1
If n\Frame=>644 And n\Frame<683 Then ;finish the walking animation
;n\CurrSpeed = CurveValue(n\Speed*0.2, n\CurrSpeed, 10.0)
n\CurrSpeed = CurveValue(n\Speed*0.05, n\CurrSpeed, 10.0)
AnimateNPC(n, 644,683,28*n\CurrSpeed*4,False)
If n\Frame=>682 Then n\Frame =175
;Animate2(n\obj,AnimTime(n\obj),644,683,28*n\CurrSpeed,False)
;If AnimTime(n\obj)=683 Then SetAnimTime(n\obj,175)
Else
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 5.0)
AnimateNPC(n, 175,297,0.22,False)
If n\Frame=>296 Then n\State = 2
;Animate2(n\obj,AnimTime(n\obj),175,297,0.22,False)
;If AnimTime(n\obj)=297 Then n\State = 2
EndIf
n\LastSeen = 0
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
Case 2
n\State2 = Max(n\State2, (n\PrevState-3))
dist = EntityDistance(n\Collider, PlayerRoom\Objects[n\State2])
n\CurrSpeed = CurveValue(n\Speed*0.3*Min(dist,1.0), n\CurrSpeed, 10.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
prevFrame = n\Frame
AnimateNPC(n, 644,683,28*n\CurrSpeed) ;walk
;prevFrame = AnimTime(n\obj)
;Animate2(n\obj,AnimTime(n\obj),644,683,28*n\CurrSpeed) ;walk
If (prevFrame<664 And n\Frame=>664) Or (prevFrame>673 And n\Frame<654) Then
PlaySound2(StepSFX(4, 0, Rand(0,3)), Camera, n\Collider, 12.0)
If Rand(10)=1 Then
temp = False
If n\SoundChn = 0 Then
temp = True
ElseIf Not ChannelPlaying(n\SoundChn)
temp = True
EndIf
If temp Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\939\"+(n\ID Mod 3)+"Lure"+Rand(1,10)+".ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider)
EndIf
EndIf
EndIf
PointEntity n\obj, PlayerRoom\Objects[n\State2]
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0), 0
If dist<0.4 Then
n\State2 = n\State2 + 1
If n\State2 > n\PrevState Then n\State2 = (n\PrevState-3)
n\State = 1
EndIf
Case 3
If EntityVisible(Collider, n\Collider) Then
If n\Sound2 = 0 Then n\Sound2 = LoadSound_Strict("SFX\General\Slash1.ogg")
n\EnemyX = EntityX(Collider)
n\EnemyZ = EntityZ(Collider)
n\LastSeen = 10*7
EndIf
If n\LastSeen > 0 And (Not NoTarget) Then
prevFrame = n\Frame
If (n\Frame=>18.0 And n\Frame<68.0) Then
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 5.0)
AnimateNPC(n, 18,68,0.5,True)
;Animate2(n\obj,AnimTime(n\obj),18,68,0.5,True)
;hasn't hit
temp = False
If prevFrame < 24 And n\Frame>=24 Then
temp = True
ElseIf prevFrame < 57 And n\Frame>=57
temp = True
EndIf
If temp Then
If Distance(n\EnemyX, n\EnemyZ, EntityX(n\Collider), EntityZ(n\Collider))<1.5 Then
PlaySound_Strict n\Sound2
Injuries = Injuries + Rnd(1.5, 2.5)-WearingVest*0.5
BlurTimer = 500
Else
n\Frame = 449
;SetAnimTime(n\obj, 449)
EndIf
EndIf
If Injuries>4.0 Then
DeathMSG=Chr(34)+"All four (4) escaped SCP-939 specimens have been captured and recontained successfully. "
DeathMSG=DeathMSG+"Three (3) of them made quite a mess at Storage Area 6. A cleaning team has been dispatched."+Chr(34)
Kill()
If (Not GodMode) Then n\State = 5
EndIf
Else
If n\LastSeen = 10*7 Then
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 20.0)
AnimateNPC(n, 449,464,6*n\CurrSpeed) ;run
;Animate2(n\obj,AnimTime(n\obj),449,464,6*n\CurrSpeed) ;run
If (prevFrame<452 And n\Frame=>452) Or (prevFrame<459 And n\Frame=>459) Then
PlaySound2(StepSFX(1, 1, Rand(0,7)), Camera, n\Collider, 12.0)
EndIf
If Distance(n\EnemyX, n\EnemyZ, EntityX(n\Collider), EntityZ(n\Collider))<1.1 Then ;player is visible
n\Frame = 18
;SetAnimTime(n\obj, 18.0)
EndIf
Else
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 5.0)
AnimateNPC(n, 175,297,5*n\CurrSpeed,True)
;Animate2(n\obj,AnimTime(n\obj),175,297,5*n\CurrSpeed,True)
EndIf
EndIf
angle = VectorYaw(n\EnemyX-EntityX(n\Collider), 0.0, n\EnemyZ-EntityZ(n\Collider))
RotateEntity n\Collider, 0, CurveAngle(angle,EntityYaw(n\Collider),15.0), 0
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
n\LastSeen = n\LastSeen - FPSfactor
Else
n\State = 2
EndIf
;Animate2(n\obj,AnimTime(n\obj),406,437,0.1) ;leap
Case 5
If n\Frame<68 Then
AnimateNPC(n, 18,68,0.5,False) ;finish the attack animation
;Animate2(n\obj,AnimTime(n\obj),18,68,0.5,False) ;finish the attack animation
Else
AnimateNPC(n, 464,473,0.5,False) ;attack to idle
;Animate2(n\obj,AnimTime(n\obj),464,473,0.5,False) ;attack to idle
EndIf
End Select
If n\State < 3 And (Not NoTarget) And (Not n\IgnorePlayer) Then
dist = EntityDistance(n\Collider, Collider)
If dist < 4.0 Then dist = dist - EntityVisible(Collider, n\Collider)
If PlayerSoundVolume*1.2>dist Or dist < 1.5 Then
If n\State3 = 0 Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\939\"+(n\ID Mod 3)+"Attack"+Rand(1,3)+".ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider)
PlaySound_Strict(LoadTempSound("SFX\SCP\939\attack.ogg"))
n\State3 = 1
EndIf
n\State = 3
ElseIf PlayerSoundVolume*1.6>dist
If n\State<>1 And n\Reload <= 0 Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\939\"+(n\ID Mod 3)+"Alert"+Rand(1,3)+".ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider)
n\Frame = 175
n\Reload = 70 * 3
;SetAnimTime(n\obj, 175)
EndIf
n\State = 1
EndIf
n\Reload = n\Reload - FPSfactor
EndIf
RotateEntity n\Collider, 0, EntityYaw(n\Collider), 0, True
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider)-0.28, EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider)-90, EntityYaw(n\Collider), EntityRoll(n\Collider), True
EndIf
;[End Block]
Case NPCtype066
;[Block]
dist = Distance(EntityX(Collider),EntityZ(Collider),EntityX(n\Collider),EntityZ(n\Collider))
Select n\State
Case 0
;idle: moves around randomly from waypoint to another if the player is far enough
;starts staring at the player when the player is close enough
If dist > 20.0 Then
AnimateNPC(n, 451, 612, 0.2, True)
;Animate2(n\obj, AnimTime(n\obj), 451, 612, 0.2, True)
If n\State2 < MilliSecs2() Then
For w.waypoints = Each WayPoints
If w\door = Null Then
If Abs(EntityX(w\obj,True)-EntityX(n\Collider))<4.0 Then
If Abs(EntityZ(w\obj,True)-EntityZ(n\Collider))<4.0 Then
PositionEntity n\Collider, EntityX(w\obj,True), EntityY(w\obj,True)+0.3, EntityZ(w\obj,True)
ResetEntity n\Collider
Exit
EndIf
EndIf
EndIf
Next
n\State2 = MilliSecs2()+5000
EndIf
ElseIf dist < 8.0
n\LastDist = Rnd(1.0, 2.5)
n\State = 1
EndIf
Case 1 ;staring at the player
If n\Frame<451 Then
angle = WrapAngle(CurveAngle(DeltaYaw(n\Collider, Collider)-180, (AnimTime(n\obj)-2.0)/1.2445, 15.0))
;0->360 = 2->450
SetNPCFrame(n,angle*1.2445+2.0)
;SetAnimTime(n\obj, angle*1.2445+2.0)
Else
AnimateNPC(n, 636, 646, 0.4, False)
If n\Frame = 646 Then SetNPCFrame(n,2)
;Animate2(n\obj, AnimTime(n\obj), 636, 646, 0.4, False)
;If AnimTime(n\obj)=646 Then SetAnimTime (n\obj, 2)
EndIf
dist = Distance(EntityX(Collider),EntityZ(Collider),EntityX(n\Collider),EntityZ(n\Collider))
If Rand(700)=1 Then PlaySound2(LoadTempSound("SFX\SCP\066\Eric"+Rand(1,3)+".ogg"),Camera, n\Collider, 8.0)
If dist < 1.0+n\LastDist Then n\State = Rand(2,3)
Case 2 ;roll towards the player and make a sound, and then escape
If n\Frame < 647 Then
angle = CurveAngle(0, (AnimTime(n\obj)-2.0)/1.2445, 5.0)
If angle < 5 Or angle > 355 Then
SetNPCFrame(n,647)
Else
SetNPCFrame(n,angle*1.2445+2.0)
EndIf
;SetAnimTime(n\obj, angle*1.2445+2.0)
;If angle < 5 Or angle > 355 Then SetAnimTime(n\obj, 647)
Else
If n\Frame=683 Then
If n\State2 = 0 Then
If Rand(2)=1 Then
PlaySound2(LoadTempSound("SFX\SCP\066\Eric"+Rand(1,3)+".ogg"),Camera, n\Collider, 8.0)
Else
PlaySound2(LoadTempSound("SFX\SCP\066\Notes"+Rand(1,6)+".ogg"), Camera, n\Collider, 8.0)
EndIf
Select Rand(1,6)
Case 1
If n\Sound2=0 Then n\Sound2=LoadSound_Strict("SFX\SCP\066\Beethoven.ogg")
n\SoundChn2 = PlaySound2(n\Sound2, Camera, n\Collider)
DeafTimer# = 70*(45+(15*SelectedDifficulty\aggressiveNPCs))
DeafPlayer = True
CameraShake = 10.0
Case 2
n\State3 = Rand(700,1400)
Case 3
For d.Doors = Each Doors
If d\locked = False And d\KeyCard = 0 And d\Code = "" Then
If Abs(EntityX(d\frameobj)-EntityX(n\Collider))<16.0 Then
If Abs(EntityZ(d\frameobj)-EntityZ(n\Collider))<16.0 Then
UseDoor(d, False)
EndIf
EndIf
EndIf
Next
Case 4
If PlayerRoom\RoomTemplate\DisableDecals = False Then
CameraShake = 5.0
de.Decals = CreateDecal(1, EntityX(n\Collider), 0.01, EntityZ(n\Collider), 90, Rand(360), 0)
de\Size = 0.3 : UpdateDecals
PlaySound_Strict(LoadTempSound("SFX\General\BodyFall.ogg"))
If Distance(EntityX(Collider),EntityZ(Collider),EntityX(n\Collider),EntityZ(n\Collider))<0.8 Then
Injuries = Injuries + Rnd(0.3,0.5)
EndIf
EndIf
End Select
EndIf
n\State2 = n\State2+FPSfactor
If n\State2>70 Then
n\State = 3
n\State2 = 0
EndIf
Else
n\CurrSpeed = CurveValue(n\Speed*1.5, n\CurrSpeed, 10.0)
PointEntity n\obj, Collider
;angle = CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 10);1.0/Max(n\CurrSpeed,0.0001))
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj)-180, EntityYaw(n\Collider), 10), 0
AnimateNPC(n, 647, 683, n\CurrSpeed*25, False)
;Animate2(n\obj, AnimTime(n\obj), 647, 683, n\CurrSpeed*25, False)
MoveEntity n\Collider, 0,0,-n\CurrSpeed*FPSfactor
EndIf
EndIf
Case 3
PointEntity n\obj, Collider
angle = CurveAngle(EntityYaw(n\obj)+n\Angle-180, EntityYaw(n\Collider), 10);1.0/Max(n\CurrSpeed,0.0001))
RotateEntity n\Collider, 0, angle, 0
n\CurrSpeed = CurveValue(n\Speed, n\CurrSpeed, 10.0)
MoveEntity n\Collider, 0,0,n\CurrSpeed*FPSfactor
;Animate2(n\obj, AnimTime(n\obj), 684, 647, -n\CurrSpeed*25)
If Rand(100)=1 Then n\Angle = Rnd(-20,20)
n\State2 = n\State2 + FPSfactor
If n\State2>250 Then
AnimateNPC(n, 684, 647, -n\CurrSpeed*25, False)
;Animate2(n\obj, AnimTime(n\obj), 684, 647, -n\CurrSpeed*25, False)
If n\Frame=647 Then
n\State = 0
n\State2=0
EndIf
Else
AnimateNPC(n, 684, 647, -n\CurrSpeed*25)
;Animate2(n\obj, AnimTime(n\obj), 684, 647, -n\CurrSpeed*25)
EndIf
End Select
If n\State > 1 Then
If n\Sound = 0 Then n\Sound = LoadSound_Strict("SFX\SCP\066\Rolling.ogg")
If n\SoundChn<>0 Then
If ChannelPlaying(n\SoundChn) Then
n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, n\Collider, 20)
EndIf
Else
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider, 20)
EndIf
EndIf
;If n\SoundChn2<>0 Then
; If ChannelPlaying(n\SoundChn2) Then
; n\SoundChn2 = LoopSound2(n\Sound2, n\SoundChn2, Camera, n\Collider, 20)
; BlurTimer = Max((5.0-dist)*300,0)
; EndIf
;EndIf
If n\State3 > 0 Then
n\State3 = n\State3-FPSfactor
LightVolume = TempLightVolume-TempLightVolume*Min(Max(n\State3/500,0.01),0.6)
HeartBeatRate = Max(HeartBeatRate, 130)
HeartBeatVolume = Max(HeartBeatVolume,Min(n\State3/1000,1.0))
EndIf
If ChannelPlaying(n\SoundChn2)
UpdateSoundOrigin2(n\SoundChn2,Camera,n\Collider,20)
BlurTimer = Max((5.0-dist)*300,0)
EndIf
PositionEntity(n\obj, EntityX(n\Collider), EntityY(n\Collider) - 0.2, EntityZ(n\Collider))
RotateEntity n\obj, EntityPitch(n\Collider)-90, EntityYaw(n\Collider), 0
;[End Block]
Case NPCtype966
;[Block]
dist = EntityDistance(n\Collider,Collider)
If (dist<HideDistance) Then
;n\state = the "general" state (idle/wander/attack/echo etc)
;n\state2 = timer for doing raycasts
prevFrame = n\Frame
If n\Sound > 0 Then
temp = 0.5
;the ambient sound gets louder when the npcs are attacking
If n\State > 0 Then temp = 1.0
n\SoundChn = LoopSound2(n\Sound, n\SoundChn, Camera, Camera, 10.0,temp)
EndIf
temp = Rnd(-1.0,1.0)
PositionEntity n\obj,EntityX(n\Collider,True),EntityY(n\Collider,True)-0.2,EntityZ(n\Collider,True)
RotateEntity n\obj,-90.0,EntityYaw(n\Collider),0.0
If (WearingNightVision=0) Then
HideEntity n\obj
If dist<1 And n\Reload <= 0 And MsgTimer <= 0 Then
Select Rand(6)
Case 1
Msg="You feel something breathing right next to you."
Case 2
Msg=Chr(34)+"It feels like something's in this room with me."+Chr(34)
Case 3
Msg="You feel like something is here with you, but you do not see anything."
Case 4
Msg=Chr(34)+"Is my mind playing tricks on me or is there someone else here?"+Chr(34)
Case 5
Msg="You feel like something is following you."
Case 6
Msg="You can feel something near you, but you are unable to see it. Perhaps its time is now."
End Select
n\Reload = 20*70
MsgTimer=8*70
EndIf
n\Reload = n\Reload - FPSfactor
Else
ShowEntity n\obj
EndIf
If n\State3>5*70 Then
;n\State = 1
If n\State3<1000.0 Then
For n2.NPCs = Each NPCs
If n2\NPCtype = n\NPCtype Then n2\State3=1000.0
Next
EndIf
n\State = Max(n\State,8)
n\State3 = 1000.0
EndIf
If Stamina<10 Then
n\State3=n\State3+FPSfactor
Else If n\State3 < 900.0
n\State3=Max(n\State3-FPSfactor*0.2,0.0)
EndIf
If n\State <> 10
n\LastSeen = 0
EndIf
Select n\State
Case 0 ;idle, standing
;If n\Frame>2300.0 Then
If n\Frame>556.0
;AnimateNPC(n, 2391, 2416, 1.0, False)
;If n\Frame>2415.0 Then SetNPCFrame(n, 201)
AnimateNPC(n, 628, 652, 0.25, False)
If n\Frame>651.0 Then SetNPCFrame(n, 2)
Else
;AnimateNPC(n, 201, 1015, 1.0, False)
AnimateNPC(n, 2, 214, 0.25, False)
;echo/stare/walk around periodically
;If n\Frame>1014.0 Then
If n\Frame>213.0
If Rand(3)=1 And dist<4 Then
n\State = Rand(1,4)
Else
n\State = Rand(5,6)
EndIf
EndIf
;echo if player gets close
If dist<2.0 Then
n\State=Rand(1,4)
EndIf
EndIf
n\CurrSpeed = CurveValue(0.0, n\CurrSpeed, 10.0)
MoveEntity n\Collider,0,0,n\CurrSpeed
Case 1,2 ;echo
; If n\State=1 Then
; AnimateNPC(n, 1015, 1180, 1.0, False)
; If n\Frame > 1179.0 Then n\State = 0
; Else
; AnimateNPC(n, 1180, 1379, 1.0, False)
; If n\Frame > 1378.0 Then n\State = 0
; EndIf
AnimateNPC(n, 214, 257, 0.25, False)
If n\Frame > 256.0 Then n\State = 0
;If n\Frame>1029.0 And prevFrame<=1029.0 Or n\Frame>1203.0 And prevFrame<=1203.0 Then
If n\Frame>228.0 And prevFrame<=228.0
PlaySound2(LoadTempSound("SFX\SCP\966\Echo"+Rand(1,3)+".ogg"), Camera, n\Collider)
EndIf
angle = VectorYaw(EntityX(Collider)-EntityX(n\Collider),0,EntityZ(Collider)-EntityZ(n\Collider))
RotateEntity n\Collider,0.0,CurveAngle(angle,EntityYaw(n\Collider),20.0),0.0
If n\State3<900 Then
BlurTimer = ((Sin(MilliSecs2()/50)+1.0)*200)/dist
If (WearingNightVision>0) Then GiveAchievement(Achv966)
If (Not Wearing714) And (WearingGasMask<3) And (WearingHazmat<3) And dist<16 Then
BlinkEffect = Max(BlinkEffect, 1.5)
BlinkEffectTimer = 1000
StaminaEffect = 2.0
StaminaEffectTimer = 1000
If MsgTimer<=0 And StaminaEffect<1.5 Then
Select Rand(4)
Case 1
Msg = "You feel exhausted."
Case 2
Msg = Chr(34)+"Could really go for a nap now..."+Chr(34)
Case 3
Msg = Chr(34)+"If I wasn't in this situation I would take a nap somewhere."+Chr(34)
Case 4
Msg = "You feel restless."
End Select
MsgTimer = 7*70
EndIf
EndIf
EndIf
Case 3,4 ;stare at player
; If n\State=3 Then
; AnimateNPC(n, 1379.0, 1692.0, 1.0, False)
;
; If n\Frame>1691.0 Then n\State = 0
; Else
; AnimateNPC(n, 1692.0, 2156.0, 1.0, False)
;
; If n\Frame>2155.0 Then n\State = 0
; EndIf
If n\State=3
AnimateNPC(n, 257, 332, 0.25, False)
If n\Frame > 331.0 Then n\State = 0
Else
AnimateNPC(n, 332, 457, 0.25, False)
If n\Frame > 456.0 Then n\State = 0
EndIf
;If n\Frame>1393.0 And prevFrame<=1393.0 Or n\Frame>1589.0 And prevFrame<=1589.0 Or n\Frame>2000.0 And prevFrame<=2000.0 Then
If n\Frame>271.0 And prevFrame<=271.0 Or n\Frame>354 Or n\Frame>314.0 And prevFrame<=314.0 Or n\Frame>301.0 And prevFrame<=301.0
PlaySound2(LoadTempSound("SFX\SCP\966\Idle"+Rand(1,3)+".ogg"), Camera, n\Collider)
EndIf
angle = VectorYaw(EntityX(Collider)-EntityX(n\Collider),0,EntityZ(Collider)-EntityZ(n\Collider))
RotateEntity n\Collider,0.0,CurveAngle(angle,EntityYaw(n\Collider),20.0),0.0
Case 5,6,8 ;walking or chasing
;If n\Frame<2343.0 Then
If n\Frame<580.0 And n\Frame>214.0 ;start walking
;AnimateNPC(n, 2319, 2343, 0.5, False)
AnimateNPC(n, 556, 580, 0.25, False)
Else
;AnimateNPC(n, 2343, 2391, n\CurrSpeed*25.0)
If n\CurrSpeed >= 0.005 Then
AnimateNPC(n, 580, 628, n\CurrSpeed*25.0)
Else
AnimateNPC(n, 2, 214, 0.25)
EndIf
;chasing the player
If n\State = 8 And dist<32 Then
If n\PathTimer <= 0 Then
n\PathStatus = FindPath (n, EntityX(Collider,True), EntityY(Collider,True), EntityZ(Collider,True))
n\PathTimer = 40*10
n\CurrSpeed = 0
EndIf
n\PathTimer = Max(n\PathTimer-FPSfactor,0)
If (Not EntityVisible(n\Collider,Collider)) Then
If n\PathStatus = 2 Then
n\CurrSpeed = 0
;SetNPCFrame(n,201)
SetNPCFrame(n,2)
ElseIf n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
n\Angle = VectorYaw(EntityX(n\Path[n\PathLocation]\obj,True)-EntityX(n\Collider),0,EntityZ(n\Path[n\PathLocation]\obj,True)-EntityZ(n\Collider))
;RotateEntity n\Collider,0.0,CurveAngle(angle,EntityYaw(n\Collider),10.0),0.0
dist2 = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
temp = True
If dist2 < 0.8 Then
If n\Path[n\PathLocation]\door<>Null Then
If (Not n\Path[n\PathLocation]\door\IsElevatorDoor)
If (n\Path[n\PathLocation]\door\locked Or n\Path[n\PathLocation]\door\KeyCard<>0 Or n\Path[n\PathLocation]\door\Code<>"") And (Not n\Path[n\PathLocation]\door\open) Then
temp = False
Else
If n\Path[n\PathLocation]\door\open = False And (n\Path[n\PathLocation]\door\buttons[0]<>0 Or n\Path[n\PathLocation]\door\buttons[1]<>0) Then
UseDoor(n\Path[n\PathLocation]\door, False)
EndIf
EndIf
EndIf
EndIf
If dist2 < 0.3 Then n\PathLocation = n\PathLocation + 1
EndIf
If temp = False Then
n\PathStatus = 0
n\PathLocation = 0
n\PathTimer = 40*10
EndIf
EndIf
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,10.0)
ElseIf n\PathStatus = 0
n\CurrSpeed = CurveValue(0,n\CurrSpeed,10.0)
EndIf
Else
n\Angle = VectorYaw(EntityX(Collider)-EntityX(n\Collider),0,EntityZ(Collider)-EntityZ(n\Collider))
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,10.0)
If dist<1.0 Then n\State=10
EndIf
Else
If MilliSecs2() > n\State2 And dist<16.0 Then
HideEntity n\Collider
EntityPick(n\Collider, 1.5)
If PickedEntity() <> 0 Then
n\Angle = EntityYaw(n\Collider)+Rnd(80,110)
EndIf
ShowEntity n\Collider
n\State2=MilliSecs2()+1000
If Rand(5)=1 Then n\State=0
EndIf
n\CurrSpeed = CurveValue(n\Speed*0.5, n\CurrSpeed, 20.0)
EndIf
If (prevFrame < 604 And n\Frame=>604) Or (prevFrame < 627 And n\Frame=>627) Then
PlaySound2(StepSFX(4,0,Rand(0,3)),Camera, n\Collider, 7.0, Rnd(0.5,0.7))
EndIf
RotateEntity n\Collider, 0, CurveAngle(n\Angle,EntityYaw(n\Collider),10.0),0
MoveEntity n\Collider,0,0,n\CurrSpeed*FPSfactor
EndIf
Case 10 ;attack
If n\LastSeen=0
PlaySound2(LoadTempSound("SFX\SCP\966\Echo"+Rand(1,3)+".ogg"), Camera, n\Collider)
n\LastSeen = 1
EndIf
;If n\Frame>2300.0 Then
If n\Frame>557.0
;AnimateNPC(n, 2391, 2416, 1.0, False
AnimateNPC(n, 628, 652, 0.25, False)
;If n\Frame>2415.0 Then
If n\Frame>651.0
Select Rand(3)
Case 1
;SetNPCFrame(n, 2160)
SetNPCFrame(n, 458)
Case 2
;SetNPCFrame(n, 2192)
SetNPCFrame(n, 488)
Case 3
;SetNPCFrame(n, 2221)
SetNPCFrame(n, 518)
End Select
EndIf
Else
; If n\Frame <= 2191 Then
; AnimateNPC(n, 2160, 2191, 0.3, False)
; If n\Frame > 2190 Then n\State = 8
; ElseIf n\Frame <= 2220
; AnimateNPC(n, 2192, 2220, 0.3, False)
; If n\Frame > 2219 Then n\State = 8
; ElseIf n\Frame <= 2260
; AnimateNPC(n, 2221, 2260, 0.3, False)
; If n\Frame > 2259 Then n\State = 8
; EndIf
If n\Frame <= 487
AnimateNPC(n, 458, 487, 0.3, False)
If n\Frame > 486.0 Then n\State = 8
ElseIf n\Frame <= 517
AnimateNPC(n, 488, 517, 0.3, False)
If n\Frame > 516.0 Then n\State = 8
ElseIf n\Frame <= 557
AnimateNPC(n, 518, 557, 0.3, False)
If n\Frame > 556.0 Then n\State = 8
EndIf
EndIf
If dist<1.0 Then
;If n\Frame>2173.0 And prevFrame<=2173.0 Or n\Frame>2203.0 And prevFrame<=2203.0 Or n\Frame>2227.0 And prevFrame<=2227.0 Then
If n\Frame>470.0 And prevFrame<=470.0 Or n\Frame>500.0 And prevFrame<=500.0 Or n\Frame>527.0 And prevFrame<=527.0
PlaySound2(LoadTempSound("SFX\General\Slash"+Rand(1,2)+".ogg"), Camera, n\Collider)
Injuries = Injuries + Rnd(0.5,1.0)
EndIf
EndIf
n\Angle = VectorYaw(EntityX(Collider)-EntityX(n\Collider),0,EntityZ(Collider)-EntityZ(n\Collider))
RotateEntity n\Collider, 0, CurveAngle(n\Angle,EntityYaw(n\Collider),30.0),0
End Select
Else
HideEntity n\obj
If (Rand(600)=1) Then
TeleportCloser(n)
EndIf
EndIf
;[End Block]
Case NPCtype1048a
;[Block]
Select n\State
Case 1
n\PathStatus = FindPath(n, n\EnemyX,n\EnemyY+0.1,n\EnemyZ)
;649, 677
End Select
;[End block]
Case NPCtype1499
;[Block]
;n\State: Current State of the NPC
;n\State2: A second state variable (dependend on the current NPC's n\State)
;n\State3: Determines if the NPC will always be aggressive against the player
;n\PrevState: Determines the type/behaviour of the NPC
; 0 = Normal / Citizen
; 1 = Stair guard / Guard next to king
; 2 = King
; 3 = Front guard
prevFrame# = n\Frame
If (Not n\Idle) And EntityDistance(n\Collider,Collider)<HideDistance*3 Then
If n\PrevState = 0 Then
If n\State = 0 Or n\State = 2 Then
For n2.NPCs = Each NPCs
If n2\NPCtype = n\NPCtype And n2 <> n Then
If n2\State <> 0 And n2\State <> 2 Then
If n2\PrevState = 0 Then
n\State = 1
n\State2 = 0
Exit
EndIf
EndIf
EndIf
Next
EndIf
EndIf
Select n\State
Case 0
;[Block]
If n\PrevState=0 Then
If n\CurrSpeed = 0.0 Then
If n\Reload=0 Then
If n\State2 < 500.0*Rnd(1,3) Then
n\CurrSpeed = 0.0
n\State2 = n\State2 + FPSfactor
Else
If n\CurrSpeed = 0.0 Then n\CurrSpeed = n\CurrSpeed + 0.0001
EndIf
Else
If n\State2 < 1500 Then
n\CurrSpeed = 0.0
n\State2 = n\State2 + FPSfactor
Else
If n\Target <> Null Then
If n\Target\Target <> Null Then
n\Target\Target = Null
EndIf
n\Target\Reload = 0
n\Target\Angle = n\Target\Angle+Rnd(-45,45)
n\Target = Null
n\Reload = 0
n\Angle = n\Angle+Rnd(-45,45)
EndIf
If n\CurrSpeed = 0.0 Then n\CurrSpeed = n\CurrSpeed + 0.0001
EndIf
EndIf
Else
If n\Target<>Null Then
n\State2 = 0.0
EndIf
If n\State2 < 10000.0*Rnd(1,3)
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,10.0)
n\State2 = n\State2 + FPSfactor
Else
n\CurrSpeed = CurveValue(0.0,n\CurrSpeed,50.0)
EndIf
RotateEntity n\Collider,0,CurveAngle(n\Angle,EntityYaw(n\Collider),10.0),0
If n\Target=Null Then
If Rand(200) = 1 Then n\Angle = n\Angle + Rnd(-45,45)
HideEntity n\Collider
EntityPick(n\Collider, 1.5)
If PickedEntity() <> 0 Then
n\Angle = EntityYaw(n\Collider)+Rnd(80,110)
EndIf
ShowEntity n\Collider
Else
n\Angle = EntityYaw(n\Collider) + DeltaYaw(n\Collider,n\Target\Collider)
If EntityDistance(n\Collider,n\Target\Collider)<1.5 Then
n\CurrSpeed = 0.0
n\Target\CurrSpeed = 0.0
n\Reload = 1
n\Target\Reload = 1
temp = Rand(0,2)
If temp=0 Then
SetNPCFrame(n,296)
ElseIf temp=1 Then
SetNPCFrame(n,856)
Else
SetNPCFrame(n,905)
EndIf
temp = Rand(0,2)
If temp=0 Then
SetNPCFrame(n\Target,296)
ElseIf temp=1 Then
SetNPCFrame(n\Target,856)
Else
SetNPCFrame(n\Target,905)
EndIf
EndIf
EndIf
EndIf
Else
RotateEntity n\Collider,0,CurveAngle(n\Angle,EntityYaw(n\Collider),10.0),0
EndIf
If n\CurrSpeed = 0.0
If n\Reload = 0 And n\PrevState<>2 Then
AnimateNPC(n,296,320,0.2)
ElseIf n\Reload = 0 And n\PrevState=2 Then
;509-533
;534-601
If n\Frame <= 532.5 Then
AnimateNPC(n,509,533,0.2,False)
ElseIf n\Frame > 533.5 And n\Frame <= 600.5 Then
AnimateNPC(n,534,601,0.2,False)
Else
temp = Rand(0,1)
If temp=0 Then
SetNPCFrame(n,509)
Else
SetNPCFrame(n,534)
EndIf
EndIf
;SetNPCFrame(n,855)
Else
If n\PrevState=2 Then
AnimateNPC(n,713,855,0.2,False)
If n\Frame > 833.5 Then
PointEntity n\obj,Collider
RotateEntity n\Collider,0,CurveAngle(n\Angle,EntityYaw(n\Collider),10.0),0
EndIf
ElseIf n\PrevState=1 Then
AnimateNPC(n,602,712,0.2,False)
If n\Frame > 711.5 Then
n\Reload = 0
EndIf
Else
If n\Frame <= 319.5 Then
AnimateNPC(n,296,320,0.2,False)
;856-904
ElseIf n\Frame > 320.5 And n\Frame < 903.5 Then
AnimateNPC(n,856,904,0.2,False)
;905-953
ElseIf n\Frame > 904.5 And n\Frame < 952.5 Then
AnimateNPC(n,905,953,0.2,False)
Else
temp = Rand(0,2)
If temp=0 Then
SetNPCFrame(n,296)
ElseIf temp=1 Then
SetNPCFrame(n,856)
Else
SetNPCFrame(n,905)
EndIf
EndIf
EndIf
EndIf
Else
If (n\ID Mod 2 = 0) Then
AnimateNPC(n,1,62,(n\CurrSpeed*28))
Else
AnimateNPC(n,100,167,(n\CurrSpeed*28))
EndIf
If n\PrevState = 0 Then
If n\Target = Null Then
If Rand(1,1200)=1 Then
For n2.NPCs = Each NPCs
If n2<>n Then
If n2\NPCtype=n\NPCtype Then
If n2\Target = Null Then
If n2\PrevState=0 Then
If EntityDistance(n\Collider,n2\Collider)<20.0 Then
n\Target = n2
n2\Target = n
n\Target\CurrSpeed = n\Target\CurrSpeed + 0.0001
Exit
EndIf
EndIf
EndIf
EndIf
EndIf
Next
EndIf
EndIf
EndIf
EndIf
;randomly play the "screaming animation" and revert back to state 0
If n\Target=Null And n\PrevState=0 Then
If (Rand(5000)=1) Then
n\State = 2
n\State2 = 0
If Not ChannelPlaying(n\SoundChn) Then
dist = EntityDistance(n\Collider,Collider)
If (dist < 20.0) Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\1499\Idle"+Rand(1,4)+".ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider, 20.0)
EndIf
EndIf
EndIf
If (n\ID Mod 2 = 0) And (Not NoTarget) Then
dist = EntityDistance(n\Collider,Collider)
If dist < 10.0 Then
If EntityVisible(n\Collider,Collider) Then
;play the "screaming animation"
n\State = 2
If dist < 5.0 Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\1499\Triggered.ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider,20.0)
n\State2 = 1 ;if player is too close, switch to attack after screaming
For n2.NPCs = Each NPCs
;If n2\NPCtype = n\NPCtype And n2 <> n And (n\ID Mod 2 = 0) Then
If n2\NPCtype = n\NPCtype And n2 <> n
If n2\PrevState = 0 Then
n2\State = 1
n2\State2 = 0
EndIf
EndIf
Next
Else
n\State2 = 0 ;otherwise keep idling
EndIf
n\Frame = 203
EndIf
EndIf
EndIf
ElseIf n\PrevState=1 Then
dist = EntityDistance(n\Collider,Collider)
If (Not NoTarget) Then
If dist < 4.0 Then
If EntityVisible(n\Collider,Collider) Then
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\SCP\1499\Triggered.ogg")
n\SoundChn = PlaySound2(n\Sound, Camera, n\Collider,20.0)
n\State = 1
n\Frame = 203
EndIf
EndIf
EndIf
EndIf
;[End Block]
Case 1 ;attacking the player
;[Block]
If NoTarget Then n\State = 0
If PlayerRoom\RoomTemplate\Name = "dimension1499" And n\PrevState=0 Then
ShouldPlay = 19
EndIf
PointEntity n\obj,Collider
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0),0
dist = EntityDistance(n\Collider,Collider)
If n\State2 = 0.0
If n\PrevState=1 Then
n\CurrSpeed = CurveValue(n\Speed*2.0,n\CurrSpeed,10.0)
If n\Target<>Null Then
n\Target\State = 1
EndIf
Else
n\CurrSpeed = CurveValue(n\Speed*1.75,n\CurrSpeed,10.0)
EndIf
If (n\ID Mod 2 = 0) Then
AnimateNPC(n,1,62,(n\CurrSpeed*28))
Else
AnimateNPC(n,100,167,(n\CurrSpeed*28))
EndIf
EndIf
If dist < 0.75
If (n\ID Mod 2 = 0) Or n\State3 = 1 Or n\PrevState=1 Or n\PrevState=3 Or n\PrevState=4 Then
n\State2 = Rand(1,2)
n\State = 3
If n\State2 = 1
SetNPCFrame(n,63)
Else
SetNPCFrame(n,168)
EndIf
Else
n\State = 4
EndIf
EndIf
;[End Block]
Case 2 ;play the "screaming animation" and switch to n\state2 after it's finished
;[Block]
n\CurrSpeed = 0.0
AnimateNPC(n,203,295,0.1,False)
If n\Frame > 294.0 Then
n\State = n\State2
EndIf
;[End Block]
Case 3 ;slashing at the player
;[Block]
n\CurrSpeed = CurveValue(0.0,n\CurrSpeed,5.0)
dist = EntityDistance(n\Collider,Collider)
If n\State2 = 1
AnimateNPC(n,63,100,0.6,False)
If prevFrame < 89 And n\Frame=>89
If dist > 0.85 Or Abs(DeltaYaw(n\Collider,Collider))>60.0
;Miss
Else
Injuries = Injuries + Rnd(0.75,1.5)
PlaySound2(LoadTempSound("SFX\General\Slash"+Rand(1,2)+".ogg"), Camera, n\Collider)
If Injuries > 10.0
Kill()
If PlayerRoom\RoomTemplate\Name$ = "dimension1499"
DeathMSG = "All personnel situated within Evacuation Shelter LC-2 during the breach have been administered "
DeathMSG = DeathMSG + "Class-B amnestics due to Incident 1499-E. The Class D subject involved in the event "
DeathMSG = DeathMSG + "died shortly after being shot by Agent [REDACTED]."
Else
DeathMSG = "An unidentified male and a deceased Class D subject were discovered in [REDACTED] by the Nine-Tailed Fox. "
DeathMSG = DeathMSG + "The man was described as highly agitated and seemed to only speak Russian. "
DeathMSG = DeathMSG + "He's been taken into a temporary holding area at [REDACTED] while waiting for a translator to arrive."
EndIf
EndIf
EndIf
ElseIf n\Frame => 99
n\State2 = 0.0
n\State = 1
EndIf
Else
AnimateNPC(n,168,202,0.6,False)
If prevFrame < 189 And n\Frame=>189
If dist > 0.85 Or Abs(DeltaYaw(n\Collider,Collider))>60.0
;Miss
Else
Injuries = Injuries + Rnd(0.75,1.5)
PlaySound2(LoadTempSound("SFX\General\Slash"+Rand(1,2)+".ogg"), Camera, n\Collider)
If Injuries > 10.0
Kill()
If PlayerRoom\RoomTemplate\Name$ = "dimension1499"
DeathMSG = "All personnel situated within Evacuation Shelter LC-2 during the breach have been administered "
DeathMSG = DeathMSG + "Class-B amnestics due to Incident 1499-E. The Class D subject involved in the event "
DeathMSG = DeathMSG + "died shortly after being shot by Agent [REDACTED]."
Else
DeathMSG = "An unidentified male and a deceased Class D subject were discovered in [REDACTED] by the Nine-Tailed Fox. "
DeathMSG = DeathMSG + "The man was described as highly agitated and seemed to only speak Russian. "
DeathMSG = DeathMSG + "He's been taken into a temporary holding area at [REDACTED] while waiting for a translator to arrive."
EndIf
EndIf
EndIf
ElseIf n\Frame => 201
n\State2 = 0.0
n\State = 1
EndIf
EndIf
;[End Block]
Case 4 ;standing in front of the player
;[Block]
dist = EntityDistance(n\Collider,Collider)
n\CurrSpeed = CurveValue(0.0,n\CurrSpeed,5.0)
AnimateNPC(n,296,320,0.2)
PointEntity n\obj,Collider
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0),0
If dist > 0.85
n\State = 1
EndIf
;[End Block]
End Select
If n\SoundChn <> 0 And ChannelPlaying(n\SoundChn) Then
UpdateSoundOrigin(n\SoundChn,Camera,n\Collider,20.0)
EndIf
MoveEntity n\Collider,0,0,n\CurrSpeed*FPSfactor
RotateEntity n\obj,0,EntityYaw(n\Collider)-180,0
PositionEntity n\obj,EntityX(n\Collider),EntityY(n\Collider)-0.2,EntityZ(n\Collider)
ShowEntity n\obj
Else
HideEntity n\obj
EndIf
;[End Block]
Case NPCtype008
;[Block]
;n\State: Main State
;n\State2: A timer used for the player detection
;n\State3: A timer for making the NPC idle (if the player escapes during that time)
If (Not n\IsDead)
If n\State = 0
EntityType n\Collider,HIT_DEAD
Else
EntityType n\Collider,HIT_PLAYER
EndIf
prevFrame = n\Frame
n\BlinkTimer = 1
Select n\State
Case 0 ;Lying next to the wall
SetNPCFrame(n,11)
Case 1 ;Standing up
AnimateNPC(n,11,32,0.1,False)
If n\Frame => 29
n\State = 2
EndIf
Case 2 ;Being active
PlayerSeeAble = MeNPCSeesPlayer(n)
If PlayerSeeAble=1 Or n\State2 > 0.0
If PlayerSeeAble=1
n\State2 = 70*2
Else
n\State2 = Max(n\State2-FPSfactor,0)
EndIf
PointEntity n\obj, Collider
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
AnimateNPC(n, 64, 93, n\CurrSpeed*30)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
If EntityDistance(n\Collider,Collider)<1.0
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
n\State = 3
EndIf
EndIf
n\PathTimer = 0
n\PathStatus = 0
n\PathLocation = 0
n\State3 = 0
Else
If n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 20.0), 0
AnimateNPC(n, 64, 93, n\CurrSpeed*30)
n\CurrSpeed = CurveValue(n\Speed*0.7, n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
;opens doors in front of him
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If dist2 < 0.6 Then
temp = True
If n\Path[n\PathLocation]\door <> Null Then
If (Not n\Path[n\PathLocation]\door\IsElevatorDoor)
If n\Path[n\PathLocation]\door\locked Or n\Path[n\PathLocation]\door\KeyCard>0 Or n\Path[n\PathLocation]\door\Code<>"" Then
temp = False
Else
If n\Path[n\PathLocation]\door\open = False Then UseDoor(n\Path[n\PathLocation]\door, False)
EndIf
EndIf
EndIf
If dist2#<0.2 And temp
n\PathLocation = n\PathLocation + 1
ElseIf dist2#<0.5 And (Not temp)
n\PathStatus = 0
n\PathTimer# = 0.0
EndIf
EndIf
;If Rand(100)=3
; n\PathStatus = FindPath(n,EntityX(Collider),EntityY(Collider),EntityZ(Collider))
;EndIf
EndIf
Else
AnimateNPC(n, 323, 344, 0.2, True)
n\CurrSpeed = 0
If n\PathTimer < 70*5
n\PathTimer = n\PathTimer + Rnd(1,2+(2*SelectedDifficulty\aggressiveNPCs))*FPSfactor
Else
n\PathStatus = FindPath(n,EntityX(Collider),EntityY(Collider),EntityZ(Collider))
n\PathTimer = 0
EndIf
EndIf
If EntityDistance(n\Collider,Collider)>HideDistance
If n\State3 < 70*(15+(10*SelectedDifficulty\aggressiveNPCs))
n\State3 = n\State3+FPSfactor
Else
DebugLog "SCP-008-1 IDLE"
n\State3 = 70*(6*60)
n\State = 4
EndIf
EndIf
EndIf
If n\CurrSpeed > 0.005 Then
If (prevFrame < 80 And n\Frame=>80) Or (prevFrame > 92 And n\Frame<65)
PlaySound2(StepSFX(0,0,Rand(0,7)),Camera, n\Collider, 8.0, Rnd(0.3,0.5))
EndIf
EndIf
n\SoundChn = LoopSound2(n\Sound,n\SoundChn,Camera,n\Collider)
Case 3 ;Attacking
AnimateNPC(n, 126, 165, 0.4, False)
If (n\Frame => 146 And prevFrame < 146)
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
PlaySound_Strict DamageSFX(Rand(5,8))
Injuries = Injuries+Rnd(0.4,1.0)
Infect = Infect + (1+(1*SelectedDifficulty\aggressiveNPCs))
DeathMSG = "Subject D-9341. Cause of death: multiple lacerations and severe blunt force trauma caused by [DATA EXPUNGED], who was infected with SCP-008. Said subject was located by Nine-Tailed Fox and terminated."
EndIf
EndIf
ElseIf n\Frame => 164
If EntityDistance(n\Collider,Collider)<1.1
If (Abs(DeltaYaw(n\Collider,Collider))<=60.0)
SetNPCFrame(n,126)
Else
n\State = 2
EndIf
Else
n\State = 2
EndIf
EndIf
Case 4 ;Idling
HideEntity n\obj
HideEntity n\Collider
n\DropSpeed = 0
PositionEntity n\Collider,0,500,0
ResetEntity n\Collider
If n\Idle > 0
n\Idle = Max(n\Idle-(1+(1*SelectedDifficulty\aggressiveNPCs))*FPSfactor,0)
Else
If PlayerInReachableRoom() ;Player is in a room where SCP-008-1 can teleport to
If Rand(50-(20*SelectedDifficulty\aggressiveNPCs))=1
ShowEntity n\Collider
ShowEntity n\obj
For w.waypoints = Each WayPoints
If w\door=Null And w\room\dist < HideDistance And Rand(3)=1 Then
If EntityDistance(w\room\obj,n\Collider)<EntityDistance(Collider,n\Collider)
x = Abs(EntityX(n\Collider)-EntityX(w\obj,True))
If x < 12.0 And x > 4.0 Then
z = Abs(EntityZ(n\Collider)-EntityZ(w\obj,True))
If z < 12 And z > 4.0 Then
If w\room\dist > 4
DebugLog "MOVING 008-1 TO "+w\room\roomtemplate\name
PositionEntity n\Collider, EntityX(w\obj,True), EntityY(w\obj,True)+0.25,EntityZ(w\obj,True)
ResetEntity n\Collider
n\PathStatus = 0
n\PathTimer# = 0.0
n\PathLocation = 0
Exit
EndIf
EndIf
EndIf
EndIf
EndIf
Next
n\State = 2
n\State3 = 0
EndIf
EndIf
EndIf
End Select
Else
If n\SoundChn <> 0
StopChannel n\SoundChn
n\SoundChn = 0
FreeSound_Strict n\Sound
n\Sound = 0
EndIf
AnimateNPC(n, 344, 363, 0.5, False)
EndIf
RotateEntity n\obj,0,EntityYaw(n\Collider)-180,0
PositionEntity n\obj,EntityX(n\Collider),EntityY(n\Collider)-0.2,EntityZ(n\Collider)
;[End Block]
End Select
If n\IsDead
EntityType n\Collider,HIT_DEAD
EndIf
Local gravityDist = Distance(EntityX(Collider),EntityZ(Collider),EntityX(n\Collider),EntityZ(n\Collider))
If gravityDist<HideDistance*0.7 Or n\NPCtype = NPCtype1499 Then
If n\InFacility = InFacility
TranslateEntity n\Collider, 0, n\DropSpeed, 0
Local CollidedFloor% = False
For i% = 1 To CountCollisions(n\Collider)
If CollisionY(n\Collider, i) < EntityY(n\Collider) - 0.01 Then CollidedFloor = True : Exit
Next
If CollidedFloor = True Then
n\DropSpeed# = 0
Else
If ShouldEntitiesFall
; If n\FallingPickDistance>0
; Local pick = LinePick(EntityX(n\Collider),EntityY(n\Collider),EntityZ(n\Collider),0,-n\FallingPickDistance,0)
; If pick
; n\DropSpeed# = Max(n\DropSpeed - 0.005*FPSfactor*n\GravityMult,-n\MaxGravity)
; Else
; n\DropSpeed# = 0
; EndIf
; Else
; n\DropSpeed# = Max(n\DropSpeed - 0.005*FPSfactor*n\GravityMult,-n\MaxGravity)
; EndIf
Local UpdateGravity% = False
Local MaxX#,MinX#,MaxZ#,MinZ#
If n\InFacility=1
If PlayerRoom\RoomTemplate\Name$ <> "173"
For e.Events = Each Events
If e\EventName = "room860"
If e\EventState = 1.0
UpdateGravity = True
Exit
EndIf
EndIf
Next
Else
UpdateGravity = True
EndIf
If (Not UpdateGravity)
For r.Rooms = Each Rooms
If r\MaxX<>0 Or r\MinX<>0 Or r\MaxZ<>0 Or r\MinZ<>0
MaxX# = r\MaxX
MinX# = r\MinX
MaxZ# = r\MaxZ
MinZ# = r\MinZ
Else
MaxX# = 4.0
MinX# = 0.0
MaxZ# = 4.0
MinZ# = 0.0
EndIf
If Abs(EntityX(n\Collider)-EntityX(r\obj))<=Abs(MaxX-MinX)
If Abs(EntityZ(n\Collider)-EntityZ(r\obj))<=Abs(MaxZ-MinZ)
If r=PlayerRoom
UpdateGravity = True
Exit
EndIf
If IsRoomAdjacent(PlayerRoom,r)
UpdateGravity = True
Exit
EndIf
For i=0 To 3
If (IsRoomAdjacent(PlayerRoom\Adjacent[i],r))
UpdateGravity = True
Exit
EndIf
Next
EndIf
EndIf
Next
EndIf
Else
UpdateGravity = True
EndIf
If UpdateGravity
n\DropSpeed# = Max(n\DropSpeed - 0.005*FPSfactor*n\GravityMult,-n\MaxGravity)
Else
If n\FallingPickDistance>0
n\DropSpeed = 0.0
Else
n\DropSpeed# = Max(n\DropSpeed - 0.005*FPSfactor*n\GravityMult,-n\MaxGravity)
EndIf
EndIf
Else
n\DropSpeed# = 0.0
EndIf
EndIf
Else
n\DropSpeed = 0
EndIf
Else
n\DropSpeed = 0
EndIf
CatchErrors(Chr(34)+n\NVName+Chr(34)+" NPC")
Next
If MTF_CameraCheckTimer>0.0 And MTF_CameraCheckTimer<70*90
MTF_CameraCheckTimer=MTF_CameraCheckTimer+FPSfactor
ElseIf MTF_CameraCheckTimer>=70*90
MTF_CameraCheckTimer=0.0
If (Not PlayerDetected)
If MTF_CameraCheckDetected
PlayAnnouncement("SFX\Character\MTF\AnnouncCameraFound"+Rand(1,2)+".ogg")
PlayerDetected=True
MTF_CameraCheckTimer=70*60
Else
PlayAnnouncement("SFX\Character\MTF\AnnouncCameraNoFound.ogg")
EndIf
EndIf
MTF_CameraCheckDetected=False
If MTF_CameraCheckTimer=0.0
PlayerDetected=False
EndIf
EndIf
End Function
Function TeleportCloser(n.NPCs)
Local closestDist# = 0
Local closestWaypoint.WayPoints
Local w.WayPoints
Local xtemp#, ztemp#
For w.WayPoints = Each WayPoints
If w\door = Null Then
xtemp = Abs(EntityX(w\obj,True)-EntityX(n\Collider,True))
If xtemp < 10.0 And xtemp > 1.0 Then
ztemp = Abs(EntityZ(w\obj,True)-EntityZ(n\Collider,True))
If ztemp < 10.0 And ztemp > 1.0 Then
If (EntityDistance(Collider, w\obj)>16-(8*SelectedDifficulty\aggressiveNPCs)) Then
;teleports to the nearby waypoint that takes it closest to the player
Local newDist# = EntityDistance(Collider, w\obj)
If (newDist < closestDist Or closestWaypoint = Null) Then
closestDist = newDist
closestWaypoint = w
EndIf
EndIf
EndIf
EndIf
EndIf
Next
Local shouldTeleport% = False
If (closestWaypoint<>Null) Then
If n\InFacility <> 1 Or SelectedDifficulty\aggressiveNPCs Then
shouldTeleport = True
ElseIf EntityY(closestWaypoint\obj,True)<=7.0 And EntityY(closestWaypoint\obj,True)>=-10.0 Then
shouldTeleport = True
EndIf
If shouldTeleport Then
PositionEntity n\Collider, EntityX(closestWaypoint\obj,True), EntityY(closestWaypoint\obj,True)+0.15, EntityZ(closestWaypoint\obj,True), True
ResetEntity n\Collider
n\PathStatus = 0
n\PathTimer# = 0.0
n\PathLocation = 0
EndIf
EndIf
End Function
Function OtherNPCSeesMeNPC%(me.NPCs,other.NPCs)
If other\BlinkTimer<=0.0 Then Return False
If EntityDistance(other\Collider,me\Collider)<6.0 Then
If Abs(DeltaYaw(other\Collider,me\Collider))<60.0 Then
Return True
EndIf
EndIf
Return False
End Function
Function MeNPCSeesPlayer%(me.NPCs,disablesoundoncrouch%=False)
;Return values:
;False (=0): Player is not detected anyhow
;True (=1): Player is detected by vision
;2: Player is detected by emitting a sound
;3: Player is detected by a camera (only for MTF Units!)
;4: Player is detected through glass
If NoTarget Then Return False
If (Not PlayerDetected) Or me\NPCtype <> NPCtypeMTF
If me\BlinkTimer<=0.0 Then Return False
If EntityDistance(Collider,me\Collider)>(8.0-CrouchState+PlayerSoundVolume) Then Return False
;spots the player if he's either in view or making a loud sound
If PlayerSoundVolume>1.0
If (Abs(DeltaYaw(me\Collider,Collider))>60.0) And EntityVisible(me\Collider,Collider)
Return 1
ElseIf (Not EntityVisible(me\Collider,Collider))
If disablesoundoncrouch% And Crouch%
Return False
Else
Return 2
EndIf
EndIf
Else
If (Abs(DeltaYaw(me\Collider,Collider))>60.0) Then Return False
EndIf
Return EntityVisible(me\Collider,Collider)
Else
If EntityDistance(Collider,me\Collider)>(8.0-CrouchState+PlayerSoundVolume) Then Return 3
If EntityVisible(me\Collider, Camera) Then Return True
;spots the player if he's either in view or making a loud sound
If PlayerSoundVolume>1.0 Then Return 2
Return 3
EndIf
End Function
Function TeleportMTFGroup(n.NPCs)
Local n2.NPCs
If n\MTFLeader <> Null Then Return
TeleportCloser(n)
For n2 = Each NPCs
If n2\NPCtype = NPCtypeMTF
If n2\MTFLeader <> Null
PositionEntity n2\Collider,EntityX(n2\MTFLeader\Collider),EntityY(n2\MTFLeader\Collider)+0.1,EntityZ(n2\MTFLeader\Collider)
EndIf
EndIf
Next
DebugLog "Teleported MTF Group (dist:"+EntityDistance(n\Collider,Collider)+")"
End Function
Function UpdateMTFUnit(n.NPCs)
;[Block]
If n\NPCtype<>NPCtypeMTF Then
Local realType$ = ""
Select n\NPCtype
Case NPCtype173
realType = "173"
Case NPCtypeOldMan
realType = "106"
Case NPCtypeGuard
realType = "guard"
Case NPCtypeD
realType = "d"
Case NPCtype372
realType = "372"
Case NPCtypeApache
realType = "apache"
Case NPCtype096
realType = "096"
Case NPCtype049
realType = "049"
Case NPCtypeZombie
realType = "zombie"
Case NPCtype5131
realType = "513-1"
Case NPCtypeTentacle
realType = "tentacle"
Case NPCtype860
realType = "860"
Case NPCtype939
realType = "939"
Case NPCtype066
realType = "066"
Case NPCtypePdPlane
realType = "PDPlane"
Case NPCtype966
realType = "966"
Case NPCtype1048a
realType = "1048-A"
Case NPCtype1499
realType = "1499-1"
End Select
RuntimeError "Called UpdateMTFUnit on "+realType
EndIf
;[End Block]
Local x#,y#,z#
Local r.Rooms
Local prevDist#,newDist#
Local n2.NPCs
Local p.Particles, target, dist#, dist2#
If n\IsDead Then
n\BlinkTimer = -1.0
SetNPCFrame(n, 532)
If ChannelPlaying(n\SoundChn2) Then
StopChannel(n\SoundChn2)
EndIf
Return
EndIf
n\MaxGravity = 0.03
n\BlinkTimer = n\BlinkTimer - FPSfactor
If n\BlinkTimer<=-5.0 Then
;only play the "blinking" sound clip if searching/containing 173
If n\State = 2
If OtherNPCSeesMeNPC(Curr173,n)
PlayMTFSound(LoadTempSound("SFX\Character\MTF\173\BLINKING.ogg"),n)
EndIf
EndIf
n\BlinkTimer = 70.0*Rnd(10.0,15.0)
EndIf
n\Reload = n\Reload - FPSfactor
Local prevFrame# = n\Frame
n\BoneToManipulate = ""
;n\BoneToManipulate2 = ""
n\ManipulateBone = False
n\ManipulationType = 0
n\NPCNameInSection = "MTF"
If Int(n\State) <> 1 Then n\PrevState = 0
n\SoundChn2 = LoopSound2(MTFSFX(6),n\SoundChn2,Camera,n\Collider)
If n\Idle>0.0 Then
FinishWalking(n,488,522,0.015*26)
n\Idle=n\Idle-FPSfactor
If n\Idle<=0.0 Then n\Idle = 0.0
Else
Select Int(n\State) ;what is this MTF doing
Case 0 ;wandering around
;[Block]
n\Speed = 0.015
If n\PathTimer<=0.0 Then ;update path
If n\MTFLeader<>Null Then ;i'll follow the leader
n\PathStatus = FindPath(n,EntityX(n\MTFLeader\Collider,True),EntityY(n\MTFLeader\Collider,True)+0.1,EntityZ(n\MTFLeader\Collider,True)) ;whatever you say boss
Else ;i am the leader
If Curr173\Idle<>2
For r = Each Rooms
If ((Abs(r\x-EntityX(n\Collider,True))>12.0) Or (Abs(r\z-EntityZ(n\Collider,True))>12.0)) And (Rand(1,Max(4-Int(Abs(r\z-EntityZ(n\Collider,True)/8.0)),2))=1) Then
x = r\x
y = 0.1
z = r\z
DebugLog r\RoomTemplate\Name
Exit
EndIf
Next
Else
Local tmp = False
If EntityDistance(n\Collider,Curr173\Collider)>4.0
If (Not EntityVisible(n\Collider,Curr173\Collider))
tmp = True
EndIf
EndIf
If (Not tmp)
For r = Each Rooms
If r\RoomTemplate\Name$ = "start"
Local foundChamber% = False
Local pvt% = CreatePivot()
PositionEntity pvt%,EntityX(r\obj,True)+4736*RoomScale,0.5,EntityZ(r\obj,True)+1692*RoomScale
If Distance(EntityX(pvt%),EntityZ(pvt%),EntityX(n\Collider),EntityZ(n\Collider))<3.5
foundChamber% = True
DebugLog Distance(EntityX(pvt%),EntityZ(pvt%),EntityX(n\Collider),EntityZ(n\Collider))
EndIf
If Curr173\Idle = 3 And Distance(EntityX(pvt%),EntityZ(pvt%),EntityX(n\Collider),EntityZ(n\Collider)) > 4.0
If r\RoomDoors[1]\open = True Then UseDoor(r\RoomDoors[1],False)
EndIf
FreeEntity pvt%
If Distance(EntityX(n\Collider),EntityZ(n\Collider),EntityX(r\obj,True)+4736*RoomScale,EntityZ(r\obj,True)+1692*RoomScale)>1.6 And (Not foundChamber)
x = EntityX(r\obj,True)+4736*RoomScale
y = 0.1
z = EntityZ(r\obj,True)+1692*RoomScale
DebugLog "Move to 173's chamber"
Exit
ElseIf Distance(EntityX(n\Collider),EntityZ(n\Collider),EntityX(r\obj,True)+4736*RoomScale,EntityZ(r\obj,True)+1692*RoomScale)>1.6 And foundChamber
n\PathX = EntityX(r\obj,True)+4736*RoomScale
n\PathZ = EntityZ(r\obj,True)+1692*RoomScale
DebugLog "Move inside 173's chamber"
Exit
Else
Curr173\Idle = 3
Curr173\Target = Null
Curr173\IsDead = True
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\173\Cont"+Rand(1,4)+".ogg")
PlayMTFSound(n\Sound, n)
PlayAnnouncement("SFX\Character\MTF\Announc173Contain.ogg")
DebugLog "173 contained"
Exit
EndIf
EndIf
Next
Else
x = EntityX(Curr173\Collider)
y = 0.1
z = EntityZ(Curr173\Collider)
DebugLog "Going back to 173's cage"
EndIf
EndIf
If n\PathX=0 Then n\PathStatus = FindPath(n,x,y,z) ;we're going to this room for no particular reason
EndIf
If n\PathStatus = 1 Then
While n\Path[n\PathLocation]=Null
If n\PathLocation>19 Then Exit
n\PathLocation=n\PathLocation+1
Wend
If n\PathLocation<19 Then
If (n\Path[n\PathLocation]<>Null) And (n\Path[n\PathLocation+1]<>Null) Then
If (n\Path[n\PathLocation]\door=Null) Then
If Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation]\obj))>Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation+1]\obj)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
EndIf
EndIf
EndIf
n\PathTimer = 70.0 * Rnd(6.0,10.0) ;search again after 6-10 seconds
ElseIf (n\PathTimer<=70.0 * 2.5) And (n\MTFLeader=Null) Then
n\PathTimer=n\PathTimer-FPSfactor
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
Else
If n\PathStatus=2 Then
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
ElseIf n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
;MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<1.0 And n\Path[n\PathLocation]\door<>Null) Then
;open the door and make it automatically close after 5 seconds
If (Not n\Path[n\PathLocation]\door\open)
Local sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor ;timer goes down slow
ElseIf n\PathX#<>0.0
pvt = CreatePivot()
PositionEntity pvt,n\PathX#,0.5,n\PathZ#
PointEntity n\Collider,pvt
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
If Distance(EntityX(n\Collider),EntityZ(n\Collider),n\PathX#,n\PathZ#)<0.2
n\PathX# = 0.0
n\PathZ# = 0.0
n\PathTimer = 70.0 * Rnd(6.0,10.0)
EndIf
FreeEntity pvt
Else
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
If n\MTFLeader = Null Then
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\CurrSpeed = 0.0
ElseIf EntityDistance(n\Collider,n\MTFLeader\Collider)>1.0 Then
PointEntity n\Collider,n\MTFLeader\Collider
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
Else
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\CurrSpeed = 0.0
EndIf
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
EndIf
EndIf
Local temp = MeNPCSeesPlayer(n)
If NoTarget Then temp = False
If temp>False Then
If n\LastSeen > 0 And n\LastSeen < 70*15 Then
If temp < 2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\ThereHeIs"+Rand(1,6)+".ogg")
PlayMTFSound(n\Sound, n)
EndIf
Else
If temp = True
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\Stop"+Rand(1,6)+".ogg")
PlayMTFSound(n\Sound, n)
ElseIf temp = 2
;If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
;n\Sound = MTFSFX(Rand(0,3))
;PlayMTFSound(n\Sound, n)
PlayMTFSound(MTFSFX(Rand(0,3)),n)
EndIf
EndIf
n\LastSeen = (70*Rnd(30,40))
n\LastDist = 1
n\State = 1
n\EnemyX = EntityX(Collider,True)
n\EnemyY = EntityY(Collider,True)
n\EnemyZ = EntityZ(Collider,True)
n\State2 = 70.0*(15.0*temp) ;give up after 15 seconds (30 seconds if detected by loud noise, over camera: 45)
DebugLog "player spotted :"+n\State2
n\PathTimer=0.0
n\PathStatus=0
n\Reload = 200-(100*SelectedDifficulty\aggressiveNPCs)
;If EntityDistance(n\Collider,Collider)>HideDistance*0.7
; TeleportMTFGroup(n)
;EndIf
EndIf
;B3D doesn't do short-circuit evaluation, so this retarded nesting is an optimization
If Curr173\Idle<2 Then
Local SoundVol173# = Max(Min((Distance(EntityX(Curr173\Collider), EntityZ(Curr173\Collider), Curr173\PrevX, Curr173\PrevZ) * 2.5), 1.0), 0.0)
If OtherNPCSeesMeNPC(Curr173,n) Or (SoundVol173#>0.0 And EntityDistance(n\Collider,Curr173\Collider)<6.0) Then
If EntityVisible(n\Collider,Curr173\Collider) Or SoundVol173#>0.0 Then
n\State = 2
n\EnemyX = EntityX(Curr173\Collider,True)
n\EnemyY = EntityY(Curr173\Collider,True)
n\EnemyZ = EntityZ(Curr173\Collider,True)
n\State2 = 70.0*15.0 ;give up after 15 seconds
n\State3 = 0.0
n\PathTimer=0.0
n\PathStatus=0
DebugLog "173 spotted :"+n\State2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\173\Spotted"+Rand(1,2)+".ogg")
PlayMTFSound(n\Sound, n)
EndIf
EndIf
EndIf
If Curr106\State <= 0
If OtherNPCSeesMeNPC(Curr106,n) Or EntityDistance(n\Collider,Curr106\Collider)<3.0 Then
If EntityVisible(n\Collider,Curr106\Collider) Then
n\State = 4
n\EnemyX = EntityX(Curr106\Collider,True)
n\EnemyY = EntityY(Curr106\Collider,True)
n\EnemyZ = EntityZ(Curr106\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = Curr106
DebugLog "106 spotted :"+n\State2
;If n\MTFLeader=Null
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\106\Spotted"+Rand(1,3)+".ogg")
PlayMTFSound(n\Sound, n)
;EndIf
EndIf
EndIf
EndIf
If Curr096 <> Null
If OtherNPCSeesMeNPC(Curr096,n) Then
If EntityVisible(n\Collider,Curr096\Collider) Then
n\State = 8
n\EnemyX = EntityX(Curr096\Collider,True)
n\EnemyY = EntityY(Curr096\Collider,True)
n\EnemyZ = EntityZ(Curr096\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
DebugLog "096 spotted :"+n\State2
;If n\MTFLeader=Null
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\096\Spotted"+Rand(1,2)+".ogg")
PlayMTFSound(n\Sound, n)
;EndIf
EndIf
EndIf
EndIf
For n2.NPCs = Each NPCs
If n2\NPCtype = NPCtype049
If OtherNPCSeesMeNPC(n2,n) Then
If EntityVisible(n\Collider,n2\Collider)
n\State = 4
n\EnemyX = EntityX(n2\Collider,True)
n\EnemyY = EntityY(n2\Collider,True)
n\EnemyZ = EntityZ(n2\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = n2
DebugLog "049 spotted :"+n\State2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Spotted"+Rand(1,5)+".ogg")
PlayMTFSound(n\Sound, n)
Exit
EndIf
EndIf
ElseIf n2\NPCtype = NPCtypeZombie And n2\IsDead = False
If OtherNPCSeesMeNPC(n2,n) Then
If EntityVisible(n\Collider,n2\Collider)
n\State = 9
n\EnemyX = EntityX(n2\Collider,True)
n\EnemyY = EntityY(n2\Collider,True)
n\EnemyZ = EntityZ(n2\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = n2
n\Reload = 70*5
DebugLog "049-2 spotted :"+n\State2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Player0492_1.ogg")
PlayMTFSound(n\Sound, n)
Exit
EndIf
EndIf
ElseIf n2\NPCtype = NPCtype008 And n2\IsDead = False
If OtherNPCSeesMeNPC(n2,n) Then
If EntityVisible(n\Collider,n2\Collider)
n\State = 9
n\EnemyX = EntityX(n2\Collider,True)
n\EnemyY = EntityY(n2\Collider,True)
n\EnemyZ = EntityZ(n2\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = n2
n\Reload = 70*5
DebugLog "008 spotted :"+n\State2
;If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
;n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Player0492_1.ogg")
;PlayMTFSound(n\Sound, n)
Exit
EndIf
EndIf
EndIf
Next
;[End Block]
Case 1 ;searching for player
;[Block]
n\Speed = 0.015
n\State2=n\State2-FPSfactor
If MeNPCSeesPlayer(n) = True Then
;if close enough, start shooting at the player
If playerDist < 4.0 Then
Local angle# = VectorYaw(EntityX(Collider)-EntityX(n\Collider),0,EntityZ(Collider)-EntityZ(n\Collider))
RotateEntity(n\Collider, 0, CurveAngle(angle, EntityYaw(n\Collider), 10.0), 0, True)
n\Angle = EntityYaw(n\Collider)
If n\Reload =< 0 And KillTimer = 0 Then
If EntityVisible(n\Collider, Camera) Then
angle# = WrapAngle(angle - EntityYaw(n\Collider))
If angle < 5 Or angle > 355 Then
prev% = KillTimer
PlaySound2(GunshotSFX, Camera, n\Collider, 15)
pvt% = CreatePivot()
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
Shoot(EntityX(pvt),EntityY(pvt),EntityZ(pvt),5.0/playerDist, False)
n\Reload = 7
FreeEntity(pvt)
DeathMSG="Subject D-9341. Died of blood loss after being shot by Nine-Tailed Fox."
;player killed -> "target terminated"
If prev => 0 And KillTimer < 0 Then
DeathMSG="Subject D-9341. Terminated by Nine-Tailed Fox."
PlayMTFSound(LoadTempSound("SFX\Character\MTF\Targetterminated"+Rand(1,4)+".ogg"),n)
EndIf
EndIf
EndIf
EndIf
For n2.NPCs = Each NPCs
If n2\NPCtype = NPCtypeMTF And n2 <> n
If n2\State = 0
If EntityDistance(n\Collider,n2\Collider)<6.0
n\PrevState = 1
n2\LastSeen = (70*Rnd(30,40))
n2\LastDist = 1
n2\State = 1
n2\EnemyX = EntityX(Collider,True)
n2\EnemyY = EntityY(Collider,True)
n2\EnemyZ = EntityZ(Collider,True)
n2\State2 = n\State2
n2\PathTimer=0.0
n2\PathStatus=0
n2\Reload = 200-(100*SelectedDifficulty\aggressiveNPCs)
n2\PrevState = 0
EndIf
EndIf
EndIf
Next
If n\PrevState = 1
SetNPCFrame(n,423)
n\PrevState = 2
ElseIf n\PrevState=2
If n\Frame>200
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 20.0)
AnimateNPC(n, 423, 463, 0.4, False)
If n\Frame>462.9 Then n\Frame = 78
Else
AnimateNPC(n, 78, 193, 0.2, False)
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 20.0)
EndIf
Else
If n\Frame>958 Then
AnimateNPC(n, 1374, 1383, 0.3, False)
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 20.0)
If n\Frame>1382.9 Then n\Frame = 78
Else
AnimateNPC(n, 78, 193, 0.2, False)
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 20.0)
EndIf
EndIf
Else
PositionEntity n\obj,n\EnemyX,n\EnemyY,n\EnemyZ,True
PointEntity n\Collider,n\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
EndIf
Else
n\LastSeen = n\LastSeen - FPSfactor
;n\Reload = 200-(100*SelectedDifficulty\aggressiveNPCs)
If n\Reload <= 7
n\Reload = 7
EndIf
If n\PathTimer<=0.0 Then ;update path
n\PathStatus = FindPath(n,n\EnemyX,n\EnemyY+0.1,n\EnemyZ)
n\PathTimer = 70.0 * Rnd(6.0,10.0) ;search again after 6 seconds
ElseIf n\PathTimer<=70.0 * 2.5 Then
n\PathTimer=n\PathTimer-FPSfactor
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
Else
If n\PathStatus=2 Then
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
ElseIf n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<1.0 And n\Path[n\PathLocation]\door<>Null) Then
;open the door and make it automatically close after 5 seconds
If (Not n\Path[n\PathLocation]\door\open)
sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor ;timer goes down slow
Else
PositionEntity n\obj,n\EnemyX,n\EnemyY,n\EnemyZ,True
If (Distance(EntityX(n\Collider,True),EntityZ(n\Collider,True),n\EnemyX,n\EnemyZ)<0.2) Or (Not EntityVisible(n\obj,n\Collider)) Then
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
If Rand(1,35)=1 Then
For wp.Waypoints = Each WayPoints
If (Rand(1,3)=1) Then
If (EntityDistance(wp\obj,n\Collider)<6.0) Then
n\EnemyX = EntityX(wp\obj,True)
n\EnemyY = EntityY(wp\obj,True)
n\EnemyZ = EntityZ(wp\obj,True)
n\PathTimer = 0.0
Exit
EndIf
EndIf
Next
EndIf
n\PathTimer=n\PathTimer-FPSfactor ;timer goes down slow
Else
PointEntity n\Collider,n\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
EndIf
EndIf
EndIf
If n\MTFLeader=Null And n\LastSeen<70*30 And n\LastSeen+FPSfactor=>70*30 Then
If Rand(2)=1 Then
PlayMTFSound(LoadTempSound("SFX\Character\MTF\Searching"+Rand(1,6)+".ogg"),n)
EndIf
EndIf
;If EntityDistance(n\Collider,Collider)>HideDistance*0.7
; TeleportMTFGroup(n)
;EndIf
EndIf
If n\State2<=0.0 And n\State2+FPSfactor >0.0 Then
If n\MTFLeader = Null Then
DebugLog "targetlost: "+n\State2
PlayMTFSound(LoadTempSound("SFX\Character\MTF\Targetlost"+Rand(1,3)+".ogg"),n)
If MTF_CameraCheckTimer=0.0
If Rand(15-(7*SelectedDifficulty\aggressiveNPCs))=1 ;Maybe change this to another chance - ENDSHN
PlayAnnouncement("SFX\Character\MTF\AnnouncCameraCheck.ogg")
MTF_CameraCheckTimer = FPSfactor
EndIf
EndIf
EndIf
n\State = 0
EndIf
;B3D doesn't do short-circuit evaluation, so this retarded nesting is an optimization
If Curr173\Idle<2 Then
SoundVol173# = Max(Min((Distance(EntityX(Curr173\Collider), EntityZ(Curr173\Collider), Curr173\PrevX, Curr173\PrevZ) * 2.5), 1.0), 0.0)
If OtherNPCSeesMeNPC(Curr173,n) Or (SoundVol173#>0.0 And EntityDistance(n\Collider,Curr173\Collider)<6.0) Then
If EntityVisible(n\Collider,Curr173\Collider) Or SoundVol173#>0.0 Then
n\State = 2
n\EnemyX = EntityX(Curr173\Collider,True)
n\EnemyY = EntityY(Curr173\Collider,True)
n\EnemyZ = EntityZ(Curr173\Collider,True)
n\State2 = 70.0*15.0 ;give up after 15 seconds
DebugLog "173 spotted :"+n\State2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\173\Spotted3.ogg")
PlayMTFSound(n\Sound, n)
n\State3 = 0.0
n\PathTimer=0.0
n\PathStatus=0
EndIf
EndIf
EndIf
If Curr106\State <= 0
If OtherNPCSeesMeNPC(Curr106,n) Or EntityDistance(n\Collider,Curr106\Collider)<3.0 Then
If EntityVisible(n\Collider,Curr106\Collider) Then
n\State = 4
n\EnemyX = EntityX(Curr106\Collider,True)
n\EnemyY = EntityY(Curr106\Collider,True)
n\EnemyZ = EntityZ(Curr106\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = Curr106
DebugLog "106 spotted :"+n\State2
If n\MTFLeader=Null
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\106\Spotted4.ogg")
PlayMTFSound(n\Sound, n)
EndIf
EndIf
EndIf
EndIf
If Curr096 <> Null
If OtherNPCSeesMeNPC(Curr096,n) Then
If EntityVisible(n\Collider,Curr096\Collider) Then
n\State = 8
n\EnemyX = EntityX(Curr096\Collider,True)
n\EnemyY = EntityY(Curr096\Collider,True)
n\EnemyZ = EntityZ(Curr096\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
DebugLog "096 spotted :"+n\State2
If n\MTFLeader=Null
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\096\Spotted"+Rand(1,2)+".ogg")
PlayMTFSound(n\Sound, n)
EndIf
EndIf
EndIf
EndIf
For n2.NPCs = Each NPCs
If n2\NPCtype = NPCtype049
If OtherNPCSeesMeNPC(n2,n) Then
If EntityVisible(n\Collider,n2\Collider)
n\State = 4
n\EnemyX = EntityX(n2\Collider,True)
n\EnemyY = EntityY(n2\Collider,True)
n\EnemyZ = EntityZ(n2\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = n2
DebugLog "049 spotted :"+n\State2
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Spotted"+Rand(1,5)+".ogg")
PlayMTFSound(n\Sound, n)
Exit
EndIf
EndIf
ElseIf n2\NPCtype = NPCtypeZombie And n2\IsDead = False
If OtherNPCSeesMeNPC(n2,n) Then
If EntityVisible(n\Collider,n2\Collider)
n\State = 9
n\EnemyX = EntityX(n2\Collider,True)
n\EnemyY = EntityY(n2\Collider,True)
n\EnemyZ = EntityZ(n2\Collider,True)
n\State2 = 70*15.0
n\State3 = 0.0
n\PathTimer = 0.0
n\PathStatus = 0
n\Target = n2
n\Reload = 70*5
DebugLog "049-2 spotted :"+n\State2
;If n\MTFLeader=Null
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Player0492_1.ogg")
PlayMTFSound(n\Sound, n)
;EndIf
Exit
EndIf
EndIf
EndIf
Next
;DebugLog Distance(EntityX(n\Collider,True),EntityZ(n\Collider,True),n\EnemyX,n\EnemyZ)
;[End Block]
Case 2 ;searching for/looking at 173
;[Block]
If Curr173\Idle = 2 Then
n\State = 0
Else
For n2.NPCs = Each NPCs
If n2<>n Then
If n2\NPCtype = NPCtypeMTF Then
n2\State = 2
EndIf
EndIf
Next
Local curr173Dist# = Distance(EntityX(n\Collider,True),EntityZ(n\Collider,True),EntityX(Curr173\Collider,True),EntityZ(Curr173\Collider,True))
If curr173Dist<5.0 Then
If Curr173\Idle <> 2 Then Curr173\Idle = True
n\State2 = 70.0*15.0
n\PathTimer = 0.0
Local tempDist# = 1.0
If n\MTFLeader<>Null Then tempDist = 2.0
If curr173Dist<tempDist Then
If n\MTFLeader = Null Then
n\State3=n\State3+FPSfactor
DebugLog "CONTAINING 173: "+n\State3
;If n\State3>=70.0*10.0 Then
If n\State3>=70.0*15.0 Then
Curr173\Idle = 2
If n\MTFLeader = Null Then Curr173\Target = n
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
n\Sound = LoadSound_Strict("SFX\Character\MTF\173\Box"+Rand(1,3)+".ogg")
PlayMTFSound(n\Sound, n)
EndIf
EndIf
PositionEntity n\obj,EntityX(Curr173\Collider,True),EntityY(Curr173\Collider,True),EntityZ(Curr173\Collider,True),True
PointEntity n\Collider,n\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
FinishWalking(n,488,522,n\Speed*26)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
Else
PositionEntity n\obj,EntityX(Curr173\Collider,True),EntityY(Curr173\Collider,True),EntityZ(Curr173\Collider,True),True
PointEntity n\Collider,n\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
EndIf
Else
If Curr173\Idle <> 2 Then Curr173\Idle = False
If n\PathTimer<=0.0 Then ;update path
n\PathStatus = FindPath(n,EntityX(Curr173\Collider,True),EntityY(Curr173\Collider,True)+0.1,EntityZ(Curr173\Collider,True))
n\PathTimer = 70.0 * Rnd(6.0,10.0) ;search again after 6 seconds
ElseIf n\PathTimer<=70.0 * 2.5 Then
n\PathTimer=n\PathTimer-FPSfactor
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
Else
If n\PathStatus=2 Then
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
ElseIf n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<1.0 And n\Path[n\PathLocation]\door<>Null) Then
;open the door and make it automatically close after 5 seconds
If (Not n\Path[n\PathLocation]\door\open)
sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor ;timer goes down slow
Else
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
n\CurrSpeed = 0.0
If Rand(1,35)=1 Then
RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
EndIf
EndIf
EndIf
EndIf
;[End Block]
Case 3 ;following a path
;[Block]
n\Angle = CurveValue(0,n\Angle,40.0)
If n\PathStatus = 2 Then
n\State = 5
n\CurrSpeed = 0
ElseIf n\PathStatus = 1
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0
n\PathStatus = 0
If n\LastSeen > 0 Then n\State = 5
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
If n\Path[n\PathLocation]\door <> Null Then
If n\Path[n\PathLocation]\door\open = False Then
n\Path[n\PathLocation]\door\open = True
n\Path[n\PathLocation]\door\timerstate = 8.0*70.0
PlayMTFSound(MTFSFX(5),n)
EndIf
EndIf
If dist < HideDistance*0.7 Then
dist2# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
;If Rand(5)=1 Then
; For n2.NPCs = Each NPCs
; If n2\NPCtype = n\NPCtype And n2<>n Then
; If EntityDistance(n\Collider, n2\Collider)<2 Then
; n\Idle = 150
; EndIf
; EndIf
; Next
;EndIf
PointEntity n\obj, n\Path[n\PathLocation]\obj
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj), EntityYaw(n\Collider), 10.0), 0
If n\Idle = 0 Then
n\CurrSpeed = CurveValue(n\Speed*Max(Min(dist2,1.0),0.1), n\CurrSpeed, 20.0)
MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
;If dist2 < (0.25+((n\Path[Min(n\PathLocation+1,19)]=Null)*0.3 * (n\ID Mod 3))) Then
If EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)<0.5
n\PathLocation = n\PathLocation + 1
EndIf
EndIf
Else
If Rand(20)=1 Then
PositionEntity n\Collider, EntityX(n\Path[n\PathLocation]\obj,True),EntityY(n\Path[n\PathLocation]\obj,True)+0.25,EntityZ(n\Path[n\PathLocation]\obj,True),True
n\PathLocation = n\PathLocation + 1
ResetEntity n\Collider
EndIf
EndIf
EndIf
Else
n\CurrSpeed = 0
n\State = 5
EndIf
If n\Idle = 0 And n\PathStatus = 1 Then
If dist < HideDistance Then
If n\Frame>959 Then
AnimateNPC(n, 1376, 1383, 0.2, False)
If n\Frame >1382.9 Then n\Frame = 488
Else
AnimateNPC(n, 488, 522, n\CurrSpeed*30)
EndIf
EndIf
Else
If dist < HideDistance Then
If n\LastSeen > 0 Then
AnimateNPC(n, 78, 312, 0.2, True)
Else
If n\Frame<962 Then
If n\Frame>487 Then n\Frame = 463
AnimateNPC(n, 463, 487, 0.3, False)
If n\Frame>486.9 Then n\Frame = 962
Else
AnimateNPC(n, 962, 1259, 0.3)
EndIf
EndIf
EndIf
n\CurrSpeed = CurveValue(0, n\CurrSpeed, 20.0)
EndIf
n\Angle = EntityYaw(n\Collider)
;[End Block]
Case 4 ;SCP-106/049 detected
;[Block]
n\Speed = 0.03
n\State2=n\State2-FPSfactor
If n\State2 > 0.0
If OtherNPCSeesMeNPC(n\Target,n)
n\State2 = 70*15
EndIf
If EntityDistance(n\Target\Collider,n\Collider)>HideDistance
If n\State2 > 70
n\State2 = 70
EndIf
EndIf
If EntityDistance(n\Target\Collider,n\Collider)<3.0 And n\State3 >= 0.0
n\State3 = 70*5
EndIf
If n\State3 > 0.0
n\PathStatus = 0
n\PathLocation = 0
n\Speed = 0.02
PointEntity n\Collider,n\Target\Collider
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(-n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,522, 488, n\CurrSpeed*26)
n\PathTimer = 1.0
n\State3=Max(n\State3-FPSfactor,0)
HideEntity n\Collider
TurnEntity n\Collider,0,180,0
EntityPick(n\Collider, 1.0)
If PickedEntity() <> 0 Then
n\State3 = -70*2
EndIf
ShowEntity n\Collider
TurnEntity n\Collider,0,180,0
ElseIf n\State3 < 0.0
n\State3 = Min(n\State3+FPSfactor,0)
EndIf
If n\PathTimer<=0.0 Then
If n\MTFLeader<>Null Then
n\PathStatus = FindPath(n,EntityX(n\MTFLeader\Collider,True),EntityY(n\MTFLeader\Collider,True)+0.1,EntityZ(n\MTFLeader\Collider,True))
Else
For r = Each Rooms
If ((Abs(r\x-EntityX(n\Collider,True))>12.0) Or (Abs(r\z-EntityZ(n\Collider,True))>12.0)) And (Rand(1,Max(4-Int(Abs(r\z-EntityZ(n\Collider,True)/8.0)),2))=1) Then
If EntityDistance(r\obj,n\Target\Collider)>6.0
x = r\x
y = 0.1
z = r\z
DebugLog r\RoomTemplate\Name
Exit
EndIf
EndIf
Next
n\PathStatus = FindPath(n,x,y,z)
EndIf
If n\PathStatus = 1 Then
While n\Path[n\PathLocation]=Null
If n\PathLocation>19 Then Exit
n\PathLocation=n\PathLocation+1
Wend
If n\PathLocation<19 Then
If (n\Path[n\PathLocation]<>Null) And (n\Path[n\PathLocation+1]<>Null) Then
If (n\Path[n\PathLocation]\door=Null) Then
If Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation]\obj))>Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation+1]\obj)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
EndIf
EndIf
EndIf
n\PathTimer = 70*10
Else
If n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26) ;Placeholder (until running animation has been implemented)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<2.0 And n\Path[n\PathLocation]\door<>Null) Then
If (Not n\Path[n\PathLocation]\door\open)
sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor
Else
n\PathTimer=0.0
EndIf
EndIf
Else
n\State = 0
EndIf
;[End Block]
Case 5 ;looking at some other target than the player
;[Block]
target=CreatePivot()
PositionEntity target, n\EnemyX, n\EnemyY, n\EnemyZ, True
If dist<HideDistance Then
AnimateNPC(n, 346, 351, 0.2, False)
EndIf
If Abs(EntityX(target)-EntityX(n\Collider)) < 55.0 And Abs(EntityZ(target)-EntityZ(n\Collider)) < 55.0 And Abs(EntityY(target)-EntityY(n\Collider))< 20.0 Then
PointEntity n\obj, target
RotateEntity n\Collider, 0, CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),30.0), 0, True
If n\PathTimer = 0 Then
n\PathStatus = EntityVisible(n\Collider,target)
n\PathTimer = Rand(100,200)
Else
n\PathTimer = Min(n\PathTimer-FPSfactor,0.0)
EndIf
If n\PathStatus = 1 And n\Reload =< 0 Then
dist# = Distance(EntityX(target),EntityZ(target),EntityX(n\Collider),EntityZ(n\Collider))
;If dist<20.0 Then
; pvt = CreatePivot()
;
; PositionEntity pvt, EntityX(n\obj),EntityY(n\obj), EntityZ(n\obj)
; RotateEntity pvt, EntityPitch(n\Collider), EntityYaw(n\Collider),0
; MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
;
; If WrapAngle(EntityYaw(pvt)-EntityYaw(n\Collider))<5 Then
; PlaySound2(GunshotSFX, Camera, n\Collider, 20)
; p.Particles = CreateParticle(EntityX(n\obj, True), EntityY(n\obj, True), EntityZ(n\obj, True), 1, 0.2, 0.0, 5)
; PositionEntity(p\pvt, EntityX(pvt), EntityY(pvt), EntityZ(pvt))
;
; n\Reload = 7
; EndIf
;
; FreeEntity pvt
;EndIf
EndIf
EndIf
FreeEntity target
n\Angle = EntityYaw(n\Collider)
;[End Block]
Case 6 ;seeing the player as a 049-2 instance
;[Block]
PointEntity n\obj,Collider
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0),0
n\Angle = EntityYaw(n\Collider)
AnimateNPC(n, 346, 351, 0.2, False)
If n\Reload =< 0 And KillTimer = 0 Then
If EntityVisible(n\Collider, Collider) Then
;angle# = WrapAngle(angle - EntityYaw(n\Collider))
;If angle < 5 Or angle > 355 Then
If (Abs(DeltaYaw(n\Collider,Collider))<50.0)
;prev% = KillTimer
PlaySound2(GunshotSFX, Camera, n\Collider, 15)
pvt% = CreatePivot()
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
Shoot(EntityX(pvt),EntityY(pvt),EntityZ(pvt),0.9, False)
n\Reload = 7
FreeEntity(pvt)
;If prev => 0 And KillTimer < 0 Then
;DeathMSG="Subject D-9341. Terminated by Nine-Tailed Fox."
;If n\MTFLeader = Null Then PlayMTFSound(LoadTempSound("SFX\Character\MTF\049\Player0492_2.ogg"),n)
;EndIf
EndIf
EndIf
EndIf
;[End Block]
Case 7 ;just shooting
;[Block]
AnimateNPC(n, 346, 351, 0.2, False)
RotateEntity n\Collider,0,CurveAngle(n\State2,EntityYaw(n\Collider),20),0
n\Angle = EntityYaw(n\Collider)
If n\Reload =< 0
LightVolume = TempLightVolume*1.2
PlaySound2(GunshotSFX, Camera, n\Collider, 20)
pvt% = CreatePivot()
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
p.Particles = CreateParticle(EntityX(pvt), EntityY(pvt), EntityZ(pvt), 1, Rnd(0.08,0.1), 0.0, 5)
TurnEntity p\obj, 0,0,Rnd(360)
p\Achange = -0.15
FreeEntity(pvt)
n\Reload = 7
End If
;[End Block]
Case 8 ;SCP-096 spotted
;[Block]
n\Speed = 0.015
n\BoneToManipulate = "head"
n\ManipulateBone = True
n\ManipulationType = 2
If n\PathTimer<=0.0 Then ;update path
If n\MTFLeader<>Null Then ;i'll follow the leader
n\PathStatus = FindPath(n,EntityX(n\MTFLeader\Collider,True),EntityY(n\MTFLeader\Collider,True)+0.1,EntityZ(n\MTFLeader\Collider,True)) ;whatever you say boss
Else ;i am the leader
For r = Each Rooms
If ((Abs(r\x-EntityX(n\Collider,True))>12.0) Or (Abs(r\z-EntityZ(n\Collider,True))>12.0)) And (Rand(1,Max(4-Int(Abs(r\z-EntityZ(n\Collider,True)/8.0)),2))=1) Then
x = r\x
y = 0.1
z = r\z
DebugLog r\RoomTemplate\Name
Exit
EndIf
Next
n\PathStatus = FindPath(n,x,y,z) ;we're going to this room for no particular reason
EndIf
If n\PathStatus = 1 Then
While n\Path[n\PathLocation]=Null
If n\PathLocation>19 Then Exit
n\PathLocation=n\PathLocation+1
Wend
If n\PathLocation<19 Then
If (n\Path[n\PathLocation]<>Null) And (n\Path[n\PathLocation+1]<>Null) Then
If (n\Path[n\PathLocation]\door=Null) Then
If Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation]\obj))>Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation+1]\obj)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
EndIf
EndIf
EndIf
n\PathTimer = 70.0 * Rnd(6.0,10.0) ;search again after 6-10 seconds
ElseIf (n\PathTimer<=70.0 * 2.5) And (n\MTFLeader=Null) Then
n\PathTimer=n\PathTimer-FPSfactor
n\CurrSpeed = 0.0
;If Rand(1,35)=1 Then
; RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
;EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
Else
If n\PathStatus=2 Then
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
n\CurrSpeed = 0.0
;If Rand(1,35)=1 Then
; RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
;EndIf
FinishWalking(n,488,522,n\Speed*26)
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
ElseIf n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
;MoveEntity n\Collider, 0, 0, n\CurrSpeed * FPSfactor
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<1.0 And n\Path[n\PathLocation]\door<>Null) Then
;open the door and make it automatically close after 5 seconds
If (Not n\Path[n\PathLocation]\door\open)
sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor ;timer goes down slow
Else
n\PathTimer=n\PathTimer-(FPSfactor*2.0) ;timer goes down fast
If n\MTFLeader = Null Then
;If Rand(1,35)=1 Then
; RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
;EndIf
FinishWalking(n,488,522,n\Speed*26)
n\CurrSpeed = 0.0
ElseIf EntityDistance(n\Collider,n\MTFLeader\Collider)>1.0 Then
PointEntity n\Collider,n\MTFLeader\Collider
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
Else
;If Rand(1,35)=1 Then
; RotateEntity n\Collider,0.0,Rnd(360.0),0.0,True
;EndIf
FinishWalking(n,488,522,n\Speed*26)
n\CurrSpeed = 0.0
EndIf
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
EndIf
EndIf
If (Not EntityVisible(n\Collider,Curr096\Collider)) Or EntityDistance(n\Collider,Curr096\Collider)>6.0
n\State = 0
EndIf
;[End Block]
Case 9 ;SCP-049-2/008 spotted
;[Block]
If EntityVisible(n\Collider, n\Target\Collider) Then
PointEntity n\obj,n\Target\Collider
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0),0
n\Angle = EntityYaw(n\Collider)
If EntityDistance(n\Target\Collider,n\Collider)<1.3
n\State3 = 70*2
EndIf
If n\State3 > 0.0
n\PathStatus = 0
n\PathLocation = 0
n\Speed = 0.02
n\CurrSpeed = CurveValue(-n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,522, 488, n\CurrSpeed*26)
n\PathTimer = 1.0
n\State3=Max(n\State3-FPSfactor,0)
Else
n\State3 = 0
AnimateNPC(n, 346, 351, 0.2, False)
EndIf
If n\Reload =< 0 And n\Target\IsDead = False Then
;angle# = WrapAngle(angle - EntityYaw(n\Collider))
;If angle < 5 Or angle > 355 Then
If (Abs(DeltaYaw(n\Collider,n\Target\Collider))<50.0)
;prev% = KillTimer
PlaySound2(GunshotSFX, Camera, n\Collider, 15)
pvt% = CreatePivot()
RotateEntity(pvt, EntityPitch(n\Collider), EntityYaw(n\Collider), 0, True)
PositionEntity(pvt, EntityX(n\obj), EntityY(n\obj), EntityZ(n\obj))
MoveEntity (pvt,0.8*0.079, 10.75*0.079, 6.9*0.079)
p.Particles = CreateParticle(EntityX(pvt), EntityY(pvt), EntityZ(pvt), 1, Rnd(0.08,0.1), 0.0, 5)
TurnEntity p\obj, 0,0,Rnd(360)
p\Achange = -0.15
If n\Target\HP > 0
n\Target\HP = Max(n\Target\HP-Rand(5,10),0)
Else
If (Not n\Target\IsDead)
If n\Sound <> 0 Then FreeSound_Strict n\Sound : n\Sound = 0
If n\NPCtype = NPCtypeZombie
n\Sound = LoadSound_Strict("SFX\Character\MTF\049\Player0492_2.ogg")
PlayMTFSound(n\Sound, n)
Else
;Still needs to be added! (for 008)
EndIf
EndIf
SetNPCFrame(n\Target,133)
n\Target\IsDead = True
n\Target = Null
n\State = 0
Return
EndIf
n\Reload = 7
FreeEntity(pvt)
EndIf
EndIf
n\PathStatus = 0
Else
If n\PathTimer<=0.0 Then
n\PathStatus = FindPath(n,EntityX(n\Target\Collider),EntityY(n\Target\Collider),EntityZ(n\Target\Collider))
If n\PathStatus = 1 Then
While n\Path[n\PathLocation]=Null
If n\PathLocation>19 Then Exit
n\PathLocation=n\PathLocation+1
Wend
If n\PathLocation<19 Then
If (n\Path[n\PathLocation]<>Null) And (n\Path[n\PathLocation+1]<>Null) Then
If (n\Path[n\PathLocation]\door=Null) Then
If Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation]\obj))>Abs(DeltaYaw(n\Collider,n\Path[n\PathLocation+1]\obj)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
EndIf
EndIf
EndIf
n\PathTimer = 70*10
Else
If n\PathStatus=1 Then
If n\Path[n\PathLocation]=Null Then
If n\PathLocation > 19 Then
n\PathLocation = 0 : n\PathStatus = 0
Else
n\PathLocation = n\PathLocation + 1
EndIf
Else
prevDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
PointEntity n\Collider,n\Path[n\PathLocation]\obj
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
RotateEntity n\obj,-90.0,n\Angle,0.0,True
n\CurrSpeed = CurveValue(n\Speed,n\CurrSpeed,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90.0)*n\CurrSpeed * FPSfactor, True
AnimateNPC(n,488, 522, n\CurrSpeed*26)
newDist# = EntityDistance(n\Collider,n\Path[n\PathLocation]\obj)
If (newDist<1.0 And n\Path[n\PathLocation]\door<>Null) Then
If (Not n\Path[n\PathLocation]\door\open)
sound = 0
If n\Path[n\PathLocation]\door\dir = 1 Then sound = 0 Else sound=Rand(0, 2)
PlaySound2(OpenDoorSFX(n\Path[n\PathLocation]\door\dir,sound),Camera,n\Path[n\PathLocation]\door\obj)
PlayMTFSound(MTFSFX(5),n)
EndIf
n\Path[n\PathLocation]\door\open = True
If n\Path[n\PathLocation]\door\MTFClose
n\Path[n\PathLocation]\door\timerstate = 70.0*5.0
EndIf
EndIf
If (newDist<0.2) Or ((prevDist<newDist) And (prevDist<1.0)) Then
n\PathLocation=n\PathLocation+1
EndIf
EndIf
n\PathTimer=n\PathTimer-FPSfactor
Else
n\PathTimer=0.0
EndIf
EndIf
EndIf
If n\Target\IsDead = True Then
n\Target = Null
n\State = 0
EndIf
;[End Block]
End Select
If n\CurrSpeed > 0.01 Then
If prevFrame > 500 And n\Frame<495
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
ElseIf prevFrame < 505 And n\Frame=>505
PlaySound2(StepSFX(2,0,Rand(0,2)),Camera, n\Collider, 8.0, Rnd(0.5,0.7))
EndIf
EndIf
If NoTarget And n\State = 1 Then n\State = 0
If n\State <> 3 And n\State <> 5 And n\State <> 6 And n\State <> 7
If n\MTFLeader<>Null Then
If EntityDistance(n\Collider,n\MTFLeader\Collider)<0.7 Then
PointEntity n\Collider,n\MTFLeader\Collider
RotateEntity n\Collider,0.0,EntityYaw(n\Collider,True),0.0,True
n\Angle = CurveAngle(EntityYaw(n\Collider,True),n\Angle,20.0)
TranslateEntity n\Collider, Cos(EntityYaw(n\Collider,True)-45)* 0.01 * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)-45)* 0.01 * FPSfactor, True
EndIf
Else
For n2.NPCs = Each NPCs
If n2<>n And n2\IsDead=False Then
If Abs(DeltaYaw(n\Collider,n2\Collider))<80.0 Then
If EntityDistance(n\Collider,n2\Collider)<0.7 Then
TranslateEntity n2\Collider, Cos(EntityYaw(n\Collider,True)+90)* 0.01 * FPSfactor, 0, Sin(EntityYaw(n\Collider,True)+90)* 0.01 * FPSfactor, True
EndIf
EndIf
EndIf
Next
EndIf
EndIf
;teleport back to the facility if fell through the floor
If n\State <> 6 And n\State <> 7
If (EntityY(n\Collider) < -10.0) Then
TeleportCloser(n)
EndIf
EndIf
RotateEntity n\obj,-90.0,n\Angle,0.0,True
PositionEntity n\obj,EntityX(n\Collider,True),EntityY(n\Collider,True)-0.15,EntityZ(n\Collider,True),True
EndIf
End Function
Function Shoot(x#, y#, z#, hitProb# = 1.0, particles% = True, instaKill% = False)
;muzzle flash
Local p.Particles = CreateParticle(x,y,z, 1, Rnd(0.08,0.1), 0.0, 5)
TurnEntity p\obj, 0,0,Rnd(360)
p\Achange = -0.15
LightVolume = TempLightVolume*1.2
If (Not GodMode) Then
If instaKill Then Kill() : PlaySound_Strict BullethitSFX : Return
If Rnd(1.0) =< hitProb Then
TurnEntity Camera, Rnd(-3,3), Rnd(-3,3), 0
Local ShotMessageUpdate$
If WearingVest>0 Then
If WearingVest = 1 Then
Select Rand(8)
Case 1,2,3,4,5
BlurTimer = 500
Stamina = 0
ShotMessageUpdate = "A bullet penetrated your vest, making you gasp."
Injuries = Injuries + Rnd(0.1,0.5)
Case 6
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your left leg."
Injuries = Injuries + Rnd(0.8,1.2)
Case 7
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your right leg."
Injuries = Injuries + Rnd(0.8,1.2)
Case 8
BlurTimer = 500
Stamina = 0
ShotMessageUpdate = "A bullet struck your neck, making you gasp."
Injuries = Injuries + Rnd(1.2,1.6)
End Select
Else
If Rand(10)=1 Then
BlurTimer = 500
Stamina = Stamina - 1
ShotMessageUpdate = "A bullet hit your chest. The vest absorbed some of the damage."
Injuries = Injuries + Rnd(0.8,1.1)
Else
ShotMessageUpdate = "A bullet hit your chest. The vest absorbed most of the damage."
Injuries = Injuries + Rnd(0.1,0.5)
EndIf
EndIf
If Injuries >= 5
If Rand(3) = 1 Then Kill()
EndIf
Else
Select Rand(6)
Case 1
Kill()
Case 2
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your left leg."
Injuries = Injuries + Rnd(0.8,1.2)
Case 3
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your right leg."
Injuries = Injuries + Rnd(0.8,1.2)
Case 4
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your right shoulder."
Injuries = Injuries + Rnd(0.8,1.2)
Case 5
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your left shoulder."
Injuries = Injuries + Rnd(0.8,1.2)
Case 6
BlurTimer = 500
ShotMessageUpdate = "A bullet hit your right shoulder."
Injuries = Injuries + Rnd(2.5,4.0)
End Select
EndIf
;Only updates the message if it's been more than two seconds.
If (MsgTimer < 64*4) Then
Msg = ShotMessageUpdate
MsgTimer = 70*6
EndIf
Injuries = Min(Injuries, 4.0)
;Kill()
PlaySound_Strict BullethitSFX
ElseIf particles And ParticleAmount>0
pvt = CreatePivot()
PositionEntity pvt, EntityX(Collider),(EntityY(Collider)+EntityY(Camera))/2,EntityZ(Collider)
PointEntity pvt, p\obj
TurnEntity pvt, 0, 180, 0
EntityPick(pvt, 2.5)
If PickedEntity() <> 0 Then
PlaySound2(Gunshot3SFX, Camera, pvt, 0.4, Rnd(0.8,1.0))
If particles Then
;dust/smoke particles
p.Particles = CreateParticle(PickedX(),PickedY(),PickedZ(), 0, 0.03, 0, 80)
p\speed = 0.001
p\SizeChange = 0.003
p\A = 0.8
p\Achange = -0.01
RotateEntity p\pvt, EntityPitch(pvt)-180, EntityYaw(pvt),0
For i = 0 To Rand(2,3)
p.Particles = CreateParticle(PickedX(),PickedY(),PickedZ(), 0, 0.006, 0.003, 80)
p\speed = 0.02
p\A = 0.8
p\Achange = -0.01
RotateEntity p\pvt, EntityPitch(pvt)+Rnd(170,190), EntityYaw(pvt)+Rnd(-10,10),0
Next
;bullet hole decal
Local de.Decals = CreateDecal(Rand(13,14), PickedX(),PickedY(),PickedZ(), 0,0,0)
AlignToVector de\obj,-PickedNX(),-PickedNY(),-PickedNZ(),3
MoveEntity de\obj, 0,0,-0.001
EntityFX de\obj, 1
de\lifetime = 70*20
EntityBlend de\obj, 2
de\Size = Rnd(0.028,0.034)
ScaleSprite de\obj, de\Size, de\Size
EndIf
EndIf
FreeEntity pvt
EndIf
EndIf
End Function
Function PlayMTFSound(sound%, n.NPCs)
If n <> Null Then
n\SoundChn = PlaySound2(sound, Camera, n\Collider, 8.0)
EndIf
If SelectedItem <> Null Then
If SelectedItem\state2 = 3 And SelectedItem\state > 0 Then
Select SelectedItem\itemtemplate\tempname
Case "radio","fineradio","18vradio"
If sound<>MTFSFX(5) Or (Not ChannelPlaying(RadioCHN(3)))
If RadioCHN(3)<> 0 Then StopChannel RadioCHN(3)
RadioCHN(3) = PlaySound_Strict (sound)
EndIf
End Select
EndIf
EndIf
End Function
Function MoveToPocketDimension()
Local r.Rooms
For r.Rooms = Each Rooms
If r\RoomTemplate\Name = "pocketdimension" Then
FallTimer = 0
UpdateDoors()
UpdateRooms()
ShowEntity Collider
PlaySound_Strict(Use914SFX)
PlaySound_Strict(OldManSFX(5))
PositionEntity(Collider, EntityX(r\obj),0.8,EntityZ(r\obj))
DropSpeed = 0
ResetEntity Collider
BlinkTimer = -10
Injuries = Injuries+0.5
PlayerRoom = r
Return
EndIf
Next
End Function
Function FindFreeNPCID%()
Local id% = 1
While (True)
Local taken% = False
For n2.NPCs = Each NPCs
If n2\ID = id Then
taken = True
Exit
EndIf
Next
If (Not taken) Then
Return id
EndIf
id = id + 1
Wend
End Function
Function ForceSetNPCID(n.NPCs, newID%)
n\ID = newID
For n2.NPCs = Each NPCs
If n2 <> n And n2\ID = newID Then
n2\id = FindFreeNPCID()
EndIf
Next
End Function
Function Find860Angle(n.NPCs, fr.Forest)
TFormPoint(EntityX(Collider),EntityY(Collider),EntityZ(Collider),0,fr\Forest_Pivot)
Local playerx = Floor((TFormedX()+6.0)/12.0)
Local playerz = Floor((TFormedZ()+6.0)/12.0)
TFormPoint(EntityX(n\Collider),EntityY(n\Collider),EntityZ(n\Collider),0,fr\Forest_Pivot)
Local x# = (TFormedX()+6.0)/12.0
Local z# = (TFormedZ()+6.0)/12.0
Local xt = Floor(x), zt = Floor(z)
Local x2,z2
If xt<>playerx Or zt<>playerz Then ;the monster is not on the same tile as the player
For x2 = Max(xt-1,0) To Min(xt+1,gridsize-1)
For z2 = Max(zt-1,0) To Min(zt+1,gridsize-1)
If fr\grid[(z2*gridsize)+x2]>0 And (x2<>xt Or z2<>zt) And (x2=xt Or z2=zt) Then
;tile (x2,z2) is closer to the player than the monsters current tile
If (Abs(playerx-x2)+Abs(playerz-z2))<(Abs(playerx-xt)+Abs(playerz-zt)) Then
;calculate the position of the tile in world coordinates
TFormPoint(x2*12.0,0,z2*12.0,fr\Forest_Pivot,0)
Return point_direction(EntityX(n\Collider),EntityZ(n\Collider),TFormedX(),TFormedZ())+180
EndIf
EndIf
Next
Next
Else
Return point_direction(EntityX(n\Collider),EntityZ(n\Collider),EntityX(Collider),EntityZ(Collider))+180
EndIf
End Function
Function Console_SpawnNPC(c_input$, c_state$ = "")
Local n.NPCs
Local consoleMSG$
Select c_input$
Case "008", "008zombie"
n.NPCs = CreateNPC(NPCtype008, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
n\State = 1
consoleMSG = "SCP-008 infected human spawned."
Case "049", "scp049", "scp-049"
n.NPCs = CreateNPC(NPCtype049, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
n\State = 1
consoleMSG = "SCP-049 spawned."
Case "049-2", "0492", "scp-049-2", "scp049-2", "049zombie"
n.NPCs = CreateNPC(NPCtypeZombie, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
n\State = 1
consoleMSG = "SCP-049-2 spawned."
Case "066", "scp066", "scp-066"
n.NPCs = CreateNPC(NPCtype066, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "SCP-066 spawned."
Case "096", "scp096", "scp-096"
n.NPCs = CreateNPC(NPCtype096, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
n\State = 5
If (Curr096 = Null) Then Curr096 = n
consoleMSG = "SCP-096 spawned."
Case "106", "scp106", "scp-106", "larry"
n.NPCs = CreateNPC(NPCtypeOldMan, EntityX(Collider), EntityY(Collider) - 0.5, EntityZ(Collider))
n\State = -1
consoleMSG = "SCP-106 spawned."
Case "173", "scp173", "scp-173", "statue"
n.NPCs = CreateNPC(NPCtype173, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
Curr173 = n
If (Curr173\Idle = 3) Then Curr173\Idle = False
consoleMSG = "SCP-173 spawned."
Case "372", "scp372", "scp-372"
n.NPCs = CreateNPC(NPCtype372, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "SCP-372 spawned."
Case "513-1", "5131", "scp513-1", "scp-513-1"
n.NPCs = CreateNPC(NPCtype5131, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "SCP-513-1 spawned."
Case "860-2", "8602", "scp860-2", "scp-860-2"
CreateConsoleMsg("SCP-860-2 cannot be spawned with the console. Sorry!", 255, 0, 0)
Case "939", "scp939", "scp-939"
CreateConsoleMsg("SCP-939 instances cannot be spawned with the console. Sorry!", 255, 0, 0)
Case "966", "scp966", "scp-966"
n.NPCs = CreateNPC(NPCtype966, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "SCP-966 instance spawned."
Case "1048-a", "scp1048-a", "scp-1048-a", "scp1048a", "scp-1048a"
CreateConsoleMsg("SCP-1048-A cannot be spawned with the console. Sorry!", 255, 0, 0)
Case "1499-1", "14991", "scp-1499-1", "scp1499-1"
n.NPCs = CreateNPC(NPCtype1499, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "SCP-1499-1 instance spawned."
Case "class-d", "classd", "d"
n.NPCs = CreateNPC(NPCtypeD, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "D-Class spawned."
Case "guard"
n.NPCs = CreateNPC(NPCtypeGuard, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "Guard spawned."
Case "mtf"
n.NPCs = CreateNPC(NPCtypeMTF, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "MTF unit spawned."
Case "apache", "helicopter"
n.NPCs = CreateNPC(NPCtypeApache, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "Apache spawned."
Case "tentacle"
n.NPCs = CreateNPC(NPCtypeTentacle, EntityX(Collider), EntityY(Collider), EntityZ(Collider))
consoleMSG = "SCP-035 tentacle spawned."
Case "clerk"
n.NPCs = CreateNPC(NPCtypeClerk, EntityX(Collider), EntityY(Collider) + 0.2, EntityZ(Collider))
consoleMSG = "Clerk spawned."
Default
CreateConsoleMsg("NPC type not found.", 255, 0, 0) : Return
End Select
If n <> Null
If c_state <> "" Then n\State = Float(c_state) : consoleMSG = consoleMSG + " (State = " + n\State + ")"
EndIf
CreateConsoleMsg(consoleMSG)
End Function
Function ManipulateNPCBones()
Local n.NPCs,bone%,pvt%,bonename$
Local maxvalue#,minvalue#,offset#,smooth#
Local i%
Local tovalue#
For n = Each NPCs
If n\ManipulateBone
bonename$ = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"bonename",0)
If bonename$<>""
pvt% = CreatePivot()
bone% = FindChild(n\obj,bonename$)
If bone% = 0 Then RuntimeError "ERROR: NPC bone "+Chr(34)+bonename$+Chr(34)+" does not exist."
PositionEntity pvt%,EntityX(bone%,True),EntityY(bone%,True),EntityZ(bone%,True)
Select n\ManipulationType
Case 0 ;<--- looking at player
For i = 1 To GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controller_max",1)
If GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i,0) = "pitch"
maxvalue# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_max",2)
minvalue# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_min",2)
offset# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_offset",2)
If GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_inverse",3)
tovalue = -DeltaPitch(bone,Camera)+offset
Else
tovalue = DeltaPitch(bone,Camera)+offset
EndIf
;n\BonePitch = CurveAngle(tovalue,n\BonePitch,20.0)
smooth# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_smoothing",2)
If smooth>0.0
n\BonePitch = CurveAngle(tovalue,n\BonePitch,smooth)
Else
n\BonePitch = tovalue
EndIf
n\BonePitch = ChangeAngleValueForCorrectBoneAssigning(n\BonePitch)
n\BonePitch = Max(Min(n\BonePitch,maxvalue),minvalue)
ElseIf GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis1",0) = "yaw"
maxvalue# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_max",2)
minvalue# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_min",2)
offset# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_offset",2)
If GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_inverse",3)
tovalue = -DeltaYaw(bone,Camera)+offset
Else
tovalue = DeltaYaw(bone,Camera)+offset
EndIf
;n\BoneYaw = CurveAngle(tovalue,n\BoneYaw,20.0)
smooth# = GetNPCManipulationValue(n\NPCNameInSection,n\BoneToManipulate,"controlleraxis"+i+"_smoothing",2)
If smooth>0.0
n\BoneYaw = CurveAngle(tovalue,n\BoneYaw,smooth)
Else
n\BoneYaw = tovalue
EndIf
n\BoneYaw = ChangeAngleValueForCorrectBoneAssigning(n\BoneYaw)
n\BoneYaw = Max(Min(n\BoneYaw,maxvalue),minvalue)
;ElseIf --> (Roll Value)
;
EndIf
Next
RotateEntity bone%,EntityPitch(bone)+n\BonePitch,EntityYaw(bone)+n\BoneYaw,EntityRoll(bone)+n\BoneRoll
End Select
FreeEntity pvt%
EndIf
Else
EndIf
Next
End Function
Function GetNPCManipulationValue$(NPC$,bone$,section$,valuetype%=0)
;valuetype determines what type of variable should the Output be returned
;0 - String
;1 - Int
;2 - Float
;3 - Boolean
Local value$ = GetINIString("Data\NPCBones.ini",NPC$,bone$+"_"+section$)
Select valuetype%
Case 0
Return value$
Case 1
Return Int(value$)
Case 2
Return Float(value$)
Case 3
If value$ = "true" Or value$ = "1"
Return True
Else
Return False
EndIf
End Select
End Function
Function ChangeAngleValueForCorrectBoneAssigning(value#)
Local numb#
If value# <= 180.0
numb# = value#
Else
numb# = -360+value#
EndIf
Return numb#
End Function
Function NPCSpeedChange(n.NPCs)
Select n\NPCtype
Case NPCtype173,NPCtypeOldMan,NPCtype096,NPCtype049,NPCtype939,NPCtypeMTF
Select SelectedDifficulty\otherFactors
Case NORMAL
n\Speed = n\Speed * 1.1
Case HARD
n\Speed = n\Speed * 1.2
End Select
End Select
End Function
Function PlayerInReachableRoom(canSpawnIn049Chamber%=False)
Local RN$ = PlayerRoom\RoomTemplate\Name$
Local e.Events, temp
;Player is in these rooms, returning false
If RN = "pocketdimension" Or RN = "gatea" Or RN = "dimension1499" Or RN = "173" Then
Return False
EndIf
;Player is at GateB and is at the surface, returning false
If RN = "exit1" And EntityY(Collider)>1040.0*RoomScale Then
Return False
EndIf
;Player is in 860's test room and inside the forest, returning false
temp = False
For e = Each Events
If e\EventName$ = "room860" And e\EventState = 1.0 Then
temp = True
Exit
EndIf
Next
If RN = "room860" And temp Then
Return False
EndIf
If (Not canSpawnIn049Chamber) Then
If SelectedDifficulty\aggressiveNPCs = False Then
If RN = "room049" And EntityY(Collider)<=-2848*RoomScale Then
Return False
EndIf
EndIf
EndIf
;Return true, this means player is in reachable room
Return True
End Function
Function CheckForNPCInFacility(n.NPCs)
;False (=0): NPC is not in facility (mostly meant for "dimension1499")
;True (=1): NPC is in facility
;2: NPC is in tunnels (maintenance tunnels/049 tunnels/939 storage room, etc...)
If EntityY(n\Collider)>100.0
Return False
EndIf
If EntityY(n\Collider)< -10.0
Return 2
EndIf
If EntityY(n\Collider)> 7.0 And EntityY(n\Collider)<=100.0
Return 2
EndIf
Return True
End Function
Function FindNextElevator(n.NPCs)
Local eo.ElevatorObj, eo2.ElevatorObj
For eo = Each ElevatorObj
If eo\InFacility = n\InFacility
If Abs(EntityY(eo\obj,True)-EntityY(n\Collider))<10.0
For eo2 = Each ElevatorObj
If eo2 <> eo
If eo2\InFacility = n\InFacility
If Abs(EntityY(eo2\obj,True)-EntityY(n\Collider))<10.0
If EntityDistance(eo2\obj,n\Collider)<EntityDistance(eo\obj,n\Collider)
n\PathStatus = FindPath(n, EntityX(eo2\obj,True),EntityY(eo2\obj,True),EntityZ(eo2\obj,True))
n\CurrElevator = eo2
DebugLog "eo2 found for "+n\NPCtype
Exit
EndIf
EndIf
EndIf
EndIf
Next
If n\CurrElevator = Null
n\PathStatus = FindPath(n, EntityX(eo\obj,True),EntityY(eo\obj,True),EntityZ(eo\obj,True))
n\CurrElevator = eo
DebugLog "eo found for "+n\NPCtype
EndIf
If n\PathStatus <> 1
n\CurrElevator = Null
DebugLog "Unable to find elevator path: Resetting CurrElevator"
EndIf
Exit
EndIf
EndIf
Next
End Function
Function GoToElevator(n.NPCs)
Local dist#,inside%
If n\PathStatus <> 1
PointEntity n\obj,n\CurrElevator\obj
RotateEntity n\Collider,0,CurveAngle(EntityYaw(n\obj),EntityYaw(n\Collider),20.0),0
inside% = False
If Abs(EntityX(n\Collider)-EntityX(n\CurrElevator\obj,True))<280.0*RoomScale
If Abs(EntityZ(n\Collider)-EntityZ(n\CurrElevator\obj,True))<280.0*RoomScale Then
If Abs(EntityY(n\Collider)-EntityY(n\CurrElevator\obj,True))<280.0*RoomScale Then
inside% = True
EndIf
EndIf
EndIf
dist# = EntityDistance(n\Collider,n\CurrElevator\door\frameobj)
If n\CurrElevator\door\open
If (dist# > 0.4 And dist# < 0.7) And inside%
UseDoor(n\CurrElevator\door,False)
DebugLog n\NPCtype+" used elevator"
EndIf
Else
If dist# < 0.7
n\CurrSpeed = 0.0
If n\CurrElevator\door\NPCCalledElevator=False
n\CurrElevator\door\NPCCalledElevator = True
DebugLog n\NPCtype+" called elevator"
EndIf
EndIf
EndIf
EndIf
End Function
Function FinishWalking(n.NPCs,startframe#,endframe#,speed#)
Local centerframe#
If n<>Null
centerframe# = (endframe#-startframe#)/2
If n\Frame >= centerframe#
AnimateNPC(n,startframe#,endframe#,speed#,False)
Else
AnimateNPC(n,endframe#,startframe#,-speed#,False)
EndIf
EndIf
End Function
Function ChangeNPCTextureID(n.NPCs,textureid%)
If (n=Null) Then
CreateConsoleMsg("Tried to change the texture of an invalid NPC")
If ConsoleOpening Then
ConsoleOpen = True
EndIf
Return
EndIf
n\TextureID = textureid%+1
FreeEntity n\obj
n\obj = CopyEntity(DTextures[textureid%+1])
temp# = 0.5 / MeshWidth(n\obj)
ScaleEntity n\obj, temp, temp, temp
MeshCullBox (n\obj, -MeshWidth(ClassDObj), -MeshHeight(ClassDObj), -MeshDepth(ClassDObj), MeshWidth(ClassDObj)*2, MeshHeight(ClassDObj)*2, MeshDepth(ClassDObj)*2)
SetNPCFrame(n,n\Frame)
End Function
;~IDEal Editor Parameters:
;~F#0#A#4F#6B#85#95#C5#D5#DE#EC#FB#10F#12F#159#16D#18A#1CB#1E2#203#226
;~F#230#248#25C#27C#2AC#3A0#49B#5FE#803#89E#9FB#A00#A37#AD9#B15#BA8#C14#D28#DF7#EAE
;~F#F61#107F#1088#1248#126F#127A#12A2#12B5#12B6#1313#1472#15BE#1640#169F#171F#174F#1775#178E#180E#18BC
;~F#1946#1957#1971#1982#198C#19AD#1A18#1A99#1AB2#1ACB#1AD9#1AF5#1B07#1B2B#1B4E#1B5C
;~B#197#12A9#1343#13DC#1590#169B#185C#18B8
;~C#Blitz3D
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化