Mission10.cpp 122 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779
  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. * Mission10.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 10 scripts
  25. *
  26. * PROGRAMMER
  27. * Ryan Vervack, Dan Etter
  28. *
  29. * VERSION INFO
  30. * $Author: Dan_e $
  31. * $Revision: 69 $
  32. * $Modtime: 2/11/02 9:41a $
  33. * $Archive: /Commando/Code/Scripts/Mission10.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission10.h"
  39. DECLARE_SCRIPT(M10_Objective_Controller, "")
  40. {
  41. int silo_count, turret_count;
  42. int e_sam_count, w_sam_count;
  43. int primary_count;
  44. REGISTER_VARIABLES()
  45. {
  46. SAVE_VARIABLE(silo_count, 1);
  47. SAVE_VARIABLE(turret_count, 2);
  48. SAVE_VARIABLE(e_sam_count, 3);
  49. SAVE_VARIABLE(w_sam_count, 4);
  50. SAVE_VARIABLE(primary_count, 5);
  51. }
  52. void Created(GameObject * obj)
  53. {
  54. Commands->Set_Num_Tertiary_Objectives ( 2 );
  55. Commands->Start_Timer (obj, this, 0.5f, HAVOCS_SCRIPT);
  56. silo_count = turret_count = 0;
  57. e_sam_count = w_sam_count = 0;
  58. primary_count = 0;
  59. Commands->Add_Objective(1020, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M10_01, NULL, IDS_Enc_Obj_Hidden_M10_01);
  60. Commands->Add_Objective(1021, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M10_02, NULL, IDS_Enc_Obj_Hidden_M10_02);
  61. }
  62. void Remove_Pog(int id)
  63. {
  64. switch (id)
  65. {
  66. // Destroy the Power Plant
  67. case 1001:
  68. {
  69. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_05.tga", IDS_POG_DESTROY);
  70. }
  71. break;
  72. // Destroy the Construction Yard
  73. case 1002:
  74. {
  75. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_02.tga", IDS_POG_DESTROY);
  76. }
  77. break;
  78. // Place the Ion Cannon Beacon at the Temple of Nod Entrance
  79. case 1003:
  80. {
  81. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_07.tga", IDS_POG_SABOTAGE);
  82. }
  83. break;
  84. // Destroy the Communications Center
  85. case 1004:
  86. {
  87. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_04.tga", IDS_POG_DESTROY);
  88. }
  89. break;
  90. // Lower the Southeastern Base Gate
  91. case 1005:
  92. {
  93. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_01.tga", IDS_POG_OPEN);
  94. }
  95. break;
  96. // Lower the Northeastern Base Gate
  97. case 1006:
  98. {
  99. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_01.tga", IDS_POG_OPEN);
  100. }
  101. break;
  102. // Lower the Northwestern Base Gate
  103. case 1007:
  104. {
  105. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_1_01.tga", IDS_POG_OPEN);
  106. }
  107. break;
  108. // Destroy the Hand of Nod
  109. case 1008:
  110. {
  111. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_01.tga", IDS_POG_DESTROY);
  112. }
  113. break;
  114. // Destroy the Tiberium Refinery
  115. case 1009:
  116. {
  117. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_02.tga", IDS_POG_DESTROY);
  118. }
  119. break;
  120. // Destroy the Nod Airstrip
  121. case 1010:
  122. {
  123. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_06.tga", IDS_POG_DESTROY);
  124. }
  125. break;
  126. // Destroy the Tiberium Silos
  127. case 1011:
  128. {
  129. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_02.tga", IDS_POG_DESTROY);
  130. }
  131. break;
  132. // Acquire the Level 1 Key From an Officer
  133. case 1012:
  134. {
  135. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_1_02.tga", IDS_POG_ACQUIRE);
  136. }
  137. break;
  138. // Destroy the Northern Nod Helipad
  139. case 1013:
  140. {
  141. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_02.tga", IDS_POG_DESTROY);
  142. }
  143. break;
  144. // Destroy the Western Nod Helipad
  145. case 1014:
  146. {
  147. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_07.tga", IDS_POG_DESTROY);
  148. }
  149. break;
  150. // Destroy the Southern SAM Site
  151. case 1015:
  152. {
  153. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_03.tga", IDS_POG_DESTROY);
  154. }
  155. break;
  156. // Destroy the Northern SAM Site
  157. case 1016:
  158. {
  159. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_11.tga", IDS_POG_DESTROY);
  160. }
  161. break;
  162. // Destroy the Western SAM Site
  163. case 1017:
  164. {
  165. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_06.tga", IDS_POG_DESTROY);
  166. }
  167. break;
  168. // Destroy the Eastern SAM Site
  169. case 1018:
  170. {
  171. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_05.tga", IDS_POG_DESTROY);
  172. }
  173. break;
  174. // Destroy the Nod Turrets
  175. case 1019:
  176. {
  177. Commands->Set_Objective_HUD_Info(id, -1, "POG_M10_2_12.tga", IDS_POG_DESTROY);
  178. }
  179. break;
  180. }
  181. }
  182. void Add_An_Objective(int id)
  183. {
  184. GameObject *object;
  185. GameObject *object2;
  186. GameObject *obj = Commands->Find_Object (1100154);
  187. switch (id)
  188. {
  189. case 1001:
  190. {
  191. Commands->Add_Objective(1001, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_05, NULL, IDS_Enc_Obj_Primary_M10_05);
  192. object = Commands->Find_Object(2007444);
  193. if(object)
  194. {
  195. Commands->Set_Objective_Radar_Blip_Object(1001, object);
  196. Commands->Set_Objective_HUD_Info_Position( 1001, 75, "POG_M10_1_05.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  197. }
  198. }
  199. break;
  200. case 1002:
  201. {
  202. Commands->Add_Objective(1002, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_02, NULL, IDS_Enc_Obj_Primary_M10_02);
  203. object = Commands->Find_Object(2007445);
  204. if(object)
  205. {
  206. Commands->Set_Objective_Radar_Blip_Object(1002, object);
  207. Commands->Set_Objective_HUD_Info_Position( 1002, 78, "POG_M10_1_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  208. }
  209. }
  210. break;
  211. case 1003:
  212. {
  213. Commands->Add_Objective(1003, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_07, NULL, IDS_Enc_Obj_Primary_M10_07);
  214. object = Commands->Find_Object(2007446);
  215. if(object)
  216. {
  217. Commands->Set_Objective_Radar_Blip_Object(1003, object);
  218. Commands->Set_Objective_HUD_Info_Position( 1003, 73, "POG_M10_1_07.tga", IDS_POG_SABOTAGE, Commands->Get_Position (object));
  219. }
  220. }
  221. break;
  222. case 1004:
  223. {
  224. Commands->Add_Objective(1004, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_04, NULL, IDS_Enc_Obj_Primary_M10_04);
  225. object = Commands->Find_Object(2007447);
  226. if(object)
  227. {
  228. Commands->Set_Objective_Radar_Blip_Object(1004, object);
  229. Commands->Set_Objective_HUD_Info_Position( 1004, 76, "POG_M10_1_04.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  230. }
  231. }
  232. break;
  233. case 1005:
  234. {
  235. Commands->Add_Objective(1005, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_01, NULL, IDS_Enc_Obj_Primary_M10_01);
  236. object = Commands->Find_Object(1100166);
  237. if(object)
  238. {
  239. Commands->Set_Objective_Radar_Blip_Object(1005, object);
  240. Commands->Set_Objective_HUD_Info_Position( 1005, 80, "POG_M10_1_01.tga", IDS_POG_OPEN, Commands->Get_Position (object));
  241. }
  242. }
  243. break;
  244. case 1006:
  245. {
  246. Commands->Add_Objective(1006, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_06, NULL, IDS_Enc_Obj_Primary_M10_06);
  247. object = Commands->Find_Object(2017706);
  248. if(object)
  249. {
  250. Commands->Set_Objective_Radar_Blip_Object(1006, object);
  251. Commands->Set_Objective_HUD_Info_Position( 1006, 74, "POG_M10_1_01.tga", IDS_POG_OPEN, Commands->Get_Position (object));
  252. }
  253. }
  254. break;
  255. case 1007:
  256. {
  257. Commands->Add_Objective(1007, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_03, NULL, IDS_Enc_Obj_Primary_M10_03);
  258. object = Commands->Find_Object(1100169);
  259. if(object)
  260. {
  261. Commands->Set_Objective_Radar_Blip_Object(1007, object);
  262. Commands->Set_Objective_HUD_Info_Position( 1007, 77, "POG_M10_1_01.tga", IDS_POG_OPEN, Commands->Get_Position (object));
  263. }
  264. }
  265. break;
  266. case 1008:
  267. {
  268. Commands->Add_Objective(1008, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_01, NULL, IDS_Enc_Obj_Secondary_M10_01);
  269. object = Commands->Find_Object(2007448);
  270. if(object)
  271. {
  272. Commands->Set_Objective_Radar_Blip_Object(1008, object);
  273. Commands->Set_Objective_HUD_Info_Position( 1008, 51, "POG_M10_2_01.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  274. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1008, SECONDARY_POG_DELAY );
  275. }
  276. }
  277. break;
  278. case 1009:
  279. {
  280. Commands->Add_Objective(1009, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_04, NULL, IDS_Enc_Obj_Secondary_M10_04);
  281. object = Commands->Find_Object(2007449);
  282. if(object)
  283. {
  284. Commands->Set_Objective_Radar_Blip_Object(1009, object);
  285. Commands->Set_Objective_HUD_Info_Position( 1009, 50, "POG_M10_2_03.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  286. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1009, SECONDARY_POG_DELAY );
  287. }
  288. }
  289. break;
  290. case 1010:
  291. {
  292. Commands->Add_Objective(1010, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_06, NULL, IDS_Enc_Obj_Secondary_M10_06);
  293. object = Commands->Find_Object(2007450);
  294. if(object)
  295. {
  296. Commands->Set_Objective_Radar_Blip_Object(1010, object);
  297. Commands->Set_Objective_HUD_Info_Position( 1010, 59, "POG_M10_2_05.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  298. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1010, SECONDARY_POG_DELAY );
  299. }
  300. }
  301. break;
  302. case 1011:
  303. {
  304. Commands->Add_Objective(1011, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_08, NULL, IDS_Enc_Obj_Secondary_M10_08);
  305. object = Commands->Find_Object(2005260);
  306. if(object)
  307. {
  308. Commands->Set_Objective_Radar_Blip_Object(1011, object);
  309. Commands->Set_Objective_HUD_Info_Position( 1011, 58, "POG_M10_2_07.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  310. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1011, SECONDARY_POG_DELAY );
  311. }
  312. }
  313. break;
  314. case 1012:
  315. {
  316. Commands->Add_Objective(1012, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M10_08, NULL, IDS_Enc_Obj_Primary_M10_08);
  317. object = Commands->Find_Object(2000890);
  318. if(object)
  319. {
  320. Commands->Set_Objective_Radar_Blip_Object(1012, object);
  321. Commands->Set_Objective_HUD_Info_Position( 1012, 79, "POG_M10_1_08.tga", IDS_POG_ACQUIRE, Commands->Get_Position (object));
  322. }
  323. }
  324. break;
  325. case 1013:
  326. {
  327. Commands->Add_Objective(1013, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_10, NULL, IDS_Enc_Obj_Secondary_M10_10);
  328. object = Commands->Find_Object(1154083);
  329. if(object)
  330. {
  331. Commands->Set_Objective_Radar_Blip_Object(1013, object);
  332. Commands->Set_Objective_HUD_Info_Position( 1013, 57, "POG_M10_2_06.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  333. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1013, SECONDARY_POG_DELAY );
  334. }
  335. }
  336. break;
  337. case 1014:
  338. {
  339. Commands->Add_Objective(1014, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_07, NULL, IDS_Enc_Obj_Secondary_M10_07);
  340. object = Commands->Find_Object(1154084);
  341. if(object)
  342. {
  343. Commands->Set_Objective_Radar_Blip_Object(1014, object);
  344. Commands->Set_Objective_HUD_Info_Position( 1014, 56, "POG_M10_2_06.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  345. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1014, SECONDARY_POG_DELAY );
  346. }
  347. }
  348. break;
  349. case 1015:
  350. {
  351. Commands->Add_Objective(1015, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_03, NULL, IDS_Enc_Obj_Secondary_M10_03);
  352. object = Commands->Find_Object(1100007);
  353. if(object)
  354. {
  355. Commands->Set_Objective_Radar_Blip_Object(1015, object);
  356. Commands->Set_Objective_HUD_Info_Position( 1015, 55, "POG_M10_2_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  357. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1015, SECONDARY_POG_DELAY );
  358. }
  359. }
  360. break;
  361. case 1016:
  362. {
  363. Commands->Add_Objective(1016, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_11, NULL, IDS_Enc_Obj_Secondary_M10_11);
  364. object = Commands->Find_Object(1100010);
  365. if(object)
  366. {
  367. Commands->Set_Objective_Radar_Blip_Object(1016, object);
  368. Commands->Set_Objective_HUD_Info_Position( 1016, 54, "POG_M10_2_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  369. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1016, SECONDARY_POG_DELAY );
  370. }
  371. }
  372. break;
  373. case 1017:
  374. {
  375. Commands->Add_Objective(1017, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_09, NULL, IDS_Enc_Obj_Secondary_M10_09);
  376. object = Commands->Find_Object(1100012);
  377. object2 = Commands->Find_Object(1100011);
  378. if(object && object2)
  379. {
  380. Commands->Set_Objective_Radar_Blip_Object(1017, object);
  381. //Commands->Set_Objective_Radar_Blip_Object(1017, object2);
  382. Commands->Set_Objective_HUD_Info_Position( 1017, 53, "POG_M10_2_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  383. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1017, SECONDARY_POG_DELAY );
  384. }
  385. }
  386. break;
  387. case 1018:
  388. {
  389. Commands->Add_Objective(1018, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_05, NULL, IDS_Enc_Obj_Secondary_M10_05);
  390. object = Commands->Find_Object(1100008);
  391. object2 = Commands->Find_Object(1100009);
  392. if(object || object2)
  393. {
  394. Commands->Set_Objective_Radar_Blip_Object(1018, Commands->Find_Object (1209367));
  395. //Commands->Set_Objective_Radar_Blip_Object(1018, object2);
  396. Commands->Set_Objective_HUD_Info_Position( 1018, 52, "POG_M10_2_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  397. }
  398. }
  399. break;
  400. case 1019:
  401. {
  402. Commands->Add_Objective(1019, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_12, NULL, IDS_Enc_Obj_Secondary_M10_12);
  403. object = Commands->Find_Object(1100013);
  404. object2 = Commands->Find_Object(1100014);
  405. if(object || object2)
  406. {
  407. Commands->Set_Objective_Radar_Blip_Object(1019, object);
  408. //Commands->Set_Objective_Radar_Blip_Object(1019, object2);
  409. Commands->Set_Objective_HUD_Info_Position( 1019, 51, "POG_M10_2_11.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  410. }
  411. }
  412. break;
  413. }
  414. }
  415. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason reason)
  416. {
  417. if (action_id == 100045)
  418. {
  419. Commands->Set_Objective_Status(1017, OBJECTIVE_STATUS_ACCOMPLISHED);
  420. }
  421. if (action_id == 100052)
  422. {
  423. Commands->Add_Objective(1019, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_12, NULL, IDS_Enc_Obj_Secondary_M10_12);
  424. Commands->Set_Objective_Status(1019, OBJECTIVE_STATUS_ACCOMPLISHED);
  425. }
  426. }
  427. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  428. {
  429. /*if (type == REMOVE_SECONDARY_POG)
  430. {
  431. Remove_Pog(param);
  432. }*/
  433. if (type >= 1000 && type <= 1025)
  434. {
  435. switch (param)
  436. {
  437. case 1: if (type == 1011)
  438. {
  439. Commands->Set_Objective_Status(1011, OBJECTIVE_STATUS_ACCOMPLISHED);
  440. }
  441. else if (type == 1019)
  442. {
  443. if (++turret_count == 2)
  444. {
  445. Commands->Add_Objective(1019, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_12, NULL, IDS_Enc_Obj_Secondary_M10_12);
  446. Commands->Set_Objective_Status(1019, OBJECTIVE_STATUS_ACCOMPLISHED);
  447. int id = Commands->Create_Conversation("M10CON052", 99, 2000, false);
  448. Commands->Join_Conversation(NULL, id);
  449. Commands->Join_Conversation(STAR, id);
  450. Commands->Start_Conversation(id, 100052);
  451. Commands->Monitor_Conversation(obj, id);
  452. }
  453. }
  454. else if (type == 1015)
  455. {
  456. int id = Commands->Create_Conversation("M10CON028", 99, 2000, false);
  457. Commands->Join_Conversation(NULL, id);
  458. Commands->Start_Conversation(id, 100028);
  459. Commands->Monitor_Conversation(obj, id);
  460. }
  461. else if (type == 1018)
  462. {
  463. if (++e_sam_count >= 1)
  464. {
  465. if (e_sam_count == 1)
  466. {
  467. int id = Commands->Create_Conversation("M10CON035", 99, 2000, false);
  468. Commands->Join_Conversation(NULL, id);
  469. Commands->Join_Conversation(STAR, id);
  470. Commands->Start_Conversation(id, 100035);
  471. Commands->Monitor_Conversation(obj, id);
  472. }
  473. if (e_sam_count == 2)
  474. {
  475. Commands->Add_Objective(1018, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M10_05, NULL, IDS_Enc_Obj_Secondary_M10_05);
  476. Commands->Set_Objective_Status(1018, OBJECTIVE_STATUS_ACCOMPLISHED);
  477. int id = Commands->Create_Conversation("M10CON034", 99, 2000, false);
  478. Commands->Join_Conversation(STAR, id);
  479. Commands->Start_Conversation(id, 100034);
  480. Commands->Monitor_Conversation(obj, id);
  481. }
  482. }
  483. }
  484. else if (type == 1017)
  485. {
  486. if (++w_sam_count == 2)
  487. {
  488. int id = Commands->Create_Conversation("M10CON045", 99, 2000, false);
  489. Commands->Join_Conversation(NULL, id);
  490. Commands->Join_Conversation(STAR, id);
  491. Commands->Start_Conversation(id, 100045);
  492. Commands->Monitor_Conversation(obj, id);
  493. Vector3 drop_loc = Commands->Get_Position (Commands->Find_Object (2005997));
  494. float facing = Commands->Get_Facing (Commands->Find_Object (2005997));
  495. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  496. if (chinook_obj1)
  497. {
  498. Commands->Set_Facing(chinook_obj1, facing);
  499. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M10_GDI_Drop_HummVee.txt");
  500. }
  501. }
  502. }
  503. else
  504. {
  505. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  506. if (type < 1008 || type == 1012)
  507. {
  508. if (++primary_count >= 7)
  509. {
  510. if (primary_count == 7)
  511. {
  512. int id = Commands->Create_Conversation("M10CON019", 99, 2000, false);
  513. Commands->Join_Conversation(STAR, id);
  514. Commands->Join_Conversation(NULL, id);
  515. Commands->Start_Conversation(id, 100019);
  516. Commands->Monitor_Conversation(obj, id);
  517. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(146.59f, 67.52f, -5.25f));
  518. Commands->Set_Facing(chinook_obj, 0.0f);
  519. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X10I_GDI_Drop_PowerUp.txt");
  520. }
  521. if (type == 1003)
  522. {
  523. Commands->Start_Timer(obj, this, 5.0f, MISSION_COMPLETE);
  524. }
  525. }
  526. }
  527. }
  528. break;
  529. case 2: Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  530. break;
  531. case 3: Add_An_Objective(type);
  532. break;
  533. case 4: Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  534. break;
  535. }
  536. }
  537. }
  538. void Timer_Expired(GameObject * obj, int timer_id)
  539. {
  540. if(timer_id == HAVOCS_SCRIPT)
  541. {
  542. GameObject * obj_con = Commands->Find_Object(1100154);
  543. if (obj_con)
  544. {
  545. Commands->Start_Timer(obj, this, 3.0f, 1);
  546. Commands->Send_Custom_Event(obj, obj_con, 1003, 3);
  547. /*Commands->Send_Custom_Event(obj, obj_con, 1009, 3);
  548. Commands->Send_Custom_Event(obj, obj_con, 1008, 3);
  549. Commands->Send_Custom_Event(obj, obj_con, 1015, 3);
  550. Commands->Send_Custom_Event(obj, obj_con, 1012, 3);*/
  551. }
  552. Commands->Attach_Script(STAR, "M10_Havoc_Script", "");
  553. }
  554. if(timer_id == 1)
  555. {
  556. int id = Commands->Create_Conversation("M10CON064", 99, 2000, false);
  557. Commands->Join_Conversation(NULL, id);
  558. Commands->Join_Conversation(STAR, id);
  559. Commands->Start_Conversation(id, 100064);
  560. Commands->Monitor_Conversation(obj, id);
  561. }
  562. if(timer_id == MISSION_COMPLETE)
  563. {
  564. Commands->Mission_Complete(true);
  565. }
  566. }
  567. };
  568. DECLARE_SCRIPT (M10_Ion_Cannon, "")
  569. {
  570. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  571. {
  572. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  573. {
  574. GameObject * obj_con = Commands->Find_Object(1100154);
  575. Commands->Send_Custom_Event(obj, obj_con, 1003, 1);
  576. }
  577. }
  578. };
  579. DECLARE_SCRIPT (M10_Havoc_Script, "")
  580. {
  581. void Created (GameObject *obj)
  582. {
  583. /*Commands->Give_PowerUp(obj, "POW_LaserChaingun_Player");
  584. Commands->Give_PowerUp(obj, "POW_LaserRifle_Player");
  585. Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
  586. Commands->Give_PowerUp(obj, "POW_SniperRifle_Player");
  587. Commands->Give_PowerUp(obj, "POW_TiberiumAutoRifle_Player");
  588. Commands->Give_PowerUp(obj, "POW_GrenadeLauncher_Player");
  589. Commands->Give_PowerUp(obj, "POW_FlameThrower_Player");
  590. Commands->Give_PowerUp(obj, "POW_ChemSprayer_Player");
  591. Commands->Give_PowerUp(obj, "POW_LaserChaingun_Player");
  592. Commands->Give_PowerUp(obj, "POW_LaserRifle_Player");
  593. Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
  594. Commands->Give_PowerUp(obj, "POW_RocketLauncher_Player");
  595. Commands->Give_PowerUp(obj, "POW_RocketLauncher_Player");
  596. Commands->Give_PowerUp(obj, "POW_TiberiumAutoRifle_Player");
  597. Commands->Give_PowerUp(obj, "POW_PersonalIonCannon_Player");
  598. Commands->Give_PowerUp(obj, "POW_FlameThrower_Player");
  599. Commands->Give_PowerUp(obj, "POW_ChemSprayer_Player");*/
  600. }
  601. /*void Destroyed(GameObject * obj)
  602. {
  603. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 666, 666, 0.0f);
  604. }*/
  605. };
  606. DECLARE_SCRIPT(M10_Turret_Tank, "CheckBlocked=1:int")
  607. {
  608. void Created(GameObject * obj)
  609. {
  610. Commands->Enable_Enemy_Seen(obj, true);
  611. }
  612. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  613. {
  614. bool blocked;
  615. if (Get_Int_Parameter ("CheckBlocked") != 0)
  616. {
  617. blocked = true;
  618. }
  619. else
  620. {
  621. blocked = false;
  622. }
  623. ActionParamsStruct params;
  624. params.Set_Basic(this, 90, 0);
  625. params.Set_Attack(enemy, 100.0f, 4.0f, true);
  626. params.AttackCheckBlocked = blocked;
  627. Commands->Action_Attack(obj, params);
  628. Commands->Start_Timer(obj, this, 10.0f, 0);
  629. }
  630. void Timer_Expired(GameObject * obj, int timer_id)
  631. {
  632. Commands->Action_Reset(obj, 99);
  633. }
  634. };
  635. DECLARE_SCRIPT(M10_Power_Plant, "")
  636. {
  637. bool con_yard_destroyed;
  638. REGISTER_VARIABLES()
  639. {
  640. SAVE_VARIABLE(con_yard_destroyed, 1);
  641. }
  642. void Created(GameObject * obj)
  643. {
  644. con_yard_destroyed = false;
  645. Commands->Static_Anim_Phys_Goto_Frame ( 1285077, 0, "L10_LASERFENCE1.L10_LASERFENCE1" );
  646. }
  647. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  648. {
  649. if (type == 1000 && param == 1000)
  650. {
  651. con_yard_destroyed = true;
  652. }
  653. }
  654. void Power_Off(void)
  655. {
  656. //Turns power off on all buildings (besides Obelisk, which is done elsewhere)
  657. GameObject * building;
  658. building = Commands->Find_Object(1153933); //Con Yard
  659. Commands->Set_Building_Power(building, false);
  660. building = Commands->Find_Object(1153932); //Comm Center
  661. Commands->Set_Building_Power(building, false);
  662. building = Commands->Find_Object(1153934); //Airstrip
  663. Commands->Set_Building_Power(building, false);
  664. building = Commands->Find_Object(1153940); //Refinery
  665. Commands->Set_Building_Power(building, false);
  666. building = Commands->Find_Object(1153939); //Hand of Nod
  667. Commands->Set_Building_Power(building, false);
  668. }
  669. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  670. {
  671. GameObject * obj_con = Commands->Find_Object(1100154);
  672. if (action_id == 100014)
  673. {
  674. Commands->Send_Custom_Event(obj, obj_con, 1001, 3);
  675. Commands->Send_Custom_Event(obj, obj_con, 1001, 1);
  676. }
  677. }
  678. void Killed(GameObject * obj, GameObject * killer)
  679. {
  680. Commands->Enable_Radar ( true );
  681. Commands->Destroy_Object (Commands->Find_Object (1203589));
  682. int id = Commands->Create_Conversation("M10CON014", 99, 2000, false);
  683. Commands->Join_Conversation(NULL, id);
  684. Commands->Start_Conversation(id, 100014);
  685. Commands->Monitor_Conversation(obj, id);
  686. GameObject * obelisk = Commands->Find_Object(1153938);
  687. if (obelisk)
  688. {
  689. Commands->Send_Custom_Event(obj, obelisk, 1000, 1000);
  690. }
  691. Commands->Static_Anim_Phys_Goto_Frame ( 1285077, 1, "L10_LASERFENCE1.L10_LASERFENCE1" );
  692. Power_Off();
  693. }
  694. };
  695. DECLARE_SCRIPT(M10_Con_Yard, "")
  696. {
  697. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  698. {
  699. GameObject * obj_con = Commands->Find_Object(1100154);
  700. if (action_id == 100005)
  701. {
  702. Commands->Send_Custom_Event(obj, obj_con, 1002, 1);
  703. }
  704. }
  705. void Killed(GameObject * obj, GameObject * killer)
  706. {
  707. Commands->Destroy_Object (Commands->Find_Object (2014793));
  708. Commands->Destroy_Object (Commands->Find_Object (2014792));
  709. int id = Commands->Create_Conversation("M10CON005", 99, 2000, false);
  710. Commands->Join_Conversation(NULL, id);
  711. Commands->Start_Conversation(id, 100005);
  712. Commands->Monitor_Conversation(obj, id);
  713. GameObject * power_plant = Commands->Find_Object(1153931);
  714. if (power_plant)
  715. {
  716. Commands->Send_Custom_Event(obj, power_plant, 3000, 3000);
  717. }
  718. GameObject * turret1 = Commands->Find_Object(1100013);
  719. if (turret1)
  720. {
  721. Commands->Send_Custom_Event(obj, turret1, 3000, 3000);
  722. }
  723. GameObject * comm_center = Commands->Find_Object(1153932);
  724. if (comm_center)
  725. {
  726. Commands->Send_Custom_Event(obj, comm_center, 3000, 3000);
  727. }
  728. GameObject * heli_pad = Commands->Find_Object(1154083);
  729. if (heli_pad)
  730. {
  731. Commands->Send_Custom_Event(obj, heli_pad, 3000, 3000);
  732. }
  733. GameObject * sam_site = Commands->Find_Object(1100010);
  734. if (sam_site)
  735. {
  736. Commands->Send_Custom_Event(obj, sam_site, 3000, 3000);
  737. }
  738. GameObject * turret2 = Commands->Find_Object(1100014);
  739. if (turret2)
  740. {
  741. Commands->Send_Custom_Event(obj, turret2, 3000, 3000);
  742. }
  743. GameObject * hon = Commands->Find_Object(1153939);
  744. if (hon)
  745. {
  746. Commands->Send_Custom_Event(obj, hon, 3000, 3000);
  747. }
  748. GameObject * sam1 = Commands->Find_Object(1100007);
  749. if (sam1)
  750. {
  751. Commands->Send_Custom_Event(obj, sam1, 3000, 3000);
  752. }
  753. GameObject * turret3 = Commands->Find_Object(2000728);
  754. if (turret3)
  755. {
  756. Commands->Send_Custom_Event(obj, turret3, 3000, 3000);
  757. }
  758. GameObject * turret4 = Commands->Find_Object(2000729);
  759. if (turret4)
  760. {
  761. Commands->Send_Custom_Event(obj, turret4, 3000, 3000);
  762. }
  763. GameObject * refinery = Commands->Find_Object(1153940);
  764. if (refinery)
  765. {
  766. Commands->Send_Custom_Event(obj, refinery, 3000, 3000);
  767. }
  768. GameObject * turret5 = Commands->Find_Object(1205749);
  769. if (turret5)
  770. {
  771. Commands->Send_Custom_Event(obj, turret5, 3000, 3000);
  772. }
  773. GameObject * turret6 = Commands->Find_Object(1205748);
  774. if (turret6)
  775. {
  776. Commands->Send_Custom_Event(obj, turret6, 3000, 3000);
  777. }
  778. GameObject * obelisk = Commands->Find_Object(1153938);
  779. if (obelisk)
  780. {
  781. Commands->Send_Custom_Event(obj, obelisk, 3000, 3000);
  782. }
  783. GameObject * sam2 = Commands->Find_Object(1100008);
  784. if (sam2)
  785. {
  786. Commands->Send_Custom_Event(obj, sam2, 3000, 3000);
  787. }
  788. GameObject * sam3 = Commands->Find_Object(1100009);
  789. if (sam3)
  790. {
  791. Commands->Send_Custom_Event(obj, sam3, 3000, 3000);
  792. }
  793. GameObject * airstrip = Commands->Find_Object(1154061);
  794. if (airstrip)
  795. {
  796. Commands->Send_Custom_Event(obj, airstrip, 3000, 3000);
  797. }
  798. GameObject * helipad1 = Commands->Find_Object(1154084);
  799. if (helipad1)
  800. {
  801. Commands->Send_Custom_Event(obj, helipad1, 3000, 3000);
  802. }
  803. GameObject * sam4 = Commands->Find_Object(1100012);
  804. if (sam4)
  805. {
  806. Commands->Send_Custom_Event(obj, sam4, 3000, 3000);
  807. }
  808. GameObject * sam5 = Commands->Find_Object(1100011);
  809. if (sam5)
  810. {
  811. Commands->Send_Custom_Event(obj, sam5, 3000, 3000);
  812. }
  813. GameObject * silo1 = Commands->Find_Object(1153935);
  814. if (silo1)
  815. {
  816. Commands->Send_Custom_Event(obj, silo1, 3000, 3000);
  817. }
  818. GameObject * silo2 = Commands->Find_Object(1154051);
  819. if (silo2)
  820. {
  821. Commands->Send_Custom_Event(obj, silo2, 3000, 3000);
  822. }
  823. }
  824. };
  825. DECLARE_SCRIPT(M10_Comm_Center, "")
  826. {
  827. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  828. {
  829. GameObject * obj_con = Commands->Find_Object(1100154);
  830. if (action_id == 100011)
  831. {
  832. Commands->Send_Custom_Event(obj, obj_con, 1004, 3);
  833. Commands->Send_Custom_Event(obj, obj_con, 1004, 1);
  834. }
  835. }
  836. void Killed(GameObject * obj, GameObject * killer)
  837. {
  838. Commands->Destroy_Object (Commands->Find_Object (2014802));
  839. Commands->Enable_Radar (true);
  840. int id = Commands->Create_Conversation("M10CON011", 99, 2000, false);
  841. Commands->Join_Conversation(NULL, id);
  842. Commands->Join_Conversation(NULL, id);
  843. Commands->Start_Conversation(id, 100011);
  844. Commands->Monitor_Conversation(obj, id);
  845. //Commands->Give_PowerUp(STAR, "Ion Cannon Powerup");
  846. }
  847. };
  848. DECLARE_SCRIPT(M10_Hand_Of_Nod, "")
  849. {
  850. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  851. {
  852. GameObject * obj_con = Commands->Find_Object(1100154);
  853. if (action_id == 100021)
  854. {
  855. Commands->Send_Custom_Event(obj, obj_con, 1008, 1);
  856. }
  857. }
  858. void Killed(GameObject * obj, GameObject * killer)
  859. {
  860. int id = Commands->Create_Conversation("M10CON021", 99, 2000, false);
  861. Commands->Join_Conversation(NULL, id);
  862. Commands->Join_Conversation(STAR, id);
  863. Commands->Start_Conversation(id, 100021);
  864. Commands->Monitor_Conversation(obj, id);
  865. }
  866. };
  867. DECLARE_SCRIPT(M10_Refinery, "")
  868. {
  869. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  870. {
  871. GameObject * obj_con = Commands->Find_Object(1100154);
  872. if (action_id == 100031)
  873. {
  874. Commands->Send_Custom_Event(obj, obj_con, 1009, 1);
  875. }
  876. }
  877. void Killed(GameObject * obj, GameObject * killer)
  878. {
  879. int id = Commands->Create_Conversation("M10CON031", 99, 2000, false);
  880. Commands->Join_Conversation(STAR, id);
  881. Commands->Join_Conversation(NULL, id);
  882. Commands->Start_Conversation(id, 100031);
  883. Commands->Monitor_Conversation(obj, id);
  884. }
  885. };
  886. DECLARE_SCRIPT(M10_Airstrip, "")
  887. {
  888. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  889. {
  890. GameObject * obj_con = Commands->Find_Object(1100154);
  891. if (action_id == 100037)
  892. {
  893. Commands->Send_Custom_Event(obj, obj_con, 1010, 1);
  894. }
  895. }
  896. void Killed(GameObject * obj, GameObject * killer)
  897. {
  898. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100161), NO_DROP, 0);
  899. int id = Commands->Create_Conversation("M10CON037", 99, 2000, false);
  900. Commands->Join_Conversation(NULL, id);
  901. Commands->Start_Conversation(id, 100037);
  902. Commands->Monitor_Conversation(obj, id);
  903. }
  904. };
  905. DECLARE_SCRIPT(M10_Silo, "")
  906. {
  907. void Killed(GameObject * obj, GameObject * killer)
  908. {
  909. GameObject * silo_con = Commands->Find_Object(2005260);
  910. if (silo_con)
  911. {
  912. Commands->Send_Custom_Event(obj, silo_con, KILLED, 0);
  913. }
  914. }
  915. };
  916. DECLARE_SCRIPT(M10_Silo_Controller, "")
  917. {
  918. int count;
  919. REGISTER_VARIABLES()
  920. {
  921. SAVE_VARIABLE(count, 1);
  922. }
  923. void Created (GameObject *obj)
  924. {
  925. count = 0;
  926. }
  927. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason reason)
  928. {
  929. if (action_id == 100043)
  930. {
  931. GameObject * obj_con = Commands->Find_Object(1100154);
  932. //Commands->Set_Objective_Status(1011, OBJECTIVE_STATUS_ACCOMPLISHED);
  933. Commands->Send_Custom_Event(obj, obj_con, 1011, 3);
  934. Commands->Send_Custom_Event(obj, obj_con, 1011, 1);
  935. }
  936. }
  937. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  938. {
  939. if (type == KILLED)
  940. {
  941. count++;
  942. if (count >= 2)
  943. {
  944. int id = Commands->Create_Conversation("M10CON043", 99, 2000, false);
  945. Commands->Join_Conversation(STAR, id);
  946. Commands->Join_Conversation(NULL, id);
  947. Commands->Start_Conversation(id, 100043);
  948. Commands->Monitor_Conversation(obj, id);
  949. }
  950. }
  951. }
  952. };
  953. DECLARE_SCRIPT(M10_Obelisk, "")
  954. {
  955. bool objective_completed, inside_obelisk, conyard_destroyed;
  956. float full_health, curr_health;
  957. REGISTER_VARIABLES()
  958. {
  959. SAVE_VARIABLE(objective_completed, 1);
  960. SAVE_VARIABLE(inside_obelisk, 2);
  961. SAVE_VARIABLE(conyard_destroyed, 3);
  962. }
  963. void Created(GameObject * obj)
  964. {
  965. objective_completed = inside_obelisk = conyard_destroyed = false;
  966. full_health = Commands->Get_Health(obj);
  967. }
  968. void Killed(GameObject * obj, GameObject * killer)
  969. {
  970. if (!objective_completed)
  971. {
  972. GameObject * obj_con = Commands->Find_Object(1100154);
  973. if (obj_con)
  974. {
  975. Commands->Send_Custom_Event(obj, obj_con, 1020, 1);
  976. Commands->Send_Custom_Event(obj, Commands->Find_Object (2010415), KILLED, 0);
  977. Commands->Send_Custom_Event(obj, Commands->Find_Object (6000728), KILLED, 0);
  978. }
  979. }
  980. }
  981. /*void Damaged(GameObject * obj, GameObject * damager, float amount)
  982. {
  983. if (inside_obelisk || conyard_destroyed)
  984. {
  985. return;
  986. }
  987. else
  988. {
  989. curr_health = Commands->Get_Health (obj);
  990. float counter = 1.0f;
  991. Commands->Set_Health(obj, (curr_health + 1));
  992. for (float x = curr_health; x <= full_health; x++)
  993. {
  994. Commands->Start_Timer(obj, this, counter, REBUILD);
  995. counter++;
  996. //Commands->Set_Health(obj, full_health);
  997. }
  998. }
  999. }*/
  1000. void Timer_Expired(GameObject * obj, int timer_id )
  1001. {
  1002. if (timer_id == REBUILD)
  1003. {
  1004. curr_health++;
  1005. Commands->Set_Health(obj, curr_health);
  1006. }
  1007. }
  1008. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1009. {
  1010. if (type == 1000 && param == 1000)
  1011. {
  1012. Commands->Set_Building_Power(obj, false);
  1013. objective_completed = false;
  1014. }
  1015. if (type == 2000 && param == 2000)
  1016. {
  1017. inside_obelisk = true;
  1018. }
  1019. if (type == 2000 && param == 2001)
  1020. {
  1021. inside_obelisk = false;
  1022. full_health = Commands->Get_Health(obj);
  1023. }
  1024. if (type == 3000 && param == 3000)
  1025. {
  1026. conyard_destroyed = true;
  1027. }
  1028. }
  1029. };
  1030. DECLARE_SCRIPT(M10_Turret, "")
  1031. {
  1032. void Created(GameObject * obj)
  1033. {
  1034. Commands->Enable_Enemy_Seen(obj, true);
  1035. }
  1036. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  1037. {
  1038. ActionParamsStruct params;
  1039. params.Set_Basic(this, 90, 0);
  1040. params.Set_Attack(enemy, 100.0f, 4.0f, true);
  1041. Commands->Action_Attack(obj, params);
  1042. Commands->Start_Timer(obj, this, 10.0f, 0);
  1043. }
  1044. void Killed(GameObject * obj, GameObject * killer)
  1045. {
  1046. Vector3 my_pos = Commands->Get_Position(obj);
  1047. float facing = Commands->Get_Facing(obj);
  1048. GameObject * destroyed_turret = Commands->Create_Object("Nod_Turret_Destroyed", my_pos);
  1049. Commands->Set_Facing(destroyed_turret, facing);
  1050. Commands->Attach_Script(destroyed_turret, "M10_Destroyed_Turret", "");
  1051. }
  1052. void Timer_Expired(GameObject * obj, int timer_id)
  1053. {
  1054. Commands->Action_Reset(obj, 99);
  1055. }
  1056. };
  1057. DECLARE_SCRIPT(M10_Destroyed_Turret, "")
  1058. {
  1059. void Created(GameObject * obj)
  1060. {
  1061. Commands->Start_Timer(obj, this, 1.0f, 0);
  1062. }
  1063. void Timer_Expired(GameObject * obj, int timer_id)
  1064. {
  1065. Commands->Create_2D_Sound("EVA_Enemy_Structure_Destroyed");
  1066. }
  1067. };
  1068. DECLARE_SCRIPT(M10_Destroy_Self, "")
  1069. {
  1070. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1071. {
  1072. Commands->Destroy_Object(obj);
  1073. }
  1074. };
  1075. DECLARE_SCRIPT(M10_Apache_Controller, "")
  1076. {
  1077. bool active;
  1078. int area;
  1079. bool destroyed[3];
  1080. int apache_id[3];
  1081. int attacking_apache;
  1082. REGISTER_VARIABLES()
  1083. {
  1084. SAVE_VARIABLE(active, 1);
  1085. SAVE_VARIABLE(area, 2);
  1086. SAVE_VARIABLE(destroyed, 3);
  1087. SAVE_VARIABLE(apache_id, 4);
  1088. SAVE_VARIABLE(attacking_apache, 5);
  1089. }
  1090. void Created(GameObject * obj)
  1091. {
  1092. active = false;
  1093. attacking_apache = 0;
  1094. area = -1;
  1095. destroyed[0] = destroyed[1] = destroyed[2] = false;
  1096. //apache_id[0] = Commands->Get_ID(Commands->Create_Object("Nod_Apache_No_Idle", Vector3(-12.129f, -149.546f, 2.949f)));
  1097. //GameObject * apache = Commands->Find_Object(apache_id[0]);
  1098. //Commands->Attach_Script(apache, "M10_Apache", "0");
  1099. apache_id[1] = Commands->Get_ID(Commands->Create_Object("Nod_Apache_No_Idle", Vector3(-171.980f, 51.905f, 8.959f)));
  1100. GameObject * apache = Commands->Find_Object(apache_id[1]);
  1101. Commands->Attach_Script(apache, "M10_Apache", "1");
  1102. apache_id[2] = Commands->Get_ID(Commands->Create_Object("Nod_Apache_No_Idle", Vector3(8.548f, 226.140f, 1.697f)));
  1103. apache = Commands->Find_Object(apache_id[2]);
  1104. Commands->Attach_Script(apache, "M10_Apache", "2");
  1105. }
  1106. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1107. {
  1108. if (param < -1 || param > 2)
  1109. {
  1110. return;
  1111. }
  1112. if (type == 1000)
  1113. {
  1114. destroyed[param] = true;
  1115. if (Commands->Find_Object(apache_id[param]))
  1116. {
  1117. Commands->Send_Custom_Event(obj, Commands->Find_Object(apache_id[param]), 300, 300);
  1118. }
  1119. }
  1120. if (type == 2000)
  1121. {
  1122. apache_id[param] = 0;
  1123. if (!destroyed[param])
  1124. {
  1125. Commands->Start_Timer(obj, this, 40.0f, param);
  1126. }
  1127. else
  1128. {
  1129. }
  1130. }
  1131. if (type == 3000)
  1132. {
  1133. if (param == area)
  1134. {
  1135. return;
  1136. }
  1137. if (area > -1)
  1138. {
  1139. Return_To_Helipad(area);
  1140. }
  1141. area = param;
  1142. if (area > -1)
  1143. {
  1144. Attack_Player(area);
  1145. }
  1146. }
  1147. if (type == 4000)
  1148. {
  1149. if (area == param)
  1150. {
  1151. Commands->Send_Custom_Event(obj, sender, 100, 100);
  1152. attacking_apache = area;
  1153. }
  1154. }
  1155. if (type == 5000)
  1156. {
  1157. Reload_At_Helipad(area);
  1158. Commands->Start_Timer(obj, this, 25.0f, 10 + area);
  1159. }
  1160. }
  1161. void Return_To_Helipad(int current_area)
  1162. {
  1163. GameObject * apache = Commands->Find_Object(apache_id[current_area]);
  1164. if (apache)
  1165. {
  1166. Commands->Send_Custom_Event(Owner(), apache, 200, 200);
  1167. }
  1168. }
  1169. void Reload_At_Helipad(int current_area)
  1170. {
  1171. GameObject * apache = Commands->Find_Object(apache_id[current_area]);
  1172. if (apache)
  1173. {
  1174. Commands->Send_Custom_Event(Owner(), apache, 500, 500);
  1175. }
  1176. }
  1177. void Attack_Player(int current_area)
  1178. {
  1179. GameObject * apache = Commands->Find_Object(apache_id[area]);
  1180. if (apache)
  1181. {
  1182. Commands->Send_Custom_Event(Owner(), apache, 100, 100);
  1183. attacking_apache = area;
  1184. }
  1185. }
  1186. void Replace_Apache(int current_area)
  1187. {
  1188. Vector3 start_loc;
  1189. start_loc.Set(8.107f, 70.031f, 44.679f);
  1190. GameObject * apache = Commands->Create_Object("Nod_Apache_No_Idle", start_loc);
  1191. Commands->Enable_Engine(apache, true);
  1192. char param[10];
  1193. sprintf(param, "%d", current_area);
  1194. Commands->Attach_Script(apache, "M10_Apache", param);
  1195. Commands->Send_Custom_Event(Owner(), apache, 400, 400);
  1196. apache_id[current_area] = Commands->Get_ID(apache);
  1197. }
  1198. void Timer_Expired(GameObject * obj, int timer_id)
  1199. {
  1200. if (timer_id >= 10)
  1201. {
  1202. int current_area = timer_id - 10;
  1203. if (current_area == area)
  1204. {
  1205. GameObject * apache = Commands->Find_Object(apache_id[area]);
  1206. if (apache)
  1207. {
  1208. Commands->Send_Custom_Event(Owner(), apache, 100, 100);
  1209. attacking_apache = area;
  1210. }
  1211. }
  1212. return;
  1213. }
  1214. if (!destroyed[timer_id])
  1215. {
  1216. Replace_Apache(timer_id);
  1217. }
  1218. else
  1219. {
  1220. }
  1221. }
  1222. };
  1223. DECLARE_SCRIPT(M10_Apache, "Area:int")
  1224. {
  1225. bool on_pad, pad_destroyed;
  1226. int my_area;
  1227. REGISTER_VARIABLES()
  1228. {
  1229. SAVE_VARIABLE(on_pad, 1);
  1230. SAVE_VARIABLE(my_area, 2);
  1231. SAVE_VARIABLE(pad_destroyed, 3);
  1232. }
  1233. void Created(GameObject * obj)
  1234. {
  1235. //Commands->Enable_Vehicle_Transitions ( obj, false );
  1236. Commands->Enable_Hibernation(obj, false);
  1237. on_pad = true;
  1238. pad_destroyed = false;
  1239. my_area = Get_Int_Parameter("Area");
  1240. }
  1241. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1242. {
  1243. if (type == 100 && param == 100)
  1244. {
  1245. on_pad = false;
  1246. ActionParamsStruct params;
  1247. params.Set_Basic(this, 90, 0);
  1248. Vector3 pos = Commands->Get_Position(obj);
  1249. pos.Z += 10.0f;
  1250. params.Set_Movement(pos, 1.0f, 1.0f);
  1251. params.MovePathfind = false;
  1252. Commands->Action_Goto(obj, params);
  1253. }
  1254. if (type == 200 && param == 200)
  1255. {
  1256. int pad_obj[3] =
  1257. {
  1258. 1110050,
  1259. 1110051,
  1260. 1110052
  1261. };
  1262. ActionParamsStruct params;
  1263. params.Set_Basic(this, 90, 2);
  1264. int area = Get_Int_Parameter("Area");
  1265. params.Set_Movement(Commands->Find_Object(pad_obj[area]), 1.0f, 0.1f);
  1266. params.MovePathfind = false;
  1267. Commands->Action_Goto(obj, params);
  1268. }
  1269. if (type == 300 && param == 300)
  1270. {
  1271. pad_destroyed = true;
  1272. if (on_pad)
  1273. {
  1274. Commands->Apply_Damage(obj, 10000.0f, "EXPLOSIVE");
  1275. }
  1276. else
  1277. {
  1278. int pad_obj[3] =
  1279. {
  1280. 1110050,
  1281. 1110051,
  1282. 1110052
  1283. };
  1284. ActionParamsStruct params;
  1285. params.Set_Basic(this, 90, 2);
  1286. int area = Get_Int_Parameter("Area");
  1287. params.Set_Movement(Commands->Find_Object(pad_obj[area]), 1.0f, 0.1f);
  1288. params.MovePathfind = false;
  1289. Commands->Action_Goto(obj, params);
  1290. }
  1291. }
  1292. if (type == 400 && param == 400)
  1293. {
  1294. int waypath[3] =
  1295. {
  1296. 1110082,
  1297. 1110040,
  1298. 1110045
  1299. };
  1300. ActionParamsStruct params;
  1301. params.Set_Basic(this, 90, 2);
  1302. int area = Get_Int_Parameter("Area");
  1303. params.Set_Movement(Vector3(0,0,0), 1.0f, 1.0f);
  1304. params.MovePathfind = false;
  1305. params.WaypathID = waypath[area];
  1306. Commands->Action_Goto(obj, params);
  1307. }
  1308. if (type == 500 && param == 500)
  1309. {
  1310. int pad_obj[3] =
  1311. {
  1312. 1110050,
  1313. 1110051,
  1314. 1110052
  1315. };
  1316. ActionParamsStruct params;
  1317. params.Set_Basic(this, 91, 3);
  1318. int area = Get_Int_Parameter("Area");
  1319. params.Set_Movement(Commands->Find_Object(pad_obj[area]), 1.0f, 0.1f);
  1320. params.MovePathfind = false;
  1321. Commands->Action_Goto(obj, params);
  1322. }
  1323. }
  1324. void Timer_Expired(GameObject * obj, int timer_id)
  1325. {
  1326. if (!pad_destroyed)
  1327. {
  1328. if (timer_id == 0)
  1329. {
  1330. Vector3 pos = Commands->Get_Position(STAR);
  1331. float facing = Commands->Get_Facing(STAR);
  1332. pos.X -= cos(DEG_TO_RADF(facing)) * 6.0f;
  1333. pos.Y -= sin(DEG_TO_RADF(facing)) * 6.0f;
  1334. pos.Z = WWMath::Max(pos.Z + 12.0f, Commands->Get_Safe_Flight_Height(pos.X, pos.Y) + 6.0f);
  1335. ActionParamsStruct params;
  1336. params.Set_Basic(this, 90, 1);
  1337. params.Set_Movement(pos, 1.0f, 5.0f);
  1338. params.MovePathfind = false;
  1339. Commands->Action_Goto(obj, params);
  1340. }
  1341. if (timer_id == 1)
  1342. {
  1343. if (!pad_destroyed && on_pad)
  1344. {
  1345. if (Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  1346. {
  1347. Commands->Set_Health(obj, Commands->Get_Health(obj) + 5.0f);
  1348. }
  1349. Commands->Start_Timer(obj, this, 3.0f, 1);
  1350. }
  1351. }
  1352. if (timer_id == 2)
  1353. {
  1354. Commands->Action_Reset(obj, 90);
  1355. Commands->Start_Timer(obj, this, Commands->Get_Random(1.0f, 3.0f), 0);
  1356. }
  1357. if (timer_id == 3)
  1358. {
  1359. GameObject * controller = Commands->Find_Object(1110009);
  1360. if (controller)
  1361. {
  1362. Commands->Send_Custom_Event(obj, controller, 5000, Get_Int_Parameter("Area"));
  1363. }
  1364. }
  1365. if (timer_id == 4)
  1366. {
  1367. Commands->Enable_Engine(obj, false);
  1368. }
  1369. }
  1370. }
  1371. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1372. {
  1373. if (!pad_destroyed)
  1374. {
  1375. if (reason != ACTION_COMPLETE_NORMAL)
  1376. {
  1377. return;
  1378. }
  1379. if (action_id == 0)
  1380. {
  1381. Commands->Start_Timer(obj, this, 2.0f, 0);
  1382. Commands->Start_Timer(obj, this, 60.0f, 3);
  1383. }
  1384. if (action_id == 1)
  1385. {
  1386. ActionParamsStruct params;
  1387. params.Set_Basic(this, 90, 2);
  1388. params.Set_Attack(STAR, 150.0f, 2.0f, true);
  1389. params.MovePathfind = false;
  1390. Commands->Action_Attack(obj, params);
  1391. Commands->Start_Timer(obj, this, Commands->Get_Random(4.0f, 6.0f), 2);
  1392. }
  1393. if (action_id == 2)
  1394. {
  1395. Commands->Start_Timer(obj, this, 1.0f, 4);
  1396. on_pad = true;
  1397. Commands->Start_Timer(obj, this, 5.0f, 1);
  1398. GameObject * controller = Commands->Find_Object(1110009);
  1399. if (controller)
  1400. {
  1401. Commands->Send_Custom_Event(obj, controller, 4000, Get_Int_Parameter("Area"));
  1402. }
  1403. }
  1404. if (action_id == 3)
  1405. {
  1406. Commands->Start_Timer(obj, this, 1.0f, 4);
  1407. on_pad = true;
  1408. Commands->Start_Timer(obj, this, 5.0f, 1);
  1409. }
  1410. }
  1411. }
  1412. void Killed(GameObject * obj, GameObject * killer)
  1413. {
  1414. GameObject * controller = Commands->Find_Object(1110009);
  1415. if (controller)
  1416. {
  1417. Commands->Send_Custom_Event(obj, controller, 2000, Get_Int_Parameter("Area"));
  1418. }
  1419. }
  1420. };
  1421. DECLARE_SCRIPT(M10_Reinforcement_Controller, "")
  1422. {
  1423. int area_count[3]; //Number of units killed in area since last reinforcement
  1424. int target_count[3]; //Number of units neccessary to be killed before reinforcements arrive
  1425. int max_reinforcements[3]; //Max number of times an area can be reinforced
  1426. int current_area; //Current area the Commando is in
  1427. REGISTER_VARIABLES()
  1428. {
  1429. SAVE_VARIABLE(area_count, 1);
  1430. SAVE_VARIABLE(current_area, 2);
  1431. SAVE_VARIABLE(target_count, 3);
  1432. SAVE_VARIABLE(max_reinforcements, 4);
  1433. }
  1434. void Created(GameObject * obj)
  1435. {
  1436. area_count[0] = area_count[1] = area_count[2] = 0;
  1437. target_count[0] = target_count[1] = target_count[2] = 4 - DIFFICULTY;
  1438. max_reinforcements[0] = max_reinforcements[1] = max_reinforcements[2] = 3;
  1439. current_area = -1;
  1440. }
  1441. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1442. {
  1443. if (type == 3000)
  1444. {
  1445. current_area = param;
  1446. if (current_area > 2)
  1447. {
  1448. current_area = 2;
  1449. }
  1450. if (current_area < -1)
  1451. {
  1452. current_area = -1;
  1453. }
  1454. }
  1455. if (type == 10000 && param == 10000 && current_area != -1)
  1456. {
  1457. if (++area_count[current_area] >= target_count[current_area])
  1458. {
  1459. area_count[current_area] = 0;
  1460. Reinforce_Area();
  1461. }
  1462. }
  1463. if (type == 20000 && param >= 0 && param <= 2 && param > -1)
  1464. {
  1465. target_count[param]++;
  1466. }
  1467. }
  1468. void Reinforce_Area(void)
  1469. {
  1470. if (current_area != -1 && max_reinforcements[current_area]-- <= 0)
  1471. {
  1472. max_reinforcements[current_area] = 0;
  1473. return;
  1474. }
  1475. typedef struct
  1476. {
  1477. Vector3 Pos;
  1478. float Facing;
  1479. } Reinforce_Info;
  1480. Reinforce_Info reinforce[3][4];
  1481. reinforce[0][0].Pos.Set(110.498f, -161.705f, 3.060f);
  1482. reinforce[0][0].Facing = 140.0f;
  1483. reinforce[0][1].Pos.Set(31.971f, -136.521f, 6.669f);
  1484. reinforce[0][1].Facing = 165.0f;
  1485. reinforce[0][2].Pos.Set(-11.678f, -140.165f, 5.467f);
  1486. reinforce[0][2].Facing = -165.0f;
  1487. reinforce[0][3].Pos.Set(11.674f, -195.396f, 0.926f);
  1488. reinforce[0][3].Facing = -175.0f;
  1489. reinforce[1][0].Pos.Set(-98.021f, -67.086f, 7.0f);
  1490. reinforce[1][0].Facing = 130.0f;
  1491. reinforce[1][1].Pos.Set(-96.862f, 19.633f, 7.0f);
  1492. reinforce[1][1].Facing = -105.0f;
  1493. reinforce[1][2].Pos.Set(-161.272f, -26.111f, 8.513f);
  1494. reinforce[1][2].Facing = 15.0f;
  1495. reinforce[1][3].Pos.Set(-184.338f, 60.513f, 8.852f);
  1496. reinforce[1][3].Facing = -145.0f;
  1497. reinforce[2][0].Pos.Set(16.075f, 172.231f, 2.541f);
  1498. reinforce[2][0].Facing = 175.0f;
  1499. reinforce[2][1].Pos.Set(56.842f, 182.570f, 1.399f);
  1500. reinforce[2][1].Facing = 30.0f;
  1501. reinforce[2][2].Pos.Set(24.164f, 230.841f, 0.704f);
  1502. reinforce[2][2].Facing = 15.0f;
  1503. reinforce[2][3].Pos.Set(23.470f, 158.990f, 6.251f);
  1504. reinforce[2][3].Facing = 0.0f;
  1505. if (Commands->Get_Random_Int(0, 2) == 1)
  1506. {
  1507. int num = Commands->Get_Random_Int(0, 4);
  1508. Reinforce_By_Rope(reinforce[current_area][num].Pos, reinforce[current_area][num].Facing);
  1509. }
  1510. else
  1511. {
  1512. int num = Commands->Get_Random_Int(0, 4);
  1513. Reinforce_By_Parachute(reinforce[current_area][num].Pos, reinforce[current_area][num].Facing);
  1514. }
  1515. }
  1516. void Reinforce_By_Rope(const Vector3 & pos, float facing)
  1517. {
  1518. GameObject *new_obj = Commands->Create_Object("Invisible_Object", pos);
  1519. Commands->Set_Facing(new_obj, facing);
  1520. Commands->Attach_Script(new_obj, "Test_Cinematic", "X10I_TroopDrop.txt");
  1521. }
  1522. void Reinforce_By_Parachute(const Vector3 & pos, float facing)
  1523. {
  1524. GameObject * new_obj = Commands->Create_Object("Invisible_Object", pos);
  1525. Commands->Set_Facing(new_obj, facing);
  1526. Commands->Attach_Script(new_obj, "Test_Cinematic", "X10D_CHTroopdrop1.txt");
  1527. }
  1528. };
  1529. DECLARE_SCRIPT(M10_Chinook_ParaDrop, "Preset:string")
  1530. {
  1531. int chinook_id;
  1532. bool dead;
  1533. int out;
  1534. REGISTER_VARIABLES()
  1535. {
  1536. SAVE_VARIABLE(chinook_id, 1);
  1537. SAVE_VARIABLE(dead, 2);
  1538. SAVE_VARIABLE(out, 3);
  1539. }
  1540. void Created(GameObject * obj)
  1541. {
  1542. Vector3 loc = Commands->Get_Position(obj);
  1543. float facing = Commands->Get_Facing(obj);
  1544. GameObject *chinook_rail = Commands->Create_Object("Generic_Cinematic", loc);
  1545. Commands->Set_Model(chinook_rail, "X5D_Chinookfly");
  1546. Commands->Set_Facing(chinook_rail, facing);
  1547. Commands->Set_Animation(chinook_rail, "X5D_Chinookfly.X5D_Chinookfly", false);
  1548. GameObject *chinook = Commands->Create_Object("Nod_Chinook", loc);
  1549. Commands->Set_Facing(chinook, facing);
  1550. Commands->Set_Animation(chinook, "v_nod_chinook.vf_nod_chinook", true);
  1551. Commands->Attach_To_Object_Bone(chinook, chinook_rail, "BN_Chinook_1");
  1552. dead = false;
  1553. out = 0;
  1554. char params[10];
  1555. sprintf(params, "%d", Commands->Get_ID(obj));
  1556. Commands->Attach_Script(chinook, "M10_Reinforcement_Chinook", params);
  1557. chinook_id = Commands->Get_ID(chinook);
  1558. // Destroy Chinook
  1559. Commands->Start_Timer(obj, this, 280.0f/30.0f, 0);
  1560. // Parachutes
  1561. Commands->Start_Timer(obj, this, 169.0f/30.0f, 1);
  1562. Commands->Start_Timer(obj, this, 179.0f/30.0f, 2);
  1563. Commands->Start_Timer(obj, this, 198.0f/30.0f, 3);
  1564. // Soldiers
  1565. Commands->Start_Timer(obj, this, 145.0f/30.0f, 4);
  1566. Commands->Start_Timer(obj, this, 155.0f/30.0f, 5);
  1567. Commands->Start_Timer(obj, this, 165.0f/30.0f, 6);
  1568. }
  1569. void Timer_Expired(GameObject * obj, int timer_id)
  1570. {
  1571. Vector3 loc = Commands->Get_Position(obj);
  1572. const char * preset = Get_Parameter("Preset");
  1573. float facing = Commands->Get_Facing(obj);
  1574. switch (timer_id)
  1575. {
  1576. case 0:
  1577. GameObject *chinook;
  1578. chinook = Commands->Find_Object(chinook_id);
  1579. Commands->Destroy_Object(chinook);
  1580. break;
  1581. case 1:
  1582. if (out >= 1)
  1583. {
  1584. GameObject *para1;
  1585. para1 = Commands->Create_Object("Generic_Cinematic", loc);
  1586. Commands->Set_Facing(para1, facing);
  1587. Commands->Set_Model(para1, "X5D_Parachute");
  1588. Commands->Set_Animation(para1, "X5D_Parachute.X5D_ParaC_1", false);
  1589. Commands->Create_3D_Sound_At_Bone("parachute_open", para1, "ROOTTRANSFORM");
  1590. Commands->Attach_Script(para1, "M10_No_More_Parachute", "");
  1591. }
  1592. break;
  1593. case 2:
  1594. if (out >= 2)
  1595. {
  1596. GameObject *para2;
  1597. para2 = Commands->Create_Object("Generic_Cinematic", loc);
  1598. Commands->Set_Facing(para2, facing);
  1599. Commands->Set_Model(para2, "X5D_Parachute");
  1600. Commands->Set_Animation(para2, "X5D_Parachute.X5D_ParaC_2", false);
  1601. Commands->Create_3D_Sound_At_Bone("parachute_open", para2, "ROOTTRANSFORM");
  1602. Commands->Attach_Script(para2, "M10_No_More_Parachute", "");
  1603. }
  1604. break;
  1605. case 3:
  1606. if (out == 3)
  1607. {
  1608. GameObject *para3;
  1609. para3 = Commands->Create_Object("Generic_Cinematic", loc);
  1610. Commands->Set_Facing(para3, facing);
  1611. Commands->Set_Model(para3, "X5D_Parachute");
  1612. Commands->Set_Animation(para3, "X5D_Parachute.X5D_ParaC_3", false);
  1613. Commands->Create_3D_Sound_At_Bone("parachute_open", para3, "ROOTTRANSFORM");
  1614. Commands->Attach_Script(para3, "M10_No_More_Parachute", "");
  1615. }
  1616. break;
  1617. case 4:
  1618. if (!dead)
  1619. {
  1620. GameObject *box1 = Commands->Create_Object("Generic_Cinematic", loc);
  1621. Commands->Set_Model(box1, "X5D_Box01");
  1622. Commands->Set_Facing(box1, facing);
  1623. Commands->Set_Animation(box1, "X5D_Box01.X5D_Box01", false);
  1624. GameObject *soldier1;
  1625. soldier1 = Commands->Create_Object_At_Bone(box1, preset, "Box01");
  1626. Commands->Set_Facing(soldier1, facing);
  1627. Commands->Attach_Script(soldier1, "RMV_Trigger_Killed", "1110009, 10000, 10000");
  1628. Commands->Attach_Script(soldier1, "M00_No_Falling_Damage_DME", "");
  1629. Commands->Attach_To_Object_Bone( soldier1, box1, "Box01" );
  1630. Commands->Set_Animation(soldier1, "s_a_human.H_A_X5D_ParaT_1", false);
  1631. out++;
  1632. }
  1633. break;
  1634. case 5:
  1635. if (!dead)
  1636. {
  1637. GameObject *box2 = Commands->Create_Object("Generic_Cinematic", loc);
  1638. Commands->Set_Model(box2, "X5D_Box02");
  1639. Commands->Set_Facing(box2, facing);
  1640. Commands->Set_Animation(box2, "X5D_Box02.X5D_Box02", false);
  1641. GameObject *soldier2;
  1642. soldier2 = Commands->Create_Object_At_Bone(box2, preset, "Box02");
  1643. Commands->Set_Facing(soldier2, facing);
  1644. Commands->Attach_Script(soldier2, "RMV_Trigger_Killed", "1110009, 10000, 10000");
  1645. Commands->Attach_Script(soldier2, "M00_No_Falling_Damage_DME", "");
  1646. Commands->Set_Animation(soldier2, "s_a_human.H_A_X5D_ParaT_2", false);
  1647. Commands->Attach_To_Object_Bone( soldier2, box2, "Box02" );
  1648. out++;
  1649. }
  1650. break;
  1651. case 6:
  1652. if (!dead)
  1653. {
  1654. GameObject *box3 = Commands->Create_Object("Generic_Cinematic", loc);
  1655. Commands->Set_Model(box3, "X5D_Box03");
  1656. Commands->Set_Facing(box3, facing);
  1657. Commands->Set_Animation(box3, "X5D_Box03.X5D_Box03", false);
  1658. GameObject *soldier3;
  1659. soldier3 = Commands->Create_Object_At_Bone(box3, preset, "Box03");
  1660. Commands->Set_Facing(soldier3, facing);
  1661. Commands->Attach_Script(soldier3, "RMV_Trigger_Killed", "1110009, 10000, 10000");
  1662. Commands->Attach_Script(soldier3, "M00_No_Falling_Damage_DME", "");
  1663. Commands->Set_Animation(soldier3, "s_a_human.H_A_X5D_ParaT_3", false);
  1664. Commands->Attach_To_Object_Bone( soldier3, box3, "Box03" );
  1665. out++;
  1666. }
  1667. break;
  1668. }
  1669. }
  1670. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1671. {
  1672. if (type == 23000 && param == 23000)
  1673. {
  1674. dead = true;
  1675. }
  1676. }
  1677. };
  1678. DECLARE_SCRIPT(M10_No_More_Parachute, "")
  1679. {
  1680. void Destroyed(GameObject * obj)
  1681. {
  1682. Commands->Create_3D_Sound_At_Bone("parachute_away", obj, "ROOTTRANSFORM");
  1683. }
  1684. };
  1685. DECLARE_SCRIPT(M10_Reinforcement_Chinook, "Controller_ID:int")
  1686. {
  1687. int sound_id;
  1688. REGISTER_VARIABLES()
  1689. {
  1690. SAVE_VARIABLE(sound_id, 1);
  1691. }
  1692. void Created(GameObject * obj)
  1693. {
  1694. sound_id = Commands->Create_3D_Sound_At_Bone("Chinook_Idle_01", obj, "V_FUSELAGE");
  1695. }
  1696. void Killed(GameObject * obj, GameObject * killer)
  1697. {
  1698. GameObject * con = Commands->Find_Object(Get_Int_Parameter(0));
  1699. Commands->Send_Custom_Event(obj, con, 23000, 23000);
  1700. }
  1701. void Destroyed(GameObject * obj)
  1702. {
  1703. Commands->Stop_Sound(sound_id, true);
  1704. }
  1705. };
  1706. DECLARE_SCRIPT(M10_Cargo_Plane_Dropoff, "")
  1707. {
  1708. bool already_entered;
  1709. bool tank_alive;
  1710. bool airstrip_alive;
  1711. // Register variables to be Auto-Saved
  1712. // All variables must have a unique ID, less than 256, that never changes
  1713. REGISTER_VARIABLES()
  1714. {
  1715. SAVE_VARIABLE( already_entered, 1 );
  1716. SAVE_VARIABLE( tank_alive, 2 );
  1717. SAVE_VARIABLE( airstrip_alive, 3 );
  1718. }
  1719. void Created (GameObject * obj)
  1720. {
  1721. already_entered = false;
  1722. tank_alive = false;
  1723. airstrip_alive = true;
  1724. }
  1725. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1726. {
  1727. if (type == TANK_KILLED)
  1728. {
  1729. tank_alive = false;
  1730. }
  1731. if (type == NO_DROP)
  1732. {
  1733. airstrip_alive = false;
  1734. }
  1735. }
  1736. void Entered(GameObject * obj, GameObject * enterer)
  1737. {
  1738. if (!already_entered && Commands->Get_Health (Commands->Find_Object (1154061)) > 0.0f)
  1739. {
  1740. already_entered = true;
  1741. tank_alive = true;
  1742. Vector3 pos = Vector3(-128.772f, -3.245f, 8.151f);
  1743. GameObject * new_object = Commands->Create_Object("Invisible_Object", pos);
  1744. Commands->Set_Facing(new_object, 90.0f);
  1745. Commands->Attach_Script(new_object, "Test_Cinematic", "CnC_C130Drop.txt");
  1746. GameObject * stealth_tank = Commands->Create_Object("Nod_Stealth_Tank", Vector3(0,0,0));
  1747. if (stealth_tank)
  1748. {
  1749. Commands->Send_Custom_Event(obj, new_object, M00_CUSTOM_CINEMATIC_SET_SLOT + 3, Commands->Get_ID(stealth_tank));
  1750. Commands->Attach_Script(stealth_tank, "M10_Stealth_Attack_02", "");
  1751. }
  1752. Commands->Start_Timer (obj, this, 10.0f, CARGO_DROP);
  1753. }
  1754. }
  1755. void Timer_Expired(GameObject * obj, int timer_id )
  1756. {
  1757. if (timer_id == CARGO_DROP)
  1758. {
  1759. if (!tank_alive && airstrip_alive)
  1760. {
  1761. tank_alive = true;
  1762. Vector3 pos = Vector3(-128.772f, -3.245f, 8.151f);
  1763. GameObject * new_object = Commands->Create_Object("Invisible_Object", pos);
  1764. Commands->Set_Facing(new_object, 90.0f);
  1765. Commands->Attach_Script(new_object, "Test_Cinematic", "CnC_C130Drop.txt");
  1766. GameObject * stealth_tank = Commands->Create_Object("Nod_Stealth_Tank", Vector3(0,0,0));
  1767. if (stealth_tank)
  1768. {
  1769. Commands->Send_Custom_Event(obj, new_object, M00_CUSTOM_CINEMATIC_SET_SLOT + 3, Commands->Get_ID(stealth_tank));
  1770. Commands->Attach_Script(stealth_tank, "M10_Stealth_Attack_02", "");
  1771. }
  1772. Commands->Start_Timer (obj, this, 10.0f, CARGO_DROP);
  1773. }
  1774. }
  1775. }
  1776. };
  1777. DECLARE_SCRIPT(M10_Light_Tank, "")
  1778. {
  1779. bool attacking;
  1780. REGISTER_VARIABLES()
  1781. {
  1782. SAVE_VARIABLE(attacking, 1);
  1783. }
  1784. void Created(GameObject * obj)
  1785. {
  1786. attacking = false;
  1787. Commands->Start_Timer(obj, this, (470.0f/30.0f + 2.0f), 0);
  1788. }
  1789. void Timer_Expired(GameObject * obj, int timer_id)
  1790. {
  1791. if (timer_id == 0)
  1792. {
  1793. ActionParamsStruct params;
  1794. params.Set_Basic(this, 90, 0);
  1795. params.Set_Movement(STAR, 0.2f, 20.0f);
  1796. params.MoveFollow = true;
  1797. params.Set_Attack(STAR, 100.0f, 4.0f, true);
  1798. params.AttackActive = attacking;
  1799. Commands->Action_Attack(obj, params);
  1800. Commands->Start_Timer(obj, this, 3.0f, 1);
  1801. }
  1802. if (timer_id == 1)
  1803. {
  1804. ActionParamsStruct params;
  1805. params.Set_Basic(this, 90, 0);
  1806. params.Set_Movement(STAR, 0.2f, 20.0f);
  1807. params.MoveFollow = true;
  1808. params.Set_Attack(STAR, 100.0f, 4.0f, true);
  1809. attacking = !attacking;
  1810. params.AttackActive = attacking;
  1811. Commands->Modify_Action(obj, 0, params);
  1812. Commands->Start_Timer(obj, this, (attacking) ? 3.0f : 5.0f, 1);
  1813. }
  1814. }
  1815. };
  1816. DECLARE_SCRIPT(M10_Ion_Cannon_Detector, "")
  1817. {
  1818. void Created(GameObject * obj)
  1819. {
  1820. Commands->Set_Is_Rendered(obj, false);
  1821. Commands->Enable_Hibernation(obj, false);
  1822. Commands->Disable_All_Collisions(obj);
  1823. }
  1824. void Damaged(GameObject * obj, GameObject * damager, float amount)
  1825. {
  1826. Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
  1827. }
  1828. void Sound_Heard(GameObject * obj, const CombatSound & sound)
  1829. {
  1830. if (sound.Type != SOUND_TYPE_DESIGNER07)
  1831. {
  1832. return;
  1833. }
  1834. GameObject * obj_con = Commands->Find_Object(1100154);
  1835. Vector3 my_pos = Commands->Get_Position(obj);
  1836. if (Commands->Get_Distance(my_pos, sound.Position) <= 6.0f)
  1837. {
  1838. if (obj_con)
  1839. {
  1840. Commands->Send_Custom_Event(obj, obj_con, 1007, 1);
  1841. }
  1842. }
  1843. else
  1844. {
  1845. if (obj_con)
  1846. {
  1847. Commands->Send_Custom_Event(obj, obj_con, 1007, 2);
  1848. }
  1849. }
  1850. }
  1851. };
  1852. ////////////////////////////////////////////////////////////////////////////
  1853. ////////////////////////////////DME/////////////////////////////////////////
  1854. ////////////////////////////////////////////////////////////////////////////
  1855. DECLARE_SCRIPT (M10_Vehicle_Attack_02, "")
  1856. {
  1857. bool attacking, charge, charging;
  1858. Vector3 current_loc;
  1859. Vector3 enemy_loc;
  1860. enum{ATTACK_OVER};
  1861. // Register variables to be Auto-Saved
  1862. // All variables must have a unique ID, less than 256, that never changes
  1863. REGISTER_VARIABLES()
  1864. {
  1865. SAVE_VARIABLE( attacking, 1 );
  1866. SAVE_VARIABLE( charge, 2 );
  1867. SAVE_VARIABLE( charging, 3 );
  1868. SAVE_VARIABLE( current_loc, 4 );
  1869. SAVE_VARIABLE( enemy_loc, 5 );
  1870. }
  1871. void Created(GameObject * obj)
  1872. {
  1873. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  1874. Commands->Enable_Enemy_Seen( obj, true);
  1875. attacking = false;
  1876. }
  1877. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1878. {
  1879. current_loc = Commands->Get_Position ( obj );
  1880. enemy_loc = Commands->Get_Position ( enemy );
  1881. if (!attacking)
  1882. {
  1883. if ((Commands->Get_Distance(current_loc, enemy_loc)) < 100.0f)
  1884. {
  1885. attacking = true;
  1886. ActionParamsStruct params;
  1887. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1888. params.Set_Attack(enemy, 100.0f, 7.5f, true);
  1889. params.AttackCheckBlocked = true;
  1890. params.AttackActive = true;
  1891. Commands->Action_Attack (obj, params);
  1892. Commands->Start_Timer(obj, this, 5.0f, ATTACK_OVER);
  1893. }
  1894. }
  1895. }
  1896. void Timer_Expired (GameObject* obj, int timer_id)
  1897. {
  1898. ActionParamsStruct params;
  1899. if (timer_id == ATTACK_OVER)
  1900. {
  1901. attacking = false;
  1902. }
  1903. }
  1904. };
  1905. DECLARE_SCRIPT (M10_Stealth, "")
  1906. {
  1907. void Created (GameObject *obj)
  1908. {
  1909. Commands->Enable_Stealth (obj, true);
  1910. }
  1911. };
  1912. DECLARE_SCRIPT(M10_Home_Point, "Radius=5.0:float")
  1913. {
  1914. void Created(GameObject * obj)
  1915. {
  1916. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), Get_Float_Parameter("Radius"));
  1917. }
  1918. };
  1919. DECLARE_SCRIPT(M10_HON_Spawn_Zones, "Zone_Number:int")
  1920. {
  1921. void Entered(GameObject * obj, GameObject * enterer)
  1922. {
  1923. switch (Get_Int_Parameter("Zone_Number"))
  1924. {
  1925. case 1:
  1926. {
  1927. Commands->Enable_Spawner (1100124, true);
  1928. Commands->Enable_Spawner (1100123, true);
  1929. }
  1930. break;
  1931. case 2:
  1932. {
  1933. Commands->Enable_Spawner (1100125, true);
  1934. Commands->Enable_Spawner (1100127, true);
  1935. }
  1936. break;
  1937. case 3:
  1938. {
  1939. Commands->Enable_Spawner (1100128, true);
  1940. Commands->Enable_Spawner (1100130, true);
  1941. Commands->Enable_Spawner (1100129, true);
  1942. }
  1943. break;
  1944. case 4:
  1945. {
  1946. Commands->Enable_Spawner (1100142, true);
  1947. Commands->Enable_Spawner (1100143, true);
  1948. Commands->Enable_Spawner (1100145, true);
  1949. Commands->Enable_Spawner (1100147, true);
  1950. Commands->Enable_Spawner (1100153, true);
  1951. }
  1952. break;
  1953. case 5:
  1954. {
  1955. Commands->Enable_Spawner (1100148, true);
  1956. Commands->Enable_Spawner (1100150, true);
  1957. Commands->Enable_Spawner (1100151, true);
  1958. Commands->Enable_Spawner (2000748, true);
  1959. Commands->Enable_Spawner (2000749, true);
  1960. Commands->Enable_Spawner (2000750, true);
  1961. Commands->Enable_Spawner (2000751, true);
  1962. }
  1963. break;
  1964. }
  1965. }
  1966. };
  1967. DECLARE_SCRIPT(M10_Refinery_Spawn_Zones, "Zone_Number:int")
  1968. {
  1969. void Entered(GameObject * obj, GameObject * enterer)
  1970. {
  1971. switch (Get_Int_Parameter("Zone_Number"))
  1972. {
  1973. case 1:
  1974. {
  1975. Commands->Enable_Spawner (1100202, true);
  1976. Commands->Enable_Spawner (1100209, true);
  1977. }
  1978. break;
  1979. case 2:
  1980. {
  1981. Commands->Enable_Spawner (1100203, true);
  1982. Commands->Enable_Spawner (1100204, true);
  1983. Commands->Enable_Spawner (2000890, true);
  1984. }
  1985. break;
  1986. case 3:
  1987. {
  1988. Commands->Enable_Spawner (1100212, true);
  1989. Commands->Enable_Spawner (1100210, true);
  1990. }
  1991. break;
  1992. case 4:
  1993. {
  1994. Commands->Enable_Spawner (2000767, true);
  1995. Commands->Enable_Spawner (2000758, true);
  1996. Commands->Enable_Spawner (1100213, true);
  1997. Commands->Enable_Spawner (2000768, true);
  1998. }
  1999. break;
  2000. case 5:
  2001. {
  2002. Commands->Enable_Spawner (1100215, true);
  2003. Commands->Enable_Spawner (1100216, true);
  2004. Commands->Enable_Spawner (2000769, true);
  2005. }
  2006. break;
  2007. case 6:
  2008. {
  2009. Commands->Enable_Spawner (2000770, true);
  2010. Commands->Enable_Spawner (1100220, true);
  2011. }
  2012. break;
  2013. }
  2014. }
  2015. };
  2016. DECLARE_SCRIPT(M10_PowerPlant_Spawn_Zones, "Zone_Number:int")
  2017. {
  2018. void Entered(GameObject * obj, GameObject * enterer)
  2019. {
  2020. switch (Get_Int_Parameter("Zone_Number"))
  2021. {
  2022. case 1:
  2023. {
  2024. Commands->Enable_Spawner (1100244, true);
  2025. Commands->Enable_Spawner (1100245, true);
  2026. }
  2027. break;
  2028. case 2:
  2029. {
  2030. Commands->Enable_Spawner (1100252, true);
  2031. Commands->Enable_Spawner (1100255, true);
  2032. }
  2033. break;
  2034. case 3:
  2035. {
  2036. Commands->Enable_Spawner (1100257, true);
  2037. Commands->Enable_Spawner (1100259, true);
  2038. }
  2039. break;
  2040. case 4:
  2041. {
  2042. Commands->Enable_Spawner (2000801, true);
  2043. Commands->Enable_Spawner (2000802, true);
  2044. Commands->Enable_Spawner (2000803, true);
  2045. Commands->Enable_Spawner (2000804, true);
  2046. }
  2047. break;
  2048. }
  2049. }
  2050. };
  2051. DECLARE_SCRIPT(M10_ComCenter_Spawn_Zones, "Zone_Number:int")
  2052. {
  2053. void Entered(GameObject * obj, GameObject * enterer)
  2054. {
  2055. switch (Get_Int_Parameter("Zone_Number"))
  2056. {
  2057. case 1:
  2058. {
  2059. Commands->Enable_Spawner (1100232, true);
  2060. Commands->Enable_Spawner (2000805, true);
  2061. }
  2062. break;
  2063. case 2:
  2064. {
  2065. Commands->Enable_Spawner (2000806, true);
  2066. //Commands->Enable_Spawner (1100238, true);
  2067. Commands->Enable_Spawner (1100243, true);
  2068. Commands->Enable_Spawner (2000812, true);
  2069. }
  2070. break;
  2071. case 3:
  2072. {
  2073. Commands->Enable_Spawner (2000807, true);
  2074. Commands->Enable_Spawner (1100233, true);
  2075. //Commands->Enable_Spawner (1100234, true);
  2076. //Commands->Enable_Spawner (2000811, true);
  2077. Commands->Enable_Spawner (2000809, true);
  2078. Commands->Enable_Spawner (2000810, true);
  2079. //Commands->Enable_Spawner (2000808, true);
  2080. }
  2081. break;
  2082. case 4:
  2083. {
  2084. Commands->Enable_Spawner (2000813, true);
  2085. //Commands->Enable_Spawner (1100241, true);
  2086. Commands->Enable_Spawner (1100240, true);
  2087. //Commands->Enable_Spawner (2000814, true);
  2088. Commands->Enable_Spawner (2000815, true);
  2089. }
  2090. break;
  2091. case 5:
  2092. {
  2093. Commands->Enable_Spawner (2000816, true);
  2094. Commands->Enable_Spawner (2000817, true);
  2095. }
  2096. break;
  2097. case 6:
  2098. {
  2099. Commands->Enable_Spawner (2000819, true);
  2100. Commands->Enable_Spawner (2000818, true);
  2101. }
  2102. break;
  2103. }
  2104. }
  2105. };
  2106. DECLARE_SCRIPT (M10_Gate_Test, "")
  2107. {
  2108. void Poked(GameObject * obj, GameObject * poker)
  2109. {
  2110. Commands->Static_Anim_Phys_Goto_Last_Frame (2050007, NULL );
  2111. }
  2112. };
  2113. DECLARE_SCRIPT (M10_Mammoth_Attack, "")
  2114. {
  2115. bool attacking;
  2116. int target [4];
  2117. bool valid [4];
  2118. int choice;
  2119. enum{ATTACK_OVER};
  2120. // Register variables to be Auto-Saved
  2121. // All variables must have a unique ID, less than 256, that never changes
  2122. REGISTER_VARIABLES()
  2123. {
  2124. SAVE_VARIABLE( attacking, 1 );
  2125. SAVE_VARIABLE( valid, 2 );
  2126. SAVE_VARIABLE( choice, 3 );
  2127. }
  2128. void Created(GameObject * obj)
  2129. {
  2130. attacking = false;
  2131. target [0] = 2000788;
  2132. target [1] = 2000795;
  2133. target [2] = 2000796;
  2134. target [3] = 2000797;
  2135. valid [0] = true;
  2136. valid [1] = true;
  2137. valid [2] = true;
  2138. valid [3] = true;
  2139. choice = Commands->Get_Random_Int(0,4);
  2140. }
  2141. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2142. {
  2143. if (type == MAMMOTH && param == ATTACK)
  2144. {
  2145. Commands->Start_Timer(obj, this, 0.1f, ATTACK_OVER);
  2146. }
  2147. if (type == TARGET)
  2148. {
  2149. switch (param)
  2150. {
  2151. case 0:
  2152. {
  2153. valid [param] = false;
  2154. }
  2155. break;
  2156. case 1:
  2157. {
  2158. valid [param] = false;
  2159. }
  2160. break;
  2161. case 2:
  2162. {
  2163. valid [param] = false;
  2164. }
  2165. break;
  2166. }
  2167. }
  2168. }
  2169. void Timer_Expired (GameObject* obj, int timer_id)
  2170. {
  2171. if (timer_id == ATTACK_OVER)
  2172. {
  2173. if (!attacking)
  2174. {
  2175. attacking = true;
  2176. while (!(valid [choice]))
  2177. {
  2178. choice = Commands->Get_Random_Int(0,4);
  2179. }
  2180. GameObject *mammoth_target = Commands->Find_Object(target [choice]);
  2181. ActionParamsStruct params;
  2182. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  2183. params.Set_Attack(mammoth_target, 1500.0f, 1.5f, true);
  2184. params.AttackCheckBlocked = false;
  2185. params.AttackActive = true;
  2186. Commands->Action_Attack (obj, params);
  2187. Commands->Start_Timer(obj, this, 5.0f, ATTACK_OVER);
  2188. }
  2189. attacking = false;
  2190. }
  2191. }
  2192. };
  2193. DECLARE_SCRIPT (M10_Mammoth_Target_Destruction, "Target_Number:int")
  2194. {
  2195. void Destroyed(GameObject * obj)
  2196. {
  2197. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000787), TARGET, Get_Int_Parameter("Target_Number"), 0.0f);
  2198. }
  2199. };
  2200. DECLARE_SCRIPT (M10_Mammoth_Activate_Zone, "")
  2201. {
  2202. bool already_entered;
  2203. // Register variables to be Auto-Saved
  2204. // All variables must have a unique ID, less than 256, that never changes
  2205. REGISTER_VARIABLES()
  2206. {
  2207. SAVE_VARIABLE( already_entered, 1 );
  2208. }
  2209. void Created (GameObject * obj)
  2210. {
  2211. already_entered = false;
  2212. }
  2213. void Entered (GameObject * obj, GameObject * enterer)
  2214. {
  2215. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2216. {
  2217. already_entered = true;
  2218. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000787), MAMMOTH, ATTACK, 0.0f);
  2219. }
  2220. }
  2221. };
  2222. DECLARE_SCRIPT (M10_Stationary, "")
  2223. {
  2224. void Created(GameObject *obj)
  2225. {
  2226. Commands->Set_Innate_Is_Stationary ( obj, true );
  2227. }
  2228. };
  2229. DECLARE_SCRIPT(M10_TestStealth, "")
  2230. {
  2231. bool stealthed;
  2232. float delayTimer;
  2233. REGISTER_VARIABLES()
  2234. {
  2235. SAVE_VARIABLE( stealthed, 1 );
  2236. SAVE_VARIABLE( delayTimer, 2 );
  2237. }
  2238. void Created( GameObject * obj )
  2239. {
  2240. Commands->Innate_Disable(obj);
  2241. delayTimer = Commands->Get_Random ( 10, 20 );
  2242. Commands->Start_Timer(obj, this, delayTimer, 5);
  2243. stealthed = false;
  2244. }
  2245. void Timer_Expired(GameObject * obj, int timer_id)
  2246. {
  2247. if (stealthed == true)
  2248. {
  2249. stealthed = false;
  2250. Commands->Enable_Stealth(obj, false);
  2251. Commands->Debug_Message ( "***************************going out of stealth\n" );
  2252. }
  2253. else
  2254. {
  2255. stealthed = true;
  2256. Commands->Enable_Stealth(obj, true);
  2257. Commands->Debug_Message ( "***************************going to stealth\n" );
  2258. }
  2259. Commands->Start_Timer(obj, this, delayTimer, 5);
  2260. }
  2261. };
  2262. DECLARE_SCRIPT (M10_GDI_Reinforcement_Waypath, "")
  2263. {
  2264. void Created (GameObject * obj)
  2265. {
  2266. Commands->Set_Innate_Aggressiveness ( obj, 10.0f );
  2267. Commands->Set_Innate_Take_Cover_Probability ( obj, 100.0f );
  2268. ActionParamsStruct params;
  2269. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  2270. params.Set_Movement( Vector3(0,0,0), RUN, 0 );
  2271. params.WaypathID = 2000852;
  2272. Commands->Action_Goto (obj, params);
  2273. }
  2274. void Killed(GameObject * obj, GameObject * killer)
  2275. {
  2276. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000861), KILLED, 1);
  2277. }
  2278. };
  2279. DECLARE_SCRIPT (M10_GDI_Reinforcement, "")
  2280. {
  2281. bool already_entered;
  2282. int kill_tally;
  2283. // Register variables to be Auto-Saved
  2284. // All variables must have a unique ID, less than 256, that never changes
  2285. REGISTER_VARIABLES()
  2286. {
  2287. SAVE_VARIABLE( already_entered, 1 );
  2288. SAVE_VARIABLE( kill_tally, 2 );
  2289. }
  2290. void Created (GameObject * obj)
  2291. {
  2292. already_entered = false;
  2293. kill_tally = 0;
  2294. }
  2295. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2296. {
  2297. if (type == REINFORCE)
  2298. {
  2299. Commands->Enable_Spawner (2000850, true);
  2300. Commands->Enable_Spawner (2000849, true);
  2301. Commands->Enable_Spawner (2000851, true);
  2302. GameObject *drop_obj = Commands->Find_Object (2000861);
  2303. GameObject *drop_obj2 = Commands->Find_Object (1203588);
  2304. float facing = Commands->Get_Facing (drop_obj);
  2305. Vector3 drop_loc = Commands->Get_Position (drop_obj);
  2306. float facing2 = Commands->Get_Facing (drop_obj2);
  2307. Vector3 drop_loc2 = Commands->Get_Position (drop_obj2);
  2308. GameObject *new_obj = Commands->Create_Object("Invisible_Object", drop_loc);
  2309. Commands->Set_Facing(new_obj, facing);
  2310. Commands->Attach_Script(new_obj, "Test_Cinematic", "M10_X3I_GDI_TroopDrop1.txt");
  2311. GameObject *new_obj2 = Commands->Create_Object("Invisible_Object", drop_loc2);
  2312. Commands->Set_Facing(new_obj2, facing2);
  2313. Commands->Attach_Script(new_obj2, "Test_Cinematic", "M10_X3I_GDI_TroopDrop1.txt");
  2314. }
  2315. if (type == KILLED)
  2316. {
  2317. kill_tally++;
  2318. if (kill_tally >= 3)
  2319. {
  2320. kill_tally = 0;
  2321. GameObject *drop_obj = Commands->Find_Object (2000861);
  2322. float facing = Commands->Get_Facing (drop_obj);
  2323. Vector3 drop_loc = Commands->Get_Position (drop_obj);
  2324. GameObject *new_obj = Commands->Create_Object("Invisible_Object", drop_loc);
  2325. Commands->Set_Facing(new_obj, facing);
  2326. Commands->Attach_Script(new_obj, "Test_Cinematic", "M10_X3I_GDI_TroopDrop1.txt");
  2327. }
  2328. }
  2329. }
  2330. };
  2331. DECLARE_SCRIPT (M10_SAM_Reinforce, "")
  2332. {
  2333. void Killed (GameObject * obj, GameObject * killer)
  2334. {
  2335. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000861), REINFORCE, 1);
  2336. }
  2337. };
  2338. DECLARE_SCRIPT (M10_Refinery_Key_Grant, "")
  2339. {
  2340. void Killed (GameObject * obj, GameObject * killer)
  2341. {
  2342. Vector3 create_position = Commands->Get_Position( obj );
  2343. create_position.Z += 1.0f;
  2344. GameObject * key1;
  2345. key1 = Commands->Create_Object( "Level_01_Keycard", create_position );
  2346. Commands->Attach_Script(key1, "M10_Refinery_Keycard", "");
  2347. Commands->Set_Objective_Radar_Blip_Object(1012, key1);
  2348. }
  2349. };
  2350. DECLARE_SCRIPT (M10_Gate_Check, "Objective:int, Gate1:int, Gate2:int")
  2351. {
  2352. bool already_poked, first, second;
  2353. REGISTER_VARIABLES()
  2354. {
  2355. SAVE_VARIABLE( already_poked, 1 );
  2356. }
  2357. void Created (GameObject *obj)
  2358. {
  2359. already_poked = false;
  2360. first = false;
  2361. second = false;
  2362. }
  2363. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2364. {
  2365. GameObject * obj_con = Commands->Find_Object(1100154);
  2366. if (action_id == 100002)
  2367. {
  2368. first = true;
  2369. Commands->Send_Custom_Event(obj, obj_con, 1005, 1);
  2370. }
  2371. if (action_id == 100008)
  2372. {
  2373. second = true;
  2374. Commands->Send_Custom_Event(obj, obj_con, 1007, 1);
  2375. }
  2376. if (action_id == 100017)
  2377. {
  2378. Commands->Send_Custom_Event(obj, obj_con, 1006, 1);
  2379. }
  2380. }
  2381. void Poked(GameObject * obj, GameObject * poker)
  2382. {
  2383. GameObject * obj_con = Commands->Find_Object(1100154);
  2384. if (!already_poked)
  2385. {
  2386. if (Commands->Has_Key(STAR, 1))
  2387. {
  2388. already_poked = true;
  2389. int objective = Get_Int_Parameter("Objective");
  2390. int gate1 = Get_Int_Parameter("Gate1");
  2391. int gate2 = Get_Int_Parameter("Gate2");
  2392. //Commands->Send_Custom_Event(obj, Commands->Find_Object (1100154), objective, 1);
  2393. Commands->Static_Anim_Phys_Goto_Last_Frame (gate1, NULL );
  2394. Commands->Static_Anim_Phys_Goto_Last_Frame (gate2, NULL );
  2395. if (objective == 1005)
  2396. {
  2397. int id = Commands->Create_Conversation("M10CON002", 99, 2000, false);
  2398. Commands->Join_Conversation(NULL, id);
  2399. Commands->Start_Conversation(id, 100002);
  2400. Commands->Monitor_Conversation(obj, id);
  2401. }
  2402. if (objective == 1007 && first)
  2403. {
  2404. int id = Commands->Create_Conversation("M10CON008", 99, 2000, false);
  2405. Commands->Join_Conversation(NULL, id);
  2406. Commands->Start_Conversation(id, 100008);
  2407. Commands->Monitor_Conversation(obj, id);
  2408. }
  2409. if (objective == 1007 && !first)
  2410. {
  2411. second = true;
  2412. Commands->Send_Custom_Event(obj, obj_con, 1007, 1);
  2413. }
  2414. if (objective == 1006 && first && second)
  2415. {
  2416. int id = Commands->Create_Conversation("M10CON017", 99, 2000, false);
  2417. Commands->Join_Conversation(NULL, id);
  2418. Commands->Join_Conversation(STAR, id);
  2419. Commands->Start_Conversation(id, 100017);
  2420. Commands->Monitor_Conversation(obj, id);
  2421. }
  2422. if (objective == 1006 && !first && second)
  2423. {
  2424. Commands->Send_Custom_Event(obj, obj_con, 1006, 1);
  2425. }
  2426. if (objective == 1006 && first && !second)
  2427. {
  2428. Commands->Send_Custom_Event(obj, obj_con, 1006, 1);
  2429. }
  2430. if (objective == 1006 && !first && !second)
  2431. {
  2432. Commands->Send_Custom_Event(obj, obj_con, 1006, 1);
  2433. }
  2434. }
  2435. }
  2436. }
  2437. };
  2438. DECLARE_SCRIPT (M10_ConYard_Key_Grant, "")
  2439. {
  2440. void Killed (GameObject * obj, GameObject * killer)
  2441. {
  2442. Vector3 create_position = Commands->Get_Position( obj );
  2443. create_position.Z += 1.0f;
  2444. Commands->Create_Object( "Level_03_Keycard", create_position );
  2445. }
  2446. };
  2447. DECLARE_SCRIPT (M10_Spacecraft_Check, "")
  2448. {
  2449. void Poked(GameObject * obj, GameObject * poker)
  2450. {
  2451. if (Commands->Has_Key(STAR, 3))
  2452. {
  2453. Commands->Static_Anim_Phys_Goto_Last_Frame (2058171, NULL );
  2454. }
  2455. }
  2456. };
  2457. DECLARE_SCRIPT (M10_Mammoth_Grant_Controller, "") //2001634
  2458. {
  2459. bool hon_alive;
  2460. // Register variables to be Auto-Saved
  2461. // All variables must have a unique ID, less than 256, that never changes
  2462. REGISTER_VARIABLES()
  2463. {
  2464. SAVE_VARIABLE( hon_alive, 1 );
  2465. }
  2466. void Created (GameObject * obj)
  2467. {
  2468. hon_alive = true;
  2469. }
  2470. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2471. {
  2472. GameObject * mammoth = Commands->Find_Object (2000787);
  2473. if (type == KILLED)
  2474. {
  2475. if (param == HON)
  2476. {
  2477. hon_alive = false;
  2478. if (!hon_alive && mammoth)
  2479. {
  2480. Commands->Send_Custom_Event(obj, obj, GRANT, 0);
  2481. }
  2482. }
  2483. }
  2484. if (type == GRANT)
  2485. {
  2486. GameObject *mammoth = Commands->Find_Object (2000787);
  2487. float curr_health = Commands->Get_Health(mammoth);
  2488. Vector3 mammoth_loc = Commands->Get_Position (mammoth);
  2489. float mammoth_face = Commands->Get_Facing (mammoth);
  2490. GameObject *mammoth_new;
  2491. mammoth_new = Commands->Create_Object ("GDI_Mammoth_Tank_Player", mammoth_loc);
  2492. Commands->Attach_Script(mammoth_new, "M10_Occupied", "");
  2493. Commands->Set_Health(mammoth_new, curr_health);
  2494. Commands->Set_Facing ( mammoth_new, mammoth_face );
  2495. Commands->Destroy_Object (mammoth);
  2496. GameObject *GDI_soldier;
  2497. Vector3 GI_loc = Commands->Get_Position (Commands->Find_Object (2001634));
  2498. GDI_soldier = Commands->Create_Object ("GDI_MP", GI_loc);
  2499. int id = Commands->Create_Conversation("M10CON071", 99, 2000, false);
  2500. Commands->Join_Conversation(GDI_soldier, id);
  2501. Commands->Start_Conversation(id, 100071);
  2502. Commands->Monitor_Conversation(obj, id);
  2503. }
  2504. }
  2505. };
  2506. DECLARE_SCRIPT (M10_Hon_Killed, "")
  2507. {
  2508. void Killed(GameObject * obj, GameObject * killer)
  2509. {
  2510. Commands->Enable_Spawner (2000849, false);
  2511. Commands->Enable_Spawner (2000850, false);
  2512. Commands->Enable_Spawner (2000851, false);
  2513. Commands->Send_Custom_Event(obj, Commands->Find_Object (2001634), KILLED, HON);
  2514. }
  2515. };
  2516. DECLARE_SCRIPT (M10_Helipad_Killed, "")
  2517. {
  2518. void Killed(GameObject * obj, GameObject * killer)
  2519. {
  2520. Commands->Send_Custom_Event(obj, Commands->Find_Object (2001634), KILLED, HELIPAD);
  2521. }
  2522. };
  2523. DECLARE_SCRIPT (M10_Stealth_Drop, "")
  2524. {
  2525. void Created (GameObject * obj)
  2526. {
  2527. Commands->Enable_Stealth (obj, false);
  2528. }
  2529. void Destroyed(GameObject * obj)
  2530. {
  2531. Commands->Send_Custom_Event( obj, Commands->Find_Object (1110056), KILLED, 0 );
  2532. }
  2533. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2534. {
  2535. if (type == 2500)
  2536. {
  2537. Commands->Enable_Stealth (obj, true);
  2538. Commands->Start_Timer(obj, this, 2.5f, 2501);
  2539. }
  2540. if (type == 3500)
  2541. {
  2542. Commands->Enable_Stealth (obj, true);
  2543. }
  2544. }
  2545. void Timer_Expired(GameObject * obj, int timer_id )
  2546. {
  2547. if(timer_id == 2501)
  2548. {
  2549. Commands->Destroy_Object (obj);
  2550. }
  2551. }
  2552. };
  2553. DECLARE_SCRIPT(DME_Cinematic_Zone, "")
  2554. {
  2555. bool already_entered;
  2556. int drop_area [4];
  2557. bool stealthtank_alive;
  2558. int reinforce_chance;
  2559. int stealth_counter;
  2560. // Register variables to be Auto-Saved
  2561. // All variables must have a unique ID, less than 256, that never changes
  2562. REGISTER_VARIABLES()
  2563. {
  2564. SAVE_VARIABLE( already_entered, 1 );
  2565. SAVE_VARIABLE( stealthtank_alive, 2 );
  2566. SAVE_VARIABLE( reinforce_chance, 3 );
  2567. SAVE_VARIABLE( stealth_counter, 4 );
  2568. SAVE_VARIABLE( drop_area [0], 5 );
  2569. SAVE_VARIABLE( drop_area [1], 6 );
  2570. SAVE_VARIABLE( drop_area [2], 7 );
  2571. SAVE_VARIABLE( drop_area [3], 8 );
  2572. }
  2573. void Created (GameObject * obj)
  2574. {
  2575. already_entered = false;
  2576. stealthtank_alive = false;
  2577. reinforce_chance = 0;
  2578. stealth_counter = 0;
  2579. drop_area [0] = 2002356; //Top of Hill
  2580. drop_area [1] = 2002357; //Hand of Nod
  2581. drop_area [2] = 2003814; //Bottom of Hill
  2582. drop_area [3] = 2003815; //Above Tank
  2583. }
  2584. void Entered (GameObject * obj, GameObject * enterer)
  2585. {
  2586. if(!already_entered)
  2587. {
  2588. already_entered = true;
  2589. stealth_counter++;
  2590. float stealth_face = Commands->Get_Facing (Commands->Find_Object (drop_area [2]));
  2591. Vector3 drop_loc = Commands->Get_Position (Commands->Find_Object (drop_area [2]));
  2592. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", drop_loc);
  2593. Commands->Set_Facing(chinook_obj3, stealth_face);
  2594. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "M10_XG_VehicleDrop2.txt");
  2595. stealthtank_alive = true;
  2596. Commands->Start_Timer(obj, this, 10.0f, FAKE_TIMER);
  2597. }
  2598. }
  2599. void Timer_Expired (GameObject* obj, int timer_id)
  2600. {
  2601. reinforce_chance = Commands->Get_Random_Int (1, 6);
  2602. if (timer_id == FAKE_TIMER && stealth_counter < 4)
  2603. {
  2604. if (!stealthtank_alive && reinforce_chance >= 4)
  2605. {
  2606. stealth_counter++;
  2607. stealthtank_alive = true;
  2608. int random_loc = Commands->Get_Random_Int (0, 4);
  2609. float stealth_face = Commands->Get_Facing (Commands->Find_Object (drop_area [random_loc]));
  2610. Vector3 drop_loc = Commands->Get_Position (Commands->Find_Object (drop_area [random_loc]));
  2611. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", drop_loc);
  2612. Commands->Set_Facing(chinook_obj3, stealth_face);
  2613. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "M10_XG_VehicleDrop2.txt");
  2614. }
  2615. Commands->Start_Timer(obj, this, 10.0f, FAKE_TIMER);
  2616. }
  2617. }
  2618. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2619. {
  2620. if (type == KILLED)
  2621. {
  2622. stealthtank_alive = false;
  2623. }
  2624. }
  2625. };
  2626. DECLARE_SCRIPT (M10_Stealth_Attack_01, "")
  2627. {
  2628. bool attacking, charge, charging, same;
  2629. int attack_loc [13];
  2630. float loc_dist;
  2631. int loc;
  2632. Vector3 current_loc;
  2633. Vector3 enemy_loc;
  2634. enum{ATTACK_OVER};
  2635. // Register variables to be Auto-Saved
  2636. // All variables must have a unique ID, less than 256, that never changes
  2637. REGISTER_VARIABLES()
  2638. {
  2639. SAVE_VARIABLE( attacking, 1 );
  2640. SAVE_VARIABLE( charge, 2 );
  2641. SAVE_VARIABLE( charging, 3 );
  2642. SAVE_VARIABLE( current_loc, 4 );
  2643. SAVE_VARIABLE( enemy_loc, 5 );
  2644. SAVE_VARIABLE( loc_dist, 6 );
  2645. SAVE_VARIABLE( loc, 7 );
  2646. SAVE_VARIABLE( same, 8 );
  2647. }
  2648. void Created(GameObject * obj)
  2649. {
  2650. Commands->Enable_Enemy_Seen( obj, true);
  2651. attacking = false;
  2652. charge = false;
  2653. charging = false;
  2654. same = false;
  2655. attack_loc [0] = 2003080;
  2656. attack_loc [1] = 2003081;
  2657. attack_loc [2] = 2003082;
  2658. attack_loc [3] = 2003083;
  2659. attack_loc [4] = 2003084;
  2660. attack_loc [5] = 2003085;
  2661. attack_loc [6] = 2003086;
  2662. attack_loc [7] = 2003087;
  2663. attack_loc [8] = 2003088;
  2664. attack_loc [9] = 2003089;
  2665. attack_loc [10] = 2003090;
  2666. attack_loc [11] = 2003091;
  2667. attack_loc [12] = 2003092;
  2668. loc_dist = 1000.0f;
  2669. loc = 100;
  2670. Commands->Start_Timer(obj, this, 1.0f, GOTO_LOC);
  2671. }
  2672. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2673. {
  2674. if (action_id == 10 && reason ==ACTION_COMPLETE_NORMAL)
  2675. {
  2676. Commands->Debug_Message ("Up Yours!!");
  2677. }
  2678. }
  2679. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2680. {
  2681. ActionParamsStruct params;
  2682. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  2683. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  2684. params.Set_Attack(enemy, 100.0f, 5.0f, true);
  2685. params.AttackCheckBlocked = false;
  2686. //params.AttackActive = true;
  2687. Commands->Modify_Action(obj, 10, params);
  2688. }
  2689. void Killed(GameObject * obj, GameObject * killer)
  2690. {
  2691. Commands->Send_Custom_Event( obj, Commands->Find_Object (1110056), KILLED, 0 );
  2692. }
  2693. void Timer_Expired (GameObject* obj, int timer_id)
  2694. {
  2695. if (timer_id == GOTO_LOC)
  2696. {
  2697. current_loc = Commands->Get_Position ( obj );
  2698. Vector3 star_loc = Commands->Get_Position (STAR);
  2699. for (int x = 0; x <= 12; x++)
  2700. {
  2701. float dist = Commands->Get_Distance(star_loc, Commands->Get_Position (Commands->Find_Object (attack_loc [x])));
  2702. if (dist < loc_dist)
  2703. {
  2704. loc_dist = dist;
  2705. loc = x;
  2706. }
  2707. }
  2708. loc_dist = 1000.0f;
  2709. if(loc >= 13)
  2710. {
  2711. Commands->Debug_Message("*** Warning! Loc = %d", loc);
  2712. }
  2713. if (!same)
  2714. {
  2715. Commands->Action_Reset(obj, 99);
  2716. ActionParamsStruct params;
  2717. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  2718. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  2719. //params.Set_Attack(STAR, 100.0f, 5.0f, true);
  2720. //params.AttackCheckBlocked = false;
  2721. //params.AttackActive = true;
  2722. //Commands->Modify_Action(obj, 10, params);
  2723. Commands->Action_Attack(obj, params);
  2724. }
  2725. Commands->Start_Timer(obj, this, 10.0f, GOTO_LOC);
  2726. }
  2727. }
  2728. };
  2729. DECLARE_SCRIPT (M10_Stealth_Attack_02, "")
  2730. {
  2731. bool attacking, charge, charging, same;
  2732. int attack_loc [13];
  2733. float loc_dist;
  2734. int loc;
  2735. Vector3 current_loc;
  2736. Vector3 enemy_loc;
  2737. enum{ATTACK_OVER};
  2738. // Register variables to be Auto-Saved
  2739. // All variables must have a unique ID, less than 256, that never changes
  2740. REGISTER_VARIABLES()
  2741. {
  2742. SAVE_VARIABLE( attacking, 1 );
  2743. SAVE_VARIABLE( charge, 2 );
  2744. SAVE_VARIABLE( charging, 3 );
  2745. SAVE_VARIABLE( current_loc, 4 );
  2746. SAVE_VARIABLE( enemy_loc, 5 );
  2747. SAVE_VARIABLE( loc_dist, 6 );
  2748. SAVE_VARIABLE( loc, 7 );
  2749. }
  2750. void Created(GameObject * obj)
  2751. {
  2752. Commands->Enable_Enemy_Seen( obj, true);
  2753. attacking = false;
  2754. charge = false;
  2755. charging = false;
  2756. same = false;
  2757. Commands->Enable_Stealth (obj, true);
  2758. attack_loc [0] = 2005985;
  2759. attack_loc [1] = 2005986;
  2760. attack_loc [2] = 2005987;
  2761. attack_loc [3] = 2005988;
  2762. attack_loc [4] = 2005989;
  2763. attack_loc [5] = 2005990;
  2764. attack_loc [6] = 2005991;
  2765. attack_loc [7] = 2005992;
  2766. attack_loc [8] = 2005993;
  2767. attack_loc [9] = 2005994;
  2768. attack_loc [10] = 2005995;
  2769. attack_loc [11] = 2005996;
  2770. attack_loc [12] = 2005996;
  2771. loc_dist = 1000.0f;
  2772. loc = 100;
  2773. Commands->Start_Timer(obj, this, 0.25f, GOTO_LOC);
  2774. /*ActionParamsStruct params;
  2775. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  2776. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  2777. params.WaypathID = 2000095;
  2778. Commands->Action_Attack (obj, params);*/
  2779. }
  2780. void Killed(GameObject * obj, GameObject *killer )
  2781. {
  2782. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100161), TANK_KILLED, 0);
  2783. }
  2784. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2785. {
  2786. if (action_id == 10 && reason ==ACTION_COMPLETE_NORMAL)
  2787. {
  2788. Commands->Debug_Message ("Up Yours!!");
  2789. }
  2790. }
  2791. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2792. {
  2793. ActionParamsStruct params;
  2794. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  2795. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  2796. params.Set_Attack(enemy, 100.0f, 5.0f, true);
  2797. params.AttackCheckBlocked = false;
  2798. //params.AttackActive = true;
  2799. Commands->Modify_Action(obj, 10, params);
  2800. }
  2801. void Timer_Expired (GameObject* obj, int timer_id)
  2802. {
  2803. if (timer_id == GOTO_LOC)
  2804. {
  2805. current_loc = Commands->Get_Position ( obj );
  2806. Vector3 star_loc = Commands->Get_Position (STAR);
  2807. for (int x = 0; x <= 12; x++)
  2808. {
  2809. float dist = Commands->Get_Distance(star_loc, Commands->Get_Position (Commands->Find_Object (attack_loc [x])));
  2810. if (dist < loc_dist)
  2811. {
  2812. loc_dist = dist;
  2813. loc = x;
  2814. }
  2815. }
  2816. loc_dist = 1000.0f;
  2817. if (!same)
  2818. {
  2819. Commands->Action_Reset(obj, 99);
  2820. ActionParamsStruct params;
  2821. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  2822. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), 1.0f, 5.0f );
  2823. //params.Set_Attack(STAR, 100.0f, 5.0f, true);
  2824. //params.AttackCheckBlocked = false;
  2825. //params.AttackActive = true;
  2826. //Commands->Modify_Action(obj, 10, params);
  2827. Commands->Action_Attack(obj, params);
  2828. }
  2829. Commands->Start_Timer(obj, this, 10.0f, GOTO_LOC);
  2830. }
  2831. }
  2832. };
  2833. DECLARE_SCRIPT(M10_Nod_Obelisk, "")
  2834. {
  2835. bool attacking;
  2836. enum{ATTACK_OVER};
  2837. // Register variables to be Auto-Saved
  2838. // All variables must have a unique ID, less than 256, that never changes
  2839. REGISTER_VARIABLES()
  2840. {
  2841. SAVE_VARIABLE( attacking, 1 );
  2842. }
  2843. void Created (GameObject * obj)
  2844. {
  2845. Commands->Disable_All_Collisions(obj);
  2846. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  2847. Commands->Set_Is_Rendered(obj, false);
  2848. Commands->Enable_Enemy_Seen( obj, true);
  2849. attacking = false;
  2850. }
  2851. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2852. {
  2853. ActionParamsStruct params;
  2854. if(!attacking)
  2855. {
  2856. attacking = true;
  2857. params.Set_Basic( this, 99, 1 );
  2858. params.Set_Attack (enemy, 100.0f, 0.5f, 1);
  2859. params.AttackCheckBlocked = false;
  2860. Commands->Action_Attack( obj, params );
  2861. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2862. }
  2863. }
  2864. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2865. {
  2866. if(type == M10_PLAYERTYPE_CHANGE_OBELISK)
  2867. {
  2868. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  2869. }
  2870. if (type == KILLED)
  2871. {
  2872. Commands->Destroy_Object (obj);
  2873. }
  2874. }
  2875. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2876. {
  2877. ActionParamsStruct params;
  2878. if(!attacking)
  2879. {
  2880. attacking = true;
  2881. params.Set_Basic( this, 99, 1 );
  2882. params.Set_Attack (damager, 100.0f, 0.5f, 1);
  2883. params.AttackCheckBlocked = false;
  2884. Commands->Action_Attack( obj, params );
  2885. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2886. }
  2887. }
  2888. void Timer_Expired (GameObject* obj, int timer_id)
  2889. {
  2890. ActionParamsStruct params;
  2891. if(timer_id == ATTACK_OVER)
  2892. {
  2893. attacking = false;
  2894. }
  2895. }
  2896. };
  2897. DECLARE_SCRIPT(M10_Obelisk_MCT, "")
  2898. {
  2899. bool alive;
  2900. REGISTER_VARIABLES()
  2901. {
  2902. SAVE_VARIABLE( alive, 1 );
  2903. }
  2904. void Created (GameObject * obj)
  2905. {
  2906. //Commands->Set_Is_Rendered(obj, false);
  2907. alive = true;
  2908. }
  2909. void Poked(GameObject * obj, GameObject * poker)
  2910. {
  2911. if (alive)
  2912. {
  2913. Commands->Send_Custom_Event( obj, Commands->Find_Object (2010415), M10_PLAYERTYPE_CHANGE_OBELISK, 0);
  2914. }
  2915. }
  2916. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2917. {
  2918. if (type == KILLED)
  2919. {
  2920. alive = false;
  2921. }
  2922. }
  2923. };
  2924. DECLARE_SCRIPT(M10_Refinery_Keycard, "")
  2925. {
  2926. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2927. {
  2928. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  2929. {
  2930. GameObject * obj_con = Commands->Find_Object(1100154);
  2931. if (obj_con)
  2932. {
  2933. Commands->Send_Custom_Event(obj, obj_con, 1012, 1);
  2934. }
  2935. }
  2936. }
  2937. };
  2938. DECLARE_SCRIPT(M10_Playertype_Nod, "")
  2939. {
  2940. void Created (GameObject *obj)
  2941. {
  2942. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  2943. }
  2944. };
  2945. DECLARE_SCRIPT (M10_Flyover_Controller, "")
  2946. {
  2947. int last;
  2948. int last2;
  2949. int last3;
  2950. int count;
  2951. bool already_entered;
  2952. REGISTER_VARIABLES()
  2953. {
  2954. SAVE_VARIABLE( last, 1 );
  2955. SAVE_VARIABLE( last2, 2 );
  2956. SAVE_VARIABLE( last3, 3 );
  2957. SAVE_VARIABLE( count, 4 );
  2958. SAVE_VARIABLE( already_entered, 5 );
  2959. }
  2960. void Created (GameObject *obj)
  2961. {
  2962. last, last2, last3 = 100;
  2963. count = 2;
  2964. already_entered = false;
  2965. }
  2966. void Entered (GameObject * obj, GameObject * enterer)
  2967. {
  2968. if (!already_entered)
  2969. {
  2970. already_entered = true;
  2971. Commands->Send_Custom_Event ( obj, obj, FLYOVER, 0, 0 );
  2972. }
  2973. }
  2974. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2975. {
  2976. if (type == FLYOVER)
  2977. {
  2978. if (++count >= 3)
  2979. {
  2980. count = 0;
  2981. char *flyovers[10] =
  2982. {
  2983. "X10A_Apache_00.txt",
  2984. "X10A_Apache_01.txt",
  2985. "X10A_Apache_02.txt",
  2986. "X10A_Apache_03.txt",
  2987. "X10A_Apache_04.txt",
  2988. "X10A_Trnspt_00.txt",
  2989. "X10A_Trnspt_01.txt",
  2990. "X10A_Trnspt_02.txt",
  2991. "X10A_Trnspt_03.txt",
  2992. "X10A_Trnspt_04.txt",
  2993. };
  2994. int random = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  2995. while (random == last) {
  2996. random = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  2997. }
  2998. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  2999. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  3000. last = random;
  3001. int random2 = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3002. while (random2 == last2 || random2 == random) {
  3003. random2 = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3004. }
  3005. GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3006. Commands->Attach_Script(controller2, "Test_Cinematic", flyovers[random2]);
  3007. last2 = random2;
  3008. int random3 = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3009. while (random3 == last3 || random3 == random || random3 == random2) {
  3010. random3 = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3011. }
  3012. GameObject *controller3 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3013. Commands->Attach_Script(controller3, "Test_Cinematic", flyovers[random3]);
  3014. last3 = random3;
  3015. }
  3016. }
  3017. }
  3018. };
  3019. DECLARE_SCRIPT (M10_Conversation_Zone, "Conv_Num:int")
  3020. {
  3021. bool already_entered;
  3022. REGISTER_VARIABLES()
  3023. {
  3024. SAVE_VARIABLE( already_entered, 1 );
  3025. }
  3026. void Created (GameObject * obj)
  3027. {
  3028. already_entered = false;
  3029. }
  3030. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3031. {
  3032. if (type == ENTERED)
  3033. {
  3034. already_entered = true;
  3035. }
  3036. }
  3037. void Timer_Expired(GameObject * obj, int timer_id)
  3038. {
  3039. GameObject * obj_con = Commands->Find_Object(1100154);
  3040. if (timer_id == KEY_OBJ)
  3041. {
  3042. Commands->Send_Custom_Event(obj, obj_con, 1012, 3);
  3043. }
  3044. };
  3045. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3046. {
  3047. GameObject * obj_con = Commands->Find_Object(1100154);
  3048. if (action_id == 100001)
  3049. {
  3050. Commands->Send_Custom_Event(obj, obj_con, 1005, 3);
  3051. Commands->Start_Timer (obj, this, 2.5f, KEY_OBJ);
  3052. }
  3053. if (action_id == 100004)
  3054. {
  3055. Commands->Send_Custom_Event(obj, obj_con, 1002, 3);
  3056. }
  3057. if (action_id == 100007)
  3058. {
  3059. Commands->Send_Custom_Event(obj, obj_con, 1007, 3);
  3060. }
  3061. if (action_id == 100010)
  3062. {
  3063. Commands->Send_Custom_Event(obj, obj_con, 1004, 3);
  3064. }
  3065. if (action_id == 100015)
  3066. {
  3067. Commands->Send_Custom_Event(obj, obj_con, 1001, 3);
  3068. }
  3069. if (action_id == 100018)
  3070. {
  3071. Commands->Send_Custom_Event(obj, obj_con, 1006, 3);
  3072. }
  3073. if (action_id == 100020)
  3074. {
  3075. Commands->Send_Custom_Event(obj, obj_con, 1008, 3);
  3076. }
  3077. if (action_id == 100027)
  3078. {
  3079. Commands->Send_Custom_Event(obj, obj_con, 1015, 3);
  3080. }
  3081. if (action_id == 100030)
  3082. {
  3083. Commands->Send_Custom_Event(obj, obj_con, 1009, 3);
  3084. }
  3085. if (action_id == 100033)
  3086. {
  3087. Commands->Send_Custom_Event(obj, obj_con, 1018, 3);
  3088. }
  3089. if (action_id == 100036)
  3090. {
  3091. Commands->Send_Custom_Event(obj, obj_con, 1010, 3);
  3092. }
  3093. if (action_id == 100039)
  3094. {
  3095. Commands->Send_Custom_Event(obj, obj_con, 1014, 3);
  3096. }
  3097. if (action_id == 100042)
  3098. {
  3099. Commands->Send_Custom_Event(obj, obj_con, 1011, 3);
  3100. }
  3101. if (action_id == 100044)
  3102. {
  3103. Commands->Send_Custom_Event(obj, obj_con, 1017, 3);
  3104. }
  3105. if (action_id == 100051)
  3106. {
  3107. Commands->Send_Custom_Event(obj, obj_con, 1019, 3);
  3108. }
  3109. }
  3110. void Entered (GameObject * obj, GameObject * enterer)
  3111. {
  3112. if (!already_entered)
  3113. {
  3114. switch(Get_Int_Parameter("Conv_Num"))
  3115. {
  3116. case 1:
  3117. {
  3118. already_entered = true;
  3119. int id = Commands->Create_Conversation("M10CON001", 99, 2000, false);
  3120. Commands->Join_Conversation(NULL, id);
  3121. Commands->Start_Conversation(id, 100001);
  3122. Commands->Monitor_Conversation(obj, id);
  3123. }
  3124. break;
  3125. case 3:
  3126. {
  3127. already_entered = true;
  3128. int id = Commands->Create_Conversation("M10CON003", 99, 2000, false);
  3129. Commands->Join_Conversation(NULL, id);
  3130. Commands->Start_Conversation(id, 100003);
  3131. Commands->Monitor_Conversation(obj, id);
  3132. }
  3133. break;
  3134. case 4:
  3135. {
  3136. already_entered = true;
  3137. int id = Commands->Create_Conversation("M10CON004", 100, 2000, false);
  3138. Commands->Join_Conversation(NULL, id);
  3139. Commands->Start_Conversation(id, 100004);
  3140. Commands->Monitor_Conversation(obj, id);
  3141. }
  3142. break;
  3143. case 6:
  3144. {
  3145. already_entered = true;
  3146. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014793), ENTERED, 0);
  3147. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014792), ENTERED, 0);
  3148. int id = Commands->Create_Conversation("M10CON006", 99, 2000, false);
  3149. Commands->Join_Conversation(NULL, id);
  3150. Commands->Join_Conversation(STAR, id);
  3151. Commands->Start_Conversation(id, 100006);
  3152. Commands->Monitor_Conversation(obj, id);
  3153. }
  3154. break;
  3155. case 7:
  3156. {
  3157. already_entered = true;
  3158. Commands->Send_Custom_Event(obj, Commands->Find_Object (2017710), ENTERED, 0);
  3159. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014796), ENTERED, 0);
  3160. int id = Commands->Create_Conversation("M10CON007", 99, 2000, false);
  3161. Commands->Join_Conversation(NULL, id);
  3162. Commands->Start_Conversation(id, 100007);
  3163. Commands->Monitor_Conversation(obj, id);
  3164. }
  3165. break;
  3166. case 10:
  3167. {
  3168. already_entered = true;
  3169. int id = Commands->Create_Conversation("M10CON010", 99, 2000, false);
  3170. Commands->Join_Conversation(NULL, id);
  3171. Commands->Join_Conversation(STAR, id);
  3172. Commands->Start_Conversation(id, 100010);
  3173. Commands->Monitor_Conversation(obj, id);
  3174. }
  3175. break;
  3176. case 13:
  3177. {
  3178. already_entered = true;
  3179. int id = Commands->Create_Conversation("M10CON013", 99, 2000, false);
  3180. Commands->Join_Conversation(NULL, id);
  3181. Commands->Start_Conversation(id, 100013);
  3182. Commands->Monitor_Conversation(obj, id);
  3183. }
  3184. break;
  3185. case 15:
  3186. {
  3187. already_entered = true;
  3188. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014798), ENTERED, 0);
  3189. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014799), ENTERED, 0);
  3190. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014800), ENTERED, 0);
  3191. int id = Commands->Create_Conversation("M10CON015", 99, 2000, false);
  3192. Commands->Join_Conversation(NULL, id);
  3193. Commands->Start_Conversation(id, 100015);
  3194. Commands->Monitor_Conversation(obj, id);
  3195. }
  3196. break;
  3197. case 16:
  3198. {
  3199. already_entered = true;
  3200. int id = Commands->Create_Conversation("M10CON009", 99, 2000, false);
  3201. Commands->Join_Conversation(NULL, id);
  3202. Commands->Join_Conversation(STAR, id);
  3203. Commands->Start_Conversation(id, 100016);
  3204. Commands->Monitor_Conversation(obj, id);
  3205. }
  3206. break;
  3207. case 18:
  3208. {
  3209. already_entered = true;
  3210. int id = Commands->Create_Conversation("M10CON018", 99, 2000, false);
  3211. Commands->Join_Conversation(NULL, id);
  3212. Commands->Join_Conversation(STAR, id);
  3213. Commands->Start_Conversation(id, 100018);
  3214. Commands->Monitor_Conversation(obj, id);
  3215. }
  3216. break;
  3217. case 20:
  3218. {
  3219. already_entered = true;
  3220. int id = Commands->Create_Conversation("M10CON020", 99, 2000, false);
  3221. Commands->Join_Conversation(NULL, id);
  3222. Commands->Join_Conversation(STAR, id);
  3223. Commands->Start_Conversation(id, 100020);
  3224. Commands->Monitor_Conversation(obj, id);
  3225. }
  3226. break;
  3227. case 22:
  3228. {
  3229. if (Commands->Get_Health (Commands->Find_Object (1153939)) > 0.0f)
  3230. {
  3231. already_entered = true;
  3232. int id = Commands->Create_Conversation("M10CON022", 99, 2000, false);
  3233. Commands->Join_Conversation(NULL, id);
  3234. Commands->Join_Conversation(STAR, id);
  3235. Commands->Start_Conversation(id, 100022);
  3236. Commands->Monitor_Conversation(obj, id);
  3237. }
  3238. }
  3239. break;
  3240. case 23:
  3241. {
  3242. if (Commands->Get_Health (Commands->Find_Object (1153939)) > 0.0f)
  3243. {
  3244. already_entered = true;
  3245. int id = Commands->Create_Conversation("M10CON023", 99, 2000, false);
  3246. Commands->Join_Conversation(NULL, id);
  3247. Commands->Start_Conversation(id, 100023);
  3248. Commands->Monitor_Conversation(obj, id);
  3249. }
  3250. }
  3251. break;
  3252. case 27:
  3253. {
  3254. already_entered = true;
  3255. int id = Commands->Create_Conversation("M10CON027", 99, 2000, false);
  3256. Commands->Join_Conversation(NULL, id);
  3257. Commands->Join_Conversation(STAR, id);
  3258. Commands->Start_Conversation(id, 100027);
  3259. Commands->Monitor_Conversation(obj, id);
  3260. }
  3261. break;
  3262. case 29:
  3263. {
  3264. if (Commands->Get_Health (Commands->Find_Object (1100007)) > 0.0f)
  3265. {
  3266. already_entered = true;
  3267. int id = Commands->Create_Conversation("M10CON029", 99, 2000, false);
  3268. Commands->Join_Conversation(NULL, id);
  3269. Commands->Join_Conversation(STAR, id);
  3270. Commands->Start_Conversation(id, 100029);
  3271. Commands->Monitor_Conversation(obj, id);
  3272. }
  3273. }
  3274. break;
  3275. case 30:
  3276. {
  3277. already_entered = true;
  3278. Commands->Send_Custom_Event(obj, Commands->Find_Object (2015525), ENTERED, 0);
  3279. Commands->Send_Custom_Event(obj, Commands->Find_Object (2015524), ENTERED, 0);
  3280. int id = Commands->Create_Conversation("M10CON030", 99, 2000, false);
  3281. Commands->Join_Conversation(NULL, id);
  3282. Commands->Join_Conversation(STAR, id);
  3283. Commands->Start_Conversation(id, 100030);
  3284. Commands->Monitor_Conversation(obj, id);
  3285. }
  3286. break;
  3287. case 32:
  3288. {
  3289. if (Commands->Get_Health (Commands->Find_Object (1153940)) > 0.0f)
  3290. {
  3291. already_entered = true;
  3292. Commands->Send_Custom_Event(obj, Commands->Find_Object (2016248), ENTERED, 0);
  3293. Commands->Send_Custom_Event(obj, Commands->Find_Object (2016249), ENTERED, 0);
  3294. int id = Commands->Create_Conversation("M10CON032", 99, 2000, false);
  3295. Commands->Join_Conversation(NULL, id);
  3296. Commands->Join_Conversation(STAR, id);
  3297. Commands->Start_Conversation(id, 100032);
  3298. Commands->Monitor_Conversation(obj, id);
  3299. }
  3300. }
  3301. break;
  3302. case 33:
  3303. {
  3304. if (Commands->Find_Object (1100008) && Commands->Find_Object (1100009))
  3305. {
  3306. already_entered = true;
  3307. int id = Commands->Create_Conversation("M10CON033", 99, 2000, false);
  3308. Commands->Join_Conversation(NULL, id);
  3309. Commands->Join_Conversation(STAR, id);
  3310. Commands->Start_Conversation(id, 100033);
  3311. Commands->Monitor_Conversation(obj, id);
  3312. }
  3313. }
  3314. break;
  3315. case 36:
  3316. {
  3317. if (Commands->Get_Health (Commands->Find_Object (1153934)) > 0.0f)
  3318. {
  3319. already_entered = true;
  3320. int id = Commands->Create_Conversation("M10CON036", 99, 2000, false);
  3321. Commands->Join_Conversation(STAR, id);
  3322. Commands->Start_Conversation(id, 100036);
  3323. Commands->Monitor_Conversation(obj, id);
  3324. }
  3325. }
  3326. break;
  3327. case 38:
  3328. {
  3329. if (Commands->Get_Health (Commands->Find_Object (1153934)) > 0.0f)
  3330. {
  3331. already_entered = true;
  3332. int id = Commands->Create_Conversation("M10CON038", 99, 2000, false);
  3333. Commands->Join_Conversation(NULL, id);
  3334. Commands->Join_Conversation(STAR, id);
  3335. Commands->Start_Conversation(id, 100038);
  3336. Commands->Monitor_Conversation(obj, id);
  3337. }
  3338. }
  3339. break;
  3340. case 39:
  3341. {
  3342. if (Commands->Get_Health (Commands->Find_Object (2063322)) > 0.0f)
  3343. {
  3344. already_entered = true;
  3345. int id = Commands->Create_Conversation("M10CON039", 99, 2000, false);
  3346. Commands->Join_Conversation(NULL, id);
  3347. Commands->Join_Conversation(STAR, id);
  3348. Commands->Start_Conversation(id, 100039);
  3349. Commands->Monitor_Conversation(obj, id);
  3350. }
  3351. }
  3352. break;
  3353. case 42:
  3354. {
  3355. if (Commands->Get_Health (Commands->Find_Object (2063323)) > 0.0f || Commands->Get_Health (Commands->Find_Object (1153935)) > 0.0f)
  3356. {
  3357. already_entered = true;
  3358. Commands->Send_Custom_Event(obj, Commands->Find_Object (2016251), ENTERED, 0);
  3359. Commands->Send_Custom_Event(obj, Commands->Find_Object (2016976), ENTERED, 0);
  3360. int id = Commands->Create_Conversation("M10CON042", 99, 2000, false);
  3361. Commands->Join_Conversation(STAR, id);
  3362. Commands->Join_Conversation(NULL, id);
  3363. Commands->Start_Conversation(id, 100042);
  3364. Commands->Monitor_Conversation(obj, id);
  3365. }
  3366. }
  3367. break;
  3368. case 44:
  3369. {
  3370. if (Commands->Get_Health (Commands->Find_Object (1100012)) > 0.0f || Commands->Get_Health (Commands->Find_Object (1100011)) > 0.0f)
  3371. {
  3372. already_entered = true;
  3373. Commands->Send_Custom_Event(obj, Commands->Find_Object (2017698), ENTERED, 0);
  3374. Commands->Send_Custom_Event(obj, Commands->Find_Object (2017699), ENTERED, 0);
  3375. int id = Commands->Create_Conversation("M10CON044", 99, 2000, false);
  3376. Commands->Join_Conversation(NULL, id);
  3377. Commands->Start_Conversation(id, 100044);
  3378. Commands->Monitor_Conversation(obj, id);
  3379. }
  3380. }
  3381. break;
  3382. case 47:
  3383. {
  3384. if (Commands->Get_Health (Commands->Find_Object (2063324)) > 0.0f)
  3385. {
  3386. already_entered = true;
  3387. int id = Commands->Create_Conversation("M10CON047", 99, 2000, false);
  3388. Commands->Join_Conversation(STAR, id);
  3389. Commands->Join_Conversation(NULL, id);
  3390. Commands->Start_Conversation(id, 100047);
  3391. Commands->Monitor_Conversation(obj, id);
  3392. }
  3393. }
  3394. break;
  3395. case 49:
  3396. {
  3397. if (Commands->Get_Health (Commands->Find_Object (1100010)) > 0.0f)
  3398. {
  3399. already_entered = true;
  3400. /*int id = Commands->Create_Conversation("M10CON049", 99, 2000, false);
  3401. Commands->Join_Conversation(STAR, id);
  3402. Commands->Join_Conversation(NULL, id);
  3403. Commands->Start_Conversation(id, 100049);
  3404. Commands->Monitor_Conversation(obj, id);*/
  3405. }
  3406. }
  3407. break;
  3408. case 51:
  3409. {
  3410. if (Commands->Get_Health (Commands->Find_Object (1100014)) > 0.0f || Commands->Get_Health (Commands->Find_Object (1100013)) > 0.0f)
  3411. {
  3412. already_entered = true;
  3413. int id = Commands->Create_Conversation("M10CON051", 99, 2000, false);
  3414. Commands->Join_Conversation(STAR, id);
  3415. Commands->Join_Conversation(NULL, id);
  3416. Commands->Start_Conversation(id, 100051);
  3417. Commands->Monitor_Conversation(obj, id);
  3418. }
  3419. }
  3420. break;
  3421. case 54:
  3422. {
  3423. already_entered = true;
  3424. Commands->Send_Custom_Event(obj, Commands->Find_Object (2014795), ENTERED, 0);
  3425. Commands->Send_Custom_Event(obj, Commands->Find_Object (2017711), ENTERED, 0);
  3426. int id = Commands->Create_Conversation("M10CON054", 99, 2000, false);
  3427. Commands->Join_Conversation(STAR, id);
  3428. Commands->Start_Conversation(id, 100054);
  3429. Commands->Monitor_Conversation(obj, id);
  3430. }
  3431. break;
  3432. }
  3433. }
  3434. }
  3435. };
  3436. DECLARE_SCRIPT(M10_Sam_Killed, "SamNumber:int")
  3437. {
  3438. /*void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3439. {
  3440. GameObject * obj_con = Commands->Find_Object(1100154);
  3441. if (action_id == 100028)
  3442. {
  3443. Commands->Set_Objective_Status(1015, OBJECTIVE_STATUS_ACCOMPLISHED);
  3444. }
  3445. if (action_id == 100050)
  3446. {
  3447. Commands->Send_Custom_Event(obj, obj_con, 1016, 1);
  3448. }
  3449. }*/
  3450. void Killed(GameObject * obj, GameObject * killer)
  3451. {
  3452. GameObject * obj_con = Commands->Find_Object(1100154);
  3453. switch(Get_Int_Parameter("SamNumber"))
  3454. {
  3455. case 1:
  3456. {
  3457. Commands->Send_Custom_Event(obj, obj_con, 1015, 3);
  3458. Commands->Send_Custom_Event(obj, obj_con, 1015, 1);
  3459. Commands->Set_Objective_Status(1015, OBJECTIVE_STATUS_ACCOMPLISHED);
  3460. }
  3461. break;
  3462. case 2:
  3463. {
  3464. Commands->Send_Custom_Event(obj, obj_con, 1017, 1);
  3465. }
  3466. break;
  3467. case 3:
  3468. {
  3469. Commands->Send_Custom_Event(obj, obj_con, 1018, 1);
  3470. }
  3471. break;
  3472. case 4:
  3473. {
  3474. Commands->Send_Custom_Event(obj, obj_con, 1016, 3);
  3475. Commands->Send_Custom_Event(obj, obj_con, 1016, 1);
  3476. Commands->Set_Objective_Status(1016, OBJECTIVE_STATUS_ACCOMPLISHED);
  3477. }
  3478. break;
  3479. }
  3480. }
  3481. };
  3482. DECLARE_SCRIPT(M10_Helipad_Destroyed, "PadNumber:int")
  3483. {
  3484. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3485. {
  3486. GameObject * obj_con = Commands->Find_Object(1100154);
  3487. if (action_id == 100040)
  3488. {
  3489. Commands->Send_Custom_Event(obj, obj_con, 1014, 3);
  3490. Commands->Send_Custom_Event(obj, obj_con, 1014, 1);
  3491. }
  3492. if (action_id == 100048)
  3493. {
  3494. Commands->Send_Custom_Event(obj, obj_con, 1013, 3);
  3495. Commands->Send_Custom_Event(obj, obj_con, 1013, 1);
  3496. }
  3497. }
  3498. void Killed(GameObject * obj, GameObject * killer)
  3499. {
  3500. switch(Get_Int_Parameter("PadNumber"))
  3501. {
  3502. case 1:
  3503. {
  3504. int id = Commands->Create_Conversation("M10CON040", 99, 2000, false);
  3505. Commands->Join_Conversation(NULL, id);
  3506. Commands->Join_Conversation(STAR, id);
  3507. Commands->Start_Conversation(id, 100040);
  3508. Commands->Monitor_Conversation(obj, id);
  3509. }
  3510. break;
  3511. case 2:
  3512. {
  3513. GameObject * obj_con = Commands->Find_Object(1100154);
  3514. Commands->Send_Custom_Event(obj, obj_con, 1013, 3);
  3515. Commands->Send_Custom_Event(obj, obj_con, 1013, 1);
  3516. /*int id = Commands->Create_Conversation("M10CON048", 99, 2000, false);
  3517. Commands->Join_Conversation(STAR, id);
  3518. Commands->Join_Conversation(NULL, id);
  3519. Commands->Start_Conversation(id, 100048);
  3520. Commands->Monitor_Conversation(obj, id);*/
  3521. }
  3522. break;
  3523. }
  3524. }
  3525. };
  3526. DECLARE_SCRIPT(M10_Turret_Killed, "")
  3527. {
  3528. void Killed(GameObject * obj, GameObject * killer)
  3529. {
  3530. GameObject * obj_con = Commands->Find_Object(1100154);
  3531. Commands->Send_Custom_Event(obj, obj_con, 1019, 3);
  3532. Commands->Send_Custom_Event(obj, obj_con, 1019, 1);
  3533. }
  3534. };
  3535. DECLARE_SCRIPT(M10_Mrls_Grant, "")
  3536. {
  3537. bool already_poked;
  3538. int drop_loc1;
  3539. int drop_loc2;
  3540. bool occupied1;
  3541. bool occupied2;
  3542. bool grant;
  3543. REGISTER_VARIABLES()
  3544. {
  3545. SAVE_VARIABLE( already_poked, 1 );
  3546. SAVE_VARIABLE( drop_loc1, 2 );
  3547. SAVE_VARIABLE( drop_loc2, 3 );
  3548. SAVE_VARIABLE( occupied1, 4 );
  3549. SAVE_VARIABLE( occupied2, 5 );
  3550. SAVE_VARIABLE( grant, 6 );
  3551. }
  3552. void Created (GameObject *obj)
  3553. {
  3554. already_poked = false;
  3555. drop_loc1 = 1112072;
  3556. drop_loc2 = 1112073;
  3557. occupied1 = false;
  3558. occupied1 = false;
  3559. grant = false;
  3560. }
  3561. void Poked(GameObject * obj, GameObject * poker)
  3562. {
  3563. if (!already_poked)
  3564. {
  3565. if (Commands->Has_Key(STAR, 1))
  3566. {
  3567. already_poked = true;
  3568. Commands->Create_Logical_Sound (obj, CLEAR1, Commands->Get_Position (Commands->Find_Object (drop_loc1)), 10.0f);
  3569. Commands->Create_Logical_Sound (obj, CLEAR2, Commands->Get_Position (Commands->Find_Object (drop_loc2)), 10.0f);
  3570. Commands->Start_Timer ( obj, this, 2.0f, GRANT_MRLS );
  3571. }
  3572. }
  3573. }
  3574. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3575. {
  3576. if (type == MAMMY)
  3577. {
  3578. if (param == 1)
  3579. {
  3580. grant = false;
  3581. }
  3582. if (param == 0)
  3583. {
  3584. grant = true;
  3585. }
  3586. }
  3587. if (type == OCCUPIED)
  3588. {
  3589. if (param == 1)
  3590. {
  3591. occupied1 = true;
  3592. }
  3593. if (param == 2)
  3594. {
  3595. occupied2 = true;
  3596. }
  3597. }
  3598. }
  3599. void Timer_Expired(GameObject * obj, int timer_id)
  3600. {
  3601. if (timer_id == GRANT_MRLS)
  3602. {
  3603. if (!occupied1 && grant)
  3604. {
  3605. GameObject * mrls = Commands->Create_Object ( "GDI_MRLS_Player", Commands->Get_Position (Commands->Find_Object (drop_loc1)));
  3606. Commands->Attach_Script(mrls, "M10_Mrls_Waypath", "");
  3607. }
  3608. else if (!occupied2 && grant)
  3609. {
  3610. GameObject * mrls2 = Commands->Create_Object ( "GDI_MRLS_Player", Commands->Get_Position (Commands->Find_Object (drop_loc2)));
  3611. Commands->Attach_Script(mrls2, "M10_Mrls_Waypath", "");
  3612. }
  3613. }
  3614. }
  3615. };
  3616. DECLARE_SCRIPT(M10_Mrls_Waypath, "")
  3617. {
  3618. void Created (GameObject *obj)
  3619. {
  3620. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100007), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3621. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100008), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3622. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100009), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3623. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100010), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3624. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100011), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3625. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100012), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3626. ActionParamsStruct params;
  3627. params.Set_Basic( this, 99, 10 );
  3628. params.Set_Movement( Vector3(0,0,0), RUN, 4.0f );
  3629. params.WaypathID = 1112795;
  3630. Commands->Action_Goto (obj, params);
  3631. }
  3632. };
  3633. DECLARE_SCRIPT(M10_Humm_SAMIgnore, "")
  3634. {
  3635. void Created (GameObject *obj)
  3636. {
  3637. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100007), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3638. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100008), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3639. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100009), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3640. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100010), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3641. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100011), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3642. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100012), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3643. }
  3644. };
  3645. DECLARE_SCRIPT(M10_Occupied, "")
  3646. {
  3647. void Created (GameObject *obj)
  3648. {
  3649. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100007), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3650. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100008), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3651. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100009), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3652. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100010), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3653. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100011), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3654. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100012), M00_CUSTOM_SAM_SITE_IGNORE, Commands->Get_ID (obj));
  3655. }
  3656. void Killed( GameObject * obj, GameObject * killer )
  3657. {
  3658. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100166), MAMMY, 0);
  3659. }
  3660. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  3661. {
  3662. if (sound.Type == CLEAR1)
  3663. {
  3664. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100166), OCCUPIED, 1);
  3665. }
  3666. if (sound.Type == CLEAR2)
  3667. {
  3668. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100166), OCCUPIED, 2);
  3669. }
  3670. }
  3671. };
  3672. DECLARE_SCRIPT(M10_Con_Yard_Repair, "RepairSpeed=1:float")
  3673. {
  3674. bool objective_completed, inside_obelisk, conyard_destroyed;
  3675. float full_health, curr_health, counter;
  3676. REGISTER_VARIABLES()
  3677. {
  3678. SAVE_VARIABLE(objective_completed, 1);
  3679. SAVE_VARIABLE(conyard_destroyed, 2);
  3680. SAVE_VARIABLE(curr_health, 3);
  3681. SAVE_VARIABLE(counter, 4);
  3682. SAVE_VARIABLE(full_health, 5);
  3683. }
  3684. void Created(GameObject * obj)
  3685. {
  3686. objective_completed = conyard_destroyed = false;
  3687. full_health = curr_health = Commands->Get_Health(obj);
  3688. }
  3689. void Damaged(GameObject * obj, GameObject * damager, float amount)
  3690. {
  3691. if (conyard_destroyed)
  3692. {
  3693. return;
  3694. }
  3695. else
  3696. {
  3697. if (damager == STAR)
  3698. {
  3699. Commands->Send_Custom_Event(obj, Commands->Find_Object (1206469), DAMAGED, 0);
  3700. }
  3701. curr_health = Commands->Get_Health (obj);
  3702. counter = 1.0f;
  3703. //Commands->Set_Health(obj, (curr_health + Get_Float_Parameter("RepairSpeed")));
  3704. for (float x = curr_health; x <= full_health; x++)
  3705. {
  3706. Commands->Start_Timer(obj, this, counter, REBUILD);
  3707. counter++;
  3708. //Commands->Set_Health(obj, full_health);
  3709. }
  3710. }
  3711. }
  3712. void Timer_Expired(GameObject * obj, int timer_id )
  3713. {
  3714. if (timer_id == REBUILD && Commands->Get_Health(obj) > 0)
  3715. {
  3716. curr_health += Get_Float_Parameter("RepairSpeed");
  3717. Commands->Set_Health(obj, curr_health);
  3718. }
  3719. }
  3720. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3721. {
  3722. if (type == 3000 && param == 3000)
  3723. {
  3724. conyard_destroyed = true;
  3725. }
  3726. }
  3727. };
  3728. DECLARE_SCRIPT (M10_Ssm_Trigger, "")
  3729. {
  3730. bool already_entered;
  3731. REGISTER_VARIABLES()
  3732. {
  3733. SAVE_VARIABLE( already_entered, 1 );
  3734. }
  3735. void Created (GameObject * obj)
  3736. {
  3737. already_entered = false;
  3738. }
  3739. void Entered( GameObject * obj, GameObject * enterer )
  3740. {
  3741. if (!already_entered)
  3742. {
  3743. already_entered = true;
  3744. Commands->Send_Custom_Event (obj, Commands->Find_Object (2009688), M00_LAUNCH_SSM, 0);
  3745. }
  3746. }
  3747. };
  3748. DECLARE_SCRIPT (M10_Pokeable_Item_OnePoke, "")
  3749. {
  3750. bool poked;
  3751. REGISTER_VARIABLES()
  3752. {
  3753. SAVE_VARIABLE( poked, 1 );
  3754. }
  3755. void Created (GameObject * obj)
  3756. {
  3757. poked = false;
  3758. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  3759. }
  3760. void Poked(GameObject * obj, GameObject * poker)
  3761. {
  3762. if (!poked)
  3763. {
  3764. poked = true;
  3765. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  3766. }
  3767. }
  3768. };
  3769. DECLARE_SCRIPT(M10_Radar_Scramble, "")
  3770. {
  3771. bool already_entered;
  3772. REGISTER_VARIABLES()
  3773. {
  3774. SAVE_VARIABLE( already_entered, 1 );
  3775. }
  3776. void Created (GameObject * obj)
  3777. {
  3778. already_entered = false;
  3779. }
  3780. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3781. {
  3782. if (type == ENTERED)
  3783. {
  3784. already_entered = true;
  3785. }
  3786. }
  3787. void Entered (GameObject *obj, GameObject *enterer)
  3788. {
  3789. if (Commands->Get_Health (Commands->Find_Object (1153932)) > 0 && Commands->Get_Health (Commands->Find_Object (1153931)) > 0)
  3790. {
  3791. if (!already_entered)
  3792. {
  3793. Commands->Send_Custom_Event (obj, Commands->Find_Object (1110022), ENTERED, 0);
  3794. Commands->Send_Custom_Event (obj, Commands->Find_Object (1100160), ENTERED, 0);
  3795. already_entered = true;
  3796. int id = Commands->Create_Conversation("M03CON068", 99, 2000, false);
  3797. Commands->Join_Conversation(NULL, id);
  3798. Commands->Start_Conversation(id, 100068);
  3799. Commands->Monitor_Conversation(obj, id);
  3800. }
  3801. Commands->Enable_Radar ( false );
  3802. }
  3803. }
  3804. };
  3805. DECLARE_SCRIPT(M10_Radar_UnScramble, "")
  3806. {
  3807. void Entered (GameObject *obj, GameObject *enterer)
  3808. {
  3809. Commands->Enable_Radar ( true );
  3810. }
  3811. };
  3812. DECLARE_SCRIPT (M10_HON_KillPrevention, "")
  3813. {
  3814. void Killed(GameObject * obj, GameObject * killer)
  3815. {
  3816. if (killer != STAR)
  3817. {
  3818. Commands->Set_Health (obj, 1.0f);
  3819. }
  3820. }
  3821. };
  3822. DECLARE_SCRIPT (M10_SoldierPoke, "")
  3823. {
  3824. bool already_picked [6];
  3825. int count;
  3826. REGISTER_VARIABLES()
  3827. {
  3828. SAVE_VARIABLE( already_picked [0], 1 );
  3829. SAVE_VARIABLE( already_picked [1], 2 );
  3830. SAVE_VARIABLE( already_picked [2], 3 );
  3831. SAVE_VARIABLE( already_picked [3], 4 );
  3832. SAVE_VARIABLE( already_picked [4], 5 );
  3833. SAVE_VARIABLE( already_picked [5], 6 );
  3834. }
  3835. void Created (GameObject * obj)
  3836. {
  3837. count = 0;
  3838. for (int x = 0; x <= 5; x++)
  3839. {
  3840. already_picked [x] = false;
  3841. }
  3842. }
  3843. void Poked(GameObject * obj, GameObject * poker)
  3844. {
  3845. if (count >= 5)
  3846. {
  3847. for (int x = 0; x <= 5; x++)
  3848. {
  3849. already_picked [x] = false;
  3850. }
  3851. }
  3852. int random = Commands->Get_Random_Int (0, 6);
  3853. while (!already_picked)
  3854. {
  3855. random = Commands->Get_Random_Int (0, 6);
  3856. }
  3857. already_picked [random] = true;
  3858. count++;
  3859. switch (random)
  3860. {
  3861. // Destroy the Power Plant
  3862. case 0:
  3863. {
  3864. int id = Commands->Create_Conversation("M10CON065", 99, 2000, false);
  3865. Commands->Join_Conversation(obj, id);
  3866. Commands->Start_Conversation(id, 100065);
  3867. Commands->Monitor_Conversation(obj, id);
  3868. }
  3869. break;
  3870. case 1:
  3871. {
  3872. int id = Commands->Create_Conversation("M10CON066", 99, 2000, false);
  3873. Commands->Join_Conversation(obj, id);
  3874. Commands->Start_Conversation(id, 100066);
  3875. Commands->Monitor_Conversation(obj, id);
  3876. }
  3877. break;
  3878. case 2:
  3879. {
  3880. int id = Commands->Create_Conversation("M10CON067", 99, 2000, false);
  3881. Commands->Join_Conversation(obj, id);
  3882. Commands->Start_Conversation(id, 100067);
  3883. Commands->Monitor_Conversation(obj, id);
  3884. }
  3885. break;
  3886. case 3:
  3887. {
  3888. int id = Commands->Create_Conversation("M10CON068", 99, 2000, false);
  3889. Commands->Join_Conversation(obj, id);
  3890. Commands->Start_Conversation(id, 100068);
  3891. Commands->Monitor_Conversation(obj, id);
  3892. }
  3893. break;
  3894. case 4:
  3895. {
  3896. int id = Commands->Create_Conversation("M10CON069", 99, 2000, false);
  3897. Commands->Join_Conversation(obj, id);
  3898. Commands->Start_Conversation(id, 100069);
  3899. Commands->Monitor_Conversation(obj, id);
  3900. }
  3901. break;
  3902. case 5:
  3903. {
  3904. int id = Commands->Create_Conversation("M10CON070", 99, 2000, false);
  3905. Commands->Join_Conversation(obj, id);
  3906. Commands->Start_Conversation(id, 100070);
  3907. Commands->Monitor_Conversation(obj, id);
  3908. }
  3909. break;
  3910. }
  3911. }
  3912. };
  3913. DECLARE_SCRIPT(M10_NBase_Attacked, "") //1206469
  3914. {
  3915. bool message_fired;
  3916. REGISTER_VARIABLES()
  3917. {
  3918. SAVE_VARIABLE( message_fired, 1 );
  3919. }
  3920. void Created (GameObject *obj)
  3921. {
  3922. message_fired = false;
  3923. }
  3924. void Timer_Expired (GameObject *obj, int timer_id)
  3925. {
  3926. if (timer_id == RESET)
  3927. {
  3928. message_fired = false;
  3929. }
  3930. }
  3931. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3932. {
  3933. if (type == DAMAGED && !message_fired)
  3934. {
  3935. message_fired = true;
  3936. int id = Commands->Create_Conversation("M10CON072", 99, 2000, false);
  3937. Commands->Join_Conversation(NULL, id);
  3938. Commands->Start_Conversation(id, 100072);
  3939. Commands->Monitor_Conversation(obj, id);
  3940. Commands->Start_Timer(obj, this, 60.0f, RESET);
  3941. }
  3942. }
  3943. };
  3944. DECLARE_SCRIPT (M10_NBase_Damage_Modifier, "Damage_multiplier:float")
  3945. {
  3946. float current_health, last_health, damage_tally;
  3947. bool conyard_destroyed;
  3948. REGISTER_VARIABLES()
  3949. {
  3950. SAVE_VARIABLE( current_health, 1 );
  3951. SAVE_VARIABLE( last_health, 2 );
  3952. SAVE_VARIABLE( damage_tally, 3 );
  3953. SAVE_VARIABLE( conyard_destroyed, 4 );
  3954. }
  3955. void Created (GameObject *obj)
  3956. {
  3957. last_health = Commands->Get_Health (obj);
  3958. damage_tally = 0;
  3959. conyard_destroyed = false;
  3960. }
  3961. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3962. {
  3963. if (type == 3000 && param == 3000)
  3964. {
  3965. conyard_destroyed = true;
  3966. }
  3967. }
  3968. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3969. {
  3970. if (!conyard_destroyed)
  3971. {
  3972. float damage;
  3973. if (damager == STAR)
  3974. {
  3975. last_health = Commands->Get_Health (obj);
  3976. }
  3977. if (damager != STAR)
  3978. {
  3979. current_health = Commands->Get_Health (obj);
  3980. if (current_health == 0)
  3981. {
  3982. damage = ((last_health - current_health) + damage_tally);
  3983. damage_tally = 0;
  3984. }
  3985. else
  3986. {
  3987. damage = (last_health - current_health);
  3988. damage_tally = 0;
  3989. }
  3990. float mod_damage = (damage * (Get_Float_Parameter("Damage_multiplier")));
  3991. damage_tally += mod_damage;
  3992. Commands->Set_Health (obj, (last_health - mod_damage));
  3993. last_health = Commands->Get_Health (obj);
  3994. current_health = Commands->Get_Health (obj);
  3995. }
  3996. }
  3997. }
  3998. };
  3999. DECLARE_SCRIPT(M10_Lv2_KeyCarrier, "")
  4000. {
  4001. void Killed( GameObject * obj, GameObject * killer )
  4002. {
  4003. Vector3 spawnLocation = Commands->Get_Position ( obj );
  4004. spawnLocation.Z += 0.75f;
  4005. Commands->Create_Object ( "Level_02_Keycard", spawnLocation );
  4006. }
  4007. };
  4008. DECLARE_SCRIPT(M10_Holograph_EntryZone_DME, "")
  4009. {
  4010. bool entered;
  4011. REGISTER_VARIABLES()
  4012. {
  4013. SAVE_VARIABLE(entered, 1);
  4014. }
  4015. void Created( GameObject * obj )
  4016. {
  4017. entered = false;
  4018. }
  4019. void Entered( GameObject * obj, GameObject * enterer )
  4020. {
  4021. if (enterer == STAR && entered == false)
  4022. {
  4023. entered = true;
  4024. float delayTimer = Commands->Get_Random ( 0.25f, 1.0f );
  4025. Commands->Send_Custom_Event( obj, obj, 0, 8000, delayTimer );
  4026. }
  4027. }
  4028. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4029. {
  4030. if (param == 8000)
  4031. {
  4032. GameObject * holograph = Commands->Find_Object ( 1208599 );
  4033. if (holograph)
  4034. {
  4035. GameObject * kane = Commands->Create_Object_At_Bone ( holograph, "Nod_Kane_HologramHead", "O_ARROW" );
  4036. Commands->Attach_To_Object_Bone( kane, holograph, "O_ARROW" );
  4037. Commands->Disable_All_Collisions ( kane );
  4038. Commands->Set_Facing (kane, Commands->Get_Facing (holograph));
  4039. Commands->Set_Loiters_Allowed( kane, false );
  4040. Commands->Attach_Script(kane, "M10_KaneHead_DME", "");
  4041. Commands->Send_Custom_Event( obj, Commands->Find_Object (1209308), KANE_CONV, Commands->Get_ID (obj), 0.0f );
  4042. //kane_ID = Commands->Get_ID ( kane );
  4043. }
  4044. //Commands->Destroy_Object ( obj );//one time only zone--cleaning up
  4045. }
  4046. }
  4047. };
  4048. DECLARE_SCRIPT(M10_Holograph_EntryZone2_DME, "")
  4049. {
  4050. bool entered;
  4051. int kane_id;
  4052. REGISTER_VARIABLES()
  4053. {
  4054. SAVE_VARIABLE(entered, 1);
  4055. SAVE_VARIABLE(kane_id, 2);
  4056. }
  4057. void Created( GameObject * obj )
  4058. {
  4059. entered = false;
  4060. kane_id = 0;
  4061. }
  4062. void Entered( GameObject * obj, GameObject * enterer )
  4063. {
  4064. if (enterer == STAR && entered == false)
  4065. {
  4066. entered = true;
  4067. Commands->Send_Custom_Event( obj, obj, 0, 8500, 0 );
  4068. }
  4069. }
  4070. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4071. {
  4072. if (type == KANE_CONV)
  4073. {
  4074. kane_id = param;
  4075. }
  4076. if (param == 8500)
  4077. {
  4078. GameObject * kane = Commands->Find_Object ( kane_id );
  4079. if (kane)
  4080. {
  4081. Commands->Attach_Script(kane, "M10_KaneHead2_DME", "");
  4082. }
  4083. //Commands->Destroy_Object ( obj );//one time only zone--cleaning up
  4084. }
  4085. }
  4086. };
  4087. DECLARE_SCRIPT(M10_KaneHead_DME, "") //2017221
  4088. {
  4089. int kane_conversation02;
  4090. REGISTER_VARIABLES()
  4091. {
  4092. SAVE_VARIABLE(kane_conversation02, 1);
  4093. }
  4094. void Created( GameObject * obj )
  4095. {
  4096. GameObject *officer = Commands->Find_Object (1208600);
  4097. if (officer)
  4098. {
  4099. int id = Commands->Create_Conversation("M10CON056", 99, 100, true);
  4100. Commands->Join_Conversation_Facing ( obj, id, Commands->Get_ID (officer) );
  4101. Commands->Join_Conversation_Facing ( officer, id, Commands->Get_ID (obj) );
  4102. Commands->Start_Conversation(id, 100056);
  4103. Commands->Monitor_Conversation(obj, id);
  4104. }
  4105. }
  4106. /*void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  4107. {
  4108. switch (complete_reason)
  4109. {
  4110. case ACTION_COMPLETE_CONVERSATION_ENDED:
  4111. {
  4112. if (action_id == 100061)
  4113. {
  4114. Commands->Debug_Message ( "***************************kane conversation 02 is over--sending delete custom\n" );
  4115. Commands->Send_Custom_Event ( obj, obj, 0, 8000, 2 );
  4116. }
  4117. }
  4118. break;
  4119. }
  4120. }*/
  4121. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4122. {
  4123. if (param == 8000)//conversation is over--go away
  4124. {
  4125. Commands->Debug_Message ( "***************************delete custom received--kane should now vanish\n" );
  4126. Commands->Destroy_Object ( obj );
  4127. }
  4128. }
  4129. };
  4130. DECLARE_SCRIPT(M10_KaneHead2_DME, "") //2017221
  4131. {
  4132. void Created( GameObject * obj )
  4133. {
  4134. if (STAR)
  4135. {
  4136. int id = Commands->Create_Conversation("M10CON057", 99, 100, true);
  4137. Commands->Join_Conversation_Facing ( obj, id, Commands->Get_ID (STAR) );
  4138. Commands->Join_Conversation_Facing ( STAR, id, Commands->Get_ID (obj) );
  4139. Commands->Start_Conversation(id, 100057);
  4140. Commands->Monitor_Conversation(obj, id);
  4141. }
  4142. }
  4143. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  4144. {
  4145. switch (complete_reason)
  4146. {
  4147. case ACTION_COMPLETE_CONVERSATION_ENDED:
  4148. {
  4149. if (action_id == 100057)
  4150. {
  4151. Commands->Debug_Message ( "***************************kane conversation 02 is over--sending delete custom\n" );
  4152. Commands->Send_Custom_Event ( obj, obj, 0, 8000, 2 );
  4153. }
  4154. }
  4155. break;
  4156. }
  4157. }
  4158. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4159. {
  4160. if (param == 8000)//conversation is over--go away
  4161. {
  4162. Commands->Debug_Message ( "***************************delete custom received--kane should now vanish\n" );
  4163. Commands->Destroy_Object ( obj );
  4164. }
  4165. }
  4166. };