Mission09.cpp 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706
  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. * Mission09.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 9 specific scripts
  25. *
  26. * PROGRAMMER
  27. * Dan Etter
  28. *
  29. * VERSION INFO
  30. * $Author: Greg_h $
  31. * $Revision: 106 $
  32. * $Modtime: 1/20/02 11:10a $
  33. * $Archive: /Commando/Code/Scripts/Mission09.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission9.h"
  39. #include <string.h>
  40. #include <stdio.h>
  41. DECLARE_SCRIPT(M09_Objective_Controller, "") // Object Controller id: 2000071
  42. {
  43. enum {HAVOCS_SCRIPT};
  44. bool objective [3];
  45. int spawn_loc;
  46. int block1, block2, block3, block4;
  47. // Register variables to be Auto-Saved
  48. // All variables must have a unique ID, less than 256, that never changes
  49. REGISTER_VARIABLES()
  50. {
  51. SAVE_VARIABLE( spawn_loc, 1 );
  52. SAVE_VARIABLE( block1, 2 );
  53. SAVE_VARIABLE( block2, 3 );
  54. SAVE_VARIABLE( block3, 4 );
  55. SAVE_VARIABLE( block4, 5 );
  56. }
  57. void Created(GameObject * obj)
  58. {
  59. Commands->Set_Num_Tertiary_Objectives ( 1 );
  60. Commands->Start_Timer (obj, this, 1.0f, HAVOCS_SCRIPT);
  61. Commands->Enable_Hibernation(obj, false);
  62. spawn_loc = 0;
  63. for (int x = 0; x <= 2; x++)
  64. {
  65. objective [x] = false;
  66. }
  67. block1 = 0;
  68. block2 = 0;
  69. block3 = 0;
  70. block4 = 0;
  71. }
  72. void Remove_Pog(int id)
  73. {
  74. switch (id)
  75. {
  76. // New Primary Mission Objective: Retrieve the Mobile Power Suit for Dr. Mobius
  77. case 901:
  78. {
  79. Commands->Set_Objective_HUD_Info(id, -1, "POG_M09_1_01.tga", IDS_POG_RETRIEVE);
  80. }
  81. break;
  82. // New Primary Mission Objective: Escort Dr. Mobius to the Surface
  83. case 902:
  84. {
  85. Commands->Set_Objective_HUD_Info(id, -1, "POG_M09_1_02.tga", IDS_POG_ESCORT);
  86. }
  87. break;
  88. // New Primary Mission Objective: Escort Dr. Mobius to the Rendezvous Point
  89. case 903:
  90. {
  91. Commands->Set_Objective_HUD_Info(id, -1, "POG_M09_1_03.tga", IDS_POG_ESCORT);
  92. }
  93. break;
  94. }
  95. }
  96. void Add_An_Objective(int id)
  97. {
  98. GameObject *object;
  99. switch (id)
  100. {
  101. // New Primary Mission Objective: Protect Mobius
  102. case 900:
  103. {
  104. Commands->Add_Objective(900, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M09_04, NULL, IDS_Enc_Obj_Primary_M09_04);
  105. object = Commands->Find_Object(2000010);
  106. if(object)
  107. {
  108. Commands->Set_Objective_Radar_Blip_Object(900, object);
  109. Commands->Set_Objective_HUD_Info_Position( 900, 90, "POG_M09_1_02.tga", IDS_POG_PROTECT, Commands->Get_Position (object));
  110. }
  111. }
  112. break;
  113. // New Primary Mission Objective: Retrieve the Mobile Power Suit for Dr. Mobius
  114. case 901:
  115. {
  116. Commands->Add_Objective(901, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M09_01, NULL, IDS_Enc_Obj_Primary_M09_01);
  117. object = Commands->Find_Object(2002239);
  118. if(object)
  119. {
  120. Commands->Set_Objective_Radar_Blip_Object(901, object);
  121. Commands->Set_Objective_HUD_Info_Position( 901, 99, "POG_M09_1_01.tga", IDS_POG_RETRIEVE, Commands->Get_Position (object));
  122. }
  123. }
  124. break;
  125. // New Primary Mission Objective: Escort Dr. Mobius to the Surface
  126. case 902:
  127. {
  128. Commands->Add_Objective(902, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M09_02, NULL, IDS_Enc_Obj_Primary_M09_02);
  129. object = Commands->Find_Object(2000955);
  130. if(object)
  131. {
  132. Commands->Set_Objective_Radar_Blip_Object(902, object);
  133. Commands->Set_Objective_HUD_Info_Position( 902, 98, "POG_M08_1_03.tga", IDS_POG_ESCORT, Commands->Get_Position (object));
  134. }
  135. }
  136. break;
  137. // New Primary Mission Objective: Escort Dr. Mobius to the Rendezvous Point
  138. case 903:
  139. {
  140. Commands->Add_Objective(903, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M09_03, NULL, IDS_Enc_Obj_Primary_M09_03);
  141. object = Commands->Find_Object(2000969);
  142. if(object)
  143. {
  144. Commands->Set_Objective_Radar_Blip_Object(903, object);
  145. Commands->Set_Objective_HUD_Info_Position( 903, 97, "POG_M09_1_03.tga", IDS_POG_ESCORT, Commands->Get_Position (object));
  146. }
  147. }
  148. break;
  149. // New Hidden Mission Objective: Eliminate the NOD Resistance at Checkpoint A
  150. case 904:
  151. {
  152. Commands->Add_Objective(904, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M09_01, NULL, IDS_Enc_Obj_Hidden_M09_04); }
  153. break;/*
  154. // New Hidden Mission Objective: Comandeer the NOD Stealth Tank.
  155. case 905:
  156. {
  157. Commands->Add_Objective(905, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_M09_T02, NULL);
  158. }
  159. break;
  160. // New Hidden Mission Objective: Comandeer the NOD Stealth Tank.
  161. case 906:
  162. {
  163. Commands->Add_Objective(906, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_M09_P05, NULL);
  164. }
  165. break;*/
  166. case 1000:
  167. {
  168. break;
  169. }
  170. }
  171. }
  172. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  173. {
  174. if (type == BLOCK_ON)
  175. {
  176. if ((block1 != 0) && (block2 != 0) && (block3 != 0) && (block4 != 0)) {
  177. Commands->Start_Timer (obj, this, 3.0f, 333);
  178. GameObject *rub1 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-108.066f, 483.917f, -191.022f));
  179. block1 = Commands->Get_ID (rub1);
  180. Commands->Set_Is_Rendered( rub1, false );
  181. GameObject *rub2 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-25.433f, 513.013f, -150.613f));
  182. block2 = Commands->Get_ID (rub2);
  183. Commands->Set_Is_Rendered( rub2, false );
  184. GameObject *rub3 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-47.948f, 535.216f, -103.284f));
  185. block3 = Commands->Get_ID (rub3);
  186. Commands->Set_Is_Rendered( rub3, false );
  187. Commands->Set_Facing (rub3, -90.0);
  188. GameObject *rub4 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (39.231f, 515.105f, -78.137f));
  189. block4 = Commands->Get_ID (rub4);
  190. Commands->Set_Is_Rendered( rub4, false );
  191. }
  192. }
  193. if (type == BLOCK_OFF)
  194. {
  195. Commands->Destroy_Object (Commands->Find_Object (block1));
  196. Commands->Destroy_Object (Commands->Find_Object (block2));
  197. Commands->Destroy_Object (Commands->Find_Object (block3));
  198. Commands->Destroy_Object (Commands->Find_Object (block4));
  199. block1 = block2 = block3 = block4 = 0;
  200. }
  201. if (type == MOBIUS_KILLED)
  202. {
  203. Commands->Set_HUD_Help_Text ( IDS_M09DSGN_DSGN0073I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  204. Commands->Start_Timer (obj, this, 4.0f, 40);
  205. }
  206. if (type == check && param == check)
  207. {
  208. Commands->Send_Custom_Event (obj, sender, 901, objective [0], 0.0f);
  209. Commands->Send_Custom_Event (obj, sender, 902, objective [1], 0.0f);
  210. Commands->Send_Custom_Event (obj, sender, 903, objective [2], 0.0f);
  211. }
  212. if (type == 901 && param == 1)
  213. {
  214. objective [0] = true;
  215. Remove_Pog(901);
  216. }
  217. if (type == 902 && param == 1)
  218. {
  219. objective [1] = true;
  220. Remove_Pog(902);
  221. }
  222. if (type == 903 && param == 1)
  223. {
  224. objective [2] = true;
  225. Remove_Pog(903);
  226. }
  227. switch (param)
  228. {
  229. case 1:
  230. {
  231. //Commands->Clear_Radar_Marker (type);
  232. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  233. }
  234. break;
  235. case 2:
  236. {
  237. //Commands->Clear_Radar_Marker (type);
  238. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  239. }
  240. break;
  241. case 3:
  242. Add_An_Objective(type);
  243. break;
  244. case 4:
  245. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  246. break;
  247. case 5:
  248. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_HIDDEN);
  249. break;
  250. }
  251. if(type == 666 && param == 666)
  252. {
  253. Commands->Start_Timer (obj, this, 0.10f, M09_DEAD_HAVOC);
  254. }
  255. if (type == SPAWN_LOC && param == INCREMENT)
  256. {
  257. spawn_loc++;
  258. }
  259. }
  260. void Timer_Expired(GameObject * obj, int timer_id )
  261. {
  262. if (timer_id == 333)
  263. {
  264. Commands->Destroy_Object (Commands->Find_Object (block1));
  265. Commands->Destroy_Object (Commands->Find_Object (block2));
  266. Commands->Destroy_Object (Commands->Find_Object (block3));
  267. Commands->Destroy_Object (Commands->Find_Object (block4));
  268. block1 = block2 = block3 = block4 = 0;
  269. }
  270. if (timer_id == 40)
  271. {
  272. Commands->Mission_Complete(false);
  273. }
  274. }
  275. };
  276. DECLARE_SCRIPT (M09_Havoc_Script, "")
  277. {
  278. void Created (GameObject *obj)
  279. {
  280. /*Commands->Give_PowerUp(obj, "Shotgun Weapon 3 Clips PU");
  281. Commands->Give_PowerUp(obj, "FlameThrower_Weapon_PowerUp");
  282. Commands->Give_PowerUp(obj, "Flame_Weapon_1_Clip_PowerUp");
  283. Commands->Give_PowerUp(obj, "Flame_Weapon_1_Clip_PowerUp");
  284. Commands->Give_PowerUp(obj, "ChemSprayer_Weapon_PowerUp");
  285. Commands->Give_PowerUp(obj, "Chem_Weapon_1_Clip_PowerUp");
  286. Commands->Give_PowerUp(obj, "Grenade Launcher Weapon PowerUps");
  287. Commands->Give_PowerUp(obj, "GL_Weapon_1_Clip_PowerUp");
  288. Commands->Give_PowerUp(obj, "Mine Weapons PowerUps");
  289. Commands->Give_PowerUp(obj, "Remote Mine Weapon 1 Clip PU");
  290. Commands->Give_PowerUp(obj, "Sniper Weapon 1 Clip PU");
  291. Commands->Give_PowerUp(obj, "Sniper Weapon 1 Clip PU");
  292. Commands->Give_PowerUp(obj, "MG Weapon 1 Clip PowerUp");
  293. Commands->Give_PowerUp(obj, "MiniGun 2 Clips PU");
  294. Commands->Give_PowerUp(obj, "Armor 100 PowerUp");
  295. Commands->Give_PowerUp(obj, "RL Weapon 1 Clip PowerUp");*/
  296. Commands->Start_Timer(obj, this, 0.5f, ACTIVATE);
  297. //Commands->Grant_Key ( STAR, 10, true);
  298. }
  299. void Timer_Expired (GameObject *obj, int timer_id)
  300. {
  301. if (timer_id == ACTIVATE)
  302. {
  303. Commands->Grant_Key ( STAR, 10, true);
  304. }
  305. }
  306. void Destroyed(GameObject * obj)
  307. {
  308. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 666, 666, 0.0f);
  309. }
  310. };
  311. DECLARE_SCRIPT (M09_Mobius_Suit_Objective, "")
  312. {
  313. bool already_entered;
  314. // Register variables to be Auto-Saved
  315. // All variables must have a unique ID, less than 256, that never changes
  316. REGISTER_VARIABLES()
  317. {
  318. SAVE_VARIABLE( already_entered, 1 );
  319. }
  320. void Created (GameObject * obj)
  321. {
  322. already_entered = false;
  323. }
  324. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  325. {
  326. if (type == 8888)
  327. {
  328. GameObject *mobius = Commands->Find_Object (2000010);
  329. Vector3 havoc_loc = Commands->Get_Position (Commands->Find_Object (1100497));
  330. Vector3 mobius_loc = Commands->Get_Position (Commands->Find_Object (2002239));
  331. Commands->Set_Position (STAR, havoc_loc );
  332. Commands->Set_Position (mobius, mobius_loc );
  333. }
  334. }
  335. void Entered (GameObject * obj, GameObject * enterer)
  336. {
  337. if (!already_entered)
  338. {
  339. GameObject *mobius = Commands->Find_Object (2000010);
  340. already_entered = true;
  341. //Commands->Destroy_Object (Commands->Find_Object (1202323));
  342. if (mobius)
  343. {
  344. Vector3 havoc_loc = Commands->Get_Position (STAR);
  345. Vector3 mobius_loc = Commands->Get_Position (mobius);
  346. havoc_loc.Z += 7.0f;
  347. mobius_loc.Z += 7.0f;
  348. Commands->Action_Reset(mobius, 100);
  349. Commands->Set_Position (STAR, havoc_loc );
  350. Commands->Set_Position (mobius, mobius_loc );
  351. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), SPAWN_LOC, INCREMENT, 0.0f);
  352. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 901, 1, 0.0f);
  353. GameObject * powermob = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  354. Commands->Set_Facing(powermob, 0.0f);
  355. Commands->Attach_Script(powermob, "Test_Cinematic", "X9C_MIDTRO.txt");
  356. Commands->Set_Model ( mobius, "c_ag_gdi_pmob" );
  357. Commands->Give_PowerUp(mobius, "POW_LaserChaingun_AI");
  358. Commands->Select_Weapon (mobius, "Weapon_LaserChaingun_Ai" );
  359. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 901, 1, 0.0f);
  360. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 902, 3, 0.0f);
  361. Commands->Set_Health (mobius, 300.0f);
  362. Commands->Attach_Script(mobius, "M09_Damage_Modifier", ".05");
  363. }
  364. }
  365. }
  366. void Animation_Complete(GameObject * obj, const char *anim)
  367. {
  368. if (stricmp(anim, "h_a_a0a0_l26da") == 0)
  369. {
  370. GameObject *mobius = Commands->Find_Object (2000010);
  371. Commands->Set_Animation ( mobius, "h_a_a0a0_l26db", true);
  372. const char *conv_name = ("IDS_M09_D11");
  373. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  374. Commands->Join_Conversation(mobius, conv_id, false, false);
  375. Commands->Join_Conversation(STAR, conv_id, false, false);
  376. Commands->Start_Conversation (conv_id, 901);
  377. Commands->Monitor_Conversation (obj, conv_id);
  378. }
  379. }
  380. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  381. {
  382. if(action_id == 900 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  383. {
  384. /*GameObject *mobius = Commands->Find_Object (2000010);
  385. Commands->Set_Model ( mobius, "c_ag_gdi_pmob" );
  386. Commands->Give_PowerUp(mobius, "POW_LaserChaingun_AI");
  387. Commands->Select_Weapon (mobius, "Weapon_LaserChaingun_Ai" );*/
  388. //Commands->Set_Animation ( mobius, "h_a_a0a0_l26da", false);
  389. }
  390. if(action_id == 901 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  391. {
  392. GameObject *mobius = Commands->Find_Object (2000010);
  393. Commands->Set_Animation ( mobius, "h_a_a0a0_l26dc", false);
  394. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 902, 3, 0.0f);
  395. }
  396. }
  397. };
  398. DECLARE_SCRIPT (M09_Surface_Objective, "")
  399. {
  400. bool already_entered;
  401. // Register variables to be Auto-Saved
  402. // All variables must have a unique ID, less than 256, that never changes
  403. REGISTER_VARIABLES()
  404. {
  405. SAVE_VARIABLE( already_entered, 1 );
  406. }
  407. void Created (GameObject * obj)
  408. {
  409. already_entered = false;
  410. }
  411. void Entered (GameObject * obj, GameObject * enterer)
  412. {
  413. if (!already_entered)
  414. {
  415. already_entered = true;
  416. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), SPAWN_LOC, INCREMENT, 0.0f);
  417. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 902, 1, 0.0f);
  418. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 903, 3, 0.0f);
  419. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000955), FLYOVER, 0, 0.0f);
  420. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 906, 3, 0.0f);
  421. Commands->Destroy_Object ( Commands->Find_Object (2000614));
  422. Commands->Destroy_Object ( Commands->Find_Object (2000954));
  423. }
  424. }
  425. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  426. {
  427. if (type == ENTERED && param == ENTERED)
  428. {
  429. already_entered = true;
  430. }
  431. }
  432. };
  433. DECLARE_SCRIPT (M09_Evac_Point_Objective, "")
  434. {
  435. bool star_in_zone;
  436. bool mobius_in_zone;
  437. REGISTER_VARIABLES()
  438. {
  439. SAVE_VARIABLE( star_in_zone, 1 );
  440. SAVE_VARIABLE( mobius_in_zone, 2 );
  441. }
  442. void Created (GameObject * obj)
  443. {
  444. star_in_zone = false;
  445. mobius_in_zone = false;
  446. }
  447. void Exited( GameObject * obj, GameObject * exiter )
  448. {
  449. GameObject * mobius = Commands->Find_Object (2000010);
  450. if (exiter == STAR)
  451. {
  452. star_in_zone = false;
  453. }
  454. if (exiter == mobius)
  455. {
  456. mobius_in_zone = false;
  457. }
  458. }
  459. void Entered (GameObject * obj, GameObject * enterer)
  460. {
  461. GameObject * mobius = Commands->Find_Object (2000010);
  462. if (enterer == STAR)
  463. {
  464. star_in_zone = true;
  465. if (mobius_in_zone)
  466. {
  467. Commands->Attach_Script(mobius, "M00_Damage_Modifier_DME", "0.05f, 1, 1, 0, 0");
  468. Commands->Start_Timer (obj, this, 1.0f, M09_MISSION_COMPLETE);
  469. }
  470. if (!mobius_in_zone)
  471. {
  472. Commands->Send_Custom_Event( obj, mobius, FOLLOW, 2000969, 0.0f );
  473. }
  474. }
  475. if (enterer == mobius)
  476. {
  477. mobius_in_zone = true;
  478. if (star_in_zone)
  479. {
  480. Commands->Attach_Script(mobius, "M00_Damage_Modifier_DME", "0.05f, 1, 1, 0, 0");
  481. Commands->Start_Timer (obj, this, 1.0f, M09_MISSION_COMPLETE);
  482. }
  483. }
  484. /*GameObject *mobius = Commands->Find_Object (2000010);
  485. float mobius_distance = Commands->Get_Distance(Commands->Get_Position (Commands->Find_Object (2000969)), Commands->Get_Position (mobius));
  486. if (mobius_distance < 15.0f)
  487. {
  488. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 903, 1, 0.0f);
  489. Commands->Start_Timer (obj, this, 5.0f, M09_MISSION_COMPLETE);
  490. GameObject * chin_loc = Commands->Find_Object (2000259);
  491. float facing = Commands->Get_Facing (chin_loc);
  492. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position (chin_loc));
  493. Commands->Set_Facing(chinook_obj, facing);
  494. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M09_XG_EV4.txt");
  495. }
  496. else
  497. {
  498. ActionParamsStruct params;
  499. params.Set_Basic( this, 99, MOBIUS_GOTO );
  500. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000969)), 1.2f, 0.8f );
  501. Commands->Action_Goto (mobius, params);
  502. Commands->Start_Timer (obj, this, 3.0f, TIMER_RESET);
  503. }*/
  504. }
  505. void Timer_Expired(GameObject * obj, int timer_id )
  506. {
  507. if (timer_id == M09_MISSION_COMPLETE)
  508. {
  509. Commands->Mission_Complete ( true );
  510. }
  511. if (timer_id == TIMER_RESET)
  512. {
  513. GameObject *mobius = Commands->Find_Object (2000010);
  514. float mobius_distance = Commands->Get_Distance(Commands->Get_Position (Commands->Find_Object (2000969)), Commands->Get_Position (mobius));
  515. if (mobius_distance < 15.0f)
  516. {
  517. //Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 903, 1, 0.0f);
  518. Commands->Start_Timer (obj, this, 1.0f, M09_MISSION_COMPLETE);
  519. GameObject * chin_loc = Commands->Find_Object (2000259);
  520. float facing = Commands->Get_Facing (chin_loc);
  521. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position (chin_loc));
  522. Commands->Set_Facing(chinook_obj, facing);
  523. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M09_XG_EV4.txt");
  524. }
  525. else
  526. {
  527. ActionParamsStruct params;
  528. params.Set_Basic( this, 99, MOBIUS_GOTO );
  529. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000969)), 1.2f, 0.8f );
  530. Commands->Action_Goto (mobius, params);
  531. Commands->Start_Timer (obj, this, 3.0f, TIMER_RESET);
  532. }
  533. }
  534. }
  535. };
  536. DECLARE_SCRIPT (M09_LabRoom_Zones, "Mutant_Num:int, Mutant_Goto:int")
  537. {
  538. int mutant;
  539. bool already_entered;
  540. // Register variables to be Auto-Saved
  541. // All variables must have a unique ID, less than 256, that never changes
  542. REGISTER_VARIABLES()
  543. {
  544. SAVE_VARIABLE( already_entered, 1 );
  545. SAVE_VARIABLE( mutant, 2 );
  546. }
  547. void Created (GameObject * obj)
  548. {
  549. mutant = Get_Int_Parameter("Mutant_Num");
  550. int anim_loc = Get_Int_Parameter("Mutant_Goto");
  551. //already_entered = false;
  552. Commands->Send_Custom_Event (obj, Commands->Find_Object(mutant), GOTO, anim_loc, 4.0f);
  553. }
  554. void Entered (GameObject * obj, GameObject * enterer)
  555. {
  556. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000279), CONVERSATION, TRIGGERED);
  557. Commands->Action_Reset ( Commands->Find_Object (mutant), 100.0f );
  558. }
  559. void Exited( GameObject * obj, GameObject * exiter )
  560. {
  561. //Commands->Grant_Key ( STAR, 10, false);
  562. }
  563. void Custom(GameObject *obj, int type, int param, GameObject *sender)
  564. {
  565. if (type == ALREADY_ENTERED)
  566. {
  567. already_entered = true;
  568. }
  569. }
  570. };
  571. DECLARE_SCRIPT (M09_Animating_Mutant, "Animation=0:int")
  572. {
  573. float face;
  574. void Custom(GameObject *obj, int type, int param, GameObject *sender)
  575. {
  576. if (type == GOTO)
  577. {
  578. //face = Commands->Get_Facing (Commands->Find_Object (param));
  579. //Vector3 loc = Commands->Get_Position (Commands->Find_Object (param));
  580. ActionParamsStruct params;
  581. params.Set_Basic( this, 99, MUTANT_GOTO );
  582. //params.Set_Movement( loc, RUN, 0.25f );
  583. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  584. params.WaypathID = param;
  585. Commands->Action_Goto (obj, params);
  586. }
  587. if (type == ANIMATION && param == RESET)
  588. {
  589. Commands->Action_Reset ( obj, 100 );
  590. }
  591. }
  592. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  593. {
  594. int animation = Get_Int_Parameter ("Animation");
  595. if (action_id == MUTANT_GOTO && reason == ACTION_COMPLETE_NORMAL)
  596. {
  597. if (animation == 0)
  598. {
  599. //Commands->Set_Facing (obj, face);
  600. ActionParamsStruct params;
  601. params.Set_Basic( this, 99, DOING_ANIMATION );
  602. params.Set_Animation ("S_C_HUMAN.H_C_7001", true);
  603. Commands->Action_Play_Animation (obj, params);
  604. }
  605. if (animation == 1)
  606. {
  607. ActionParamsStruct params;
  608. params.Set_Basic( this, 99, DOING_ANIMATION );
  609. params.Set_Animation ("S_C_HUMAN.H_C_7002", true);
  610. Commands->Action_Play_Animation (obj, params);
  611. }
  612. }
  613. }
  614. };
  615. DECLARE_SCRIPT (M09_LabRoom_Controller, "")
  616. {
  617. bool triggered;
  618. bool mobius_ready;
  619. REGISTER_VARIABLES()
  620. {
  621. SAVE_VARIABLE( triggered, 1 );
  622. SAVE_VARIABLE( mobius_ready, 2 );
  623. }
  624. void Created (GameObject *obj)
  625. {
  626. triggered = false;
  627. mobius_ready = false;
  628. }
  629. void Custom(GameObject *obj, int type, int param, GameObject *sender)
  630. {
  631. if (!triggered && mobius_ready)
  632. {
  633. if (type == CONVERSATION && param == TRIGGERED)
  634. {
  635. triggered = true;
  636. GameObject *mobius = Commands->Find_Object (2000010);
  637. const char *conv_name = ("M09CON014");
  638. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  639. Commands->Join_Conversation(mobius, conv_id, true, true);
  640. Commands->Join_Conversation(STAR, conv_id, true, true);
  641. Commands->Start_Conversation (conv_id, 904);
  642. Commands->Monitor_Conversation (mobius, conv_id);
  643. }
  644. }
  645. if (type == CONVERSATION && param == ENDED)
  646. {
  647. mobius_ready = true;
  648. }
  649. }
  650. };
  651. DECLARE_SCRIPT (M09_Mobius_Initial_Conversation, "")
  652. {
  653. float max_health;
  654. REGISTER_VARIABLES()
  655. {
  656. SAVE_VARIABLE( max_health, 1 );
  657. }
  658. void Created (GameObject *obj)
  659. {
  660. Commands->Set_HUD_Help_Text ( IDS_M09DSGN_DSGN0072I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  661. Commands->Start_Timer (obj, this, 5.0f, 20);
  662. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 900, 3, 0.0f);
  663. Commands->Innate_Disable ( obj );
  664. max_health = Commands->Get_Health (obj);
  665. }
  666. void Timer_Expired(GameObject * obj, int timer_id )
  667. {
  668. if (timer_id == 20)
  669. {
  670. const char *conv_name = ("IDS_M09_D07");
  671. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  672. Commands->Join_Conversation(obj, conv_id, false, false);
  673. Commands->Join_Conversation(STAR, conv_id, false, false);
  674. Commands->Start_Conversation (conv_id, 900);
  675. Commands->Monitor_Conversation (obj, conv_id);
  676. }
  677. }
  678. /*void Damaged (GameObject *obj, GameObject *damager, float amount)
  679. {
  680. Commands->Set_Health (obj, max_health);
  681. }*/
  682. void Killed(GameObject * obj, GameObject *killer )
  683. {
  684. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), MOBIUS_KILLED, 0, 0.0f);
  685. }
  686. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  687. {
  688. if(action_id == 900 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  689. {
  690. const char *conv_name = ("IDS_M09_P01");
  691. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  692. Commands->Join_Conversation(obj, conv_id, false, false);
  693. Commands->Join_Conversation(STAR, conv_id, false, false);
  694. Commands->Start_Conversation (conv_id, 903);
  695. Commands->Monitor_Conversation (obj, conv_id);
  696. }
  697. if(action_id == 901 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  698. {
  699. ActionParamsStruct params;
  700. params.Set_Basic( this, 99, 101 );
  701. params.Set_Movement( Vector3(0,0,0), WALK, 0.5f);
  702. params.WaypathID = 2000275;
  703. Commands->Action_Goto (obj, params);
  704. }
  705. if (action_id == 101)
  706. {
  707. /*ActionParamsStruct params;
  708. params.Set_Basic( this, 99, 150 );
  709. params.Set_Face_Location( Commands->Get_Position (STAR), 10.0f);
  710. Commands->Action_Face_Location ( obj, params );
  711. */
  712. const char *conv_name = ("IDS_M09_D07");
  713. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  714. Commands->Join_Conversation(obj, conv_id, false, false);
  715. Commands->Join_Conversation(STAR, conv_id, false, false);
  716. Commands->Start_Conversation (conv_id, 902);
  717. Commands->Monitor_Conversation (obj, conv_id);
  718. }
  719. if(action_id == 902 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  720. {
  721. const char *conv_name = ("IDS_M09_P01");
  722. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  723. Commands->Join_Conversation(obj, conv_id, false, false);
  724. Commands->Join_Conversation(STAR, conv_id, false, false);
  725. Commands->Start_Conversation (conv_id, 903);
  726. Commands->Monitor_Conversation (obj, conv_id);
  727. }
  728. if(action_id == 903 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  729. {
  730. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 901, 3, 0.0f);
  731. Commands->Innate_Enable(obj);
  732. Commands->Attach_Script(Commands->Find_Object (2000010), "M09_Mobius_Follow", "");
  733. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000279), CONVERSATION, ENDED, 0.0f);
  734. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, 2001012, 1.0f );
  735. Commands->Give_PowerUp(obj, "POW_Pistol_AI");
  736. Commands->Select_Weapon (obj, "Weapon_Pistol_Ai" );
  737. }
  738. }
  739. };
  740. DECLARE_SCRIPT (M09_Mobius_Follow, "") //Mobius (Pre-Suit): 2000010
  741. {
  742. int objective_901, objective_902, objective_903;
  743. int cover_id [3];
  744. int closest;
  745. int attack_path;
  746. int elev_num;
  747. float cover_distance [3];
  748. float current_health;
  749. float last_health, damage_tally;
  750. bool stationary;
  751. bool nofollow;
  752. REGISTER_VARIABLES()
  753. {
  754. SAVE_VARIABLE( objective_901, 1 );
  755. SAVE_VARIABLE( objective_902, 2 );
  756. SAVE_VARIABLE( objective_903, 3 );
  757. SAVE_VARIABLE( closest, 4 );
  758. SAVE_VARIABLE( current_health, 5 );
  759. SAVE_VARIABLE( last_health, 6 );
  760. SAVE_VARIABLE( damage_tally, 7 );
  761. SAVE_VARIABLE( stationary, 8 );
  762. SAVE_VARIABLE( attack_path, 9 );
  763. SAVE_VARIABLE( nofollow, 10 );
  764. SAVE_VARIABLE( elev_num, 11 );
  765. }
  766. void Follow_Function (GameObject * obj, int waypath_id)
  767. {
  768. attack_path = waypath_id;
  769. //Vector3 loc = Commands->Get_Position (Commands->Find_Object (waypath_id));
  770. ActionParamsStruct params;
  771. params.Set_Basic( this, 96, MOBIUS_GOTO );
  772. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (waypath_id)), 1.2f, 0.8f );
  773. Commands->Action_Goto (obj, params);
  774. /*ActionParamsStruct params;
  775. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  776. params.Set_Movement (STAR, RUN, 0.5f);
  777. params.MoveFollow = true;
  778. Commands->Action_Goto (obj, params);*/
  779. }
  780. /*void Enemy_Seen(GameObject * obj, GameObject *enemy )
  781. {
  782. ActionParamsStruct params;
  783. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  784. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_path)), 1.2f, 1.0f );
  785. //params.WaypathID = attack_path;
  786. params.Set_Attack(enemy, 100.0f, 1.0f, true);
  787. params.AttackCheckBlocked = true;
  788. params.AttackActive = true;
  789. Commands->Action_Attack (obj, params);
  790. }*/
  791. void Killed(GameObject * obj, GameObject *killer )
  792. {
  793. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), check, check, 0.0f);
  794. if (objective_901 == false)
  795. {
  796. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 901, 2, 0.0f);
  797. }
  798. else if (objective_902 == false)
  799. {
  800. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 902, 2, 0.0f);
  801. }
  802. else if (objective_903 == false)
  803. {
  804. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 903, 2, 0.0f);
  805. }
  806. Commands->Mission_Complete(false);
  807. }
  808. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  809. {
  810. if (type == NO_FOLLOW)
  811. {
  812. if (param == ON)
  813. {
  814. nofollow = true;
  815. }
  816. if (param == OFF)
  817. {
  818. nofollow = false;
  819. }
  820. }
  821. if (sender == (Commands->Find_Object (2000071)))
  822. {
  823. switch (type)
  824. {
  825. case 901:
  826. {
  827. objective_901 = param;
  828. }
  829. break;
  830. case 902:
  831. {
  832. objective_902 = param;
  833. }
  834. break;
  835. case 903:
  836. {
  837. objective_903 = param;
  838. }
  839. break;
  840. }
  841. }
  842. if (type == WAYPATH)
  843. {
  844. ActionParamsStruct params;
  845. params.Set_Basic( this, 99, 951 );
  846. params.Set_Movement( Commands->Find_Object (param), 1.2f, 0.5f);
  847. Commands->Action_Goto( obj, params );
  848. }
  849. if (type == FOLLOW)
  850. {
  851. Follow_Function (obj, param);
  852. }
  853. if (type == ELEVATOR_EXIT)
  854. {
  855. attack_path = param;
  856. ActionParamsStruct params;
  857. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, MOBIUS_GOTO );
  858. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (param)), 1.2f, 0.8f );
  859. params.MovePathfind = false;
  860. Commands->Action_Goto (obj, params);
  861. }
  862. if (type == ELEVATOR)
  863. {
  864. elev_num = Commands->Get_ID (sender);
  865. Commands->Action_Reset ( obj, 100 );
  866. ActionParamsStruct params;
  867. params.Set_Basic( this, 99, ELEV_WAYPOINT );
  868. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (param)), 1.2f, 1.0f);
  869. Commands->Action_Goto (obj, params);
  870. }
  871. if (type == ELEVATOR_DOWN)
  872. {
  873. elev_num = Commands->Get_ID (sender);
  874. Commands->Action_Reset ( obj, 100 );
  875. ActionParamsStruct params;
  876. params.Set_Basic( this, 99, ELEV_WAYPOINT2 );
  877. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (param)), 1.2f, 1.0f);
  878. Commands->Action_Goto (obj, params);
  879. }
  880. }
  881. void Created (GameObject *obj)
  882. {
  883. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000279), CONVERSATION, ENDED, 0.0f);
  884. for (int x = 0; x <= 2; x++)
  885. {
  886. cover_distance [x] = 900;
  887. }
  888. cover_id [0] = 2000006;
  889. cover_id [1] = 2000007;
  890. cover_id [2] = 2000008;
  891. objective_901 = false;
  892. objective_902 = false;
  893. objective_903 = false;
  894. stationary = false;
  895. nofollow = false;
  896. closest = 0;
  897. last_health = Commands->Get_Max_Health(obj);
  898. damage_tally = 0;
  899. Commands->Start_Timer (obj, this, 5.0f, TOO_FAR);
  900. }
  901. /*void Damaged( GameObject * obj, GameObject * damager, float amount )
  902. {
  903. current_health = Commands->Get_Health (obj);
  904. float damage = ((last_health - current_health) + damage_tally);
  905. float mod_damage = (damage * .15);
  906. damage_tally += mod_damage;
  907. Commands->Set_Health (obj, (last_health - mod_damage));
  908. last_health = Commands->Get_Health (obj);
  909. current_health = Commands->Get_Health (obj);
  910. if (current_health <= 75)
  911. {
  912. Commands->Set_Innate_Aggressiveness ( obj, 0.0 );
  913. Commands->Set_Innate_Take_Cover_Probability ( obj, 100.0 );
  914. }
  915. }*/
  916. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  917. {
  918. if((action_id == MOBIUS_GOTO) && (action_id != Commands->Get_Action_ID(obj)) && (!Commands->Is_Performing_Pathfind_Action(obj)) && (reason == ACTION_COMPLETE_LOW_PRIORITY))
  919. {
  920. Commands->Start_Timer (obj, this, 5.0f, RESEND_GOTO);
  921. }
  922. if (action_id == MOBIUS_GOTO && reason == ACTION_COMPLETE_PATH_BAD_DEST)
  923. {
  924. Commands->Start_Timer (obj, this, 0.5f, BAD_PATH);
  925. }
  926. /*if(action_id == 1 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  927. {
  928. Follow_Function (obj);
  929. }
  930. if (action_id == 20)
  931. {
  932. Commands->Start_Timer (obj, this, 10.0f, 20);
  933. }
  934. if (action_id == 10000)
  935. {
  936. ActionParamsStruct params;
  937. params.Set_Basic( this, 99, 10001);
  938. params.Set_Animation( "H_A_J20b", true );
  939. Commands->Action_Play_Animation (obj, params);
  940. }*/
  941. /*if (action_id == 951)
  942. {
  943. Commands->Set_Facing (obj, Commands->Get_Facing (Commands->Find_Object (2000462)));
  944. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000453), VERIFY, GO, 4.0f );
  945. const char *conv_name = ("IDS_M09_D17");
  946. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  947. Commands->Join_Conversation(obj, conv_id, false, false);
  948. Commands->Join_Conversation(STAR, conv_id, false, false);
  949. Commands->Start_Conversation (conv_id, 952);
  950. Commands->Monitor_Conversation (obj, conv_id);
  951. }*/
  952. if(action_id == 952)
  953. {
  954. Commands->Start_Timer (obj, this, 0.0f, 953);
  955. }
  956. if (action_id == ELEV_WAYPOINT && reason == ACTION_COMPLETE_NORMAL)
  957. {
  958. Commands->Set_Innate_Is_Stationary ( obj, true );
  959. Commands->Send_Custom_Event( obj, Commands->Find_Object (elev_num), SET_MOBIUS, 0);
  960. }
  961. if (action_id == ELEV_WAYPOINT2 && reason == ACTION_COMPLETE_NORMAL)
  962. {
  963. Commands->Set_Innate_Is_Stationary ( obj, true );
  964. Commands->Send_Custom_Event( obj, Commands->Find_Object (elev_num), SET_MOBIUS, 0);
  965. }
  966. }
  967. /*void Poked(GameObject * obj, GameObject * poker)
  968. {
  969. if (poker == STAR)
  970. {
  971. if (stationary == false)
  972. {
  973. stationary = true;
  974. Commands->Set_Innate_Is_Stationary ( obj, true );
  975. const char *conv_name = ("IDS_M09_D03");
  976. int conv_id = Commands->Create_Conversation (conv_name);
  977. Commands->Join_Conversation(obj, conv_id, false, true);
  978. Commands->Start_Conversation (conv_id, 1);
  979. Commands->Monitor_Conversation (obj, conv_id);
  980. ActionParamsStruct params;
  981. params.Set_Basic( this, 99, 10000);
  982. params.Set_Animation( "H_A_J20a", false );
  983. Commands->Action_Play_Animation (obj, params);
  984. }
  985. else if (stationary == true)
  986. {
  987. stationary = false;
  988. Commands->Action_Reset ( obj, 100 );
  989. Commands->Set_Innate_Is_Stationary ( obj, false );
  990. const char *conv_name = ("IDS_M09_D04");
  991. int conv_id = Commands->Create_Conversation (conv_name);
  992. Commands->Join_Conversation(obj, conv_id, false, true);
  993. Commands->Start_Conversation (conv_id, 1);
  994. Commands->Monitor_Conversation (obj, conv_id);
  995. ActionParamsStruct params;
  996. params.Set_Basic( this, 99, 10002);
  997. params.Set_Animation( "H_A_J20c", false );
  998. Commands->Action_Play_Animation (obj, params);
  999. //Follow_Function (GameObject * obj, int waypath_id);
  1000. }
  1001. }
  1002. }*/
  1003. void Timer_Expired(GameObject * obj, int timer_id )
  1004. {
  1005. if (timer_id == RESEND_GOTO)
  1006. {
  1007. ActionParamsStruct params;
  1008. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, MOBIUS_GOTO );
  1009. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_path)), 1.2f, 1.0f );
  1010. Commands->Action_Goto (obj, params);
  1011. }
  1012. if (timer_id == BAD_PATH)
  1013. {
  1014. ActionParamsStruct params;
  1015. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, MOBIUS_GOTO );
  1016. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_path)), 1.2f, 1.0f );
  1017. params.MovePathfind = false;
  1018. Commands->Action_Goto (obj, params);
  1019. }
  1020. if (timer_id == TOO_FAR)
  1021. {
  1022. if (!nofollow)
  1023. {
  1024. float distance = (Commands->Get_Distance ( Commands->Get_Position (STAR), Commands->Get_Position (Commands->Find_Object (2000010))) );
  1025. if (distance >= 25.0f)
  1026. {
  1027. ActionParamsStruct params;
  1028. params.Set_Basic( this, 96, MOBIUS_GOTO );
  1029. params.Set_Movement( Commands->Get_Position (STAR), 1.2f, 5.0f );
  1030. //params.MovePathfind = false;
  1031. Commands->Action_Goto (obj, params);
  1032. }
  1033. Commands->Start_Timer (obj, this, 5.0f, TOO_FAR);
  1034. }
  1035. }
  1036. /*if (stationary == false)
  1037. {
  1038. int poke_id = Commands->Get_Random_Int(1, 3);
  1039. Commands->Start_Timer (obj, this, 5.0f, CHECK_DISTANCE);
  1040. // Don't leave me here
  1041. if(timer_id == CHECK_DISTANCE && poke_id == 2)
  1042. {
  1043. Vector3 star_pos = Commands->Get_Position(STAR);
  1044. Vector3 mobius_pos = Commands->Get_Position(obj);
  1045. float distance_to_star = Commands->Get_Distance(star_pos, mobius_pos);
  1046. if(distance_to_star > 15.0f)
  1047. {
  1048. const char *conv_name = ("IDS_M09_D01");
  1049. int conv_id = Commands->Create_Conversation (conv_name);
  1050. Commands->Join_Conversation(obj, conv_id, false, true);
  1051. Commands->Start_Conversation (conv_id, 1);
  1052. Commands->Monitor_Conversation (obj, conv_id);
  1053. Follow_Function (obj);
  1054. }
  1055. }
  1056. // Hey! Wait for me!
  1057. else if(timer_id == CHECK_DISTANCE && poke_id == 1)
  1058. {
  1059. Vector3 star_pos = Commands->Get_Position(STAR);
  1060. Vector3 mobius_pos = Commands->Get_Position(obj);
  1061. float distance_to_star = Commands->Get_Distance(star_pos, mobius_pos);
  1062. if(distance_to_star > 15.0f)
  1063. {
  1064. const char *conv_name = ("IDS_M09_D02");
  1065. int conv_id = Commands->Create_Conversation (conv_name);
  1066. Commands->Join_Conversation(obj, conv_id, false, true);
  1067. Commands->Start_Conversation (conv_id, 1);
  1068. Commands->Monitor_Conversation (obj, conv_id);
  1069. Follow_Function (obj);
  1070. }
  1071. }
  1072. else if(timer_id == 20)
  1073. {
  1074. Follow_Function (obj);
  1075. }
  1076. }*/
  1077. if(timer_id == 953)
  1078. {
  1079. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000453), VERIFY, STOP, 3.0f );
  1080. }
  1081. }
  1082. };
  1083. DECLARE_SCRIPT (M09_Stationary, "Reward_override=0:int")
  1084. {
  1085. int reward;
  1086. REGISTER_VARIABLES()
  1087. {
  1088. SAVE_VARIABLE( reward, 1 );
  1089. }
  1090. void Created(GameObject *obj)
  1091. {
  1092. Commands->Set_Innate_Is_Stationary ( obj, true );
  1093. reward = Commands->Get_Random_Int ( 1, 101 );
  1094. if (Get_Int_Parameter("Reward_override") == 1)
  1095. {
  1096. Commands->Set_Health ( obj, 5 );
  1097. }
  1098. }
  1099. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1100. {
  1101. Commands->Set_Innate_Is_Stationary ( obj, false );
  1102. }
  1103. /*void Killed( GameObject * obj, GameObject * killer )
  1104. {
  1105. if (Get_Int_Parameter("Reward_override") == 0)
  1106. {
  1107. if (reward > 25)
  1108. {
  1109. Vector3 powerup_loc = Commands->Get_Position (obj);
  1110. powerup_loc.Z += 1.0f;
  1111. Commands->Create_Object("Health 025 PowerUp", powerup_loc);
  1112. }
  1113. if (reward > 80)
  1114. {
  1115. Vector3 powerup_loc = Commands->Get_Position (obj);
  1116. powerup_loc.Z += 1.0f;
  1117. Commands->Create_Object("Armor 025 PowerUp", powerup_loc);
  1118. }
  1119. }
  1120. }*/
  1121. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1122. {
  1123. if (type == CHANGE_PLAYERTYPE)
  1124. {
  1125. if (param == MUTANT)
  1126. {
  1127. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_MUTANT );
  1128. }
  1129. }
  1130. }
  1131. };
  1132. DECLARE_SCRIPT (M09_Stationary_Nod, "")
  1133. {
  1134. int reward;
  1135. REGISTER_VARIABLES()
  1136. {
  1137. SAVE_VARIABLE( reward, 1 );
  1138. }
  1139. void Created(GameObject *obj)
  1140. {
  1141. Commands->Set_Innate_Is_Stationary ( obj, true );
  1142. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  1143. reward = Commands->Get_Random_Int ( 1, 101 );
  1144. }
  1145. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1146. {
  1147. Commands->Set_Innate_Is_Stationary ( obj, false );
  1148. }
  1149. /*void Killed( GameObject * obj, GameObject * killer )
  1150. {
  1151. if (reward > 25)
  1152. {
  1153. Vector3 powerup_loc = Commands->Get_Position (obj);
  1154. powerup_loc.Z += 1.0f;
  1155. Commands->Create_Object("Health 025 PowerUp", powerup_loc);
  1156. }
  1157. if (reward > 80)
  1158. {
  1159. Vector3 powerup_loc = Commands->Get_Position (obj);
  1160. powerup_loc.Z += 1.0f;
  1161. Commands->Create_Object("Armor 025 PowerUp", powerup_loc);
  1162. }
  1163. }*/
  1164. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1165. {
  1166. if (type == CHANGE_PLAYERTYPE)
  1167. {
  1168. if (param == MUTANT)
  1169. {
  1170. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_MUTANT );
  1171. }
  1172. }
  1173. }
  1174. };
  1175. DECLARE_SCRIPT (M09_Home_Location_10, "")
  1176. {
  1177. void Created (GameObject *obj)
  1178. {
  1179. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 10.0f);
  1180. }
  1181. };
  1182. DECLARE_SCRIPT (M09_Mutant_Ambush_Zone_01, "")
  1183. {
  1184. bool already_entered;
  1185. // Register variables to be Auto-Saved
  1186. // All variables must have a unique ID, less than 256, that never changes
  1187. REGISTER_VARIABLES()
  1188. {
  1189. SAVE_VARIABLE( already_entered, 1 );
  1190. }
  1191. void Created (GameObject * obj)
  1192. {
  1193. already_entered = false;
  1194. }
  1195. void Entered (GameObject * obj, GameObject * enterer)
  1196. {
  1197. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1198. {
  1199. already_entered = true;
  1200. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), SPAWN_LOC, INCREMENT, 0.0f);
  1201. //Nod soldiers
  1202. Commands->Attach_Script(Commands->Find_Object (2000126), "M09_Nod_Damage_Mod_10", "");
  1203. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000126), false );
  1204. Commands->Attach_Script(Commands->Find_Object (2000127), "M09_Nod_Damage_Mod_10", "");
  1205. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000127), false );
  1206. Commands->Attach_Script(Commands->Find_Object (2000128), "M09_Nod_Damage_Mod_10", "");
  1207. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000128), false );
  1208. Commands->Attach_Script(Commands->Find_Object (2000129), "M09_Nod_Damage_Mod_10", "");
  1209. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000129), false );
  1210. //Mutant soldiers
  1211. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000122), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  1212. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000122), false );
  1213. Commands->Attach_Script(Commands->Find_Object (2000122), "M09_Mutant_Damage_Mod_10", "");
  1214. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000123), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  1215. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000123), false );
  1216. Commands->Attach_Script(Commands->Find_Object (2000123), "M09_Mutant_Damage_Mod_10", "");
  1217. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000124), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  1218. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000124), false );
  1219. Commands->Attach_Script(Commands->Find_Object (2000124), "M09_Mutant_Damage_Mod_10", "");
  1220. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000125), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  1221. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000125), false );
  1222. Commands->Attach_Script(Commands->Find_Object (2000125), "M09_Mutant_Damage_Mod_10", "");
  1223. }
  1224. }
  1225. };
  1226. DECLARE_SCRIPT (M09_Mutant_Damage_Mod_10, "")
  1227. {
  1228. float last_health, current_health, damage_tally;
  1229. REGISTER_VARIABLES()
  1230. {
  1231. SAVE_VARIABLE( last_health, 1 );
  1232. SAVE_VARIABLE( current_health, 2 );
  1233. SAVE_VARIABLE( damage_tally, 3 );
  1234. }
  1235. void Created (GameObject * obj)
  1236. {
  1237. last_health = Commands->Get_Max_Health(obj);
  1238. damage_tally = 0;
  1239. }
  1240. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1241. {
  1242. if (damager != STAR)
  1243. {
  1244. current_health = Commands->Get_Health (obj);
  1245. float damage = ((last_health - current_health) + damage_tally);
  1246. float mod_damage = (damage * .10);
  1247. damage_tally += mod_damage;
  1248. Commands->Set_Health (obj, (last_health - mod_damage));
  1249. last_health = Commands->Get_Health (obj);
  1250. current_health = Commands->Get_Health (obj);
  1251. }
  1252. }
  1253. };
  1254. DECLARE_SCRIPT (M09_Mutant_Damage_Mod_50, "")
  1255. {
  1256. float last_health, current_health, damage_tally;
  1257. REGISTER_VARIABLES()
  1258. {
  1259. SAVE_VARIABLE( last_health, 1 );
  1260. SAVE_VARIABLE( current_health, 2 );
  1261. SAVE_VARIABLE( damage_tally, 3 );
  1262. }
  1263. void Created (GameObject * obj)
  1264. {
  1265. last_health = Commands->Get_Max_Health(obj);
  1266. damage_tally = 0;
  1267. }
  1268. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1269. {
  1270. if (damager != STAR)
  1271. {
  1272. current_health = Commands->Get_Health (obj);
  1273. float damage = ((last_health - current_health) + damage_tally);
  1274. float mod_damage = (damage * .25);
  1275. damage_tally += mod_damage;
  1276. Commands->Set_Health (obj, (last_health - mod_damage));
  1277. last_health = Commands->Get_Health (obj);
  1278. current_health = Commands->Get_Health (obj);
  1279. }
  1280. }
  1281. };
  1282. DECLARE_SCRIPT (M09_Nod_Damage_Mod_10, "")
  1283. {
  1284. float last_health, current_health, damage_tally;
  1285. REGISTER_VARIABLES()
  1286. {
  1287. SAVE_VARIABLE( last_health, 1 );
  1288. SAVE_VARIABLE( current_health, 2 );
  1289. SAVE_VARIABLE( damage_tally, 3 );
  1290. }
  1291. void Created (GameObject * obj)
  1292. {
  1293. last_health = Commands->Get_Max_Health(obj);
  1294. damage_tally = 0;
  1295. }
  1296. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1297. {
  1298. if (damager != STAR)
  1299. {
  1300. current_health = Commands->Get_Health (obj);
  1301. float damage = ((last_health - current_health) + damage_tally);
  1302. float mod_damage = (damage * .08);
  1303. damage_tally += mod_damage;
  1304. Commands->Set_Health (obj, (last_health - mod_damage));
  1305. last_health = Commands->Get_Health (obj);
  1306. current_health = Commands->Get_Health (obj);
  1307. }
  1308. }
  1309. };
  1310. DECLARE_SCRIPT (M09_Stealth_Tank_Pilot, "")
  1311. {
  1312. void Created (GameObject *obj)
  1313. {
  1314. Commands->Set_Facing(obj, 35.0f);
  1315. Commands->Innate_Disable ( obj );
  1316. }
  1317. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1318. {
  1319. if (enemy == STAR)
  1320. {
  1321. // Vector3 location = Commands->Get_Position (Commands->Find_Object (2000091));
  1322. ActionParamsStruct params;
  1323. params.Set_Basic( this, 99, RUN_TO_TANK );
  1324. params.Set_Movement( Commands->Find_Object (2000090), RUN, 4.0f );
  1325. Commands->Action_Goto( obj, params );
  1326. }
  1327. }
  1328. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1329. {
  1330. if (action_id == RUN_TO_TANK && reason == ACTION_COMPLETE_NORMAL)
  1331. {
  1332. Commands->Destroy_Object (obj);
  1333. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000090), ATTACK, ATTACK, 0.0f);
  1334. }
  1335. }
  1336. };
  1337. DECLARE_SCRIPT (M09_Stationary_StealthTank, "")
  1338. {
  1339. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1340. {
  1341. if (type == ATTACK && param == ATTACK)
  1342. {
  1343. Vector3 stealth_loc = Commands->Get_Position (obj);
  1344. Commands->Destroy_Object (obj);
  1345. GameObject *stealth_tank;
  1346. stealth_tank = Commands->Create_Object ( "Nod_Stealth_Tank", stealth_loc );
  1347. Commands->Attach_Script (stealth_tank, "M09_Vehicle_Attack_01", "");
  1348. Commands->Attach_Script (stealth_tank, "M09_CheckpointA_Counter", "");
  1349. }
  1350. if (type == CUSTOM_EVENT_VEHICLE_ENTERED)
  1351. {
  1352. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 905, 3, 0.0f);
  1353. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 905, 1, 0.0f);
  1354. }
  1355. }
  1356. };
  1357. DECLARE_SCRIPT (M09_Vehicle_Attack_01, "")
  1358. {
  1359. bool attacking, charge, charging;
  1360. Vector3 current_loc;
  1361. Vector3 enemy_loc;
  1362. enum{ATTACK_OVER};
  1363. // Register variables to be Auto-Saved
  1364. // All variables must have a unique ID, less than 256, that never changes
  1365. REGISTER_VARIABLES()
  1366. {
  1367. SAVE_VARIABLE( attacking, 1 );
  1368. SAVE_VARIABLE( charge, 2 );
  1369. SAVE_VARIABLE( charging, 3 );
  1370. SAVE_VARIABLE( current_loc, 4 );
  1371. SAVE_VARIABLE( enemy_loc, 5 );
  1372. }
  1373. void Created(GameObject * obj)
  1374. {
  1375. Commands->Enable_Enemy_Seen( obj, true);
  1376. attacking = false;
  1377. charge = false;
  1378. charging = false;
  1379. ActionParamsStruct params;
  1380. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1381. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1382. params.WaypathID = 2000095;
  1383. Commands->Action_Attack (obj, params);
  1384. }
  1385. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1386. {
  1387. current_loc = Commands->Get_Position ( obj );
  1388. enemy_loc = Commands->Get_Position ( enemy );
  1389. if (!attacking && !charge)
  1390. {
  1391. if ((Commands->Get_Distance(current_loc, enemy_loc)) < 65)
  1392. {
  1393. attacking = true;
  1394. ActionParamsStruct params;
  1395. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  1396. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1397. params.WaypathID = 2000095;
  1398. params.Set_Attack(STAR, 100.0f, 5.0f, true);
  1399. params.AttackCheckBlocked = false;
  1400. params.AttackActive = true;
  1401. Commands->Modify_Action(obj, 10, params);
  1402. Commands->Start_Timer(obj, this, 5.0f, ATTACK_OVER);
  1403. if (!charging)
  1404. {
  1405. charging = true;
  1406. Commands->Start_Timer(obj, this, 16.0f, CHANGE_ATTACK);
  1407. }
  1408. }
  1409. }
  1410. }
  1411. void Timer_Expired (GameObject* obj, int timer_id)
  1412. {
  1413. ActionParamsStruct params;
  1414. if (timer_id == ATTACK_OVER)
  1415. {
  1416. attacking = false;
  1417. }
  1418. else if (timer_id == CHANGE_ATTACK)
  1419. {
  1420. if ((Commands->Get_Distance(current_loc, enemy_loc)) < 65)
  1421. {
  1422. Commands->Action_Reset ( obj, 100 );
  1423. charge = true;
  1424. ActionParamsStruct params;
  1425. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1426. params.Set_Movement( STAR, 1.5f, 0 );
  1427. params.Set_Attack(STAR, 100.0f, 5.0f, true);
  1428. params.AttackCheckBlocked = false;
  1429. params.AttackActive = true;
  1430. Commands->Action_Attack (obj, params);
  1431. Commands->Start_Timer(obj, this, 6.0f, CHARGE_COMPLETE);
  1432. }
  1433. }
  1434. else if (timer_id == CHARGE_COMPLETE)
  1435. {
  1436. charge = false;
  1437. charging = false;
  1438. ActionParamsStruct params;
  1439. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  1440. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1441. params.WaypathID = 2000095;
  1442. params.Set_Attack(STAR, 100.0f, 5.0f, true);
  1443. params.AttackCheckBlocked = false;
  1444. params.AttackActive = true;
  1445. Commands->Action_Attack (obj, params);
  1446. }
  1447. }
  1448. };
  1449. DECLARE_SCRIPT (M09_Vehicle_Attack_02, "")
  1450. {
  1451. bool attacking, charge, charging;
  1452. Vector3 current_loc;
  1453. Vector3 enemy_loc;
  1454. enum{ATTACK_OVER};
  1455. // Register variables to be Auto-Saved
  1456. // All variables must have a unique ID, less than 256, that never changes
  1457. REGISTER_VARIABLES()
  1458. {
  1459. SAVE_VARIABLE( attacking, 1 );
  1460. SAVE_VARIABLE( charge, 2 );
  1461. SAVE_VARIABLE( charging, 3 );
  1462. SAVE_VARIABLE( current_loc, 4 );
  1463. SAVE_VARIABLE( enemy_loc, 5 );
  1464. }
  1465. void Created(GameObject * obj)
  1466. {
  1467. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  1468. Commands->Enable_Enemy_Seen( obj, true);
  1469. attacking = false;
  1470. charge = false;
  1471. charging = false;
  1472. }
  1473. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1474. {
  1475. current_loc = Commands->Get_Position ( obj );
  1476. enemy_loc = Commands->Get_Position ( enemy );
  1477. if (!attacking)
  1478. {
  1479. if ((Commands->Get_Distance(current_loc, enemy_loc)) < 200.0f)
  1480. {
  1481. attacking = true;
  1482. ActionParamsStruct params;
  1483. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1484. params.Set_Attack(STAR, 200.0f, 5.0f, true);
  1485. params.AttackCheckBlocked = false;
  1486. params.AttackActive = true;
  1487. Commands->Action_Attack (obj, params);
  1488. Commands->Start_Timer(obj, this, 1.0f, ATTACK_OVER);
  1489. }
  1490. }
  1491. }
  1492. void Timer_Expired (GameObject* obj, int timer_id)
  1493. {
  1494. ActionParamsStruct params;
  1495. if (timer_id == ATTACK_OVER)
  1496. {
  1497. attacking = false;
  1498. }
  1499. }
  1500. };
  1501. DECLARE_SCRIPT (M09_Sam_Engineer_1, "")
  1502. {
  1503. void Created(GameObject * obj)
  1504. {
  1505. ActionParamsStruct params;
  1506. params.Set_Basic( this, 99, 10 );
  1507. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000102)), RUN, 1.5f );
  1508. Commands->Action_Goto (obj, params);
  1509. }
  1510. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1511. {
  1512. if (action_id == 10)
  1513. {
  1514. ActionParamsStruct params;
  1515. params.Set_Basic( this, 99, 1);
  1516. params.Set_Animation( "H_A_a0f0", true );
  1517. Commands->Action_Play_Animation (obj, params);
  1518. }
  1519. }
  1520. };
  1521. DECLARE_SCRIPT (M09_Sam_Engineer_2, "")
  1522. {
  1523. void Created(GameObject * obj)
  1524. {
  1525. ActionParamsStruct params;
  1526. params.Set_Basic( this, 99, 10 );
  1527. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000103)), RUN, 1.5f );
  1528. Commands->Action_Goto (obj, params);
  1529. }
  1530. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1531. {
  1532. if (action_id == 10)
  1533. {
  1534. ActionParamsStruct params;
  1535. params.Set_Basic( this, 99, 1);
  1536. params.Set_Animation( "H_A_a0f0", true );
  1537. Commands->Action_Play_Animation (obj, params);
  1538. }
  1539. }
  1540. };
  1541. DECLARE_SCRIPT (M09_Excavation_Tunnel_Encounter_On, "")
  1542. {
  1543. void Entered (GameObject * obj, GameObject * enterer)
  1544. {
  1545. if (Commands->Is_A_Star(enterer))
  1546. {
  1547. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000406), ACTIVATE, ACTIVATE, 0.0f);
  1548. }
  1549. }
  1550. };
  1551. DECLARE_SCRIPT (M09_Excavation_Tunnel_Encounter_Off, "")
  1552. {
  1553. void Entered (GameObject * obj, GameObject * enterer)
  1554. {
  1555. if (Commands->Is_A_Star(enterer))
  1556. {
  1557. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000406), DEACTIVATE, DEACTIVATE, 0.0f);
  1558. }
  1559. }
  1560. };
  1561. DECLARE_SCRIPT (M09_Excavation_Tunnel_Controller, "") //2000406
  1562. {
  1563. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1564. {
  1565. if (type == ACTIVATE && param == ACTIVATE)
  1566. {
  1567. //nod spawners
  1568. Commands->Enable_Spawner(2000357, true);
  1569. Commands->Enable_Spawner(2000354, true);
  1570. Commands->Enable_Spawner(2000356, true);
  1571. //mutant spawners
  1572. Commands->Enable_Spawner(2000384, true);
  1573. Commands->Enable_Spawner(2000383, true);
  1574. Commands->Enable_Spawner(2000382, true);
  1575. Commands->Enable_Spawner(2000381, true);
  1576. }
  1577. if (type == DEACTIVATE && param == DEACTIVATE)
  1578. {
  1579. //nod spawners
  1580. Commands->Enable_Spawner(2000357, false);
  1581. Commands->Enable_Spawner(2000354, false);
  1582. Commands->Enable_Spawner(2000356, false);
  1583. //mutant spawners
  1584. Commands->Enable_Spawner(2000384, false);
  1585. Commands->Enable_Spawner(2000383, false);
  1586. Commands->Enable_Spawner(2000382, false);
  1587. Commands->Enable_Spawner(2000381, false);
  1588. }
  1589. }
  1590. };
  1591. DECLARE_SCRIPT (M09_Vehicle_Attack_03, "")
  1592. {
  1593. bool attacking, charge, charging;
  1594. Vector3 current_loc;
  1595. Vector3 enemy_loc;
  1596. enum{ATTACK_OVER};
  1597. // Register variables to be Auto-Saved
  1598. // All variables must have a unique ID, less than 256, that never changes
  1599. REGISTER_VARIABLES()
  1600. {
  1601. SAVE_VARIABLE( attacking, 1 );
  1602. SAVE_VARIABLE( charge, 2 );
  1603. SAVE_VARIABLE( charging, 3 );
  1604. SAVE_VARIABLE( current_loc, 4 );
  1605. SAVE_VARIABLE( enemy_loc, 5 );
  1606. }
  1607. void Created(GameObject * obj)
  1608. {
  1609. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  1610. Commands->Enable_Enemy_Seen( obj, true);
  1611. attacking = false;
  1612. charge = false;
  1613. charging = false;
  1614. }
  1615. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1616. {
  1617. current_loc = Commands->Get_Position ( obj );
  1618. enemy_loc = Commands->Get_Position ( enemy );
  1619. if (!attacking)
  1620. {
  1621. if ((Commands->Get_Distance(current_loc, enemy_loc)) < 200.0f)
  1622. {
  1623. attacking = true;
  1624. ActionParamsStruct params;
  1625. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1626. params.Set_Attack(enemy, 200.0f, 10.0f, true);
  1627. params.AttackCheckBlocked = false;
  1628. params.AttackActive = true;
  1629. Commands->Action_Attack (obj, params);
  1630. Commands->Start_Timer(obj, this, 10.0f, ATTACK_OVER);
  1631. }
  1632. }
  1633. }
  1634. void Timer_Expired (GameObject* obj, int timer_id)
  1635. {
  1636. ActionParamsStruct params;
  1637. if (timer_id == ATTACK_OVER)
  1638. {
  1639. attacking = false;
  1640. }
  1641. }
  1642. };
  1643. DECLARE_SCRIPT (M09_Tunnel_Spawner_357, "")
  1644. {
  1645. void Created (GameObject * obj)
  1646. {
  1647. ActionParamsStruct params;
  1648. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1649. params.Set_Movement( Vector3(0,0,0), RUN, 0 );
  1650. params.WaypathID = 2000364;
  1651. Commands->Action_Goto (obj, params);
  1652. }
  1653. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1654. {
  1655. if(action_id == 10)
  1656. {
  1657. Commands->Enable_Enemy_Seen( obj, true);
  1658. Commands->Set_Innate_Is_Stationary ( obj, true );
  1659. }
  1660. }
  1661. };
  1662. DECLARE_SCRIPT (M09_Tunnel_Spawner_354, "")
  1663. {
  1664. void Created (GameObject * obj)
  1665. {
  1666. ActionParamsStruct params;
  1667. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1668. params.Set_Movement( Vector3(0,0,0), RUN, 0 );
  1669. params.WaypathID = 2000370;
  1670. Commands->Action_Goto (obj, params);
  1671. }
  1672. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1673. {
  1674. if(action_id == 10)
  1675. {
  1676. Commands->Set_Innate_Is_Stationary ( obj, true );
  1677. }
  1678. }
  1679. };
  1680. DECLARE_SCRIPT (M09_Tunnel_Spawner_356, "")
  1681. {
  1682. void Created (GameObject * obj)
  1683. {
  1684. ActionParamsStruct params;
  1685. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  1686. params.Set_Movement( Vector3(0,0,0), RUN, 0 );
  1687. params.WaypathID = 2000375;
  1688. Commands->Action_Goto (obj, params);
  1689. }
  1690. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1691. {
  1692. if(action_id == 10)
  1693. {
  1694. Commands->Set_Innate_Is_Stationary ( obj, true );
  1695. }
  1696. }
  1697. };
  1698. DECLARE_SCRIPT (M09_Tunnel_Spawner_384_382, "")
  1699. {
  1700. void Created (GameObject * obj)
  1701. {
  1702. Commands->Set_Innate_Aggressiveness ( obj, 1 );
  1703. ActionParamsStruct params;
  1704. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1705. params.Set_Movement( Vector3(0,0,0), RUN, 0.25f );
  1706. params.WaypathID = 2000385;
  1707. Commands->Action_Goto (obj, params);
  1708. }
  1709. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1710. {
  1711. Commands->Debug_Message("Action Complete on M09_Tunnel_Spawner_383_381 %d %d.\n", action_id, reason);
  1712. if(action_id == 10)
  1713. {
  1714. Commands->Action_Reset ( obj, 100 );
  1715. Commands->Enable_Enemy_Seen( obj, true);
  1716. }
  1717. }
  1718. };
  1719. DECLARE_SCRIPT (M09_Tunnel_Spawner_383_381, "")
  1720. {
  1721. void Created (GameObject * obj)
  1722. {
  1723. Commands->Set_Innate_Aggressiveness ( obj, 1 );
  1724. ActionParamsStruct params;
  1725. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1726. params.Set_Movement( Vector3(0,0,0), RUN, .25f );
  1727. params.WaypathID = 2000397;
  1728. Commands->Action_Goto (obj, params);
  1729. }
  1730. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1731. {
  1732. Commands->Debug_Message("Action Complete on M09_Tunnel_Spawner_383_381 %d %d.\n", action_id, reason);
  1733. if(action_id == 10)
  1734. {
  1735. Commands->Action_Reset ( obj, 100 );
  1736. Commands->Enable_Enemy_Seen( obj, true);
  1737. }
  1738. }
  1739. };
  1740. DECLARE_SCRIPT (M09_Excavation_Tunnel_3, "")
  1741. {
  1742. bool already_entered;
  1743. // Register variables to be Auto-Saved
  1744. // All variables must have a unique ID, less than 256, that never changes
  1745. REGISTER_VARIABLES()
  1746. {
  1747. SAVE_VARIABLE( already_entered, 1 );
  1748. }
  1749. void Created (GameObject * obj)
  1750. {
  1751. already_entered = false;
  1752. }
  1753. void Entered (GameObject * obj, GameObject * enterer)
  1754. {
  1755. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1756. {
  1757. already_entered = true;
  1758. //Nod soldiers
  1759. Commands->Attach_Script(Commands->Find_Object (2000170), "M09_Nod_Damage_Mod_10", "");
  1760. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000170), false );
  1761. //Mutant soldiers
  1762. Commands->Attach_Script(Commands->Find_Object (2000171), "M09_Mutant_Damage_Mod_10", "");
  1763. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000171), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  1764. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000171), false );
  1765. }
  1766. }
  1767. };
  1768. DECLARE_SCRIPT (M09_Entrance_Zone, "")
  1769. {
  1770. bool already_entered;
  1771. // Register variables to be Auto-Saved
  1772. // All variables must have a unique ID, less than 256, that never changes
  1773. REGISTER_VARIABLES()
  1774. {
  1775. SAVE_VARIABLE( already_entered, 1 );
  1776. }
  1777. void Created (GameObject * obj)
  1778. {
  1779. already_entered = false;
  1780. }
  1781. void Entered (GameObject * obj, GameObject * enterer)
  1782. {
  1783. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1784. {
  1785. already_entered = true;
  1786. Commands->Enable_Spawner(2000105, true);
  1787. Commands->Enable_Spawner(2000106, true);
  1788. //Nod soldiers
  1789. Commands->Attach_Script(Commands->Find_Object (2000234), "M09_Nod_Damage_Mod_10", "");
  1790. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000234), false );
  1791. Commands->Attach_Script(Commands->Find_Object (2000235), "M09_Nod_Damage_Mod_10", "");
  1792. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000235), false );
  1793. Commands->Attach_Script(Commands->Find_Object (2000236), "M09_Nod_Damage_Mod_1", "");
  1794. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000236), false );
  1795. //Mutant soldiers
  1796. Commands->Attach_Script(Commands->Find_Object (2000216), "M09_Mutant_Damage_Mod_10", "");
  1797. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000216), false );
  1798. Commands->Attach_Script(Commands->Find_Object (2000217), "M09_Mutant_Damage_Mod_10", "");
  1799. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000217), false );
  1800. Commands->Attach_Script(Commands->Find_Object (2000218), "M09_Mutant_Damage_Mod_10", "");
  1801. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000218), false );
  1802. ActionParamsStruct params;
  1803. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1804. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1805. params.WaypathID = 2000222;
  1806. Commands->Action_Goto (Commands->Find_Object (2000217), params);
  1807. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 11 );
  1808. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1809. params.WaypathID = 2000230;
  1810. Commands->Action_Goto (Commands->Find_Object (2000216), params);
  1811. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 12 );
  1812. params.Set_Movement( Vector3(0,0,0), 1.0f, 0 );
  1813. params.WaypathID = 2000226;
  1814. Commands->Action_Goto (Commands->Find_Object (2000218), params);
  1815. }
  1816. }
  1817. };
  1818. DECLARE_SCRIPT (M09_CheckpointA_Controller, "") //2000969
  1819. {
  1820. int count;
  1821. REGISTER_VARIABLES()
  1822. {
  1823. SAVE_VARIABLE( count, 1 );
  1824. }
  1825. void Created (GameObject *obj)
  1826. {
  1827. count = 0;
  1828. }
  1829. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1830. {
  1831. if (type == COUNTER && param == COUNTER)
  1832. {
  1833. if (count++ >= 12)
  1834. {
  1835. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 904, 3, 0.0f);
  1836. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 904, 1, 0.0f);
  1837. }
  1838. }
  1839. }
  1840. };
  1841. DECLARE_SCRIPT (M09_CheckpointA_Counter, "")
  1842. {
  1843. void Killed( GameObject * obj, GameObject * killer )
  1844. {
  1845. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000969), COUNTER, COUNTER, 0.0f);
  1846. }
  1847. };
  1848. DECLARE_SCRIPT(M09_Chinook_ParaDrop, "Preset:string")
  1849. {
  1850. int chinook_id;
  1851. bool dead;
  1852. int out;
  1853. REGISTER_VARIABLES()
  1854. {
  1855. SAVE_VARIABLE(chinook_id, 1);
  1856. SAVE_VARIABLE(dead, 2);
  1857. SAVE_VARIABLE(out, 3);
  1858. }
  1859. void Created(GameObject * obj)
  1860. {
  1861. Vector3 loc = Commands->Get_Position(obj);
  1862. float facing = Commands->Get_Facing(obj);
  1863. GameObject *chinook_rail = Commands->Create_Object("Generic_Cinematic", loc);
  1864. Commands->Set_Model(chinook_rail, "X5D_Chinookfly");
  1865. Commands->Set_Facing(chinook_rail, facing);
  1866. Commands->Set_Animation(chinook_rail, "X5D_Chinookfly.X5D_Chinookfly", false);
  1867. GameObject *chinook = Commands->Create_Object("Nod_Chinook", loc);
  1868. Commands->Set_Facing(chinook, facing);
  1869. Commands->Set_Animation(chinook, "v_nod_chinook.vf_nod_chinook", true);
  1870. Commands->Attach_To_Object_Bone(chinook, chinook_rail, "BN_Chinook_1");
  1871. dead = false;
  1872. out = 0;
  1873. char params[10];
  1874. sprintf(params, "%d", Commands->Get_ID(obj));
  1875. Commands->Attach_Script(chinook, "M03_Reinforcement_Chinook", params);
  1876. chinook_id = Commands->Get_ID(chinook);
  1877. // Destroy Chinook
  1878. Commands->Start_Timer(obj, this, 280.0f/30.0f, 0);
  1879. // Parachutes
  1880. Commands->Start_Timer(obj, this, 169.0f/30.0f, 1);
  1881. Commands->Start_Timer(obj, this, 179.0f/30.0f, 2);
  1882. Commands->Start_Timer(obj, this, 198.0f/30.0f, 3);
  1883. // Soldiers
  1884. Commands->Start_Timer(obj, this, 145.0f/30.0f, 4);
  1885. Commands->Start_Timer(obj, this, 155.0f/30.0f, 5);
  1886. Commands->Start_Timer(obj, this, 165.0f/30.0f, 6);
  1887. }
  1888. void Timer_Expired(GameObject * obj, int timer_id)
  1889. {
  1890. Vector3 loc = Commands->Get_Position(obj);
  1891. const char * preset = Get_Parameter("Preset");
  1892. float facing = Commands->Get_Facing(obj);
  1893. switch (timer_id)
  1894. {
  1895. case 0:
  1896. GameObject *chinook;
  1897. chinook = Commands->Find_Object(chinook_id);
  1898. Commands->Destroy_Object(chinook);
  1899. break;
  1900. case 1:
  1901. if (out >= 1)
  1902. {
  1903. GameObject *para1;
  1904. para1 = Commands->Create_Object("Generic_Cinematic", loc);
  1905. Commands->Set_Facing(para1, facing);
  1906. Commands->Set_Model(para1, "X5D_Parachute");
  1907. Commands->Set_Animation(para1, "X5D_Parachute.X5D_ParaC_1", false);
  1908. Commands->Create_3D_Sound_At_Bone("parachute_open", para1, "ROOTTRANSFORM");
  1909. Commands->Attach_Script(para1, "M03_No_More_Parachute", "");
  1910. }
  1911. break;
  1912. case 2:
  1913. if (out >= 2)
  1914. {
  1915. GameObject *para2;
  1916. para2 = Commands->Create_Object("Generic_Cinematic", loc);
  1917. Commands->Set_Facing(para2, facing);
  1918. Commands->Set_Model(para2, "X5D_Parachute");
  1919. Commands->Set_Animation(para2, "X5D_Parachute.X5D_ParaC_2", false);
  1920. Commands->Create_3D_Sound_At_Bone("parachute_open", para2, "ROOTTRANSFORM");
  1921. Commands->Attach_Script(para2, "M03_No_More_Parachute", "");
  1922. }
  1923. break;
  1924. case 3:
  1925. if (out == 3)
  1926. {
  1927. GameObject *para3;
  1928. para3 = Commands->Create_Object("Generic_Cinematic", loc);
  1929. Commands->Set_Facing(para3, facing);
  1930. Commands->Set_Model(para3, "X5D_Parachute");
  1931. Commands->Set_Animation(para3, "X5D_Parachute.X5D_ParaC_3", false);
  1932. Commands->Create_3D_Sound_At_Bone("parachute_open", para3, "ROOTTRANSFORM");
  1933. Commands->Attach_Script(para3, "M03_No_More_Parachute", "");
  1934. }
  1935. break;
  1936. case 4:
  1937. if (!dead)
  1938. {
  1939. GameObject *box1 = Commands->Create_Object("Generic_Cinematic", loc);
  1940. Commands->Set_Model(box1, "X5D_Box01");
  1941. Commands->Set_Facing(box1, facing);
  1942. Commands->Set_Animation(box1, "X5D_Box01.X5D_Box01", false);
  1943. GameObject *soldier1;
  1944. soldier1 = Commands->Create_Object_At_Bone(box1, preset, "Box01");
  1945. Commands->Set_Facing(soldier1, facing);
  1946. Commands->Attach_Script(soldier1, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  1947. Commands->Attach_Script(soldier1, "M09_CheckpointA_Counter", "");
  1948. Commands->Attach_To_Object_Bone( soldier1, box1, "Box01" );
  1949. Commands->Set_Animation(soldier1, "s_a_human.H_A_X5D_ParaT_1", false);
  1950. out++;
  1951. if ((out - 1) == DIFFICULTY)
  1952. {
  1953. dead = true;
  1954. }
  1955. }
  1956. break;
  1957. case 5:
  1958. if (!dead)
  1959. {
  1960. GameObject *box2 = Commands->Create_Object("Generic_Cinematic", loc);
  1961. Commands->Set_Model(box2, "X5D_Box02");
  1962. Commands->Set_Facing(box2, facing);
  1963. Commands->Set_Animation(box2, "X5D_Box02.X5D_Box02", false);
  1964. GameObject *soldier2;
  1965. soldier2 = Commands->Create_Object_At_Bone(box2, preset, "Box02");
  1966. Commands->Set_Facing(soldier2, facing);
  1967. Commands->Attach_Script(soldier2, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  1968. Commands->Attach_Script(soldier2, "M09_CheckpointA_Counter", "");
  1969. Commands->Set_Animation(soldier2, "s_a_human.H_A_X5D_ParaT_2", false);
  1970. Commands->Attach_To_Object_Bone( soldier2, box2, "Box02" );
  1971. out++;
  1972. if ((out - 1) == DIFFICULTY)
  1973. {
  1974. dead = true;
  1975. }
  1976. }
  1977. break;
  1978. case 6:
  1979. if (!dead)
  1980. {
  1981. GameObject *box3 = Commands->Create_Object("Generic_Cinematic", loc);
  1982. Commands->Set_Model(box3, "X5D_Box03");
  1983. Commands->Set_Facing(box3, facing);
  1984. Commands->Set_Animation(box3, "X5D_Box03.X5D_Box03", false);
  1985. GameObject *soldier3;
  1986. soldier3 = Commands->Create_Object_At_Bone(box3, preset, "Box03");
  1987. Commands->Set_Facing(soldier3, facing);
  1988. Commands->Attach_Script(soldier3, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  1989. Commands->Attach_Script(soldier3, "M09_CheckpointA_Counter", "");
  1990. Commands->Set_Animation(soldier3, "s_a_human.H_A_X5D_ParaT_3", false);
  1991. Commands->Attach_To_Object_Bone( soldier3, box3, "Box03" );
  1992. out++;
  1993. if ((out - 1) == DIFFICULTY)
  1994. {
  1995. dead = true;
  1996. }
  1997. }
  1998. break;
  1999. }
  2000. }
  2001. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2002. {
  2003. if (type == 23000 && param == 23000)
  2004. {
  2005. dead = true;
  2006. }
  2007. }
  2008. };
  2009. DECLARE_SCRIPT (M09_First_Mutant_Encounter_Zone, "")
  2010. {
  2011. bool already_entered;
  2012. // Register variables to be Auto-Saved
  2013. // All variables must have a unique ID, less than 256, that never changes
  2014. REGISTER_VARIABLES()
  2015. {
  2016. SAVE_VARIABLE( already_entered, 1 );
  2017. }
  2018. void Created (GameObject * obj)
  2019. {
  2020. already_entered = false;
  2021. }
  2022. void Entered (GameObject * obj, GameObject * enterer)
  2023. {
  2024. if (!already_entered)
  2025. {
  2026. GameObject *mutant1 = Commands->Find_Object (2000280);
  2027. if (mutant1)
  2028. {
  2029. Commands->Attach_Script (mutant1, "M09_First_Mutant_Encounter", "");
  2030. Commands->Start_Timer (obj, this, 1.0f, 100);
  2031. }
  2032. }
  2033. }
  2034. void Timer_Expired(GameObject * obj, int timer_id )
  2035. {
  2036. if (timer_id == 100)
  2037. {
  2038. GameObject *mutant2 = Commands->Find_Object (2000281);
  2039. Commands->Attach_Script (mutant2, "M09_First_Mutant_Encounter", "");
  2040. }
  2041. }
  2042. };
  2043. DECLARE_SCRIPT (M09_First_Mutant_Encounter, "")
  2044. {
  2045. void Created (GameObject *obj)
  2046. {
  2047. Commands->Start_Timer (obj, this, 2.0f, 20);
  2048. }
  2049. void Timer_Expired(GameObject * obj, int timer_id )
  2050. {
  2051. if (timer_id == 20)
  2052. {
  2053. ActionParamsStruct params;
  2054. params.Set_Basic( this, 99, 100);
  2055. params.Set_Animation( "H_A_J26C", false );
  2056. Commands->Action_Play_Animation (obj, params);
  2057. Commands->Start_Timer (obj, this, 2.0f, 20);
  2058. }
  2059. }
  2060. };
  2061. DECLARE_SCRIPT (M09_Immobile, "")
  2062. {
  2063. void Created (GameObject *obj)
  2064. {
  2065. Commands->Innate_Disable ( obj );
  2066. }
  2067. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2068. {
  2069. if (enemy == STAR)
  2070. {
  2071. Commands->Innate_Enable(obj);
  2072. ActionParamsStruct params;
  2073. params.Set_Attack( STAR, 50.0f, 5.0f, true );
  2074. Commands->Action_Attack( obj, params );
  2075. }
  2076. }
  2077. };
  2078. DECLARE_SCRIPT (M09_Mutant, "")
  2079. {
  2080. void Created (GameObject *obj)
  2081. {
  2082. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_MUTANT );
  2083. }
  2084. };
  2085. DECLARE_SCRIPT (M09_Explosion_Zone_Lab01, "")
  2086. {
  2087. bool already_entered;
  2088. // Register variables to be Auto-Saved
  2089. // All variables must have a unique ID, less than 256, that never changes
  2090. REGISTER_VARIABLES()
  2091. {
  2092. SAVE_VARIABLE( already_entered, 1 );
  2093. }
  2094. void Created (GameObject * obj)
  2095. {
  2096. already_entered = false;
  2097. }
  2098. void Entered (GameObject * obj, GameObject * enterer)
  2099. {
  2100. if (!already_entered)
  2101. {
  2102. already_entered = true;
  2103. Commands->Create_Explosion("Ground Explosions Twiddler", Vector3 (-102.560f, 483.462f ,-155.543f));
  2104. Commands->Start_Timer (obj, this, 1.0f, 100);
  2105. }
  2106. }
  2107. void Timer_Expired (GameObject *obj, int timer_id)
  2108. {
  2109. if (timer_id == 100)
  2110. {
  2111. /*Commands->Create_Explosion("Ground Explosions Twiddler", Vector3 (-102.560f, 483.462f ,-155.543f));
  2112. GameObject *blocker;
  2113. blocker = Commands->Create_Object ( "M08_Rubble_Stub", Vector3 (-102.560f, 483.462f ,-155.543f));*/
  2114. }
  2115. }
  2116. };
  2117. DECLARE_SCRIPT (M09_Explosion_Zone_Lab02, "")
  2118. {
  2119. bool already_entered;
  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( already_entered, 1 );
  2125. }
  2126. void Created (GameObject * obj)
  2127. {
  2128. already_entered = false;
  2129. }
  2130. void Entered (GameObject * obj, GameObject * enterer)
  2131. {
  2132. if (!already_entered)
  2133. {
  2134. already_entered = true;
  2135. Commands->Create_Explosion("Ground Explosions Twiddler", Vector3 (-6.151f, 494.846f ,-151.888f));
  2136. GameObject *blocker1;
  2137. blocker1 = Commands->Create_Object ( "M08_Rubble_Stub", Vector3 (-6.151f, 494.846f ,-151.888f));
  2138. Commands->Set_Facing ( blocker1, 60.0f );
  2139. }
  2140. }
  2141. };
  2142. DECLARE_SCRIPT (M09_Explosion_Zone_Tunnel01, "")
  2143. {
  2144. bool already_entered;
  2145. // Register variables to be Auto-Saved
  2146. // All variables must have a unique ID, less than 256, that never changes
  2147. REGISTER_VARIABLES()
  2148. {
  2149. SAVE_VARIABLE( already_entered, 1 );
  2150. }
  2151. void Created (GameObject * obj)
  2152. {
  2153. already_entered = false;
  2154. }
  2155. void Entered (GameObject * obj, GameObject * enterer)
  2156. {
  2157. if (!already_entered)
  2158. {
  2159. already_entered = true;
  2160. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), SPAWN_LOC, INCREMENT, 0.0f);
  2161. Commands->Create_Explosion("Ground Explosions Twiddler", Vector3 (-70.356f, 475.905f ,-63.233f));
  2162. GameObject *blocker1;
  2163. blocker1 = Commands->Create_Object ( "M08_Rubble_Stub", Vector3 (-74.290f, 474.747f, -64.022f));
  2164. Commands->Set_Facing(blocker1, 90.0f);
  2165. }
  2166. }
  2167. };
  2168. DECLARE_SCRIPT (M09_Sam_Counter, "")
  2169. {
  2170. void Killed( GameObject * obj, GameObject * killer )
  2171. {
  2172. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000331), COUNTER, COUNTER, 0.0f);
  2173. }
  2174. };
  2175. DECLARE_SCRIPT (M09_Sam_Controller, "") //2000331
  2176. {
  2177. int count;
  2178. REGISTER_VARIABLES()
  2179. {
  2180. SAVE_VARIABLE( count, 1 );
  2181. }
  2182. void Created (GameObject *obj)
  2183. {
  2184. count = 0;
  2185. }
  2186. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2187. {
  2188. if (type == COUNTER && param == COUNTER)
  2189. {
  2190. count++;
  2191. }
  2192. if (count >= 3)
  2193. {
  2194. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), 906, 1, 0.0f);
  2195. }
  2196. }
  2197. };
  2198. DECLARE_SCRIPT (M09_Unteamed, "")
  2199. {
  2200. void Created (GameObject *obj)
  2201. {
  2202. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_SPECTATOR );
  2203. }
  2204. };
  2205. DECLARE_SCRIPT (M09_Mutant_Excavation_Zone_01, "")
  2206. {
  2207. bool already_entered;
  2208. // Register variables to be Auto-Saved
  2209. // All variables must have a unique ID, less than 256, that never changes
  2210. REGISTER_VARIABLES()
  2211. {
  2212. SAVE_VARIABLE( already_entered, 1 );
  2213. }
  2214. void Created (GameObject * obj)
  2215. {
  2216. already_entered = false;
  2217. }
  2218. void Entered (GameObject * obj, GameObject * enterer)
  2219. {
  2220. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2221. {
  2222. already_entered = true;
  2223. //Mutant soldiers
  2224. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000158), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  2225. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000158), false );
  2226. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000159), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  2227. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000159), false );
  2228. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000160), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  2229. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000160), false );
  2230. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000161), CHANGE_PLAYERTYPE, MUTANT, 0.0f);
  2231. Commands->Set_Innate_Is_Stationary ( Commands->Find_Object (2000161), false );
  2232. //noddities
  2233. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000347), ATTACK, 2000158, 0.0f);
  2234. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000175), ATTACK, 2000159, 0.0f);
  2235. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000346), ATTACK, 2000160, 0.0f);
  2236. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000174), ATTACK, 2000161, 0.0f);
  2237. }
  2238. }
  2239. };
  2240. DECLARE_SCRIPT (M09_Custom_Attack, "")
  2241. {
  2242. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2243. {
  2244. if (type == ATTACK)
  2245. {
  2246. Commands->Set_Innate_Is_Stationary ( obj, false );
  2247. ActionParamsStruct params;
  2248. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  2249. params.Set_Attack(Commands->Find_Object (param), 200.0f, 5.0f, true);
  2250. params.AttackCheckBlocked = false;
  2251. params.AttackActive = true;
  2252. Commands->Action_Attack (obj, params);
  2253. }
  2254. }
  2255. };
  2256. DECLARE_SCRIPT (M09_Flamer_Attack_Zone, "")
  2257. {
  2258. bool already_entered;
  2259. // Register variables to be Auto-Saved
  2260. // All variables must have a unique ID, less than 256, that never changes
  2261. REGISTER_VARIABLES()
  2262. {
  2263. SAVE_VARIABLE( already_entered, 1 );
  2264. }
  2265. void Created (GameObject * obj)
  2266. {
  2267. already_entered = false;
  2268. }
  2269. void Entered (GameObject * obj, GameObject * enterer)
  2270. {
  2271. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2272. {
  2273. already_entered = true;
  2274. //Flamer Customs
  2275. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000185), ATTACK, (Commands->Get_ID (STAR)), 0.0f);
  2276. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000186), ATTACK, (Commands->Get_ID (STAR)), 0.0f);
  2277. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000187), ATTACK, (Commands->Get_ID (STAR)), 0.0f);
  2278. Commands->Send_Custom_Event (obj, Commands->Find_Object (2000188), ATTACK, (Commands->Get_ID (STAR)), 0.0f);
  2279. }
  2280. }
  2281. };
  2282. DECLARE_SCRIPT (M09_Cryo_Mutant_Zone_01, "")
  2283. {
  2284. bool already_entered;
  2285. REGISTER_VARIABLES()
  2286. {
  2287. SAVE_VARIABLE( already_entered, 1 );
  2288. }
  2289. void Created (GameObject *obj)
  2290. {
  2291. already_entered = false;
  2292. }
  2293. void Entered (GameObject * obj, GameObject * enterer)
  2294. {
  2295. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2296. {
  2297. already_entered = true;
  2298. Commands->Start_Timer (obj, this, 1.0f, 1000);
  2299. Commands->Enable_Spawner(2000417, true);
  2300. Commands->Enable_Spawner(2000418, true);
  2301. }
  2302. }
  2303. void Timer_Expired (GameObject *obj, int timer_id)
  2304. {
  2305. if (timer_id == 1000)
  2306. {
  2307. Commands->Enable_Spawner(2000416, true);
  2308. Commands->Enable_Spawner(2000424, true);
  2309. }
  2310. }
  2311. };
  2312. DECLARE_SCRIPT (M09_Mutant_Path_01, "")
  2313. {
  2314. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2315. {
  2316. ActionParamsStruct params;
  2317. params.Set_Basic( this, 99, 101 );
  2318. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  2319. params.WaypathID = 2000425;
  2320. Commands->Action_Goto (obj, params);
  2321. }
  2322. };
  2323. DECLARE_SCRIPT (M09_Mutant_Path_02, "")
  2324. {
  2325. void Created (GameObject *obj)
  2326. {
  2327. ActionParamsStruct params;
  2328. params.Set_Basic( this, 99, 101 );
  2329. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  2330. params.WaypathID = 2000443;
  2331. Commands->Action_Goto (obj, params);
  2332. }
  2333. };
  2334. DECLARE_SCRIPT (M09_Key_Grant, "")
  2335. {
  2336. void Poked(GameObject * obj, GameObject * poker)
  2337. {
  2338. if (poker == STAR)
  2339. {
  2340. GameObject *key1 = Commands->Create_Object ( "Level_01_Keycard", Vector3 (-97.303f, 520.441f, -153.080f) );
  2341. Commands->Attach_Script (key1, "M09_Containment_Key_1", "");
  2342. }
  2343. }
  2344. };
  2345. DECLARE_SCRIPT (M09_Lab_Key_Controller, "") //2000452
  2346. {
  2347. int key_counter;
  2348. REGISTER_VARIABLES()
  2349. {
  2350. SAVE_VARIABLE( key_counter, 1 );
  2351. }
  2352. void Created (GameObject *obj)
  2353. {
  2354. key_counter = 0;
  2355. }
  2356. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2357. {
  2358. if ( type == KEY_COUNTER )
  2359. {
  2360. if (param == INCREMENT)
  2361. {
  2362. key_counter++;
  2363. }
  2364. }
  2365. if (type == CHECK)
  2366. {
  2367. Commands->Send_Custom_Event( obj, sender, COUNT, key_counter, 0.0f );
  2368. }
  2369. }
  2370. };
  2371. DECLARE_SCRIPT (M09_Containment_Key_1, "")
  2372. {
  2373. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2374. {
  2375. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  2376. {
  2377. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), KEY_COUNTER, INCREMENT, 0.0f );
  2378. GameObject *mobius = Commands->Find_Object (2000010);
  2379. ActionParamsStruct params;
  2380. params.Set_Basic( this, 99, MOBIUS_GOTO );
  2381. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000988)), 1.2f, 0.8f );
  2382. Commands->Action_Goto (mobius, params);
  2383. }
  2384. }
  2385. };
  2386. DECLARE_SCRIPT (M09_Containment_Key_2, "")
  2387. {
  2388. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2389. {
  2390. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  2391. {
  2392. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), KEY_COUNTER, INCREMENT, 0.0f );
  2393. GameObject *mobius = Commands->Find_Object (2000010);
  2394. ActionParamsStruct params;
  2395. params.Set_Basic( this, 99, MOBIUS_GOTO );
  2396. params.Set_Movement( Commands->Get_Position (Commands->Find_Object (2000988)), 1.2f, 0.8f );
  2397. Commands->Action_Goto (mobius, params);
  2398. Commands->Destroy_Object (Commands->Find_Object (2000699));
  2399. Commands->Destroy_Object (Commands->Find_Object (2001988));
  2400. Commands->Destroy_Object (Commands->Find_Object (2000457));
  2401. Commands->Destroy_Object (Commands->Find_Object (2000709));
  2402. }
  2403. }
  2404. /*if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  2405. {
  2406. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), KEY_COUNTER, INCREMENT, 0.0f );
  2407. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000709), GOAL, DECREMENT, 0.0f );
  2408. }
  2409. }*/
  2410. };
  2411. DECLARE_SCRIPT (M09_Key_Controller_Zones, "")
  2412. {
  2413. bool already_triggered;
  2414. int key_count;
  2415. // Register variables to be Auto-Saved
  2416. // All variables must have a unique ID, less than 256, that never changes
  2417. REGISTER_VARIABLES()
  2418. {
  2419. SAVE_VARIABLE( already_triggered, 1 );
  2420. SAVE_VARIABLE( key_count, 2);
  2421. }
  2422. void Created (GameObject * obj)
  2423. {
  2424. already_triggered = false;
  2425. }
  2426. void Entered (GameObject * obj, GameObject * enterer)
  2427. {
  2428. if (!already_triggered)
  2429. {
  2430. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), CHECK, 0, 0.0f );
  2431. }
  2432. }
  2433. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2434. {
  2435. if ( type == COUNT )
  2436. {
  2437. key_count = param;
  2438. }
  2439. }
  2440. };
  2441. DECLARE_SCRIPT (M09_Key_Box, "")
  2442. {
  2443. bool poke;
  2444. bool opened;
  2445. REGISTER_VARIABLES()
  2446. {
  2447. SAVE_VARIABLE( poke, 1 );
  2448. SAVE_VARIABLE( opened, 2 );
  2449. }
  2450. void Created (GameObject *obj)
  2451. {
  2452. poke = false;
  2453. opened = false;
  2454. }
  2455. void Poked(GameObject * obj, GameObject * poker)
  2456. {
  2457. if (poke)
  2458. {
  2459. opened = true;
  2460. Commands->Static_Anim_Phys_Goto_Frame ( 1265140, 0, "lab_spn_door08.lab_spn_door08" );
  2461. GameObject *mobius;
  2462. mobius = Commands->Find_Object (2000010);
  2463. const char *conv_name = ("IDS_M09_D18");
  2464. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  2465. Commands->Join_Conversation(mobius, conv_id, false, false);
  2466. Commands->Join_Conversation(STAR, conv_id, false, false);
  2467. Commands->Start_Conversation (conv_id, 999);
  2468. Commands->Monitor_Conversation (obj, conv_id);
  2469. }
  2470. }
  2471. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2472. {
  2473. if (action_id == 999)
  2474. {
  2475. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, 2000860, 0.0f );
  2476. }
  2477. }
  2478. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2479. {
  2480. if ( type == VERIFY )
  2481. {
  2482. if (param == GO)
  2483. {
  2484. poke = true;
  2485. }
  2486. if (param == STOP)
  2487. {
  2488. poke = false;
  2489. if (!opened)
  2490. {
  2491. GameObject *mobius;
  2492. mobius = Commands->Find_Object (2000010);
  2493. const char *conv_name = ("IDS_M09_D19");
  2494. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  2495. Commands->Join_Conversation(mobius, conv_id, false, false);
  2496. Commands->Join_Conversation(STAR, conv_id, false, false);
  2497. Commands->Start_Conversation (conv_id, 900);
  2498. Commands->Monitor_Conversation (obj, conv_id);
  2499. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), WAYPATH, 2000462, 0.0f );
  2500. }
  2501. }
  2502. }
  2503. }
  2504. };
  2505. DECLARE_SCRIPT (M09_MrShuman_Zone, "")
  2506. {
  2507. bool star_in_zone;
  2508. bool fired_off;
  2509. bool key;
  2510. // Register variables to be Auto-Saved
  2511. // All variables must have a unique ID, less than 256, that never changes
  2512. REGISTER_VARIABLES()
  2513. {
  2514. SAVE_VARIABLE( star_in_zone, 1);
  2515. SAVE_VARIABLE( fired_off, 2);
  2516. SAVE_VARIABLE( key, 3);
  2517. }
  2518. void Created (GameObject * obj)
  2519. {
  2520. star_in_zone = false;
  2521. fired_off = false;
  2522. key = false;
  2523. }
  2524. void Timer_Expired(GameObject * obj, int timer_id)
  2525. {
  2526. if (timer_id == DIST_CHECK && star_in_zone)
  2527. {
  2528. float mobius_distance = Commands->Get_Distance(Commands->Get_Position (STAR), Commands->Get_Position (Commands->Find_Object (2000010)));
  2529. if (mobius_distance <= 7.0 && star_in_zone && !fired_off)
  2530. {
  2531. fired_off = true;
  2532. GameObject *shuman = Commands->Find_Object (2000456);
  2533. GameObject *mobius = Commands->Find_Object (2000010);
  2534. Commands->Send_Custom_Event ( obj, shuman, CLARK_KENT, 0);
  2535. if (shuman)
  2536. {
  2537. const char *conv_name = ("IDS_M09_D14");
  2538. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  2539. Commands->Join_Conversation(shuman, conv_id, false, true, true);
  2540. Commands->Join_Conversation(mobius, conv_id, false, true, true);
  2541. Commands->Join_Conversation(STAR, conv_id, false, false);
  2542. Commands->Start_Conversation (conv_id, 954);
  2543. Commands->Monitor_Conversation (obj, conv_id);
  2544. }
  2545. }
  2546. else
  2547. {
  2548. Commands->Start_Timer (obj, this, 2.0f, DIST_CHECK);
  2549. }
  2550. }
  2551. }
  2552. void Exited( GameObject * obj, GameObject * exiter )
  2553. {
  2554. star_in_zone = false;
  2555. }
  2556. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2557. {
  2558. if (type == LOCKBOX)
  2559. {
  2560. key = true;
  2561. }
  2562. }
  2563. void Entered (GameObject * obj, GameObject * enterer)
  2564. {
  2565. star_in_zone = true;
  2566. float mobius_distance = Commands->Get_Distance(Commands->Get_Position (STAR), Commands->Get_Position (Commands->Find_Object (2000010)));
  2567. if (mobius_distance <= 7.0 && star_in_zone && !fired_off)
  2568. {
  2569. fired_off = true;
  2570. GameObject *shuman = Commands->Find_Object (2000456);
  2571. GameObject *mobius = Commands->Find_Object (2000010);
  2572. Commands->Send_Custom_Event ( obj, shuman, CLARK_KENT, 0);
  2573. const char *conv_name = ("IDS_M09_D14");
  2574. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  2575. Commands->Join_Conversation(shuman, conv_id, false, false);
  2576. Commands->Join_Conversation(mobius, conv_id, false, false);
  2577. Commands->Join_Conversation(STAR, conv_id, false, false);
  2578. Commands->Start_Conversation (conv_id, 954);
  2579. Commands->Monitor_Conversation (obj, conv_id);
  2580. }
  2581. else
  2582. {
  2583. Commands->Start_Timer (obj, this, 2.0f, DIST_CHECK);
  2584. }
  2585. }
  2586. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2587. {
  2588. if(action_id == 954)
  2589. {
  2590. /*GameObject *key2 = Commands->Create_Object ( "Level_02_Keycard", Vector3 (-76.473f, 457.493f, -153.807f) );
  2591. Commands->Attach_Script (key2, "M09_Containment_Key_2", "");*/
  2592. GameObject *shuman = Commands->Find_Object (2000456);
  2593. ActionParamsStruct params;
  2594. params.Set_Basic( this, 99, 101 );
  2595. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  2596. params.WaypathID = 1200474;
  2597. Commands->Action_Goto (shuman, params);
  2598. }
  2599. }
  2600. };
  2601. DECLARE_SCRIPT (M09_Invincible_MrShuman, "")
  2602. {
  2603. bool invincible;
  2604. void Created (GameObject *obj)
  2605. {
  2606. invincible = true;
  2607. }
  2608. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  2609. {
  2610. if (type == CLARK_KENT)
  2611. {
  2612. invincible = false;
  2613. }
  2614. }
  2615. void Damaged (GameObject *obj, GameObject *damager, float amount)
  2616. {
  2617. if (invincible)
  2618. {
  2619. Commands->Set_Health (obj, 5.0f);
  2620. }
  2621. }
  2622. };
  2623. DECLARE_SCRIPT (M09_Elevator_Movement_Zone, "Direction:int, Anim_num:int, Elev_obj_num:int")
  2624. {
  2625. void Entered (GameObject * obj, GameObject * enterer)
  2626. {
  2627. char *elevators[9] =
  2628. {
  2629. "l09_res_elev06.l09_res_elev06",
  2630. "elev01.elev01",
  2631. "res_elev04.res_elev04",
  2632. "l09_res_elev05.l09_res_elev05",
  2633. "res_elev11.res_elev11",
  2634. "l09_big_elev.l09_big_elev",
  2635. "l09_big2_elev.l09_big2_elev",
  2636. "cent_elev01.cent_elev01",
  2637. "lab_spn_door08.lab_spn_door08",
  2638. };
  2639. if (enterer == STAR)
  2640. {
  2641. if (Get_Int_Parameter("Direction") == 0)
  2642. {
  2643. Commands->Static_Anim_Phys_Goto_Frame ( Get_Int_Parameter("Elev_obj_num"), 0, elevators [Get_Int_Parameter("Anim_num")] );
  2644. }
  2645. if (Get_Int_Parameter("Direction") == 1)
  2646. {
  2647. Commands->Static_Anim_Phys_Goto_Last_Frame ( Get_Int_Parameter("Elev_obj_num"), elevators [Get_Int_Parameter("Anim_num")] );
  2648. }
  2649. }
  2650. }
  2651. };
  2652. DECLARE_SCRIPT (M09_Elevator_All_Zone, "Controller_num:int")
  2653. {
  2654. bool star_in_zone;
  2655. bool mobius_in_zone;
  2656. GameObject * mobius;
  2657. REGISTER_VARIABLES()
  2658. {
  2659. SAVE_VARIABLE( star_in_zone, 1 );
  2660. SAVE_VARIABLE( mobius_in_zone, 2 );
  2661. }
  2662. void Created (GameObject *obj)
  2663. {
  2664. star_in_zone = false;
  2665. mobius = Commands->Find_Object (2000010);
  2666. }
  2667. void Entered (GameObject * obj, GameObject * enterer)
  2668. {
  2669. if (enterer == STAR)
  2670. {
  2671. star_in_zone = true;
  2672. Commands->Send_Custom_Event(obj, Commands->Find_Object(Get_Int_Parameter("Controller_num")), SET_STAR, ENTER);
  2673. }
  2674. }
  2675. void Exited(GameObject * obj, GameObject * exiter)
  2676. {
  2677. if (exiter == STAR)
  2678. {
  2679. star_in_zone = false;
  2680. Commands->Send_Custom_Event(obj, Commands->Find_Object(Get_Int_Parameter("Controller_num")), SET_STAR, EXIT);
  2681. }
  2682. }
  2683. };
  2684. DECLARE_SCRIPT (M09_Elevator_All_Controller, "Waypoint_num:int, Elev_obj_num:int, Anim_num:int, Direction = 0:int, Mobius_exit_goto:int")
  2685. {
  2686. bool star_in_zone;
  2687. bool mobius_in_zone;
  2688. bool transition;
  2689. int block1, block2, block3, block4;
  2690. GameObject *mobius;
  2691. REGISTER_VARIABLES()
  2692. {
  2693. SAVE_VARIABLE( star_in_zone, 1 );
  2694. SAVE_VARIABLE( mobius_in_zone, 2 );
  2695. SAVE_VARIABLE( transition, 3 );
  2696. SAVE_VARIABLE( block1, 4 );
  2697. SAVE_VARIABLE( block2, 5 );
  2698. SAVE_VARIABLE( block3, 6 );
  2699. SAVE_VARIABLE( block4, 7 );
  2700. }
  2701. void Created (GameObject *obj)
  2702. {
  2703. star_in_zone = false;
  2704. mobius_in_zone = false;
  2705. block1 = block2 = block3 = block4 = 0;
  2706. char *elevators[9] =
  2707. {
  2708. "l09_res_elev06.l09_res_elev06",
  2709. "elev01.elev01",
  2710. "res_elev04.res_elev04",
  2711. "l09_res_elev05.l09_res_elev05",
  2712. "res_elev11.res_elev11",
  2713. "l09_big_elev.l09_big_elev",
  2714. "l09_big2_elev.l09_big2_elev",
  2715. "cent_elev01.cent_elev01",
  2716. "lab_spn_door08.lab_spn_door08",
  2717. };
  2718. mobius = Commands->Find_Object (2000010);
  2719. Commands->Static_Anim_Phys_Goto_Last_Frame ( Get_Int_Parameter("Elev_obj_num"), elevators [Get_Int_Parameter("Anim_num")] );
  2720. }
  2721. void Timer_Expired(GameObject * obj, int timer_id)
  2722. {
  2723. if (timer_id == 333)
  2724. {
  2725. Commands->Destroy_Object (Commands->Find_Object (block1));
  2726. Commands->Destroy_Object (Commands->Find_Object (block2));
  2727. Commands->Destroy_Object (Commands->Find_Object (block3));
  2728. Commands->Destroy_Object (Commands->Find_Object (block4));
  2729. }
  2730. }
  2731. //
  2732. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2733. {
  2734. char *elevators[9] =
  2735. {
  2736. "l09_res_elev06.l09_res_elev06",
  2737. "res_elev01.res_elev01",
  2738. "res_elev04.res_elev04",
  2739. "l09_res_elev05.l09_res_elev05",
  2740. "res_elev11.res_elev11",
  2741. "l09_big_elev.l09_big_elev",
  2742. "l09_big2_elev.l09_big2_elev",
  2743. "cent_elev01.cent_elev01",
  2744. "lab_spn_door08.lab_spn_door08",
  2745. };
  2746. if (type == CHECK_STAR)
  2747. {
  2748. Commands->Send_Custom_Event(obj, sender, STAR_STATUS, star_in_zone);
  2749. }
  2750. if (type == CHECK_MOBIUS)
  2751. {
  2752. Commands->Send_Custom_Event(obj, sender, CHECK_MOBIUS, mobius_in_zone);
  2753. }
  2754. if (type == STAR_STATUS)
  2755. {
  2756. if (!param)
  2757. {
  2758. if (Get_Int_Parameter("Direction") == 0)
  2759. {
  2760. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), ELEVATOR, (Get_Int_Parameter("Waypoint_num")));
  2761. }
  2762. if (Get_Int_Parameter("Direction") == 1)
  2763. {
  2764. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), ELEVATOR_DOWN, (Get_Int_Parameter("Waypoint_num")));
  2765. }
  2766. }
  2767. }
  2768. if (type == SET_MOBIUS)
  2769. {
  2770. mobius_in_zone = true;
  2771. if (star_in_zone)
  2772. {
  2773. if (Get_Int_Parameter("Direction") == 0)
  2774. {
  2775. Commands->Send_Custom_Event( obj, obj, ACTIVATE, 0);
  2776. }
  2777. if (Get_Int_Parameter("Direction") == 1)
  2778. {
  2779. Commands->Send_Custom_Event( obj, obj, ACTIVATEDOWN, 0);
  2780. }
  2781. }
  2782. }
  2783. if (type == SET_STAR)
  2784. {
  2785. if (param == ENTER)
  2786. {
  2787. star_in_zone = true;
  2788. if (((Commands->Get_ID (obj)) != 2000607) && ((Commands->Get_ID (obj)) != 2000599))
  2789. {
  2790. if (Get_Int_Parameter("Direction") == 0)
  2791. {
  2792. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), ELEVATOR, (Get_Int_Parameter("Waypoint_num")));
  2793. }
  2794. if (Get_Int_Parameter("Direction") == 1)
  2795. {
  2796. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), ELEVATOR_DOWN, (Get_Int_Parameter("Waypoint_num")));
  2797. }
  2798. }
  2799. if ((Commands->Get_ID (obj)) == 2000607)
  2800. {
  2801. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000599), CHECK_STAR, 0);
  2802. }
  2803. if ((Commands->Get_ID (obj)) == 2000599)
  2804. {
  2805. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000607), CHECK_STAR, 0);
  2806. }
  2807. }
  2808. if (param == EXIT)
  2809. {
  2810. star_in_zone = false;
  2811. //Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), FOLLOW, Get_Int_Parameter("Mobius_exit_goto"));
  2812. }
  2813. }
  2814. if (type == ACTIVATE)
  2815. {
  2816. if (star_in_zone && mobius_in_zone)
  2817. {
  2818. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), BLOCK_ON, 0, 0.0f);
  2819. /* Commands->Start_Timer (obj, this, 3.0f, 333);
  2820. GameObject *rub1 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-108.916f, 483.904f, -191.022f));
  2821. block1 = Commands->Get_ID (rub1);
  2822. Commands->Set_Is_Rendered( rub1, false );
  2823. GameObject *rub2 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-25.433f, 513.013f, -150.613f));
  2824. block2 = Commands->Get_ID (rub2);
  2825. Commands->Set_Is_Rendered( rub2, false );
  2826. GameObject *rub3 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-47.948f, 535.216f, -103.284f));
  2827. block3 = Commands->Get_ID (rub3);
  2828. Commands->Set_Is_Rendered( rub3, false );
  2829. Commands->Set_Facing (rub3, -90.0);
  2830. GameObject *rub4 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (39.231f, 515.105f, -78.137f));
  2831. block4 = Commands->Get_ID (rub4);
  2832. Commands->Set_Is_Rendered( rub4, false );
  2833. */ Commands->Static_Anim_Phys_Goto_Frame ( Get_Int_Parameter("Elev_obj_num"), 0, elevators [Get_Int_Parameter("Anim_num")] );
  2834. }
  2835. }
  2836. if (type == ACTIVATEDOWN)
  2837. {
  2838. if (star_in_zone && mobius_in_zone)
  2839. {
  2840. Commands->Static_Anim_Phys_Goto_Last_Frame ( Get_Int_Parameter("Elev_obj_num"), elevators [Get_Int_Parameter("Anim_num")] );
  2841. }
  2842. }
  2843. }
  2844. };
  2845. DECLARE_SCRIPT (M09_Block_Off, "")
  2846. {
  2847. void Entered (GameObject *obj, GameObject *enterer)
  2848. {
  2849. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000071), BLOCK_OFF, 0, 0.0f);
  2850. }
  2851. };
  2852. DECLARE_SCRIPT (M09_Mutant_Attack, "Target_num:int")
  2853. {
  2854. int target;
  2855. void Created (GameObject *obj)
  2856. {
  2857. target = Get_Int_Parameter ("Target_num");
  2858. }
  2859. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2860. {
  2861. target = Get_Int_Parameter ("Target_num");
  2862. ActionParamsStruct params;
  2863. if ( sound.Type == M09_INNATE_ENABLE )
  2864. {
  2865. Vector3 loc = Commands->Get_Position (Commands->Find_Object (target));
  2866. Commands->Set_Innate_Aggressiveness ( obj, 100.0f );
  2867. Commands->Set_Innate_Take_Cover_Probability ( obj, 100.0 );
  2868. ActionParamsStruct params;
  2869. params.Set_Basic( this, 99, RUN_TO_TARGET );
  2870. params.Set_Movement( loc, 1.2f, 0.75f);
  2871. Commands->Action_Goto (obj, params);
  2872. }
  2873. }
  2874. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2875. {
  2876. float face = Commands->Get_Facing (Commands->Find_Object (target));
  2877. if (action_id == RUN_TO_TARGET)
  2878. {
  2879. Commands->Set_Facing (obj, face);
  2880. ActionParamsStruct params;
  2881. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ATTACKING );
  2882. params.Set_Attack (Commands->Find_Object (2000626), 3.0f, 0.0f, 1);
  2883. Commands->Action_Attack( obj, params );
  2884. }
  2885. }
  2886. };
  2887. DECLARE_SCRIPT (M09_Waypath_Run, "Waypath_num:int, Attacker_num:int, Controller_num:int")
  2888. {
  2889. int mutant_id;
  2890. int attackee_id;
  2891. REGISTER_VARIABLES()
  2892. {
  2893. SAVE_VARIABLE( mutant_id, 1 );
  2894. SAVE_VARIABLE( attackee_id, 2 );
  2895. }
  2896. void Created (GameObject *obj)
  2897. {
  2898. Commands->Innate_Disable(obj);
  2899. attackee_id = Commands->Get_ID(obj);
  2900. Commands->Send_Custom_Event(obj, Commands->Find_Object (Get_Int_Parameter("Controller_num")), MUTANT_ATTACKEE, attackee_id);
  2901. Commands->Start_Timer (obj, this, 1.0f, START);
  2902. if (Get_Int_Parameter("Waypath_num") != 0)
  2903. {
  2904. ActionParamsStruct params;
  2905. params.Set_Basic( this, 99, RUN_TO_TARGET );
  2906. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  2907. params.WaypathID = Get_Int_Parameter("Waypath_num");
  2908. Commands->Action_Goto (obj, params);
  2909. }
  2910. }
  2911. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2912. {
  2913. Commands->Action_Reset ( obj, 100 );
  2914. ActionParamsStruct params;
  2915. params.Set_Basic( this, 100, ANIMATION );
  2916. params.Set_Animation ("h_a_891a", false);
  2917. Commands->Action_Play_Animation (obj, params);
  2918. }
  2919. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2920. {
  2921. if (action_id == ANIMATION)
  2922. {
  2923. if (Get_Int_Parameter("Waypath_num") != 0)
  2924. {
  2925. Commands->Action_Reset ( obj, 100 );
  2926. ActionParamsStruct params;
  2927. params.Set_Basic( this, 99, RUN_TO_TARGET );
  2928. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f);
  2929. params.WaypathID = Get_Int_Parameter("Waypath_num");
  2930. Commands->Action_Goto ( obj, params );
  2931. }
  2932. }
  2933. }
  2934. void Killed(GameObject * obj, GameObject *killer )
  2935. {
  2936. Commands->Send_Custom_Event(obj, (Commands->Find_Object (mutant_id)), ATTACK_STAR, 0);
  2937. }
  2938. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2939. {
  2940. if (type == ATTACKER_CHECK)
  2941. {
  2942. mutant_id = param;
  2943. }
  2944. if (type == DEAD_MUTANT)
  2945. {
  2946. Commands->Action_Reset ( obj, 100 );
  2947. }
  2948. }
  2949. void Timer_Expired(GameObject * obj, int timer_id )
  2950. {
  2951. if(timer_id == START)
  2952. {
  2953. Commands->Send_Custom_Event(obj, Commands->Find_Object (Get_Int_Parameter("Controller_num")), ATTACKER_CHECK, 0);
  2954. }
  2955. }
  2956. };
  2957. DECLARE_SCRIPT (M09_Mutant_Encounter_Controller, "")
  2958. {
  2959. int mutant_id;
  2960. int attackee_id;
  2961. REGISTER_VARIABLES()
  2962. {
  2963. SAVE_VARIABLE( mutant_id, 1 );
  2964. SAVE_VARIABLE( attackee_id, 2 );
  2965. }
  2966. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2967. {
  2968. if (type == MUTANT_ATTACKER)
  2969. {
  2970. mutant_id = param;
  2971. }
  2972. if (type == MUTANT_ATTACKEE)
  2973. {
  2974. attackee_id = param;
  2975. }
  2976. if (type == ATTACKER_CHECK)
  2977. {
  2978. Commands->Send_Custom_Event(obj, sender, ATTACKER_CHECK, mutant_id);
  2979. }
  2980. if (type == ATTACKEE_CHECK)
  2981. {
  2982. Commands->Send_Custom_Event(obj, sender, ATTACKEE_CHECK, attackee_id);
  2983. }
  2984. }
  2985. };
  2986. DECLARE_SCRIPT (M09_Damage_Modifier, "Damage_multiplier:float")
  2987. {
  2988. float current_health, last_health, damage_tally;
  2989. REGISTER_VARIABLES()
  2990. {
  2991. SAVE_VARIABLE( current_health, 1 );
  2992. SAVE_VARIABLE( last_health, 2 );
  2993. SAVE_VARIABLE( damage_tally, 3 );
  2994. }
  2995. void Created (GameObject *obj)
  2996. {
  2997. last_health = Commands->Get_Health (obj);
  2998. damage_tally = 0;
  2999. }
  3000. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3001. {
  3002. float damage;
  3003. if (damager == STAR)
  3004. {
  3005. last_health = Commands->Get_Health (obj);
  3006. }
  3007. if (damager != STAR)
  3008. {
  3009. current_health = Commands->Get_Health (obj);
  3010. if (current_health == 0)
  3011. {
  3012. damage = ((last_health - current_health) + damage_tally);
  3013. damage_tally = 0;
  3014. }
  3015. else
  3016. {
  3017. damage = (last_health - current_health);
  3018. damage_tally = 0;
  3019. }
  3020. float mod_damage = (damage * (Get_Float_Parameter("Damage_multiplier")));
  3021. damage_tally += mod_damage;
  3022. Commands->Set_Health (obj, (last_health - mod_damage));
  3023. last_health = Commands->Get_Health (obj);
  3024. current_health = Commands->Get_Health (obj);
  3025. }
  3026. }
  3027. };
  3028. DECLARE_SCRIPT (M09_Zone_Enabled_Mobius, "Waypath_id:int, Condition=0:int")
  3029. {
  3030. bool already_entered;
  3031. int goal;
  3032. // Register variables to be Auto-Saved
  3033. // All variables must have a unique ID, less than 256, that never changes
  3034. REGISTER_VARIABLES()
  3035. {
  3036. SAVE_VARIABLE( already_entered, 1 );
  3037. SAVE_VARIABLE( goal, 2 );
  3038. }
  3039. void Created (GameObject * obj)
  3040. {
  3041. already_entered = false;
  3042. goal = Get_Int_Parameter("Condition");
  3043. }
  3044. void Entered (GameObject * obj, GameObject * enterer)
  3045. {
  3046. if (goal <= 0)
  3047. {
  3048. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, Get_Int_Parameter("Waypath_id"), 0.0f );
  3049. goal = 1;
  3050. }
  3051. }
  3052. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3053. {
  3054. if (type == GOAL)
  3055. {
  3056. if (param == INCREMENT)
  3057. {
  3058. goal++;
  3059. }
  3060. if (param == DECREMENT)
  3061. {
  3062. goal--;
  3063. }
  3064. }
  3065. }
  3066. };
  3067. DECLARE_SCRIPT (M09_No_Obj_Damage, "")
  3068. {
  3069. float curr_health;
  3070. REGISTER_VARIABLES()
  3071. {
  3072. SAVE_VARIABLE( curr_health, 1 );
  3073. }
  3074. void Created (GameObject *obj)
  3075. {
  3076. curr_health = Commands->Get_Health (obj);
  3077. }
  3078. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3079. {
  3080. Commands->Set_Health (obj, curr_health);
  3081. }
  3082. };
  3083. DECLARE_SCRIPT (M09_Flyover_Controller, "")
  3084. {
  3085. int last;
  3086. REGISTER_VARIABLES()
  3087. {
  3088. SAVE_VARIABLE( last, 1 );
  3089. }
  3090. void Created (GameObject *obj)
  3091. {
  3092. last = 0;
  3093. }
  3094. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3095. {
  3096. if (type == FLYOVER)
  3097. {
  3098. char *flyovers[8] =
  3099. {
  3100. "X9A_Apache_00.txt",
  3101. "X9A_Apache_01.txt",
  3102. "X9A_Apache_02.txt",
  3103. "X9A_Apache_03.txt",
  3104. "X9A_Trnspt_00.txt",
  3105. "X9A_Trnspt_01.txt",
  3106. "X9A_Trnspt_02.txt",
  3107. "X9A_Trnspt_03.txt",
  3108. };
  3109. int random = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3110. while (random == last) {
  3111. random = int(Commands->Get_Random(0, 8-WWMATH_EPSILON));
  3112. }
  3113. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3114. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  3115. last = random;
  3116. }
  3117. }
  3118. };
  3119. DECLARE_SCRIPT (M09_Flyover_Recycle, "")
  3120. {
  3121. void Destroyed(GameObject * obj)
  3122. {
  3123. Commands->Send_Custom_Event (obj, Commands->Find_Object(2000955), FLYOVER, 0, 0.0f);
  3124. }
  3125. };
  3126. DECLARE_SCRIPT (M09_Weather_On, "")
  3127. {
  3128. void Entered (GameObject * obj, GameObject * enterer)
  3129. {
  3130. Commands->Set_Fog_Enable ( true );
  3131. Commands->Set_Fog_Range (0.0, 150.0, 2.0);
  3132. Commands->Set_Lightning (0.25f, 0.0f, 0.2f, 265.0f, 0.3f, 2.0f);
  3133. Commands->Set_Rain ( 10.0, 2.0, false);
  3134. }
  3135. };
  3136. DECLARE_SCRIPT (M09_Weather_Off, "")
  3137. {
  3138. void Entered (GameObject * obj, GameObject * enterer)
  3139. {
  3140. //Commands->Set_Fog_Enable ( false );
  3141. Commands->Set_Fog_Range (0.0, 1000.0, 2.0);
  3142. Commands->Set_Lightning (0.0f, 0.0f, 0.2f, 265.0f, 0.3f, 2.0f);
  3143. Commands->Set_Rain ( 0.0, 2.0, false);
  3144. }
  3145. };
  3146. DECLARE_SCRIPT(M09_Evac_Transport, "") //2000969
  3147. {
  3148. bool already_entered;
  3149. float facing;
  3150. // Register variables to be Auto-Saved
  3151. // All variables must have a unique ID, less than 256, that never changes
  3152. REGISTER_VARIABLES()
  3153. {
  3154. SAVE_VARIABLE( already_entered, 1 );
  3155. SAVE_VARIABLE( facing, 2 );
  3156. }
  3157. void Created (GameObject * obj)
  3158. {
  3159. already_entered = false;
  3160. facing = 0.0f;
  3161. }
  3162. void Entered (GameObject * obj, GameObject * enterer)
  3163. {
  3164. if (!already_entered)
  3165. {
  3166. already_entered = true;
  3167. facing = Commands->Get_Facing (Commands->Find_Object (2000969));
  3168. Vector3 loc = Commands->Get_Position (Commands->Find_Object (2000969));
  3169. GameObject * bone = Commands->Create_Object ( "Invisible_Object", loc );
  3170. Commands->Set_Facing(bone, facing);
  3171. Commands->Attach_Script(bone, "M09_Evac_Bone", "");
  3172. Commands->Set_Model ( bone, "XG_TransprtBone" );
  3173. Commands->Set_Animation ( bone, "XG_TransprtBone.XG_EV2_PathA", false );
  3174. GameObject * chinook = Commands->Create_Object_At_Bone( bone, "GDI_Transport_Helicopter", "XG_TransprtBone" );
  3175. GameObject * troop = Commands->Create_Object_At_Bone( bone, "GDI_RocketSoldier_2SF", "SPAWNER" );
  3176. Commands->Attach_Script(troop, "M00_Damage_Modifier_DME", "0.05f, 1, 1, 0, 0");
  3177. char param1[10];
  3178. sprintf(param1, "%d", Commands->Get_ID(troop));
  3179. Commands->Set_Facing(chinook, facing);
  3180. Commands->Attach_Script(chinook, "M09_Evac_Helicopter", param1);
  3181. Commands->Attach_To_Object_Bone ( chinook, bone, "BN_Trajectory" );
  3182. Commands->Set_Animation ( chinook, "v_GDI_trnspt.XG_EV2_trnsA", false );
  3183. Commands->Attach_Script(troop, "M09_Gunner", "");
  3184. Commands->Attach_Script(chinook, "M09_No_Obj_Damage", "");
  3185. Commands->Attach_To_Object_Bone ( troop, chinook, "SPAWNER" );
  3186. //Commands->Set_Facing(troop, facing - 180.0);
  3187. }
  3188. }
  3189. };
  3190. DECLARE_SCRIPT(M09_Evac_Bone, "")
  3191. {
  3192. void Animation_Complete(GameObject * obj, const char *anim)
  3193. {
  3194. if (stricmp(anim, "XG_TransprtBone.XG_EV2_PathA") == 0)
  3195. {
  3196. Commands->Set_Animation ( obj, "XG_TransprtBone.XG_EV2_Pathloop", true );
  3197. }
  3198. }
  3199. };
  3200. DECLARE_SCRIPT(M09_Evac_Helicopter, "Gunner:int")
  3201. {
  3202. void Animation_Complete(GameObject * obj, const char *anim)
  3203. {
  3204. if (stricmp(anim, "v_GDI_trnspt.XG_EV2_trnsA") == 0)
  3205. {
  3206. int gunner_id = Get_Int_Parameter("Gunner");
  3207. Commands->Disable_Physical_Collisions ( obj );
  3208. Commands->Start_Timer (obj, this, 3.0f, COLLISION);
  3209. Commands->Send_Custom_Event (obj, Commands->Find_Object(gunner_id), GO, 0, 0.0f);
  3210. Commands->Set_Animation ( obj, "v_GDI_trnspt.XG_EV2_trnsloop", true );
  3211. }
  3212. }
  3213. void Killed(GameObject * obj, GameObject * killer)
  3214. {
  3215. Commands->Mission_Complete(false);
  3216. }
  3217. void Timer_Expired (GameObject* obj, int timer_id)
  3218. {
  3219. if (timer_id == COLLISION)
  3220. {
  3221. Commands->Enable_Collisions ( obj );
  3222. }
  3223. }
  3224. };
  3225. DECLARE_SCRIPT(M09_Gunner, "")
  3226. {
  3227. float full_health;
  3228. void Created ( GameObject *obj)
  3229. {
  3230. full_health = Commands->Get_Health (obj);
  3231. }
  3232. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3233. {
  3234. if (type == GO)
  3235. {
  3236. Commands->Attach_To_Object_Bone( obj, NULL, NULL );
  3237. //Commands->Enable_Collisions ( obj );
  3238. ActionParamsStruct params;
  3239. params.Set_Basic( this, 99, 101 );
  3240. params.Set_Movement( Commands->Find_Object (2000970), RUN, 1.5f);
  3241. Commands->Action_Goto (obj, params);
  3242. //Commands->Set_Innate_Aggressiveness ( obj, 1.0f );
  3243. }
  3244. }
  3245. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3246. {
  3247. ActionParamsStruct params;
  3248. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN +5, 10 );
  3249. params.Set_Attack(enemy, 100.0f, 5.0f, true);
  3250. params.AttackCheckBlocked = true;
  3251. params.AttackActive = true;
  3252. Commands->Modify_Action(obj, 10, params);
  3253. }
  3254. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3255. {
  3256. Commands->Set_Health (obj, full_health);
  3257. }
  3258. };
  3259. DECLARE_SCRIPT(M09_Mobius_Goto, "GotoObject:int")
  3260. {
  3261. void Entered (GameObject *obj, GameObject *enterer)
  3262. {
  3263. GameObject * mobius = Commands->Find_Object (2000010);
  3264. Commands->Send_Custom_Event( obj, mobius, FOLLOW, Get_Int_Parameter("GotoObject"), 0.0f );
  3265. }
  3266. };
  3267. DECLARE_SCRIPT(M09_Innate_Disable, "")
  3268. {
  3269. float current_health, last_health, damage_tally;
  3270. //GameObject * mobius;
  3271. REGISTER_VARIABLES()
  3272. {
  3273. SAVE_VARIABLE( current_health, 1 );
  3274. SAVE_VARIABLE( last_health, 2 );
  3275. SAVE_VARIABLE( damage_tally, 3 );
  3276. }
  3277. void Created (GameObject *obj)
  3278. {
  3279. Commands->Innate_Disable(obj);
  3280. //GameObject * mobius = Commands->Find_Object (2000010);
  3281. last_health = Commands->Get_Health (obj);
  3282. damage_tally = 0;
  3283. }
  3284. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  3285. {
  3286. ActionParamsStruct params;
  3287. if ( sound.Type == M09_INNATE_ENABLE )
  3288. {
  3289. Commands->Innate_Enable(obj);
  3290. Commands->Set_Innate_Aggressiveness ( obj, 100.0f );
  3291. //Commands->Innate_Force_State_Gunshots_Heard ( obj, Commands->Get_Position (obj) );
  3292. Vector3 projector = Commands->Get_Position (obj);
  3293. }
  3294. }
  3295. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3296. {
  3297. if (type == M09_INNATE_ENABLE )
  3298. {
  3299. Commands->Innate_Enable(obj);
  3300. Commands->Set_Innate_Aggressiveness ( obj, 100.0f );
  3301. //Commands->Innate_Force_State_Gunshots_Heard ( obj, Commands->Get_Position (obj) );
  3302. }
  3303. }
  3304. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3305. {
  3306. GameObject * mobius = Commands->Find_Object (2000010);
  3307. if (damager == STAR || damager == mobius)
  3308. {
  3309. last_health = Commands->Get_Health (obj);
  3310. }
  3311. if (damager != STAR && damager != mobius)
  3312. {
  3313. current_health = Commands->Get_Health (obj);
  3314. float damage = ((last_health - current_health) + damage_tally);
  3315. float mod_damage = (damage * 0.05f);
  3316. damage_tally += mod_damage;
  3317. Commands->Set_Health (obj, (last_health - mod_damage));
  3318. last_health = Commands->Get_Health (obj);
  3319. current_health = Commands->Get_Health (obj);
  3320. }
  3321. }
  3322. };
  3323. DECLARE_SCRIPT(M09_Innate_Enable_Zone, "SoundProjector:int, Radius=7.0:float, Total_Enemies:int")
  3324. {
  3325. bool already_entered, all_checked_in;
  3326. int enemies;
  3327. // Register variables to be Auto-Saved
  3328. // All variables must have a unique ID, less than 256, that never changes
  3329. REGISTER_VARIABLES()
  3330. {
  3331. SAVE_VARIABLE( already_entered, 1 );
  3332. }
  3333. void Created (GameObject * obj)
  3334. {
  3335. already_entered = false;
  3336. enemies = 0;
  3337. }
  3338. /*void Sound_Heard(GameObject* obj, const CombatSound & sound)
  3339. {
  3340. if ( sound.Type == M09_CHECK_IN )
  3341. {
  3342. enemies++;
  3343. if (enemies == Get_Int_Parameter ("Total_Enemies"))
  3344. {
  3345. all_checked_in = true;
  3346. }
  3347. }
  3348. }*/
  3349. void Timer_Expired (GameObject* obj, int timer_id)
  3350. {
  3351. if (timer_id == INNATE_RECYCLE && !all_checked_in)
  3352. {
  3353. Vector3 projector = Commands->Get_Position (Commands->Find_Object (Get_Int_Parameter ("SoundProjector")));
  3354. float rad = Get_Float_Parameter("Radius");
  3355. Commands->Create_Logical_Sound (obj, M09_INNATE_ENABLE, projector, rad);
  3356. //Commands->Start_Timer (obj, this, 4.0f, INNATE_RECYCLE);
  3357. }
  3358. }
  3359. void Entered (GameObject * obj, GameObject * enterer)
  3360. {
  3361. if (!already_entered)
  3362. {
  3363. already_entered = true;
  3364. Vector3 projector = Commands->Get_Position (Commands->Find_Object (Get_Int_Parameter ("SoundProjector")));
  3365. float rad = Get_Float_Parameter("Radius");
  3366. Commands->Create_Logical_Sound (obj, M09_INNATE_ENABLE, projector, rad);
  3367. Commands->Start_Timer (obj, this, 4.0f, INNATE_RECYCLE);
  3368. }
  3369. }
  3370. };
  3371. DECLARE_SCRIPT(M09_Zone_Destroy, "")
  3372. {
  3373. void Entered (GameObject *obj, GameObject *enterer)
  3374. {
  3375. Commands->Destroy_Object(obj);
  3376. }
  3377. };
  3378. DECLARE_SCRIPT (M09_Lab_Powerup, "Target:int")
  3379. {
  3380. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3381. {
  3382. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  3383. {
  3384. Commands->Grant_Key (Commands->Find_Object (Get_Int_Parameter("Target")), 10, true);
  3385. Commands->Debug_Message("Key granted to %d.\n", Get_Int_Parameter("Target"));
  3386. //Commands->Send_Custom_Event (obj, Commands->Find_Object (Get_Int_Parameter("Target")), 0, 0);
  3387. Commands->Action_Reset ( Commands->Find_Object (Get_Int_Parameter("Target")), 100 );
  3388. Commands->Attach_Script( Commands->Find_Object (Get_Int_Parameter("Target")), "M03_Goto_Star", "");
  3389. }
  3390. }
  3391. };
  3392. DECLARE_SCRIPT (M09_Ambient_Clutter, "")
  3393. {
  3394. int alarm;
  3395. Vector3 sound_loc;
  3396. REGISTER_VARIABLES()
  3397. {
  3398. SAVE_VARIABLE( alarm, 1 );
  3399. SAVE_VARIABLE( sound_loc, 2 );
  3400. }
  3401. void Created (GameObject *obj)
  3402. {
  3403. float delayTimer = Commands->Get_Random ( 1, 5 );
  3404. /*int chooser = Commands->Get_Random_Int (0, 7);
  3405. float rand_dist = Commands->Get_Random ( 15, 20 );
  3406. sound_loc = Commands->Get_Position (STAR);
  3407. sound_loc.X += rand_dist;
  3408. sound_loc.Y += rand_dist;
  3409. sound_loc.Z += rand_dist;
  3410. //Commands->Create_Sound ( ambients [chooser], sound_loc, obj );*/
  3411. Commands->Start_Timer(obj, this, (20.0f - delayTimer), AMB_SOUND);
  3412. Commands->Start_Timer(obj, this, (8.0f + delayTimer), AMB_EXPLOSION);
  3413. }
  3414. void Timer_Expired (GameObject* obj, int timer_id)
  3415. {
  3416. if (timer_id == AMB_SOUND)
  3417. {
  3418. char *ambients[7] =
  3419. {
  3420. "Ambient_Screams_03",
  3421. "Ambient_Screams_04",
  3422. "Explosion_Glass_02",
  3423. "Explosion_Glass_03",
  3424. "Explosion_Large_01",
  3425. "Vehicle_Explo_Med2",
  3426. "Vehicle_Explo_Med1",
  3427. };
  3428. int chooser = Commands->Get_Random_Int (0, 7);
  3429. float delayTimer = Commands->Get_Random ( 1, 5 );
  3430. float rand_dist = Commands->Get_Random ( 15, 30 );
  3431. sound_loc = Commands->Get_Position (STAR);
  3432. sound_loc.X += rand_dist;
  3433. sound_loc.Y += rand_dist;
  3434. sound_loc.Z += rand_dist;
  3435. Commands->Create_Sound ( ambients [chooser], sound_loc, obj );
  3436. Commands->Start_Timer(obj, this, (20.0f - delayTimer), AMB_SOUND);
  3437. }
  3438. if (timer_id == AMB_EXPLOSION)
  3439. {
  3440. int exp_point [5];
  3441. exp_point [0] = 2006120;
  3442. exp_point [1] = 2006121;
  3443. exp_point [2] = 2006122;
  3444. exp_point [3] = 2006123;
  3445. exp_point [4] = 2006124;
  3446. int exp_num = Commands->Get_Random_Int (0, 5);
  3447. Commands->Create_Explosion("Air Explosions Twiddler", Commands->Get_Position (Commands->Find_Object (exp_point [exp_num])));
  3448. float delayTimer = Commands->Get_Random ( 1, 5 );
  3449. Commands->Start_Timer(obj, this, (8.0f + delayTimer), AMB_EXPLOSION);
  3450. }
  3451. }
  3452. };
  3453. DECLARE_SCRIPT (M09_Scientist_Cower, "")
  3454. {
  3455. void Created (GameObject *obj)
  3456. {
  3457. float delay = Commands->Get_Random ( 1, 3 );
  3458. Commands->Start_Timer(obj, this, (delay), ANIM_DELAY);
  3459. }
  3460. void Timer_Expired (GameObject* obj, int timer_id)
  3461. {
  3462. if (timer_id == ANIM_DELAY)
  3463. {
  3464. ActionParamsStruct params;
  3465. params.Set_Basic( this, 99, DOING_ANIMATION );
  3466. params.Set_Animation ("S_A_HUMAN.H_A_A0A0_L51", true);
  3467. Commands->Action_Play_Animation (obj, params);
  3468. }
  3469. }
  3470. };
  3471. DECLARE_SCRIPT (M09_Destroy_Self_Zone, "")
  3472. {
  3473. bool already_entered;
  3474. // Register variables to be Auto-Saved
  3475. // All variables must have a unique ID, less than 256, that never changes
  3476. REGISTER_VARIABLES()
  3477. {
  3478. SAVE_VARIABLE( already_entered, 1 );
  3479. }
  3480. void Created (GameObject * obj)
  3481. {
  3482. already_entered = false;
  3483. }
  3484. void Entered (GameObject * obj, GameObject * enterer)
  3485. {
  3486. GameObject *mobius = Commands->Find_Object (2000010);
  3487. if (!already_entered)
  3488. {
  3489. already_entered = true;
  3490. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), NO_FOLLOW, ON);
  3491. const char *conv_name = ("IDS_M09_D13");
  3492. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3493. Commands->Join_Conversation(NULL, conv_id, false, false);
  3494. Commands->Join_Conversation(mobius, conv_id, false, false);
  3495. Commands->Join_Conversation(STAR, conv_id, false, false);
  3496. Commands->Start_Conversation (conv_id, 900);
  3497. Commands->Monitor_Conversation (obj, conv_id);
  3498. }
  3499. }
  3500. };
  3501. DECLARE_SCRIPT (M09_KeyCard_Zone, "")
  3502. {
  3503. bool initiation;
  3504. GameObject *mobius;
  3505. float mobius_distance;
  3506. bool star_in_zone;
  3507. bool fired_off;
  3508. REGISTER_VARIABLES()
  3509. {
  3510. SAVE_VARIABLE( initiation, 1 );
  3511. SAVE_VARIABLE( mobius_distance, 2 );
  3512. SAVE_VARIABLE( star_in_zone, 3 );
  3513. SAVE_VARIABLE( fired_off, 4 );
  3514. }
  3515. void Created (GameObject *obj)
  3516. {
  3517. star_in_zone = false;
  3518. fired_off = false;
  3519. initiation = false;
  3520. mobius = Commands->Find_Object (2000010);
  3521. }
  3522. void Timer_Expired(GameObject * obj, int timer_id)
  3523. {
  3524. if (timer_id == DIST_CHECK && star_in_zone)
  3525. {
  3526. if (mobius_distance <= 15.0/* && !fired_off*/)
  3527. {
  3528. //fired_off = true;
  3529. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), CHECK, 0, 0.0f );
  3530. }
  3531. else
  3532. {
  3533. Commands->Start_Timer (obj, this, 2.0f, DIST_CHECK);
  3534. }
  3535. }
  3536. }
  3537. void Entered (GameObject * obj, GameObject * enterer)
  3538. {
  3539. star_in_zone = true;
  3540. mobius = Commands->Find_Object (2000010);
  3541. mobius_distance = Commands->Get_Distance(Commands->Get_Position (STAR), Commands->Get_Position (mobius));
  3542. if (mobius_distance <= 15.0/* && !fired_off*/)
  3543. {
  3544. //fired_off = true;
  3545. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), CHECK, 0, 0.0f );
  3546. }
  3547. else
  3548. {
  3549. Commands->Start_Timer (obj, this, 2.0f, DIST_CHECK);
  3550. }
  3551. }
  3552. void Exited( GameObject * obj, GameObject * exiter )
  3553. {
  3554. star_in_zone = false;
  3555. }
  3556. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3557. {
  3558. if (type == INITIATION)
  3559. {
  3560. //initiation = true;
  3561. }
  3562. if ( type == COUNT )
  3563. {
  3564. if (param == 0)
  3565. {
  3566. //initiation = true;
  3567. /*const char *conv_name = ("IDS_M09_D13");
  3568. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3569. Commands->Join_Conversation(NULL, conv_id, false, false);
  3570. Commands->Join_Conversation(mobius, conv_id, false, false);
  3571. Commands->Join_Conversation(STAR, conv_id, false, false);
  3572. Commands->Start_Conversation (conv_id, 900);
  3573. Commands->Monitor_Conversation (obj, conv_id);*/
  3574. }
  3575. if (param == 1)
  3576. {
  3577. //initiation = true;
  3578. const char *conv_name = ("IDS_M09_D15");
  3579. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3580. Commands->Join_Conversation(mobius, conv_id, false, false);
  3581. Commands->Join_Conversation(STAR, conv_id, false, false);
  3582. Commands->Start_Conversation (conv_id, 905);
  3583. Commands->Monitor_Conversation (obj, conv_id);
  3584. }
  3585. if (param == 2)
  3586. {
  3587. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000452), KEY_COUNTER, INCREMENT, 0.0f );
  3588. Commands->Static_Anim_Phys_Goto_Frame ( 1265140, 0, "lab_spn_door08.lab_spn_door08" );
  3589. const char *conv_name = ("IDS_M09_D18");
  3590. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3591. Commands->Join_Conversation(mobius, conv_id, false, false);
  3592. Commands->Join_Conversation(STAR, conv_id, false, false);
  3593. Commands->Start_Conversation (conv_id, 910);
  3594. Commands->Monitor_Conversation (obj, conv_id);
  3595. }
  3596. }
  3597. }
  3598. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3599. {
  3600. mobius = Commands->Find_Object (2000010);
  3601. if(action_id == 900)
  3602. {
  3603. const char *conv_name = ("IDS_M09_D13");
  3604. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3605. Commands->Join_Conversation(mobius, conv_id, false, false);
  3606. Commands->Join_Conversation(STAR, conv_id, false, false);
  3607. Commands->Start_Conversation (conv_id, 950);
  3608. Commands->Monitor_Conversation (obj, conv_id);
  3609. //Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, 0, 0.0f );
  3610. }
  3611. if(action_id == 906)
  3612. {
  3613. const char *conv_name = ("IDS_M09_D13");
  3614. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3615. Commands->Join_Conversation(mobius, conv_id, false, false);
  3616. Commands->Join_Conversation(STAR, conv_id, false, false);
  3617. Commands->Start_Conversation (conv_id, 908);
  3618. Commands->Monitor_Conversation (obj, conv_id);
  3619. //Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, 0, 0.0f );
  3620. }
  3621. if(action_id == 907)
  3622. {
  3623. const char *conv_name = ("IDS_M09_D15");
  3624. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3625. Commands->Join_Conversation(mobius, conv_id, false, false);
  3626. Commands->Join_Conversation(STAR, conv_id, false, false);
  3627. Commands->Start_Conversation (conv_id, 909);
  3628. Commands->Monitor_Conversation (obj, conv_id);
  3629. //Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), FOLLOW, 0, 0.0f );
  3630. }
  3631. if(action_id == 908)
  3632. {
  3633. const char *conv_name = ("IDS_M09_D16");
  3634. int conv_id = Commands->Create_Conversation (conv_name, 99, 200, false);
  3635. Commands->Join_Conversation(mobius, conv_id, false, false);
  3636. Commands->Join_Conversation(STAR, conv_id, false, false);
  3637. Commands->Start_Conversation (conv_id, 910);
  3638. Commands->Monitor_Conversation (obj, conv_id);
  3639. }
  3640. /*if(action_id == 910)
  3641. {
  3642. Commands->Send_Custom_Event( obj, Commands->Find_Object (2000010), WAYPATH, 2000462, 0.0f );
  3643. }*/
  3644. }
  3645. };
  3646. DECLARE_SCRIPT (M09_Innate_Activate, "Target0=0:int, Target1=0:int, Target2=0:int, Target3=0:int, Target4=0:int, Target5=0:int, Target6=0:int, Target7=0:int, Target8=0:int, Target9=0:int")
  3647. {
  3648. int target [10];
  3649. bool already_entered;
  3650. REGISTER_VARIABLES()
  3651. {
  3652. SAVE_VARIABLE( already_entered, 1 );
  3653. SAVE_VARIABLE( target [0], 2 );
  3654. SAVE_VARIABLE( target [1], 3 );
  3655. SAVE_VARIABLE( target [2], 4 );
  3656. SAVE_VARIABLE( target [3], 5 );
  3657. SAVE_VARIABLE( target [4], 6 );
  3658. SAVE_VARIABLE( target [5], 7 );
  3659. SAVE_VARIABLE( target [6], 8 );
  3660. SAVE_VARIABLE( target [7], 9 );
  3661. SAVE_VARIABLE( target [8], 10 );
  3662. SAVE_VARIABLE( target [9], 11 );
  3663. }
  3664. void Created (GameObject *obj)
  3665. {
  3666. already_entered = false;
  3667. target [0] = Get_Int_Parameter ("Target0");
  3668. target [1] = Get_Int_Parameter ("Target1");
  3669. target [2] = Get_Int_Parameter ("Target2");
  3670. target [3] = Get_Int_Parameter ("Target3");
  3671. target [4] = Get_Int_Parameter ("Target4");
  3672. target [5] = Get_Int_Parameter ("Target5");
  3673. target [6] = Get_Int_Parameter ("Target6");
  3674. target [7] = Get_Int_Parameter ("Target7");
  3675. target [8] = Get_Int_Parameter ("Target8");
  3676. target [9] = Get_Int_Parameter ("Target9");
  3677. }
  3678. void Entered (GameObject *obj, GameObject *enterer)
  3679. {
  3680. if (!already_entered)
  3681. {
  3682. already_entered = true;
  3683. for (int x = 0; x < 10; x++)
  3684. {
  3685. if (target [x] != 0)
  3686. {
  3687. Commands->Send_Custom_Event(obj, Commands->Find_Object(target [x]), M09_INNATE_ENABLE, 0);
  3688. }
  3689. }
  3690. }
  3691. }
  3692. };
  3693. DECLARE_SCRIPT (M09_Camera_Activate, "Camera0=0:int, Camera1=0:int, Camera2=0:int, Camera3=0:int, Camera4=0:int")
  3694. {
  3695. int camera [5];
  3696. bool already_entered;
  3697. REGISTER_VARIABLES()
  3698. {
  3699. SAVE_VARIABLE( already_entered, 1 );
  3700. SAVE_VARIABLE( camera [0], 2 );
  3701. SAVE_VARIABLE( camera [1], 3 );
  3702. SAVE_VARIABLE( camera [2], 4 );
  3703. SAVE_VARIABLE( camera [3], 5 );
  3704. SAVE_VARIABLE( camera [4], 6 );
  3705. }
  3706. void Created (GameObject *obj)
  3707. {
  3708. already_entered = false;
  3709. camera [0] = Get_Int_Parameter ("Camera0");
  3710. camera [1] = Get_Int_Parameter ("Camera1");
  3711. camera [2] = Get_Int_Parameter ("Camera2");
  3712. camera [3] = Get_Int_Parameter ("Camera3");
  3713. camera [4] = Get_Int_Parameter ("Camera4");
  3714. }
  3715. void Entered (GameObject *obj, GameObject *enterer)
  3716. {
  3717. if (!already_entered)
  3718. {
  3719. already_entered = true;
  3720. for (int x = 0; x < 10; x++)
  3721. {
  3722. if (camera [x] != 0)
  3723. {
  3724. Commands->Attach_Script (Commands->Find_Object (camera [x]), "RMV_Camera_Behavior", "90.0, 0, 1, 0.0");
  3725. }
  3726. }
  3727. }
  3728. }
  3729. };
  3730. DECLARE_SCRIPT(M09_Level10Key, "")
  3731. {
  3732. void Entered (GameObject * obj, GameObject * enterer)
  3733. {
  3734. Commands->Grant_Key ( STAR, 10, true);
  3735. }
  3736. };
  3737. DECLARE_SCRIPT(M09_Destroy_Zone, "")
  3738. {
  3739. void Entered (GameObject * obj, GameObject * enterer)
  3740. {
  3741. Commands->Start_Timer (obj, this, 2.0f, 10);
  3742. }
  3743. void Timer_Expired(GameObject * obj, int timer_id )
  3744. {
  3745. if(timer_id == 10)
  3746. {
  3747. Commands->Destroy_Object (obj);
  3748. }
  3749. }
  3750. };
  3751. DECLARE_SCRIPT(M09_Elevator_Exit, "Mobius_exit_goto:int")
  3752. {
  3753. bool already_entered;
  3754. // Register variables to be Auto-Saved
  3755. // All variables must have a unique ID, less than 256, that never changes
  3756. REGISTER_VARIABLES()
  3757. {
  3758. SAVE_VARIABLE( already_entered, 1 );
  3759. }
  3760. void Created (GameObject * obj)
  3761. {
  3762. already_entered = false;
  3763. }
  3764. void Entered (GameObject * obj, GameObject * enterer)
  3765. {
  3766. //already_entered = true;
  3767. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), ELEVATOR_EXIT, Get_Int_Parameter("Mobius_exit_goto"));
  3768. }
  3769. };
  3770. DECLARE_SCRIPT(M09_Attack_Blocked_False, "")
  3771. {
  3772. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3773. {
  3774. ActionParamsStruct params;
  3775. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3776. params.Set_Attack (enemy, 200.0f, 5.0f, 1);
  3777. params.AttackCheckBlocked = false;
  3778. Commands->Action_Attack (obj, params);
  3779. }
  3780. };
  3781. DECLARE_SCRIPT(M09_Mobius_OnFollow, "")
  3782. {
  3783. void Entered (GameObject * obj, GameObject * enterer)
  3784. {
  3785. Commands->Send_Custom_Event(obj, Commands->Find_Object (2000010), NO_FOLLOW, OFF);
  3786. }
  3787. };
  3788. DECLARE_SCRIPT(M09_PSuitAnim, "")
  3789. {
  3790. void Created (GameObject *obj)
  3791. {
  3792. /*ActionParamsStruct params;
  3793. params.Set_Basic( this, 99, DOING_ANIMATION );
  3794. params.Set_Animation ("S_A_HUMAN.H_A_X9C_SUIT", true);
  3795. Commands->Action_Play_Animation (obj, params);*/
  3796. Commands->Set_Animation ( obj, "S_A_HUMAN.H_A_X9C_SUIT", true, NULL, 0.0f, -1.0f, false );
  3797. }
  3798. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3799. {
  3800. if (type == 666)
  3801. {
  3802. Commands->Destroy_Object (obj);
  3803. }
  3804. }
  3805. };