mission08.cpp 172 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * Mission08.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 8 specific scripts
  25. *
  26. * PROGRAMMER
  27. * David Shuman
  28. *
  29. * VERSION INFO
  30. * $Author: Byon_g $
  31. * $Revision: 64 $
  32. * $Modtime: 2/08/02 3:20p $
  33. * $Archive: /Commando/Code/Scripts/mission08.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission8.h"
  39. #include <string.h>
  40. #include <stdio.h>
  41. // Objective Controller
  42. DECLARE_SCRIPT(M08_Objective_Controller, "") // 100002
  43. {
  44. enum {HAVOCS_SCRIPT};
  45. // Register variables to be Auto-Saved
  46. // All variables must have a unique ID, less than 256, that never changes
  47. REGISTER_VARIABLES()
  48. {
  49. }
  50. void Created(GameObject * obj)
  51. {
  52. // Background Music
  53. Commands->Set_Background_Music ("08-Sniper.mp3");
  54. Commands->Start_Timer (obj, this, 1.0f, HAVOCS_SCRIPT);
  55. Commands->Enable_Hibernation(obj, false);
  56. Add_An_Objective(801);
  57. Add_An_Objective(808);
  58. Add_An_Objective(809);
  59. }
  60. void Add_An_Objective(int id)
  61. {
  62. GameObject *object;
  63. switch (id)
  64. {
  65. // Escape Prison
  66. case 801:
  67. {
  68. Commands->Add_Objective(801, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M08_01, NULL, IDS_Enc_Obj_Primary_M08_01);
  69. object = Commands->Find_Object(108360);
  70. if(object)
  71. {
  72. Commands->Set_Objective_Radar_Blip_Object(801, object);
  73. Commands->Set_Objective_HUD_Info_Position(801, 90.0f, "POG_M08_1_02.tga", IDS_POG_ESCAPE, Commands->Get_Position (object));
  74. }
  75. }
  76. break;
  77. // Infiltrate Research Facility
  78. case 802:
  79. {
  80. Commands->Add_Objective(802, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M08_02, NULL, IDS_Enc_Obj_Primary_M08_02);
  81. object = Commands->Find_Object(108361);
  82. if(object)
  83. {
  84. Commands->Set_Objective_Radar_Blip_Object(802, object);
  85. Commands->Set_Objective_HUD_Info_Position(802, 90.0f, "POG_M08_1_03.tga", IDS_POG_INFILTRATE, Commands->Get_Position (object));
  86. }
  87. }
  88. break;
  89. // Rescue Scientists
  90. case 803:
  91. {
  92. Commands->Add_Objective(803, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M08_03, NULL, IDS_Enc_Obj_Primary_M08_03);
  93. // Now that Havoc is out of the prison area you must remove lock level 10 so that he cannot open the mutant pens
  94. Commands->Grant_Key (STAR, 10, false);
  95. object = Commands->Find_Object(108818);
  96. if(object)
  97. {
  98. Commands->Set_Objective_Radar_Blip_Object(803, object);
  99. Commands->Set_Objective_HUD_Info_Position(803, 90.0f, "POG_M08_1_04.tga", IDS_POG_RESCUE, Commands->Get_Position (object));
  100. }
  101. }
  102. break;
  103. // Destroy Helipad
  104. case 804:
  105. {
  106. Commands->Add_Objective(804, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M08_01, NULL, IDS_Enc_Obj_Secondary_M08_05);
  107. object = Commands->Find_Object(106339);
  108. if(object)
  109. {
  110. Commands->Set_Objective_Radar_Blip_Object(804, object);
  111. Commands->Set_Objective_HUD_Info_Position(804, 90.0f, "POG_M08_2_01.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  112. }
  113. }
  114. break;
  115. // Eliminate Raveshaw
  116. case 805:
  117. {
  118. Commands->Add_Objective(805, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M08_04, NULL, IDS_Enc_Obj_Primary_M08_04);
  119. Commands->Set_Objective_HUD_Info(805, 90.0f, "POG_M08_1_01.tga", IDS_POG_ELIMINATE);
  120. }
  121. break;
  122. // Disable Research Station Alpha
  123. case 806:
  124. {
  125. Commands->Add_Objective(806, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M08_02, NULL, IDS_Enc_Obj_Secondary_M08_06);
  126. object = Commands->Find_Object(100016);
  127. if(object)
  128. {
  129. Commands->Set_Objective_Radar_Blip_Object(806, object);
  130. Commands->Set_Objective_HUD_Info_Position(806, 90.0f, "POG_M08_2_02.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
  131. }
  132. }
  133. break;
  134. // Disable Research Station Beta
  135. case 807:
  136. {
  137. Commands->Add_Objective(807, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M08_03, NULL, IDS_Enc_Obj_Secondary_M08_07);
  138. object = Commands->Find_Object(100017);
  139. if(object)
  140. {
  141. Commands->Set_Objective_Radar_Blip_Object(807, object);
  142. Commands->Set_Objective_HUD_Info_Position(807, 90.0f, "POG_M08_2_03.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
  143. }
  144. }
  145. break;
  146. // Disable excavation mechanisms at archaeological dig
  147. case 808:
  148. {
  149. Commands->Add_Objective(808, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M08_01, NULL, IDS_Enc_Obj_Hidden_M08_01);
  150. }
  151. break;
  152. // Destroy Tiberium cultivation center
  153. case 809:
  154. {
  155. Commands->Add_Objective(809, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M08_02, NULL, IDS_Enc_Obj_Hidden_M08_02);
  156. }
  157. break;
  158. }
  159. }
  160. void Remove_Pog(int id)
  161. {
  162. switch (id)
  163. {
  164. // Escape from Nod Prison Facility
  165. case 801:
  166. {
  167. Commands->Set_Objective_HUD_Info(801, -1, "POG_M08_1_02.tga", IDS_POG_ESCAPE);
  168. }
  169. break;
  170. // Infiltrate Research Facility
  171. case 802:
  172. {
  173. Commands->Set_Objective_HUD_Info(802, -1, "POG_M08_1_03.tga", IDS_POG_INFILTRATE);
  174. }
  175. break;
  176. // Find and rescue kidnapped scientists
  177. case 803:
  178. {
  179. Commands->Set_Objective_HUD_Info(803, -1, "POG_M08_1_04.tga", IDS_POG_RESCUE);
  180. }
  181. break;
  182. // Destroy Nod Helipad
  183. case 804:
  184. {
  185. Commands->Set_Objective_HUD_Info(804, -1, "POG_M08_2_01.tga", IDS_POG_DESTROY);
  186. }
  187. break;
  188. // Destroy Mutated Raveshaw
  189. case 805:
  190. {
  191. Commands->Set_Objective_HUD_Info(806, -1, "POG_M08_1_02.tga", IDS_POG_DISABLE);
  192. }
  193. break;
  194. // Disable Research Station Alpha
  195. case 806:
  196. {
  197. Commands->Set_Objective_HUD_Info(801, -1, "POG_M08_1_02.tga", IDS_POG_ESCAPE);
  198. }
  199. break;
  200. // Disable Research Station Beta
  201. case 807:
  202. {
  203. Commands->Set_Objective_HUD_Info(807, -1, "POG_M08_1_03.tga", IDS_POG_DISABLE);
  204. }
  205. break;
  206. }
  207. }
  208. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  209. {
  210. switch (param)
  211. {
  212. case 1:
  213. {
  214. Commands->Clear_Radar_Marker (type);
  215. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  216. Remove_Pog(type);
  217. if(type == 805)
  218. {
  219. Commands->Mission_Complete ( true );
  220. }
  221. }
  222. break;
  223. case 2:
  224. {
  225. Commands->Clear_Radar_Marker (type);
  226. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  227. Remove_Pog(type);
  228. }
  229. break;
  230. case 3:
  231. Add_An_Objective(type);
  232. break;
  233. case 4:
  234. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  235. break;
  236. case 5:
  237. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_HIDDEN);
  238. break;
  239. }
  240. if(type == 666 && param == 666)
  241. {
  242. Commands->Start_Timer (obj, this, 2.0f, M08_DEAD_HAVOC);
  243. }
  244. // Relocate Havoc
  245. if(type == M08_RELOCATE)
  246. {
  247. // Accomplish rescue the scientists mission
  248. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 803, 1, 1.0f);
  249. // Relocate Havoc
  250. Commands->Send_Custom_Event(obj, STAR, M08_RELOCATE, 0, 0.0f);
  251. // Turn Havoc off of immortal
  252. Commands->Send_Custom_Event(obj, STAR, M08_STAR_IMMORTAL, 0, 0.0f);
  253. }
  254. }
  255. };
  256. //Grants initial weapons
  257. DECLARE_SCRIPT(M08_Havoc_DLS, "")
  258. {
  259. // Register variables to be Auto-Saved
  260. // All variables must have a unique ID, less than 256, that never changes
  261. REGISTER_VARIABLES()
  262. {
  263. }
  264. void Created(GameObject * obj)
  265. {
  266. // Remove all of Havocs starting weapons except for the pistol
  267. Commands->Clear_Weapons(STAR);
  268. Commands->Give_PowerUp(obj, "POW_Pistol_Player");
  269. Commands->Grant_Key (obj, 10, true);
  270. Commands->Set_Shield_Strength(obj, 0.0f);
  271. // Reveal GDI Power Suit
  272. Commands->Reveal_Encyclopedia_Vehicle(16);
  273. }
  274. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  275. {
  276. if(type == M08_RELOCATE)
  277. {
  278. Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108819)));
  279. // Mission objective to destroy raveshaw
  280. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 805, 3, 2.0f);
  281. //
  282. // Play the boss music
  283. //
  284. Commands->Set_Background_Music ("Raveshaw_Act on Instinct.mp3");
  285. //
  286. // Create the Raveshaw Boss character
  287. //
  288. GameObject *raveshaw = Commands->Create_Object ("Raveshaw", Vector3 (-127.209F, 484.503F, -189.532F));
  289. if (raveshaw != NULL) {
  290. Commands->Set_Facing (raveshaw, 0.0F);
  291. }
  292. }
  293. }
  294. void Destroyed(GameObject * obj)
  295. {
  296. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 666, 666, 0.0f);
  297. }
  298. };
  299. DECLARE_SCRIPT(M08_Activate_Objective_802, "")
  300. {
  301. bool already_entered;
  302. // Register variables to be Auto-Saved
  303. // All variables must have a unique ID, less than 256, that never changes
  304. REGISTER_VARIABLES()
  305. {
  306. SAVE_VARIABLE( already_entered, 1 );
  307. }
  308. void Created (GameObject * obj)
  309. {
  310. already_entered = false;
  311. }
  312. void Entered (GameObject * obj, GameObject * enterer)
  313. {
  314. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  315. {
  316. already_entered = true;
  317. // Nick, Those scientists you've been digging for are being held in a Nod Research Facility at the far end of the canyon. Figure'd you might want to know.\n
  318. const char *conv_name = ("M08_CON001");
  319. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  320. Commands->Join_Conversation(NULL, conv_id, false, true);
  321. Commands->Join_Conversation(STAR, conv_id, false, true);
  322. Commands->Start_Conversation (conv_id, 300502);
  323. Commands->Monitor_Conversation (obj, conv_id);
  324. }
  325. }
  326. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  327. {
  328. ActionParamsStruct params;
  329. if(type == 100 && param == 100)
  330. {
  331. already_entered = true;
  332. }
  333. }
  334. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  335. {
  336. ActionParamsStruct params;
  337. if(action_id == 300502 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  338. {
  339. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 802, 3, 0.0f);
  340. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 801, 1, 3.0f);
  341. }
  342. }
  343. };
  344. DECLARE_SCRIPT(M08_Activate_Objective_803, "")
  345. {
  346. bool already_entered;
  347. // Register variables to be Auto-Saved
  348. // All variables must have a unique ID, less than 256, that never changes
  349. REGISTER_VARIABLES()
  350. {
  351. SAVE_VARIABLE( already_entered, 1 );
  352. }
  353. void Created (GameObject * obj)
  354. {
  355. already_entered = false;
  356. }
  357. void Entered (GameObject * obj, GameObject * enterer)
  358. {
  359. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  360. {
  361. already_entered = true;
  362. // Nick, we're going to lose contact when you head inside, there's no radio communication possible due to jamming signals.\n
  363. const char *conv_name = ("M08_CON002");
  364. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  365. Commands->Join_Conversation(NULL, conv_id, false, true);
  366. Commands->Join_Conversation(STAR, conv_id, false, true);
  367. Commands->Start_Conversation (conv_id, 300803);
  368. Commands->Monitor_Conversation (obj, conv_id);
  369. Commands->Send_Custom_Event(obj, Commands->Find_Object(100008), 100, 100, 0.0f);
  370. Commands->Send_Custom_Event(obj, Commands->Find_Object(100009), 100, 100, 0.0f);
  371. }
  372. }
  373. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  374. {
  375. ActionParamsStruct params;
  376. if(type == 100 && param == 100)
  377. {
  378. already_entered = true;
  379. }
  380. }
  381. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  382. {
  383. ActionParamsStruct params;
  384. if(action_id == 300803 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  385. {
  386. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 803, 3, 0.0f);
  387. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 802, 1, 3.0f);
  388. }
  389. }
  390. };
  391. DECLARE_SCRIPT(M08_Activate_Objective_804, "")
  392. {
  393. bool already_entered;
  394. // Register variables to be Auto-Saved
  395. // All variables must have a unique ID, less than 256, that never changes
  396. REGISTER_VARIABLES()
  397. {
  398. SAVE_VARIABLE( already_entered, 1 );
  399. }
  400. void Created (GameObject * obj)
  401. {
  402. already_entered = false;
  403. }
  404. void Entered (GameObject * obj, GameObject * enterer)
  405. {
  406. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  407. {
  408. already_entered = true;
  409. // Don't know if you care, hon, but there's a Nod Helipad in back of the Prison Facility. Might help if you blow it up.\n
  410. const char *conv_name = ("M08_CON003");
  411. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  412. Commands->Join_Conversation(NULL, conv_id, false, true);
  413. Commands->Join_Conversation(STAR, conv_id, false, true);
  414. Commands->Start_Conversation (conv_id, 300804);
  415. Commands->Monitor_Conversation (obj, conv_id);
  416. // Disable all activate_804 zones
  417. Commands->Send_Custom_Event(obj, Commands->Find_Object(100003), 100, 100, 0.0f);
  418. Commands->Send_Custom_Event(obj, Commands->Find_Object(100004), 100, 100, 0.0f);
  419. }
  420. }
  421. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  422. {
  423. ActionParamsStruct params;
  424. if(type == 100 && param == 100)
  425. {
  426. already_entered = true;
  427. }
  428. }
  429. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  430. {
  431. ActionParamsStruct params;
  432. if(action_id == 300804 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  433. {
  434. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 804, 3, 0.0f);
  435. }
  436. }
  437. };
  438. DECLARE_SCRIPT(M08_Activate_Objective_806, "")
  439. {
  440. bool already_entered;
  441. // Register variables to be Auto-Saved
  442. // All variables must have a unique ID, less than 256, that never changes
  443. REGISTER_VARIABLES()
  444. {
  445. SAVE_VARIABLE( already_entered, 1 );
  446. }
  447. void Created (GameObject * obj)
  448. {
  449. already_entered = false;
  450. }
  451. void Entered (GameObject * obj, GameObject * enterer)
  452. {
  453. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  454. {
  455. already_entered = true;
  456. // Disable Research Station Alpha.\n
  457. const char *conv_name = ("M08_CON004");
  458. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  459. Commands->Join_Conversation(STAR, conv_id, false, true);
  460. Commands->Start_Conversation (conv_id, 300806);
  461. Commands->Monitor_Conversation (obj, conv_id);
  462. }
  463. }
  464. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  465. {
  466. ActionParamsStruct params;
  467. if(action_id == 300806 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  468. {
  469. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 806, 3, 0.0f);
  470. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 807, 3, 2.0f);
  471. }
  472. }
  473. };
  474. DECLARE_SCRIPT(M08_Helipad, "")
  475. {
  476. // Register variables to be Auto-Saved
  477. // All variables must have a unique ID, less than 256, that never changes
  478. REGISTER_VARIABLES()
  479. {
  480. }
  481. void Created(GameObject * obj)
  482. {
  483. }
  484. void Killed (GameObject * obj, GameObject * killer)
  485. {
  486. Commands->Create_Logical_Sound(obj, M08_HELIPAD_DESTROYED, Vector3 (0,0,0), 2500.0f);
  487. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 804, 1, 0.0f);
  488. // Spawn armed prisoner for helipad area
  489. Commands->Enable_Spawner(100168, true);
  490. // Disable Apache Spawner
  491. Commands->Enable_Spawner(100311, false);
  492. }
  493. };
  494. DECLARE_SCRIPT(M08_Raveshaw, "")
  495. {
  496. // Register variables to be Auto-Saved
  497. // All variables must have a unique ID, less than 256, that never changes
  498. REGISTER_VARIABLES()
  499. {
  500. }
  501. void Created(GameObject * obj)
  502. {
  503. }
  504. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  505. {
  506. if(type == M08_RELOCATE)
  507. {
  508. Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108818)));
  509. // Accomplish rescue the scientists mission
  510. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 803, 1, 1.0f);
  511. // Relocate Havoc
  512. Commands->Send_Custom_Event(obj, STAR, M08_RELOCATE, 0, 0.0f);
  513. }
  514. }
  515. void Killed (GameObject * obj, GameObject * killer)
  516. {
  517. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 805, 1, 0.0f);
  518. }
  519. };
  520. DECLARE_SCRIPT(M08_Prison_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  521. {
  522. int waypath_id;
  523. Vector3 waypath_loc;
  524. bool enemy_seen;
  525. enum {WAYPATH, GO_WAYPATH, GO_STAR};
  526. // Register variables to be Auto-Saved
  527. // All variables must have a unique ID, less than 256, that never changes
  528. REGISTER_VARIABLES()
  529. {
  530. // SAVE_VARIABLE( waypath_id, 1 );
  531. // SAVE_VARIABLE( waypath_loc, 2 );
  532. SAVE_VARIABLE( enemy_seen, 3 );
  533. }
  534. void Created (GameObject * obj)
  535. {
  536. // No starting units can hear footsteps until otherwise alerted
  537. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  538. enemy_seen = false;
  539. waypath_id = Get_Int_Parameter("Waypath_ID");
  540. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  541. Commands->Set_Innate_Soldier_Home_Location(obj, waypath_loc, 4.0f);
  542. ActionParamsStruct params;
  543. if(waypath_id == 0)
  544. {
  545. Commands->Set_Innate_Is_Stationary(obj, true);
  546. }
  547. else if(waypath_id == 1)
  548. {
  549. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  550. params.Set_Movement( STAR, RUN, 1.5f );
  551. Commands->Action_Goto( obj, params );
  552. }
  553. else
  554. {
  555. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, GO_WAYPATH );
  556. params.Set_Movement( waypath_loc, RUN, 1.5f );
  557. Commands->Action_Goto( obj, params );
  558. }
  559. }
  560. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  561. {
  562. ActionParamsStruct params;
  563. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  564. {
  565. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, WAYPATH );
  566. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  567. params.WaypathID = waypath_id;
  568. Commands->Action_Goto( obj, params );
  569. }
  570. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  571. {
  572. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  573. }
  574. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  575. {
  576. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  577. }
  578. if(action_id == GO_STAR && reason == ACTION_COMPLETE_LOW_PRIORITY)
  579. {
  580. Commands->Start_Timer(obj, this, 60.0f, GO_STAR);
  581. }
  582. }
  583. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  584. {
  585. if((Commands->Is_A_Star(enemy)) && (!enemy_seen))
  586. {
  587. enemy_seen = true;
  588. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  589. }
  590. }
  591. void Timer_Expired(GameObject * obj, int timer_id )
  592. {
  593. ActionParamsStruct params;
  594. if(timer_id == WAYPATH)
  595. {
  596. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, GO_WAYPATH );
  597. params.Set_Movement( waypath_loc, RUN, 1.5f );
  598. Commands->Action_Goto( obj, params );
  599. }
  600. if(timer_id == GO_STAR)
  601. {
  602. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  603. params.Set_Movement( STAR, RUN, 1.5f );
  604. Commands->Action_Goto( obj, params );
  605. }
  606. }
  607. };
  608. DECLARE_SCRIPT(M08_Initial_Prisoner, "Reinforcment_ID=0:int")
  609. {
  610. bool enemy_seen;
  611. int enemy_id;
  612. enum{GO_ENEMY, PUNCH_ENEMY};
  613. // Register variables to be Auto-Saved
  614. // All variables must have a unique ID, less than 256, that never changes
  615. REGISTER_VARIABLES()
  616. {
  617. SAVE_VARIABLE( enemy_seen, 1 );
  618. SAVE_VARIABLE( enemy_id, 2 );
  619. }
  620. void Created(GameObject * obj)
  621. {
  622. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  623. enemy_seen = false;
  624. enemy_id = 0;
  625. }
  626. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  627. {
  628. ActionParamsStruct params;
  629. if(!enemy_seen)
  630. {
  631. enemy_seen = true;
  632. enemy_id = Commands->Get_ID(enemy);
  633. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_ENEMY );
  634. params.Set_Movement( enemy, RUN, 0.5f );
  635. Commands->Action_Goto( obj, params );
  636. Commands->Send_Custom_Event(obj, Commands->Find_Object(enemy_id), M08_DONT_MOVE, 1, 0.0f);
  637. }
  638. }
  639. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  640. {
  641. ActionParamsStruct params;
  642. if(type == M08_NOD_ATTACKEE_KILLED)
  643. {
  644. enemy_seen = false;
  645. }
  646. }
  647. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  648. {
  649. if ( sound.Type == M08_FREE_PRISONER )
  650. {
  651. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  652. Commands->Grant_Key (obj, 1, true);
  653. }
  654. }
  655. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  656. {
  657. ActionParamsStruct params;
  658. if((action_id == GO_ENEMY) && (reason == ACTION_COMPLETE_NORMAL) && (enemy_seen))
  659. {
  660. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, PUNCH_ENEMY);
  661. params.Set_Animation("S_A_HUMAN.H_A_J26C", false);
  662. Commands->Action_Play_Animation(obj, params);
  663. }
  664. if((action_id == PUNCH_ENEMY) && (reason == ACTION_COMPLETE_NORMAL))
  665. {
  666. Commands->Apply_Damage( Commands->Find_Object(enemy_id), 10000.0f, "STEEL");
  667. Commands->Give_PowerUp(obj, "MG Weapon 1 Clip PowerUp");
  668. Commands->Give_PowerUp(obj, "MiniGun 2 Clips PU");
  669. }
  670. }
  671. void Killed (GameObject * obj, GameObject * killer)
  672. {
  673. if(!enemy_seen)
  674. {
  675. Commands->Send_Custom_Event(obj, Commands->Find_Object(enemy_id), M08_PRISONER_ATTACKER_KILLED, 1, 0.0f);
  676. }
  677. int reinforcement_spawner_id = Get_Int_Parameter("Reinforcment_ID");
  678. Commands->Enable_Spawner(reinforcement_spawner_id, true);
  679. }
  680. };
  681. DECLARE_SCRIPT(M08_Reinforcement_Prisoner, "")
  682. {
  683. // Register variables to be Auto-Saved
  684. // All variables must have a unique ID, less than 256, that never changes
  685. REGISTER_VARIABLES()
  686. {
  687. // SAVE_VARIABLE( enemy_seen, 1 );
  688. }
  689. void Created(GameObject * obj)
  690. {
  691. }
  692. void Killed (GameObject * obj, GameObject * killer)
  693. {
  694. }
  695. };
  696. DECLARE_SCRIPT(M08_Nod_Prison_Unit, "")
  697. {
  698. int prisoner_attack_id;
  699. // Register variables to be Auto-Saved
  700. // All variables must have a unique ID, less than 256, that never changes
  701. REGISTER_VARIABLES()
  702. {
  703. SAVE_VARIABLE( prisoner_attack_id, 1 );
  704. }
  705. void Created(GameObject * obj)
  706. {
  707. prisoner_attack_id = 0;
  708. }
  709. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  710. {
  711. ActionParamsStruct params;
  712. if(type == M08_DONT_MOVE)
  713. {
  714. prisoner_attack_id = Commands->Get_ID(sender);
  715. Commands->Set_Innate_Is_Stationary(obj, true);
  716. }
  717. if(type == M08_PRISONER_ATTACKER_KILLED)
  718. {
  719. Commands->Set_Innate_Is_Stationary(obj, true);
  720. }
  721. }
  722. void Killed (GameObject * obj, GameObject * killer)
  723. {
  724. Commands->Send_Custom_Event(obj, Commands->Find_Object(prisoner_attack_id), M08_NOD_ATTACKEE_KILLED, 1, 0.0f);
  725. }
  726. };
  727. DECLARE_SCRIPT(M08_Cell_Controller, "")
  728. {
  729. bool poked;
  730. // Register variables to be Auto-Saved
  731. // All variables must have a unique ID, less than 256, that never changes
  732. REGISTER_VARIABLES()
  733. {
  734. SAVE_VARIABLE( poked, 1 );
  735. }
  736. void Created(GameObject * obj)
  737. {
  738. Commands->Debug_Message("Initialize Cell 1 Controller");
  739. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  740. poked = false;
  741. }
  742. void Poked(GameObject * obj, GameObject * poker)
  743. {
  744. if (Commands->Is_A_Star(poker) && !poked)
  745. {
  746. poked = true;
  747. Commands->Create_Sound ( "SFX.Ambient_Jail_Cell_Release", Vector3 (0,0,0), obj);
  748. Commands->Grant_Key (STAR, 1, true);
  749. Commands->Send_Custom_Event(obj, Commands->Find_Object(100710), M08_FREE_PRISONER, 1, 0.0f);
  750. Commands->Send_Custom_Event(obj, Commands->Find_Object(100713), M08_FREE_PRISONER, 1, 0.0f);
  751. Commands->Send_Custom_Event(obj, Commands->Find_Object(100714), M08_FREE_PRISONER, 1, 0.0f);
  752. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  753. Commands->Destroy_Object(Commands->Find_Object(109282));
  754. Commands->Destroy_Object(Commands->Find_Object(109283));
  755. Commands->Destroy_Object(Commands->Find_Object(109273));
  756. }
  757. }
  758. };
  759. DECLARE_SCRIPT(M08_Prison_Storage_Guard, "")
  760. {
  761. // Register variables to be Auto-Saved
  762. // All variables must have a unique ID, less than 256, that never changes
  763. REGISTER_VARIABLES()
  764. {
  765. // SAVE_VARIABLE( enemy_seen, 1 );
  766. }
  767. void Created(GameObject * obj)
  768. {
  769. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  770. }
  771. void Killed (GameObject * obj, GameObject * killer)
  772. {
  773. Vector3 create_position = Commands->Get_Position( obj );
  774. Commands->Create_Object( "Level_02_Keycard", create_position );
  775. }
  776. };
  777. DECLARE_SCRIPT(M08_Sniper, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  778. {
  779. int waypath_id;
  780. Vector3 waypath_loc;
  781. enum{GO_WAYPATH, WAYPATH};
  782. // Register variables to be Auto-Saved
  783. // All variables must have a unique ID, less than 256, that never changes
  784. REGISTER_VARIABLES()
  785. {
  786. // SAVE_VARIABLE( waypath_id, 1 );
  787. // SAVE_VARIABLE( waypath_loc, 2 );
  788. }
  789. void Created(GameObject * obj)
  790. {
  791. waypath_id = Get_Int_Parameter("Waypath_ID");
  792. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  793. ActionParamsStruct params;
  794. if(waypath_id != 0)
  795. {
  796. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_WAYPATH );
  797. params.Set_Movement( waypath_loc, RUN, 1.5f );
  798. Commands->Action_Goto( obj, params );
  799. }
  800. else
  801. {
  802. Commands->Set_Innate_Is_Stationary(obj, true);
  803. }
  804. }
  805. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  806. {
  807. ActionParamsStruct params;
  808. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  809. {
  810. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  811. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  812. params.WaypathID = waypath_id;
  813. Commands->Action_Goto( obj, params );
  814. }
  815. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  816. {
  817. Commands->Set_Innate_Is_Stationary(obj, true);
  818. }
  819. }
  820. };
  821. DECLARE_SCRIPT(M08_Nod_Gun_Emplacement, "")
  822. {
  823. bool attacking;
  824. enum{ATTACK_OVER};
  825. // Register variables to be Auto-Saved
  826. // All variables must have a unique ID, less than 256, that never changes
  827. REGISTER_VARIABLES()
  828. {
  829. SAVE_VARIABLE( attacking, 1 );
  830. }
  831. void Created (GameObject * obj)
  832. {
  833. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  834. Commands->Enable_Enemy_Seen( obj, true);
  835. attacking = false;
  836. }
  837. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  838. {
  839. ActionParamsStruct params;
  840. if(!attacking)
  841. {
  842. attacking = true;
  843. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  844. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  845. params.AttackCheckBlocked = false;
  846. Commands->Action_Attack( obj, params );
  847. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  848. }
  849. }
  850. void Damaged( GameObject * obj, GameObject * damager, float amount )
  851. {
  852. ActionParamsStruct params;
  853. if(!attacking)
  854. {
  855. attacking = true;
  856. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  857. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  858. params.AttackCheckBlocked = false;
  859. Commands->Action_Attack( obj, params );
  860. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  861. }
  862. }
  863. void Timer_Expired (GameObject* obj, int timer_id)
  864. {
  865. ActionParamsStruct params;
  866. if(timer_id == ATTACK_OVER)
  867. {
  868. attacking = false;
  869. }
  870. }
  871. };
  872. DECLARE_SCRIPT(M08_Nod_Turret, "")
  873. {
  874. bool attacking;
  875. enum{ATTACK_OVER};
  876. // Register variables to be Auto-Saved
  877. // All variables must have a unique ID, less than 256, that never changes
  878. REGISTER_VARIABLES()
  879. {
  880. SAVE_VARIABLE( attacking, 1 );
  881. }
  882. void Created (GameObject * obj)
  883. {
  884. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  885. Commands->Enable_Enemy_Seen( obj, true);
  886. attacking = false;
  887. }
  888. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  889. {
  890. ActionParamsStruct params;
  891. if(!attacking)
  892. {
  893. attacking = true;
  894. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  895. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  896. params.AttackCheckBlocked = false;
  897. Commands->Action_Attack( obj, params );
  898. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  899. }
  900. }
  901. void Damaged( GameObject * obj, GameObject * damager, float amount )
  902. {
  903. ActionParamsStruct params;
  904. if(!attacking)
  905. {
  906. if (Commands->Get_Player_Type (damager) != SCRIPT_PLAYERTYPE_NOD)
  907. {
  908. attacking = true;
  909. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  910. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  911. params.AttackCheckBlocked = false;
  912. Commands->Action_Attack( obj, params );
  913. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  914. }
  915. }
  916. }
  917. void Timer_Expired (GameObject* obj, int timer_id)
  918. {
  919. ActionParamsStruct params;
  920. if(timer_id == ATTACK_OVER)
  921. {
  922. attacking = false;
  923. }
  924. }
  925. };
  926. DECLARE_SCRIPT(M08_Prison_Apache, "")
  927. {
  928. bool enemy_seen;
  929. bool flee;
  930. enum{WAYPATH, NEW_CLOSEST, FLEE, INITIAL};
  931. // Register variables to be Auto-Saved
  932. // All variables must have a unique ID, less than 256, that never changes
  933. REGISTER_VARIABLES()
  934. {
  935. SAVE_VARIABLE( enemy_seen, 1 );
  936. SAVE_VARIABLE( flee, 2 );
  937. }
  938. void Created(GameObject * obj)
  939. {
  940. Commands->Enable_Enemy_Seen( obj, true);
  941. enemy_seen = false;
  942. flee = false;
  943. ActionParamsStruct params;
  944. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INITIAL );
  945. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  946. params.WaypathID = 100322;
  947. Commands->Action_Goto( obj, params );
  948. }
  949. int Closest_Waypath ()
  950. {
  951. Vector3 star_pos = Commands->Get_Position(STAR);
  952. Vector3 waypath1 = Vector3(-96.702f, 43.992f, 24.948f);
  953. Vector3 waypath2 = Vector3(-41.471f, 127.891f, 26.705f);
  954. Vector3 waypath3 = Vector3(4.254f, 77.652f, 14.441f);
  955. float dist_waypath1 = Commands->Get_Distance(star_pos, waypath1);
  956. float dist_waypath2 = Commands->Get_Distance(star_pos, waypath2);
  957. float dist_waypath3 = Commands->Get_Distance(star_pos, waypath3);
  958. float least_dist = WWMath::Min(WWMath::Min(dist_waypath1, dist_waypath2), dist_waypath3);
  959. if(least_dist == dist_waypath1)
  960. {
  961. return 100273;
  962. }
  963. else if (least_dist == dist_waypath2)
  964. {
  965. return 100287;
  966. }
  967. else
  968. {
  969. return 100297;
  970. }
  971. }
  972. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  973. {
  974. ActionParamsStruct params;
  975. if(!enemy_seen)
  976. {
  977. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  978. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  979. params.Set_Attack (enemy, 150.0f, 0.0f, 1);
  980. params.WaypathID = Closest_Waypath();
  981. Commands->Modify_Action (obj, WAYPATH, params);
  982. }
  983. }
  984. void Timer_Expired(GameObject * obj, int timer_id )
  985. {
  986. ActionParamsStruct params;
  987. if(timer_id == NEW_CLOSEST && !flee)
  988. {
  989. Commands->Start_Timer (obj, this, 30.0f, NEW_CLOSEST);
  990. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  991. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  992. params.WaypathID = Closest_Waypath();
  993. Commands->Action_Attack( obj, params );
  994. }
  995. }
  996. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  997. {
  998. ActionParamsStruct params;
  999. if(action_id == FLEE)
  1000. {
  1001. Commands->Destroy_Object(obj);
  1002. }
  1003. if(action_id == INITIAL)
  1004. {
  1005. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1006. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1007. params.WaypathID = Closest_Waypath();
  1008. Commands->Action_Attack( obj, params );
  1009. Commands->Start_Timer (obj, this, 30.0f, NEW_CLOSEST);
  1010. }
  1011. }
  1012. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1013. {
  1014. ActionParamsStruct params;
  1015. if ( sound.Type == M08_HELIPAD_DESTROYED )
  1016. {
  1017. flee = true;
  1018. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, FLEE );
  1019. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1020. params.WaypathID = 100333;
  1021. Commands->Action_Goto( obj, params );
  1022. }
  1023. }
  1024. };
  1025. DECLARE_SCRIPT(M08_GDI_Free_Prison, "Soldier_ID=0:int")
  1026. {
  1027. // Register variables to be Auto-Saved
  1028. // All variables must have a unique ID, less than 256, that never changes
  1029. REGISTER_VARIABLES()
  1030. {
  1031. // SAVE_VARIABLE( soldier_id, 1 );
  1032. }
  1033. void Killed (GameObject * obj, GameObject * killer)
  1034. {
  1035. int soldier_id = Get_Int_Parameter("Soldier_ID");
  1036. Commands->Send_Custom_Event(obj, Commands->Find_Object(100246), M08_GDI_FREE_PRISON_KILLED, soldier_id, 0.0f);
  1037. }
  1038. };
  1039. DECLARE_SCRIPT(M08_Prison_Controller, "") //100246
  1040. {
  1041. int gdi1;
  1042. int gdi2;
  1043. // Register variables to be Auto-Saved
  1044. // All variables must have a unique ID, less than 256, that never changes
  1045. REGISTER_VARIABLES()
  1046. {
  1047. SAVE_VARIABLE( gdi1, 1 );
  1048. SAVE_VARIABLE( gdi2, 2 );
  1049. }
  1050. void Created(GameObject * obj)
  1051. {
  1052. gdi1 = 0;
  1053. gdi2 = 0;
  1054. }
  1055. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1056. {
  1057. ActionParamsStruct params;
  1058. if(type == M08_GDI_FREE_PRISON_KILLED)
  1059. {
  1060. switch(param)
  1061. {
  1062. case 1:
  1063. {
  1064. gdi1++;
  1065. if(gdi1%2 == 0)
  1066. {
  1067. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-13.121f, 57.855f, -0.091f));
  1068. Commands->Set_Facing(controller, 90.000f);
  1069. Commands->Attach_Script(controller, "Test_Cinematic", "X8D_CHTroopdrop1.txt");
  1070. }
  1071. }
  1072. break;
  1073. case 2:
  1074. {
  1075. gdi2++;
  1076. if(gdi2%2 == 0)
  1077. {
  1078. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-43.266f, 110.230f, -0.238f));
  1079. Commands->Set_Facing(controller, 90.000f);
  1080. Commands->Attach_Script(controller, "Test_Cinematic", "X8D_CHTroopdrop2.txt");
  1081. }
  1082. }
  1083. break;
  1084. }
  1085. }
  1086. }
  1087. };
  1088. DECLARE_SCRIPT(M08_APC_Soldier, "APC_ID=0:int")
  1089. {
  1090. int apc_id;
  1091. // Register variables to be Auto-Saved
  1092. // All variables must have a unique ID, less than 256, that never changes
  1093. REGISTER_VARIABLES()
  1094. {
  1095. // SAVE_VARIABLE( apc_id, 1 );
  1096. }
  1097. void Created (GameObject * obj)
  1098. {
  1099. apc_id = Get_Int_Parameter("APC_ID");
  1100. }
  1101. void Killed (GameObject * obj, GameObject * killer)
  1102. {
  1103. if(Commands->Find_Object(apc_id))
  1104. {
  1105. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M08_REINFORCEMENT_KILLED, apc_id, 0.0f);
  1106. }
  1107. }
  1108. };
  1109. DECLARE_SCRIPT(M08_PetraA21_Buggy, "")
  1110. {
  1111. bool attacking;
  1112. int reinforce;
  1113. enum{WAYPATH, CHECK_ENEMY};
  1114. // Register variables to be Auto-Saved
  1115. // All variables must have a unique ID, less than 256, that never changes
  1116. REGISTER_VARIABLES()
  1117. {
  1118. SAVE_VARIABLE( attacking, 1 );
  1119. SAVE_VARIABLE( reinforce, 2 );
  1120. }
  1121. void Created (GameObject * obj)
  1122. {
  1123. Commands->Enable_Enemy_Seen( obj, true);
  1124. attacking = false;
  1125. }
  1126. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1127. {
  1128. ActionParamsStruct params;
  1129. if(!attacking)
  1130. {
  1131. attacking = true;
  1132. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 10 );
  1133. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1134. params.Set_Attack (enemy, 50.0f, 0.0f, 1);
  1135. params.WaypathID = 100290;
  1136. params.WaypathSplined = true;
  1137. Commands->Action_Attack( obj, params );
  1138. Commands->Start_Timer (obj, this, 30.0f, CHECK_ENEMY);
  1139. }
  1140. }
  1141. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1142. {
  1143. ActionParamsStruct params;
  1144. if(type == M08_CUSTOM_ACTIVATE)
  1145. {
  1146. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
  1147. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1148. params.WaypathID = 100263;
  1149. params.WaypathSplined = true;
  1150. Commands->Action_Goto( obj, params );
  1151. }
  1152. }
  1153. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1154. {
  1155. ActionParamsStruct params;
  1156. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1157. {
  1158. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1159. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1160. params.WaypathID = 100282;
  1161. params.WaypathSplined = true;
  1162. Commands->Action_Goto( obj, params );
  1163. }
  1164. }
  1165. void Timer_Expired(GameObject * obj, int timer_id )
  1166. {
  1167. if(timer_id == CHECK_ENEMY)
  1168. {
  1169. attacking = false;
  1170. }
  1171. }
  1172. };
  1173. DECLARE_SCRIPT(M08_Activate_PetraA21, "")
  1174. {
  1175. bool already_entered;
  1176. // Register variables to be Auto-Saved
  1177. // All variables must have a unique ID, less than 256, that never changes
  1178. REGISTER_VARIABLES()
  1179. {
  1180. SAVE_VARIABLE( already_entered, 1 );
  1181. }
  1182. void Created (GameObject * obj)
  1183. {
  1184. already_entered = false;
  1185. }
  1186. void Entered (GameObject * obj, GameObject * enterer)
  1187. {
  1188. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1189. {
  1190. already_entered = true;
  1191. // Custom to activate PetraA21_APC
  1192. Commands->Send_Custom_Event(obj, Commands->Find_Object(100262), M08_CUSTOM_ACTIVATE, 1, 0.0f);
  1193. // Custom to activate PetraA21_Buggy
  1194. Commands->Send_Custom_Event(obj, Commands->Find_Object(100289), M08_CUSTOM_ACTIVATE, 1, 0.0f);
  1195. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(109.901f, 170.915f, -7.315f));
  1196. Commands->Set_Facing(chinook_obj1, 100.000f);
  1197. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDrop1.txt");
  1198. }
  1199. }
  1200. };
  1201. DECLARE_SCRIPT(M08_Activate_PetraA22, "")
  1202. {
  1203. bool already_entered;
  1204. // Register variables to be Auto-Saved
  1205. // All variables must have a unique ID, less than 256, that never changes
  1206. REGISTER_VARIABLES()
  1207. {
  1208. SAVE_VARIABLE( already_entered, 1 );
  1209. }
  1210. void Created (GameObject * obj)
  1211. {
  1212. already_entered = false;
  1213. }
  1214. void Entered (GameObject * obj, GameObject * enterer)
  1215. {
  1216. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1217. {
  1218. already_entered = true;
  1219. Commands->Enable_Spawner(100308, true);
  1220. Commands->Enable_Spawner(100309, true);
  1221. Commands->Enable_Spawner(100310, true);
  1222. }
  1223. }
  1224. };
  1225. DECLARE_SCRIPT(M08_PetraA22_Stealth_Tank, "")
  1226. {
  1227. bool attacking;
  1228. enum{ATTACK_OVER};
  1229. // Register variables to be Auto-Saved
  1230. // All variables must have a unique ID, less than 256, that never changes
  1231. REGISTER_VARIABLES()
  1232. {
  1233. SAVE_VARIABLE( attacking, 1 );
  1234. }
  1235. void Created (GameObject * obj)
  1236. {
  1237. attacking = false;
  1238. }
  1239. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1240. {
  1241. ActionParamsStruct params;
  1242. if(!attacking)
  1243. {
  1244. attacking = true;
  1245. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1246. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1247. Commands->Action_Attack (obj, params);
  1248. Commands->Start_Timer (obj, this, 15.0f, ATTACK_OVER);
  1249. }
  1250. }
  1251. void Timer_Expired(GameObject * obj, int timer_id )
  1252. {
  1253. ActionParamsStruct params;
  1254. if(timer_id == ATTACK_OVER)
  1255. {
  1256. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1257. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1258. Commands->Action_Attack (obj, params);
  1259. attacking = false;
  1260. }
  1261. }
  1262. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1263. {
  1264. ActionParamsStruct params;
  1265. if(type == M08_CUSTOM_ACTIVATE)
  1266. {
  1267. Commands->Enable_Enemy_Seen( obj, true);
  1268. }
  1269. }
  1270. };
  1271. DECLARE_SCRIPT(M08_Petra_Convoy, "")
  1272. {
  1273. enum{WAYPATH};
  1274. // Register variables to be Auto-Saved
  1275. // All variables must have a unique ID, less than 256, that never changes
  1276. REGISTER_VARIABLES()
  1277. {
  1278. // SAVE_VARIABLE( attacking, 1 );
  1279. }
  1280. void Created (GameObject * obj)
  1281. {
  1282. }
  1283. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1284. {
  1285. ActionParamsStruct params;
  1286. if(type == M08_CUSTOM_ACTIVATE)
  1287. {
  1288. switch(param)
  1289. {
  1290. case 1:
  1291. {
  1292. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1293. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  1294. params.WaypathID = 100318;
  1295. params.WaypathSplined = true;
  1296. Commands->Action_Goto( obj, params );
  1297. }
  1298. break;
  1299. case 2:
  1300. {
  1301. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1302. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  1303. params.WaypathID = 100330;
  1304. params.WaypathSplined = true;
  1305. Commands->Action_Goto( obj, params );
  1306. }
  1307. break;
  1308. case 3:
  1309. {
  1310. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1311. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  1312. params.WaypathID = 100339;
  1313. params.WaypathSplined = true;
  1314. Commands->Action_Goto( obj, params );
  1315. }
  1316. break;
  1317. }
  1318. }
  1319. }
  1320. };
  1321. DECLARE_SCRIPT(M08_Activate_Convoy, "Param=0:int")
  1322. {
  1323. bool already_entered;
  1324. // Register variables to be Auto-Saved
  1325. // All variables must have a unique ID, less than 256, that never changes
  1326. REGISTER_VARIABLES()
  1327. {
  1328. SAVE_VARIABLE( already_entered, 1 );
  1329. }
  1330. void Created (GameObject * obj)
  1331. {
  1332. already_entered = false;
  1333. }
  1334. void Entered (GameObject * obj, GameObject * enterer)
  1335. {
  1336. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1337. {
  1338. already_entered = true;
  1339. int param = Get_Int_Parameter("Param");
  1340. Commands->Send_Custom_Event(obj, Commands->Find_Object(100326), M08_CUSTOM_ACTIVATE, param, 0.0f);
  1341. Commands->Send_Custom_Event(obj, Commands->Find_Object(100327), M08_CUSTOM_ACTIVATE, param, 0.5f);
  1342. }
  1343. }
  1344. };
  1345. DECLARE_SCRIPT(M08_Activate_Stealth_Trap, "")
  1346. {
  1347. bool already_entered;
  1348. int crate1_id;
  1349. int crate2_id;
  1350. int crate3_id;
  1351. int crate4_id;
  1352. int crate5_id;
  1353. int crate6_id;
  1354. int crate7_id;
  1355. // Register variables to be Auto-Saved
  1356. // All variables must have a unique ID, less than 256, that never changes
  1357. REGISTER_VARIABLES()
  1358. {
  1359. SAVE_VARIABLE( already_entered, 1 );
  1360. SAVE_VARIABLE( crate1_id, 2 );
  1361. SAVE_VARIABLE( crate2_id, 3 );
  1362. SAVE_VARIABLE( crate3_id, 4 );
  1363. SAVE_VARIABLE( crate4_id, 5 );
  1364. SAVE_VARIABLE( crate5_id, 6 );
  1365. SAVE_VARIABLE( crate6_id, 7 );
  1366. SAVE_VARIABLE( crate7_id, 8 );
  1367. }
  1368. void Created (GameObject * obj)
  1369. {
  1370. already_entered = false;
  1371. crate1_id = 0;
  1372. crate2_id = 0;
  1373. crate3_id = 0;
  1374. crate4_id = 0;
  1375. crate5_id = 0;
  1376. crate6_id = 0;
  1377. crate7_id = 0;
  1378. }
  1379. void Entered (GameObject * obj, GameObject * enterer)
  1380. {
  1381. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1382. {
  1383. already_entered = true;
  1384. // Front
  1385. Commands->Create_Explosion( "Ground Explosions Twiddler", Vector3(224.119f, 218.876f, -13.746f), obj );
  1386. Commands->Create_Explosion( "Ground Explosions Twiddler", Vector3(222.456f, 202.921f, -15.889f), obj );
  1387. GameObject *crate1 = Commands->Create_Object("M08_Rubble_Stub", Vector3(224.119f, 218.876f, -13.746f));
  1388. Commands->Set_Facing( crate1, 165.000f );
  1389. crate1_id = Commands->Get_ID(crate1);
  1390. GameObject *crate2 = Commands->Create_Object("M08_Rubble_Stub", Vector3(223.517f, 217.013f, -10.574f));
  1391. Commands->Set_Facing( crate2, 165.000f );
  1392. crate2_id = Commands->Get_ID(crate2);
  1393. GameObject *crate3 = Commands->Create_Object("M08_Rubble_Stub_Destroyable", Vector3(221.917f, 212.589f, -15.192f));
  1394. Commands->Set_Facing( crate3, 0.000f );
  1395. crate3_id = Commands->Get_ID(crate3);
  1396. GameObject *crate4 = Commands->Create_Object("M08_Rubble_Stub", Vector3(222.138f, 207.974f, -12.258f));
  1397. Commands->Set_Facing( crate4, 0.000f );
  1398. crate4_id = Commands->Get_ID(crate4);
  1399. GameObject *crate5 = Commands->Create_Object("M08_Rubble_Stub", Vector3(221.850f, 196.753f, -15.421f));
  1400. Commands->Set_Facing( crate5, 0.000f );
  1401. crate5_id = Commands->Get_ID(crate5);
  1402. GameObject *crate6 = Commands->Create_Object("M08_Rubble_Stub", Vector3(221.944f, 198.134f, -12.500f));
  1403. Commands->Set_Facing( crate6, 0.000f );
  1404. crate6_id = Commands->Get_ID(crate6);
  1405. GameObject *crate7 = Commands->Create_Object("M08_Rubble_Stub", Vector3(222.456f, 202.921f, -15.889f));
  1406. Commands->Set_Facing( crate7, 0.000f );
  1407. crate7_id = Commands->Get_ID(crate7);
  1408. // Rear
  1409. Commands->Create_Explosion( "Generic Ground 01", Vector3(106.852f, 221.987f, -3.990f), obj );
  1410. Commands->Create_Explosion( "Generic Ground 01", Vector3(89.681f, 218.165f, -8.951f), obj );
  1411. GameObject *crate8 = Commands->Create_Object("M08_Rubble_Stub", Vector3(106.852f, 221.987f, -3.990f));
  1412. Commands->Set_Facing( crate8, 105.000f );
  1413. GameObject *crate9 = Commands->Create_Object("M08_Rubble_Stub", Vector3(99.245f, 220.195f, -5.858f));
  1414. Commands->Set_Facing( crate9, 105.000f );
  1415. GameObject *crate10 = Commands->Create_Object("M08_Rubble_Stub", Vector3(97.595f, 219.985f, -9.097f));
  1416. Commands->Set_Facing( crate10, -75.000f );
  1417. GameObject *crate11 = Commands->Create_Object("M08_Rubble_Stub", Vector3(89.813f, 217.622f, -5.894f));
  1418. Commands->Set_Facing( crate11, 105.000f );
  1419. GameObject *crate12 = Commands->Create_Object("M08_Rubble_Stub", Vector3(89.681f, 218.165f, -8.951f));
  1420. Commands->Set_Facing( crate12, -80.000f );
  1421. // Activate initial stealth tank
  1422. Commands->Send_Custom_Event(obj, Commands->Find_Object(100347), M08_CUSTOM_ACTIVATE, 1, 0.0f);
  1423. //Enable stealth soldier spawners
  1424. Commands->Enable_Spawner(100348, true);
  1425. Commands->Enable_Spawner(100349, true);
  1426. Commands->Enable_Spawner(100351, true);
  1427. // Enable stealth tank at rear of trap
  1428. Commands->Enable_Spawner(100354, true);
  1429. // Enable stealth soldier at rear of trap
  1430. Commands->Enable_Spawner(100351, true);
  1431. // Enable damaged and emtpy stealth tank
  1432. Commands->Enable_Spawner(100359, true);
  1433. }
  1434. }
  1435. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1436. {
  1437. ActionParamsStruct params;
  1438. if(type == M08_CUSTOM_ACTIVATE)
  1439. {
  1440. Commands->Destroy_Object(Commands->Find_Object(crate1_id));
  1441. Commands->Destroy_Object(Commands->Find_Object(crate2_id));
  1442. Commands->Destroy_Object(Commands->Find_Object(crate3_id));
  1443. Commands->Destroy_Object(Commands->Find_Object(crate4_id));
  1444. Commands->Destroy_Object(Commands->Find_Object(crate5_id));
  1445. Commands->Destroy_Object(Commands->Find_Object(crate6_id));
  1446. Commands->Destroy_Object(Commands->Find_Object(crate7_id));
  1447. }
  1448. };
  1449. };
  1450. DECLARE_SCRIPT(M08_Destroy_Stealth_Trap, "")
  1451. {
  1452. bool already_entered;
  1453. int stealth_tank_id;
  1454. // Register variables to be Auto-Saved
  1455. // All variables must have a unique ID, less than 256, that never changes
  1456. REGISTER_VARIABLES()
  1457. {
  1458. SAVE_VARIABLE( already_entered, 1 );
  1459. SAVE_VARIABLE( stealth_tank_id, 2 );
  1460. }
  1461. void Created (GameObject * obj)
  1462. {
  1463. already_entered = false;
  1464. stealth_tank_id = 0;
  1465. }
  1466. void Entered (GameObject * obj, GameObject * enterer)
  1467. {
  1468. if (Commands->Get_ID(enterer) == stealth_tank_id)
  1469. {
  1470. already_entered = true;
  1471. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_CUSTOM_ACTIVATE, 1, 0.0f);
  1472. }
  1473. }
  1474. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1475. {
  1476. ActionParamsStruct params;
  1477. if(type == M08_UNIT_ID)
  1478. {
  1479. stealth_tank_id = param;
  1480. }
  1481. };
  1482. };
  1483. DECLARE_SCRIPT(M08_Player_Stealth_Tank, "")
  1484. {
  1485. bool already_entered;
  1486. // Register variables to be Auto-Saved
  1487. // All variables must have a unique ID, less than 256, that never changes
  1488. REGISTER_VARIABLES()
  1489. {
  1490. SAVE_VARIABLE( already_entered, 1 );
  1491. }
  1492. void Created (GameObject * obj)
  1493. {
  1494. Commands->Send_Custom_Event(obj, Commands->Find_Object(100360), M08_UNIT_ID, Commands->Get_ID(obj), 0.0f);
  1495. }
  1496. };
  1497. DECLARE_SCRIPT(M08_Nod_Light_Tank, "")
  1498. {
  1499. bool attacking;
  1500. enum{ATTACK_OVER};
  1501. // Register variables to be Auto-Saved
  1502. // All variables must have a unique ID, less than 256, that never changes
  1503. REGISTER_VARIABLES()
  1504. {
  1505. SAVE_VARIABLE( attacking, 1 );
  1506. }
  1507. void Created (GameObject * obj)
  1508. {
  1509. Commands->Enable_Enemy_Seen( obj, true);
  1510. attacking = false;
  1511. }
  1512. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1513. {
  1514. ActionParamsStruct params;
  1515. if(!attacking)
  1516. {
  1517. attacking = true;
  1518. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1519. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1520. Commands->Action_Attack (obj, params);
  1521. Commands->Start_Timer (obj, this, 15.0f, ATTACK_OVER);
  1522. }
  1523. }
  1524. void Timer_Expired(GameObject * obj, int timer_id )
  1525. {
  1526. ActionParamsStruct params;
  1527. if(timer_id == ATTACK_OVER)
  1528. {
  1529. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1530. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1531. Commands->Action_Attack (obj, params);
  1532. attacking = false;
  1533. }
  1534. }
  1535. };
  1536. DECLARE_SCRIPT(M08_Nod_Stealth_Tank, "")
  1537. {
  1538. bool attacking;
  1539. enum{ATTACK_OVER};
  1540. // Register variables to be Auto-Saved
  1541. // All variables must have a unique ID, less than 256, that never changes
  1542. REGISTER_VARIABLES()
  1543. {
  1544. SAVE_VARIABLE( attacking, 1 );
  1545. }
  1546. void Created (GameObject * obj)
  1547. {
  1548. Commands->Enable_Enemy_Seen( obj, true);
  1549. attacking = false;
  1550. }
  1551. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1552. {
  1553. ActionParamsStruct params;
  1554. if(!attacking)
  1555. {
  1556. attacking = true;
  1557. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1558. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1559. Commands->Action_Attack (obj, params);
  1560. Commands->Start_Timer (obj, this, 15.0f, ATTACK_OVER);
  1561. }
  1562. }
  1563. void Timer_Expired(GameObject * obj, int timer_id )
  1564. {
  1565. ActionParamsStruct params;
  1566. if(timer_id == ATTACK_OVER)
  1567. {
  1568. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1569. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1570. Commands->Action_Attack (obj, params);
  1571. attacking = false;
  1572. }
  1573. }
  1574. };
  1575. DECLARE_SCRIPT(M08_Archaelogical_Site_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3, Unit_ID=0:int")
  1576. {
  1577. int waypath_id;
  1578. Vector3 waypath_loc;
  1579. int unit_id;
  1580. enum {WAYPATH, GO_WAYPATH, INITIAL};
  1581. // Register variables to be Auto-Saved
  1582. // All variables must have a unique ID, less than 256, that never changes
  1583. REGISTER_VARIABLES()
  1584. {
  1585. // SAVE_VARIABLE( waypath_id, 1 );
  1586. // SAVE_VARIABLE( waypath_loc, 2 );
  1587. }
  1588. void Created (GameObject * obj)
  1589. {
  1590. waypath_id = Get_Int_Parameter("Waypath_ID");
  1591. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1592. unit_id = Get_Int_Parameter("Unit_ID");
  1593. if(waypath_id != 0)
  1594. {
  1595. Commands->Start_Timer(obj, this, 3.0f, INITIAL);
  1596. }
  1597. else
  1598. {
  1599. Commands->Set_Innate_Is_Stationary(obj, true);
  1600. }
  1601. }
  1602. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1603. {
  1604. ActionParamsStruct params;
  1605. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1606. {
  1607. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
  1608. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1609. params.WaypathID = waypath_id;
  1610. Commands->Action_Goto( obj, params );
  1611. }
  1612. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1613. {
  1614. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1615. }
  1616. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1617. {
  1618. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1619. }
  1620. }
  1621. void Timer_Expired(GameObject * obj, int timer_id )
  1622. {
  1623. ActionParamsStruct params;
  1624. if(timer_id == WAYPATH)
  1625. {
  1626. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_WAYPATH );
  1627. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1628. Commands->Action_Goto( obj, params );
  1629. }
  1630. if(timer_id == INITIAL)
  1631. {
  1632. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_WAYPATH );
  1633. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1634. Commands->Action_Goto( obj, params );
  1635. }
  1636. }
  1637. void Killed (GameObject * obj, GameObject * killer)
  1638. {
  1639. Commands->Send_Custom_Event(obj, Commands->Find_Object(100362), M08_ARCHAELOGICAL_KILLED, unit_id, 0.0f);
  1640. }
  1641. };
  1642. DECLARE_SCRIPT(M08_Archaelogical_Reinforcements, "Unit_ID=0:int")
  1643. {
  1644. int unit_id;
  1645. enum{INITIAL};
  1646. // Register variables to be Auto-Saved
  1647. // All variables must have a unique ID, less than 256, that never changes
  1648. REGISTER_VARIABLES()
  1649. {
  1650. // SAVE_VARIABLE( waypath_id, 1 );
  1651. }
  1652. void Created (GameObject * obj)
  1653. {
  1654. Commands->Start_Timer(obj, this, 3.0f, INITIAL);
  1655. unit_id = Get_Int_Parameter("Unit_ID");
  1656. }
  1657. void Timer_Expired(GameObject * obj, int timer_id )
  1658. {
  1659. ActionParamsStruct params;
  1660. if(timer_id == INITIAL)
  1661. {
  1662. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1663. params.Set_Movement( STAR, RUN, 1.5f );
  1664. Commands->Action_Goto( obj, params );
  1665. }
  1666. }
  1667. void Killed (GameObject * obj, GameObject * killer)
  1668. {
  1669. Commands->Send_Custom_Event(obj, Commands->Find_Object(100362), M08_ARCHAELOGICAL_KILLED, unit_id, 0.0f);
  1670. }
  1671. };
  1672. DECLARE_SCRIPT(M08_Archaelogical_Site_Controller, "")
  1673. {
  1674. bool already_entered;
  1675. int unit1_killed;
  1676. int unit2_killed;
  1677. // Register variables to be Auto-Saved
  1678. // All variables must have a unique ID, less than 256, that never changes
  1679. REGISTER_VARIABLES()
  1680. {
  1681. SAVE_VARIABLE( already_entered, 1 );
  1682. SAVE_VARIABLE( unit1_killed, 2 );
  1683. SAVE_VARIABLE( unit2_killed, 3 );
  1684. }
  1685. void Created (GameObject * obj)
  1686. {
  1687. already_entered = false;
  1688. unit1_killed = 0;
  1689. unit2_killed = 0;
  1690. }
  1691. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1692. {
  1693. ActionParamsStruct params;
  1694. if(type == M08_ARCHAELOGICAL_KILLED)
  1695. {
  1696. switch(param)
  1697. {
  1698. case 1:
  1699. {
  1700. unit1_killed++;
  1701. if(unit1_killed%2 == 0)
  1702. {
  1703. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(280.143f, 256.055f, -18.745f));
  1704. Commands->Set_Facing(chinook_obj1, 60.000f);
  1705. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDrop2.txt");
  1706. }
  1707. }
  1708. break;
  1709. case 2:
  1710. {
  1711. unit2_killed++;
  1712. if(unit2_killed%2 == 0)
  1713. {
  1714. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(270.498f, 394.061f, -12.328f));
  1715. Commands->Set_Facing(chinook_obj2, 60.000f);
  1716. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X8I_TroopDrop3.txt");
  1717. }
  1718. }
  1719. break;
  1720. }
  1721. }
  1722. }
  1723. };
  1724. DECLARE_SCRIPT(M08_Archaelogical_Site_Buggy, "")
  1725. {
  1726. bool attacking;
  1727. enum{WAYPATH, ATTACK_OVER};
  1728. // Register variables to be Auto-Saved
  1729. // All variables must have a unique ID, less than 256, that never changes
  1730. REGISTER_VARIABLES()
  1731. {
  1732. SAVE_VARIABLE( attacking, 1 );
  1733. }
  1734. void Created (GameObject * obj)
  1735. {
  1736. Commands->Enable_Enemy_Seen( obj, true);
  1737. ActionParamsStruct params;
  1738. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1739. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1740. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1741. params.WaypathID = 100406;
  1742. Commands->Action_Attack( obj, params );
  1743. attacking = false;
  1744. }
  1745. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1746. {
  1747. ActionParamsStruct params;
  1748. if(!attacking)
  1749. {
  1750. attacking = true;
  1751. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1752. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1753. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1754. params.WaypathID = 100406;
  1755. Commands->Modify_Action (obj, WAYPATH, params);
  1756. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  1757. }
  1758. }
  1759. void Timer_Expired(GameObject * obj, int timer_id )
  1760. {
  1761. ActionParamsStruct params;
  1762. if(timer_id == ATTACK_OVER)
  1763. {
  1764. attacking = false;
  1765. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1766. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1767. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1768. params.WaypathID = 100406;
  1769. Commands->Modify_Action (obj, WAYPATH, params);
  1770. }
  1771. }
  1772. };
  1773. DECLARE_SCRIPT(M08_Archaelogical_Site_Tomb, "")
  1774. {
  1775. bool already_entered;
  1776. // Register variables to be Auto-Saved
  1777. // All variables must have a unique ID, less than 256, that never changes
  1778. REGISTER_VARIABLES()
  1779. {
  1780. SAVE_VARIABLE( already_entered, 1 );
  1781. }
  1782. void Created (GameObject * obj)
  1783. {
  1784. already_entered = false;
  1785. }
  1786. void Entered (GameObject * obj, GameObject * enterer)
  1787. {
  1788. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1789. {
  1790. already_entered = true;
  1791. Commands->Enable_Spawner(100423, true);
  1792. Commands->Enable_Spawner(100424, true);
  1793. }
  1794. }
  1795. };
  1796. DECLARE_SCRIPT(M08_PetraA25_Controller, "")
  1797. {
  1798. int unit1_killed;
  1799. int unit2_killed;
  1800. // Register variables to be Auto-Saved
  1801. // All variables must have a unique ID, less than 256, that never changes
  1802. REGISTER_VARIABLES()
  1803. {
  1804. SAVE_VARIABLE( unit1_killed, 1 );
  1805. SAVE_VARIABLE( unit2_killed, 2 );
  1806. }
  1807. void Created (GameObject * obj)
  1808. {
  1809. unit1_killed = 0;
  1810. unit2_killed = 0;
  1811. }
  1812. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1813. {
  1814. ActionParamsStruct params;
  1815. if(type == M08_PETRAA25_KILLED)
  1816. {
  1817. switch(param)
  1818. {
  1819. case 1:
  1820. {
  1821. unit1_killed++;
  1822. if(unit1_killed < 4)
  1823. {
  1824. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(161.429f, 419.470f, -11.413f));
  1825. Commands->Set_Facing(chinook_obj2, 60.000f);
  1826. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "M08_XG_VehicleDrop1.txt");
  1827. }
  1828. }
  1829. break;
  1830. case 2:
  1831. {
  1832. unit2_killed++;
  1833. if(unit2_killed%2 == 0)
  1834. {
  1835. }
  1836. }
  1837. break;
  1838. }
  1839. }
  1840. }
  1841. };
  1842. DECLARE_SCRIPT(M08_PetraA25_Tank, "")
  1843. {
  1844. bool attacking;
  1845. enum{WAYPATH, ATTACK_OVER, INITIAL};
  1846. // Register variables to be Auto-Saved
  1847. // All variables must have a unique ID, less than 256, that never changes
  1848. REGISTER_VARIABLES()
  1849. {
  1850. SAVE_VARIABLE( attacking, 1 );
  1851. }
  1852. void Created (GameObject * obj)
  1853. {
  1854. Commands->Enable_Enemy_Seen( obj, true);
  1855. Commands->Start_Timer (obj, this, 4.0f, INITIAL);
  1856. attacking = true;
  1857. }
  1858. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1859. {
  1860. ActionParamsStruct params;
  1861. if(!attacking)
  1862. {
  1863. attacking = true;
  1864. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1865. params.Set_Movement( Vector3(0,0,0), 0.0f, 1.5f );
  1866. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1867. params.WaypathID = 100437;
  1868. params.WaypathSplined = true;
  1869. Commands->Modify_Action (obj, WAYPATH, params);
  1870. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  1871. }
  1872. }
  1873. void Timer_Expired(GameObject * obj, int timer_id )
  1874. {
  1875. ActionParamsStruct params;
  1876. if(timer_id == INITIAL)
  1877. {
  1878. attacking = false;
  1879. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1880. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1881. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1882. params.WaypathID = 100437;
  1883. params.WaypathSplined = true;
  1884. Commands->Action_Attack( obj, params );
  1885. }
  1886. if(timer_id == ATTACK_OVER)
  1887. {
  1888. attacking = false;
  1889. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1890. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1891. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  1892. params.WaypathID = 100437;
  1893. params.WaypathSplined = true;
  1894. Commands->Modify_Action (obj, WAYPATH, params);
  1895. }
  1896. }
  1897. void Killed (GameObject * obj, GameObject * killer)
  1898. {
  1899. Commands->Send_Custom_Event(obj, Commands->Find_Object(100436), M08_PETRAA25_KILLED, 1, 0.0f);
  1900. }
  1901. };
  1902. DECLARE_SCRIPT(M08_PetraA25_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1903. {
  1904. int waypath_id;
  1905. Vector3 waypath_loc;
  1906. enum {WAYPATH, GO_WAYPATH};
  1907. // Register variables to be Auto-Saved
  1908. // All variables must have a unique ID, less than 256, that never changes
  1909. REGISTER_VARIABLES()
  1910. {
  1911. SAVE_VARIABLE( waypath_id, 1 );
  1912. SAVE_VARIABLE( waypath_loc, 2 );
  1913. }
  1914. void Created (GameObject * obj)
  1915. {
  1916. waypath_id = Get_Int_Parameter("Waypath_ID");
  1917. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1918. ActionParamsStruct params;
  1919. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_WAYPATH );
  1920. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1921. Commands->Action_Goto( obj, params );
  1922. }
  1923. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1924. {
  1925. ActionParamsStruct params;
  1926. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1927. {
  1928. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
  1929. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1930. params.WaypathID = waypath_id;
  1931. Commands->Action_Goto( obj, params );
  1932. }
  1933. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1934. {
  1935. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1936. }
  1937. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1938. {
  1939. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1940. }
  1941. }
  1942. void Timer_Expired(GameObject * obj, int timer_id )
  1943. {
  1944. ActionParamsStruct params;
  1945. if(timer_id == WAYPATH)
  1946. {
  1947. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_WAYPATH );
  1948. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1949. Commands->Action_Goto( obj, params );
  1950. }
  1951. }
  1952. };
  1953. DECLARE_SCRIPT(M08_Excavation_Mechanism, "")
  1954. {
  1955. // Register variables to be Auto-Saved
  1956. // All variables must have a unique ID, less than 256, that never changes
  1957. REGISTER_VARIABLES()
  1958. {
  1959. // SAVE_VARIABLE( already_entered, 1 );
  1960. }
  1961. void Killed (GameObject * obj, GameObject * killer)
  1962. {
  1963. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 808, 1, 0.0f);
  1964. }
  1965. };
  1966. DECLARE_SCRIPT(M08_Tiberium_Cultivation_MCT, "")
  1967. {
  1968. // Register variables to be Auto-Saved
  1969. // All variables must have a unique ID, less than 256, that never changes
  1970. REGISTER_VARIABLES()
  1971. {
  1972. // SAVE_VARIABLE( already_entered, 1 );
  1973. }
  1974. void Created (GameObject * obj)
  1975. {
  1976. Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
  1977. }
  1978. void Killed (GameObject * obj, GameObject * killer)
  1979. {
  1980. Commands->Create_Explosion("Explosion_Mine_Remote_01", Commands->Get_Position(obj));
  1981. Vector3 myPositon = Commands->Get_Position ( obj );
  1982. float myFacing = Commands->Get_Facing ( obj );
  1983. GameObject * destroyedMCT = Commands->Create_Object ( "Nod_MCT_Alarm_Destroyed", myPositon);
  1984. Commands->Set_Facing ( destroyedMCT, myFacing );
  1985. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 809, 1, 0.0f);
  1986. }
  1987. };
  1988. DECLARE_SCRIPT(M08_Research_Station_A, "")
  1989. {
  1990. // Register variables to be Auto-Saved
  1991. // All variables must have a unique ID, less than 256, that never changes
  1992. REGISTER_VARIABLES()
  1993. {
  1994. // SAVE_VARIABLE( already_entered, 1 );
  1995. }
  1996. void Created (GameObject * obj)
  1997. {
  1998. Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
  1999. }
  2000. void Killed (GameObject * obj, GameObject * killer)
  2001. {
  2002. Commands->Create_Explosion("Explosion_Mine_Remote_01", Commands->Get_Position(obj));
  2003. Vector3 myPositon = Commands->Get_Position ( obj );
  2004. float myFacing = Commands->Get_Facing ( obj );
  2005. GameObject * destroyedMCT = Commands->Create_Object ( "Nod_MCT_Alarm_Destroyed", myPositon);
  2006. Commands->Set_Facing ( destroyedMCT, myFacing );
  2007. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 806, 1, 0.0f);
  2008. }
  2009. };
  2010. DECLARE_SCRIPT(M08_Research_Station_B, "")
  2011. {
  2012. // Register variables to be Auto-Saved
  2013. // All variables must have a unique ID, less than 256, that never changes
  2014. REGISTER_VARIABLES()
  2015. {
  2016. // SAVE_VARIABLE( already_entered, 1 );
  2017. }
  2018. void Created (GameObject * obj)
  2019. {
  2020. Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
  2021. }
  2022. void Killed (GameObject * obj, GameObject * killer)
  2023. {
  2024. Commands->Create_Explosion("Explosion_Mine_Remote_01", Commands->Get_Position(obj));
  2025. Vector3 myPositon = Commands->Get_Position ( obj );
  2026. float myFacing = Commands->Get_Facing ( obj );
  2027. GameObject * destroyedMCT = Commands->Create_Object ( "Nod_MCT_Alarm_Destroyed", myPositon);
  2028. Commands->Set_Facing ( destroyedMCT, myFacing );
  2029. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), 807, 1, 0.0f);
  2030. }
  2031. };
  2032. DECLARE_SCRIPT(M08_Facility_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  2033. {
  2034. int waypath_id;
  2035. Vector3 waypath_loc;
  2036. bool enemy_seen;
  2037. enum {WAYPATH, GO_WAYPATH};
  2038. // Register variables to be Auto-Saved
  2039. // All variables must have a unique ID, less than 256, that never changes
  2040. REGISTER_VARIABLES()
  2041. {
  2042. SAVE_VARIABLE( waypath_id, 1 );
  2043. SAVE_VARIABLE( waypath_loc, 2 );
  2044. SAVE_VARIABLE( enemy_seen, 3 );
  2045. }
  2046. void Created (GameObject * obj)
  2047. {
  2048. enemy_seen = false;
  2049. // No starting units can hear footsteps until otherwise alerted
  2050. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  2051. waypath_id = Get_Int_Parameter("Waypath_ID");
  2052. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  2053. ActionParamsStruct params;
  2054. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  2055. params.Set_Movement( waypath_loc, RUN, 1.5f );
  2056. Commands->Action_Goto( obj, params );
  2057. }
  2058. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2059. {
  2060. ActionParamsStruct params;
  2061. if(reason != ACTION_COMPLETE_NORMAL)
  2062. {
  2063. Commands->Start_Timer(obj, this, 30.0f, WAYPATH);
  2064. return;
  2065. }
  2066. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  2067. {
  2068. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  2069. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  2070. params.WaypathID = waypath_id;
  2071. Commands->Action_Goto( obj, params );
  2072. }
  2073. }
  2074. void Timer_Expired(GameObject * obj, int timer_id )
  2075. {
  2076. ActionParamsStruct params;
  2077. if(timer_id == WAYPATH)
  2078. {
  2079. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  2080. params.Set_Movement( waypath_loc, RUN, 1.5f );
  2081. Commands->Action_Goto( obj, params );
  2082. }
  2083. }
  2084. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2085. {
  2086. if((Commands->Is_A_Star(enemy)) && (!enemy_seen))
  2087. {
  2088. enemy_seen = true;
  2089. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  2090. }
  2091. }
  2092. };
  2093. DECLARE_SCRIPT(M08_Facility_Go_Point, "Point1_ID=0:int, Point2_ID=0:int")
  2094. {
  2095. int point1_id;
  2096. int point2_id;
  2097. bool enemy_seen;
  2098. enum {GO_POINT1, GO_POINT2};
  2099. // Register variables to be Auto-Saved
  2100. // All variables must have a unique ID, less than 256, that never changes
  2101. REGISTER_VARIABLES()
  2102. {
  2103. SAVE_VARIABLE( point1_id, 1 );
  2104. SAVE_VARIABLE( point2_id, 2 );
  2105. SAVE_VARIABLE( enemy_seen, 3 );
  2106. }
  2107. void Created (GameObject * obj)
  2108. {
  2109. enemy_seen = false;
  2110. // No starting units can hear footsteps until otherwise alerted
  2111. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  2112. point1_id = Get_Int_Parameter("Point1_ID");
  2113. point2_id = Get_Int_Parameter("Point2_ID");
  2114. ActionParamsStruct params;
  2115. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_POINT1 );
  2116. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  2117. Commands->Action_Goto( obj, params );
  2118. }
  2119. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2120. {
  2121. ActionParamsStruct params;
  2122. if(reason != ACTION_COMPLETE_NORMAL)
  2123. {
  2124. Commands->Start_Timer(obj, this, 30.0f, GO_POINT1);
  2125. return;
  2126. }
  2127. if(action_id == GO_POINT1 && reason == ACTION_COMPLETE_NORMAL)
  2128. {
  2129. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_POINT2 );
  2130. params.Set_Movement( Commands->Find_Object(point2_id), WALK, 1.5f );
  2131. Commands->Action_Goto( obj, params );
  2132. }
  2133. if(action_id == GO_POINT2 && reason == ACTION_COMPLETE_NORMAL)
  2134. {
  2135. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_POINT1 );
  2136. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  2137. Commands->Action_Goto( obj, params );
  2138. }
  2139. }
  2140. void Timer_Expired(GameObject * obj, int timer_id )
  2141. {
  2142. ActionParamsStruct params;
  2143. if(timer_id == GO_POINT1)
  2144. {
  2145. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_POINT1 );
  2146. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  2147. Commands->Action_Goto( obj, params );
  2148. }
  2149. }
  2150. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2151. {
  2152. if((Commands->Is_A_Star(enemy)) && (!enemy_seen))
  2153. {
  2154. enemy_seen = true;
  2155. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  2156. }
  2157. }
  2158. };
  2159. DECLARE_SCRIPT(M08_Facility_Tank, "Waypath_ID=0:int")
  2160. {
  2161. bool attacking;
  2162. int waypath_id;
  2163. enum{WAYPATH, ATTACK_OVER, INITIAL};
  2164. // Register variables to be Auto-Saved
  2165. // All variables must have a unique ID, less than 256, that never changes
  2166. REGISTER_VARIABLES()
  2167. {
  2168. SAVE_VARIABLE( attacking, 1 );
  2169. // SAVE_VARIABLE( waypath_id, 2 );
  2170. }
  2171. void Created (GameObject * obj)
  2172. {
  2173. Commands->Enable_Enemy_Seen( obj, true);
  2174. Commands->Start_Timer (obj, this, 4.0f, INITIAL);
  2175. waypath_id = Get_Int_Parameter("Waypath_ID");
  2176. attacking = true;
  2177. }
  2178. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2179. {
  2180. ActionParamsStruct params;
  2181. if(!attacking)
  2182. {
  2183. attacking = true;
  2184. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2185. params.Set_Movement( Vector3(0,0,0), 0.0f, 1.5f );
  2186. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  2187. params.WaypathID = waypath_id;
  2188. params.WaypathSplined = true;
  2189. Commands->Modify_Action (obj, WAYPATH, params);
  2190. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  2191. }
  2192. }
  2193. void Timer_Expired(GameObject * obj, int timer_id )
  2194. {
  2195. ActionParamsStruct params;
  2196. if(timer_id == INITIAL)
  2197. {
  2198. attacking = false;
  2199. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2200. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2201. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  2202. params.WaypathID = waypath_id;
  2203. params.WaypathSplined = true;
  2204. Commands->Action_Attack( obj, params );
  2205. }
  2206. if(timer_id == ATTACK_OVER)
  2207. {
  2208. attacking = false;
  2209. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2210. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2211. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  2212. params.WaypathID = waypath_id;
  2213. params.WaypathSplined = true;
  2214. Commands->Modify_Action (obj, WAYPATH, params);
  2215. }
  2216. }
  2217. };
  2218. DECLARE_SCRIPT(M08_Facility_Vehicle_Dec, "")
  2219. {
  2220. bool attacking;
  2221. enum{ATTACK_OVER, ATTACKING};
  2222. // Register variables to be Auto-Saved
  2223. // All variables must have a unique ID, less than 256, that never changes
  2224. REGISTER_VARIABLES()
  2225. {
  2226. SAVE_VARIABLE( attacking, 1 );
  2227. }
  2228. void Created (GameObject * obj)
  2229. {
  2230. Commands->Enable_Enemy_Seen( obj, true);
  2231. attacking = true;
  2232. }
  2233. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2234. {
  2235. ActionParamsStruct params;
  2236. if(!attacking)
  2237. {
  2238. attacking = true;
  2239. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ATTACKING );
  2240. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  2241. Commands->Action_Attack (obj, params);
  2242. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  2243. }
  2244. }
  2245. void Timer_Expired(GameObject * obj, int timer_id )
  2246. {
  2247. ActionParamsStruct params;
  2248. if(timer_id == ATTACK_OVER)
  2249. {
  2250. attacking = false;
  2251. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ATTACKING );
  2252. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  2253. Commands->Modify_Action (obj, ATTACKING, params);
  2254. }
  2255. }
  2256. };
  2257. DECLARE_SCRIPT(M08_Activate_Encounter, "Spawner_ID1=0:int, Spawner_ID2=0:int, Spawner_ID3=0:int, Spawner_ID4=0:int, Spawner_ID5=0:int, Spawner_ID6=0:int")
  2258. {
  2259. bool already_entered;
  2260. // Register variables to be Auto-Saved
  2261. // All variables must have a unique ID, less than 256, that never changes
  2262. REGISTER_VARIABLES()
  2263. {
  2264. SAVE_VARIABLE( already_entered, 1 );
  2265. }
  2266. void Created (GameObject * obj)
  2267. {
  2268. already_entered = false;
  2269. }
  2270. void Entered (GameObject * obj, GameObject * enterer)
  2271. {
  2272. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2273. {
  2274. already_entered = true;
  2275. int spawner_id1 = Get_Int_Parameter("Spawner_ID1");
  2276. int spawner_id2 = Get_Int_Parameter("Spawner_ID2");
  2277. int spawner_id3 = Get_Int_Parameter("Spawner_ID3");
  2278. int spawner_id4 = Get_Int_Parameter("Spawner_ID4");
  2279. int spawner_id5 = Get_Int_Parameter("Spawner_ID5");
  2280. int spawner_id6 = Get_Int_Parameter("Spawner_ID6");
  2281. if(spawner_id1 != 0)
  2282. {
  2283. Commands->Enable_Spawner(spawner_id1, true);
  2284. }
  2285. if(spawner_id2 != 0)
  2286. {
  2287. Commands->Enable_Spawner(spawner_id2, true);
  2288. }
  2289. if(spawner_id3 != 0)
  2290. {
  2291. Commands->Enable_Spawner(spawner_id3, true);
  2292. }
  2293. if(spawner_id4 != 0)
  2294. {
  2295. Commands->Enable_Spawner(spawner_id4, true);
  2296. }
  2297. if(spawner_id5 != 0)
  2298. {
  2299. Commands->Enable_Spawner(spawner_id5, true);
  2300. }
  2301. if(spawner_id6 != 0)
  2302. {
  2303. Commands->Enable_Spawner(spawner_id6, true);
  2304. }
  2305. }
  2306. }
  2307. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2308. {
  2309. if (type == M08_DEACTIVATE_ENCOUNTER)
  2310. {
  2311. int spawner_id1 = Get_Int_Parameter("Spawner_ID1");
  2312. int spawner_id2 = Get_Int_Parameter("Spawner_ID2");
  2313. int spawner_id3 = Get_Int_Parameter("Spawner_ID3");
  2314. int spawner_id4 = Get_Int_Parameter("Spawner_ID4");
  2315. int spawner_id5 = Get_Int_Parameter("Spawner_ID5");
  2316. int spawner_id6 = Get_Int_Parameter("Spawner_ID6");
  2317. if(spawner_id1 != 0)
  2318. {
  2319. Commands->Enable_Spawner(spawner_id1, false);
  2320. }
  2321. if(spawner_id2 != 0)
  2322. {
  2323. Commands->Enable_Spawner(spawner_id2, false);
  2324. }
  2325. if(spawner_id3 != 0)
  2326. {
  2327. Commands->Enable_Spawner(spawner_id3, false);
  2328. }
  2329. if(spawner_id4 != 0)
  2330. {
  2331. Commands->Enable_Spawner(spawner_id4, false);
  2332. }
  2333. if(spawner_id5 != 0)
  2334. {
  2335. Commands->Enable_Spawner(spawner_id5, false);
  2336. }
  2337. if(spawner_id6 != 0)
  2338. {
  2339. Commands->Enable_Spawner(spawner_id6, false);
  2340. }
  2341. }
  2342. }
  2343. };
  2344. DECLARE_SCRIPT(M08_Deactivate_Encounter, "Activate_Zone=0:int")
  2345. {
  2346. // Register variables to be Auto-Saved
  2347. // All variables must have a unique ID, less than 256, that never changes
  2348. REGISTER_VARIABLES()
  2349. {
  2350. // SAVE_VARIABLE( already_entered, 1 );
  2351. }
  2352. void Created (GameObject * obj)
  2353. {
  2354. }
  2355. void Entered (GameObject * obj, GameObject * enterer)
  2356. {
  2357. if (Commands->Is_A_Star(enterer))
  2358. {
  2359. int activate_zone = Get_Int_Parameter("Activate_Zone");
  2360. Commands->Send_Custom_Event(obj, Commands->Find_Object(activate_zone), M08_DEACTIVATE_ENCOUNTER, 1);
  2361. }
  2362. }
  2363. };
  2364. DECLARE_SCRIPT(M08_Encounter_Unit, "Waypath_ID=0:int, Priority=0:int, Suicide=0:int, Stationary_at_End=0:int")
  2365. {
  2366. int waypath_id;
  2367. int priority;
  2368. bool suicide;
  2369. bool stationary;
  2370. enum{DIE_SURPRISE, GO_STAR, WAYPATH};
  2371. // Register variables to be Auto-Saved
  2372. // All variables must have a unique ID, less than 256, that never changes
  2373. REGISTER_VARIABLES()
  2374. {
  2375. // SAVE_VARIABLE( poke_id, 1 );
  2376. }
  2377. void Created (GameObject * obj)
  2378. {
  2379. ActionParamsStruct params;
  2380. waypath_id = Get_Int_Parameter("Waypath_ID");
  2381. priority = Get_Int_Parameter("Priority");
  2382. suicide = (Get_Int_Parameter("Suicide") == 1) ? true : false;
  2383. stationary = (Get_Int_Parameter("Stationary_at_End") == 1) ? true : false;
  2384. if(waypath_id == 0)
  2385. {
  2386. Commands->Set_Innate_Is_Stationary(obj, true);
  2387. }
  2388. else if(waypath_id == 1)
  2389. {
  2390. params.Set_Basic( this, priority, GO_STAR );
  2391. params.Set_Movement( STAR, RUN, 2.0f );
  2392. Commands->Action_Goto ( obj, params );
  2393. }
  2394. else
  2395. {
  2396. params.Set_Basic( this, priority, WAYPATH );
  2397. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2398. params.WaypathID = waypath_id;
  2399. Commands->Action_Goto( obj, params );
  2400. }
  2401. if(suicide)
  2402. {
  2403. Commands->Start_Timer (obj, this, 15.0f, DIE_SURPRISE);
  2404. }
  2405. }
  2406. void Timer_Expired(GameObject* obj, int timer_id)
  2407. {
  2408. if(timer_id == DIE_SURPRISE)
  2409. {
  2410. Commands->Apply_Damage( obj, 100000, "STEEL", NULL );
  2411. Vector3 obj_pos = Commands->Get_Position(obj);
  2412. Vector3 shot_pos;
  2413. shot_pos.X = obj_pos.X + 4.0f;
  2414. shot_pos.Y = obj_pos.Y + 4.0f;
  2415. shot_pos.Z = obj_pos.Z + 4.0f;
  2416. Commands->Create_Sound("Sniper_Fire_01", shot_pos, obj);
  2417. }
  2418. }
  2419. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2420. {
  2421. if (reason != ACTION_COMPLETE_NORMAL)
  2422. {
  2423. return;
  2424. }
  2425. if (action_id == WAYPATH)
  2426. {
  2427. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  2428. if(stationary)
  2429. {
  2430. Commands->Set_Innate_Is_Stationary(obj, true);
  2431. }
  2432. }
  2433. }
  2434. };
  2435. DECLARE_SCRIPT(M08_Warden_Announcement1, "")
  2436. {
  2437. bool already_entered;
  2438. // Register variables to be Auto-Saved
  2439. // All variables must have a unique ID, less than 256, that never changes
  2440. REGISTER_VARIABLES()
  2441. {
  2442. SAVE_VARIABLE( already_entered, 1 );
  2443. }
  2444. void Created (GameObject * obj)
  2445. {
  2446. already_entered = false;
  2447. }
  2448. void Entered (GameObject * obj, GameObject * enterer)
  2449. {
  2450. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2451. {
  2452. already_entered = true;
  2453. // This is the warden, we have a probable escape situation in solitary. Full lockdown, all personnel initiate response protocols.\n
  2454. const char *conv_name = ("M08_CON006");
  2455. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2456. Commands->Join_Conversation(NULL, conv_id, false, true);
  2457. Commands->Start_Conversation (conv_id, 300502);
  2458. Commands->Monitor_Conversation (obj, conv_id);
  2459. }
  2460. }
  2461. };
  2462. DECLARE_SCRIPT(M08_Warden_Announcement2, "")
  2463. {
  2464. bool already_entered;
  2465. // Register variables to be Auto-Saved
  2466. // All variables must have a unique ID, less than 256, that never changes
  2467. REGISTER_VARIABLES()
  2468. {
  2469. SAVE_VARIABLE( already_entered, 1 );
  2470. }
  2471. void Created (GameObject * obj)
  2472. {
  2473. already_entered = false;
  2474. }
  2475. void Entered (GameObject * obj, GameObject * enterer)
  2476. {
  2477. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2478. {
  2479. already_entered = true;
  2480. // This is the warden, we have a confirmed prison break, repeat, confirmed prison break! Assume all GDI as hostile, kill every last one of them!\n
  2481. const char *conv_name = ("M08_CON007");
  2482. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2483. Commands->Join_Conversation(NULL, conv_id, false, true);
  2484. Commands->Start_Conversation (conv_id, 300502);
  2485. Commands->Monitor_Conversation (obj, conv_id);
  2486. }
  2487. }
  2488. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2489. {
  2490. ActionParamsStruct params;
  2491. if(action_id == 300502)
  2492. {
  2493. Commands->Create_Sound ( "M06_Alarm", Vector3 (0,0,0), obj);
  2494. }
  2495. }
  2496. };
  2497. DECLARE_SCRIPT(M08_Innate_Control, "")
  2498. {
  2499. // Register variables to be Auto-Saved
  2500. // All variables must have a unique ID, less than 256, that never changes
  2501. REGISTER_VARIABLES()
  2502. {
  2503. // SAVE_VARIABLE( already_entered, 1 );
  2504. }
  2505. void Created (GameObject * obj)
  2506. {
  2507. Commands->Innate_Disable(obj);
  2508. }
  2509. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2510. {
  2511. ActionParamsStruct params;
  2512. if(type == M08_INNATE_ON)
  2513. {
  2514. Commands->Innate_Enable(obj);
  2515. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  2516. }
  2517. }
  2518. };
  2519. DECLARE_SCRIPT(M08_Activate_Innate, "Unit_ID1=0:int, Unit_ID2=0:int, Unit_ID3=0:int, Unit_ID4=0:int, Unit_ID5=0:int, ")
  2520. {
  2521. bool already_entered;
  2522. // Register variables to be Auto-Saved
  2523. // All variables must have a unique ID, less than 256, that never changes
  2524. REGISTER_VARIABLES()
  2525. {
  2526. SAVE_VARIABLE( already_entered, 1 );
  2527. }
  2528. void Created (GameObject * obj)
  2529. {
  2530. already_entered = false;
  2531. }
  2532. void Entered (GameObject * obj, GameObject * enterer)
  2533. {
  2534. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2535. {
  2536. already_entered = true;
  2537. int unit_id1 = Get_Int_Parameter("Unit_ID1");
  2538. int unit_id2 = Get_Int_Parameter("Unit_ID2");
  2539. int unit_id3 = Get_Int_Parameter("Unit_ID3");
  2540. int unit_id4 = Get_Int_Parameter("Unit_ID4");
  2541. int unit_id5 = Get_Int_Parameter("Unit_ID5");
  2542. if(unit_id1 != 0)
  2543. {
  2544. Commands->Send_Custom_Event(obj, Commands->Find_Object(unit_id1), M08_INNATE_ON, 1, 0.0f);
  2545. }
  2546. if(unit_id2 != 0)
  2547. {
  2548. Commands->Send_Custom_Event(obj, Commands->Find_Object(unit_id2), M08_INNATE_ON, 1, 0.0f);
  2549. }
  2550. if(unit_id3 != 0)
  2551. {
  2552. Commands->Send_Custom_Event(obj, Commands->Find_Object(unit_id3), M08_INNATE_ON, 1, 0.0f);
  2553. }
  2554. if(unit_id4 != 0)
  2555. {
  2556. Commands->Send_Custom_Event(obj, Commands->Find_Object(unit_id4), M08_INNATE_ON, 1, 0.0f);
  2557. }
  2558. if(unit_id5 != 0)
  2559. {
  2560. Commands->Send_Custom_Event(obj, Commands->Find_Object(unit_id5), M08_INNATE_ON, 1, 0.0f);
  2561. }
  2562. }
  2563. }
  2564. };
  2565. DECLARE_SCRIPT(M08_Basketball_Court_Controller, "")
  2566. {
  2567. int m08_basketball_gun_emp_killed;
  2568. // Register variables to be Auto-Saved
  2569. // All variables must have a unique ID, less than 256, that never changes
  2570. REGISTER_VARIABLES()
  2571. {
  2572. SAVE_VARIABLE( m08_basketball_gun_emp_killed, 1 );
  2573. }
  2574. void Created (GameObject * obj)
  2575. {
  2576. m08_basketball_gun_emp_killed = 0;
  2577. // Nod Soldiers
  2578. // Commands->Enable_Spawner(100205, true);
  2579. // Commands->Enable_Spawner(100206, true);
  2580. Commands->Enable_Spawner(100207, true);
  2581. Commands->Enable_Spawner(100208, true);
  2582. }
  2583. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2584. {
  2585. ActionParamsStruct params;
  2586. if(type == M08_BASKETBALL_GUN_EMP_KILLED)
  2587. {
  2588. m08_basketball_gun_emp_killed++;
  2589. if(m08_basketball_gun_emp_killed == 1)
  2590. {
  2591. // GDI Prisoner
  2592. Commands->Enable_Spawner(100201, true);
  2593. Commands->Enable_Spawner(100202, true);
  2594. // Nod Soldiers
  2595. // Commands->Enable_Spawner(100205, false);
  2596. // Commands->Enable_Spawner(100206, false);
  2597. }
  2598. else
  2599. {
  2600. // GDI Prisoner
  2601. // Commands->Enable_Spawner(100203, true);
  2602. // Commands->Enable_Spawner(100204, true);
  2603. // Nod Soldiers
  2604. // Commands->Enable_Spawner(100207, false);
  2605. }
  2606. }
  2607. }
  2608. };
  2609. DECLARE_SCRIPT(M08_Basketball_Gun_Emp, "")
  2610. {
  2611. void Killed (GameObject * obj, GameObject * killer)
  2612. {
  2613. Commands->Send_Custom_Event(obj, Commands->Find_Object(100197), M08_BASKETBALL_GUN_EMP_KILLED, 1, 0.0f);
  2614. }
  2615. };
  2616. DECLARE_SCRIPT(M08_Homepoint, "Homepoint_ID=0:int")
  2617. {
  2618. void Created (GameObject * obj)
  2619. {
  2620. int homepoint_id = Get_Int_Parameter("Homepoint_ID");
  2621. Vector3 homepoint_loc = Commands->Get_Position(Commands->Find_Object(homepoint_id));
  2622. Commands->Set_Innate_Soldier_Home_Location(obj, homepoint_loc, 4.0f);
  2623. }
  2624. };
  2625. DECLARE_SCRIPT(M08_Nod_Buggy_Dec, "")
  2626. {
  2627. bool attacking;
  2628. enum{ATTACK_OVER};
  2629. // Register variables to be Auto-Saved
  2630. // All variables must have a unique ID, less than 256, that never changes
  2631. REGISTER_VARIABLES()
  2632. {
  2633. SAVE_VARIABLE( attacking, 1 );
  2634. }
  2635. void Created (GameObject * obj)
  2636. {
  2637. Commands->Enable_Enemy_Seen( obj, true);
  2638. attacking = false;
  2639. }
  2640. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2641. {
  2642. ActionParamsStruct params;
  2643. if(!attacking)
  2644. {
  2645. attacking = true;
  2646. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  2647. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  2648. params.AttackCheckBlocked = false;
  2649. Commands->Action_Attack( obj, params );
  2650. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2651. }
  2652. }
  2653. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2654. {
  2655. ActionParamsStruct params;
  2656. if(!attacking)
  2657. {
  2658. attacking = true;
  2659. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  2660. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  2661. params.AttackCheckBlocked = false;
  2662. Commands->Action_Attack( obj, params );
  2663. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2664. }
  2665. }
  2666. void Timer_Expired (GameObject* obj, int timer_id)
  2667. {
  2668. ActionParamsStruct params;
  2669. if(timer_id == ATTACK_OVER)
  2670. {
  2671. attacking = false;
  2672. }
  2673. }
  2674. };
  2675. DECLARE_SCRIPT(M08_Petra_A_Controller, "") //100346
  2676. {
  2677. int m08_petra_a1_unit;
  2678. int m08_petra_a2_unit;
  2679. int m08_petra_a3_unit;
  2680. int a1_last_loc;
  2681. int a2_last_loc;
  2682. int a3_last_loc;
  2683. bool petra_a_active;
  2684. bool created_vehicle;
  2685. int player_vehicle_id;
  2686. // Register variables to be Auto-Saved
  2687. // All variables must have a unique ID, less than 256, that never changes
  2688. REGISTER_VARIABLES()
  2689. {
  2690. SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  2691. SAVE_VARIABLE( m08_petra_a2_unit, 2 );
  2692. SAVE_VARIABLE( m08_petra_a3_unit, 3 );
  2693. SAVE_VARIABLE( a1_last_loc, 4 );
  2694. SAVE_VARIABLE( a2_last_loc, 5 );
  2695. SAVE_VARIABLE( a3_last_loc, 6 );
  2696. SAVE_VARIABLE( petra_a_active, 7 );
  2697. SAVE_VARIABLE( created_vehicle, 8 );
  2698. SAVE_VARIABLE( player_vehicle_id, 9 );
  2699. }
  2700. void Created(GameObject * obj)
  2701. {
  2702. m08_petra_a1_unit = 0;
  2703. m08_petra_a2_unit = 0;
  2704. m08_petra_a3_unit = 0;
  2705. a1_last_loc = 111522;
  2706. a2_last_loc = 111524;
  2707. a3_last_loc = 111526;
  2708. petra_a_active = false;
  2709. created_vehicle = false;
  2710. player_vehicle_id = 0;
  2711. }
  2712. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2713. {
  2714. if(type == M08_PETRA_A_UNIT_STATUS)
  2715. {
  2716. Commands->Send_Custom_Event(obj, sender, M08_PETRA_A_UNIT_STATUS, petra_a_active, 0.0f);
  2717. }
  2718. if(type == M08_PETRA_A_ACTIVATE && !petra_a_active)
  2719. {
  2720. petra_a_active = true;
  2721. Commands->Create_Logical_Sound(obj, M08_PETRA_A_LOGICAL, Vector3 (0,0,0), 2500.0f);
  2722. // Custom to bring in helo troop drop
  2723. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_HELO_KILLED, 1, 0.0f);
  2724. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_HELO_KILLED, 2, 1.0f);
  2725. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_HELO_KILLED, 3, 2.0f);
  2726. }
  2727. if(type == M08_PETRA_A_DEACTIVATE && petra_a_active)
  2728. {
  2729. petra_a_active = false;
  2730. Commands->Create_Logical_Sound(obj, M08_PETRA_A_LOGICAL, Vector3 (0,0,0), 2500.0f);
  2731. }
  2732. if(type == M08_PETRA_A_CREATED)
  2733. {
  2734. switch(param)
  2735. {
  2736. case 1:
  2737. {
  2738. m08_petra_a1_unit++;
  2739. }
  2740. break;
  2741. case 2:
  2742. {
  2743. m08_petra_a2_unit++;
  2744. }
  2745. break;
  2746. case 3:
  2747. {
  2748. m08_petra_a3_unit++;
  2749. }
  2750. break;
  2751. }
  2752. }
  2753. if(type == M08_PETRA_A_KILLED)
  2754. {
  2755. switch(param)
  2756. {
  2757. case 1:
  2758. {
  2759. m08_petra_a1_unit--;
  2760. }
  2761. break;
  2762. case 2:
  2763. {
  2764. m08_petra_a2_unit--;
  2765. }
  2766. break;
  2767. case 3:
  2768. {
  2769. m08_petra_a3_unit--;
  2770. }
  2771. break;
  2772. }
  2773. }
  2774. if((type == M08_PETRA_A_KILLED || type == M08_PETRA_A_HELO_KILLED) && petra_a_active)
  2775. {
  2776. switch(param)
  2777. {
  2778. case 1:
  2779. {
  2780. if(m08_petra_a1_unit == 0)
  2781. {
  2782. GameObject * drop_loc = Commands->Find_Object(111523);
  2783. float drop_facing = Commands->Get_Facing(drop_loc);
  2784. if(a1_last_loc == 111522)
  2785. {
  2786. drop_loc = Commands->Find_Object(111523);
  2787. drop_facing = Commands->Get_Facing(drop_loc);
  2788. a1_last_loc = 111523;
  2789. }
  2790. else if(a1_last_loc == 111523)
  2791. {
  2792. drop_loc = Commands->Find_Object(111522);
  2793. drop_facing = Commands->Get_Facing(drop_loc);
  2794. a1_last_loc = 111522;
  2795. }
  2796. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2797. Commands->Set_Facing(chinook_obj1, drop_facing);
  2798. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropA1.txt");
  2799. }
  2800. }
  2801. break;
  2802. case 2:
  2803. {
  2804. if(m08_petra_a2_unit == 0)
  2805. {
  2806. GameObject * drop_loc = Commands->Find_Object(111524);
  2807. float drop_facing = Commands->Get_Facing(drop_loc);
  2808. if(a2_last_loc == 111524)
  2809. {
  2810. drop_loc = Commands->Find_Object(111525);
  2811. drop_facing = Commands->Get_Facing(drop_loc);
  2812. a2_last_loc = 111525;
  2813. }
  2814. else if(a2_last_loc == 111525)
  2815. {
  2816. drop_loc = Commands->Find_Object(111524);
  2817. drop_facing = Commands->Get_Facing(drop_loc);
  2818. a2_last_loc = 111524;
  2819. }
  2820. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2821. Commands->Set_Facing(chinook_obj1, drop_facing);
  2822. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropA2.txt");
  2823. }
  2824. }
  2825. break;
  2826. case 3:
  2827. {
  2828. if(m08_petra_a3_unit == 0)
  2829. {
  2830. GameObject * drop_loc = Commands->Find_Object(111526);
  2831. float drop_facing = Commands->Get_Facing(drop_loc);
  2832. if(a3_last_loc == 111526)
  2833. {
  2834. drop_loc = Commands->Find_Object(111527);
  2835. drop_facing = Commands->Get_Facing(drop_loc);
  2836. a3_last_loc = 111527;
  2837. }
  2838. else if(a3_last_loc == 111527)
  2839. {
  2840. drop_loc = Commands->Find_Object(111522);
  2841. drop_facing = Commands->Get_Facing(drop_loc);
  2842. a3_last_loc = 111526;
  2843. }
  2844. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2845. Commands->Set_Facing(chinook_obj1, drop_facing);
  2846. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropA3.txt");
  2847. }
  2848. }
  2849. break;
  2850. }
  2851. }
  2852. }
  2853. };
  2854. DECLARE_SCRIPT(M08_Petra_A_Unit, "Unit_ID=0:int")
  2855. {
  2856. enum{GO_STAR, GO_PETRA_A};
  2857. // Register variables to be Auto-Saved
  2858. // All variables must have a unique ID, less than 256, that never changes
  2859. REGISTER_VARIABLES()
  2860. {
  2861. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  2862. }
  2863. void Created(GameObject * obj)
  2864. {
  2865. ActionParamsStruct params;
  2866. int unit_id = Get_Int_Parameter("Unit_ID");
  2867. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_CREATED, unit_id, 0.0f);
  2868. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_UNIT_STATUS, unit_id, 0.0f);
  2869. }
  2870. void Timer_Expired(GameObject * obj, int timer_id )
  2871. {
  2872. ActionParamsStruct params;
  2873. if(timer_id == GO_STAR)
  2874. {
  2875. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  2876. params.Set_Movement( STAR, RUN, 1.5f );
  2877. Commands->Action_Goto( obj, params );
  2878. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  2879. }
  2880. }
  2881. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2882. {
  2883. ActionParamsStruct params;
  2884. if(type == M08_PETRA_A_UNIT_STATUS)
  2885. {
  2886. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  2887. bool petra_a_active = (param == 1) ? true : false;
  2888. if(petra_a_active)
  2889. {
  2890. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  2891. params.Set_Movement( STAR, RUN, 1.5f );
  2892. Commands->Action_Goto( obj, params );
  2893. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  2894. }
  2895. else
  2896. {
  2897. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_PETRA_A );
  2898. params.Set_Movement( Commands->Find_Object(100346), RUN, 8.5f );
  2899. Commands->Action_Goto( obj, params );
  2900. }
  2901. }
  2902. }
  2903. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2904. {
  2905. ActionParamsStruct params;
  2906. if ( sound.Type == M08_PETRA_A_LOGICAL )
  2907. {
  2908. int unit_id = Commands->Get_ID(obj);
  2909. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_UNIT_STATUS, unit_id, 0.0f);
  2910. }
  2911. }
  2912. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2913. {
  2914. ActionParamsStruct params;
  2915. if(action_id == GO_PETRA_A && reason == ACTION_COMPLETE_NORMAL)
  2916. {
  2917. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  2918. }
  2919. }
  2920. void Killed (GameObject * obj, GameObject * killer)
  2921. {
  2922. int unit_id = Get_Int_Parameter("Unit_ID");
  2923. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_KILLED, unit_id, 0.0f);
  2924. }
  2925. };
  2926. DECLARE_SCRIPT(M08_Petra_A_Helo, "Unit_ID=0:int")
  2927. {
  2928. // Register variables to be Auto-Saved
  2929. // All variables must have a unique ID, less than 256, that never changes
  2930. REGISTER_VARIABLES()
  2931. {
  2932. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  2933. }
  2934. void Created(GameObject * obj)
  2935. {
  2936. Commands->Enable_Hibernation(obj, false);
  2937. }
  2938. void Killed (GameObject * obj, GameObject * killer)
  2939. {
  2940. int unit_id = Get_Int_Parameter("Unit_ID");
  2941. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_HELO_KILLED, unit_id, 0.0f);
  2942. }
  2943. };
  2944. DECLARE_SCRIPT(M08_Activate_Petra_A, "")
  2945. {
  2946. // Register variables to be Auto-Saved
  2947. // All variables must have a unique ID, less than 256, that never changes
  2948. REGISTER_VARIABLES()
  2949. {
  2950. // SAVE_VARIABLE( already_entered, 1 );
  2951. }
  2952. void Created (GameObject * obj)
  2953. {
  2954. }
  2955. void Entered (GameObject * obj, GameObject * enterer)
  2956. {
  2957. if (Commands->Is_A_Star(enterer))
  2958. {
  2959. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_ACTIVATE, 1, 0.0f);
  2960. }
  2961. }
  2962. };
  2963. DECLARE_SCRIPT(M08_Deactivate_Petra_A, "")
  2964. {
  2965. // Register variables to be Auto-Saved
  2966. // All variables must have a unique ID, less than 256, that never changes
  2967. REGISTER_VARIABLES()
  2968. {
  2969. // SAVE_VARIABLE( already_entered, 1 );
  2970. }
  2971. void Created (GameObject * obj)
  2972. {
  2973. }
  2974. void Entered (GameObject * obj, GameObject * enterer)
  2975. {
  2976. if (Commands->Is_A_Star(enterer))
  2977. {
  2978. Commands->Send_Custom_Event(obj, Commands->Find_Object(100346), M08_PETRA_A_DEACTIVATE, 1, 0.0f);
  2979. }
  2980. }
  2981. };
  2982. // Petra B
  2983. DECLARE_SCRIPT(M08_Petra_B_Controller, "") //100346
  2984. {
  2985. int m08_petra_b1_unit;
  2986. int m08_petra_b2_unit;
  2987. int m08_petra_b3_unit;
  2988. int b1_last_loc;
  2989. int b2_last_loc;
  2990. int b3_last_loc;
  2991. bool petra_b_active;
  2992. bool created_vehicle;
  2993. int player_vehicle_id;
  2994. // Register variables to be Auto-Saved
  2995. // All variables must have a unique ID, less than 256, that never changes
  2996. REGISTER_VARIABLES()
  2997. {
  2998. SAVE_VARIABLE( m08_petra_b1_unit, 1 );
  2999. SAVE_VARIABLE( m08_petra_b2_unit, 2 );
  3000. SAVE_VARIABLE( m08_petra_b3_unit, 3 );
  3001. SAVE_VARIABLE( b1_last_loc, 4 );
  3002. SAVE_VARIABLE( b2_last_loc, 5 );
  3003. SAVE_VARIABLE( b3_last_loc, 6 );
  3004. SAVE_VARIABLE( petra_b_active, 7 );
  3005. SAVE_VARIABLE( created_vehicle, 8 );
  3006. SAVE_VARIABLE( player_vehicle_id, 9 );
  3007. }
  3008. void Created(GameObject * obj)
  3009. {
  3010. m08_petra_b1_unit = 0;
  3011. m08_petra_b2_unit = 0;
  3012. m08_petra_b3_unit = 0;
  3013. b1_last_loc = 111753;
  3014. b2_last_loc = 111756;
  3015. b3_last_loc = 111757;
  3016. petra_b_active = false;
  3017. created_vehicle = false;
  3018. player_vehicle_id = 0;
  3019. }
  3020. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3021. {
  3022. if(type == M08_PLAYER_VEHICLE_ID)
  3023. {
  3024. player_vehicle_id = param;
  3025. }
  3026. if(type == M08_PETRA_B_UNIT_STATUS)
  3027. {
  3028. Commands->Send_Custom_Event(obj, sender, M08_PETRA_B_UNIT_STATUS, petra_b_active, 0.0f);
  3029. }
  3030. if(type == M08_PETRA_B_ACTIVATE && !petra_b_active)
  3031. {
  3032. petra_b_active = true;
  3033. Commands->Create_Logical_Sound(obj, M08_PETRA_B_LOGICAL, Vector3 (0,0,0), 2500.0f);
  3034. // Custom to bring in helo troop drop
  3035. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_HELO_KILLED, 1, 0.0f);
  3036. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_HELO_KILLED, 2, 1.0f);
  3037. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_HELO_KILLED, 3, 2.0f);
  3038. // Check if player has a vehicle, if not, create one
  3039. if(!Commands->Find_Object(109047) && !created_vehicle)
  3040. {
  3041. created_vehicle = true;
  3042. GameObject * player_vehicle = Commands->Create_Object("Nod_Stealth_Tank_Player", Vector3(145.898f, 269.404f, -14.918f));
  3043. Commands->Set_Facing(player_vehicle, 150.000f);
  3044. // Send the player vehicle id to Petra_C
  3045. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PLAYER_VEHICLE_ID, Commands->Get_ID(player_vehicle), 0.0f);
  3046. }
  3047. }
  3048. if(type == M08_PETRA_B_DEACTIVATE && petra_b_active)
  3049. {
  3050. petra_b_active = false;
  3051. Commands->Create_Logical_Sound(obj, M08_PETRA_B_LOGICAL, Vector3 (0,0,0), 2500.0f);
  3052. }
  3053. if(type == M08_PETRA_B_CREATED)
  3054. {
  3055. switch(param)
  3056. {
  3057. case 1:
  3058. {
  3059. m08_petra_b1_unit++;
  3060. }
  3061. break;
  3062. case 2:
  3063. {
  3064. m08_petra_b2_unit++;
  3065. }
  3066. break;
  3067. case 3:
  3068. {
  3069. m08_petra_b3_unit++;
  3070. }
  3071. break;
  3072. }
  3073. }
  3074. if(type == M08_PETRA_B_KILLED)
  3075. {
  3076. switch(param)
  3077. {
  3078. case 1:
  3079. {
  3080. m08_petra_b1_unit--;
  3081. }
  3082. break;
  3083. case 2:
  3084. {
  3085. m08_petra_b2_unit--;
  3086. }
  3087. break;
  3088. case 3:
  3089. {
  3090. m08_petra_b3_unit--;
  3091. }
  3092. break;
  3093. }
  3094. }
  3095. if((type == M08_PETRA_B_KILLED || type == M08_PETRA_B_HELO_KILLED) && petra_b_active)
  3096. {
  3097. switch(param)
  3098. {
  3099. case 1:
  3100. {
  3101. if(m08_petra_b1_unit == 0)
  3102. {
  3103. GameObject * drop_loc = Commands->Find_Object(111753);
  3104. float drop_facing = Commands->Get_Facing(drop_loc);
  3105. if(b1_last_loc == 111753)
  3106. {
  3107. drop_loc = Commands->Find_Object(111754);
  3108. drop_facing = Commands->Get_Facing(drop_loc);
  3109. b1_last_loc = 111754;
  3110. }
  3111. else if(b1_last_loc == 111754)
  3112. {
  3113. drop_loc = Commands->Find_Object(111753);
  3114. drop_facing = Commands->Get_Facing(drop_loc);
  3115. b1_last_loc = 111753;
  3116. }
  3117. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3118. Commands->Set_Facing(chinook_obj1, drop_facing);
  3119. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropB1.txt");
  3120. }
  3121. }
  3122. break;
  3123. case 2:
  3124. {
  3125. if(m08_petra_b2_unit == 0)
  3126. {
  3127. GameObject * drop_loc = Commands->Find_Object(111755);
  3128. float drop_facing = Commands->Get_Facing(drop_loc);
  3129. if(b2_last_loc == 111755)
  3130. {
  3131. drop_loc = Commands->Find_Object(111756);
  3132. drop_facing = Commands->Get_Facing(drop_loc);
  3133. b2_last_loc = 111756;
  3134. }
  3135. else if(b2_last_loc == 111756)
  3136. {
  3137. drop_loc = Commands->Find_Object(111755);
  3138. drop_facing = Commands->Get_Facing(drop_loc);
  3139. b2_last_loc = 111755;
  3140. }
  3141. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3142. Commands->Set_Facing(chinook_obj1, drop_facing);
  3143. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropB2.txt");
  3144. }
  3145. }
  3146. break;
  3147. case 3:
  3148. {
  3149. if(m08_petra_b3_unit == 0)
  3150. {
  3151. GameObject * drop_loc = Commands->Find_Object(111757);
  3152. float drop_facing = Commands->Get_Facing(drop_loc);
  3153. if(b3_last_loc == 111757)
  3154. {
  3155. drop_loc = Commands->Find_Object(111758);
  3156. drop_facing = Commands->Get_Facing(drop_loc);
  3157. b3_last_loc = 111758;
  3158. }
  3159. else if(b3_last_loc == 111758)
  3160. {
  3161. drop_loc = Commands->Find_Object(111757);
  3162. drop_facing = Commands->Get_Facing(drop_loc);
  3163. b3_last_loc = 111757;
  3164. }
  3165. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3166. Commands->Set_Facing(chinook_obj1, drop_facing);
  3167. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropB3.txt");
  3168. }
  3169. }
  3170. break;
  3171. }
  3172. }
  3173. }
  3174. };
  3175. DECLARE_SCRIPT(M08_Petra_B_Unit, "Unit_ID=0:int")
  3176. {
  3177. enum{GO_STAR, GO_PETRA_B};
  3178. // Register variables to be Auto-Saved
  3179. // All variables must have a unique ID, less than 256, that never changes
  3180. REGISTER_VARIABLES()
  3181. {
  3182. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  3183. }
  3184. void Created(GameObject * obj)
  3185. {
  3186. ActionParamsStruct params;
  3187. int unit_id = Get_Int_Parameter("Unit_ID");
  3188. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_CREATED, unit_id, 0.0f);
  3189. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_UNIT_STATUS, unit_id, 0.0f);
  3190. }
  3191. void Timer_Expired(GameObject * obj, int timer_id )
  3192. {
  3193. ActionParamsStruct params;
  3194. if(timer_id == GO_STAR)
  3195. {
  3196. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3197. params.Set_Movement( STAR, RUN, 1.5f );
  3198. Commands->Action_Goto( obj, params );
  3199. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  3200. }
  3201. }
  3202. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3203. {
  3204. ActionParamsStruct params;
  3205. if(type == M08_PETRA_B_UNIT_STATUS)
  3206. {
  3207. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  3208. bool petra_b_active = (param == 1) ? true : false;
  3209. if(petra_b_active)
  3210. {
  3211. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3212. params.Set_Movement( STAR, RUN, 1.5f );
  3213. Commands->Action_Goto( obj, params );
  3214. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  3215. }
  3216. else
  3217. {
  3218. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_PETRA_B );
  3219. params.Set_Movement( Commands->Find_Object(100370), RUN, 8.5f );
  3220. Commands->Action_Goto( obj, params );
  3221. }
  3222. }
  3223. }
  3224. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  3225. {
  3226. ActionParamsStruct params;
  3227. if ( sound.Type == M08_PETRA_B_LOGICAL )
  3228. {
  3229. int unit_id = Commands->Get_ID(obj);
  3230. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_UNIT_STATUS, unit_id, 0.0f);
  3231. }
  3232. }
  3233. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3234. {
  3235. ActionParamsStruct params;
  3236. if(action_id == GO_PETRA_B && reason == ACTION_COMPLETE_NORMAL)
  3237. {
  3238. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  3239. }
  3240. }
  3241. void Killed (GameObject * obj, GameObject * killer)
  3242. {
  3243. int unit_id = Get_Int_Parameter("Unit_ID");
  3244. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_KILLED, unit_id, 0.0f);
  3245. }
  3246. };
  3247. DECLARE_SCRIPT(M08_Petra_B_Helo, "Unit_ID=0:int")
  3248. {
  3249. // Register variables to be Auto-Saved
  3250. // All variables must have a unique ID, less than 256, that never changes
  3251. REGISTER_VARIABLES()
  3252. {
  3253. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  3254. }
  3255. void Created(GameObject * obj)
  3256. {
  3257. }
  3258. void Killed (GameObject * obj, GameObject * killer)
  3259. {
  3260. int unit_id = Get_Int_Parameter("Unit_ID");
  3261. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_HELO_KILLED, unit_id, 0.0f);
  3262. }
  3263. };
  3264. DECLARE_SCRIPT(M08_Activate_Petra_B, "")
  3265. {
  3266. // Register variables to be Auto-Saved
  3267. // All variables must have a unique ID, less than 256, that never changes
  3268. REGISTER_VARIABLES()
  3269. {
  3270. // SAVE_VARIABLE( already_entered, 1 );
  3271. }
  3272. void Created (GameObject * obj)
  3273. {
  3274. }
  3275. void Entered (GameObject * obj, GameObject * enterer)
  3276. {
  3277. if (Commands->Is_A_Star(enterer))
  3278. {
  3279. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_ACTIVATE, 1, 0.0f);
  3280. }
  3281. }
  3282. };
  3283. DECLARE_SCRIPT(M08_Deactivate_Petra_B, "")
  3284. {
  3285. // Register variables to be Auto-Saved
  3286. // All variables must have a unique ID, less than 256, that never changes
  3287. REGISTER_VARIABLES()
  3288. {
  3289. // SAVE_VARIABLE( already_entered, 1 );
  3290. }
  3291. void Created (GameObject * obj)
  3292. {
  3293. }
  3294. void Entered (GameObject * obj, GameObject * enterer)
  3295. {
  3296. if (Commands->Is_A_Star(enterer))
  3297. {
  3298. Commands->Send_Custom_Event(obj, Commands->Find_Object(100370), M08_PETRA_B_DEACTIVATE, 1, 0.0f);
  3299. }
  3300. }
  3301. };
  3302. // Petra C
  3303. DECLARE_SCRIPT(M08_Petra_C_Controller, "") //100389
  3304. {
  3305. int m08_petra_c1_unit;
  3306. int m08_petra_c2_unit;
  3307. int m08_petra_c3_unit;
  3308. int c1_last_loc;
  3309. int c2_last_loc;
  3310. int c3_last_loc;
  3311. bool petra_c_active;
  3312. bool created_vehicle;
  3313. int player_vehicle_id;
  3314. // Register variables to be Auto-Saved
  3315. // All variables must have a unique ID, less than 256, that never changes
  3316. REGISTER_VARIABLES()
  3317. {
  3318. SAVE_VARIABLE( m08_petra_c1_unit, 1 );
  3319. SAVE_VARIABLE( m08_petra_c2_unit, 2 );
  3320. SAVE_VARIABLE( m08_petra_c3_unit, 3 );
  3321. SAVE_VARIABLE( c1_last_loc, 4 );
  3322. SAVE_VARIABLE( c2_last_loc, 5 );
  3323. SAVE_VARIABLE( c3_last_loc, 6 );
  3324. SAVE_VARIABLE( petra_c_active, 7 );
  3325. SAVE_VARIABLE( created_vehicle, 8 );
  3326. SAVE_VARIABLE( player_vehicle_id, 9 );
  3327. }
  3328. void Created(GameObject * obj)
  3329. {
  3330. m08_petra_c1_unit = 0;
  3331. m08_petra_c2_unit = 0;
  3332. m08_petra_c3_unit = 0;
  3333. c1_last_loc = 111759;
  3334. c2_last_loc = 111761;
  3335. c3_last_loc = 111763;
  3336. petra_c_active = false;
  3337. created_vehicle = false;
  3338. player_vehicle_id = 0;
  3339. }
  3340. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3341. {
  3342. if(type == M08_PLAYER_VEHICLE_ID)
  3343. {
  3344. player_vehicle_id = param;
  3345. }
  3346. if(type == M08_PETRA_C_UNIT_STATUS)
  3347. {
  3348. Commands->Send_Custom_Event(obj, sender, M08_PETRA_C_UNIT_STATUS, petra_c_active, 0.0f);
  3349. }
  3350. if(type == M08_PETRA_C_ACTIVATE && !petra_c_active)
  3351. {
  3352. petra_c_active = true;
  3353. Commands->Create_Logical_Sound(obj, M08_PETRA_C_LOGICAL, Vector3 (0,0,0), 2500.0f);
  3354. // Custom to bring in helo troop drop
  3355. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_HELO_KILLED, 1, 0.0f);
  3356. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_HELO_KILLED, 2, 1.0f);
  3357. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_HELO_KILLED, 3, 2.0f);
  3358. }
  3359. if(type == M08_PETRA_C_DEACTIVATE && petra_c_active)
  3360. {
  3361. petra_c_active = false;
  3362. Commands->Create_Logical_Sound(obj, M08_PETRA_C_LOGICAL, Vector3 (0,0,0), 2500.0f);
  3363. }
  3364. if(type == M08_PETRA_C_CREATED)
  3365. {
  3366. switch(param)
  3367. {
  3368. case 1:
  3369. {
  3370. m08_petra_c1_unit++;
  3371. }
  3372. break;
  3373. case 2:
  3374. {
  3375. m08_petra_c2_unit++;
  3376. }
  3377. break;
  3378. case 3:
  3379. {
  3380. m08_petra_c3_unit++;
  3381. }
  3382. break;
  3383. }
  3384. }
  3385. if(type == M08_PETRA_C_KILLED)
  3386. {
  3387. switch(param)
  3388. {
  3389. case 1:
  3390. {
  3391. m08_petra_c1_unit--;
  3392. }
  3393. break;
  3394. case 2:
  3395. {
  3396. m08_petra_c2_unit--;
  3397. }
  3398. break;
  3399. case 3:
  3400. {
  3401. m08_petra_c3_unit--;
  3402. }
  3403. break;
  3404. }
  3405. }
  3406. if((type == M08_PETRA_C_KILLED || type == M08_PETRA_C_HELO_KILLED) && petra_c_active)
  3407. {
  3408. switch(param)
  3409. {
  3410. case 1:
  3411. {
  3412. if(m08_petra_c1_unit == 0)
  3413. {
  3414. GameObject * drop_loc = Commands->Find_Object(111759);
  3415. float drop_facing = Commands->Get_Facing(drop_loc);
  3416. if(c1_last_loc == 111759)
  3417. {
  3418. drop_loc = Commands->Find_Object(111760);
  3419. drop_facing = Commands->Get_Facing(drop_loc);
  3420. c1_last_loc = 111760;
  3421. }
  3422. else if(c1_last_loc == 111760)
  3423. {
  3424. drop_loc = Commands->Find_Object(111759);
  3425. drop_facing = Commands->Get_Facing(drop_loc);
  3426. c1_last_loc = 111759;
  3427. }
  3428. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3429. Commands->Set_Facing(chinook_obj1, drop_facing);
  3430. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropC1.txt");
  3431. }
  3432. }
  3433. break;
  3434. case 2:
  3435. {
  3436. if(m08_petra_c2_unit == 0)
  3437. {
  3438. GameObject * drop_loc = Commands->Find_Object(111761);
  3439. float drop_facing = Commands->Get_Facing(drop_loc);
  3440. if(c2_last_loc == 111761)
  3441. {
  3442. drop_loc = Commands->Find_Object(111762);
  3443. drop_facing = Commands->Get_Facing(drop_loc);
  3444. c2_last_loc = 111762;
  3445. }
  3446. else if(c2_last_loc == 111762)
  3447. {
  3448. drop_loc = Commands->Find_Object(111761);
  3449. drop_facing = Commands->Get_Facing(drop_loc);
  3450. c2_last_loc = 111761;
  3451. }
  3452. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3453. Commands->Set_Facing(chinook_obj1, drop_facing);
  3454. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropC2.txt");
  3455. }
  3456. }
  3457. break;
  3458. case 3:
  3459. {
  3460. if(m08_petra_c3_unit == 0)
  3461. {
  3462. GameObject * drop_loc = Commands->Find_Object(111763);
  3463. float drop_facing = Commands->Get_Facing(drop_loc);
  3464. if(c3_last_loc == 111763)
  3465. {
  3466. drop_loc = Commands->Find_Object(111764);
  3467. drop_facing = Commands->Get_Facing(drop_loc);
  3468. c3_last_loc = 111764;
  3469. }
  3470. else if(c3_last_loc == 111764)
  3471. {
  3472. drop_loc = Commands->Find_Object(111763);
  3473. drop_facing = Commands->Get_Facing(drop_loc);
  3474. c3_last_loc = 111763;
  3475. }
  3476. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  3477. Commands->Set_Facing(chinook_obj1, drop_facing);
  3478. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X8I_TroopDropC3.txt");
  3479. }
  3480. }
  3481. break;
  3482. }
  3483. }
  3484. }
  3485. };
  3486. DECLARE_SCRIPT(M08_Petra_C_Unit, "Unit_ID=0:int")
  3487. {
  3488. enum{GO_STAR, GO_PETRA_C};
  3489. // Register variables to be Auto-Saved
  3490. // All variables must have a unique ID, less than 256, that never changes
  3491. REGISTER_VARIABLES()
  3492. {
  3493. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  3494. }
  3495. void Created(GameObject * obj)
  3496. {
  3497. ActionParamsStruct params;
  3498. int unit_id = Get_Int_Parameter("Unit_ID");
  3499. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_CREATED, unit_id, 0.0f);
  3500. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_UNIT_STATUS, unit_id, 0.0f);
  3501. }
  3502. void Timer_Expired(GameObject * obj, int timer_id )
  3503. {
  3504. ActionParamsStruct params;
  3505. if(timer_id == GO_STAR)
  3506. {
  3507. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3508. params.Set_Movement( STAR, RUN, 1.5f );
  3509. Commands->Action_Goto( obj, params );
  3510. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  3511. }
  3512. }
  3513. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3514. {
  3515. ActionParamsStruct params;
  3516. if(type == M08_PETRA_C_UNIT_STATUS)
  3517. {
  3518. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  3519. bool petra_c_active = (param == 1) ? true : false;
  3520. if(petra_c_active)
  3521. {
  3522. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3523. params.Set_Movement( STAR, RUN, 1.5f );
  3524. Commands->Action_Goto( obj, params );
  3525. Commands->Start_Timer (obj, this, 20.0f, GO_STAR);
  3526. }
  3527. else
  3528. {
  3529. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_PETRA_C );
  3530. params.Set_Movement( Commands->Find_Object(100370), RUN, 8.5f );
  3531. Commands->Action_Goto( obj, params );
  3532. }
  3533. }
  3534. }
  3535. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  3536. {
  3537. ActionParamsStruct params;
  3538. if ( sound.Type == M08_PETRA_C_LOGICAL )
  3539. {
  3540. int unit_id = Commands->Get_ID(obj);
  3541. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_UNIT_STATUS, unit_id, 0.0f);
  3542. }
  3543. }
  3544. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3545. {
  3546. ActionParamsStruct params;
  3547. if(action_id == GO_PETRA_C && reason == ACTION_COMPLETE_NORMAL)
  3548. {
  3549. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  3550. }
  3551. }
  3552. void Killed (GameObject * obj, GameObject * killer)
  3553. {
  3554. int unit_id = Get_Int_Parameter("Unit_ID");
  3555. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_KILLED, unit_id, 0.0f);
  3556. }
  3557. };
  3558. DECLARE_SCRIPT(M08_Petra_C_Helo, "Unit_ID=0:int")
  3559. {
  3560. // Register variables to be Auto-Saved
  3561. // All variables must have a unique ID, less than 256, that never changes
  3562. REGISTER_VARIABLES()
  3563. {
  3564. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  3565. }
  3566. void Created(GameObject * obj)
  3567. {
  3568. }
  3569. void Killed (GameObject * obj, GameObject * killer)
  3570. {
  3571. int unit_id = Get_Int_Parameter("Unit_ID");
  3572. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_HELO_KILLED, unit_id, 0.0f);
  3573. }
  3574. };
  3575. DECLARE_SCRIPT(M08_Activate_Petra_C, "")
  3576. {
  3577. // Register variables to be Auto-Saved
  3578. // All variables must have a unique ID, less than 256, that never changes
  3579. REGISTER_VARIABLES()
  3580. {
  3581. // SAVE_VARIABLE( already_entered, 1 );
  3582. }
  3583. void Created (GameObject * obj)
  3584. {
  3585. }
  3586. void Entered (GameObject * obj, GameObject * enterer)
  3587. {
  3588. if (Commands->Is_A_Star(enterer))
  3589. {
  3590. Commands->Send_Custom_Event(obj, Commands->Find_Object(109626), M08_PETRA_C_ACTIVATE, 1, 0.0f);
  3591. }
  3592. }
  3593. };
  3594. DECLARE_SCRIPT(M08_Deactivate_Petra_C, "")
  3595. {
  3596. // Register variables to be Auto-Saved
  3597. // All variables must have a unique ID, less than 256, that never changes
  3598. REGISTER_VARIABLES()
  3599. {
  3600. // SAVE_VARIABLE( already_entered, 1 );
  3601. }
  3602. void Created (GameObject * obj)
  3603. {
  3604. }
  3605. void Entered (GameObject * obj, GameObject * enterer)
  3606. {
  3607. if (Commands->Is_A_Star(enterer))
  3608. {
  3609. Commands->Send_Custom_Event(obj, Commands->Find_Object(100389), M08_PETRA_C_DEACTIVATE, 1, 0.0f);
  3610. }
  3611. }
  3612. };
  3613. DECLARE_SCRIPT(M08_Facility_APC, "")
  3614. {
  3615. bool attacking;
  3616. int reinforce;
  3617. bool enemy_seen;
  3618. enum{WAYPATH, DROP_SOLDIERS, ATTACK_OVER};
  3619. // Register variables to be Auto-Saved
  3620. // All variables must have a unique ID, less than 256, that never changes
  3621. REGISTER_VARIABLES()
  3622. {
  3623. SAVE_VARIABLE( attacking, 1 );
  3624. SAVE_VARIABLE( reinforce, 2 );
  3625. SAVE_VARIABLE( enemy_seen, 3 );
  3626. }
  3627. void Created (GameObject * obj)
  3628. {
  3629. Commands->Enable_Enemy_Seen( obj, true);
  3630. attacking = false;
  3631. reinforce = 0;
  3632. enemy_seen = false;
  3633. }
  3634. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3635. {
  3636. ActionParamsStruct params;
  3637. if(!enemy_seen)
  3638. {
  3639. enemy_seen = true;
  3640. char param1[10];
  3641. sprintf(param1, "%d", Commands->Get_ID(obj));
  3642. Vector3 pos = Commands->Get_Position(obj);
  3643. float facing = Commands->Get_Facing(obj);
  3644. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  3645. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  3646. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  3647. GameObject * soldier1 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc1);
  3648. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  3649. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  3650. GameObject * soldier2 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc2);
  3651. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  3652. }
  3653. if(!attacking)
  3654. {
  3655. attacking = true;
  3656. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 10 );
  3657. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3658. params.AttackCheckBlocked = false;
  3659. Commands->Action_Attack( obj, params );
  3660. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3661. }
  3662. }
  3663. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3664. {
  3665. ActionParamsStruct params;
  3666. if(type == M08_REINFORCEMENT_KILLED)
  3667. {
  3668. reinforce++;
  3669. if(reinforce%2 == 0 && reinforce < 5)
  3670. {
  3671. enemy_seen = true;
  3672. char param1[10];
  3673. sprintf(param1, "%d", Commands->Get_ID(obj));
  3674. Vector3 pos = Commands->Get_Position(obj);
  3675. float facing = Commands->Get_Facing(obj);
  3676. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  3677. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  3678. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  3679. GameObject * soldier1 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc1);
  3680. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  3681. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  3682. GameObject * soldier2 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc2);
  3683. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  3684. }
  3685. }
  3686. }
  3687. void Timer_Expired(GameObject * obj, int timer_id )
  3688. {
  3689. if(timer_id == ATTACK_OVER)
  3690. {
  3691. attacking = false;
  3692. }
  3693. }
  3694. void Damaged (GameObject * obj, GameObject * damager, float amount)
  3695. {
  3696. ActionParamsStruct params;
  3697. if(!enemy_seen)
  3698. {
  3699. enemy_seen = true;
  3700. char param1[10];
  3701. sprintf(param1, "%d", Commands->Get_ID(obj));
  3702. Vector3 pos = Commands->Get_Position(obj);
  3703. float facing = Commands->Get_Facing(obj);
  3704. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  3705. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  3706. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  3707. GameObject * soldier1 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc1);
  3708. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  3709. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  3710. GameObject * soldier2 = Commands->Create_Object("Nod_MiniGunner_1Off", soldier_loc2);
  3711. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  3712. }
  3713. }
  3714. };
  3715. DECLARE_SCRIPT(M08_Patrol_Inactive, "Waypath_ID=0:int, Waypath_Loc:Vector3, Controller_ID=0:int")
  3716. {
  3717. int waypath_id;
  3718. Vector3 waypath_loc;
  3719. bool enemy_seen;
  3720. enum {WAYPATH, GO_WAYPATH, GO_STAR};
  3721. // Register variables to be Auto-Saved
  3722. // All variables must have a unique ID, less than 256, that never changes
  3723. REGISTER_VARIABLES()
  3724. {
  3725. // SAVE_VARIABLE( waypath_id, 1 );
  3726. // SAVE_VARIABLE( waypath_loc, 2 );
  3727. // SAVE_VARIABLE( enemy_seen, 3 );
  3728. }
  3729. void Created (GameObject * obj)
  3730. {
  3731. }
  3732. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3733. {
  3734. ActionParamsStruct params;
  3735. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  3736. {
  3737. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, WAYPATH );
  3738. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  3739. params.WaypathID = waypath_id;
  3740. Commands->Action_Goto( obj, params );
  3741. }
  3742. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3743. {
  3744. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  3745. }
  3746. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3747. {
  3748. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  3749. }
  3750. if(action_id == GO_STAR && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3751. {
  3752. Commands->Start_Timer(obj, this, 60.0f, GO_STAR);
  3753. }
  3754. }
  3755. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3756. {
  3757. ActionParamsStruct params;
  3758. if(type == M08_INNATE_ON)
  3759. {
  3760. // No starting units can hear footsteps until otherwise alerted
  3761. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  3762. enemy_seen = false;
  3763. waypath_id = Get_Int_Parameter("Waypath_ID");
  3764. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  3765. Commands->Set_Innate_Soldier_Home_Location(obj, waypath_loc, 4.0f);
  3766. ActionParamsStruct params;
  3767. if(waypath_id == 0)
  3768. {
  3769. Commands->Set_Innate_Is_Stationary(obj, true);
  3770. }
  3771. else if(waypath_id == 1)
  3772. {
  3773. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3774. params.Set_Movement( STAR, RUN, 1.5f );
  3775. Commands->Action_Goto( obj, params );
  3776. }
  3777. else
  3778. {
  3779. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, GO_WAYPATH );
  3780. params.Set_Movement( waypath_loc, RUN, 1.5f );
  3781. Commands->Action_Goto( obj, params );
  3782. }
  3783. }
  3784. }
  3785. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3786. {
  3787. if((Commands->Is_A_Star(enemy)) && (!enemy_seen))
  3788. {
  3789. enemy_seen = true;
  3790. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  3791. }
  3792. }
  3793. void Timer_Expired(GameObject * obj, int timer_id )
  3794. {
  3795. ActionParamsStruct params;
  3796. if(timer_id == WAYPATH)
  3797. {
  3798. params.Set_Basic( this, INNATE_PRIORITY_GUNSHOT_HEARD - 5, GO_WAYPATH );
  3799. params.Set_Movement( waypath_loc, RUN, 1.5f );
  3800. Commands->Action_Goto( obj, params );
  3801. }
  3802. if(timer_id == GO_STAR)
  3803. {
  3804. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  3805. params.Set_Movement( STAR, RUN, 1.5f );
  3806. Commands->Action_Goto( obj, params );
  3807. }
  3808. }
  3809. void Killed (GameObject * obj, GameObject * killer)
  3810. {
  3811. int controller_id = Get_Int_Parameter("Controller_ID");
  3812. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_PATROL_KILLED, 1, 0.0f);
  3813. }
  3814. };
  3815. DECLARE_SCRIPT(M08_Scientist, "Controller_ID=0:int")
  3816. {
  3817. // Register variables to be Auto-Saved
  3818. // All variables must have a unique ID, less than 256, that never changes
  3819. REGISTER_VARIABLES()
  3820. {
  3821. // SAVE_VARIABLE( waypath_id, 1 );
  3822. }
  3823. void Created (GameObject * obj)
  3824. {
  3825. }
  3826. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3827. {
  3828. ActionParamsStruct params;
  3829. if(type == M08_INNATE_ON)
  3830. {
  3831. Commands->Start_Random_Conversation(obj);
  3832. }
  3833. }
  3834. void Killed (GameObject * obj, GameObject * killer)
  3835. {
  3836. int controller_id = Get_Int_Parameter("Controller_ID");
  3837. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_SCIENTIST_KILLED, 1, 0.0f);
  3838. }
  3839. };
  3840. DECLARE_SCRIPT(M08_Observatory_Dome_Controller, "")
  3841. {
  3842. bool reinforcements;
  3843. // Register variables to be Auto-Saved
  3844. // All variables must have a unique ID, less than 256, that never changes
  3845. REGISTER_VARIABLES()
  3846. {
  3847. SAVE_VARIABLE( reinforcements, 1 );
  3848. }
  3849. void Created(GameObject * obj)
  3850. {
  3851. reinforcements = false;
  3852. }
  3853. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3854. {
  3855. ActionParamsStruct params;
  3856. if(type == M08_SCIENTIST_KILLED && reinforcements)
  3857. {
  3858. // Spawn units to pour into observatory
  3859. Commands->Enable_Spawner(100473, true);
  3860. Commands->Enable_Spawner(100474, true);
  3861. Commands->Enable_Spawner(100475, true);
  3862. Commands->Enable_Spawner(100476, true);
  3863. }
  3864. if(type == M08_REINFORCEMENTS)
  3865. {
  3866. reinforcements = (param == 1) ? true : false;
  3867. }
  3868. }
  3869. };
  3870. DECLARE_SCRIPT(M08_Reinforcements_Active, "Controller_ID=0:int")
  3871. {
  3872. // Register variables to be Auto-Saved
  3873. // All variables must have a unique ID, less than 256, that never changes
  3874. REGISTER_VARIABLES()
  3875. {
  3876. // SAVE_VARIABLE( already_entered, 1 );
  3877. }
  3878. void Created (GameObject * obj)
  3879. {
  3880. }
  3881. void Entered (GameObject * obj, GameObject * enterer)
  3882. {
  3883. if (Commands->Is_A_Star(enterer))
  3884. {
  3885. int controller_id = Get_Int_Parameter("Controller_ID");
  3886. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_REINFORCEMENTS, 1, 0.0f);
  3887. }
  3888. }
  3889. };
  3890. DECLARE_SCRIPT(M08_Reinforcements_Inactive, "Controller_ID=0:int")
  3891. {
  3892. // Register variables to be Auto-Saved
  3893. // All variables must have a unique ID, less than 256, that never changes
  3894. REGISTER_VARIABLES()
  3895. {
  3896. // SAVE_VARIABLE( already_entered, 1 );
  3897. }
  3898. void Created (GameObject * obj)
  3899. {
  3900. }
  3901. void Entered (GameObject * obj, GameObject * enterer)
  3902. {
  3903. if (Commands->Is_A_Star(enterer))
  3904. {
  3905. int controller_id = Get_Int_Parameter("Controller_ID");
  3906. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_REINFORCEMENTS, 0, 0.0f);
  3907. }
  3908. }
  3909. };
  3910. DECLARE_SCRIPT(M08_Activate_Cavern_Entrance_Truck, "")
  3911. {
  3912. bool already_entered;
  3913. // Register variables to be Auto-Saved
  3914. // All variables must have a unique ID, less than 256, that never changes
  3915. REGISTER_VARIABLES()
  3916. {
  3917. SAVE_VARIABLE( already_entered, 1 );
  3918. }
  3919. void Created (GameObject * obj)
  3920. {
  3921. already_entered = false;
  3922. }
  3923. void Entered (GameObject * obj, GameObject * enterer)
  3924. {
  3925. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3926. {
  3927. already_entered = true;
  3928. Commands->Send_Custom_Event(obj, Commands->Find_Object(100516), M08_CAVERN_ENTRANCE_TRUCK, 1);
  3929. }
  3930. }
  3931. };
  3932. DECLARE_SCRIPT(M08_Cavern_Entrance_Truck, "")
  3933. {
  3934. enum{WAYPATH};
  3935. // Register variables to be Auto-Saved
  3936. // All variables must have a unique ID, less than 256, that never changes
  3937. REGISTER_VARIABLES()
  3938. {
  3939. // SAVE_VARIABLE( already_entered, 1 );
  3940. }
  3941. void Created (GameObject * obj)
  3942. {
  3943. }
  3944. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3945. {
  3946. ActionParamsStruct params;
  3947. if(type == M08_CAVERN_ENTRANCE_TRUCK)
  3948. {
  3949. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  3950. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  3951. params.WaypathID = 100517;
  3952. params.WaypathSplined = true;
  3953. Commands->Action_Goto( obj, params );
  3954. }
  3955. }
  3956. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3957. {
  3958. ActionParamsStruct params;
  3959. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  3960. {
  3961. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  3962. }
  3963. }
  3964. };
  3965. DECLARE_SCRIPT(M08_Facility_Scientist_Inactive, "Point1_ID=0:int, Point2_ID=0:int, Point3_ID=0:int, Controller_ID=0:int")
  3966. {
  3967. int point1_id;
  3968. int point2_id;
  3969. int point3_id;
  3970. int controller_id;
  3971. bool enemy_seen;
  3972. enum {GO_POINT1, GO_POINT2, GO_POINT3, GO_POINT1A, GO_POINT2A, GO_POINT3A,
  3973. FROM_HANDS_OVER_HEAD, TO_HANDS_OVER_HEAD};
  3974. // Register variables to be Auto-Saved
  3975. // All variables must have a unique ID, less than 256, that never changes
  3976. REGISTER_VARIABLES()
  3977. {
  3978. SAVE_VARIABLE( enemy_seen, 5 );
  3979. }
  3980. void Created (GameObject * obj)
  3981. {
  3982. }
  3983. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3984. {
  3985. ActionParamsStruct params;
  3986. if(type == M08_INNATE_ON)
  3987. {
  3988. enemy_seen = false;
  3989. // No starting units can hear footsteps until otherwise alerted
  3990. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  3991. point1_id = Get_Int_Parameter("Point1_ID");
  3992. point2_id = Get_Int_Parameter("Point2_ID");
  3993. point3_id = Get_Int_Parameter("Point3_ID");
  3994. ActionParamsStruct params;
  3995. if(point1_id != 0)
  3996. {
  3997. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT1A );
  3998. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  3999. Commands->Action_Goto( obj, params );
  4000. }
  4001. }
  4002. }
  4003. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4004. {
  4005. ActionParamsStruct params;
  4006. if(reason != ACTION_COMPLETE_NORMAL)
  4007. {
  4008. Commands->Start_Timer(obj, this, 30.0f, GO_POINT1);
  4009. return;
  4010. }
  4011. // Play animation at point
  4012. if(action_id == GO_POINT1A && reason == ACTION_COMPLETE_NORMAL)
  4013. {
  4014. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT2 );
  4015. params.Set_Animation ("S_A_HUMAN.H_A_A0F0", false);
  4016. Commands->Action_Play_Animation (obj, params);
  4017. }
  4018. if(action_id == GO_POINT2A && reason == ACTION_COMPLETE_NORMAL)
  4019. {
  4020. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT3 );
  4021. params.Set_Animation ("S_A_HUMAN.H_A_A0F0", false);
  4022. Commands->Action_Play_Animation (obj, params);
  4023. }
  4024. if(action_id == GO_POINT3A && reason == ACTION_COMPLETE_NORMAL)
  4025. {
  4026. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT1 );
  4027. params.Set_Animation ("S_A_HUMAN.H_A_A0F0", false);
  4028. Commands->Action_Play_Animation (obj, params);
  4029. }
  4030. // Goto point
  4031. if(action_id == GO_POINT1 && reason == ACTION_COMPLETE_NORMAL)
  4032. {
  4033. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT1A );
  4034. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  4035. Commands->Action_Goto( obj, params );
  4036. }
  4037. if(action_id == GO_POINT2 && reason == ACTION_COMPLETE_NORMAL)
  4038. {
  4039. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT2A );
  4040. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  4041. Commands->Action_Goto( obj, params );
  4042. }
  4043. if(action_id == GO_POINT3 && reason == ACTION_COMPLETE_NORMAL)
  4044. {
  4045. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT3A );
  4046. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  4047. Commands->Action_Goto( obj, params );
  4048. }
  4049. if(action_id == TO_HANDS_OVER_HEAD && reason == ACTION_COMPLETE_NORMAL)
  4050. {
  4051. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100);
  4052. params.Set_Animation( "H_A_Host_L1b", true );
  4053. Commands->Action_Play_Animation (obj, params);
  4054. }
  4055. if(action_id == FROM_HANDS_OVER_HEAD && reason == ACTION_COMPLETE_NORMAL)
  4056. {
  4057. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT1A );
  4058. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  4059. Commands->Action_Goto( obj, params );
  4060. }
  4061. }
  4062. void Timer_Expired(GameObject * obj, int timer_id )
  4063. {
  4064. ActionParamsStruct params;
  4065. if(timer_id == GO_POINT1 && !enemy_seen)
  4066. {
  4067. enemy_seen = false;
  4068. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  4069. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_POINT1A );
  4070. params.Set_Movement( Commands->Find_Object(point1_id), RUN, 1.5f );
  4071. Commands->Action_Goto( obj, params );
  4072. }
  4073. else
  4074. {
  4075. Commands->Start_Timer(obj, this, 30.0f, GO_POINT1);
  4076. }
  4077. }
  4078. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4079. {
  4080. ActionParamsStruct params;
  4081. if((Commands->Is_A_Star(enemy)) && (!enemy_seen))
  4082. {
  4083. enemy_seen = true;
  4084. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  4085. Commands->Set_Innate_Is_Stationary(obj, true);
  4086. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, TO_HANDS_OVER_HEAD);
  4087. params.Set_Animation( "H_A_Host_L1a", false );
  4088. Commands->Action_Play_Animation (obj, params);
  4089. }
  4090. }
  4091. void Killed (GameObject * obj, GameObject * killer)
  4092. {
  4093. int controller_id = Get_Int_Parameter("Controller_ID");
  4094. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_SCIENTIST_KILLED, 1, 0.0f);
  4095. }
  4096. };
  4097. DECLARE_SCRIPT(M08_Cavern_Controller, "")
  4098. {
  4099. int cavern_unit;
  4100. bool cavern_activated;
  4101. bool first_apc;
  4102. // Register variables to be Auto-Saved
  4103. // All variables must have a unique ID, less than 256, that never changes
  4104. REGISTER_VARIABLES()
  4105. {
  4106. SAVE_VARIABLE( cavern_activated, 1 );
  4107. SAVE_VARIABLE( first_apc, 2 );
  4108. }
  4109. void Created(GameObject * obj)
  4110. {
  4111. cavern_unit = 6;
  4112. cavern_activated = false;
  4113. first_apc = true;
  4114. }
  4115. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4116. {
  4117. ActionParamsStruct params;
  4118. if (type == M08_DEACTIVATE_ENCOUNTER)
  4119. {
  4120. if(cavern_activated)
  4121. {
  4122. cavern_activated = false;
  4123. }
  4124. }
  4125. if(type == M08_SCIENTIST_KILLED)
  4126. {
  4127. cavern_unit--;
  4128. if(cavern_activated)
  4129. {
  4130. // Cavern_Reinforcements ();
  4131. }
  4132. }
  4133. if(type == M08_PATROL_KILLED)
  4134. {
  4135. cavern_unit--;
  4136. if(cavern_activated)
  4137. {
  4138. // Cavern_Reinforcements ();
  4139. }
  4140. }
  4141. if(type == M08_CUSTOM_ACTIVATE)
  4142. {
  4143. cavern_activated = true;
  4144. Commands->Enable_Spawner(100593, true);
  4145. Commands->Enable_Spawner(100592, true);
  4146. }
  4147. }
  4148. /* void Cavern_Reinforcements ()
  4149. {
  4150. if (cavern_unit < 5 && first_apc)
  4151. {
  4152. first_apc = false;
  4153. Commands->Enable_Spawner(100593, true);
  4154. Cavern_Reinforcements ();
  4155. }
  4156. else if (cavern_unit < 3 && !first_apc)
  4157. {
  4158. Commands->Enable_Spawner(100592, true);
  4159. }
  4160. }*/
  4161. };
  4162. DECLARE_SCRIPT(M08_Custom_Activate, "Controller_ID=0:int")
  4163. {
  4164. bool already_entered;
  4165. // Register variables to be Auto-Saved
  4166. // All variables must have a unique ID, less than 256, that never changes
  4167. REGISTER_VARIABLES()
  4168. {
  4169. SAVE_VARIABLE( already_entered, 1 );
  4170. }
  4171. void Created (GameObject * obj)
  4172. {
  4173. already_entered = false;
  4174. }
  4175. void Entered (GameObject * obj, GameObject * enterer)
  4176. {
  4177. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4178. {
  4179. already_entered = true;
  4180. int controller_id = Get_Int_Parameter("Controller_ID");
  4181. // Custom to activate
  4182. Commands->Send_Custom_Event(obj, Commands->Find_Object(controller_id), M08_CUSTOM_ACTIVATE, 1, 0.0f);
  4183. }
  4184. }
  4185. };
  4186. DECLARE_SCRIPT(M08_Cavern_APC, "Waypath_ID=0:int")
  4187. {
  4188. bool attacking;
  4189. int reinforce;
  4190. enum{ATTACK_OVER, DROP_SOLDIERS};
  4191. // Register variables to be Auto-Saved
  4192. // All variables must have a unique ID, less than 256, that never changes
  4193. REGISTER_VARIABLES()
  4194. {
  4195. SAVE_VARIABLE( attacking, 1 );
  4196. SAVE_VARIABLE( reinforce, 2 );
  4197. }
  4198. void Created (GameObject * obj)
  4199. {
  4200. ActionParamsStruct params;
  4201. int waypath_id = Get_Int_Parameter("Waypath_ID");
  4202. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, DROP_SOLDIERS );
  4203. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4204. params.WaypathID = waypath_id;
  4205. params.WaypathSplined = true;
  4206. Commands->Action_Goto( obj, params );
  4207. }
  4208. };
  4209. DECLARE_SCRIPT(M08_Cavern_Tunnel_APC, "")
  4210. {
  4211. bool attacking;
  4212. int reinforce;
  4213. bool enemy_seen;
  4214. enum{WAYPATH, DROP_SOLDIERS, ATTACK_OVER};
  4215. // Register variables to be Auto-Saved
  4216. // All variables must have a unique ID, less than 256, that never changes
  4217. REGISTER_VARIABLES()
  4218. {
  4219. SAVE_VARIABLE( attacking, 1 );
  4220. SAVE_VARIABLE( reinforce, 2 );
  4221. SAVE_VARIABLE( enemy_seen, 3 );
  4222. }
  4223. void Created (GameObject * obj)
  4224. {
  4225. Commands->Enable_Enemy_Seen( obj, true);
  4226. attacking = false;
  4227. reinforce = 0;
  4228. enemy_seen = false;
  4229. }
  4230. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4231. {
  4232. ActionParamsStruct params;
  4233. if(!enemy_seen)
  4234. {
  4235. enemy_seen = true;
  4236. char param1[10];
  4237. sprintf(param1, "%d", Commands->Get_ID(obj));
  4238. Vector3 pos = Commands->Get_Position(obj);
  4239. float facing = Commands->Get_Facing(obj);
  4240. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  4241. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  4242. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  4243. GameObject * soldier1 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc1);
  4244. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  4245. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  4246. GameObject * soldier2 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc2);
  4247. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  4248. }
  4249. if(!attacking)
  4250. {
  4251. attacking = true;
  4252. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 10 );
  4253. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  4254. params.AttackCheckBlocked = false;
  4255. Commands->Action_Attack( obj, params );
  4256. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  4257. }
  4258. }
  4259. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4260. {
  4261. ActionParamsStruct params;
  4262. if(type == M08_REINFORCEMENT_KILLED)
  4263. {
  4264. reinforce++;
  4265. if(reinforce%2 == 0 && reinforce < 7)
  4266. {
  4267. char param1[10];
  4268. sprintf(param1, "%d", Commands->Get_ID(obj));
  4269. Vector3 pos = Commands->Get_Position(obj);
  4270. float facing = Commands->Get_Facing(obj);
  4271. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  4272. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  4273. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  4274. GameObject * soldier1 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc1);
  4275. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  4276. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  4277. GameObject * soldier2 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc2);
  4278. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  4279. }
  4280. }
  4281. }
  4282. void Timer_Expired(GameObject * obj, int timer_id )
  4283. {
  4284. if(timer_id == ATTACK_OVER)
  4285. {
  4286. attacking = false;
  4287. }
  4288. }
  4289. void Damaged (GameObject * obj, GameObject * damager, float amount)
  4290. {
  4291. ActionParamsStruct params;
  4292. if(!enemy_seen)
  4293. {
  4294. enemy_seen = true;
  4295. char param1[10];
  4296. sprintf(param1, "%d", Commands->Get_ID(obj));
  4297. Vector3 pos = Commands->Get_Position(obj);
  4298. float facing = Commands->Get_Facing(obj);
  4299. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  4300. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  4301. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  4302. GameObject * soldier1 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc1);
  4303. Commands->Attach_Script(soldier1, "M08_APC_Soldier", param1);
  4304. Vector3 soldier_loc2 = pos + Vector3(a, (b - .5f), 0.5f);
  4305. GameObject * soldier2 = Commands->Create_Object("Nod_FlameThrower_2SF", soldier_loc2);
  4306. Commands->Attach_Script(soldier2, "M08_APC_Soldier", param1);
  4307. }
  4308. }
  4309. };
  4310. DECLARE_SCRIPT(M08_Cavern_Gun_Emplacement, "")
  4311. {
  4312. bool attacking;
  4313. enum{ATTACK_OVER};
  4314. // Register variables to be Auto-Saved
  4315. // All variables must have a unique ID, less than 256, that never changes
  4316. REGISTER_VARIABLES()
  4317. {
  4318. SAVE_VARIABLE( attacking, 1 );
  4319. }
  4320. void Created (GameObject * obj)
  4321. {
  4322. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  4323. Commands->Enable_Enemy_Seen( obj, true);
  4324. attacking = false;
  4325. }
  4326. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4327. {
  4328. ActionParamsStruct params;
  4329. if(!attacking)
  4330. {
  4331. attacking = true;
  4332. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  4333. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  4334. params.AttackCheckBlocked = false;
  4335. Commands->Action_Attack( obj, params );
  4336. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  4337. }
  4338. }
  4339. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4340. {
  4341. ActionParamsStruct params;
  4342. // Spawn buggy to patrol lower cavern
  4343. Commands->Enable_Spawner(100620, true);
  4344. if(!attacking)
  4345. {
  4346. attacking = true;
  4347. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  4348. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  4349. params.AttackCheckBlocked = false;
  4350. Commands->Action_Attack( obj, params );
  4351. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  4352. }
  4353. }
  4354. void Timer_Expired (GameObject* obj, int timer_id)
  4355. {
  4356. ActionParamsStruct params;
  4357. if(timer_id == ATTACK_OVER)
  4358. {
  4359. attacking = false;
  4360. }
  4361. }
  4362. };
  4363. DECLARE_SCRIPT(M08_Lower_Cavern_Buggy, "")
  4364. {
  4365. bool attacking;
  4366. bool in_cavern;
  4367. enum{WAYPATH, ATTACK_OVER, GO_WAYPATH};
  4368. // Register variables to be Auto-Saved
  4369. // All variables must have a unique ID, less than 256, that never changes
  4370. REGISTER_VARIABLES()
  4371. {
  4372. SAVE_VARIABLE( attacking, 1 );
  4373. SAVE_VARIABLE( in_cavern, 2 );
  4374. }
  4375. void Created (GameObject * obj)
  4376. {
  4377. Commands->Enable_Enemy_Seen( obj, true);
  4378. ActionParamsStruct params;
  4379. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_WAYPATH );
  4380. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4381. params.WaypathID = 100621;
  4382. params.WaypathSplined = true;
  4383. Commands->Action_Goto( obj, params );
  4384. attacking = false;
  4385. in_cavern = false;
  4386. }
  4387. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4388. {
  4389. ActionParamsStruct params;
  4390. if(!attacking && !in_cavern)
  4391. {
  4392. attacking = true;
  4393. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4394. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  4395. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  4396. params.WaypathID = 100631;
  4397. params.WaypathSplined = true;
  4398. Commands->Modify_Action (obj, WAYPATH, params);
  4399. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  4400. }
  4401. }
  4402. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4403. {
  4404. ActionParamsStruct params;
  4405. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  4406. {
  4407. in_cavern = true;
  4408. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4409. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4410. params.Set_Attack (STAR, 250.0f, 0.0f, 1);
  4411. params.WaypathID = 100631;
  4412. params.WaypathSplined = true;
  4413. Commands->Action_Attack( obj, params );
  4414. }
  4415. }
  4416. void Timer_Expired(GameObject * obj, int timer_id )
  4417. {
  4418. ActionParamsStruct params;
  4419. if(timer_id == ATTACK_OVER)
  4420. {
  4421. attacking = false;
  4422. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4423. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4424. params.Set_Attack (STAR, 250.0f, 0.0f, 1);
  4425. params.WaypathID = 100631;
  4426. Commands->Modify_Action (obj, WAYPATH, params);
  4427. }
  4428. }
  4429. };
  4430. DECLARE_SCRIPT(M08_Unarmed_Prisoner, "Exit_Cell_ID=0:int, Weapon_Loc_ID=0:int")
  4431. {
  4432. bool free;
  4433. enum{EXIT_CELL, WEAPONS, KEEP_TRYING};
  4434. // Register variables to be Auto-Saved
  4435. // All variables must have a unique ID, less than 256, that never changes
  4436. REGISTER_VARIABLES()
  4437. {
  4438. SAVE_VARIABLE( free, 1 );
  4439. }
  4440. void Created (GameObject * obj)
  4441. {
  4442. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  4443. Commands->Set_Innate_Is_Stationary(obj, true);
  4444. free = false;
  4445. }
  4446. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4447. {
  4448. ActionParamsStruct params;
  4449. if(action_id == WEAPONS && reason == ACTION_COMPLETE_NORMAL)
  4450. {
  4451. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  4452. Commands->Select_Weapon(obj, "Weapon_Chaingun_Ai" );
  4453. }
  4454. if(action_id == EXIT_CELL && reason == ACTION_COMPLETE_NORMAL)
  4455. {
  4456. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WEAPONS );
  4457. params.Set_Movement( Commands->Find_Object(Get_Int_Parameter("Weapon_Loc_ID")), RUN, 1.0f );
  4458. Commands->Action_Goto( obj, params );
  4459. }
  4460. if(reason == ACTION_COMPLETE_LOW_PRIORITY)
  4461. {
  4462. Commands->Start_Timer (obj, this, 1.0f, KEEP_TRYING);
  4463. }
  4464. }
  4465. void Timer_Expired(GameObject * obj, int timer_id )
  4466. {
  4467. ActionParamsStruct params;
  4468. if(timer_id == KEEP_TRYING)
  4469. {
  4470. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, EXIT_CELL );
  4471. params.Set_Movement( Commands->Find_Object(Get_Int_Parameter("Exit_Cell_ID")), RUN, 1.0f );
  4472. Commands->Action_Goto( obj, params );
  4473. }
  4474. }
  4475. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4476. {
  4477. ActionParamsStruct params;
  4478. if(type == M08_FREE_PRISONER && !free)
  4479. {
  4480. free = true;
  4481. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4482. Commands->Set_Innate_Is_Stationary(obj, false);
  4483. Commands->Grant_Key (obj, 1, true);
  4484. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, EXIT_CELL );
  4485. params.Set_Movement( Commands->Find_Object(Get_Int_Parameter("Exit_Cell_ID")), RUN, 1.0f );
  4486. Commands->Action_Goto( obj, params );
  4487. }
  4488. }
  4489. void Poked(GameObject * obj, GameObject * poker)
  4490. {
  4491. if (Commands->Is_A_Star(poker))
  4492. {
  4493. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  4494. Commands->Select_Weapon(obj, "Weapon_Chaingun_Ai" );
  4495. }
  4496. }
  4497. void Killed (GameObject * obj, GameObject * killer)
  4498. {
  4499. }
  4500. };
  4501. DECLARE_SCRIPT(M08_Free_Prisoners_Zone, "Prisoner1_ID=0:int, Prisoner2_ID=0:int, Prisoner3_ID=0:int, Prisoner4_ID=0:int")
  4502. {
  4503. bool already_entered;
  4504. // Register variables to be Auto-Saved
  4505. // All variables must have a unique ID, less than 256, that never changes
  4506. REGISTER_VARIABLES()
  4507. {
  4508. SAVE_VARIABLE( already_entered, 1 );
  4509. }
  4510. void Created (GameObject * obj)
  4511. {
  4512. already_entered = false;
  4513. }
  4514. void Entered (GameObject * obj, GameObject * enterer)
  4515. {
  4516. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4517. {
  4518. already_entered = true;
  4519. int prisoner1_id = Get_Int_Parameter("Prisoner1_ID");
  4520. int prisoner2_id = Get_Int_Parameter("Prisoner2_ID");
  4521. int prisoner3_id = Get_Int_Parameter("Prisoner3_ID");
  4522. int prisoner4_id = Get_Int_Parameter("Prisoner4_ID");
  4523. Commands->Send_Custom_Event(obj, Commands->Find_Object(prisoner1_id), M08_FREE_PRISONER, 1, 0.0f);
  4524. Commands->Send_Custom_Event(obj, Commands->Find_Object(prisoner2_id), M08_FREE_PRISONER, 1, 0.0f);
  4525. Commands->Send_Custom_Event(obj, Commands->Find_Object(prisoner3_id), M08_FREE_PRISONER, 1, 0.0f);
  4526. Commands->Send_Custom_Event(obj, Commands->Find_Object(prisoner4_id), M08_FREE_PRISONER, 1, 0.0f);
  4527. }
  4528. }
  4529. };
  4530. DECLARE_SCRIPT(M08_Sakura, "")
  4531. {
  4532. bool enemy_seen;
  4533. bool flee;
  4534. int current_waypath;
  4535. float health;
  4536. enum{WAYPATH, TO_SECOND, INITIAL, FLEE};
  4537. // Register variables to be Auto-Saved
  4538. // All variables must have a unique ID, less than 256, that never changes
  4539. REGISTER_VARIABLES()
  4540. {
  4541. SAVE_VARIABLE( enemy_seen, 1 );
  4542. SAVE_VARIABLE( flee, 2 );
  4543. SAVE_VARIABLE( current_waypath, 3 );
  4544. SAVE_VARIABLE( health, 4 );
  4545. SAVE_VARIABLE( flee, 5 );
  4546. }
  4547. void Created(GameObject * obj)
  4548. {
  4549. // Send Sakura's id to the movement zones
  4550. int sakura_id = Commands->Get_ID(obj);
  4551. Commands->Send_Custom_Event(obj, Commands->Find_Object(100356), M08_SAKURA_ID, sakura_id, 0.0f);
  4552. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4553. Commands->Enable_Enemy_Seen( obj, true);
  4554. enemy_seen = true;
  4555. ActionParamsStruct params;
  4556. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INITIAL );
  4557. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4558. params.WaypathID = 100774;
  4559. Commands->Action_Goto( obj, params );
  4560. current_waypath = 100774;
  4561. health = Commands->Get_Max_Health(obj);
  4562. flee = false;
  4563. }
  4564. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4565. {
  4566. ActionParamsStruct params;
  4567. if(!enemy_seen)
  4568. {
  4569. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4570. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4571. params.Set_Attack (enemy, 150.0f, 0.0f, 1);
  4572. params.WaypathID = current_waypath;
  4573. Commands->Modify_Action (obj, WAYPATH, params);
  4574. }
  4575. }
  4576. void Timer_Expired(GameObject * obj, int timer_id )
  4577. {
  4578. ActionParamsStruct params;
  4579. }
  4580. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4581. {
  4582. ActionParamsStruct params;
  4583. if(type == M08_MOVE_SAKURA)
  4584. {
  4585. switch(param)
  4586. {
  4587. case 2:
  4588. {
  4589. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, TO_SECOND );
  4590. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4591. params.WaypathID = 100795;
  4592. Commands->Action_Goto( obj, params );
  4593. enemy_seen = false;
  4594. }
  4595. break;
  4596. }
  4597. }
  4598. }
  4599. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4600. {
  4601. ActionParamsStruct params;
  4602. if(action_id == INITIAL)
  4603. {
  4604. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4605. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4606. params.WaypathID = 100780;
  4607. Commands->Action_Attack( obj, params );
  4608. enemy_seen = false;
  4609. current_waypath = 100780;
  4610. }
  4611. if(action_id == TO_SECOND)
  4612. {
  4613. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4614. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4615. params.WaypathID = 100800;
  4616. Commands->Action_Attack( obj, params );
  4617. enemy_seen = false;
  4618. current_waypath = 100800;
  4619. }
  4620. if(action_id == FLEE)
  4621. {
  4622. Commands->Destroy_Object(obj);
  4623. }
  4624. }
  4625. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4626. {
  4627. ActionParamsStruct params;
  4628. if((Commands->Get_Health(obj) < (.2 * Commands->Get_Max_Health(obj))) && !flee)
  4629. {
  4630. flee = true;
  4631. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 6, FLEE );
  4632. params.MovePathfind = false;
  4633. params.Set_Movement( Commands->Get_Position(Commands->Find_Object(110337)), RUN, 1.5f );
  4634. Commands->Action_Goto( obj, params );
  4635. }
  4636. if((Commands->Get_Health(obj) < (.2 * Commands->Get_Max_Health(obj))))
  4637. {
  4638. Commands->Set_Health(obj, health);
  4639. }
  4640. health = Commands->Get_Health(obj);
  4641. }
  4642. };
  4643. DECLARE_SCRIPT(M08_Activate_Sakura, "")
  4644. {
  4645. bool already_entered;
  4646. // Register variables to be Auto-Saved
  4647. // All variables must have a unique ID, less than 256, that never changes
  4648. REGISTER_VARIABLES()
  4649. {
  4650. SAVE_VARIABLE( already_entered, 1 );
  4651. }
  4652. void Created(GameObject * obj)
  4653. {
  4654. already_entered = false;
  4655. }
  4656. void Entered (GameObject * obj, GameObject * enterer)
  4657. {
  4658. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4659. {
  4660. already_entered = true;
  4661. // Spawn Sakura
  4662. Commands->Enable_Spawner(100773, true);
  4663. }
  4664. }
  4665. };
  4666. DECLARE_SCRIPT(M08_Nod_Warden, "")
  4667. {
  4668. // Register variables to be Auto-Saved
  4669. // All variables must have a unique ID, less than 256, that never changes
  4670. REGISTER_VARIABLES()
  4671. {
  4672. // SAVE_VARIABLE( already_entered, 1 );
  4673. }
  4674. void Created(GameObject * obj)
  4675. {
  4676. Commands->Innate_Disable(obj);
  4677. }
  4678. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4679. {
  4680. ActionParamsStruct params;
  4681. if(type == M08_INNATE_ON)
  4682. {
  4683. Commands->Innate_Enable(obj);
  4684. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  4685. }
  4686. }
  4687. void Killed (GameObject * obj, GameObject * killer)
  4688. {
  4689. Vector3 create_position = Commands->Get_Position( obj );
  4690. create_position.Z += 0.5f;
  4691. Commands->Create_Object( "Level_02_Keycard", create_position );
  4692. }
  4693. };
  4694. DECLARE_SCRIPT(M08_Move_Sakura, "Movement_Loc=0:int")
  4695. {
  4696. bool already_entered;
  4697. int sakura_id;
  4698. // Register variables to be Auto-Saved
  4699. // All variables must have a unique ID, less than 256, that never changes
  4700. REGISTER_VARIABLES()
  4701. {
  4702. SAVE_VARIABLE( already_entered, 1 );
  4703. SAVE_VARIABLE( sakura_id, 2 );
  4704. }
  4705. void Created(GameObject * obj)
  4706. {
  4707. sakura_id = 0;
  4708. already_entered = false;
  4709. }
  4710. void Entered (GameObject * obj, GameObject * enterer)
  4711. {
  4712. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4713. {
  4714. already_entered = true;
  4715. int movement_loc = Get_Int_Parameter("Movement_Loc");
  4716. // Custom to Sakura to move to next location in the Petra canyon
  4717. Commands->Send_Custom_Event(obj, Commands->Find_Object(sakura_id), M08_MOVE_SAKURA, movement_loc, 0.0f);
  4718. }
  4719. }
  4720. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4721. {
  4722. ActionParamsStruct params;
  4723. if(type == M08_SAKURA_ID)
  4724. {
  4725. sakura_id = param;
  4726. }
  4727. }
  4728. };
  4729. DECLARE_SCRIPT (M08_Mobile_Vehicle, "CheckBlocked=1:int, Attack_Loc0=0:int, Attack_Loc1=0:int, Attack_Loc2=0:int, Attack_Loc3=0:int, Attack_Loc4=0:int, Attack_Loc5=0:int, Attack_Loc6=0:int, Attack_Loc7=0:int, Attack_Loc8=0:int, Attack_Loc9=0:int, Attack_Loc10=0:int")
  4730. {
  4731. bool attacking;
  4732. int attack_loc [11];
  4733. float loc_dist;
  4734. int loc;
  4735. Vector3 current_loc;
  4736. Vector3 enemy_loc;
  4737. float health;
  4738. enum{ATTACK_OVER, GOTO_LOC};
  4739. // Register variables to be Auto-Saved
  4740. // All variables must have a unique ID, less than 256, that never changes
  4741. REGISTER_VARIABLES()
  4742. {
  4743. SAVE_VARIABLE( attacking, 1 );
  4744. SAVE_VARIABLE( current_loc, 4 );
  4745. SAVE_VARIABLE( enemy_loc, 5 );
  4746. SAVE_VARIABLE( loc_dist, 6 );
  4747. SAVE_VARIABLE( loc, 7 );
  4748. SAVE_VARIABLE( health, 8 );
  4749. SAVE_VARIABLE( attack_loc, 9 );
  4750. }
  4751. void Created(GameObject * obj)
  4752. {
  4753. Commands->Enable_Enemy_Seen( obj, true);
  4754. attacking = false;
  4755. attack_loc [0] = Get_Int_Parameter("Attack_Loc0");
  4756. attack_loc [1] = Get_Int_Parameter("Attack_Loc1");
  4757. attack_loc [2] = Get_Int_Parameter("Attack_Loc2");
  4758. attack_loc [3] = Get_Int_Parameter("Attack_Loc3");
  4759. attack_loc [4] = Get_Int_Parameter("Attack_Loc4");
  4760. attack_loc [5] = Get_Int_Parameter("Attack_Loc5");
  4761. attack_loc [6] = Get_Int_Parameter("Attack_Loc6");
  4762. attack_loc [7] = Get_Int_Parameter("Attack_Loc7");
  4763. attack_loc [8] = Get_Int_Parameter("Attack_Loc8");
  4764. attack_loc [9] = Get_Int_Parameter("Attack_Loc9");
  4765. attack_loc [10] = Get_Int_Parameter("Attack_Loc10");
  4766. loc_dist = 1000.0f;
  4767. loc = 100;
  4768. Commands->Start_Timer(obj, this, 1.0f, GOTO_LOC);
  4769. health = Commands->Get_Health(obj);
  4770. }
  4771. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4772. {
  4773. bool blocked;
  4774. if (Get_Int_Parameter ("CheckBlocked") != 0)
  4775. {
  4776. blocked = true;
  4777. }
  4778. else
  4779. {
  4780. blocked = false;
  4781. }
  4782. ActionParamsStruct params;
  4783. Commands->Debug_Message("Attack_Loc = %d /n", attack_loc[loc]);
  4784. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  4785. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  4786. params.Set_Attack(enemy, 100.0f, 5.0f, true);
  4787. params.AttackCheckBlocked = blocked;
  4788. Commands->Modify_Action(obj, 10, params);
  4789. }
  4790. void Timer_Expired (GameObject* obj, int timer_id)
  4791. {
  4792. if (timer_id == GOTO_LOC)
  4793. {
  4794. current_loc = Commands->Get_Position ( obj );
  4795. Vector3 star_loc = Commands->Get_Position (STAR);
  4796. for (int x = 0; x <= 10; x++)
  4797. {
  4798. if(attack_loc[x] != NULL)
  4799. {
  4800. float dist = Commands->Get_Distance(star_loc, Commands->Get_Position (Commands->Find_Object (attack_loc [x])));
  4801. if (dist < loc_dist)
  4802. {
  4803. loc_dist = dist;
  4804. loc = x;
  4805. }
  4806. }
  4807. }
  4808. loc_dist = 1000.0f;
  4809. Commands->Action_Reset(obj, 99);
  4810. ActionParamsStruct params;
  4811. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  4812. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  4813. Commands->Action_Attack(obj, params);
  4814. Commands->Start_Timer(obj, this, 5.0f, GOTO_LOC);
  4815. }
  4816. }
  4817. };
  4818. DECLARE_SCRIPT(M08_Flyover_Controller, "")
  4819. {
  4820. int last;
  4821. REGISTER_VARIABLES()
  4822. {
  4823. SAVE_VARIABLE(last, 1);
  4824. }
  4825. void Created(GameObject * obj)
  4826. {
  4827. Commands->Start_Timer(obj, this, 10.0f, 0);
  4828. last = 0;
  4829. }
  4830. void Timer_Expired(GameObject * obj, int timer_id)
  4831. {
  4832. char *flyovers[8] =
  4833. {
  4834. "X8B_Apache_00.txt",
  4835. "X8B_Apache_01.txt",
  4836. "X8B_Apache_02.txt",
  4837. "X8B_Apache_03.txt",
  4838. "X8B_Trnspt_00.txt",
  4839. "X8B_Trnspt_01.txt",
  4840. "X8B_Trnspt_02.txt",
  4841. "X8B_Trnspt_03.txt",
  4842. };
  4843. int random = Commands->Get_Random_Int ( 0, 7 );
  4844. while (random == last)
  4845. {
  4846. random = Commands->Get_Random_Int ( 0, 7 );
  4847. }
  4848. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  4849. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  4850. Commands->Start_Timer(obj, this, 10.0f, 0);
  4851. last = random;
  4852. }
  4853. };
  4854. DECLARE_SCRIPT(M08_Activate_Excavation, "")
  4855. {
  4856. bool already_entered;
  4857. // Register variables to be Auto-Saved
  4858. // All variables must have a unique ID, less than 256, that never changes
  4859. REGISTER_VARIABLES()
  4860. {
  4861. SAVE_VARIABLE( already_entered, 1 );
  4862. }
  4863. void Created (GameObject * obj)
  4864. {
  4865. already_entered = false;
  4866. }
  4867. void Entered (GameObject * obj, GameObject * enterer)
  4868. {
  4869. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4870. {
  4871. already_entered = true;
  4872. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(210.156f, 301.252f, -7.404f));
  4873. Commands->Set_Facing(chinook_obj1, 25.000f);
  4874. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M08_XG_VehicleDrop1.txt");
  4875. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(202.507f, 308.211f, -6.972f));
  4876. Commands->Set_Facing(chinook_obj2, 0.000f);
  4877. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "M08_XG_VehicleDrop1.txt");
  4878. }
  4879. }
  4880. };
  4881. DECLARE_SCRIPT(M08_Facility_Scientist, "Loc1_ID=0:int, Loc2_ID=0:int, Loc3_ID=0:int, Animation:string, Spawner_ID=0:int")
  4882. {
  4883. bool enemy_seen;
  4884. bool start_over;
  4885. enum{GO_FIRST_LOC, FACING_FIRST_LOC, ANIMATE_FIRST_LOC, GO_SECOND_LOC, FACING_SECOND_LOC, ANIMATE_SECOND_LOC,
  4886. GO_THIRD_LOC, FACING_THIRD_LOC, ANIMATE_THIRD_LOC, HANDS_OVER_HEAD, START_OVER};
  4887. // Register variables to be Auto-Saved
  4888. // All variables must have a unique ID, less than 256, that never changes
  4889. REGISTER_VARIABLES()
  4890. {
  4891. SAVE_VARIABLE( enemy_seen, 1 );
  4892. SAVE_VARIABLE( start_over, 2 );
  4893. }
  4894. void Created (GameObject * obj)
  4895. {
  4896. ActionParamsStruct params;
  4897. start_over = false;
  4898. enemy_seen = false;
  4899. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  4900. params.Set_Basic (this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_FIRST_LOC);
  4901. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
  4902. Commands->Action_Goto (obj, params);
  4903. }
  4904. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4905. {
  4906. ActionParamsStruct params;
  4907. const char *anim = Get_Parameter("Animation");
  4908. if(reason != ACTION_COMPLETE_NORMAL && action_id != Commands->Get_Action_ID(obj) && !start_over)
  4909. {
  4910. start_over = true;
  4911. Commands->Start_Timer (obj, this, 10.0f, START_OVER);
  4912. return;
  4913. }
  4914. // First Loc
  4915. if(action_id == GO_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4916. {
  4917. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_FIRST_LOC);
  4918. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc1_ID"))), 1.5f);
  4919. Commands->Action_Face_Location ( obj, params );
  4920. }
  4921. if(action_id == FACING_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4922. {
  4923. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_FIRST_LOC );
  4924. params.Set_Animation (anim, false);
  4925. Commands->Action_Play_Animation (obj, params);
  4926. }
  4927. if(action_id == ANIMATE_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4928. {
  4929. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_SECOND_LOC);
  4930. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc2_ID")), WALK, 1.5f);
  4931. Commands->Action_Goto (obj, params);
  4932. }
  4933. // Second Loc
  4934. if(action_id == GO_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4935. {
  4936. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_SECOND_LOC);
  4937. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc2_ID"))), 1.5f);
  4938. Commands->Action_Face_Location ( obj, params );
  4939. }
  4940. if(action_id == FACING_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4941. {
  4942. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_SECOND_LOC );
  4943. params.Set_Animation (anim, false);
  4944. Commands->Action_Play_Animation (obj, params);
  4945. }
  4946. if(action_id == ANIMATE_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4947. {
  4948. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_THIRD_LOC);
  4949. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc3_ID")), WALK, 1.5f);
  4950. Commands->Action_Goto (obj, params);
  4951. }
  4952. // Third Loc
  4953. if(action_id == GO_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4954. {
  4955. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_THIRD_LOC);
  4956. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc3_ID"))), 1.5f);
  4957. Commands->Action_Face_Location ( obj, params );
  4958. }
  4959. if(action_id == FACING_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4960. {
  4961. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_THIRD_LOC );
  4962. params.Set_Animation (anim, false);
  4963. Commands->Action_Play_Animation (obj, params);
  4964. }
  4965. if(action_id == ANIMATE_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4966. {
  4967. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_FIRST_LOC);
  4968. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
  4969. Commands->Action_Goto (obj, params);
  4970. }
  4971. if(action_id == HANDS_OVER_HEAD && reason == ACTION_COMPLETE_NORMAL)
  4972. {
  4973. // In hands over head anim
  4974. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  4975. params.Set_Animation( "H_A_HOST_L1B", true );
  4976. Commands->Action_Play_Animation (obj, params);
  4977. }
  4978. }
  4979. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4980. {
  4981. ActionParamsStruct params;
  4982. Commands->Create_Logical_Sound(obj, SOUND_TYPE_GUNSHOT, Commands->Get_Position(obj), 8.0f);
  4983. if(!enemy_seen)
  4984. {
  4985. // Help! Intruder! Help!\n
  4986. const char *conv_name = ("M08_CON008");
  4987. int conv_id = Commands->Create_Conversation (conv_name);
  4988. Commands->Join_Conversation(obj, conv_id, false, true);
  4989. Commands->Start_Conversation (conv_id, 1010211);
  4990. // Assume hands over head anim
  4991. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, HANDS_OVER_HEAD);
  4992. params.Set_Animation( "H_A_HOST_L1A", false );
  4993. Commands->Action_Play_Animation (obj, params);
  4994. enemy_seen = true;
  4995. }
  4996. }
  4997. void Killed (GameObject * obj, GameObject * killer)
  4998. {
  4999. // Spawn stealth soldier to come after STAR
  5000. int spawner_id = Get_Int_Parameter("Spawner_ID");
  5001. Commands->Enable_Spawner(spawner_id, true);
  5002. }
  5003. };
  5004. DECLARE_SCRIPT(M08_Apache_Controller, "")
  5005. {
  5006. bool active;
  5007. int area;
  5008. bool destroyed[3];
  5009. int apache_id[3];
  5010. int attacking_apache;
  5011. REGISTER_VARIABLES()
  5012. {
  5013. SAVE_VARIABLE(active, 1);
  5014. SAVE_VARIABLE(area, 2);
  5015. SAVE_VARIABLE(destroyed, 3);
  5016. SAVE_VARIABLE(apache_id, 4);
  5017. SAVE_VARIABLE(attacking_apache, 5);
  5018. }
  5019. void Created(GameObject * obj)
  5020. {
  5021. active = false;
  5022. attacking_apache = 0;
  5023. area = -1;
  5024. destroyed[0] = destroyed[1] = destroyed[2] = false;
  5025. //apache_id[0] = Commands->Get_ID(Commands->Create_Object("Nod_Apache_No_Idle", Vector3(-12.129f, -149.546f, 2.949f)));
  5026. //GameObject * apache = Commands->Find_Object(apache_id[0]);
  5027. //Commands->Attach_Script(apache, "M10_Apache", "0");
  5028. apache_id[1] = Commands->Get_ID(Commands->Create_Object("Nod_Apache", Vector3(-45.993f, -66.675f, 12.382f)));
  5029. GameObject * apache = Commands->Find_Object(apache_id[1]);
  5030. Commands->Attach_Script(apache, "M08_Apache", "1");
  5031. Commands->Send_Custom_Event(Owner(), apache, 400, 400);
  5032. }
  5033. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5034. {
  5035. if (param < -1 || param > 2)
  5036. {
  5037. return;
  5038. }
  5039. if (type == 1000)
  5040. {
  5041. destroyed[param] = true;
  5042. if (Commands->Find_Object(apache_id[param]))
  5043. {
  5044. Commands->Send_Custom_Event(obj, Commands->Find_Object(apache_id[param]), 300, 300);
  5045. }
  5046. }
  5047. if (type == 2000)
  5048. {
  5049. apache_id[param] = 0;
  5050. if (!destroyed[param])
  5051. {
  5052. Commands->Start_Timer(obj, this, 40.0f, param);
  5053. }
  5054. else
  5055. {
  5056. }
  5057. }
  5058. if (type == 3000)
  5059. {
  5060. if (param == area)
  5061. {
  5062. return;
  5063. }
  5064. if (area > -1)
  5065. {
  5066. Return_To_Helipad(area);
  5067. }
  5068. area = param;
  5069. if (area > -1)
  5070. {
  5071. Attack_Player(area);
  5072. }
  5073. }
  5074. if (type == 4000)
  5075. {
  5076. if (area == param)
  5077. {
  5078. Commands->Send_Custom_Event(obj, sender, 100, 100);
  5079. attacking_apache = area;
  5080. }
  5081. }
  5082. if (type == 5000)
  5083. {
  5084. Reload_At_Helipad(area);
  5085. Commands->Start_Timer(obj, this, 25.0f, 10 + area);
  5086. }
  5087. }
  5088. void Return_To_Helipad(int current_area)
  5089. {
  5090. GameObject * apache = Commands->Find_Object(apache_id[current_area]);
  5091. if (apache)
  5092. {
  5093. Commands->Send_Custom_Event(Owner(), apache, 200, 200);
  5094. }
  5095. }
  5096. void Reload_At_Helipad(int current_area)
  5097. {
  5098. GameObject * apache = Commands->Find_Object(apache_id[current_area]);
  5099. if (apache)
  5100. {
  5101. Commands->Send_Custom_Event(Owner(), apache, 500, 500);
  5102. }
  5103. }
  5104. void Attack_Player(int current_area)
  5105. {
  5106. GameObject * apache = Commands->Find_Object(apache_id[area]);
  5107. if (apache)
  5108. {
  5109. Commands->Send_Custom_Event(Owner(), apache, 100, 100);
  5110. attacking_apache = area;
  5111. }
  5112. }
  5113. void Replace_Apache(int current_area)
  5114. {
  5115. Vector3 start_loc;
  5116. start_loc.Set(-45.993f, -66.675f, 12.382f);
  5117. GameObject * apache = Commands->Create_Object("Nod_Apache_No_Idle", start_loc);
  5118. Commands->Enable_Engine(apache, true);
  5119. char param[10];
  5120. sprintf(param, "%d", current_area);
  5121. Commands->Attach_Script(apache, "M08_Apache", param);
  5122. Commands->Send_Custom_Event(Owner(), apache, 400, 400);
  5123. apache_id[current_area] = Commands->Get_ID(apache);
  5124. }
  5125. void Timer_Expired(GameObject * obj, int timer_id)
  5126. {
  5127. if (timer_id >= 10)
  5128. {
  5129. int current_area = timer_id - 10;
  5130. if (current_area == area)
  5131. {
  5132. GameObject * apache = Commands->Find_Object(apache_id[area]);
  5133. if (apache)
  5134. {
  5135. Commands->Send_Custom_Event(Owner(), apache, 100, 100);
  5136. attacking_apache = area;
  5137. }
  5138. }
  5139. return;
  5140. }
  5141. if (!destroyed[timer_id])
  5142. {
  5143. Replace_Apache(timer_id);
  5144. }
  5145. else
  5146. {
  5147. }
  5148. }
  5149. };
  5150. DECLARE_SCRIPT(M08_Apache, "Area:int")
  5151. {
  5152. bool on_pad, pad_destroyed;
  5153. int my_area;
  5154. REGISTER_VARIABLES()
  5155. {
  5156. SAVE_VARIABLE(on_pad, 1);
  5157. SAVE_VARIABLE(my_area, 2);
  5158. SAVE_VARIABLE(pad_destroyed, 3);
  5159. }
  5160. void Created(GameObject * obj)
  5161. {
  5162. //Commands->Enable_Vehicle_Transitions ( obj, false );
  5163. Commands->Enable_Hibernation(obj, false);
  5164. on_pad = true;
  5165. pad_destroyed = false;
  5166. my_area = Get_Int_Parameter("Area");
  5167. }
  5168. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5169. {
  5170. if (type == 100 && param == 100)
  5171. {
  5172. on_pad = false;
  5173. ActionParamsStruct params;
  5174. params.Set_Basic(this, 90, 0);
  5175. Vector3 pos = Commands->Get_Position(obj);
  5176. pos.Z += 10.0f;
  5177. params.Set_Movement(pos, 1.0f, 1.0f);
  5178. Commands->Action_Goto(obj, params);
  5179. }
  5180. if (type == 200 && param == 200)
  5181. {
  5182. int pad_obj = 106339;
  5183. ActionParamsStruct params;
  5184. params.Set_Basic(this, 90, 2);
  5185. params.Set_Movement(Commands->Find_Object(pad_obj), 1.0f, 0.1f);
  5186. Commands->Action_Goto(obj, params);
  5187. }
  5188. if (type == 300 && param == 300)
  5189. {
  5190. pad_destroyed = true;
  5191. if (on_pad)
  5192. {
  5193. Commands->Apply_Damage(obj, 10000.0f, "EXPLOSIVE");
  5194. }
  5195. }
  5196. if (type == 400 && param == 400)
  5197. {
  5198. int waypath = 100322;
  5199. ActionParamsStruct params;
  5200. params.Set_Basic(this, 90, 2);
  5201. params.Set_Movement(Vector3(0,0,0), 1.0f, 1.0f);
  5202. params.WaypathID = waypath;
  5203. Commands->Action_Goto(obj, params);
  5204. }
  5205. if (type == 500 && param == 500)
  5206. {
  5207. int pad_obj = 106339;
  5208. ActionParamsStruct params;
  5209. params.Set_Basic(this, 91, 3);
  5210. params.Set_Movement(Commands->Find_Object(pad_obj), 1.0f, 0.1f);
  5211. Commands->Action_Goto(obj, params);
  5212. }
  5213. }
  5214. void Timer_Expired(GameObject * obj, int timer_id)
  5215. {
  5216. if (timer_id == 0)
  5217. {
  5218. Vector3 pos = Commands->Get_Position(STAR);
  5219. float facing = Commands->Get_Facing(STAR);
  5220. pos.X -= cos(DEG_TO_RADF(facing)) * 6.0f;
  5221. pos.Y -= sin(DEG_TO_RADF(facing)) * 6.0f;
  5222. pos.Z = WWMath::Max(pos.Z + 12.0f, Commands->Get_Safe_Flight_Height(pos.X, pos.Y) + 6.0f);
  5223. ActionParamsStruct params;
  5224. params.Set_Basic(this, 90, 1);
  5225. params.Set_Movement(pos, 1.0f, 5.0f);
  5226. Commands->Action_Goto(obj, params);
  5227. }
  5228. if (timer_id == 1)
  5229. {
  5230. if (!pad_destroyed && on_pad)
  5231. {
  5232. if (Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  5233. {
  5234. Commands->Set_Health(obj, Commands->Get_Health(obj) + 5.0f);
  5235. }
  5236. Commands->Start_Timer(obj, this, 3.0f, 1);
  5237. }
  5238. }
  5239. if (timer_id == 2)
  5240. {
  5241. Commands->Action_Reset(obj, 90);
  5242. Commands->Start_Timer(obj, this, Commands->Get_Random(1.0f, 3.0f), 0);
  5243. }
  5244. if (timer_id == 3)
  5245. {
  5246. GameObject * controller = Commands->Find_Object(106339);
  5247. if (controller)
  5248. {
  5249. Commands->Send_Custom_Event(obj, controller, 5000, Get_Int_Parameter("Area"));
  5250. }
  5251. }
  5252. if (timer_id == 4)
  5253. {
  5254. Commands->Enable_Engine(obj, false);
  5255. }
  5256. }
  5257. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5258. {
  5259. if (reason != ACTION_COMPLETE_NORMAL)
  5260. {
  5261. return;
  5262. }
  5263. if (action_id == 0)
  5264. {
  5265. Commands->Start_Timer(obj, this, 2.0f, 0);
  5266. Commands->Start_Timer(obj, this, 60.0f, 3);
  5267. }
  5268. if (action_id == 1)
  5269. {
  5270. ActionParamsStruct params;
  5271. params.Set_Basic(this, 90, 2);
  5272. params.Set_Attack(STAR, 150.0f, 2.0f, true);
  5273. Commands->Action_Attack(obj, params);
  5274. Commands->Start_Timer(obj, this, Commands->Get_Random(4.0f, 6.0f), 2);
  5275. }
  5276. if (action_id == 2)
  5277. {
  5278. Commands->Start_Timer(obj, this, 1.0f, 4);
  5279. on_pad = true;
  5280. Commands->Start_Timer(obj, this, 5.0f, 1);
  5281. GameObject * controller = Commands->Find_Object(106339);
  5282. if (controller)
  5283. {
  5284. Commands->Send_Custom_Event(obj, controller, 4000, Get_Int_Parameter("Area"));
  5285. }
  5286. }
  5287. if (action_id == 3)
  5288. {
  5289. Commands->Start_Timer(obj, this, 1.0f, 4);
  5290. on_pad = true;
  5291. Commands->Start_Timer(obj, this, 5.0f, 1);
  5292. }
  5293. }
  5294. void Killed(GameObject * obj, GameObject * killer)
  5295. {
  5296. GameObject * controller = Commands->Find_Object(106339);
  5297. if (controller)
  5298. {
  5299. Commands->Send_Custom_Event(obj, controller, 2000, Get_Int_Parameter("Area"));
  5300. }
  5301. }
  5302. };
  5303. DECLARE_SCRIPT(M08_Mobile_Apache, "Entrance_Path_ID=0:int, Helipad_ID=0:int")
  5304. {
  5305. enum {ENTRANCE, GO_STAR, MOVE_TO_STAR, AIRBORNE, GO_HELIPAD, ARRIVED_HELIPAD, FLEE};
  5306. REGISTER_VARIABLES()
  5307. {
  5308. // SAVE_VARIABLE(on_pad, 1);
  5309. }
  5310. void Created(GameObject * obj)
  5311. {
  5312. Commands->Enable_Hibernation(obj, false);
  5313. ActionParamsStruct params;
  5314. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ENTRANCE );
  5315. params.MovePathfind = false;
  5316. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  5317. params.WaypathID = Get_Int_Parameter("Entrance_Path_ID");
  5318. Commands->Action_Goto( obj, params );
  5319. }
  5320. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5321. {
  5322. if(reason != ACTION_COMPLETE_NORMAL)
  5323. {
  5324. Commands->Start_Timer (obj, this, 2.0f, MOVE_TO_STAR);
  5325. return;
  5326. }
  5327. if(action_id == ENTRANCE)
  5328. {
  5329. Go_Star(obj);
  5330. Commands->Start_Timer (obj, this, 60.0f, GO_HELIPAD);
  5331. }
  5332. if(action_id == GO_STAR)
  5333. {
  5334. ActionParamsStruct params;
  5335. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 2);
  5336. params.MovePathfind = false;
  5337. params.Set_Attack(STAR, 150.0f, 2.0f, true);
  5338. Commands->Action_Attack(obj, params);
  5339. Commands->Start_Timer (obj, this, 2.0f, MOVE_TO_STAR);
  5340. }
  5341. if(action_id == ARRIVED_HELIPAD)
  5342. {
  5343. Commands->Enable_Engine(obj, false);
  5344. Commands->Start_Timer (obj, this, 5.0f, AIRBORNE);
  5345. }
  5346. if(action_id == FLEE)
  5347. {
  5348. Commands->Destroy_Object(obj);
  5349. }
  5350. }
  5351. void Timer_Expired(GameObject * obj, int timer_id )
  5352. {
  5353. ActionParamsStruct params;
  5354. if(timer_id == MOVE_TO_STAR)
  5355. {
  5356. Go_Star(obj);
  5357. }
  5358. if(timer_id == GO_HELIPAD)
  5359. {
  5360. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 6, ARRIVED_HELIPAD);
  5361. params.MovePathfind = false;
  5362. params.Set_Movement(Commands->Find_Object(Get_Int_Parameter("Helipad_ID")), 1.0f, 0.1f);
  5363. Commands->Action_Goto(obj, params);
  5364. }
  5365. if(timer_id == AIRBORNE)
  5366. {
  5367. Commands->Enable_Engine(obj, true);
  5368. Commands->Start_Timer (obj, this, 2.0f, MOVE_TO_STAR);
  5369. Commands->Start_Timer (obj, this, 60.0f, GO_HELIPAD);
  5370. }
  5371. }
  5372. void Go_Star(GameObject * obj)
  5373. {
  5374. Vector3 pos = Commands->Get_Position(STAR);
  5375. float facing = Commands->Get_Facing(STAR);
  5376. pos.X -= cos(DEG_TO_RADF(facing)) * 6.0f;
  5377. pos.Y -= sin(DEG_TO_RADF(facing)) * 6.0f;
  5378. pos.Z = WWMath::Max(pos.Z + 12.0f, Commands->Get_Safe_Flight_Height(pos.X, pos.Y) + 6.0f);
  5379. ActionParamsStruct params;
  5380. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_STAR);
  5381. params.MovePathfind = false;
  5382. params.Set_Movement(pos, 1.0f, 5.0f);
  5383. Commands->Action_Goto(obj, params);
  5384. }
  5385. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  5386. {
  5387. ActionParamsStruct params;
  5388. if ( sound.Type == M08_HELIPAD_DESTROYED )
  5389. {
  5390. Vector3 pos = Commands->Get_Position(obj);
  5391. pos.Z = pos.Z + 300.0f;
  5392. params.Set_Basic(this, 100, FLEE);
  5393. params.MovePathfind = false;
  5394. params.Set_Movement(pos, 1.0f, 5.0f);
  5395. Commands->Action_Goto(obj, params);
  5396. }
  5397. }
  5398. };
  5399. DECLARE_SCRIPT(M08_Mutant_Behavior, "")
  5400. {
  5401. bool freed;
  5402. enum {DOING_ANIMATION, GO_STAR};
  5403. REGISTER_VARIABLES()
  5404. {
  5405. SAVE_VARIABLE(freed, 1);
  5406. }
  5407. void Created(GameObject * obj)
  5408. {
  5409. // Commands->Innate_Disable(obj);
  5410. ActionParamsStruct params;
  5411. params.Set_Basic( this, 99, DOING_ANIMATION );
  5412. params.Set_Animation ("S_C_HUMAN.H_C_7001", true);
  5413. Commands->Action_Play_Animation (obj, params);
  5414. freed = false;
  5415. }
  5416. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  5417. {
  5418. ActionParamsStruct params;
  5419. if(type == M08_INNATE_ON && !freed)
  5420. {
  5421. ActionParamsStruct params;
  5422. params.Set_Basic( this, 99, DOING_ANIMATION );
  5423. params.Set_Animation ("S_C_HUMAN.H_C_7001", false);
  5424. Commands->Action_Play_Animation (obj, params);
  5425. //Commands->Innate_Enable(obj);
  5426. //params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  5427. //params.Set_Movement( STAR, RUN, 1.5f );
  5428. //Commands->Action_Goto( obj, params );
  5429. //freed = true;
  5430. }
  5431. }
  5432. };
  5433. DECLARE_SCRIPT(M08_Free_Jailed_Mutants, "")
  5434. {
  5435. REGISTER_VARIABLES()
  5436. {
  5437. // SAVE_VARIABLE(on_pad, 1);
  5438. }
  5439. void Created(GameObject * obj)
  5440. {
  5441. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  5442. }
  5443. void Poked(GameObject * obj, GameObject * poker)
  5444. {
  5445. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  5446. Commands->Grant_Key (STAR, 10, true);
  5447. Commands->Send_Custom_Event(obj, Commands->Find_Object(106816), M08_INNATE_ON, 1, 0.0f);
  5448. Commands->Send_Custom_Event(obj, Commands->Find_Object(106818), M08_INNATE_ON, 1, 0.0f);
  5449. Commands->Send_Custom_Event(obj, Commands->Find_Object(106819), M08_INNATE_ON, 1, 0.0f);
  5450. }
  5451. };
  5452. DECLARE_SCRIPT(M08_Activate_Midtro, "")
  5453. {
  5454. bool already_entered;
  5455. // Register variables to be Auto-Saved
  5456. // All variables must have a unique ID, less than 256, that never changes
  5457. REGISTER_VARIABLES()
  5458. {
  5459. SAVE_VARIABLE( already_entered, 1 );
  5460. }
  5461. void Created (GameObject * obj)
  5462. {
  5463. already_entered = false;
  5464. }
  5465. void Entered (GameObject * obj, GameObject * enterer)
  5466. {
  5467. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5468. {
  5469. already_entered = true;
  5470. Commands->Set_Position (STAR, Commands->Get_Position(Commands->Find_Object(111994)));
  5471. //Commands->Static_Anim_Phys_Goto_Last_Frame (1450630, "res_elev06.res_elev06" );
  5472. //Commands->Set_Animation_Frame ( Commands->Find_Object (1450630), "res_elev06.res_elev06", 51 );
  5473. GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  5474. Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X8A_MIDTRO.txt");
  5475. }
  5476. }
  5477. };
  5478. DECLARE_SCRIPT(M08_Prisoner_Conversation, "Orator_ID=0:int, Captive=0:int")
  5479. {
  5480. bool already_entered;
  5481. // Register variables to be Auto-Saved
  5482. // All variables must have a unique ID, less than 256, that never changes
  5483. REGISTER_VARIABLES()
  5484. {
  5485. SAVE_VARIABLE( already_entered, 1 );
  5486. }
  5487. void Created (GameObject * obj)
  5488. {
  5489. already_entered = false;
  5490. }
  5491. void Entered (GameObject * obj, GameObject * enterer)
  5492. {
  5493. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5494. {
  5495. already_entered = true;
  5496. int orator_id = Get_Int_Parameter("Orator_ID");
  5497. bool captive = (Get_Int_Parameter("Captive") == 1) ? true : false;
  5498. if(Commands->Find_Object(orator_id))
  5499. {
  5500. if(captive)
  5501. {
  5502. // Save us!\n
  5503. const char *conv_name = ("M08_CON010");
  5504. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5505. Commands->Join_Conversation(Commands->Find_Object(orator_id), conv_id, false, true);
  5506. Commands->Start_Conversation (conv_id, 2);
  5507. }
  5508. else
  5509. {
  5510. // It's the Commando!\n
  5511. const char *conv_name = ("M08_CON009");
  5512. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5513. Commands->Join_Conversation(Commands->Find_Object(orator_id), conv_id, false, true);
  5514. Commands->Start_Conversation (conv_id, 2);
  5515. }
  5516. }
  5517. }
  5518. }
  5519. };
  5520. DECLARE_SCRIPT (M08_Elevator_Movement_Zone, "Direction:int, Anim_num:int, Elev_obj_num:int")
  5521. {
  5522. void Entered (GameObject * obj, GameObject * enterer)
  5523. {
  5524. char *elevators[1] =
  5525. {
  5526. "res_elev06.res_elev06",
  5527. };
  5528. if (enterer == STAR)
  5529. {
  5530. Commands->Attach_Script(STAR, "M00_No_Falling_Damage_DME", "");
  5531. GameObject * blocker = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-100.952F, 483.541F, -155.645F));
  5532. Commands->Set_Is_Rendered(blocker, false);
  5533. int elev_obj_num = Get_Int_Parameter("Elev_obj_num");
  5534. if (Get_Int_Parameter("Direction") == 0)
  5535. {
  5536. Commands->Static_Anim_Phys_Goto_Frame (elev_obj_num, 0, elevators [Get_Int_Parameter("Anim_num")] );
  5537. }
  5538. if (Get_Int_Parameter("Direction") == 1)
  5539. {
  5540. Commands->Static_Anim_Phys_Goto_Last_Frame (elev_obj_num, elevators [Get_Int_Parameter("Anim_num")] );
  5541. }
  5542. }
  5543. }
  5544. };
  5545. DECLARE_SCRIPT (M08_Immortal_Star_DLS, "")
  5546. {
  5547. float health;
  5548. bool immortal;
  5549. // Register variables to be Auto-Saved
  5550. // All variables must have a unique ID, less than 256, that never changes
  5551. REGISTER_VARIABLES()
  5552. {
  5553. SAVE_VARIABLE( health, 1 );
  5554. SAVE_VARIABLE( immortal, 2 );
  5555. }
  5556. void Created (GameObject * obj)
  5557. {
  5558. health = Commands->Get_Health(obj);
  5559. immortal = true;
  5560. }
  5561. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5562. {
  5563. if ( type == M08_STAR_IMMORTAL )
  5564. {
  5565. immortal = param ? true : false;
  5566. }
  5567. }
  5568. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5569. {
  5570. if(immortal)
  5571. {
  5572. Commands->Set_Health(obj, health);
  5573. }
  5574. }
  5575. };
  5576. DECLARE_SCRIPT(M08_Enable_Stealth, "On=1:int")
  5577. {
  5578. void Created (GameObject * obj)
  5579. {
  5580. bool on = (Get_Int_Parameter("On")) ? true : false;
  5581. if(on)
  5582. {
  5583. Commands->Enable_Stealth(obj, true);
  5584. }
  5585. else
  5586. {
  5587. Commands->Enable_Stealth(obj, false);
  5588. }
  5589. }
  5590. };
  5591. #define PRISONER_CONV_TABLE_SIZE ( sizeof(Prisoner_Conv_Table) / sizeof (Prisoner_Conv_Table[0]) )
  5592. const char * Prisoner_Conv_Table[] =
  5593. {
  5594. "M08_CON011", //GCP1
  5595. "M08_CON012",
  5596. "M08_CON013",
  5597. "M08_CON014",
  5598. "M08_CON015",
  5599. "M08_CON016",
  5600. "M08_CON017",
  5601. "M08_CON018",
  5602. "M08_CON019",
  5603. "M08_CON020", // [9]
  5604. "M08_CON021", //GCP2
  5605. "M08_CON022",
  5606. "M08_CON023",
  5607. "M08_CON024",
  5608. "M08_CON025",
  5609. "M08_CON026",
  5610. "M08_CON027",
  5611. "M08_CON028",
  5612. "M08_CON029",
  5613. "M08_CON030", // [19]
  5614. "M08_CON031", //GCP3
  5615. "M08_CON032",
  5616. "M08_CON033",
  5617. "M08_CON034",
  5618. "M08_CON035",
  5619. "M08_CON036",
  5620. "M08_CON037",
  5621. "M08_CON038",
  5622. "M08_CON039",
  5623. "M08_CON040" // [29]
  5624. };
  5625. DECLARE_SCRIPT(M08_Prisoner_Poke_Conversation, "")
  5626. {
  5627. int random;
  5628. int last;
  5629. bool conversation;
  5630. enum{CONVERSATION};
  5631. // Register variables to be Auto-Saved
  5632. // All variables must have a unique ID, less than 256, that never changes
  5633. REGISTER_VARIABLES()
  5634. {
  5635. SAVE_VARIABLE( random, 1 );
  5636. SAVE_VARIABLE( last, 2 );
  5637. SAVE_VARIABLE( conversation, 3 );
  5638. }
  5639. void Created (GameObject * obj)
  5640. {
  5641. random = Commands->Get_Random_Int(0, PRISONER_CONV_TABLE_SIZE);
  5642. conversation = false;
  5643. }
  5644. void Poked(GameObject * obj, GameObject * poker)
  5645. {
  5646. if(conversation)
  5647. {
  5648. return;
  5649. }
  5650. conversation = true;
  5651. const char * preset_name = Commands->Get_Preset_Name( obj );
  5652. if((::strncmp( "GDI_Prisoner_v0a", preset_name, ::strlen( "GDI_Prisoner_v0a" ) ) == 0)
  5653. || (::strncmp( "GDI_Prisoner_v0b", preset_name, ::strlen( "GDI_Prisoner_v0a" ) ) == 0))
  5654. {
  5655. Play_Conversation(obj, 10, 19);
  5656. }
  5657. else if((::strncmp( "GDI_Prisoner_v1a", preset_name, ::strlen( "GDI_Prisoner_v1a" ) ) == 0)
  5658. || (::strncmp( "GDI_Prisoner_v1b", preset_name, ::strlen( "GDI_Prisoner_v1a" ) ) == 0))
  5659. {
  5660. Play_Conversation(obj, 10, 19);
  5661. }
  5662. else if((::strncmp( "GDI_Prisoner_v2a", preset_name, ::strlen( "GDI_Prisoner_v2a" ) ) == 0)
  5663. || (::strncmp( "GDI_Prisoner_v2b", preset_name, ::strlen( "GDI_Prisoner_v2a" ) ) == 0))
  5664. {
  5665. Play_Conversation(obj, 20, 29);
  5666. }
  5667. }
  5668. int Index(int Min, int Max)
  5669. {
  5670. while(random == last || random < Min || random > Max)
  5671. {
  5672. random = Commands->Get_Random_Int(0, PRISONER_CONV_TABLE_SIZE);
  5673. }
  5674. last = random;
  5675. return last;
  5676. }
  5677. void Play_Conversation(GameObject * obj, int Min, int Max)
  5678. {
  5679. const char *conv_name = Prisoner_Conv_Table[Index(Min, Max)];
  5680. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5681. Commands->Join_Conversation(obj, conv_id, false, true);
  5682. Commands->Start_Conversation (conv_id, 0);
  5683. }
  5684. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5685. {
  5686. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  5687. {
  5688. conversation = false;
  5689. }
  5690. }
  5691. };
  5692. DECLARE_SCRIPT(M08_Enable_KaneConversation, "")
  5693. {
  5694. bool already_entered;
  5695. // Register variables to be Auto-Saved
  5696. // All variables must have a unique ID, less than 256, that never changes
  5697. REGISTER_VARIABLES()
  5698. {
  5699. SAVE_VARIABLE( already_entered, 1 );
  5700. }
  5701. void Created (GameObject * obj)
  5702. {
  5703. already_entered = false;
  5704. }
  5705. void Entered (GameObject * obj, GameObject * enterer)
  5706. {
  5707. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5708. {
  5709. already_entered = true;
  5710. // Kane conversation
  5711. GameObject * holograph = Commands->Find_Object(109884);
  5712. GameObject * kane = Commands->Create_Object_At_Bone ( holograph, "Nod_Kane_HologramHead", "O_ARROW" );
  5713. Commands->Attach_To_Object_Bone( kane, holograph, "O_ARROW" );
  5714. Commands->Disable_All_Collisions ( kane );
  5715. Commands->Set_Facing (kane, Commands->Get_Facing (holograph));
  5716. Commands->Set_Loiters_Allowed( kane, false );
  5717. Commands->Attach_Script(kane, "M08_KaneHead", "");
  5718. }
  5719. }
  5720. };
  5721. DECLARE_SCRIPT(M08_KaneHead, "")
  5722. {
  5723. bool already_entered;
  5724. // Register variables to be Auto-Saved
  5725. // All variables must have a unique ID, less than 256, that never changes
  5726. REGISTER_VARIABLES()
  5727. {
  5728. SAVE_VARIABLE( already_entered, 1 );
  5729. }
  5730. void Created (GameObject * obj)
  5731. {
  5732. // Parker! Your interference is becoming troublesome.
  5733. const char *conv_name = ("M08_CON041");
  5734. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
  5735. Commands->Join_Conversation(obj, conv_id, false, true);
  5736. Commands->Join_Conversation(STAR, conv_id, false, true);
  5737. Commands->Start_Conversation (conv_id, 300123);
  5738. Commands->Monitor_Conversation (obj, conv_id);
  5739. }
  5740. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5741. {
  5742. if((action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_ENDED) || (action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  5743. {
  5744. Commands->Destroy_Object(obj);
  5745. // Spawn soldiers surrounding hologram
  5746. Commands->Enable_Spawner(100695, true);
  5747. Commands->Enable_Spawner(100692, true);
  5748. Commands->Enable_Spawner(100693, true);
  5749. }
  5750. }
  5751. };
  5752. DECLARE_SCRIPT(M08_DataDisc_01_DLS, "")//
  5753. {
  5754. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5755. {
  5756. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  5757. {
  5758. Commands->Set_HUD_Help_Text (IDS_M00EVAG_DSGN0104I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  5759. // Reveal Tiberium Flechette
  5760. Commands->Reveal_Encyclopedia_Weapon(22);
  5761. }
  5762. }
  5763. };
  5764. DECLARE_SCRIPT(M08_DataDisc_02_DLS, "")//
  5765. {
  5766. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5767. {
  5768. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  5769. {
  5770. Commands->Set_HUD_Help_Text (IDS_M00EVAG_DSGN0104I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  5771. // Reveal Tiberium Auto Rifle
  5772. Commands->Reveal_Encyclopedia_Weapon(21);
  5773. }
  5774. }
  5775. };