Mission02.cpp 140 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380
  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. * Mission02.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 02 Specific Scripts
  25. *
  26. * PROGRAMMER
  27. * Ryan Vervack, Rich Donnelly
  28. *
  29. * VERSION INFO
  30. * $Author: Rich_d $
  31. * $Revision: 332 $
  32. * $Modtime: 1/13/02 5:40p $
  33. * $Archive: /Commando/Code/Scripts/Mission02.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission2.h"
  39. // Mission Objective Controller and Initializer
  40. DECLARE_SCRIPT(M02_Objective_Controller, "")
  41. {
  42. int convoy_trucks;
  43. int count_dead;
  44. int count_dead_09;
  45. bool rocket_soldier_speech;
  46. REGISTER_VARIABLES()
  47. {
  48. SAVE_VARIABLE (convoy_trucks, 1);
  49. SAVE_VARIABLE (count_dead, 2);
  50. SAVE_VARIABLE (count_dead_09, 3);
  51. }
  52. void Created(GameObject * obj)
  53. {
  54. Commands->Reveal_Encyclopedia_Character (37);
  55. Commands->Reveal_Encyclopedia_Character (4);
  56. Commands->Reveal_Encyclopedia_Character (10);
  57. Commands->Reveal_Encyclopedia_Character (8);
  58. Commands->Set_Background_Music ("02-Packing Iron.mp3");
  59. // Set the Dam MCT to animation frame 0
  60. GameObject * dam = Commands->Find_Object (1111116);
  61. if (dam)
  62. {
  63. Commands->Set_Animation_Frame (dam, "MCT_NOD.MCT_NOD", 0);
  64. }
  65. count_dead = 0;
  66. count_dead_09 = 0;
  67. rocket_soldier_speech = false;
  68. // Set up the expected number of convoy trucks for the objective.
  69. convoy_trucks = 3;
  70. // Prevent the Objective Controller from hibernating
  71. Commands->Enable_Hibernation(obj, false);
  72. // Turn on the first primary objective (Locate the Missing Scientists)
  73. // Turn on the tertiary objectives (if any)
  74. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1004I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  75. Commands->Add_Objective (201, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M02_01, NULL, IDS_Enc_Obj_Primary_M02_01);
  76. Commands->Set_Objective_HUD_Info_Position (201, 50, "POG_M08_1_04.tga", IDS_POG_LOCATE, Vector3 (1208.31f,562.49f,55.02f));
  77. Commands->Add_Objective (223, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M02_01, NULL, IDS_Enc_Obj_Hidden_M02_01);
  78. Commands->Add_Objective (222, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M02_02, NULL, IDS_Enc_Obj_Hidden_M02_02);
  79. Commands->Start_Timer (obj, this, 2.0f, 201);
  80. }
  81. // This custom receives requests to activate and deactivate objectives
  82. // Type = Objective ID
  83. // Param 0 = Activate this objective (Pending)
  84. // Param 1 = Complete this objective (Accomplished)
  85. // Param 2 = Fail this objective (Failed)
  86. // Param 3 = Convoy truck special - counting
  87. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  88. {
  89. if (type > 199)
  90. {
  91. switch (param)
  92. {
  93. case (0): // Activate and set radar marker
  94. {
  95. Add_An_Objective (obj, type);
  96. Commands->Start_Timer (obj, this, 2.0f, type);
  97. break;
  98. }
  99. case (1): // Success
  100. {
  101. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1006I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  102. Commands->Set_Objective_Status (type, OBJECTIVE_STATUS_ACCOMPLISHED);
  103. Commands->Start_Timer (obj, this, 2.0f, (type + 200));
  104. break;
  105. }
  106. case (2): // Failure
  107. {
  108. Commands->Set_Objective_Status (type, OBJECTIVE_STATUS_FAILED);
  109. break;
  110. }
  111. case (3): // Counting Convoy Trucks
  112. {
  113. convoy_trucks--;
  114. if (!convoy_trucks)
  115. {
  116. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1006I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  117. Commands->Set_Objective_Status (213, OBJECTIVE_STATUS_ACCOMPLISHED);
  118. Commands->Stop_All_Conversations ();
  119. int id = Commands->Create_Conversation ("M02_SECONDARY_09_FINISH", 100, 300, true);
  120. Commands->Join_Conversation (NULL, id);
  121. Commands->Join_Conversation (STAR, id, true, false, false);
  122. Commands->Start_Conversation (id);
  123. }
  124. break;
  125. }
  126. default:
  127. {
  128. if (type == 1000)
  129. {
  130. if (param == 1000)
  131. {
  132. count_dead++;
  133. if (count_dead > 1)
  134. {
  135. count_dead = 0;
  136. Vector3 drop_loc = Vector3(-10.6f,-25.1f,-38.2f);
  137. float facing = 70.5f;
  138. const char* textfile = "X2I_GDI_Drop02_Rocket.txt";
  139. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  140. if (chinook_obj1)
  141. {
  142. Commands->Set_Facing(chinook_obj1, facing);
  143. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", textfile);
  144. }
  145. if (!rocket_soldier_speech)
  146. {
  147. rocket_soldier_speech = true;
  148. Commands->Stop_All_Conversations ();
  149. int id = Commands->Create_Conversation("M02_MORE_ROCKET_SOLDIERS", 100, 300, true);
  150. Commands->Join_Conversation(NULL, id);
  151. Commands->Join_Conversation (STAR, id, true, false, false);
  152. Commands->Start_Conversation(id);
  153. }
  154. }
  155. }
  156. else if (param == 1001)
  157. {
  158. count_dead_09++;
  159. if (count_dead_09 > 2)
  160. {
  161. count_dead_09 = 0;
  162. Vector3 drop_loc = Vector3(819.38f,884.05f,24.50f);
  163. float facing = 110.0f;
  164. const char* textfile = "X2I_GDI_Drop03_Minigunner.txt";
  165. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  166. if (chinook_obj1)
  167. {
  168. Commands->Set_Facing(chinook_obj1, facing);
  169. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", textfile);
  170. }
  171. }
  172. }
  173. else if (param == 1002)
  174. {
  175. Commands->Give_PowerUp (STAR, "Level_01_Keycard", true);
  176. }
  177. }
  178. break;
  179. }
  180. }
  181. }
  182. }
  183. void Timer_Expired (GameObject * obj, int timer_id)
  184. {
  185. int id = 0;
  186. Commands->Stop_All_Conversations ();
  187. switch (timer_id)
  188. {
  189. case (10): // Reminder for final objective.
  190. {
  191. id = Commands->Create_Conversation("M02_PRIMARY_04_REMIND", 100, 300, true);
  192. break;
  193. }
  194. // Initiation Conversations
  195. case (201):
  196. {
  197. id = Commands->Create_Conversation("M02_PRIMARY_01_START", 100, 300, true);
  198. break;
  199. }
  200. case (204):
  201. {
  202. id = Commands->Create_Conversation("M02_SECONDARY_01_START", 100, 300, true);
  203. break;
  204. }
  205. case (205):
  206. {
  207. id = Commands->Create_Conversation("M02_PRIMARY_04_START", 100, 300, true);
  208. Commands->Start_Timer (obj, this, 120.0f, 10);
  209. break;
  210. }
  211. case (206):
  212. {
  213. id = Commands->Create_Conversation("M02_SECONDARY_02_START", 100, 300, true);
  214. break;
  215. }
  216. case (208):
  217. {
  218. id = Commands->Create_Conversation("M02_SECONDARY_04_START", 100, 300, true);
  219. break;
  220. }
  221. case (210):
  222. {
  223. id = Commands->Create_Conversation("MX2DSGN_DSGN0004", 100, 300, true);
  224. break;
  225. }
  226. case (211):
  227. {
  228. id = Commands->Create_Conversation("M02_SECONDARY_07_START", 100, 300, true);
  229. break;
  230. }
  231. case (212):
  232. {
  233. id = Commands->Create_Conversation("M02_SECONDARY_08_START", 100, 300, true);
  234. break;
  235. }
  236. case (214):
  237. {
  238. id = Commands->Create_Conversation("M02_SECONDARY_10_START", 100, 300, true);
  239. break;
  240. }
  241. case (218):
  242. {
  243. id = Commands->Create_Conversation("M02_SECONDARY_14_START", 100, 300, true);
  244. break;
  245. }
  246. // Success Conversations
  247. case (403):
  248. {
  249. id = Commands->Create_Conversation("M02_PRIMARY_03_FINISH", 100, 300, true);
  250. break;
  251. }
  252. case (404):
  253. {
  254. id = Commands->Create_Conversation("M02_SECONDARY_01_FINISH", 100, 300, true);
  255. break;
  256. }
  257. case (406):
  258. {
  259. id = Commands->Create_Conversation("M02_SECONDARY_02_FINISH", 100, 300, true);
  260. break;
  261. }
  262. case (407):
  263. {
  264. id = Commands->Create_Conversation("M02_SECONDARY_03_FINISH", 100, 300, true);
  265. break;
  266. }
  267. case (408):
  268. {
  269. id = Commands->Create_Conversation("M02_SECONDARY_04_FINISH", 100, 300, true);
  270. break;
  271. }
  272. case (409):
  273. {
  274. id = Commands->Create_Conversation("M02_SECONDARY_05_FINISH", 100, 300, true);
  275. break;
  276. }
  277. case (410):
  278. {
  279. id = Commands->Create_Conversation("M02_SECONDARY_06_FINISH", 100, 300, true);
  280. break;
  281. }
  282. case (411):
  283. {
  284. id = Commands->Create_Conversation("M02_SECONDARY_07_FINISH", 100, 300, true);
  285. Commands->Start_Timer (obj, this, 5.0f, 11);
  286. break;
  287. }
  288. case (412):
  289. {
  290. id = Commands->Create_Conversation("M02_SECONDARY_08_FINISH", 100, 300, true);
  291. break;
  292. }
  293. case (414):
  294. {
  295. id = Commands->Create_Conversation("M02_SECONDARY_10_FINISH", 100, 300, true);
  296. break;
  297. }
  298. case (416):
  299. {
  300. id = Commands->Create_Conversation("M02_SECONDARY_12_FINISH", 100, 300, true);
  301. break;
  302. }
  303. case (417):
  304. {
  305. id = Commands->Create_Conversation("M02_SECONDARY_13_FINISH", 100, 300, true);
  306. break;
  307. }
  308. }
  309. if (id)
  310. {
  311. Commands->Join_Conversation(NULL, id);
  312. Commands->Join_Conversation (STAR, id, true, false, false);
  313. Commands->Start_Conversation(id);
  314. }
  315. }
  316. void Add_An_Objective(GameObject * obj, int id)
  317. {
  318. Vector3 objective_pos;
  319. objective_pos = Objective_Radar_Locations [(id - 202)];
  320. switch (id)
  321. {
  322. case 202:
  323. {
  324. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1004I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  325. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M02_02, NULL, IDS_Enc_Obj_Primary_M02_02);
  326. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  327. Commands->Set_Objective_HUD_Info_Position (id, 66, "POG_M07_2_05.tga", IDS_POG_DISABLE, objective_pos);
  328. break;
  329. }
  330. case 203:
  331. {
  332. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1004I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  333. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M02_03, NULL, IDS_Enc_Obj_Primary_M02_03);
  334. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  335. Commands->Set_Objective_HUD_Info_Position (id, 67, "POG_M02_1_03.tga", IDS_POG_DESTROY, objective_pos);
  336. break;
  337. }
  338. case 204:
  339. {
  340. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  341. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_01, NULL, IDS_Enc_Obj_Secondary_M02_01);
  342. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  343. Commands->Set_Objective_HUD_Info_Position (id, 80, "POG_M02_2_01.tga", IDS_POG_DESTROY, objective_pos);
  344. break;
  345. }
  346. case 205:
  347. {
  348. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1004I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  349. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M02_04, NULL, IDS_Enc_Obj_Primary_M02_04);
  350. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  351. Commands->Set_Objective_HUD_Info_Position (id, 80, "POG_M02_1_04.tga", IDS_POG_CAPTURE, objective_pos);
  352. break;
  353. }
  354. case 206:
  355. {
  356. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  357. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_02, NULL, IDS_Enc_Obj_Secondary_M02_02);
  358. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  359. Commands->Set_Objective_HUD_Info_Position (id, 53, "POG_M02_2_02.tga", IDS_POG_DESTROY, objective_pos);
  360. break;
  361. }
  362. case 207:
  363. {
  364. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  365. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_03, NULL, IDS_Enc_Obj_Secondary_M02_03);
  366. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  367. Commands->Set_Objective_HUD_Info_Position (id, 54, "POG_M02_2_03.tga", IDS_POG_ELIMINATE, objective_pos);
  368. break;
  369. }
  370. case 208:
  371. {
  372. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  373. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_05, NULL, IDS_Enc_Obj_Secondary_M02_05);
  374. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  375. Commands->Set_Objective_HUD_Info_Position (id, 56, "POG_M02_2_06.tga", IDS_POG_ELIMINATE, objective_pos);
  376. break;
  377. }
  378. case 209:
  379. {
  380. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  381. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_04, NULL, IDS_Enc_Obj_Secondary_M02_04);
  382. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  383. Commands->Set_Objective_HUD_Info_Position (id, 55, "POG_M02_2_05.tga", IDS_POG_ELIMINATE, objective_pos);
  384. break;
  385. }
  386. case 210:
  387. {
  388. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  389. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_06, NULL, IDS_Enc_Obj_Secondary_M02_06);
  390. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  391. Commands->Set_Objective_HUD_Info_Position (id, 57, "POG_M02_2_04.tga", IDS_POG_ELIMINATE, objective_pos);
  392. break;
  393. }
  394. case 211:
  395. {
  396. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  397. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_07, NULL, IDS_Enc_Obj_Secondary_M02_07);
  398. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  399. Commands->Set_Objective_HUD_Info_Position (id, 61, "POG_M02_2_07.tga", IDS_POG_ELIMINATE, objective_pos);
  400. break;
  401. }
  402. case 212:
  403. {
  404. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  405. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_08, NULL, IDS_Enc_Obj_Secondary_M02_08);
  406. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  407. Commands->Set_Objective_HUD_Info_Position (id, 59, "POG_M02_2_08.tga", IDS_POG_DESTROY, objective_pos);
  408. break;
  409. }
  410. case 213:
  411. {
  412. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  413. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_09, NULL, IDS_Enc_Obj_Secondary_M02_09);
  414. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  415. Commands->Set_Objective_HUD_Info_Position (id, 60, "POG_M02_2_09.tga", IDS_POG_DESTROY, objective_pos);
  416. break;
  417. }
  418. case 214:
  419. {
  420. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  421. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_10, NULL, IDS_Enc_Obj_Secondary_M02_10);
  422. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  423. Commands->Set_Objective_HUD_Info_Position (id, 62, "POG_M02_2_10.tga", IDS_POG_DESTROY, objective_pos);
  424. break;
  425. }
  426. case 215:
  427. {
  428. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  429. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_11, NULL, IDS_Enc_Obj_Secondary_M02_11);
  430. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  431. Commands->Set_Objective_HUD_Info_Position (id, 63, "POG_M02_2_11.tga", IDS_POG_DESTROY, objective_pos);
  432. break;
  433. }
  434. case 216:
  435. {
  436. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  437. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_12, NULL, IDS_Enc_Obj_Secondary_M02_12);
  438. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  439. Commands->Set_Objective_HUD_Info_Position (id, 64, "POG_M02_2_12.tga", IDS_POG_DESTROY, objective_pos);
  440. break;
  441. }
  442. case 217:
  443. {
  444. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  445. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_13, NULL, IDS_Enc_Obj_Secondary_M02_13);
  446. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  447. Commands->Set_Objective_HUD_Info_Position (id, 65, "POG_M02_2_13.tga", IDS_POG_DESTROY, objective_pos);
  448. break;
  449. }
  450. case 218:
  451. {
  452. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  453. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_14, NULL, IDS_Enc_Obj_Secondary_M02_14);
  454. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  455. Commands->Set_Objective_HUD_Info_Position (id, 70, "POG_M02_2_14.tga", IDS_POG_DESTROY, objective_pos);
  456. break;
  457. }
  458. case 219:
  459. {
  460. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  461. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_15, NULL, IDS_Enc_Obj_Secondary_M02_15);
  462. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  463. Commands->Set_Objective_HUD_Info_Position (id, 71, "POG_M02_2_14.tga", IDS_POG_DESTROY, objective_pos);
  464. break;
  465. }
  466. case 220:
  467. {
  468. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  469. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_16, NULL, IDS_Enc_Obj_Secondary_M02_16);
  470. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  471. Commands->Set_Objective_HUD_Info_Position (id, 72, "POG_M02_2_14.tga", IDS_POG_DESTROY, objective_pos);
  472. break;
  473. }
  474. case 221:
  475. {
  476. Commands->Set_HUD_Help_Text(IDS_M00DSGN_DSGN1005I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  477. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M02_17, NULL, IDS_Enc_Obj_Secondary_M02_17);
  478. Commands->Set_Objective_Radar_Blip(id, objective_pos);
  479. Commands->Set_Objective_HUD_Info_Position (id, 58, "POG_M02_2_15.tga", IDS_POG_ACQUIRE, objective_pos);
  480. break;
  481. }
  482. }
  483. }
  484. };
  485. DECLARE_SCRIPT(M02_Objective_Zone, "")
  486. {
  487. bool enemies_defeated;
  488. bool was_entered;
  489. bool gave_secure_warning;
  490. int mendoza_id;
  491. REGISTER_VARIABLES()
  492. {
  493. SAVE_VARIABLE (enemies_defeated, 1);
  494. SAVE_VARIABLE (mendoza_id, 2);
  495. SAVE_VARIABLE (was_entered, 3);
  496. SAVE_VARIABLE (gave_secure_warning, 4);
  497. }
  498. void Created(GameObject *obj)
  499. {
  500. gave_secure_warning = false;
  501. mendoza_id = 0;
  502. was_entered = false;
  503. enemies_defeated = false;
  504. }
  505. void Entered(GameObject *obj, GameObject *enterer)
  506. {
  507. // Send customs to activate the appropriate objectives
  508. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  509. if (object)
  510. {
  511. bool destroy_zone = false;
  512. int dual_zone = 0;
  513. int zone_id = Commands->Get_ID(obj);
  514. switch (zone_id)
  515. {
  516. case (301601):
  517. {
  518. if (!Commands->Has_Key(STAR, 6))
  519. {
  520. Commands->Stop_All_Conversations ();
  521. int id = Commands->Create_Conversation("M02_BAY_DOOR_WARNING", 100, 300, true);
  522. Commands->Join_Conversation(NULL, id);
  523. Commands->Join_Conversation (STAR, id, true, false, false);
  524. Commands->Start_Conversation(id);
  525. destroy_zone = true;
  526. }
  527. break;
  528. }
  529. case (303203):
  530. {
  531. Commands->Stop_All_Conversations ();
  532. int id = Commands->Create_Conversation("M02_PRIMARY_03_GUIDE", 100, 300, true);
  533. Commands->Join_Conversation(NULL, id);
  534. Commands->Join_Conversation (STAR, id, true, false, false);
  535. Commands->Start_Conversation(id);
  536. destroy_zone = true;
  537. break;
  538. }
  539. case (304006):
  540. {
  541. if (!was_entered)
  542. {
  543. was_entered = true;
  544. int id = Commands->Create_Conversation("MX2DSGN_DSGN0001", 100, 300, true);
  545. Commands->Join_Conversation(NULL, id);
  546. Commands->Join_Conversation (STAR, id, true, false, false);
  547. Commands->Start_Conversation(id);
  548. Commands->Set_HUD_Help_Text(IDS_M02DSGN_DSGN0186I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  549. }
  550. break;
  551. }
  552. case (400184):
  553. {
  554. // Turn on objectives
  555. Commands->Send_Custom_Event(obj, object, 206, 0);
  556. Commands->Send_Custom_Event(obj, object, 207, 0);
  557. // Turn on A00
  558. Commands->Send_Custom_Event(obj, object, 104, 0);
  559. // Call GDI Rocket Soldiers
  560. Call_GDI_Soldiers(0);
  561. // Call the Nod Apache
  562. Create_Apache(0);
  563. // Tell A00 units to wake up
  564. Commands->Send_Custom_Event(obj, Commands->Find_Object(400286), 0, 0);
  565. Commands->Send_Custom_Event(obj, Commands->Find_Object(400287), 0, 0);
  566. Commands->Send_Custom_Event(obj, Commands->Find_Object(400288), 0, 0);
  567. Commands->Send_Custom_Event(obj, Commands->Find_Object(400292), 0, 0);
  568. Commands->Send_Custom_Event(obj, Commands->Find_Object(400293), 0, 0);
  569. Commands->Send_Custom_Event(obj, Commands->Find_Object(400285), 0, 0);
  570. Commands->Send_Custom_Event(obj, Commands->Find_Object(400206), 0, 0);
  571. Commands->Send_Custom_Event(obj, Commands->Find_Object(401004), 0, 0);
  572. Commands->Send_Custom_Event(obj, Commands->Find_Object(401005), 0, 0);
  573. Commands->Send_Custom_Event(obj, Commands->Find_Object(401006), 0, 0);
  574. destroy_zone = true;
  575. break;
  576. }
  577. case (400185):
  578. {
  579. // Turn on objectives
  580. Commands->Send_Custom_Event(obj, object, 208, 0);
  581. Commands->Send_Custom_Event(obj, object, 209, 0);
  582. // Turn on A01
  583. Commands->Send_Custom_Event(obj, object, 104, 1);
  584. // Create A01 Nod Buggy for Player
  585. Commands->Send_Custom_Event(obj, object, 112, 1);
  586. Commands->Send_Custom_Event(obj, object, 111, 1);
  587. // Tell the GDI Rocket Soldiers for A00 to go to the tower.
  588. Vector3 obj_position = Commands->Get_Position (obj);
  589. Commands->Create_Logical_Sound (obj, 1100, obj_position, 1000.0f);
  590. // Tell A23 units to go to home points.
  591. Commands->Create_Logical_Sound (obj, 1073, obj_position, 1000.0f);
  592. // Tell A01 units to wake up.
  593. Commands->Send_Custom_Event(obj, Commands->Find_Object(400342), 0, 0);
  594. Commands->Send_Custom_Event(obj, Commands->Find_Object(400343), 0, 0);
  595. Commands->Send_Custom_Event(obj, Commands->Find_Object(400347), 0, 0);
  596. Commands->Send_Custom_Event(obj, Commands->Find_Object(400332), 0, 0);
  597. Commands->Send_Custom_Event(obj, Commands->Find_Object(400340), 0, 0);
  598. Commands->Send_Custom_Event(obj, Commands->Find_Object(400348), 0, 0);
  599. Commands->Send_Custom_Event(obj, Commands->Find_Object(400344), 0, 0);
  600. Commands->Send_Custom_Event(obj, Commands->Find_Object(400345), 0, 0);
  601. Commands->Send_Custom_Event(obj, Commands->Find_Object(400333), 0, 0);
  602. Commands->Send_Custom_Event(obj, Commands->Find_Object(400207), 0, 0);
  603. Commands->Send_Custom_Event(obj, Commands->Find_Object(400371), 0, 0);
  604. Commands->Send_Custom_Event(obj, Commands->Find_Object(401008), 0, 0);
  605. destroy_zone = true;
  606. break;
  607. }
  608. case (400186):
  609. {
  610. // Turn on objectives
  611. Commands->Send_Custom_Event(obj, object, 210, 0);
  612. Commands->Send_Custom_Event(obj, object, 221, 0);
  613. //Turn off A01, Turn on A02
  614. Commands->Send_Custom_Event(obj, object, 105, 1);
  615. Commands->Send_Custom_Event(obj, object, 104, 2);
  616. // Tell A01 units to go to home points.
  617. Vector3 obj_position = Commands->Get_Position (obj);
  618. Commands->Create_Logical_Sound (obj, 1051, obj_position, 1000.0f);
  619. // Turn on A02 units
  620. Commands->Send_Custom_Event(obj, Commands->Find_Object(400372), 0, 0);
  621. Commands->Send_Custom_Event(obj, Commands->Find_Object(400373), 0, 0);
  622. Commands->Send_Custom_Event(obj, Commands->Find_Object(400374), 0, 0);
  623. Commands->Send_Custom_Event(obj, Commands->Find_Object(401167), 0, 0);
  624. Commands->Send_Custom_Event(obj, Commands->Find_Object(400208), 0, 0);
  625. Commands->Send_Custom_Event(obj, Commands->Find_Object(401014), 0, 0);
  626. Commands->Send_Custom_Event(obj, Commands->Find_Object(401015), 0, 0);
  627. Commands->Send_Custom_Event(obj, Commands->Find_Object(401016), 0, 0);
  628. Commands->Send_Custom_Event(obj, Commands->Find_Object(401017), 0, 0);
  629. // Create the A02 buggy
  630. Create_Buggy (2);
  631. // Bring in A02 Sakura
  632. Create_Sakura (2);
  633. // Start the tank conversation
  634. destroy_zone = true;
  635. break;
  636. }
  637. case (400187):
  638. {
  639. // Turn on objectives
  640. Commands->Send_Custom_Event(obj, object, 211, 0);
  641. //Turn off A03, Turn on A04
  642. Commands->Send_Custom_Event(obj, object, 105, 3);
  643. Commands->Send_Custom_Event(obj, object, 104, 4);
  644. // Tell the GDI Rocket Soldiers for A02 to go to the house.
  645. Vector3 obj_position = Commands->Get_Position (obj);
  646. Commands->Create_Logical_Sound (obj, 1102, obj_position, 1000.0f);
  647. // Tell A03 units to go to home points.
  648. Commands->Create_Logical_Sound (obj, 1053, obj_position, 1000.0f);
  649. // Wake up A04 units
  650. Commands->Send_Custom_Event(obj, Commands->Find_Object(400210), 0, 0);
  651. Commands->Send_Custom_Event(obj, Commands->Find_Object(400451), 0, 0);
  652. Commands->Send_Custom_Event(obj, Commands->Find_Object(400452), 0, 0);
  653. Commands->Send_Custom_Event(obj, Commands->Find_Object(400453), 0, 0);
  654. Commands->Send_Custom_Event(obj, Commands->Find_Object(400499), 0, 0);
  655. Commands->Send_Custom_Event(obj, Commands->Find_Object(400500), 0, 0);
  656. Commands->Send_Custom_Event(obj, Commands->Find_Object(401025), 0, 0);
  657. Commands->Send_Custom_Event(obj, Commands->Find_Object(401026), 0, 0);
  658. Commands->Send_Custom_Event(obj, Commands->Find_Object(401027), 0, 0);
  659. Commands->Send_Custom_Event(obj, Commands->Find_Object(401028), 0, 0);
  660. // Create A04 Nod Light Tank for Player
  661. Commands->Send_Custom_Event(obj, object, 112, 4);
  662. Commands->Send_Custom_Event(obj, object, 111, 4);
  663. // Create the A04 Nod Buggy
  664. Create_Buggy (4);
  665. // Activate the A04 Medium Tank motion and destruction.
  666. Commands->Send_Custom_Event(obj, Commands->Find_Object(401018), 0, 0);
  667. // Start the tank speaking timer
  668. Commands->Start_Timer (obj, this, 0.1f, 10);
  669. destroy_zone = true;
  670. dual_zone = 400267;
  671. break;
  672. }
  673. case (400188):
  674. {
  675. // Turn on objectives
  676. Commands->Send_Custom_Event(obj, object, 212, 0);
  677. Commands->Send_Custom_Event(obj, object, 213, 0);
  678. //Turn off A02, Turn on A03
  679. Commands->Send_Custom_Event(obj, object, 105, 2);
  680. Commands->Send_Custom_Event(obj, object, 104, 3);
  681. // Tell A02 units to go to home points.
  682. Vector3 obj_position = Commands->Get_Position (obj);
  683. Commands->Create_Logical_Sound (obj, 1052, obj_position, 1000.0f);
  684. // Create the Light Tank for A03
  685. Create_Light_Tank (3);
  686. // Wake up A03 units
  687. Commands->Send_Custom_Event(obj, Commands->Find_Object(400410), 0, 0);
  688. Commands->Send_Custom_Event(obj, Commands->Find_Object(400209), 0, 0);
  689. Commands->Send_Custom_Event(obj, Commands->Find_Object(400411), 0, 0);
  690. Commands->Send_Custom_Event(obj, Commands->Find_Object(400412), 0, 0);
  691. Commands->Send_Custom_Event(obj, Commands->Find_Object(400413), 0, 0);
  692. Commands->Send_Custom_Event(obj, Commands->Find_Object(400414), 0, 0);
  693. Commands->Send_Custom_Event(obj, Commands->Find_Object(400415), 0, 0);
  694. destroy_zone = true;
  695. break;
  696. }
  697. case (400189):
  698. {
  699. // Turn on objectives
  700. Commands->Send_Custom_Event(obj, object, 215, 0);
  701. Commands->Send_Custom_Event(obj, object, 216, 0);
  702. //Turn on A06
  703. Commands->Send_Custom_Event(obj, object, 104, 6);
  704. // Wake up A06 units
  705. Commands->Send_Custom_Event(obj, Commands->Find_Object(400211), 0, 0);
  706. Commands->Send_Custom_Event(obj, Commands->Find_Object(400976), 0, 0);
  707. Commands->Send_Custom_Event(obj, Commands->Find_Object(400975), 0, 0);
  708. Commands->Send_Custom_Event(obj, Commands->Find_Object(400977), 0, 0);
  709. Commands->Send_Custom_Event(obj, Commands->Find_Object(400978), 0, 0);
  710. Commands->Send_Custom_Event(obj, Commands->Find_Object(400979), 0, 0);
  711. Commands->Send_Custom_Event(obj, Commands->Find_Object(400980), 0, 0);
  712. Commands->Send_Custom_Event(obj, Commands->Find_Object(401036), 0, 0);
  713. Commands->Send_Custom_Event(obj, Commands->Find_Object(401037), 0, 0);
  714. Commands->Send_Custom_Event(obj, Commands->Find_Object(401038), 0, 0);
  715. Commands->Send_Custom_Event(obj, Commands->Find_Object(401045), 0, 0);
  716. destroy_zone = true;
  717. break;
  718. }
  719. case (400192):
  720. {
  721. // Default shut off for A11, Power Plant spawns.
  722. Commands->Send_Custom_Event(obj, object, 105, 11);
  723. // Tell A11 units to go to home points.
  724. Vector3 obj_position = Commands->Get_Position (obj);
  725. Commands->Create_Logical_Sound (obj, 1061, obj_position, 1000.0f);
  726. destroy_zone = true;
  727. break;
  728. }
  729. case (400193):
  730. {
  731. GameObject * object = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  732. if (object)
  733. {
  734. Commands->Control_Enable (STAR, false);
  735. Commands->Start_Timer (obj, this, 1.0f, 9);
  736. GameObject * controller = Commands->Find_Object (M02_OBJCONTROLLER);
  737. if (controller)
  738. {
  739. Commands->Send_Custom_Event (obj, controller, 1000, 1002, 25.0f);
  740. }
  741. Commands->Attach_Script (object, "Test_Cinematic", "X2K_Midtro.txt");
  742. }
  743. break;
  744. }
  745. case (400194):
  746. {
  747. if (!was_entered)
  748. {
  749. was_entered = true;
  750. // Complete final objective
  751. Commands->Send_Custom_Event(obj, object, 205, 1);
  752. Commands->Mission_Complete (true);
  753. //Turn off A21
  754. Commands->Send_Custom_Event(obj, object, 105, 21);
  755. }
  756. break;
  757. }
  758. case (400195):
  759. {
  760. Check_For_Soldiers (obj, 3);
  761. break;
  762. }
  763. case (400196):
  764. {
  765. Check_For_Soldiers (obj, 4);
  766. break;
  767. }
  768. case (400197):
  769. {
  770. Check_For_Soldiers (obj, 5);
  771. break;
  772. }
  773. case (400198):
  774. {
  775. Check_For_Soldiers (obj, 6);
  776. break;
  777. }
  778. case (400201):
  779. {
  780. Check_For_Soldiers (obj, 7);
  781. break;
  782. }
  783. case (400267):
  784. {
  785. // Turn on objectives
  786. Commands->Send_Custom_Event(obj, object, 211, 0);
  787. // Turn off A03, Turn on A04
  788. Commands->Send_Custom_Event(obj, object, 105, 3);
  789. Commands->Send_Custom_Event(obj, object, 104, 4);
  790. // Tell A03 units to go to home points.
  791. Vector3 obj_position = Commands->Get_Position (obj);
  792. Commands->Create_Logical_Sound (obj, 1053, obj_position, 1000.0f);
  793. // Tell the GDI Rocket Soldiers for A02 to go to the house.
  794. Commands->Create_Logical_Sound (obj, 1102, obj_position, 1000.0f);
  795. // Wake up A04 units
  796. Commands->Send_Custom_Event(obj, Commands->Find_Object(400210), 0, 0);
  797. Commands->Send_Custom_Event(obj, Commands->Find_Object(400451), 0, 0);
  798. Commands->Send_Custom_Event(obj, Commands->Find_Object(400452), 0, 0);
  799. Commands->Send_Custom_Event(obj, Commands->Find_Object(400453), 0, 0);
  800. Commands->Send_Custom_Event(obj, Commands->Find_Object(400499), 0, 0);
  801. Commands->Send_Custom_Event(obj, Commands->Find_Object(400500), 0, 0);
  802. Commands->Send_Custom_Event(obj, Commands->Find_Object(401025), 0, 0);
  803. Commands->Send_Custom_Event(obj, Commands->Find_Object(401026), 0, 0);
  804. Commands->Send_Custom_Event(obj, Commands->Find_Object(401027), 0, 0);
  805. Commands->Send_Custom_Event(obj, Commands->Find_Object(401028), 0, 0);
  806. // Create A04 Nod Light Tank for Player
  807. Commands->Send_Custom_Event(obj, object, 112, 4);
  808. Commands->Send_Custom_Event(obj, object, 111, 4);
  809. // Create the A04 Nod Buggy
  810. Create_Buggy (4);
  811. // Activate the A04 Medium Tank motion and destruction.
  812. Commands->Send_Custom_Event(obj, Commands->Find_Object(401018), 0, 0);
  813. // Start the tank speaking timer
  814. Commands->Start_Timer (obj, this, 0.1f, 10);
  815. destroy_zone = true;
  816. dual_zone = 400187;
  817. break;
  818. }
  819. case (400268):
  820. {
  821. // Turn off A04
  822. Commands->Send_Custom_Event(obj, object, 105, 4);
  823. // Tell A04 units to go to home points.
  824. Vector3 obj_position = Commands->Get_Position (obj);
  825. Commands->Create_Logical_Sound (obj, 1054, obj_position, 1000.0f);
  826. // Turn on A05 units
  827. Commands->Send_Custom_Event(obj, Commands->Find_Object(400552), 0, 0);
  828. Commands->Send_Custom_Event(obj, Commands->Find_Object(400553), 0, 0);
  829. Commands->Send_Custom_Event(obj, Commands->Find_Object(400560), 0, 0);
  830. Commands->Send_Custom_Event(obj, Commands->Find_Object(400555), 0, 0);
  831. Commands->Send_Custom_Event(obj, Commands->Find_Object(400558), 0, 0);
  832. Commands->Send_Custom_Event(obj, Commands->Find_Object(400559), 0, 0);
  833. Commands->Send_Custom_Event(obj, Commands->Find_Object(400557), 0, 0);
  834. Commands->Send_Custom_Event(obj, Commands->Find_Object(400554), 0, 0);
  835. Commands->Send_Custom_Event(obj, Commands->Find_Object(400556), 0, 0);
  836. //Turn off A24
  837. Commands->Send_Custom_Event(obj, object, 105, 24);
  838. destroy_zone = true;
  839. break;
  840. }
  841. case (400269):
  842. {
  843. // Turn on objectives
  844. Commands->Send_Custom_Event(obj, object, 202, 0);
  845. Commands->Send_Custom_Event(obj, object, 203, 0);
  846. Commands->Send_Custom_Event(obj, object, 217, 0);
  847. //Turn off A06, Turn on A09 (Dam Top)
  848. Commands->Send_Custom_Event(obj, object, 105, 6);
  849. Commands->Send_Custom_Event(obj, object, 104, 9);
  850. // Turn on A09 units.
  851. Commands->Send_Custom_Event(obj, Commands->Find_Object(400212), 0, 0);
  852. Commands->Send_Custom_Event(obj, Commands->Find_Object(400981), 0, 0);
  853. Commands->Send_Custom_Event(obj, Commands->Find_Object(400982), 0, 0);
  854. Commands->Send_Custom_Event(obj, Commands->Find_Object(400983), 0, 0);
  855. // Tell A06 units to go to home points.
  856. Vector3 obj_position = Commands->Get_Position (obj);
  857. Commands->Create_Logical_Sound (obj, 1056, obj_position, 1000.0f);
  858. // Create the GDI soldier set
  859. Call_GDI_Soldiers (9);
  860. // Primary 01 GUIDE Conversation
  861. Commands->Stop_All_Conversations ();
  862. int id = Commands->Create_Conversation("M02_PRIMARY_01_GUIDE", 100, 300, true);
  863. Commands->Join_Conversation(NULL, id);
  864. Commands->Join_Conversation (STAR, id, true, false, false);
  865. Commands->Start_Conversation(id);
  866. destroy_zone = true;
  867. break;
  868. }
  869. case (400270):
  870. {
  871. //Turn off A09, Turn on A08 (Dam Interior)
  872. Commands->Send_Custom_Event(obj, object, 105, 9);
  873. Commands->Send_Custom_Event(obj, object, 104, 8);
  874. // Wake up A08 units
  875. Commands->Send_Custom_Event(obj, Commands->Find_Object(400275), 0, 0);
  876. Commands->Send_Custom_Event(obj, Commands->Find_Object(401046), 0, 0);
  877. Commands->Send_Custom_Event(obj, Commands->Find_Object(401047), 0, 0);
  878. Commands->Send_Custom_Event(obj, Commands->Find_Object(401048), 0, 0);
  879. Commands->Send_Custom_Event(obj, Commands->Find_Object(401049), 0, 0);
  880. Commands->Send_Custom_Event(obj, Commands->Find_Object(401050), 0, 0);
  881. Commands->Send_Custom_Event(obj, Commands->Find_Object(401051), 0, 0);
  882. Commands->Send_Custom_Event(obj, Commands->Find_Object(401052), 0, 0);
  883. Commands->Send_Custom_Event(obj, Commands->Find_Object(401053), 0, 0);
  884. // Tell A09 units to go to home points.
  885. Vector3 obj_position = Commands->Get_Position (obj);
  886. Commands->Create_Logical_Sound (obj, 1059, obj_position, 1000.0f);
  887. dual_zone = 400271;
  888. destroy_zone = true;
  889. break;
  890. }
  891. case (400271):
  892. {
  893. //Turn off A09, Turn on A08 (Dam Interior)
  894. Commands->Send_Custom_Event(obj, object, 105, 9);
  895. Commands->Send_Custom_Event(obj, object, 104, 8);
  896. // Wake up A08 units
  897. Commands->Send_Custom_Event(obj, Commands->Find_Object(400275), 0, 0);
  898. Commands->Send_Custom_Event(obj, Commands->Find_Object(401046), 0, 0);
  899. Commands->Send_Custom_Event(obj, Commands->Find_Object(401047), 0, 0);
  900. Commands->Send_Custom_Event(obj, Commands->Find_Object(401048), 0, 0);
  901. Commands->Send_Custom_Event(obj, Commands->Find_Object(401049), 0, 0);
  902. Commands->Send_Custom_Event(obj, Commands->Find_Object(401050), 0, 0);
  903. Commands->Send_Custom_Event(obj, Commands->Find_Object(401051), 0, 0);
  904. Commands->Send_Custom_Event(obj, Commands->Find_Object(401052), 0, 0);
  905. Commands->Send_Custom_Event(obj, Commands->Find_Object(401053), 0, 0);
  906. // Tell A09 units to go to home points.
  907. Vector3 obj_position = Commands->Get_Position (obj);
  908. Commands->Create_Logical_Sound (obj, 1059, obj_position, 1000.0f);
  909. GameObject * deadzone = Commands->Find_Object (303203);
  910. if (deadzone)
  911. {
  912. Commands->Destroy_Object (deadzone);
  913. }
  914. dual_zone = 400270;
  915. destroy_zone = true;
  916. break;
  917. }
  918. case (400272):
  919. {
  920. //Turn off A08, Turn on A10
  921. Commands->Send_Custom_Event(obj, object, 105, 8);
  922. Commands->Send_Custom_Event(obj, object, 104, 10);
  923. // Tell A08 units to go to home points.
  924. Vector3 obj_position = Commands->Get_Position (obj);
  925. Commands->Create_Logical_Sound (obj, 1058, obj_position, 1000.0f);
  926. // Wake up A10 units
  927. Commands->Send_Custom_Event(obj, Commands->Find_Object(400213), 0, 0);
  928. Commands->Send_Custom_Event(obj, Commands->Find_Object(400984), 0, 0);
  929. Commands->Send_Custom_Event(obj, Commands->Find_Object(401054), 0, 0);
  930. Commands->Send_Custom_Event(obj, Commands->Find_Object(401055), 0, 0);
  931. Commands->Send_Custom_Event(obj, Commands->Find_Object(401056), 0, 0);
  932. Commands->Send_Custom_Event(obj, Commands->Find_Object(401057), 0, 0);
  933. destroy_zone = true;
  934. break;
  935. }
  936. case (400273):
  937. {
  938. //Turn off A10, Turn on A11
  939. Commands->Send_Custom_Event(obj, object, 105, 10);
  940. Commands->Send_Custom_Event(obj, object, 104, 11);
  941. // Force an A11 spawn
  942. Commands->Send_Custom_Event(obj, object, 114, 11);
  943. Commands->Send_Custom_Event(obj, object, 102, 11);
  944. // Wake up A11 units
  945. Commands->Send_Custom_Event(obj, Commands->Find_Object(400276), 0, 0);
  946. Commands->Send_Custom_Event(obj, Commands->Find_Object(400199), 0, 0);
  947. Commands->Send_Custom_Event(obj, Commands->Find_Object(401065), 0, 0);
  948. Commands->Send_Custom_Event(obj, Commands->Find_Object(401058), 0, 0);
  949. Commands->Send_Custom_Event(obj, Commands->Find_Object(401059), 0, 0);
  950. Commands->Send_Custom_Event(obj, Commands->Find_Object(401060), 0, 0);
  951. Commands->Send_Custom_Event(obj, Commands->Find_Object(401061), 0, 0);
  952. Commands->Send_Custom_Event(obj, Commands->Find_Object(401063), 0, 0);
  953. Commands->Send_Custom_Event(obj, Commands->Find_Object(401064), 0, 0);
  954. // Tell A10 units to go to home points.
  955. Vector3 obj_position = Commands->Get_Position (obj);
  956. Commands->Create_Logical_Sound (obj, 1060, obj_position, 1000.0f);
  957. destroy_zone = true;
  958. break;
  959. }
  960. case (400274):
  961. {
  962. //Trigger A11 off only when Power Plant is destroyed.
  963. GameObject* power_plant_obj = Commands->Find_Object(1153846);
  964. if (power_plant_obj)
  965. {
  966. float health_check = Commands->Get_Health(power_plant_obj);
  967. if (health_check <= 0.0f)
  968. {
  969. Commands->Send_Custom_Event(obj, object, 105, 11);
  970. // Tell A11 units to go to home points.
  971. Vector3 obj_position = Commands->Get_Position (obj);
  972. Commands->Create_Logical_Sound (obj, 1061, obj_position, 1000.0f);
  973. // Force an A10 spawn.
  974. Commands->Send_Custom_Event(obj, object, 114, 10);
  975. Commands->Send_Custom_Event(obj, object, 102, 10);
  976. destroy_zone = true;
  977. }
  978. // Shut off the Power Plant announcement
  979. Commands->Send_Custom_Event(obj, power_plant_obj, 1, 0);
  980. }
  981. break;
  982. }
  983. case (400316):
  984. {
  985. // Make the A00 soldiers return to home points, turn of A00
  986. Commands->Send_Custom_Event(obj, object, 105, 0);
  987. Vector3 obj_position = Commands->Get_Position (obj);
  988. Commands->Create_Logical_Sound (obj, 1050, obj_position, 1000.0f);
  989. // Turn on A23 units
  990. Commands->Send_Custom_Event(obj, Commands->Find_Object(400317), 0, 0);
  991. Commands->Send_Custom_Event(obj, Commands->Find_Object(400318), 0, 0);
  992. Commands->Send_Custom_Event(obj, Commands->Find_Object(400319), 0, 0);
  993. destroy_zone = true;
  994. break;
  995. }
  996. case (400501):
  997. {
  998. //Turn on A24
  999. // Wake up A24 units
  1000. Commands->Send_Custom_Event(obj, Commands->Find_Object(400503), 0, 0);
  1001. Commands->Send_Custom_Event(obj, Commands->Find_Object(400504), 0, 0);
  1002. Commands->Send_Custom_Event(obj, Commands->Find_Object(400505), 0, 0);
  1003. Commands->Send_Custom_Event(obj, Commands->Find_Object(400506), 0, 0);
  1004. Commands->Send_Custom_Event(obj, Commands->Find_Object(400507), 0, 0);
  1005. Commands->Send_Custom_Event(obj, Commands->Find_Object(400508), 0, 0);
  1006. Commands->Send_Custom_Event(obj, Commands->Find_Object(400509), 0, 0);
  1007. Commands->Send_Custom_Event(obj, Commands->Find_Object(400510), 0, 0);
  1008. Commands->Send_Custom_Event(obj, object, 104, 24);
  1009. // Turn on objective - SAM Site
  1010. Commands->Send_Custom_Event(obj, object, 214, 0);
  1011. dual_zone = 400502;
  1012. destroy_zone = true;
  1013. break;
  1014. }
  1015. case (400502):
  1016. {
  1017. //Turn on A24
  1018. Commands->Send_Custom_Event(obj, object, 104, 24);
  1019. // Wake up A24 units
  1020. Commands->Send_Custom_Event(obj, Commands->Find_Object(400503), 0, 0);
  1021. Commands->Send_Custom_Event(obj, Commands->Find_Object(400504), 0, 0);
  1022. Commands->Send_Custom_Event(obj, Commands->Find_Object(400505), 0, 0);
  1023. Commands->Send_Custom_Event(obj, Commands->Find_Object(400506), 0, 0);
  1024. Commands->Send_Custom_Event(obj, Commands->Find_Object(400507), 0, 0);
  1025. Commands->Send_Custom_Event(obj, Commands->Find_Object(400508), 0, 0);
  1026. Commands->Send_Custom_Event(obj, Commands->Find_Object(400509), 0, 0);
  1027. Commands->Send_Custom_Event(obj, Commands->Find_Object(400510), 0, 0);
  1028. // Turn on objective - SAM Site
  1029. Commands->Send_Custom_Event(obj, object, 214, 0);
  1030. dual_zone = 400501;
  1031. destroy_zone = true;
  1032. break;
  1033. }
  1034. case (400551):
  1035. {
  1036. // Create the Apache for this area
  1037. Create_Apache (24);
  1038. destroy_zone = true;
  1039. break;
  1040. }
  1041. case (400989):
  1042. {
  1043. destroy_zone = true;
  1044. break;
  1045. }
  1046. case (400990):
  1047. {
  1048. // Trigger the Failed Drop Cinematic
  1049. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1050. if (chinook_obj1)
  1051. {
  1052. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2E_C130Drop.txt");
  1053. }
  1054. destroy_zone = true;
  1055. break;
  1056. }
  1057. case (400991):
  1058. {
  1059. // Trigger the Orca shootdown cinematic
  1060. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1061. if (chinook_obj1)
  1062. {
  1063. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2F_OrcaSam.txt");
  1064. }
  1065. destroy_zone = true;
  1066. break;
  1067. }
  1068. case (400992):
  1069. {
  1070. // Trigger the Apache Orca crash cinematic
  1071. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1072. if (chinook_obj1)
  1073. {
  1074. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2G_AirCrash.txt");
  1075. }
  1076. destroy_zone = true;
  1077. break;
  1078. }
  1079. case (401001):
  1080. {
  1081. // Trigger the Apache bridge crash cinematic.
  1082. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1083. if (chinook_obj1)
  1084. {
  1085. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2H_ApacheSpray.txt");
  1086. }
  1087. destroy_zone = true;
  1088. break;
  1089. }
  1090. case (401029):
  1091. {
  1092. // Trigger the crash cinematic in A01
  1093. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1094. if (chinook_obj1)
  1095. {
  1096. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2D_MTank_Slip.txt");
  1097. }
  1098. destroy_zone = true;
  1099. break;
  1100. }
  1101. case (401054):
  1102. {
  1103. // Force an A08 spawn
  1104. Commands->Send_Custom_Event(obj, object, 114, 8);
  1105. Commands->Send_Custom_Event(obj, object, 102, 8);
  1106. destroy_zone = true;
  1107. break;
  1108. }
  1109. case (401066):
  1110. {
  1111. // Wake up A13 Obelisk units. No spawns in here.
  1112. Commands->Send_Custom_Event(obj, Commands->Find_Object(400200), 0, 0);
  1113. Commands->Send_Custom_Event(obj, Commands->Find_Object(401067), 0, 0);
  1114. Commands->Send_Custom_Event(obj, Commands->Find_Object(401068), 0, 0);
  1115. Commands->Send_Custom_Event(obj, Commands->Find_Object(401069), 0, 0);
  1116. // Shut off the Obelisk warning.
  1117. GameObject * obelisk = Commands->Find_Object(1153845);
  1118. if (obelisk)
  1119. {
  1120. Commands->Send_Custom_Event (obj, obelisk, 1, 0);
  1121. }
  1122. destroy_zone = true;
  1123. break;
  1124. }
  1125. case (401070):
  1126. {
  1127. // Turn on A14, Turn off A11 as default.
  1128. Commands->Send_Custom_Event(obj, object, 105, 11);
  1129. Commands->Send_Custom_Event(obj, object, 104, 14);
  1130. // Tell A11 units to go to home points.
  1131. Vector3 obj_position = Commands->Get_Position (obj);
  1132. Commands->Create_Logical_Sound (obj, 1061, obj_position, 1000.0f);
  1133. // Wake up A14 units
  1134. Commands->Send_Custom_Event(obj, Commands->Find_Object(401071), 0, 0);
  1135. Commands->Send_Custom_Event(obj, Commands->Find_Object(401072), 0, 0);
  1136. Commands->Send_Custom_Event(obj, Commands->Find_Object(401073), 0, 0);
  1137. Commands->Send_Custom_Event(obj, Commands->Find_Object(401074), 0, 0);
  1138. Commands->Send_Custom_Event(obj, Commands->Find_Object(401075), 0, 0);
  1139. Commands->Send_Custom_Event(obj, Commands->Find_Object(401076), 0, 0);
  1140. Commands->Send_Custom_Event(obj, Commands->Find_Object(401077), 0, 0);
  1141. Commands->Send_Custom_Event(obj, Commands->Find_Object(401078), 0, 0);
  1142. Commands->Send_Custom_Event(obj, Commands->Find_Object(401192), 0, 0);
  1143. Commands->Send_Custom_Event(obj, Commands->Find_Object(401193), 0, 0);
  1144. Commands->Send_Custom_Event(obj, Commands->Find_Object(401194), 0, 0);
  1145. Commands->Send_Custom_Event(obj, Commands->Find_Object(401195), 0, 0);
  1146. dual_zone = 401196;
  1147. destroy_zone = true;
  1148. break;
  1149. }
  1150. case (401079):
  1151. {
  1152. // Turn off A14, Turn on A15
  1153. Commands->Send_Custom_Event(obj, object, 105, 14);
  1154. Commands->Send_Custom_Event(obj, object, 104, 15);
  1155. // Tell A14 units to go to home points.
  1156. Vector3 obj_position = Commands->Get_Position (obj);
  1157. Commands->Create_Logical_Sound (obj, 1064, obj_position, 1000.0f);
  1158. // Turn on A15 Objectives
  1159. Commands->Send_Custom_Event(obj, object, 218, 0);
  1160. Commands->Send_Custom_Event(obj, object, 219, 0);
  1161. Commands->Send_Custom_Event(obj, object, 220, 0);
  1162. // Wake up A15 Units
  1163. Commands->Send_Custom_Event(obj, Commands->Find_Object(401089), 0, 0);
  1164. Commands->Send_Custom_Event(obj, Commands->Find_Object(401087), 0, 0);
  1165. Commands->Send_Custom_Event(obj, Commands->Find_Object(401086), 0, 0);
  1166. Commands->Send_Custom_Event(obj, Commands->Find_Object(401088), 0, 0);
  1167. Commands->Send_Custom_Event(obj, Commands->Find_Object(401085), 0, 0);
  1168. Commands->Send_Custom_Event(obj, Commands->Find_Object(401090), 0, 0);
  1169. Commands->Send_Custom_Event(obj, Commands->Find_Object(401091), 0, 0);
  1170. Commands->Send_Custom_Event(obj, Commands->Find_Object(401092), 0, 0);
  1171. Commands->Send_Custom_Event(obj, Commands->Find_Object(401094), 0, 0);
  1172. Commands->Send_Custom_Event(obj, Commands->Find_Object(401095), 0, 0);
  1173. Commands->Send_Custom_Event(obj, Commands->Find_Object(401096), 0, 0);
  1174. Commands->Send_Custom_Event(obj, Commands->Find_Object(401097), 0, 0);
  1175. Commands->Send_Custom_Event(obj, Commands->Find_Object(401189), 0, 0);
  1176. Commands->Send_Custom_Event(obj, Commands->Find_Object(401190), 0, 0);
  1177. Commands->Send_Custom_Event(obj, Commands->Find_Object(401191), 0, 0);
  1178. dual_zone = 401080;
  1179. destroy_zone = true;
  1180. break;
  1181. }
  1182. case (401080):
  1183. {
  1184. // Turn off A14, Turn on A15
  1185. Commands->Send_Custom_Event(obj, object, 105, 14);
  1186. Commands->Send_Custom_Event(obj, object, 104, 15);
  1187. // Tell A14 units to go to home points.
  1188. Vector3 obj_position = Commands->Get_Position (obj);
  1189. Commands->Create_Logical_Sound (obj, 1064, obj_position, 1000.0f);
  1190. // Turn on A15 Objectives
  1191. Commands->Send_Custom_Event(obj, object, 218, 0);
  1192. Commands->Send_Custom_Event(obj, object, 219, 0);
  1193. Commands->Send_Custom_Event(obj, object, 220, 0);
  1194. // Wake up A15 Units
  1195. Commands->Send_Custom_Event(obj, Commands->Find_Object(401089), 0, 0);
  1196. Commands->Send_Custom_Event(obj, Commands->Find_Object(401087), 0, 0);
  1197. Commands->Send_Custom_Event(obj, Commands->Find_Object(401086), 0, 0);
  1198. Commands->Send_Custom_Event(obj, Commands->Find_Object(401088), 0, 0);
  1199. Commands->Send_Custom_Event(obj, Commands->Find_Object(401085), 0, 0);
  1200. Commands->Send_Custom_Event(obj, Commands->Find_Object(401090), 0, 0);
  1201. Commands->Send_Custom_Event(obj, Commands->Find_Object(401091), 0, 0);
  1202. Commands->Send_Custom_Event(obj, Commands->Find_Object(401092), 0, 0);
  1203. Commands->Send_Custom_Event(obj, Commands->Find_Object(401094), 0, 0);
  1204. Commands->Send_Custom_Event(obj, Commands->Find_Object(401095), 0, 0);
  1205. Commands->Send_Custom_Event(obj, Commands->Find_Object(401096), 0, 0);
  1206. Commands->Send_Custom_Event(obj, Commands->Find_Object(401097), 0, 0);
  1207. Commands->Send_Custom_Event(obj, Commands->Find_Object(401189), 0, 0);
  1208. Commands->Send_Custom_Event(obj, Commands->Find_Object(401190), 0, 0);
  1209. Commands->Send_Custom_Event(obj, Commands->Find_Object(401191), 0, 0);
  1210. dual_zone = 401079;
  1211. destroy_zone = true;
  1212. break;
  1213. }
  1214. case (401101):
  1215. {
  1216. // Turn on Hand of Nod objective
  1217. Commands->Send_Custom_Event(obj, object, 204, 0);
  1218. // Tell A15 units to go to home points.
  1219. Vector3 obj_position = Commands->Get_Position (obj);
  1220. Commands->Create_Logical_Sound (obj, 1065, obj_position, 1000.0f);
  1221. // Turn off A15, Turn on A16 units - First HoN encounter set.
  1222. Commands->Send_Custom_Event(obj, Commands->Find_Object(401103), 0, 0);
  1223. Commands->Send_Custom_Event(obj, Commands->Find_Object(401104), 0, 0);
  1224. Commands->Send_Custom_Event(obj, Commands->Find_Object(401105), 0, 0);
  1225. Commands->Send_Custom_Event(obj, Commands->Find_Object(401106), 0, 0);
  1226. Commands->Send_Custom_Event(obj, Commands->Find_Object(401107), 0, 0);
  1227. Commands->Send_Custom_Event(obj, Commands->Find_Object(401108), 0, 0);
  1228. Commands->Send_Custom_Event(obj, Commands->Find_Object(401109), 0, 0);
  1229. Commands->Send_Custom_Event(obj, Commands->Find_Object(401110), 0, 0);
  1230. Commands->Send_Custom_Event(obj, Commands->Find_Object(401112), 0, 0);
  1231. dual_zone = 401102;
  1232. destroy_zone = true;
  1233. break;
  1234. }
  1235. case (401102):
  1236. {
  1237. // Turn on Hand of Nod objective
  1238. Commands->Send_Custom_Event(obj, object, 204, 0);
  1239. // Tell A15 units to go to home points.
  1240. Vector3 obj_position = Commands->Get_Position (obj);
  1241. Commands->Create_Logical_Sound (obj, 1065, obj_position, 1000.0f);
  1242. // Turn off A15, Turn on A16 units - First HoN encounter set.
  1243. Commands->Send_Custom_Event(obj, Commands->Find_Object(401103), 0, 0);
  1244. Commands->Send_Custom_Event(obj, Commands->Find_Object(401104), 0, 0);
  1245. Commands->Send_Custom_Event(obj, Commands->Find_Object(401105), 0, 0);
  1246. Commands->Send_Custom_Event(obj, Commands->Find_Object(401106), 0, 0);
  1247. Commands->Send_Custom_Event(obj, Commands->Find_Object(401107), 0, 0);
  1248. Commands->Send_Custom_Event(obj, Commands->Find_Object(401108), 0, 0);
  1249. Commands->Send_Custom_Event(obj, Commands->Find_Object(401109), 0, 0);
  1250. Commands->Send_Custom_Event(obj, Commands->Find_Object(401110), 0, 0);
  1251. Commands->Send_Custom_Event(obj, Commands->Find_Object(401112), 0, 0);
  1252. dual_zone = 401101;
  1253. destroy_zone = true;
  1254. break;
  1255. }
  1256. case (401113):
  1257. {
  1258. // Turn on A17 Units, Hand of Nod underside.
  1259. Commands->Send_Custom_Event(obj, Commands->Find_Object(401115), 0, 0);
  1260. Commands->Send_Custom_Event(obj, Commands->Find_Object(401116), 0, 0);
  1261. Commands->Send_Custom_Event(obj, Commands->Find_Object(401117), 0, 0);
  1262. Commands->Send_Custom_Event(obj, Commands->Find_Object(401118), 0, 0);
  1263. Commands->Send_Custom_Event(obj, Commands->Find_Object(401119), 0, 0);
  1264. Commands->Send_Custom_Event(obj, Commands->Find_Object(401120), 0, 0);
  1265. Commands->Send_Custom_Event(obj, Commands->Find_Object(401121), 0, 0);
  1266. Commands->Send_Custom_Event(obj, Commands->Find_Object(401122), 0, 0);
  1267. dual_zone = 401114;
  1268. destroy_zone = true;
  1269. break;
  1270. }
  1271. case (401114):
  1272. {
  1273. // Turn on A17 Units, Hand of Nod underside.
  1274. Commands->Send_Custom_Event(obj, Commands->Find_Object(401115), 0, 0);
  1275. Commands->Send_Custom_Event(obj, Commands->Find_Object(401116), 0, 0);
  1276. Commands->Send_Custom_Event(obj, Commands->Find_Object(401117), 0, 0);
  1277. Commands->Send_Custom_Event(obj, Commands->Find_Object(401118), 0, 0);
  1278. Commands->Send_Custom_Event(obj, Commands->Find_Object(401119), 0, 0);
  1279. Commands->Send_Custom_Event(obj, Commands->Find_Object(401120), 0, 0);
  1280. Commands->Send_Custom_Event(obj, Commands->Find_Object(401121), 0, 0);
  1281. Commands->Send_Custom_Event(obj, Commands->Find_Object(401122), 0, 0);
  1282. dual_zone = 401113;
  1283. destroy_zone = true;
  1284. break;
  1285. }
  1286. case (401123):
  1287. {
  1288. // Turn on A18 Units, Hand of Nod Lowest Level
  1289. Commands->Send_Custom_Event(obj, Commands->Find_Object(401124), 0, 0);
  1290. Commands->Send_Custom_Event(obj, Commands->Find_Object(401125), 0, 0);
  1291. Commands->Send_Custom_Event(obj, Commands->Find_Object(401126), 0, 0);
  1292. Commands->Send_Custom_Event(obj, Commands->Find_Object(401127), 0, 0);
  1293. Commands->Send_Custom_Event(obj, Commands->Find_Object(401128), 0, 0);
  1294. Commands->Send_Custom_Event(obj, Commands->Find_Object(401129), 0, 0);
  1295. destroy_zone = true;
  1296. break;
  1297. }
  1298. case (401130):
  1299. {
  1300. GameObject * controller = Commands->Find_Object (1157690);
  1301. if (controller)
  1302. {
  1303. float health = Commands->Get_Health (controller);
  1304. if (health)
  1305. {
  1306. Commands->Stop_All_Conversations ();
  1307. int id = Commands->Create_Conversation("M02_SECONDARY_01_GUIDE", 100, 300, true);
  1308. Commands->Join_Conversation(NULL, id);
  1309. Commands->Join_Conversation (STAR, id, true, false, false);
  1310. Commands->Start_Conversation(id);
  1311. }
  1312. }
  1313. // Turn on A19 Units, Hand of Nod area
  1314. Commands->Send_Custom_Event(obj, Commands->Find_Object(401132), 0, 0);
  1315. Commands->Send_Custom_Event(obj, Commands->Find_Object(401133), 0, 0);
  1316. Commands->Send_Custom_Event(obj, Commands->Find_Object(401134), 0, 0);
  1317. Commands->Send_Custom_Event(obj, Commands->Find_Object(401135), 0, 0);
  1318. Commands->Send_Custom_Event(obj, Commands->Find_Object(401136), 0, 0);
  1319. Commands->Send_Custom_Event(obj, Commands->Find_Object(401137), 0, 0);
  1320. Commands->Send_Custom_Event(obj, Commands->Find_Object(401138), 0, 0);
  1321. Commands->Send_Custom_Event(obj, Commands->Find_Object(401139), 0, 0);
  1322. dual_zone = 401131;
  1323. destroy_zone = true;
  1324. break;
  1325. }
  1326. case (401131):
  1327. {
  1328. GameObject * controller = Commands->Find_Object (1157690);
  1329. if (controller)
  1330. {
  1331. float health = Commands->Get_Health (controller);
  1332. if (health)
  1333. {
  1334. Commands->Stop_All_Conversations ();
  1335. int id = Commands->Create_Conversation("M02_SECONDARY_01_GUIDE", 100, 300, true);
  1336. Commands->Join_Conversation(NULL, id);
  1337. Commands->Join_Conversation (STAR, id, true, false, false);
  1338. Commands->Start_Conversation(id);
  1339. }
  1340. }
  1341. // Turn on A19 Units, Hand of Nod area
  1342. Commands->Send_Custom_Event(obj, Commands->Find_Object(401132), 0, 0);
  1343. Commands->Send_Custom_Event(obj, Commands->Find_Object(401133), 0, 0);
  1344. Commands->Send_Custom_Event(obj, Commands->Find_Object(401134), 0, 0);
  1345. Commands->Send_Custom_Event(obj, Commands->Find_Object(401135), 0, 0);
  1346. Commands->Send_Custom_Event(obj, Commands->Find_Object(401136), 0, 0);
  1347. Commands->Send_Custom_Event(obj, Commands->Find_Object(401137), 0, 0);
  1348. Commands->Send_Custom_Event(obj, Commands->Find_Object(401138), 0, 0);
  1349. Commands->Send_Custom_Event(obj, Commands->Find_Object(401139), 0, 0);
  1350. dual_zone = 401130;
  1351. destroy_zone = true;
  1352. break;
  1353. }
  1354. case (401186):
  1355. {
  1356. // Create the A15 Apache
  1357. Create_Apache(15);
  1358. // M02 Secondary 14 GUIDE Conversation
  1359. Commands->Stop_All_Conversations ();
  1360. int id = Commands->Create_Conversation("M02_SECONDARY_14_GUIDE", 100, 300, true);
  1361. Commands->Join_Conversation(NULL, id);
  1362. Commands->Join_Conversation (STAR, id, true, false, false);
  1363. Commands->Start_Conversation(id);
  1364. dual_zone = 401187;
  1365. destroy_zone = true;
  1366. break;
  1367. }
  1368. case (401187):
  1369. {
  1370. // Create the A15 Apache
  1371. Create_Apache(15);
  1372. // M02 Secondary 14 GUIDE Conversation
  1373. Commands->Stop_All_Conversations ();
  1374. int id = Commands->Create_Conversation("M02_SECONDARY_14_GUIDE", 100, 300, true);
  1375. Commands->Join_Conversation(NULL, id);
  1376. Commands->Join_Conversation (STAR, id, true, false, false);
  1377. Commands->Start_Conversation(id);
  1378. dual_zone = 401186;
  1379. destroy_zone = true;
  1380. break;
  1381. }
  1382. case (401196):
  1383. {
  1384. // Turn on A14, Turn off A11 as default.
  1385. Commands->Send_Custom_Event(obj, object, 105, 11);
  1386. Commands->Send_Custom_Event(obj, object, 104, 14);
  1387. // Tell A11 units to go to home points.
  1388. Vector3 obj_position = Commands->Get_Position (obj);
  1389. Commands->Create_Logical_Sound (obj, 1061, obj_position, 1000.0f);
  1390. // Wake up A14 units
  1391. Commands->Send_Custom_Event(obj, Commands->Find_Object(401071), 0, 0);
  1392. Commands->Send_Custom_Event(obj, Commands->Find_Object(401072), 0, 0);
  1393. Commands->Send_Custom_Event(obj, Commands->Find_Object(401073), 0, 0);
  1394. Commands->Send_Custom_Event(obj, Commands->Find_Object(401074), 0, 0);
  1395. Commands->Send_Custom_Event(obj, Commands->Find_Object(401075), 0, 0);
  1396. Commands->Send_Custom_Event(obj, Commands->Find_Object(401076), 0, 0);
  1397. Commands->Send_Custom_Event(obj, Commands->Find_Object(401077), 0, 0);
  1398. Commands->Send_Custom_Event(obj, Commands->Find_Object(401078), 0, 0);
  1399. Commands->Send_Custom_Event(obj, Commands->Find_Object(401192), 0, 0);
  1400. Commands->Send_Custom_Event(obj, Commands->Find_Object(401193), 0, 0);
  1401. Commands->Send_Custom_Event(obj, Commands->Find_Object(401194), 0, 0);
  1402. Commands->Send_Custom_Event(obj, Commands->Find_Object(401195), 0, 0);
  1403. dual_zone = 401070;
  1404. destroy_zone = true;
  1405. break;
  1406. }
  1407. case (401982):
  1408. {
  1409. Commands->Stop_All_Conversations ();
  1410. int id = Commands->Create_Conversation("M02_SECONDARY_13_START", 100, 300, true);
  1411. Commands->Join_Conversation(NULL, id);
  1412. Commands->Join_Conversation (STAR, id, true, false, false);
  1413. Commands->Start_Conversation(id);
  1414. // Fly the Lear Jet over
  1415. GameObject * lear_jet = Commands->Create_Object ("Nod_Jet", Vector3(929.91f,1132.34f,70.5f));
  1416. if (lear_jet)
  1417. {
  1418. Commands->Attach_Script (lear_jet, "M02_Nod_Jet", "");
  1419. }
  1420. destroy_zone = true;
  1421. break;
  1422. }
  1423. case (405116):
  1424. {
  1425. Commands->Stop_All_Conversations ();
  1426. int id = Commands->Create_Conversation("M02_OBELISK_APPROACH", 100, 300, true);
  1427. Commands->Join_Conversation(NULL, id);
  1428. Commands->Join_Conversation (STAR, id, true, false, false);
  1429. Commands->Start_Conversation(id);
  1430. destroy_zone = true;
  1431. break;
  1432. }
  1433. case (405117):
  1434. {
  1435. Commands->Stop_All_Conversations ();
  1436. int id = Commands->Create_Conversation("M02_PRIMARY_02_REMIND", 100, 300, true);
  1437. Commands->Join_Conversation(NULL, id);
  1438. Commands->Join_Conversation (STAR, id, true, false, false);
  1439. Commands->Start_Conversation(id);
  1440. destroy_zone = true;
  1441. break;
  1442. }
  1443. case (405118):
  1444. {
  1445. destroy_zone = true;
  1446. break;
  1447. }
  1448. case (405119):
  1449. {
  1450. Commands->Stop_All_Conversations ();
  1451. int id = Commands->Create_Conversation("M02_SECONDARY_03_START", 100, 300, true);
  1452. Commands->Join_Conversation(NULL, id);
  1453. Commands->Join_Conversation (STAR, id, true, false, false);
  1454. Commands->Start_Conversation(id);
  1455. destroy_zone = true;
  1456. break;
  1457. }
  1458. case (405120):
  1459. {
  1460. // Drop the A02 Mammoth Tank
  1461. Vector3 droploc = Vector3(570.06f,261.47f,-55.0f);
  1462. GameObject * chinook_obj1 = Commands->Create_Object("GDI_Mammoth_Tank_Player", droploc);
  1463. if (chinook_obj1)
  1464. {
  1465. Commands->Set_Facing (chinook_obj1, 45.0f);
  1466. Commands->Attach_Script(chinook_obj1, "M02_Player_Vehicle", "2");
  1467. }
  1468. destroy_zone = true;
  1469. break;
  1470. }
  1471. case (405122):
  1472. {
  1473. Commands->Stop_All_Conversations ();
  1474. int id = Commands->Create_Conversation("M02_SECONDARY_11_START", 100, 300, true);
  1475. Commands->Join_Conversation(NULL, id);
  1476. Commands->Join_Conversation (STAR, id, true, false, false);
  1477. Commands->Start_Conversation(id);
  1478. Commands->Start_Timer (obj, this, 6.0f, 12);
  1479. destroy_zone = true;
  1480. break;
  1481. }
  1482. }
  1483. if (dual_zone)
  1484. {
  1485. // Another zone is also associated with this trigger. Destroy it as well.
  1486. GameObject* dual_zone_obj = Commands->Find_Object(dual_zone);
  1487. if (dual_zone_obj)
  1488. {
  1489. Commands->Destroy_Object(dual_zone_obj);
  1490. }
  1491. }
  1492. if (destroy_zone)
  1493. {
  1494. Commands->Destroy_Object(obj);
  1495. }
  1496. }
  1497. }
  1498. void Check_For_Soldiers (GameObject* obj, int timer_id)
  1499. {
  1500. enemies_defeated = true;
  1501. Vector3 obj_position = Commands->Get_Position (obj);
  1502. Commands->Create_Logical_Sound (obj, 1000, obj_position, 70.0f);
  1503. Commands->Start_Timer(obj, this, 1.0f, timer_id);
  1504. }
  1505. void Timer_Expired(GameObject * obj, int timer_id)
  1506. {
  1507. if (timer_id == 3)
  1508. {
  1509. Send_and_Destroy (obj, 207);
  1510. }
  1511. else if (timer_id == 4)
  1512. {
  1513. Send_and_Destroy (obj, 208);
  1514. }
  1515. else if (timer_id == 5)
  1516. {
  1517. Send_and_Destroy (obj, 209);
  1518. }
  1519. else if (timer_id == 6)
  1520. {
  1521. Send_and_Destroy (obj, 210);
  1522. }
  1523. else if (timer_id == 7)
  1524. {
  1525. Send_and_Destroy (obj, 211);
  1526. }
  1527. else if (timer_id == 9)
  1528. {
  1529. // Teleport the star to the rooftop area.
  1530. Commands->Set_Position (STAR, Vector3(1190.268f,558.538f,32.5f));
  1531. // Create the Nod Jet and fly it out
  1532. GameObject * jet = Commands->Create_Object ("Nod_Jet", Vector3(1209.879f,528.647f,21.313f));
  1533. if (jet)
  1534. {
  1535. Commands->Attach_Script(jet, "M02_Nod_Jet_Waypath", "");
  1536. }
  1537. // Turn on objectives
  1538. GameObject * object = Commands->Find_Object (M02_OBJCONTROLLER);
  1539. if (object)
  1540. {
  1541. Commands->Control_Enable (STAR, true);
  1542. ActionParamsStruct params;
  1543. params.Set_Basic (this, 100, 0);
  1544. Commands->Action_Follow_Input (STAR, params);
  1545. Commands->Send_Custom_Event(obj, object, 201, 1);
  1546. Commands->Send_Custom_Event(obj, object, 205, 0);
  1547. //Turn on A21
  1548. Commands->Send_Custom_Event(obj, object, 104, 21);
  1549. // Wake up A21 units
  1550. Commands->Send_Custom_Event(obj, Commands->Find_Object(400277), 0, 0);
  1551. Commands->Send_Custom_Event(obj, Commands->Find_Object(401141), 0, 0);
  1552. Commands->Send_Custom_Event(obj, Commands->Find_Object(401142), 0, 0);
  1553. Commands->Send_Custom_Event(obj, Commands->Find_Object(401143), 0, 0);
  1554. Commands->Send_Custom_Event(obj, Commands->Find_Object(401144), 0, 0);
  1555. Commands->Send_Custom_Event(obj, Commands->Find_Object(401145), 0, 0);
  1556. Commands->Send_Custom_Event(obj, Commands->Find_Object(401146), 0, 0);
  1557. // Create Mendoza
  1558. GameObject * mendoza = Commands->Create_Object("Nod_FlameThrower_3Boss", Vector3(1260.007f,535.460f,18.428f));
  1559. if (mendoza)
  1560. {
  1561. Commands->Attach_Script(mendoza, "M02_Mendoza", "");
  1562. mendoza_id = Commands->Get_ID (mendoza);
  1563. GameObject * endzone = Commands->Find_Object (400194);
  1564. if (endzone)
  1565. {
  1566. Commands->Send_Custom_Event(obj, endzone, 999, mendoza_id);
  1567. }
  1568. }
  1569. Commands->Destroy_Object(obj);
  1570. }
  1571. }
  1572. else if (timer_id == 10)
  1573. {
  1574. GameObject * tank = Commands->Find_Object (401028);
  1575. if (tank)
  1576. {
  1577. Vector3 tank_pos = Commands->Get_Position (tank);
  1578. Vector3 my_pos = Commands->Get_Position (STAR);
  1579. float distance = Commands->Get_Distance (tank_pos, my_pos);
  1580. if (distance < 20.0f)
  1581. {
  1582. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0009", 100, 300, true);
  1583. Commands->Join_Conversation (NULL, id);
  1584. Commands->Join_Conversation (STAR, id, true, false, false);
  1585. Commands->Start_Conversation (id);
  1586. }
  1587. else
  1588. {
  1589. Commands->Start_Timer (obj, this, 2.0f, 10);
  1590. }
  1591. }
  1592. }
  1593. else if (timer_id == 11)
  1594. {
  1595. GameObject * tank = Commands->Find_Object (401028);
  1596. if (tank)
  1597. {
  1598. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0010", 100, 300, true);
  1599. Commands->Join_Conversation (NULL, id);
  1600. Commands->Join_Conversation (STAR, id, true, false, false);
  1601. Commands->Start_Conversation (id);
  1602. }
  1603. }
  1604. else if (timer_id == 12)
  1605. {
  1606. GameObject * tank = Commands->Find_Object (401036);
  1607. if (tank)
  1608. {
  1609. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0011", 100, 300, true);
  1610. Commands->Join_Conversation (NULL, id);
  1611. Commands->Join_Conversation (STAR, id, true, false, false);
  1612. Commands->Start_Conversation (id);
  1613. }
  1614. }
  1615. }
  1616. void Send_and_Destroy (GameObject *obj, int type)
  1617. {
  1618. if (enemies_defeated)
  1619. {
  1620. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  1621. if (object)
  1622. {
  1623. Commands->Send_Custom_Event(obj, object, type, 1);
  1624. enemies_defeated = false;
  1625. Commands->Destroy_Object(obj);
  1626. if (type == 207)
  1627. {
  1628. // Check if the commando needs a new vehicle.
  1629. Commands->Send_Custom_Event(obj, object, 111, 0);
  1630. // Tell the GDI rocket solders to go to the tower.
  1631. Vector3 obj_position = Commands->Get_Position (obj);
  1632. Commands->Create_Logical_Sound (obj, 1100, obj_position, 1000.0f);
  1633. }
  1634. else if (type == 210)
  1635. {
  1636. // Air drop GDI soldiers into A02
  1637. Call_GDI_Soldiers (2);
  1638. }
  1639. }
  1640. }
  1641. else if (!gave_secure_warning)
  1642. {
  1643. gave_secure_warning = true;
  1644. Commands->Stop_All_Conversations ();
  1645. int id = Commands->Create_Conversation("M02_EVAG_SECURE_WARNING", 100, 300, true);
  1646. Commands->Join_Conversation(NULL, id);
  1647. Commands->Join_Conversation (STAR, id, true, false, false);
  1648. Commands->Start_Conversation(id);
  1649. }
  1650. }
  1651. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1652. {
  1653. // Custom received from living units in an area.
  1654. if ((type == 100) && (param == 1))
  1655. {
  1656. enemies_defeated = false;
  1657. }
  1658. else if (type == 999)
  1659. {
  1660. if (param == 999)
  1661. {
  1662. GameObject * mendoza = Commands->Find_Object (mendoza_id);
  1663. if (mendoza)
  1664. {
  1665. mendoza_id = 0;
  1666. Commands->Destroy_Object (mendoza);
  1667. }
  1668. }
  1669. else
  1670. {
  1671. mendoza_id = param;
  1672. }
  1673. }
  1674. }
  1675. void Call_GDI_Soldiers (int area_id)
  1676. {
  1677. Vector3 drop_loc = Vector3(0.0f,0.0f,0.0f);
  1678. float facing = 0.0f;
  1679. const char* textfile = "X2I_GDI_Drop02_Rocket.txt";
  1680. switch (area_id)
  1681. {
  1682. case (0):
  1683. {
  1684. drop_loc = Vector3(-10.6f,-25.1f,-38.2f);
  1685. facing = 70.5f;
  1686. textfile = "X2I_GDI_Drop02_Rocket.txt";
  1687. break;
  1688. }
  1689. case (2):
  1690. {
  1691. drop_loc = Vector3(664.70f,312.57f,-59.65f);
  1692. facing = -150.0f;
  1693. textfile = "X2I_GDI_Drop02_Rocket_2.txt";
  1694. break;
  1695. }
  1696. case (9): // Dam Top Rush
  1697. {
  1698. drop_loc = Vector3(869.320f,912.316f,30.150f);
  1699. facing = 110.0f;
  1700. textfile = "X2I_GDI_Drop03_Minigunner.txt";
  1701. break;
  1702. }
  1703. }
  1704. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  1705. if (chinook_obj1)
  1706. {
  1707. Commands->Set_Facing(chinook_obj1, facing);
  1708. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", textfile);
  1709. }
  1710. }
  1711. void Create_Apache (int area_id)
  1712. {
  1713. GameObject *helipad = Commands->Find_Object(474463);
  1714. if (helipad)
  1715. {
  1716. // This will stop working when the Power Plant goes down, but it won't matter by that time.
  1717. float currenthealth = Commands->Get_Health (helipad);
  1718. if (((Commands->Get_Building_Power (helipad)) && (currenthealth > 0.0f)) || (area_id == 15))
  1719. {
  1720. Vector3 create_pos = Vector3(0.0f, 0.0f, 0.0f);
  1721. float facing = 0.0f;
  1722. const char* apache_params = "0";
  1723. switch(area_id)
  1724. {
  1725. case (0):
  1726. {
  1727. create_pos = Vector3(138.36f, -5.61f, -12.20f);
  1728. facing = -80.0f;
  1729. apache_params = "0";
  1730. break;
  1731. }
  1732. case (15):
  1733. {
  1734. create_pos = Vector3(1300.898f,657.717f,67.364f);
  1735. facing = 0.0f;
  1736. apache_params = "15";
  1737. break;
  1738. }
  1739. case (24):
  1740. {
  1741. create_pos = Vector3(610.03f,1036.35f,-15.676f);
  1742. facing = 0.0f;
  1743. apache_params = "24";
  1744. break;
  1745. }
  1746. }
  1747. GameObject * apache = Commands->Create_Object("Nod_Apache", create_pos);
  1748. if (apache)
  1749. {
  1750. Commands->Set_Facing(apache, facing);
  1751. Commands->Attach_Script(apache, "M02_Nod_Apache", apache_params);
  1752. }
  1753. }
  1754. }
  1755. }
  1756. void Create_Light_Tank (int area_id)
  1757. {
  1758. Vector3 create_pos = Vector3(465.645f, 715.86f, -14.935f);
  1759. float facing = -10.0f;
  1760. const char* tank_params = "3";
  1761. GameObject * tank = Commands->Create_Object("Nod_Light_Tank", create_pos);
  1762. if (tank)
  1763. {
  1764. Commands->Set_Facing(tank, facing);
  1765. Commands->Attach_Script(tank, "M02_Nod_Vehicle", tank_params);
  1766. }
  1767. }
  1768. void Create_Sakura (int area_id)
  1769. {
  1770. GameObject *helipad = Commands->Find_Object(474463);
  1771. if (helipad)
  1772. {
  1773. float currenthealth = Commands->Get_Health (helipad);
  1774. if ((Commands->Get_Building_Power (helipad)) && (currenthealth > 0.0f))
  1775. {
  1776. Vector3 create_pos = Vector3(509.362f,473.582f,-40.0f);
  1777. float facing = 0.0f;
  1778. const char* sakura_params = "2";
  1779. GameObject * sakura = Commands->Create_Object("Nod_Apache", create_pos);
  1780. if (sakura)
  1781. {
  1782. Commands->Set_Facing(sakura, facing);
  1783. Commands->Attach_Script(sakura, "M02_Nod_Sakura", sakura_params);
  1784. }
  1785. }
  1786. }
  1787. }
  1788. void Create_Buggy (int area_id)
  1789. {
  1790. Vector3 create_pos = Vector3(0.0f, 0.0f, 0.0f);
  1791. float facing = 0.0f;
  1792. const char* buggy_params = "0";
  1793. switch (area_id)
  1794. {
  1795. case (2):
  1796. {
  1797. create_pos = Vector3(674.622f,308.296f,-61.674f);
  1798. facing = -90.0f;
  1799. buggy_params = "2";
  1800. break;
  1801. }
  1802. case (4):
  1803. {
  1804. create_pos = Vector3(366.209f,861.401f,6.488f);
  1805. facing = -110.0f;
  1806. buggy_params = "4";
  1807. break;
  1808. }
  1809. }
  1810. GameObject * buggy = Commands->Create_Object("Nod_Buggy", create_pos);
  1811. if (buggy)
  1812. {
  1813. Commands->Set_Facing(buggy, facing);
  1814. Commands->Attach_Script(buggy, "M02_Nod_Vehicle", buggy_params);
  1815. }
  1816. }
  1817. };
  1818. DECLARE_SCRIPT (M02_Respawn_Controller, "")
  1819. {
  1820. bool active_area [M02_AREACOUNT];
  1821. bool area_spawn_heli_drop_01_active [M02_AREACOUNT];
  1822. bool area_spawn_heli_drop_02_active [M02_AREACOUNT];
  1823. bool area_spawn_parachute_active [M02_AREACOUNT];
  1824. char area_unit_count [M02_AREACOUNT];
  1825. char area_unit_max [M02_AREACOUNT];
  1826. int area_officer [M02_AREACOUNT];
  1827. int spawner_rotator;
  1828. int replacement_vehicle;
  1829. int destroyed_sam;
  1830. int destroyed_silo;
  1831. REGISTER_VARIABLES()
  1832. {
  1833. SAVE_VARIABLE( active_area, 1);
  1834. SAVE_VARIABLE( area_spawn_heli_drop_01_active, 2);
  1835. SAVE_VARIABLE( area_spawn_heli_drop_02_active, 3);
  1836. SAVE_VARIABLE( area_spawn_parachute_active, 4);
  1837. SAVE_VARIABLE( area_unit_count, 5);
  1838. SAVE_VARIABLE( area_unit_max, 6);
  1839. SAVE_VARIABLE( area_officer, 7);
  1840. SAVE_VARIABLE( spawner_rotator, 8);
  1841. SAVE_VARIABLE( replacement_vehicle, 9);
  1842. SAVE_VARIABLE( destroyed_sam, 10);
  1843. SAVE_VARIABLE( destroyed_silo, 11);
  1844. }
  1845. void Created (GameObject *obj)
  1846. {
  1847. int counter;
  1848. counter = 0;
  1849. spawner_rotator = 0;
  1850. replacement_vehicle = -1;
  1851. destroyed_sam = 0;
  1852. destroyed_silo = 0;
  1853. while (counter < ARRAY_ELEMENT_COUNT(active_area))
  1854. {
  1855. active_area [counter] = false;
  1856. area_unit_count [counter] = 0;
  1857. area_officer [counter] = 0;
  1858. area_unit_max [counter] = 8;
  1859. area_spawn_heli_drop_01_active [counter] = false;
  1860. area_spawn_heli_drop_02_active [counter] = false;
  1861. area_spawn_parachute_active [counter] = false;
  1862. // Turning the actives to true in here means they do not occur in the area
  1863. // provided you don't turn them off later on in the mission.
  1864. switch (counter)
  1865. {
  1866. case (1):
  1867. {
  1868. area_unit_max [counter] = 7;
  1869. break;
  1870. }
  1871. case (2):
  1872. {
  1873. area_unit_max [counter] = 7;
  1874. break;
  1875. }
  1876. case (3):
  1877. {
  1878. area_unit_max [counter] = 5;
  1879. break;
  1880. }
  1881. case (6):
  1882. {
  1883. area_unit_max [counter] = 6;
  1884. break;
  1885. }
  1886. case (8):
  1887. {
  1888. area_spawn_heli_drop_01_active [counter] = true;
  1889. area_spawn_heli_drop_02_active [counter] = true;
  1890. area_spawn_parachute_active [counter] = true;
  1891. area_unit_max [counter] = 3;
  1892. break;
  1893. }
  1894. case (9):
  1895. {
  1896. area_unit_max [counter] = 7;
  1897. break;
  1898. }
  1899. case (10):
  1900. {
  1901. area_spawn_parachute_active [counter] = true;
  1902. break;
  1903. }
  1904. case (11):
  1905. {
  1906. area_spawn_heli_drop_01_active [counter] = true;
  1907. area_spawn_heli_drop_02_active [counter] = true;
  1908. area_spawn_parachute_active [counter] = true;
  1909. area_unit_max [counter] = 3;
  1910. break;
  1911. }
  1912. case (14):
  1913. {
  1914. area_spawn_heli_drop_01_active [counter] = true;
  1915. area_spawn_heli_drop_02_active [counter] = true;
  1916. area_spawn_parachute_active [counter] = true;
  1917. area_unit_max [counter] = 3;
  1918. break;
  1919. }
  1920. case (15):
  1921. {
  1922. area_spawn_heli_drop_01_active [counter] = true;
  1923. area_spawn_heli_drop_02_active [counter] = true;
  1924. area_spawn_parachute_active [counter] = true;
  1925. area_unit_max [counter] = 3;
  1926. break;
  1927. }
  1928. case (21):
  1929. {
  1930. area_unit_max [counter] = 5;
  1931. break;
  1932. }
  1933. case (24):
  1934. {
  1935. area_spawn_heli_drop_01_active [counter] = true;
  1936. area_spawn_heli_drop_02_active [counter] = true;
  1937. area_spawn_parachute_active [counter] = true;
  1938. area_unit_max [counter] = 3;
  1939. break;
  1940. }
  1941. }
  1942. counter++;
  1943. }
  1944. // Create the GDI Transport Helicopter and fly it out of scene.
  1945. GameObject * helicopter = Commands->Create_Object ("GDI_Transport_Helicopter", Vector3(-26.87f,37.42f,20.75f));
  1946. if (helicopter)
  1947. {
  1948. Commands->Set_Facing (helicopter, -155.0f);
  1949. Commands->Attach_Script (helicopter, "M02_GDI_Helicopter", "");
  1950. }
  1951. // Drop the first Humm-Vee into the start area.
  1952. Call_GDI_HummVee (0);
  1953. // Wake up the A25 units.
  1954. Commands->Send_Custom_Event(obj, Commands->Find_Object(400985), 0, 0);
  1955. // Call the ORCA strike intro.
  1956. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1957. if (chinook_obj1)
  1958. {
  1959. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2A_OrcaStrike.txt");
  1960. }
  1961. Commands->Start_Timer(obj, this, 3.0f, 2);
  1962. }
  1963. void Call_GDI_HummVee (int area_id)
  1964. {
  1965. Vector3 drop_loc = Vector3(-87.2f,-13.1f,-40.1f);
  1966. float facing = 102.9f;
  1967. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  1968. if (chinook_obj1)
  1969. {
  1970. Commands->Set_Facing(chinook_obj1, facing);
  1971. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2I_GDI_Drop_HummVee.txt");
  1972. }
  1973. }
  1974. void Call_GDI_PowerUp (int area_id)
  1975. {
  1976. Vector3 drop_loc = Vector3(511.3f,680.3f,-21.2f);
  1977. float facing = 146.6f;
  1978. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  1979. if (chinook_obj1)
  1980. {
  1981. Commands->Set_Facing(chinook_obj1, facing);
  1982. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2I_GDI_Drop_PowerUp.txt");
  1983. }
  1984. }
  1985. void Timer_Expired(GameObject * obj, int timer_id)
  1986. {
  1987. if (timer_id == 2)
  1988. {
  1989. // Count through each area, check if it is active.
  1990. int counter;
  1991. counter = 0;
  1992. while (counter < ARRAY_ELEMENT_COUNT(active_area))
  1993. {
  1994. if (active_area[counter])
  1995. {
  1996. // Check if the area still has an officer associated.
  1997. if (area_officer[counter])
  1998. {
  1999. GameObject* officer = Commands->Find_Object(area_officer[counter]);
  2000. if (officer)
  2001. {
  2002. Check_Respawns (counter);
  2003. }
  2004. }
  2005. }
  2006. counter++;
  2007. }
  2008. int players_difficulty = Commands->Get_Difficulty_Level();
  2009. float timer_length = 25 - (10 * (players_difficulty));
  2010. Commands->Start_Timer(obj, this, timer_length, 2);
  2011. }
  2012. }
  2013. void Check_Respawns (int area_id)
  2014. {
  2015. // Can this particular area handle respawns?
  2016. // Count through the spawn sequence until all units have been accounted for.
  2017. int counter;
  2018. int stop_point;
  2019. bool stopped_counter;
  2020. int spawner_buffer = 0;
  2021. stopped_counter = false;
  2022. counter = Get_Int_Random(0,2);
  2023. stop_point = counter;
  2024. int tempcount = area_unit_count[area_id];
  2025. while (tempcount < area_unit_max [area_id])
  2026. {
  2027. if (!stopped_counter)
  2028. {
  2029. // Check which respawn type I can use.
  2030. switch (counter)
  2031. {
  2032. case (0):
  2033. {
  2034. if (!area_spawn_heli_drop_01_active[area_id])
  2035. {
  2036. if ((area_unit_max[area_id] - tempcount) > 2)
  2037. {
  2038. area_spawn_heli_drop_01_active[area_id] = true;
  2039. tempcount += 3;
  2040. Use_Heli_Drop_01(area_id);
  2041. }
  2042. }
  2043. break;
  2044. }
  2045. case (1):
  2046. {
  2047. if (!area_spawn_heli_drop_02_active[area_id])
  2048. {
  2049. if ((area_unit_max[area_id] - tempcount) > 1)
  2050. {
  2051. area_spawn_heli_drop_02_active[area_id] = true;
  2052. tempcount += 2;
  2053. Use_Heli_Drop_02(area_id);
  2054. }
  2055. }
  2056. break;
  2057. }
  2058. case (2):
  2059. {
  2060. if (!area_spawn_parachute_active[area_id])
  2061. {
  2062. if ((area_unit_max[area_id] - tempcount) > 2)
  2063. {
  2064. area_spawn_parachute_active[area_id] = true;
  2065. Use_Parachute_Drop(area_id);
  2066. tempcount += 3;
  2067. }
  2068. }
  2069. break;
  2070. }
  2071. }
  2072. }
  2073. else
  2074. {
  2075. spawner_buffer++;
  2076. if (spawner_buffer < 3)
  2077. {
  2078. tempcount ++;
  2079. Use_Spawners (area_id);
  2080. }
  2081. else
  2082. {
  2083. tempcount = area_unit_max[area_id];
  2084. }
  2085. }
  2086. if (!stopped_counter)
  2087. {
  2088. counter++;
  2089. if (counter > 2)
  2090. {
  2091. counter = 0;
  2092. }
  2093. if (counter == stop_point)
  2094. {
  2095. stopped_counter = true;
  2096. }
  2097. }
  2098. }
  2099. }
  2100. // This uses a helicopter to drop three units.
  2101. void Use_Heli_Drop_01 (int area_id)
  2102. {
  2103. Vector3 drop_location;
  2104. float facing;
  2105. const char* cinematic;
  2106. const char* textfile;
  2107. const char* parameters;
  2108. cinematic = "Test_Cinematic";
  2109. textfile = "X2I_Drop03_Area00.txt";
  2110. parameters = "0,107";
  2111. drop_location = Vector3(0.0f,0.0f,0.0f);
  2112. facing = 0.0f;
  2113. switch (area_id)
  2114. {
  2115. case (0): // A00 Guard Tower
  2116. {
  2117. parameters = "0,107";
  2118. textfile = "X2I_Drop03_Area00.txt";
  2119. drop_location = Vector3(119.5f,6.1f,-19.7f);
  2120. facing = 140.0f;
  2121. break;
  2122. }
  2123. case (1):
  2124. {
  2125. parameters = "1,107";
  2126. textfile = "X2I_Drop03_Area01.txt";
  2127. drop_location = Vector3(515.5f,17.1f,-58.9f);
  2128. facing = 51.3f;
  2129. break;
  2130. }
  2131. case (2):
  2132. {
  2133. parameters = "2,107";
  2134. textfile = "X2I_Drop03_Area02.txt";
  2135. drop_location = Vector3(619.9f,310.4f,-59.9f);
  2136. facing = 0.0f;
  2137. break;
  2138. }
  2139. case (3):
  2140. {
  2141. parameters = "3,107";
  2142. textfile = "X2I_Drop03_Area03.txt";
  2143. drop_location = Vector3(530.4f,690.8f,-19.2f);
  2144. facing = -22.8f;
  2145. break;
  2146. }
  2147. case (4):
  2148. {
  2149. parameters = "4,107";
  2150. textfile = "X2I_Drop03_Area04.txt";
  2151. drop_location = Vector3(461.5f,908.0f,5.3f);
  2152. facing = -102.4f;
  2153. break;
  2154. }
  2155. case (6):
  2156. {
  2157. parameters = "6,107";
  2158. textfile = "X2I_Drop03_Area06.txt";
  2159. drop_location = Vector3(772.1f,969.6f,21.4f);
  2160. facing = 163.2f;
  2161. break;
  2162. }
  2163. case (9):
  2164. {
  2165. parameters = "9,107";
  2166. textfile = "X2I_Drop03_Area09.txt";
  2167. drop_location = Vector3(957.638f,879.421f,34.220f);
  2168. facing = 55.0f;
  2169. break;
  2170. }
  2171. case (10):
  2172. {
  2173. parameters = "10,107";
  2174. textfile = "X2I_Drop03_Area10.txt";
  2175. drop_location = Vector3(1044.01f,947.144f,-37.816f);
  2176. facing = -83.5f;
  2177. break;
  2178. }
  2179. case (11):
  2180. {
  2181. parameters = "11,107";
  2182. textfile = "X2I_Drop03_Area11.txt";
  2183. drop_location = Vector3(1072.776f,997.836f,6.492f);
  2184. facing = -35.0f;
  2185. break;
  2186. }
  2187. case (21):
  2188. {
  2189. parameters = "21,107";
  2190. textfile = "X2I_Drop03_Area21.txt";
  2191. drop_location = Vector3(1173.998f,478.803f,22.657f);
  2192. facing = 55.0f;
  2193. break;
  2194. }
  2195. }
  2196. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_location);
  2197. if (chinook_obj1)
  2198. {
  2199. Commands->Set_Facing(chinook_obj1, facing);
  2200. Commands->Attach_Script(chinook_obj1, "M02_Reset_Spawn", parameters);
  2201. Commands->Attach_Script(chinook_obj1, cinematic, textfile);
  2202. }
  2203. }
  2204. // This uses a different helicopter route to drop two units.
  2205. void Use_Heli_Drop_02 (int area_id)
  2206. {
  2207. Vector3 drop_location;
  2208. float facing;
  2209. const char* cinematic;
  2210. const char* textfile;
  2211. const char* parameters;
  2212. cinematic = "Test_Cinematic";
  2213. textfile = "X2I_Drop02_Area00.txt";
  2214. parameters = "0,108";
  2215. drop_location = Vector3(0.0f,0.0f,0.0f);
  2216. facing = 0.0f;
  2217. switch (area_id)
  2218. {
  2219. case (0):
  2220. {
  2221. parameters = "0,108";
  2222. textfile = "X2I_Drop02_Area00.txt";
  2223. drop_location = Vector3(99.4f,-13.8f,-28.4f);
  2224. facing = 25.1f;
  2225. break;
  2226. }
  2227. case (1):
  2228. {
  2229. parameters = "1,108";
  2230. textfile = "X2I_Drop02_Area01.txt";
  2231. drop_location = Vector3(522.4f,128.1f,-58.7f);
  2232. facing = -133.9f;
  2233. break;
  2234. }
  2235. case (2):
  2236. {
  2237. parameters = "2,108";
  2238. textfile = "X2I_Drop02_Area02.txt";
  2239. drop_location = Vector3(614.8f,278.9f,-52.3f);
  2240. facing = 22.8f;
  2241. break;
  2242. }
  2243. case (3):
  2244. {
  2245. parameters = "3,108";
  2246. textfile = "X2I_Drop02_Area03.txt";
  2247. drop_location = Vector3(506.11f,567.12f,-39.60f);
  2248. facing = 66.9f;
  2249. break;
  2250. }
  2251. case (4):
  2252. {
  2253. parameters = "4,108";
  2254. textfile = "X2I_Drop02_Area04.txt";
  2255. drop_location = Vector3(471.1f,854.9f,3.7f);
  2256. facing = -171.2f;
  2257. break;
  2258. }
  2259. case (6):
  2260. {
  2261. parameters = "6,108";
  2262. textfile = "X2I_Drop02_Area06.txt";
  2263. drop_location = Vector3(786.0f,1032.3f,21.3f);
  2264. facing = 168.7f;
  2265. break;
  2266. }
  2267. case (9):
  2268. {
  2269. parameters = "9,108";
  2270. textfile = "X2I_Drop02_Area09.txt";
  2271. drop_location = Vector3(1047.111f,879.541f,34.220f);
  2272. facing = 140.0f;
  2273. break;
  2274. }
  2275. case (10):
  2276. {
  2277. parameters = "10,108";
  2278. textfile = "X2I_Drop02_Area10.txt";
  2279. drop_location = Vector3(970.504f,941.132f,-37.812f);
  2280. facing = -130.0f;
  2281. break;
  2282. }
  2283. case (11):
  2284. {
  2285. parameters = "11,108";
  2286. textfile = "X2I_Drop02_Area11.txt";
  2287. drop_location = Vector3(1092.028f,975.856f,4.14f);
  2288. facing = 15.0f;
  2289. break;
  2290. }
  2291. case (21):
  2292. {
  2293. parameters = "21,108";
  2294. textfile = "X2I_Drop02_Area21.txt";
  2295. drop_location = Vector3(1173.369f,562.608f,32.394f);
  2296. facing = 0.0f;
  2297. break;
  2298. }
  2299. }
  2300. GameObject * chinook_obj2 = Commands->Create_Object("Invisible_Object", drop_location);
  2301. if (chinook_obj2)
  2302. {
  2303. Commands->Set_Facing(chinook_obj2, facing);
  2304. Commands->Attach_Script(chinook_obj2, "M02_Reset_Spawn", parameters);
  2305. Commands->Attach_Script(chinook_obj2, cinematic, textfile);
  2306. }
  2307. }
  2308. // This uses a cargo plane parachute drop to drop three units.
  2309. void Use_Parachute_Drop (int area_id)
  2310. {
  2311. Vector3 drop_location;
  2312. float facing;
  2313. const char* cinematic;
  2314. const char* textfile;
  2315. const char* parameters;
  2316. cinematic = "Test_Cinematic";
  2317. textfile = "X2I_Para03_Area00.txt";
  2318. parameters = "0,109";
  2319. drop_location = Vector3(0.0f,0.0f,0.0f);
  2320. facing = 0.0f;
  2321. switch (area_id)
  2322. {
  2323. case (0):
  2324. {
  2325. textfile = "X2I_Para03_Area00.txt";
  2326. parameters = "0,109";
  2327. drop_location = Vector3(119.5f,38.2f,-15.6f);
  2328. facing = -144.9f;
  2329. break;
  2330. }
  2331. case (1):
  2332. {
  2333. textfile = "X2I_Para03_Area01.txt";
  2334. parameters = "1,109";
  2335. drop_location = Vector3(509.7f,78.3f,-55.2f);
  2336. facing = -73.7f;
  2337. break;
  2338. }
  2339. case (2):
  2340. {
  2341. textfile = "X2I_Para03_Area02.txt";
  2342. parameters = "2,109";
  2343. drop_location = Vector3(598.7f,342.2f,-62.7f);
  2344. facing = -119.1f;
  2345. break;
  2346. }
  2347. case (3):
  2348. {
  2349. textfile = "X2I_Para03_Area03.txt";
  2350. parameters = "3,109";
  2351. drop_location = Vector3(488.2f,608.4f,-41.2f);
  2352. facing = -158.2f;
  2353. break;
  2354. }
  2355. case (4):
  2356. {
  2357. textfile = "X2I_Para03_Area04.txt";
  2358. parameters = "4,109";
  2359. drop_location = Vector3(371.1f,794.0f,3.7f);
  2360. facing = 90.0f;
  2361. break;
  2362. }
  2363. case (6):
  2364. {
  2365. textfile = "X2I_Para03_Area06.txt";
  2366. parameters = "6,109";
  2367. drop_location = Vector3(765.5f,1004.0f,21.4f);
  2368. facing = -14.4f;
  2369. break;
  2370. }
  2371. case (9):
  2372. {
  2373. textfile = "X2I_Para03_Area09.txt";
  2374. parameters = "9,109";
  2375. drop_location = Vector3(1028.1f,876.4f,34.2f);
  2376. facing = 87.2f;
  2377. break;
  2378. }
  2379. case (21):
  2380. {
  2381. textfile = "X2I_Para03_Area21.txt";
  2382. parameters = "21,109";
  2383. drop_location = Vector3(1255.732f,565.134f,17.602f);
  2384. facing = 150.0f;
  2385. break;
  2386. }
  2387. }
  2388. GameObject * plane_obj = Commands->Create_Object("Invisible_Object", drop_location);
  2389. if (plane_obj)
  2390. {
  2391. Commands->Set_Facing(plane_obj, facing);
  2392. Commands->Attach_Script(plane_obj, "M02_Reset_Spawn", parameters);
  2393. Commands->Attach_Script(plane_obj, cinematic, textfile);
  2394. }
  2395. }
  2396. // This uses the regular spawners to generate one unit.
  2397. bool Use_Spawners (int area_id)
  2398. {
  2399. int spawner_id;
  2400. const char *spawner_params;
  2401. spawner_id = 0;
  2402. spawner_params = "0,0,-1";
  2403. spawner_rotator++;
  2404. if (spawner_rotator > 2)
  2405. {
  2406. spawner_rotator = 0;
  2407. }
  2408. switch (area_id)
  2409. {
  2410. case (0):
  2411. {
  2412. switch (spawner_rotator)
  2413. {
  2414. case (0):
  2415. {
  2416. spawner_id = 400233;
  2417. break;
  2418. }
  2419. case (1):
  2420. {
  2421. spawner_id = 400236;
  2422. break;
  2423. }
  2424. default:
  2425. {
  2426. spawner_id = 400237;
  2427. break;
  2428. }
  2429. }
  2430. spawner_params = "0,0,-1";
  2431. break;
  2432. }
  2433. case (1):
  2434. {
  2435. switch (spawner_rotator)
  2436. {
  2437. case (0):
  2438. {
  2439. spawner_id = 400234;
  2440. break;
  2441. }
  2442. case (1):
  2443. {
  2444. spawner_id = 400238;
  2445. break;
  2446. }
  2447. default:
  2448. {
  2449. spawner_id = 400239;
  2450. break;
  2451. }
  2452. }
  2453. spawner_params = "1,0,-1";
  2454. break;
  2455. }
  2456. case (2):
  2457. {
  2458. switch (spawner_rotator)
  2459. {
  2460. case (0):
  2461. {
  2462. spawner_id = 400235;
  2463. break;
  2464. }
  2465. case (1):
  2466. {
  2467. spawner_id = 400240;
  2468. break;
  2469. }
  2470. default:
  2471. {
  2472. spawner_id = 400241;
  2473. break;
  2474. }
  2475. }
  2476. spawner_params = "2,0,-1";
  2477. break;
  2478. }
  2479. case (3):
  2480. {
  2481. switch (spawner_rotator)
  2482. {
  2483. case (0):
  2484. {
  2485. spawner_id = 400242;
  2486. break;
  2487. }
  2488. case (1):
  2489. {
  2490. spawner_id = 400243;
  2491. break;
  2492. }
  2493. default:
  2494. {
  2495. spawner_id = 400244;
  2496. break;
  2497. }
  2498. }
  2499. spawner_params = "3,0,-1";
  2500. break;
  2501. }
  2502. case (4):
  2503. {
  2504. switch (spawner_rotator)
  2505. {
  2506. case (0):
  2507. {
  2508. spawner_id = 400245;
  2509. break;
  2510. }
  2511. case (1):
  2512. {
  2513. spawner_id = 400246;
  2514. break;
  2515. }
  2516. default:
  2517. {
  2518. spawner_id = 400247;
  2519. break;
  2520. }
  2521. }
  2522. spawner_params = "4,0,-1";
  2523. break;
  2524. }
  2525. case (6):
  2526. {
  2527. switch (spawner_rotator)
  2528. {
  2529. case (0):
  2530. {
  2531. spawner_id = 400248;
  2532. break;
  2533. }
  2534. case (1):
  2535. {
  2536. spawner_id = 400249;
  2537. break;
  2538. }
  2539. default:
  2540. {
  2541. spawner_id = 400250;
  2542. break;
  2543. }
  2544. }
  2545. spawner_params = "6,0,-1";
  2546. break;
  2547. }
  2548. case (8):
  2549. {
  2550. switch (spawner_rotator)
  2551. {
  2552. case (0):
  2553. {
  2554. spawner_id = 400261;
  2555. break;
  2556. }
  2557. case (1):
  2558. {
  2559. spawner_id = 400262;
  2560. break;
  2561. }
  2562. default:
  2563. {
  2564. spawner_id = 400263;
  2565. break;
  2566. }
  2567. }
  2568. spawner_params = "8,0,-1";
  2569. break;
  2570. }
  2571. case (9):
  2572. {
  2573. switch (spawner_rotator)
  2574. {
  2575. case (0):
  2576. {
  2577. spawner_id = 400251;
  2578. break;
  2579. }
  2580. case (1):
  2581. {
  2582. spawner_id = 400252;
  2583. break;
  2584. }
  2585. default:
  2586. {
  2587. spawner_id = 400253;
  2588. break;
  2589. }
  2590. }
  2591. spawner_params = "9,0,-1";
  2592. break;
  2593. }
  2594. case (10):
  2595. {
  2596. switch (spawner_rotator)
  2597. {
  2598. case (0):
  2599. {
  2600. spawner_id = 400254;
  2601. break;
  2602. }
  2603. case (1):
  2604. {
  2605. spawner_id = 400255;
  2606. break;
  2607. }
  2608. default:
  2609. {
  2610. spawner_id = 400256;
  2611. break;
  2612. }
  2613. }
  2614. spawner_params = "10,0,-1";
  2615. break;
  2616. }
  2617. case (11):
  2618. {
  2619. switch (spawner_rotator)
  2620. {
  2621. case (0):
  2622. {
  2623. spawner_id = 400257;
  2624. break;
  2625. }
  2626. case (1):
  2627. {
  2628. spawner_id = 400258;
  2629. break;
  2630. }
  2631. default:
  2632. {
  2633. spawner_id = 400259;
  2634. break;
  2635. }
  2636. }
  2637. spawner_params = "11,0,-1";
  2638. break;
  2639. }
  2640. case (14):
  2641. {
  2642. switch (spawner_rotator)
  2643. {
  2644. case (0):
  2645. {
  2646. spawner_id = 401081;
  2647. break;
  2648. }
  2649. case (1):
  2650. {
  2651. spawner_id = 401082;
  2652. break;
  2653. }
  2654. default:
  2655. {
  2656. spawner_id = 401083;
  2657. break;
  2658. }
  2659. }
  2660. spawner_params = "14,0,-1";
  2661. break;
  2662. }
  2663. case (15):
  2664. {
  2665. switch (spawner_rotator)
  2666. {
  2667. case (0):
  2668. {
  2669. spawner_id = 401098;
  2670. break;
  2671. }
  2672. case (1):
  2673. {
  2674. spawner_id = 401099;
  2675. break;
  2676. }
  2677. default:
  2678. {
  2679. spawner_id = 401100;
  2680. break;
  2681. }
  2682. }
  2683. spawner_params = "15,0,-1";
  2684. break;
  2685. }
  2686. case (21):
  2687. {
  2688. switch (spawner_rotator)
  2689. {
  2690. case (0):
  2691. {
  2692. spawner_id = 400264;
  2693. break;
  2694. }
  2695. case (1):
  2696. {
  2697. spawner_id = 400265;
  2698. break;
  2699. }
  2700. default:
  2701. {
  2702. spawner_id = 400266;
  2703. break;
  2704. }
  2705. }
  2706. spawner_params = "21,0,-1";
  2707. break;
  2708. }
  2709. case (24):
  2710. {
  2711. switch (spawner_rotator)
  2712. {
  2713. case (0):
  2714. {
  2715. spawner_id = 400540;
  2716. break;
  2717. }
  2718. case (1):
  2719. {
  2720. spawner_id = 400541;
  2721. break;
  2722. }
  2723. default:
  2724. {
  2725. spawner_id = 400542;
  2726. break;
  2727. }
  2728. }
  2729. spawner_params = "24,0,-1";
  2730. break;
  2731. }
  2732. }
  2733. GameObject * spawn1 = Commands->Trigger_Spawner(spawner_id);
  2734. if (spawn1)
  2735. {
  2736. Commands->Attach_Script(spawn1, "M02_Nod_Soldier", spawner_params);
  2737. return true;
  2738. }
  2739. else
  2740. {
  2741. return false;
  2742. }
  2743. }
  2744. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  2745. {
  2746. if (type == 101)
  2747. {
  2748. // A unit has died, subtract him from his area (param).
  2749. area_unit_count [param]--;
  2750. if (area_unit_count [param] < 0)
  2751. {
  2752. area_unit_count [param] = 0;
  2753. }
  2754. }
  2755. else if (type == 102)
  2756. {
  2757. // A specific area is requesting a forced spawn if possible.
  2758. Check_Respawns (param);
  2759. }
  2760. else if (type == 103)
  2761. {
  2762. // A unit is registering with the area unit count.
  2763. area_unit_count [param]++;
  2764. }
  2765. else if (type == 104)
  2766. {
  2767. // An area is being activated. Turn on the area.
  2768. active_area [param] = true;
  2769. }
  2770. else if (type == 105)
  2771. {
  2772. // An area is being deactivated.
  2773. active_area [param] = false;
  2774. }
  2775. else if (type == 106)
  2776. {
  2777. // An officer is registering with his area.
  2778. if (sender)
  2779. {
  2780. area_officer[param] = Commands->Get_ID(sender);
  2781. }
  2782. }
  2783. else if (type == 107)
  2784. {
  2785. // A Heli_01 spawner type is attempting to reset itself.
  2786. area_spawn_heli_drop_01_active[param] = false;
  2787. }
  2788. else if (type == 108)
  2789. {
  2790. // A Heli_02 spawner type is attempting to reset itself.
  2791. area_spawn_heli_drop_02_active[param] = false;
  2792. }
  2793. else if (type == 109)
  2794. {
  2795. // A Parachute spawner type is attempting to reset itself.
  2796. area_spawn_parachute_active[param] = false;
  2797. }
  2798. else if (type == 111)
  2799. {
  2800. // A request to spawn a new vehicle for the commando has been made.
  2801. Replacement_Vehicle (obj, param);
  2802. }
  2803. else if (type == 112)
  2804. {
  2805. // A player controlled vehicle has been destroyed, turn on the ability to make a new one
  2806. replacement_vehicle = param;
  2807. }
  2808. else if (type == 113)
  2809. {
  2810. // A request has been made to call in a GDI power-up drop.
  2811. Call_GDI_PowerUp (3);
  2812. }
  2813. else if (type == 114)
  2814. {
  2815. // Reset the unit area count to zero.
  2816. area_unit_count [param] = 0;
  2817. }
  2818. else if (type == 115)
  2819. {
  2820. // Destroyed SAM on the bridge - add to count, determine if both are destroyed.
  2821. destroyed_sam++;
  2822. if (destroyed_sam > 1)
  2823. {
  2824. // Drop a Medium Tank on the bridge.
  2825. replacement_vehicle = 6;
  2826. Replacement_Vehicle (obj, 6);
  2827. }
  2828. }
  2829. else if (type == 116)
  2830. {
  2831. // Destroyed Tiberium Silo - add to count, determine if both are destroyed.
  2832. destroyed_silo++;
  2833. if (destroyed_silo > 1)
  2834. {
  2835. // Complete this mission objective.
  2836. Commands->Send_Custom_Event (obj, obj, 222, 1);
  2837. Commands->Stop_All_Conversations ();
  2838. int id = Commands->Create_Conversation("M02_HIDDEN_02_FINISH", 100, 300, true);
  2839. Commands->Join_Conversation(NULL, id);
  2840. Commands->Join_Conversation (STAR, id, true, false, false);
  2841. Commands->Start_Conversation(id);
  2842. }
  2843. }
  2844. }
  2845. // When a player controlled vehicle is destroyed, it sends a custom to this controller
  2846. // to turn on the ability to create a new vehicle in a certain area.
  2847. // Another object then sends a custom to check for new vehicle creation. If the flag for
  2848. // creating a new vehicle for this area is active, it is reset and the vehicle is delivered.
  2849. void Replacement_Vehicle (GameObject *obj, int area_id)
  2850. {
  2851. Vector3 drop_loc = Vector3(0.0f,0.0f,0.0f);
  2852. float facing = 0.0f;
  2853. const char* textfile = "X2I_GDI_Drop_HummVee.txt";
  2854. bool nocinematic = false;
  2855. switch (area_id)
  2856. {
  2857. case (0):
  2858. {
  2859. drop_loc = Vector3(161.6f,27.6f,-18.0f);
  2860. facing = 115.4f;
  2861. textfile = "X2I_GDI_Drop_HummVee.txt";
  2862. break;
  2863. }
  2864. case (1):
  2865. {
  2866. drop_loc = Vector3(494.652f,128.786f,-56.159f);
  2867. facing = 30.0f;
  2868. GameObject *buggy = Commands->Create_Object ("Nod_Buggy_Player", drop_loc);
  2869. if (buggy)
  2870. {
  2871. Commands->Set_Facing (buggy, facing);
  2872. Commands->Attach_Script (buggy, "M02_Player_Vehicle", "3");
  2873. }
  2874. nocinematic = true;
  2875. break;
  2876. }
  2877. case (2):
  2878. {
  2879. drop_loc = Vector3(448.32f,717.19f,-12.35f);
  2880. facing = -30.0f;
  2881. textfile = "X2I_GDI_Drop_MediumTank.txt";
  2882. break;
  2883. }
  2884. case (4):
  2885. {
  2886. drop_loc = Vector3(429.672f, 894.045f, 4.354f);
  2887. facing = -25.0f;
  2888. GameObject *buggy = Commands->Create_Object ("Nod_Light_Tank_Player", drop_loc);
  2889. if (buggy)
  2890. {
  2891. Commands->Set_Facing (buggy, facing);
  2892. Commands->Attach_Script (buggy, "M02_Player_Vehicle", "5");
  2893. }
  2894. nocinematic = true;
  2895. break;
  2896. }
  2897. case (5):
  2898. {
  2899. drop_loc = Vector3(611.1f, 1164.9f, 4.6f);
  2900. facing = -39.7f;
  2901. GameObject *buggy = Commands->Create_Object ("Nod_Recon_Bike_Player", drop_loc);
  2902. if (buggy)
  2903. {
  2904. Commands->Set_Facing (buggy, facing);
  2905. Commands->Attach_Script (buggy, "M02_Player_Vehicle", "6");
  2906. }
  2907. nocinematic = true;
  2908. break;
  2909. }
  2910. case (6):
  2911. {
  2912. drop_loc = Vector3(785.3f,893.9f,21.8f);
  2913. facing = 138.0f;
  2914. textfile = "X2I_GDI_Drop_MediumTank.txt";
  2915. break;
  2916. }
  2917. case (14):
  2918. {
  2919. drop_loc = Vector3(1229.37f, 742.89f, 27.03f);
  2920. facing = 85.0f;
  2921. GameObject *buggy = Commands->Create_Object ("Nod_Recon_Bike_Player", drop_loc);
  2922. if (buggy)
  2923. {
  2924. Commands->Set_Facing (buggy, facing);
  2925. Commands->Attach_Script (buggy, "M02_Player_Vehicle", "14");
  2926. }
  2927. nocinematic = true;
  2928. break;
  2929. }
  2930. }
  2931. if (!nocinematic)
  2932. {
  2933. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", drop_loc);
  2934. if (chinook_obj1)
  2935. {
  2936. Commands->Set_Facing(chinook_obj1, facing);
  2937. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", textfile);
  2938. }
  2939. }
  2940. }
  2941. };
  2942. DECLARE_SCRIPT (M02_Reset_Spawn, "Area_ID:int,Spawn_Type:int")
  2943. {
  2944. void Destroyed (GameObject *obj)
  2945. {
  2946. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  2947. if (object)
  2948. {
  2949. int area_id;
  2950. int spawn_type;
  2951. area_id = Get_Int_Parameter("Area_ID");
  2952. spawn_type = Get_Int_Parameter("Spawn_Type");
  2953. Commands->Send_Custom_Event(obj, object, spawn_type, area_id);
  2954. }
  2955. }
  2956. };
  2957. DECLARE_SCRIPT (M02_Nod_Soldier, "Area_Number:int,Area_Officer:int,Pre_Placed:int")
  2958. {
  2959. Vector3 my_home_point;
  2960. bool no_return_home;
  2961. int officeranimcounter;
  2962. bool initial_damage;
  2963. float initial_health;
  2964. bool enemy_seen;
  2965. REGISTER_VARIABLES()
  2966. {
  2967. SAVE_VARIABLE (my_home_point, 1);
  2968. SAVE_VARIABLE (no_return_home, 2);
  2969. SAVE_VARIABLE (officeranimcounter, 3);
  2970. SAVE_VARIABLE (initial_damage, 4);
  2971. SAVE_VARIABLE (initial_health, 5);
  2972. SAVE_VARIABLE (enemy_seen, 6);
  2973. }
  2974. void Created (GameObject *obj)
  2975. {
  2976. officeranimcounter = 0;
  2977. no_return_home = false;
  2978. enemy_seen = false;
  2979. initial_damage = false;
  2980. initial_health = Commands->Get_Health(obj);
  2981. // Set the unit's home point, save the value.
  2982. Vector3 my_home_point = Commands->Get_Position(obj);
  2983. Commands->Set_Innate_Soldier_Home_Location(obj, my_home_point, 20.0f);
  2984. // Turn hibernation off for a moment.
  2985. Commands->Enable_Hibernation (obj, 0);
  2986. // Start the timer to register with the controller.
  2987. Commands->Start_Timer(obj, this, 1.0f, 1);
  2988. // If the unit is spawned, do not disturb it.
  2989. // If the unit is preplaced, turn of actions.
  2990. // If the unit is flown in, order it to move to the commando.
  2991. int preplaced = Get_Int_Parameter("Pre_Placed");
  2992. if (!preplaced)
  2993. {
  2994. // Give spawned units a green key for the Hand of Nod.
  2995. Commands->Grant_Key (obj, 1, true);
  2996. GameObject *starobj = Commands->Get_A_Star (my_home_point);
  2997. if (starobj)
  2998. {
  2999. ActionParamsStruct params;
  3000. params.Set_Basic(this, 71, 0);
  3001. params.Set_Movement(starobj, RUN, 5.0f, 0);
  3002. Commands->Action_Goto(obj, params);
  3003. }
  3004. }
  3005. else
  3006. {
  3007. if (preplaced > 0)
  3008. {
  3009. // Turn off all actions for preplaced soldiers.
  3010. Commands->Innate_Disable (obj);
  3011. }
  3012. }
  3013. }
  3014. void Enemy_Seen (GameObject * obj, GameObject * enemy)
  3015. {
  3016. enemy_seen = true;
  3017. }
  3018. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  3019. {
  3020. // If an objective shouts, respond to it, letting it know the area is not cleared.
  3021. if (sound.Type == 1000)
  3022. {
  3023. if (sound.Creator)
  3024. {
  3025. Commands->Send_Custom_Event(obj, sound.Creator, 100, 1);
  3026. }
  3027. }
  3028. // If a zone shouts to return to home points, do so.
  3029. else if ((sound.Type > 1049) && (sound.Type < 1100) && (!no_return_home))
  3030. {
  3031. int area_id = (sound.Type - 1050);
  3032. int area_num = Get_Int_Parameter("Area_Number");
  3033. if (area_num == area_id)
  3034. {
  3035. // Tell this unit to return to its home point, conserving unit counts.
  3036. ActionParamsStruct params;
  3037. params.Set_Basic(this, 99, 0);
  3038. params.Set_Movement(my_home_point, RUN, 20.0f, false);
  3039. Commands->Modify_Action (obj, 0, params, true, false);
  3040. }
  3041. }
  3042. }
  3043. void Timer_Expired (GameObject *obj, int timer_id)
  3044. {
  3045. if (timer_id == 1)
  3046. {
  3047. // Register with the respawn controller - send my area number.
  3048. int officer = Get_Int_Parameter("Area_Officer");
  3049. int preplaced = Get_Int_Parameter("Pre_Placed");
  3050. int param = Get_Int_Parameter("Area_Number");
  3051. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3052. if (object)
  3053. {
  3054. // Register with the respawn controller.
  3055. Commands->Send_Custom_Event(obj, object, 103, param);
  3056. if (officer)
  3057. {
  3058. // Unit is a preplaced officer. Register as an officer and hibernate.
  3059. Commands->Set_Innate_Take_Cover_Probability (obj, 100.0f);
  3060. Commands->Send_Custom_Event(obj, object, 106, param);
  3061. Commands->Enable_Hibernation (obj, 1);
  3062. }
  3063. else
  3064. {
  3065. if (preplaced > 0)
  3066. {
  3067. // SPECIAL CASE SETUP: Force fire routine for Rocket Soldiers.
  3068. if (preplaced == 4)
  3069. {
  3070. Commands->Attach_Script (obj, "M00_Soldier_Powerup_Disable", "");
  3071. if ((param == 0) || (param == 3) || (param == 6) || (param == 10) || (param == 16) || (param == 21))
  3072. {
  3073. no_return_home = true;
  3074. Commands->Start_Timer(obj, this, 15.0f, 4);
  3075. }
  3076. }
  3077. // Soldiers in start cinematic begin self-destruct.
  3078. if ((preplaced == 2) && (param == 99))
  3079. {
  3080. Commands->Start_Timer(obj, this, 5.0f, 6);
  3081. }
  3082. Commands->Enable_Hibernation (obj, 1);
  3083. }
  3084. else
  3085. {
  3086. // Unit is not pre-placed, activate cleanup code and do not hibernate if not in the interior areas.
  3087. Commands->Start_Timer(obj, this, 15.0f, 2);
  3088. }
  3089. }
  3090. }
  3091. }
  3092. else if (timer_id == 2)
  3093. {
  3094. // Cleanup code - find the nearest star, check distance, then check visibility
  3095. Vector3 myloc = Commands->Get_Position(obj);
  3096. GameObject *star_obj = Commands->Get_A_Star(myloc);
  3097. if (star_obj)
  3098. {
  3099. Vector3 starloc = Commands->Get_Position(star_obj);
  3100. float distance = Commands->Get_Distance (myloc, starloc);
  3101. if (distance > 70.0f)
  3102. {
  3103. bool visibility = Commands->Is_Object_Visible(star_obj, obj);
  3104. if (!visibility)
  3105. {
  3106. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  3107. }
  3108. else
  3109. {
  3110. Force_Move (obj);
  3111. }
  3112. }
  3113. else
  3114. {
  3115. Force_Move (obj);
  3116. }
  3117. }
  3118. Commands->Start_Timer(obj, this, 5.0f, 2);
  3119. }
  3120. else if (timer_id == 3)
  3121. {
  3122. // Force movement code to prevent irregular activity.
  3123. Force_Move (obj);
  3124. Commands->Start_Timer(obj, this, 15.0f, 3);
  3125. }
  3126. else if (timer_id == 4)
  3127. {
  3128. // Force fire at star code to prevent irregular activity.
  3129. Vector3 myloc;
  3130. myloc = Commands->Get_Position(obj);
  3131. GameObject* starobj = Commands->Get_A_Star(myloc);
  3132. if (starobj)
  3133. {
  3134. Vector3 starloc;
  3135. float distance;
  3136. starloc = Commands->Get_Position(starobj);
  3137. distance = Commands->Get_Distance(myloc, starloc);
  3138. if (distance < 150.0f)
  3139. {
  3140. ActionParamsStruct params;
  3141. params.Set_Basic(this, 90, 0);
  3142. params.Set_Attack(starobj, 150.0f, 0.0f, true);
  3143. Commands->Action_Attack(obj, params);
  3144. }
  3145. }
  3146. Commands->Start_Timer(obj, this, 15.0f, 4);
  3147. }
  3148. else if (timer_id == 5)
  3149. {
  3150. // An officer is trying to play an animation.
  3151. Vector3 playerloc = Commands->Get_Position (STAR);
  3152. Vector3 myloc = Commands->Get_Position(obj);
  3153. float distance = Commands->Get_Distance(myloc, playerloc);
  3154. if ((distance > 10.0f) && (!Commands->Is_Performing_Pathfind_Action(obj)))
  3155. {
  3156. officeranimcounter++;
  3157. if (officeranimcounter > 2)
  3158. {
  3159. officeranimcounter = 0;
  3160. }
  3161. switch (officeranimcounter)
  3162. {
  3163. case (0):
  3164. {
  3165. GameObject *nearsoldier = Commands->Find_Closest_Soldier (myloc, 1.0f, 50.0f);
  3166. if ((nearsoldier) && (nearsoldier != STAR))
  3167. {
  3168. ActionParamsStruct params;
  3169. params.Set_Basic(this, 99, 0);
  3170. Vector3 soldierloc = Commands->Get_Position (nearsoldier);
  3171. params.Set_Animation ("H_A_J18C", false);
  3172. params.Set_Face_Location (soldierloc, 4.0f);
  3173. Commands->Action_Play_Animation (obj, params);
  3174. }
  3175. break;
  3176. }
  3177. case (1):
  3178. {
  3179. if (STAR)
  3180. {
  3181. ActionParamsStruct params;
  3182. params.Set_Basic(this, 99, 0);
  3183. params.Set_Animation ("H_A_J23C", false);
  3184. params.Set_Face_Location (playerloc, 4.0f);
  3185. Commands->Action_Play_Animation (obj, params);
  3186. }
  3187. break;
  3188. }
  3189. default:
  3190. {
  3191. if (STAR)
  3192. {
  3193. ActionParamsStruct params;
  3194. params.Set_Basic(this, 99, 0);
  3195. params.Set_Animation ("H_A_J27C", false);
  3196. params.Set_Face_Location (playerloc, 4.0f);
  3197. Commands->Action_Play_Animation (obj, params);
  3198. }
  3199. break;
  3200. }
  3201. }
  3202. }
  3203. Commands->Start_Timer(obj, this, 10.0f, 5);
  3204. }
  3205. else if (timer_id == 6)
  3206. {
  3207. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  3208. }
  3209. else if (timer_id == 7)
  3210. {
  3211. if (!enemy_seen)
  3212. {
  3213. // Time to move the chem-warrior. Pick a new location.
  3214. Vector3 newloc;
  3215. int rndnum = (Get_Int_Random(0.0f,1.0f) * 5);
  3216. switch (rndnum)
  3217. {
  3218. case (0):
  3219. {
  3220. newloc = Vector3(1301.55f,617.89f,19.66f);
  3221. break;
  3222. }
  3223. case (1):
  3224. {
  3225. newloc = Vector3(1340.65f,655.04f,19.51f);
  3226. break;
  3227. }
  3228. case (2):
  3229. {
  3230. newloc = Vector3(1310.67f,694.74f,19.71f);
  3231. break;
  3232. }
  3233. default:
  3234. {
  3235. newloc = Vector3(1242.26f,646.04f,19.65f);
  3236. break;
  3237. }
  3238. }
  3239. ActionParamsStruct params;
  3240. params.Set_Basic(this, 31, 0);
  3241. params.Set_Movement(newloc, WALK, 10.0f, false);
  3242. Commands->Action_Goto(obj, params);
  3243. }
  3244. else
  3245. {
  3246. Force_Move (obj);
  3247. }
  3248. Commands->Start_Timer(obj, this, 30.0f, 7);
  3249. }
  3250. else if (timer_id == 10)
  3251. {
  3252. Vector3 my_pos = Commands->Get_Position (obj);
  3253. Vector3 star_pos = Commands->Get_Position (STAR);
  3254. float distance = Commands->Get_Distance (my_pos, star_pos);
  3255. if (distance < 20.0f)
  3256. {
  3257. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0014", 100, 300, true);
  3258. Commands->Join_Conversation (NULL, id);
  3259. Commands->Join_Conversation (STAR, id, true, false, false);
  3260. Commands->Start_Conversation (id);
  3261. Commands->Start_Timer (obj, this, 3.0f, 11);
  3262. }
  3263. else
  3264. {
  3265. Commands->Start_Timer (obj, this, 2.0f, 10);
  3266. }
  3267. }
  3268. else if (timer_id == 11)
  3269. {
  3270. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0015", 100, 300, true);
  3271. Commands->Join_Conversation (NULL, id);
  3272. Commands->Join_Conversation (STAR, id, true, false, false);
  3273. Commands->Start_Conversation (id);
  3274. }
  3275. }
  3276. void Force_Move (GameObject* obj)
  3277. {
  3278. if (!Commands->Is_Performing_Pathfind_Action(obj))
  3279. {
  3280. Vector3 mypos = Commands->Get_Position(obj);
  3281. GameObject *starobj = Commands->Get_A_Star (mypos);
  3282. if (starobj)
  3283. {
  3284. ActionParamsStruct params;
  3285. params.Set_Basic(this, 90, 0);
  3286. params.Set_Movement(starobj, RUN, 10.0f, 0);
  3287. params.Set_Attack(starobj, 150.0f, 0.0f, true);
  3288. Commands->Action_Attack(obj, params);
  3289. }
  3290. }
  3291. }
  3292. void Killed (GameObject *obj, GameObject *killer)
  3293. {
  3294. // Tell the respawn controller I am dead.
  3295. int param;
  3296. param = Get_Int_Parameter("Area_Number");
  3297. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3298. if (object)
  3299. {
  3300. Commands->Send_Custom_Event(obj, object, 101, param);
  3301. }
  3302. if (param == 3)
  3303. {
  3304. int officer = Get_Int_Parameter("Area_Officer");
  3305. if (officer)
  3306. {
  3307. // If a Medium Tank is needed for A03, drop it.
  3308. Commands->Send_Custom_Event (obj, object, 111, 2);
  3309. }
  3310. }
  3311. }
  3312. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3313. {
  3314. int specific_id = Commands->Get_ID (obj);
  3315. if (specific_id == 400276)
  3316. {
  3317. Commands->Start_Timer (obj, this, 2.0f, 10);
  3318. }
  3319. if ((type == 0) && (param == 0))
  3320. {
  3321. Commands->Innate_Enable (obj);
  3322. // If the unit is a preplaced minigunner, forced movement code is activated for this unit.
  3323. int preplaced = Get_Int_Parameter("Pre_Placed");
  3324. if (preplaced == 2)
  3325. {
  3326. int myid = Commands->Get_ID(obj);
  3327. if ((myid != 400512) || (myid != 400513))
  3328. {
  3329. Commands->Start_Timer(obj, this, 1.0f, 3);
  3330. }
  3331. }
  3332. else if (preplaced == 1)
  3333. {
  3334. // Unit is an officer, start the animation timer.
  3335. Commands->Start_Timer(obj, this, 10.0f, 5);
  3336. }
  3337. else if (preplaced == 6)
  3338. {
  3339. // Unit is a chem-warrior, start low priority wandering.
  3340. Commands->Start_Timer(obj, this, 1.0f, 7);
  3341. }
  3342. else if (preplaced == 5)
  3343. {
  3344. int areanum = Get_Int_Parameter("Area_Number");
  3345. if (areanum == 19)
  3346. {
  3347. // Unit is a technician, who plays an animation in front of a terminal.
  3348. ActionParamsStruct params;
  3349. params.Set_Basic(this, 31, 100);
  3350. params.Set_Animation ("H_A_CON2", true);
  3351. Commands->Action_Play_Animation (obj, params);
  3352. }
  3353. }
  3354. }
  3355. if ((type == 99) && (!Commands->Is_Performing_Pathfind_Action(obj)))
  3356. {
  3357. if (param == 214)
  3358. {
  3359. // An Objective or Building is asking to be repaired.
  3360. ActionParamsStruct params;
  3361. params.Set_Basic(this, 71, 214);
  3362. params.Set_Movement(sender, RUN, 10.0f, 0);
  3363. Vector3 senderpos = Commands->Get_Position(sender);
  3364. senderpos.Z -= 1.0f;
  3365. params.Set_Attack(senderpos, 10.0f, 0.0f, false);
  3366. Commands->Action_Attack(obj, params);
  3367. }
  3368. else if (param == 202)
  3369. {
  3370. ActionParamsStruct params;
  3371. params.Set_Basic(this, 50, 214);
  3372. params.Set_Movement(Vector3(1113.61f,877.4f,17.15f), RUN, 10.0f, 0);
  3373. params.Set_Attack(Vector3(1113.61f,877.4f,17.15f), 10.0f, 0.0f, false);
  3374. Commands->Action_Attack(obj, params);
  3375. }
  3376. else if (param == 217)
  3377. {
  3378. ActionParamsStruct params;
  3379. params.Set_Basic(this, 50, 214);
  3380. params.Set_Movement(Vector3(1062.24f,978.38f,-16.85f), RUN, 10.0f, 0);
  3381. params.Set_Attack(Vector3(1062.24f,978.38f,-16.85f), 10.0f, 0.0f, false);
  3382. Commands->Action_Attack(obj, params);
  3383. }
  3384. }
  3385. if (!initial_damage)
  3386. {
  3387. if (type == CUSTOM_EVENT_FALLING_DAMAGE)
  3388. {
  3389. initial_health = Commands->Get_Max_Health(obj);
  3390. }
  3391. }
  3392. }
  3393. void Damaged( GameObject * obj, GameObject *damager, float amount)
  3394. {
  3395. if (!initial_damage && damager == NULL)
  3396. {
  3397. initial_damage = true;
  3398. Commands->Set_Health(obj, initial_health);
  3399. }
  3400. }
  3401. };
  3402. DECLARE_SCRIPT(M02_Obelisk, "")
  3403. {
  3404. bool info_given;
  3405. void Created(GameObject*obj)
  3406. {
  3407. info_given = false;
  3408. }
  3409. void Damaged(GameObject * obj, GameObject * damager, float amount)
  3410. {
  3411. if (Commands->Get_Building_Power (obj))
  3412. {
  3413. // Check if the engineer is alive
  3414. GameObject * obj_engineer = Commands->Find_Object(400200);
  3415. if (obj_engineer)
  3416. {
  3417. // Tell the Engineer to repair the building.
  3418. Commands->Send_Custom_Event (obj, obj_engineer, 99, 202);
  3419. //Actually repair the building.
  3420. float maxhealth = Commands->Get_Max_Health (obj);
  3421. Commands->Set_Health (obj, maxhealth);
  3422. // Announce the returned health as an engineer repairing internally.
  3423. if ((!info_given) && (damager == STAR))
  3424. {
  3425. info_given = true;
  3426. Commands->Stop_All_Conversations ();
  3427. int id = Commands->Create_Conversation("M02_EVA_OBELISK_REPAIR", 100, 300, true);
  3428. Commands->Join_Conversation(NULL, id);
  3429. Commands->Join_Conversation (STAR, id, true, false, false);
  3430. Commands->Start_Conversation(id);
  3431. }
  3432. }
  3433. }
  3434. }
  3435. void Killed(GameObject * obj, GameObject * killer)
  3436. {
  3437. if (Commands->Get_Building_Power (obj))
  3438. {
  3439. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3440. if (object)
  3441. {
  3442. Commands->Send_Custom_Event(obj, object, 202, 1);
  3443. }
  3444. }
  3445. GameObject * zone = Commands->Find_Object (405116);
  3446. if (zone)
  3447. {
  3448. Commands->Destroy_Object (zone);
  3449. }
  3450. zone = Commands->Find_Object (405117);
  3451. if (zone)
  3452. {
  3453. Commands->Destroy_Object (zone);
  3454. }
  3455. }
  3456. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3457. {
  3458. if (type == 1)
  3459. {
  3460. info_given = true;
  3461. }
  3462. }
  3463. };
  3464. DECLARE_SCRIPT (M02_Power_Plant, "")
  3465. {
  3466. bool info_given;
  3467. void Created(GameObject*obj)
  3468. {
  3469. info_given = false;
  3470. }
  3471. void Damaged(GameObject * obj, GameObject * damager, float amount)
  3472. {
  3473. // Check if the engineer is alive
  3474. GameObject * obj_engineer = Commands->Find_Object(400199);
  3475. if (obj_engineer)
  3476. {
  3477. // Tell the Engineer to repair the building.
  3478. Commands->Send_Custom_Event (obj, obj_engineer, 99, 217);
  3479. //Actually repair the building.
  3480. float maxhealth = Commands->Get_Max_Health (obj);
  3481. Commands->Set_Health (obj, maxhealth);
  3482. // Announce the returned health as an engineer repairing internally.
  3483. if ((!info_given) && (damager == STAR))
  3484. {
  3485. info_given = true;
  3486. Commands->Stop_All_Conversations ();
  3487. int id = Commands->Create_Conversation("M02_EVA_POWER_REPAIR", 100, 300, true);
  3488. Commands->Join_Conversation(NULL, id);
  3489. Commands->Join_Conversation (STAR, id, true, false, false);
  3490. Commands->Start_Conversation(id);
  3491. }
  3492. }
  3493. }
  3494. void Killed(GameObject * obj, GameObject * killer)
  3495. {
  3496. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3497. if (object)
  3498. {
  3499. Commands->Send_Custom_Event(obj, object, 217, 1);
  3500. Commands->Send_Custom_Event(obj, object, 202, 1);
  3501. }
  3502. GameObject * obelisk = Commands->Find_Object(1153845);
  3503. if (obelisk)
  3504. {
  3505. Commands->Set_Building_Power(obelisk, false);
  3506. }
  3507. GameObject * zone = Commands->Find_Object (405116);
  3508. if (zone)
  3509. {
  3510. Commands->Destroy_Object (zone);
  3511. }
  3512. zone = Commands->Find_Object (405117);
  3513. if (zone)
  3514. {
  3515. Commands->Destroy_Object (zone);
  3516. }
  3517. GameObject * hand_of_nod = Commands->Find_Object(1157690);
  3518. if (hand_of_nod)
  3519. {
  3520. Commands->Set_Building_Power(hand_of_nod, false);
  3521. }
  3522. }
  3523. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3524. {
  3525. if (type == 1)
  3526. {
  3527. info_given = true;
  3528. }
  3529. }
  3530. };
  3531. DECLARE_SCRIPT (M02_Dam_MCT, "")
  3532. {
  3533. bool destroyed;
  3534. REGISTER_VARIABLES()
  3535. {
  3536. SAVE_VARIABLE (destroyed, 1);
  3537. }
  3538. void Created (GameObject * obj)
  3539. {
  3540. destroyed = false;
  3541. }
  3542. void Damaged (GameObject * obj, GameObject * damager, float amount)
  3543. {
  3544. float health = Commands->Get_Health(obj);
  3545. if (health < 1.0f)
  3546. {
  3547. Commands->Set_Health (obj, 0.1f);
  3548. if (!destroyed)
  3549. {
  3550. destroyed = true;
  3551. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3552. if (object)
  3553. {
  3554. Commands->Send_Custom_Event(obj, object, 203, 1);
  3555. Commands->Grant_Key (STAR, 6, true);
  3556. }
  3557. Commands->Set_Animation_Frame (obj, "MCT_NOD.MCT_NOD", 7);
  3558. }
  3559. }
  3560. }
  3561. };
  3562. DECLARE_SCRIPT (M02_Helipad, "")
  3563. {
  3564. void Killed(GameObject *obj, GameObject *killer)
  3565. {
  3566. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3567. if (object)
  3568. {
  3569. Commands->Send_Custom_Event(obj, object, 206, 1);
  3570. }
  3571. }
  3572. };
  3573. DECLARE_SCRIPT (M02_Destroy_Objective, "Objective_ID:int")
  3574. {
  3575. void Killed(GameObject *obj, GameObject *killer)
  3576. {
  3577. int objective_id;
  3578. objective_id = Get_Int_Parameter ("Objective_ID");
  3579. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3580. if (object)
  3581. {
  3582. if (objective_id != 222)
  3583. {
  3584. Commands->Send_Custom_Event(obj, object, objective_id, 1);
  3585. }
  3586. // Special case items, mission is solved by above line!
  3587. if (objective_id == 212)
  3588. {
  3589. // Drop powerups into A03.
  3590. Commands->Send_Custom_Event(obj, object, 113, 3);
  3591. }
  3592. else if (objective_id == 214)
  3593. {
  3594. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", Vector3(580.37f,889.69f,-0.57f));
  3595. if (chinook_obj1)
  3596. {
  3597. Commands->Set_Facing(chinook_obj1, -180.0f);
  3598. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X2I_GDI_Drop02_Rocket_24.txt");
  3599. }
  3600. }
  3601. else if ((objective_id == 215) || (objective_id == 216))
  3602. {
  3603. // Send a custom to the controller to count destroyed SAMs on the bridge.
  3604. Commands->Send_Custom_Event(obj, object, 115, 0);
  3605. }
  3606. else if (objective_id == 204)
  3607. {
  3608. // Hand of Nod destroyed, turn off respawns in the area.
  3609. Commands->Send_Custom_Event(obj, object, 105, 21);
  3610. }
  3611. else if (objective_id == 222)
  3612. {
  3613. // Send a custom to the controller to count destroyed Tiberium Silos.
  3614. Commands->Send_Custom_Event(obj, object, 116, 0);
  3615. }
  3616. }
  3617. }
  3618. void Damaged(GameObject *obj, GameObject *damager, float amount)
  3619. {
  3620. int objective_id;
  3621. objective_id = Get_Int_Parameter ("Objective_ID");
  3622. if (objective_id == 214)
  3623. {
  3624. GameObject* engineer = Commands->Find_Object(400510);
  3625. if (engineer)
  3626. {
  3627. Commands->Send_Custom_Event(obj, engineer, 99, 214);
  3628. }
  3629. }
  3630. }
  3631. };
  3632. DECLARE_SCRIPT (M02_Nod_Convoy_Truck, "")
  3633. {
  3634. void Killed(GameObject *obj, GameObject *killer)
  3635. {
  3636. GameObject * object = Commands->Find_Object(M02_OBJCONTROLLER);
  3637. if (object)
  3638. {
  3639. // Tell the controller to subtract a truck.
  3640. Commands->Send_Custom_Event(obj, object, 900, 3);
  3641. // Create an explosion here.
  3642. Vector3 myloc;
  3643. myloc = Commands->Get_Position(obj);
  3644. }
  3645. }
  3646. };
  3647. // SOLDIER TYPE PARAMETERS FOR GDI
  3648. // 1 = Rocket Soldier
  3649. // 2 = Minigunner Officer
  3650. // 3 = Minigunner Enlisted
  3651. // 4 = Grenadier Enlisted
  3652. DECLARE_SCRIPT (M02_GDI_Soldier, "Area_ID:int, Soldier_Type=0:int")
  3653. {
  3654. bool stop_following;
  3655. bool said_message;
  3656. int shout_count;
  3657. REGISTER_VARIABLES()
  3658. {
  3659. SAVE_VARIABLE (stop_following, 1);
  3660. SAVE_VARIABLE (said_message, 2);
  3661. SAVE_VARIABLE (shout_count, 3);
  3662. }
  3663. void Created(GameObject* obj)
  3664. {
  3665. Commands->Enable_Hibernation(obj, false);
  3666. stop_following = false;
  3667. said_message = false;
  3668. shout_count = 0;
  3669. // Special case checks for preplaced soldiers.
  3670. int area_id = Get_Int_Parameter("Area_ID");
  3671. if (area_id == 1)
  3672. {
  3673. Commands->Innate_Disable (obj);
  3674. int soldier_type = Get_Int_Parameter ("Soldier_Type");
  3675. if (soldier_type == 2)
  3676. {
  3677. Commands->Start_Timer(obj, this, 10.0f, 2);
  3678. }
  3679. }
  3680. else
  3681. {
  3682. // Default spawned following unit - Give orders to stay near the commando on a timer.
  3683. Commands->Start_Timer(obj, this, 1.0f, 1);
  3684. }
  3685. }
  3686. void Timer_Expired(GameObject * obj, int timer_id)
  3687. {
  3688. if (timer_id == 1)
  3689. {
  3690. int area_id = Get_Int_Parameter("Area_ID");
  3691. if (area_id == 9)
  3692. {
  3693. // GDI soldiers in A09 Dam Top rush the Obelisk and die.
  3694. GameObject * obelisk = Commands->Find_Object(1153845);
  3695. if (obelisk)
  3696. {
  3697. bool power = Commands->Get_Building_Power (obelisk);
  3698. if (power)
  3699. {
  3700. ActionParamsStruct params;
  3701. params.Set_Basic(this, 71, 0);
  3702. params.Set_Movement(Vector3(1105.78f,897.75f,35.05f), 1.0f, 20.0f, 0);
  3703. Commands->Action_Goto(obj, params);
  3704. }
  3705. }
  3706. }
  3707. else if (!stop_following)
  3708. {
  3709. // Follow the commando. Start this check timer again.
  3710. Vector3 mypos = Commands->Get_Position(obj);
  3711. GameObject *starobj = Commands->Get_A_Star (mypos);
  3712. if (starobj)
  3713. {
  3714. ActionParamsStruct params;
  3715. params.Set_Basic(this, 71, 1);
  3716. params.Set_Movement(starobj, 1.0f, 20.0f, 0);
  3717. Commands->Action_Goto(obj, params);
  3718. }
  3719. else
  3720. {
  3721. stop_following = true;
  3722. }
  3723. }
  3724. Commands->Start_Timer(obj, this, 10.0f, 1);
  3725. }
  3726. else if (timer_id == 2)
  3727. {
  3728. if(!said_message)
  3729. {
  3730. Vector3 mypos = Commands->Get_Position (obj);
  3731. Vector3 starpos = Commands->Get_Position (STAR);
  3732. float distance = Commands->Get_Distance (mypos, starpos);
  3733. if (distance < 30.0f)
  3734. {
  3735. switch (shout_count)
  3736. {
  3737. case (0):
  3738. {
  3739. int id = Commands->Create_Conversation("M02_GOMG_RADIO_01", 99, 20, true);
  3740. Commands->Join_Conversation (obj, id, true, true, true);
  3741. Commands->Start_Conversation(id);
  3742. shout_count++;
  3743. break;
  3744. }
  3745. case (1):
  3746. {
  3747. int id = Commands->Create_Conversation("M02_GOMG_RADIO_02", 99, 20, true);
  3748. Commands->Join_Conversation (obj, id, true, true, true);
  3749. Commands->Start_Conversation(id);
  3750. shout_count++;
  3751. break;
  3752. }
  3753. case (2):
  3754. {
  3755. int id = Commands->Create_Conversation("M02_GOMG_RADIO_03", 99, 20, true);
  3756. Commands->Join_Conversation (obj, id, true, true, true);
  3757. Commands->Start_Conversation(id);
  3758. shout_count++;
  3759. break;
  3760. }
  3761. default:
  3762. {
  3763. break;
  3764. }
  3765. }
  3766. }
  3767. Commands->Start_Timer(obj, this, 10.0f, 2);
  3768. }
  3769. }
  3770. }
  3771. void Poked (GameObject * obj, GameObject * poker)
  3772. {
  3773. int soldier_type = Get_Int_Parameter ("Soldier_Type");
  3774. if ((soldier_type == 2) && (!said_message))
  3775. {
  3776. said_message = true;
  3777. int id = Commands->Create_Conversation("M02_GOMG_CONVERSATION", 99, 10, true);
  3778. Commands->Join_Conversation (obj, id, true, true, true);
  3779. Commands->Join_Conversation(STAR, id, true, true, false);
  3780. Commands->Start_Conversation(id);
  3781. }
  3782. }
  3783. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  3784. {
  3785. if ((sound.Type > 1099) && (sound.Type < 1199))
  3786. {
  3787. // Make sure this is the sound this unit is supposed to react to.
  3788. int area_id = Get_Int_Parameter("Area_ID");
  3789. if ((sound.Type - 1100) == area_id)
  3790. {
  3791. stop_following = true;
  3792. switch (area_id)
  3793. {
  3794. case (0):
  3795. {
  3796. Commands->Action_Reset (obj, 100);
  3797. break;
  3798. }
  3799. case (2):
  3800. {
  3801. Vector3 house_loc = Vector3(648.77f,300.74f,-59.99f);
  3802. ActionParamsStruct params;
  3803. params.Set_Basic(this, 81, 0);
  3804. params.Set_Movement(house_loc, WALK, 1.0f, 0);
  3805. Commands->Action_Goto(obj, params);
  3806. break;
  3807. }
  3808. }
  3809. }
  3810. }
  3811. }
  3812. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3813. {
  3814. if ((type == 0) && (param == 0))
  3815. {
  3816. // A zone is trying to enable actions for this soldier.
  3817. Commands->Innate_Enable (obj);
  3818. }
  3819. }
  3820. void Killed (GameObject * obj, GameObject * killer)
  3821. {
  3822. int area_id = Get_Int_Parameter("Area_ID");
  3823. if (area_id == 0)
  3824. {
  3825. GameObject * controller = Commands->Find_Object (M02_OBJCONTROLLER);
  3826. if (controller)
  3827. {
  3828. Commands->Send_Custom_Event (obj, controller, 1000, 1000);
  3829. }
  3830. }
  3831. else if (area_id == 9)
  3832. {
  3833. GameObject * controller = Commands->Find_Object (M02_OBJCONTROLLER);
  3834. if (controller)
  3835. {
  3836. Commands->Send_Custom_Event (obj, controller, 1000, 1001);
  3837. }
  3838. }
  3839. }
  3840. void Action_Complete (GameObject * obj, int action_id, ActionCompleteReason complete_reason)
  3841. {
  3842. if ((action_id == 1) && (complete_reason == ACTION_COMPLETE_NORMAL))
  3843. {
  3844. if (!said_message)
  3845. {
  3846. said_message = true;
  3847. int soldier_type = Get_Int_Parameter ("Soldier_Type");
  3848. switch (soldier_type)
  3849. {
  3850. case (1): // Rocket Soldier
  3851. {
  3852. int id = Commands->Create_Conversation("M02_GERS_COVER_01", 99, 50, true);
  3853. Commands->Join_Conversation (obj, id, true, true, false);
  3854. Commands->Join_Conversation(STAR, id, true, true, false);
  3855. Commands->Start_Conversation(id);
  3856. break;
  3857. }
  3858. case (4): // Grenadier
  3859. {
  3860. int id = Commands->Create_Conversation("M02_GEGR_COVER_01", 99, 50, true);
  3861. Commands->Join_Conversation (obj, id, true, true, false);
  3862. Commands->Join_Conversation(STAR, id, true, true, false);
  3863. Commands->Start_Conversation(id);
  3864. break;
  3865. }
  3866. default:
  3867. {
  3868. break;
  3869. }
  3870. }
  3871. }
  3872. }
  3873. }
  3874. };
  3875. DECLARE_SCRIPT (M02_Stationary_Vehicle,"Area_ID:int")
  3876. {
  3877. void Created (GameObject* obj)
  3878. {
  3879. int area_id;
  3880. area_id = Get_Int_Parameter("Area_ID");
  3881. // Area One is a conflict area, other stationary vehicles in conflict areas must be paused as well
  3882. Commands->Enable_Enemy_Seen (obj, false);
  3883. if (area_id == 99)
  3884. {
  3885. Commands->Innate_Disable (obj);
  3886. Commands->Start_Timer (obj, this, 5.33f, 1);
  3887. }
  3888. }
  3889. void Killed (GameObject * obj, GameObject * killer)
  3890. {
  3891. int area_id = Get_Int_Parameter ("Area_ID");
  3892. int my_id = Commands->Get_ID (obj);
  3893. if (area_id == 2)
  3894. {
  3895. if (my_id == 401016)
  3896. {
  3897. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0008", 100, 300, true);
  3898. Commands->Join_Conversation (NULL, id);
  3899. Commands->Join_Conversation (STAR, id, true, false, false);
  3900. Commands->Start_Conversation (id);
  3901. }
  3902. else if (my_id == 401167)
  3903. {
  3904. GameObject * tank = Commands->Find_Object (401016);
  3905. if (tank)
  3906. {
  3907. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0007", 100, 300, true);
  3908. Commands->Join_Conversation (tank, id);
  3909. Commands->Join_Conversation (STAR, id, true, false, false);
  3910. Commands->Start_Conversation (id);
  3911. }
  3912. }
  3913. }
  3914. }
  3915. void Enemy_Seen (GameObject * obj, GameObject * enemy)
  3916. {
  3917. int area_id;
  3918. area_id = Get_Int_Parameter("Area_ID");
  3919. if (area_id != 99)
  3920. {
  3921. ActionParamsStruct params;
  3922. params.Set_Basic(this, 90, 0);
  3923. params.Set_Attack(enemy, 300.0f, 0.0f, true);
  3924. params.AttackCheckBlocked = false;
  3925. Commands->Action_Attack(obj, params);
  3926. Commands->Start_Timer(obj, this, 5.0f, 2);
  3927. }
  3928. }
  3929. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  3930. {
  3931. // If an objective shouts, respond to it, letting it know the area is not cleared.
  3932. if (sound.Type == 1000)
  3933. {
  3934. if (sound.Creator)
  3935. {
  3936. int player_type = Commands->Get_Player_Type (obj);
  3937. if (player_type == SCRIPT_PLAYERTYPE_NOD)
  3938. {
  3939. Commands->Send_Custom_Event(obj, sound.Creator, 100, 1);
  3940. }
  3941. }
  3942. }
  3943. }
  3944. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  3945. {
  3946. if ((type == 0) && (param == 0))
  3947. {
  3948. // A zone is trying to enable actions for this vehicle.
  3949. Commands->Enable_Enemy_Seen (obj, true);
  3950. }
  3951. }
  3952. void Timer_Expired(GameObject * obj, int timer_id)
  3953. {
  3954. if (timer_id == 1)
  3955. {
  3956. Commands->Apply_Damage (obj, 10000.0f, "Blamokiller");
  3957. }
  3958. else if (timer_id == 2)
  3959. {
  3960. Commands->Action_Reset (obj, 100);
  3961. }
  3962. }
  3963. };
  3964. DECLARE_SCRIPT (M02_Nod_Apache, "Area_ID:int")
  3965. {
  3966. int waypath_id;
  3967. REGISTER_VARIABLES()
  3968. {
  3969. SAVE_VARIABLE( waypath_id, 1);
  3970. }
  3971. void Created (GameObject* obj)
  3972. {
  3973. int area_id = Get_Int_Parameter("Area_ID");
  3974. float timer_len = 1.0f;
  3975. //First waypath means area for looping Apaches, it is set when timer expires, and then uses real IDs.
  3976. switch (area_id)
  3977. {
  3978. case (0):
  3979. {
  3980. waypath_id = 0;
  3981. timer_len = 8.0f;
  3982. break;
  3983. }
  3984. case (15):
  3985. {
  3986. waypath_id = 1;
  3987. timer_len = 15.0f;
  3988. break;
  3989. }
  3990. case (24):
  3991. {
  3992. waypath_id = 24;
  3993. break;
  3994. }
  3995. }
  3996. Commands->Enable_Engine(obj, true);
  3997. Commands->Disable_Physical_Collisions(obj);
  3998. Commands->Start_Timer(obj, this, timer_len, 1);
  3999. Commands->Start_Timer(obj, this, 15.0f, 3);
  4000. }
  4001. void Timer_Expired(GameObject * obj, int timer_id)
  4002. {
  4003. if (timer_id == 1)
  4004. {
  4005. // Delayed initial action.
  4006. switch (waypath_id)
  4007. {
  4008. case (0): // Area 0 Apache delay timer expired, start movement
  4009. {
  4010. waypath_id = 400296;
  4011. break;
  4012. }
  4013. case (1): // Area 15 Apache delay timer expired, start movement.
  4014. {
  4015. waypath_id = 401169;
  4016. break;
  4017. }
  4018. case (24):
  4019. {
  4020. waypath_id = 400544;
  4021. break;
  4022. }
  4023. case (400296):
  4024. {
  4025. waypath_id = 400304;
  4026. break;
  4027. }
  4028. case (400304):
  4029. {
  4030. waypath_id = 400310;
  4031. break;
  4032. }
  4033. case (400310):
  4034. {
  4035. waypath_id = 400304;
  4036. break;
  4037. }
  4038. case (400544):
  4039. {
  4040. waypath_id = -1;
  4041. break;
  4042. }
  4043. case (401169):
  4044. {
  4045. waypath_id = 401173;
  4046. break;
  4047. }
  4048. case (401173):
  4049. {
  4050. waypath_id = 401180;
  4051. break;
  4052. }
  4053. case (401180):
  4054. {
  4055. waypath_id = 401173;
  4056. break;
  4057. }
  4058. }
  4059. if (waypath_id != -1)
  4060. {
  4061. ActionParamsStruct params;
  4062. params.Set_Basic(this, 90, 0);
  4063. params.Set_Movement(Vector3(0,0,0), 0.2 + (0.1 * DIFFICULTY), 5.0f);
  4064. params.WaypathID = waypath_id;
  4065. params.WaypathSplined = true;
  4066. params.MovePathfind = false;
  4067. params.Set_Attack(STAR, 200.0f, 0.0f, true);
  4068. params.AttackCheckBlocked = false;
  4069. params.AttackActive = false;
  4070. Commands->Action_Attack(obj, params);
  4071. }
  4072. Commands->Start_Timer(obj, this, 5.0f, 2);
  4073. }
  4074. else if (timer_id == 2)
  4075. {
  4076. // Time to start firing, and move again in a second.
  4077. Vector3 myloc = Commands->Get_Position(obj);
  4078. ActionParamsStruct params;
  4079. params.Set_Basic(this, 90, 0);
  4080. params.Set_Movement(myloc, 0.0, 5.0f);
  4081. params.MovePathfind = false;
  4082. params.Set_Attack(STAR, 200.0f, 0.0f, true);
  4083. params.AttackCheckBlocked = false;
  4084. params.AttackActive = true;
  4085. Commands->Action_Attack(obj, params);
  4086. Commands->Start_Timer(obj, this, 5.0f, 1);
  4087. }
  4088. else if (timer_id == 3)
  4089. {
  4090. // Cleanup code - find the nearest star, check distance.
  4091. float distance;
  4092. Vector3 myloc;
  4093. Vector3 starloc;
  4094. myloc = Commands->Get_Position(obj);
  4095. GameObject *star_obj = Commands->Get_A_Star(myloc);
  4096. if (star_obj)
  4097. {
  4098. starloc = Commands->Get_Position(star_obj);
  4099. distance = Commands->Get_Distance (myloc, starloc);
  4100. if (distance > 300.0f)
  4101. {
  4102. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4103. }
  4104. }
  4105. Commands->Start_Timer(obj, this, 15.0f, 3);
  4106. }
  4107. }
  4108. // If an objective shouts, respond to it, letting it know the area is not cleared.
  4109. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  4110. {
  4111. if (sound.Type == 1000)
  4112. {
  4113. if (sound.Creator)
  4114. {
  4115. Commands->Send_Custom_Event(obj, sound.Creator, 100, 1);
  4116. }
  4117. }
  4118. }
  4119. };
  4120. DECLARE_SCRIPT (M02_Nod_Vehicle, "Area_ID:int")
  4121. {
  4122. void Created (GameObject* obj)
  4123. {
  4124. Commands->Enable_Enemy_Seen (obj, true);
  4125. Commands->Enable_Engine(obj, true);
  4126. // Get my area id and determine what I need to to immediately.
  4127. int area_id = Get_Int_Parameter("Area_ID");
  4128. switch (area_id)
  4129. {
  4130. case (2):
  4131. {
  4132. ActionParamsStruct params;
  4133. params.Set_Basic(this, 98, 0);
  4134. params.Set_Movement(Vector3(0,0,0), 1.0f, 5.0f);
  4135. params.WaypathID = 400375;
  4136. params.WaypathSplined = false;
  4137. params.Set_Attack(STAR, 300.0f, 0.0f, true);
  4138. Commands->Action_Attack(obj, params);
  4139. break;
  4140. }
  4141. case (3):
  4142. {
  4143. ActionParamsStruct params;
  4144. params.Set_Basic(this, 98, 0);
  4145. params.Set_Movement(Vector3(0,0,0), 1.0f, 5.0f);
  4146. params.WaypathID = 400416;
  4147. params.WaypathSplined = false;
  4148. params.Set_Attack(STAR, 300.0f, 0.0f, true);
  4149. Commands->Action_Attack(obj, params);
  4150. break;
  4151. }
  4152. case (4):
  4153. {
  4154. ActionParamsStruct params;
  4155. params.Set_Basic(this, 98, 0);
  4156. params.Set_Movement(Vector3(0,0,0), 1.0f, 5.0f);
  4157. params.WaypathID = 400454;
  4158. params.WaypathSplined = false;
  4159. params.Set_Attack(STAR, 300.0f, 0.0f, true);
  4160. Commands->Action_Attack(obj, params);
  4161. break;
  4162. }
  4163. }
  4164. Commands->Start_Timer(obj, this, 15.0f, 1);
  4165. }
  4166. // If an objective shouts, respond to it, letting it know the area is not cleared.
  4167. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  4168. {
  4169. if (sound.Type == 1000)
  4170. {
  4171. if (sound.Creator)
  4172. {
  4173. Commands->Send_Custom_Event(obj, sound.Creator, 100, 1);
  4174. }
  4175. }
  4176. }
  4177. void Timer_Expired(GameObject * obj, int timer_id)
  4178. {
  4179. if (timer_id == 1)
  4180. {
  4181. // Cleanup code - find the nearest star, check distance, then check visibility
  4182. float distance;
  4183. Vector3 myloc;
  4184. Vector3 starloc;
  4185. myloc = Commands->Get_Position(obj);
  4186. GameObject *star_obj = Commands->Get_A_Star(myloc);
  4187. if (star_obj)
  4188. {
  4189. starloc = Commands->Get_Position(star_obj);
  4190. distance = Commands->Get_Distance (myloc, starloc);
  4191. if (distance > 300.0f)
  4192. {
  4193. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4194. }
  4195. }
  4196. Commands->Start_Timer(obj, this, 15.0f, 1);
  4197. }
  4198. }
  4199. };
  4200. DECLARE_SCRIPT (M02_Player_Vehicle, "Area_ID:int")
  4201. {
  4202. bool entered_me;
  4203. REGISTER_VARIABLES()
  4204. {
  4205. SAVE_VARIABLE(entered_me, 1);
  4206. }
  4207. void Created (GameObject* obj)
  4208. {
  4209. entered_me = false;
  4210. Commands->Enable_Vehicle_Transitions (obj, true);
  4211. Commands->Set_Player_Type (obj, SCRIPT_PLAYERTYPE_NEUTRAL);
  4212. Commands->Start_Timer(obj, this, 15.0f, 1);
  4213. int unitid = Commands->Get_ID (obj);
  4214. Send_Custom_To_SAM_Sites (obj, M00_CUSTOM_SAM_SITE_IGNORE, unitid);
  4215. }
  4216. void Timer_Expired(GameObject * obj, int timer_id)
  4217. {
  4218. if (timer_id == 1)
  4219. {
  4220. // Check if this vehicle needs to be removed.
  4221. Vector3 myloc = Commands->Get_Position(obj);
  4222. GameObject *star_obj = Commands->Get_A_Star(myloc);
  4223. if (star_obj)
  4224. {
  4225. Vector3 starloc = Commands->Get_Position(star_obj);
  4226. float distance = Commands->Get_Distance (myloc, starloc);
  4227. if (distance > 300.0f)
  4228. {
  4229. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4230. }
  4231. }
  4232. Commands->Start_Timer(obj, this, 15.0f, 1);
  4233. }
  4234. }
  4235. void Destroyed (GameObject* obj)
  4236. {
  4237. int area_id = Get_Int_Parameter ("Area_ID");
  4238. GameObject* controller = Commands->Find_Object(M02_OBJCONTROLLER);
  4239. if (controller)
  4240. {
  4241. Commands->Send_Custom_Event(obj, controller, 112, area_id);
  4242. }
  4243. if ((area_id == 2) && (!entered_me))
  4244. {
  4245. Commands->Send_Custom_Event(obj, controller, 221, 2);
  4246. }
  4247. }
  4248. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4249. {
  4250. if (type == CUSTOM_EVENT_VEHICLE_ENTERED)
  4251. {
  4252. int area_id = Get_Int_Parameter ("Area_ID");
  4253. if ((area_id == 2) && (!entered_me))
  4254. {
  4255. entered_me = true;
  4256. GameObject* controller = Commands->Find_Object(M02_OBJCONTROLLER);
  4257. if (controller)
  4258. {
  4259. Commands->Send_Custom_Event(obj, controller, 221, 1);
  4260. }
  4261. }
  4262. }
  4263. }
  4264. };
  4265. DECLARE_SCRIPT (M02_Nod_Sakura, "Area_ID:int")
  4266. {
  4267. bool onmywayout;
  4268. REGISTER_VARIABLES()
  4269. {
  4270. SAVE_VARIABLE(onmywayout, 1);
  4271. }
  4272. void Created (GameObject* obj)
  4273. {
  4274. onmywayout = false;
  4275. int waypath_id = 400397;
  4276. Commands->Enable_Enemy_Seen (obj, true);
  4277. Commands->Enable_Engine(obj, true);
  4278. Commands->Disable_Physical_Collisions(obj);
  4279. ActionParamsStruct params;
  4280. params.Set_Basic(this, 91, 0);
  4281. params.Set_Movement(Vector3(0,0,0), 2.5f, 1.0f);
  4282. params.WaypathID = waypath_id;
  4283. params.WaypathSplined = true;
  4284. params.Set_Attack(STAR, 200.0f, 0.0f, true);
  4285. Commands->Action_Goto(obj, params);
  4286. Commands->Start_Timer(obj, this, 15.0f, 1);
  4287. Commands->Start_Timer(obj, this, 10.0f, 3);
  4288. }
  4289. void Enemy_Seen (GameObject * obj, GameObject * enemy)
  4290. {
  4291. ActionParamsStruct params;
  4292. params.Set_Basic(this, 92, 2);
  4293. params.AttackCheckBlocked = false;
  4294. params.Set_Attack(enemy, 300.0f, 0.0f, true);
  4295. Commands->Action_Attack(obj, params);
  4296. }
  4297. void Timer_Expired(GameObject * obj, int timer_id)
  4298. {
  4299. if (timer_id == 1)
  4300. {
  4301. // Cleanup code - find the nearest star, check distance, then check visibility
  4302. float distance;
  4303. Vector3 myloc;
  4304. Vector3 starloc;
  4305. myloc = Commands->Get_Position(obj);
  4306. GameObject *star_obj = Commands->Get_A_Star(myloc);
  4307. if (star_obj)
  4308. {
  4309. starloc = Commands->Get_Position(star_obj);
  4310. distance = Commands->Get_Distance (myloc, starloc);
  4311. if (distance > 300.0f)
  4312. {
  4313. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4314. }
  4315. }
  4316. Commands->Start_Timer(obj, this, 15.0f, 1);
  4317. }
  4318. else if (timer_id == 2)
  4319. {
  4320. Commands->Destroy_Object (obj);
  4321. }
  4322. else if (timer_id == 3)
  4323. {
  4324. Vector3 myloc = Commands->Get_Position(obj);
  4325. ActionParamsStruct params;
  4326. params.Set_Basic(this, 93, 1);
  4327. params.Set_Movement(myloc, 0.0, 5.0f);
  4328. params.Set_Attack(STAR, 200.0f, 0.0f, true);
  4329. params.AttackActive = true;
  4330. Commands->Action_Attack(obj, params);
  4331. }
  4332. }
  4333. // If an objective shouts, respond to it, letting it know the area is not cleared.
  4334. void Sound_Heard (GameObject * obj, const CombatSound & sound)
  4335. {
  4336. if (sound.Type == 1000)
  4337. {
  4338. if (sound.Creator)
  4339. {
  4340. Commands->Send_Custom_Event(obj, sound.Creator, 100, 1);
  4341. }
  4342. }
  4343. }
  4344. };
  4345. // This script handles approach vehicles.
  4346. DECLARE_SCRIPT (M02_Approach_Vehicle, "Area_ID:int")
  4347. {
  4348. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4349. {
  4350. if ((type == 0) && (param == 0))
  4351. {
  4352. Commands->Enable_Engine (obj, true);
  4353. // Unit is being activated. Determine waypath and follow it.
  4354. int area_id = Get_Int_Parameter("Area_ID");
  4355. ActionParamsStruct params;
  4356. params.Set_Basic(this, 100, 0);
  4357. params.Set_Movement(Vector3(0,0,0), 1.0f, 1.0f);
  4358. switch (area_id)
  4359. {
  4360. case (1):
  4361. {
  4362. params.WaypathID = 401009;
  4363. break;
  4364. }
  4365. case (4):
  4366. {
  4367. params.WaypathID = 401031;
  4368. break;
  4369. }
  4370. case (6):
  4371. {
  4372. params.WaypathID = 401039;
  4373. break;
  4374. }
  4375. }
  4376. Commands->Action_Goto(obj, params);
  4377. Commands->Start_Timer(obj, this, 6.0f, 0);
  4378. }
  4379. }
  4380. void Timer_Expired(GameObject * obj, int timer_id)
  4381. {
  4382. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4383. }
  4384. };
  4385. // This script is currently only used for an Orca above a SAM Site objective, in A03.
  4386. DECLARE_SCRIPT (M02_Destroy_Vehicle, "")
  4387. {
  4388. void Created (GameObject* obj)
  4389. {
  4390. Commands->Enable_Engine(obj, true);
  4391. Commands->Disable_Physical_Collisions(obj);
  4392. Commands->Start_Timer(obj, this, 4.0f, 1);
  4393. }
  4394. void Timer_Expired(GameObject * obj, int timer_id)
  4395. {
  4396. if (timer_id == 1)
  4397. {
  4398. ActionParamsStruct params;
  4399. params.Set_Basic(this, 99, 0);
  4400. params.Set_Movement(Vector3(0,0,0), 2.5f, 1.0f);
  4401. params.WaypathID = 400993;
  4402. params.WaypathSplined = true;
  4403. Commands->Action_Goto(obj, params);
  4404. Commands->Start_Timer(obj, this, 20.0f, 2);
  4405. }
  4406. else if (timer_id == 2)
  4407. {
  4408. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4409. }
  4410. }
  4411. void Damaged (GameObject* obj, GameObject* damager, float amount)
  4412. {
  4413. if (damager != STAR)
  4414. {
  4415. Commands->Apply_Damage(obj, 10000.0f, "Blamokiller");
  4416. }
  4417. }
  4418. void Enemy_Seen (GameObject * obj, GameObject * enemy)
  4419. {
  4420. ActionParamsStruct params;
  4421. params.Set_Basic(this, 90, 1);
  4422. params.Set_Attack(enemy, 200.0f, 0.0f, true);
  4423. params.AttackActive = true;
  4424. Commands->Action_Attack(obj, params);
  4425. }
  4426. };
  4427. DECLARE_SCRIPT (M02_Mendoza, "")
  4428. {
  4429. bool calling_extraction;
  4430. bool move_toggle;
  4431. float start_health;
  4432. float last_armor;
  4433. int counter;
  4434. REGISTER_VARIABLES()
  4435. {
  4436. SAVE_VARIABLE (calling_extraction, 1);
  4437. SAVE_VARIABLE (start_health, 2);
  4438. SAVE_VARIABLE (last_armor, 3);
  4439. SAVE_VARIABLE (counter, 4);
  4440. SAVE_VARIABLE (move_toggle, 5);
  4441. }
  4442. void Created (GameObject * obj)
  4443. {
  4444. start_health = Commands->Get_Health (obj);
  4445. last_armor = Commands->Get_Shield_Strength (obj);
  4446. calling_extraction = false;
  4447. move_toggle = false;
  4448. counter = 0;
  4449. Commands->Innate_Disable (obj);
  4450. ActionParamsStruct params;
  4451. params.Set_Basic (this, 98, 3);
  4452. params.Set_Attack (STAR, 300.0f, 0.0f, true);
  4453. Commands->Action_Attack(obj, params);
  4454. Commands->Start_Timer (obj, this, 2.0f, 1);
  4455. }
  4456. void Damaged (GameObject * obj, GameObject * damager, float amount)
  4457. {
  4458. Commands->Set_Health (obj, start_health);
  4459. last_armor -= 2.0f;
  4460. Commands->Set_Shield_Strength (obj, last_armor);
  4461. if (last_armor < 1.0f)
  4462. {
  4463. if (!calling_extraction)
  4464. {
  4465. calling_extraction = true;
  4466. ActionParamsStruct params;
  4467. params.Set_Basic(this, 100, 1);
  4468. params.Set_Movement(Vector3(1260.007f,535.460f,18.428f), RUN, 5.0f);
  4469. Commands->Action_Goto(obj, params);
  4470. }
  4471. }
  4472. }
  4473. void Action_Complete (GameObject * obj, int action_id, ActionCompleteReason complete_reason)
  4474. {
  4475. if (action_id == 1)
  4476. {
  4477. Commands->Innate_Disable (obj);
  4478. Vector3 my_location = Commands->Get_Position (obj);
  4479. GameObject * chinook_obj1 = Commands->Create_Object("Invisible_Object", my_location);
  4480. if (chinook_obj1)
  4481. {
  4482. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "XG_ROPE_EVAC_F.txt");
  4483. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0025", 100, 300, true);
  4484. Commands->Join_Conversation (obj, id, true, false, false);
  4485. Commands->Join_Conversation (STAR, id, true, false, false);
  4486. Commands->Join_Conversation (NULL, id);
  4487. Commands->Start_Conversation (id);
  4488. }
  4489. }
  4490. else if (action_id == 2)
  4491. {
  4492. ActionParamsStruct params;
  4493. params.Set_Basic (this, 98, 3);
  4494. params.Set_Attack (STAR, 300.0f, 0.0f, true);
  4495. Commands->Action_Attack(obj, params);
  4496. }
  4497. }
  4498. void Timer_Expired (GameObject * obj, int timer_id)
  4499. {
  4500. if ((timer_id == 1) && (!calling_extraction))
  4501. {
  4502. int id = Commands->Create_Conversation ("MX2DSGN_DSGN0019", 100, 300, true);
  4503. counter++;
  4504. if (counter > 6)
  4505. {
  4506. counter = 1;
  4507. }
  4508. switch (counter)
  4509. {
  4510. case (1):
  4511. {
  4512. id = Commands->Create_Conversation ("MX2DSGN_DSGN0019", 100, 300, true);
  4513. break;
  4514. }
  4515. case (2):
  4516. {
  4517. id = Commands->Create_Conversation ("MX2DSGN_DSGN0020", 100, 300, true);
  4518. break;
  4519. }
  4520. case (3):
  4521. {
  4522. id = Commands->Create_Conversation ("MX2DSGN_DSGN0021", 100, 300, true);
  4523. break;
  4524. }
  4525. case (4):
  4526. {
  4527. id = Commands->Create_Conversation ("MX2DSGN_DSGN0022", 100, 300, true);
  4528. break;
  4529. }
  4530. case (5):
  4531. {
  4532. id = Commands->Create_Conversation ("MX2DSGN_DSGN0023", 100, 300, true);
  4533. break;
  4534. }
  4535. case (6):
  4536. {
  4537. id = Commands->Create_Conversation ("MX2DSGN_DSGN0024", 100, 300, true);
  4538. break;
  4539. }
  4540. default:
  4541. {
  4542. id = Commands->Create_Conversation ("MX2DSGN_DSGN0024", 100, 300, true);
  4543. break;
  4544. }
  4545. }
  4546. Commands->Join_Conversation (obj, id, true, false, false);
  4547. Commands->Join_Conversation (STAR, id, true, false, false);
  4548. Commands->Start_Conversation (id);
  4549. Commands->Start_Timer (obj, this, 7.0f, 1);
  4550. if (!move_toggle)
  4551. {
  4552. move_toggle = true;
  4553. Commands->Action_Reset (obj, 100);
  4554. ActionParamsStruct params;
  4555. params.Set_Basic(this, 99, 2);
  4556. switch (Get_Int_Random (0,3))
  4557. {
  4558. case (0):
  4559. {
  4560. params.Set_Movement(Vector3(1248.592f,568.431f,17.396f), RUN, 5.0f);
  4561. break;
  4562. }
  4563. case (1):
  4564. {
  4565. params.Set_Movement(Vector3(1264.680f,564.459f,17.816f), RUN, 5.0f);
  4566. break;
  4567. }
  4568. case (2):
  4569. {
  4570. params.Set_Movement(Vector3(1270.220f,541.406f,17.978f), RUN, 5.0f);
  4571. break;
  4572. }
  4573. case (3):
  4574. {
  4575. params.Set_Movement(Vector3(1251.213f,544.658f,17.854f), RUN, 5.0f);
  4576. break;
  4577. }
  4578. default:
  4579. {
  4580. params.Set_Movement(Vector3(1260.007f,535.460f,18.428f), RUN, 5.0f);
  4581. break;
  4582. }
  4583. }
  4584. Commands->Action_Goto(obj, params);
  4585. }
  4586. else
  4587. {
  4588. move_toggle = false;
  4589. }
  4590. }
  4591. }
  4592. };
  4593. DECLARE_SCRIPT (M02_Nod_Jet, "")
  4594. {
  4595. void Created (GameObject * obj)
  4596. {
  4597. Commands->Enable_Engine (obj, true);
  4598. Commands->Disable_Physical_Collisions (obj);
  4599. ActionParamsStruct params;
  4600. params.MovePathfind = false;
  4601. params.Set_Basic(this, 100, 1);
  4602. params.Set_Movement(Vector3(1143.09f,702.08f,70.5f), 4.0f, 5.0f);
  4603. Commands->Action_Goto(obj, params);
  4604. }
  4605. void Action_Complete (GameObject * obj, int action_id, ActionCompleteReason complete_reason)
  4606. {
  4607. if (action_id == 1)
  4608. {
  4609. Commands->Destroy_Object (obj);
  4610. }
  4611. }
  4612. };
  4613. DECLARE_SCRIPT (M02_Nod_Jet_Waypath, "")
  4614. {
  4615. void Created (GameObject * obj)
  4616. {
  4617. Commands->Enable_Engine (obj, true);
  4618. Commands->Disable_Physical_Collisions (obj);
  4619. ActionParamsStruct params;
  4620. params.Set_Basic(this, 100, 1);
  4621. params.Set_Movement(Vector3(0,0,0), 4.0f, 5.0f);
  4622. params.WaypathID = 403389;
  4623. params.WaypathSplined = true;
  4624. Commands->Action_Goto(obj, params);
  4625. }
  4626. void Action_Complete (GameObject * obj, int action_id, ActionCompleteReason complete_reason)
  4627. {
  4628. if (action_id == 1)
  4629. {
  4630. Commands->Destroy_Object (obj);
  4631. }
  4632. }
  4633. };
  4634. DECLARE_SCRIPT (M02_GDI_Helicopter, "")
  4635. {
  4636. void Created (GameObject * obj)
  4637. {
  4638. Commands->Enable_Engine (obj, true);
  4639. Commands->Disable_Physical_Collisions (obj);
  4640. ActionParamsStruct params;
  4641. params.Set_Basic(this, 100, 1);
  4642. params.Set_Movement(Vector3(-246.87f,17.42f,100.75f), 1.0f, 5.0f);
  4643. Commands->Action_Goto(obj, params);
  4644. }
  4645. void Action_Complete (GameObject * obj, int action_id, ActionCompleteReason complete_reason)
  4646. {
  4647. if (action_id == 1)
  4648. {
  4649. Commands->Destroy_Object (obj);
  4650. }
  4651. }
  4652. };
  4653. DECLARE_SCRIPT (M02_Commando_Start, "")
  4654. {
  4655. void Created (GameObject * obj)
  4656. {
  4657. Commands->Give_PowerUp (obj, "POW_MineRemote_Player", false);
  4658. Commands->Give_PowerUp (obj, "POW_Chaingun_Player", false);
  4659. Commands->Give_PowerUp (obj, "POW_SniperRifle_Player", false);
  4660. }
  4661. };
  4662. DECLARE_SCRIPT (M02_Data_Disk, "Disk_ID:int")
  4663. {
  4664. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4665. {
  4666. if (type == CUSTOM_EVENT_POWERUP_GRANTED)
  4667. {
  4668. int id = Get_Int_Parameter ("Disk_ID");
  4669. Vector3 reveal_loc = Vector3 (0,0,0);
  4670. int radius = 15;
  4671. switch (id)
  4672. {
  4673. case (1): // Disk Reveals the Ski Resort
  4674. {
  4675. reveal_loc = Vector3(425.76f,840.78f,8.19f);
  4676. radius = 15;
  4677. break;
  4678. }
  4679. case (2): // Disk Reveals the Dam Area
  4680. {
  4681. reveal_loc = Vector3(1016.43f,885.96f,35.41f);
  4682. radius = 30;
  4683. break;
  4684. }
  4685. default: // Disk Reveals the Hand of Nod
  4686. {
  4687. reveal_loc = Vector3(1204.46f,565.35f,37.84f);
  4688. radius = 15;
  4689. break;
  4690. }
  4691. }
  4692. Commands->Clear_Map_Region_By_Pos (reveal_loc, radius);
  4693. Commands->Set_HUD_Help_Text (IDS_M00EVAG_DSGN0103I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  4694. }
  4695. }
  4696. };
  4697. DECLARE_SCRIPT (M02_Encyclopedia_Reveal, "Disk_ID:int")
  4698. {
  4699. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4700. {
  4701. if (type == CUSTOM_EVENT_POWERUP_GRANTED)
  4702. {
  4703. int id = Get_Int_Parameter ("Disk_ID");
  4704. switch (id)
  4705. {
  4706. case (1):
  4707. {
  4708. Commands->Reveal_Encyclopedia_Vehicle (5);
  4709. break;
  4710. }
  4711. default:
  4712. {
  4713. Commands->Reveal_Encyclopedia_Building (15);
  4714. break;
  4715. }
  4716. }
  4717. Commands->Set_HUD_Help_Text (IDS_M00EVAG_DSGN0104I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY);
  4718. }
  4719. }
  4720. };