Mission06.cpp 155 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710
  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. * Mission06.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 6 script
  25. *
  26. * PROGRAMMER
  27. * David Shuman
  28. *
  29. * VERSION INFO
  30. * $Author: Darren_k $
  31. * $Revision: 136 $
  32. * $Modtime: 2/05/02 4:18p $
  33. * $Archive: /Commando/Code/Scripts/Mission06.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission6.h"
  39. #include <string.h>
  40. #include <stdio.h>
  41. // ************************* M06B
  42. // Objective Controller
  43. DECLARE_SCRIPT(M06_Objective_Controller, "") // 100018
  44. {
  45. int mendoza_id;
  46. bool accomplished_609;
  47. enum {HAVOCS_SCRIPT, M06_INITIAL_APACHES};
  48. // Register variables to be Auto-Saved
  49. // All variables must have a unique ID, less than 256, that never changes
  50. REGISTER_VARIABLES()
  51. {
  52. SAVE_VARIABLE( mendoza_id, 1 );
  53. SAVE_VARIABLE( accomplished_609, 2 );
  54. }
  55. void Created(GameObject * obj)
  56. {
  57. // Background Music
  58. Commands->Set_Background_Music ("06-onyourfeet.mp3");
  59. // Scale their sight and hearing back
  60. // Commands->Scale_AI_Awareness(.5f, .5f );
  61. Commands->Start_Timer (obj, this, 1.0f, HAVOCS_SCRIPT);
  62. Commands->Enable_Hibernation(obj, false);
  63. mendoza_id = 0;
  64. accomplished_609 = false;
  65. // EVA - Give me a position on the scientists.\n
  66. const char *conv_name = ("M06_CON059");
  67. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  68. Commands->Join_Conversation(STAR, conv_id, false, true);
  69. Commands->Join_Conversation(NULL, conv_id, false, true);
  70. Commands->Start_Conversation (conv_id, 300601);
  71. Commands->Monitor_Conversation (obj, conv_id);
  72. Add_An_Objective(605);
  73. Add_An_Objective(607);
  74. Add_An_Objective(608);
  75. // Add_An_Objective(609);
  76. // Add_An_Objective(610);
  77. Commands->Start_Timer (obj, this, 6.0f, M06_INITIAL_APACHES);
  78. }
  79. void Add_An_Objective(int id)
  80. {
  81. GameObject *object;
  82. switch (id)
  83. {
  84. // Hack War Room Computer
  85. case 601:
  86. {
  87. Commands->Add_Objective(601, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_02, NULL, IDS_Enc_Obj_Primary_M06_02);
  88. object = Commands->Find_Object(106952);
  89. if(object)
  90. {
  91. Commands->Set_Objective_Radar_Blip_Object(601, object);
  92. Commands->Set_Objective_HUD_Info_Position(601, 90.0f, "POG_M06_1_03.tga", IDS_POG_HACK, Commands->Get_Position (object));
  93. }
  94. }
  95. break;
  96. // Rescue Scientists
  97. case 603:
  98. {
  99. Commands->Add_Objective(603, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_01, NULL, IDS_Enc_Obj_Primary_M06_01);
  100. object = Commands->Find_Object(101010);
  101. if(object)
  102. {
  103. Commands->Set_Objective_Radar_Blip_Object(603, object);
  104. Commands->Set_Objective_HUD_Info_Position(603, 90.0f, "POG_M06_1_04.tga", IDS_POG_RESCUE, Commands->Get_Position (object));
  105. }
  106. }
  107. break;
  108. // Eliminate Mendoza
  109. case 604:
  110. {
  111. Commands->Add_Objective(604, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_04, NULL, IDS_Enc_Obj_Primary_M06_04);
  112. // object = Commands->Find_Object(mendoza_id);
  113. object = Commands->Find_Object(108275);
  114. if(object)
  115. {
  116. Commands->Set_Objective_Radar_Blip_Object(604, object);
  117. Commands->Set_Objective_HUD_Info_Position(604, 90.0f, "POG_M06_1_01.tga", IDS_POG_ELIMINATE, Commands->Get_Position (object));
  118. }
  119. }
  120. break;
  121. // Rescue Resistance
  122. case 605:
  123. {
  124. Commands->Add_Objective(605, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_02, NULL, IDS_Enc_Obj_Hidden_M06_02);
  125. object = Commands->Find_Object(101016);
  126. }
  127. break;
  128. // Release GDI prisoner
  129. case 607:
  130. {
  131. Commands->Add_Objective(607, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_03, NULL, IDS_Enc_Obj_Hidden_M06_03);
  132. }
  133. break;
  134. // Plunder Raveshaw's hidden cache
  135. case 608:
  136. {
  137. Commands->Add_Objective(608, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_04, NULL, IDS_Enc_Obj_Hidden_M06_04);
  138. }
  139. break;
  140. // Deactivate alarm system
  141. case 609:
  142. {
  143. Commands->Add_Objective(609, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M06_01, NULL, IDS_Enc_Obj_Hidden_M06_01);
  144. Vector3 star_pos = Commands->Get_Position(STAR);
  145. Vector3 greenhouse_alarm = Commands->Get_Position(Commands->Find_Object(101548));
  146. Vector3 shower_alarm = Commands->Get_Position(Commands->Find_Object(101549));
  147. float star_greenhouse = Commands->Get_Distance(star_pos, greenhouse_alarm);
  148. float star_shower = Commands->Get_Distance(star_pos, shower_alarm);
  149. if(star_greenhouse == (WWMath::Min(star_greenhouse, star_shower)))
  150. {
  151. object = Commands->Find_Object(101548);
  152. if(object)
  153. {
  154. Commands->Set_Objective_Radar_Blip_Object(609, object);
  155. Commands->Set_Objective_HUD_Info_Position(609, 90.0f, "POG_M08_2_02.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
  156. }
  157. }
  158. else
  159. {
  160. object = Commands->Find_Object(101549);
  161. if(object)
  162. {
  163. Commands->Set_Objective_Radar_Blip_Object(609, object);
  164. Commands->Set_Objective_HUD_Info_Position(609, 90.0f, "POG_M08_2_02.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
  165. }
  166. }
  167. }
  168. break;
  169. // Alarm State: Stand Down
  170. case 610:
  171. {
  172. Commands->Add_Objective(610, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_HIDDEN, 1000, NULL);
  173. }
  174. break;
  175. // Escape Chateau with Dr. Sydney Mobius
  176. case 611:
  177. {
  178. Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1007I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  179. Commands->Add_Objective(611, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_03, NULL, IDS_Enc_Obj_Primary_M06_03);
  180. object = Commands->Find_Object(101527);
  181. if(object)
  182. {
  183. Commands->Set_Objective_Radar_Blip_Object(611, object);
  184. Commands->Set_Objective_HUD_Info_Position(611, 90.0f, "POG_M06_1_05.tga", IDS_POG_ESCORT, Commands->Get_Position (object));
  185. }
  186. }
  187. break;
  188. }
  189. }
  190. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  191. {
  192. if(type == M06_MENDOZA_ID)
  193. {
  194. mendoza_id = param;
  195. }
  196. if(type == 666 && param == 666)
  197. {
  198. Commands->Start_Timer (obj, this, 2.0f, M06_DEAD_HAVOC);
  199. }
  200. if(type > 611)
  201. {
  202. return;
  203. }
  204. switch (param)
  205. {
  206. case 1:
  207. {
  208. if(type == 609 && accomplished_609)
  209. {
  210. return;
  211. }
  212. Commands->Clear_Radar_Marker (type);
  213. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  214. if(type == 604)
  215. {
  216. Commands->Mission_Complete ( true );
  217. }
  218. if(type == 609)
  219. {
  220. accomplished_609 = true;
  221. }
  222. }
  223. break;
  224. case 2:
  225. {
  226. Commands->Clear_Radar_Marker (type);
  227. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  228. if(type == 611)
  229. {
  230. Commands->Mission_Complete ( false );
  231. }
  232. }
  233. break;
  234. case 3:
  235. Add_An_Objective(type);
  236. break;
  237. case 4:
  238. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  239. break;
  240. case 5:
  241. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_HIDDEN);
  242. break;
  243. }
  244. }
  245. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  246. {
  247. if(action_id == 300601 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  248. {
  249. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 601, 3, 0.0f);
  250. }
  251. }
  252. void Timer_Expired(GameObject * obj, int timer_id )
  253. {
  254. if(timer_id == HAVOCS_SCRIPT)
  255. {
  256. // Commands->Attach_Script(STAR, "M06_Havoc_DLS", "");
  257. }
  258. if(timer_id == M06_DEAD_HAVOC)
  259. {
  260. // Commands->Attach_Script(STAR, "M06_Havoc_DLS", "");
  261. }
  262. if(timer_id == M06_INITIAL_APACHES)
  263. {
  264. // Initial Apaches
  265. GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  266. Commands->Attach_Script(controller1, "Test_Cinematic", "X6A_Apache_01.txt");
  267. GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  268. Commands->Attach_Script(controller2, "Test_Cinematic", "X6A_Apache_02.txt");
  269. }
  270. }
  271. };
  272. // WarRoom Computer
  273. DECLARE_SCRIPT(M06_WarRoom_Computer, "")
  274. {
  275. bool already_poked;
  276. // Register variables to be Auto-Saved
  277. // All variables must have a unique ID, less than 256, that never changes
  278. REGISTER_VARIABLES()
  279. {
  280. SAVE_VARIABLE( already_poked, 1 );
  281. }
  282. void Created (GameObject * obj)
  283. {
  284. already_poked = false;
  285. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  286. }
  287. void Poked(GameObject * obj, GameObject * poker)
  288. {
  289. if (Commands->Is_A_Star(poker) && (!already_poked))
  290. {
  291. // Data decryption complete. Internal computer systems indicate Dr. Ignatio Mobius is located beneath the Chateau. Access is gained through the dining hall.\n
  292. const char *conv_name = ("M06_CON001");
  293. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  294. Commands->Join_Conversation(NULL, conv_id, true, true);
  295. Commands->Join_Conversation(STAR, conv_id, false, true);
  296. Commands->Start_Conversation (conv_id, 300603);
  297. Commands->Monitor_Conversation (obj, conv_id);
  298. already_poked = true;
  299. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  300. Commands->Create_Object ("Level_03_Keycard", Vector3 (35.263F, 16.432F, 13.382F));
  301. }
  302. }
  303. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  304. {
  305. ActionParamsStruct params;
  306. if(action_id == 300603 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  307. {
  308. // New Primary Mission Objective: Evacuate Doctors' Ignatio and Sydney Mobius. Basement, NE section. Requires level 2 security keycard.
  309. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 601, 1, 0.0f);
  310. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 603, 3, 1.0f);
  311. }
  312. }
  313. };
  314. #define SYDNEY_MOVE_TABLE_SIZE ( sizeof(Sydney_Move_Table) / sizeof (Sydney_Move_Table[0]) )
  315. const int Sydney_Move_Table[] =
  316. {
  317. 101567,
  318. 101569,
  319. 101571,
  320. 101573,
  321. 101575,
  322. 101577,
  323. 101579,
  324. 101581,
  325. 101582,
  326. 101584,
  327. 101586,
  328. 101587,
  329. 101588
  330. };
  331. DECLARE_SCRIPT(M06_Sydney_Mobius, "")
  332. {
  333. int poke_id;
  334. bool dont_move;
  335. int current_move_loc;
  336. enum {CHECK_DISTANCE = 20, SYDNEY_MOVE_LOC, MOVE_LOC_LOW_PRIORITY};
  337. // Register variables to be Auto-Saved
  338. // All variables must have a unique ID, less than 256, that never changes
  339. REGISTER_VARIABLES()
  340. {
  341. SAVE_VARIABLE( poke_id, 1 );
  342. SAVE_VARIABLE( dont_move, 2 );
  343. SAVE_VARIABLE( current_move_loc, 3 );
  344. }
  345. void Created (GameObject * obj)
  346. {
  347. Commands->Set_Innate_Is_Stationary(obj, true);
  348. Commands->Grant_Key (obj, 3, true);
  349. poke_id = 4;
  350. dont_move = true;
  351. current_move_loc = 0;
  352. }
  353. void Poked(GameObject * obj, GameObject * poker)
  354. {
  355. ActionParamsStruct params;
  356. switch(poke_id)
  357. {
  358. case 1:
  359. {
  360. // \\Hold here. I'll be back.\n
  361. const char *conv_name = ("M06_CON002");
  362. int conv_id = Commands->Create_Conversation (conv_name);
  363. Commands->Join_Conversation(STAR, conv_id, false, true);
  364. Commands->Start_Conversation (conv_id, 1);
  365. Commands->Monitor_Conversation (obj, conv_id);
  366. Commands->Set_Innate_Is_Stationary(obj, true);
  367. dont_move = true;
  368. poke_id = 2;
  369. }
  370. break;
  371. case 2:
  372. {
  373. // \\Let's keep moving.\n
  374. const char *conv_name = ("M06_CON003");
  375. int conv_id = Commands->Create_Conversation (conv_name);
  376. Commands->Join_Conversation(STAR, conv_id, false, true);
  377. Commands->Start_Conversation (conv_id, 1);
  378. Commands->Monitor_Conversation (obj, conv_id);
  379. Commands->Set_Innate_Is_Stationary(obj, false);
  380. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
  381. params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
  382. Commands->Action_Goto (obj, params);
  383. poke_id = 1;
  384. dont_move = false;
  385. }
  386. break;
  387. }
  388. }
  389. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  390. {
  391. ActionParamsStruct params;
  392. if(type == M06_RELOCATE)
  393. {
  394. if(param == 0)
  395. {
  396. Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(107606)));
  397. // Relocate Havoc
  398. Commands->Send_Custom_Event(obj, STAR, M06_RELOCATE, 0, 0.0f);
  399. // Activate MidtroC zone
  400. Commands->Send_Custom_Event (obj, Commands->Find_Object(108285), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  401. // Move Sydney to initial move location
  402. Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
  403. dont_move = false;
  404. // Start the destruction stub sequence
  405. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 100, 100, 2.0f);
  406. // Accomplish mission objective to rescue scientists
  407. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 603, 1, 1.0f);
  408. // Mission objective to escort Sydney out of Chateau
  409. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 611, 3, 2.0f);
  410. // Clost and lock door to lab
  411. // Door to the lab
  412. Commands->Static_Anim_Phys_Goto_Frame ( 1300001615, 0, "DOOR_0.DOOR_0");
  413. }
  414. if(param == 1)
  415. {
  416. Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108277)));
  417. // Relocate Havoc
  418. Commands->Send_Custom_Event(obj, STAR, M06_RELOCATE, 1, 0.0f);
  419. // Accomplish Mission Objective for Sydney Escort out of Chateau
  420. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 611, 1, 1.0f);
  421. // Relocate Mendoza
  422. //Commands->Send_Custom_Event(obj, Commands->Find_Object(108275), M06_RELOCATE, 0, 0.0f);
  423. //
  424. // Play the boss music
  425. //
  426. // Commands->Set_Background_Music ("Mendoza_Battle1.mp3");
  427. //
  428. // Create and position Mendoza
  429. //
  430. GameObject *mendoza = Commands->Create_Object ("Mendoza Boss", Vector3 (-40.572F, 28.942F, 1.605F));
  431. if (mendoza != NULL) {
  432. Commands->Set_Facing (mendoza, -50.0F);
  433. }
  434. // GameObject *mendoza = Commands->Create_Object ("Nod_FlameThrower_3Boss", Vector3 (-40.572F, 28.942F, 1.605F));
  435. // if (mendoza != NULL) {
  436. // Commands->Set_Facing (mendoza, -50.0F);
  437. // Commands->Attach_Script(mendoza, "M06_Mendoza", "");
  438. // }
  439. // Mission objective to defeat Mendoza
  440. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 604, 3, 0.0f);
  441. // Make Sydney indestructible
  442. Commands->Set_Shield_Strength (obj, 100 );
  443. Commands->Set_Shield_Type (obj, "Blamo");
  444. //
  445. // Create logical sound to remove all other players in fight with Mendoza
  446. //
  447. Commands->Create_Logical_Sound(obj, M06_CLEAR_FOR_MENDOZA, Commands->Get_Position(obj), 2500.0f);
  448. }
  449. }
  450. if(type == M06_MOVE_SYDNEY && !dont_move)
  451. {
  452. current_move_loc = param;
  453. if(current_move_loc == 12)
  454. {
  455. poke_id = 4;
  456. }
  457. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
  458. params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
  459. Commands->Action_Goto (obj, params);
  460. }
  461. }
  462. void Damaged( GameObject * obj, GameObject * damager, float amount )
  463. {
  464. // Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
  465. }
  466. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  467. {
  468. ActionParamsStruct params;
  469. if(action_id == SYDNEY_MOVE_LOC && reason == ACTION_COMPLETE_NORMAL)
  470. {
  471. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  472. }
  473. if((action_id == SYDNEY_MOVE_LOC) && (action_id != Commands->Get_Action_ID(obj)) && (!Commands->Is_Performing_Pathfind_Action(obj)) && (reason == ACTION_COMPLETE_LOW_PRIORITY))
  474. {
  475. Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
  476. }
  477. }
  478. void Timer_Expired(GameObject * obj, int timer_id )
  479. {
  480. ActionParamsStruct params;
  481. if(timer_id == MOVE_LOC_LOW_PRIORITY)
  482. {
  483. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
  484. params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
  485. Commands->Action_Goto (obj, params);
  486. }
  487. if(timer_id == CHECK_DISTANCE)
  488. {
  489. Commands->Start_Timer (obj, this, 10.0f, CHECK_DISTANCE);
  490. }
  491. if(timer_id == CHECK_DISTANCE && poke_id == 2)
  492. {
  493. Vector3 star_pos = Commands->Get_Position(STAR);
  494. Vector3 sydney_pos = Commands->Get_Position(obj);
  495. float distance_to_star = Commands->Get_Distance(star_pos, sydney_pos);
  496. if(distance_to_star > 15.0f)
  497. {
  498. // Don't leave me here!\n
  499. const char *conv_name = ("M06_CON005");
  500. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  501. Commands->Join_Conversation(obj, conv_id, false, true);
  502. Commands->Start_Conversation (conv_id, 1);
  503. Commands->Monitor_Conversation (obj, conv_id);
  504. }
  505. }
  506. else if(timer_id == CHECK_DISTANCE && poke_id == 1)
  507. {
  508. Vector3 star_pos = Commands->Get_Position(STAR);
  509. Vector3 sydney_pos = Commands->Get_Position(obj);
  510. float distance_to_star = Commands->Get_Distance(star_pos, sydney_pos);
  511. if(distance_to_star > 15.0f)
  512. {
  513. // Wait for me!\n
  514. const char *conv_name = ("M06_CON006");
  515. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  516. Commands->Join_Conversation(obj, conv_id, false, true);
  517. Commands->Start_Conversation (conv_id, 1);
  518. Commands->Monitor_Conversation (obj, conv_id);
  519. }
  520. }
  521. }
  522. void Killed (GameObject * obj, GameObject * killer)
  523. {
  524. Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1008I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  525. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 611, 2, 0.0f);
  526. }
  527. };
  528. DECLARE_SCRIPT(M06_MidtroB_Explosion_Controller, "Loc0_ID=0:int, Loc1_ID=0:int, Loc2_ID=0:int, Loc3_ID=0:int, Loc4_ID=0:int")
  529. {
  530. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  531. {
  532. if(type == M06_MIDTRO_EXPLOSION)
  533. {
  534. int explode_loc[5];
  535. explode_loc[0] = Get_Int_Parameter("Loc0_ID");
  536. explode_loc[1] = Get_Int_Parameter("Loc1_ID");
  537. explode_loc[2] = Get_Int_Parameter("Loc2_ID");
  538. explode_loc[3] = Get_Int_Parameter("Loc3_ID");
  539. explode_loc[4] = Get_Int_Parameter("Loc4_ID");
  540. Commands->Create_Explosion("Chateau_Explosions_Twiddler", Commands->Get_Position(Commands->Find_Object(explode_loc[param])));
  541. }
  542. }
  543. };
  544. DECLARE_SCRIPT(M06_Activate_Midtro, "")
  545. {
  546. bool already_entered;
  547. // Register variables to be Auto-Saved
  548. // All variables must have a unique ID, less than 256, that never changes
  549. REGISTER_VARIABLES()
  550. {
  551. SAVE_VARIABLE( already_entered, 1 );
  552. }
  553. void Created (GameObject * obj)
  554. {
  555. already_entered = false;
  556. // Door to the lab
  557. Commands->Static_Anim_Phys_Goto_Frame ( 1300001615, 0, "DOOR_0.DOOR_0");
  558. // Raveshaw/Mendoza door
  559. Commands->Static_Anim_Phys_Goto_Frame ( 1553454, 0, "DOOR_0.DOOR_0");
  560. }
  561. void Entered (GameObject * obj, GameObject * enterer)
  562. {
  563. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  564. {
  565. // Open door to lab
  566. Commands->Static_Anim_Phys_Goto_Last_Frame ( 1300001615, "DOOR_0.DOOR_0" );
  567. // Open Raveshaw/Mendoza Door
  568. Commands->Static_Anim_Phys_Goto_Last_Frame ( 1553454, "DOOR_0.DOOR_0" );
  569. already_entered = true;
  570. // Commands->Send_Custom_Event (obj, Commands->Find_Object(101010), 100, 100, 0.0f);
  571. Vector3 havoc_loc = Commands->Get_Position (STAR);
  572. havoc_loc.Z += 7.0f;
  573. Commands->Set_Position (STAR, havoc_loc );
  574. GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  575. Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X6B_MIDTRO.txt");
  576. // Grant armor increase medal
  577. Commands->Create_Object ( "POW_Medal_Health", Vector3(-1.472f, 31.216f, -9.000f));
  578. }
  579. }
  580. };
  581. DECLARE_SCRIPT(M06_Destruction_Stub, "")
  582. {
  583. enum {SHAKE_TIMER};
  584. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  585. {
  586. if(type == 100 && param == 100)
  587. {
  588. // Activate destruction zones
  589. Commands->Send_Custom_Event(obj, Commands->Find_Object(104312), M06_CHATEAU_COLLAPSE, 1, 0.0f);
  590. Commands->Send_Custom_Event(obj, Commands->Find_Object(105635), M06_CHATEAU_COLLAPSE, 1, 0.0f);
  591. Commands->Send_Custom_Event(obj, Commands->Find_Object(105639), M06_CHATEAU_COLLAPSE, 1, 0.0f);
  592. Commands->Send_Custom_Event(obj, Commands->Find_Object(105640), M06_CHATEAU_COLLAPSE, 1, 0.0f);
  593. Commands->Send_Custom_Event(obj, Commands->Find_Object(105641), M06_CHATEAU_COLLAPSE, 1, 0.0f);
  594. // Create destruction path blocks
  595. GameObject *crate1 = Commands->Create_Object("X6_Rubble1", Vector3(23.453f, 16.340f, -2.000f));
  596. Commands->Set_Facing( crate1, -65.000f );
  597. GameObject *crate2 = Commands->Create_Object("X6_Rubble2", Vector3(27.086f, 28.569f, -1.454f));
  598. Commands->Set_Facing( crate2, 0.000f );
  599. GameObject *crate3 = Commands->Create_Object("X6_Rubble2", Vector3(25.614f, 33.324f, -0.043f));
  600. Commands->Set_Facing( crate3, 125.000f );
  601. GameObject *crate4 = Commands->Create_Object("X6_Rubble3", Vector3(14.597f, -30.510f, -0.033f));
  602. Commands->Set_Facing( crate4, 140.000f );
  603. GameObject *crate5 = Commands->Create_Object("X6_Rubble4", Vector3(25.079f, 28.012f, -2.007f));
  604. Commands->Set_Facing( crate5, -60.000f );
  605. GameObject *crate6 = Commands->Create_Object("X6_Rubble4", Vector3(26.463f, 27.382f, -2.003f));
  606. Commands->Set_Facing( crate6, 0.000f );
  607. GameObject *crate7 = Commands->Create_Object("X6_Rubble4", Vector3(38.426f, 2.889f, 2.574f));
  608. Commands->Set_Facing( crate7, -35.000f );
  609. GameObject *crate8 = Commands->Create_Object("X6_Rubble4", Vector3(40.258f, 3.442f, 2.798f));
  610. Commands->Set_Facing( crate8, -180.000f );
  611. GameObject *crate9 = Commands->Create_Object("X6_Rubble4", Vector3(9.832f, -35.126f, -0.014f));
  612. Commands->Set_Facing( crate9, 5.000f );
  613. GameObject *crate10 = Commands->Create_Object("X6_Rubble4", Vector3(4.503f, -33.694f, 3.003f));
  614. Commands->Set_Facing( crate10, 150.000f );
  615. GameObject *crate11 = Commands->Create_Object("X6_Rubble4", Vector3(1.179f, -33.281f, -0.042f));
  616. Commands->Set_Facing( crate11, -160.000f );
  617. GameObject *crate12 = Commands->Create_Object("X6_Rubble4", Vector3(-5.442f, -28.292f, 0.003f));
  618. Commands->Set_Facing( crate12, -15.000f );
  619. GameObject *crate13 = Commands->Create_Object("X6_Rubble4", Vector3(-5.423f, -12.960f, 0.000f));
  620. Commands->Set_Facing( crate13, 110.000f );
  621. GameObject *crate14 = Commands->Create_Object("X6_Rubble5", Vector3(8.042f, 27.962f, -0.150f));
  622. Commands->Set_Facing( crate14, 150.000f );
  623. GameObject *crate15 = Commands->Create_Object("X6_Rubble5", Vector3(9.271f, 28.300f, -0.001f));
  624. Commands->Set_Facing( crate15, -5.000f );
  625. GameObject *crate16 = Commands->Create_Object("X6_Rubble5", Vector3(7.208f, 30.813f, 4.400f));
  626. Commands->Set_Facing( crate16, 142.684f );
  627. GameObject *crate17 = Commands->Create_Object("X6_Rubble5", Vector3(5.628f, 29.865f, -0.025f));
  628. Commands->Set_Facing( crate17, 115.000f );
  629. GameObject *crate18 = Commands->Create_Object("X6_Rubble5", Vector3(38.716f, 4.235f, 2.374f));
  630. Commands->Set_Facing( crate18, 50.000f );
  631. GameObject *crate19 = Commands->Create_Object("X6_Rubble5", Vector3(13.124f, -30.323f, 0.000f));
  632. Commands->Set_Facing( crate19, 5.000f );
  633. GameObject *crate20 = Commands->Create_Object("X6_Rubble5", Vector3(8.932f, -34.790f, -0.000f));
  634. Commands->Set_Facing( crate20, -0.000f );
  635. GameObject *crate21 = Commands->Create_Object("X6_Rubble5", Vector3(6.464f, -33.466f, 2.978f));
  636. Commands->Set_Facing( crate21, 0.000f );
  637. GameObject *crate22 = Commands->Create_Object("X6_Rubble5", Vector3(2.144f, -33.484f, 0.007f));
  638. Commands->Set_Facing( crate22, 0.000f );
  639. GameObject *crate23 = Commands->Create_Object("X6_Rubble5", Vector3(-5.275f, -27.057f, 0.000f));
  640. Commands->Set_Facing( crate23, 70.000f );
  641. GameObject *crate24 = Commands->Create_Object("X6_Rubble5", Vector3(-5.932f, -11.340f, 0.000f));
  642. Commands->Set_Facing( crate24, 25.000f );
  643. GameObject *crate25 = Commands->Create_Object("X6_Rubble5", Vector3(-4.760f, -1.653f, 0.000f));
  644. Commands->Set_Facing( crate25, 110.000f );
  645. GameObject *crate26 = Commands->Create_Object("X6_Rubble5", Vector3(-5.332f, -2.713f, 0.277f));
  646. Commands->Set_Facing( crate26, 0.000f );
  647. GameObject *crate27 = Commands->Create_Object("X6_Rubble5", Vector3(5.699f, -32.438f, 2.563f));
  648. Commands->Set_Facing( crate27, -120.000f );
  649. float shake_timer = Commands->Get_Random(0.0f, 3.0f);
  650. Commands->Start_Timer (obj, this, shake_timer, SHAKE_TIMER);
  651. }
  652. }
  653. void Timer_Expired(GameObject * obj, int timer_id )
  654. {
  655. // Shake the Chateau to simulate collapse
  656. if(timer_id == SHAKE_TIMER)
  657. {
  658. // Explosions near Star to simulate collapse
  659. // Vector3 star_pos = Commands->Get_Position(STAR);
  660. // Vector3 explode_loc;
  661. // explode_loc.X = star_pos.X + Commands->Get_Random(5.0f, 10.0f);
  662. // explode_loc.Y = star_pos.Y + Commands->Get_Random(5.0f, 10.0f);
  663. // explode_loc.Z = star_pos.Z; //+ Commands->Get_Random(5.0f, 10.0f);
  664. float distance = Commands->Get_Random(-12.0f, 12.0f);
  665. distance *= 3;
  666. Vector3 pos = Commands->Get_Position(STAR);
  667. float facing = Commands->Get_Facing(STAR);
  668. float a = cos(DEG_TO_RADF(facing)) * distance;
  669. float b = sin(DEG_TO_RADF(facing)) * distance;
  670. Vector3 explode_loc = pos + Vector3(a, b, 0.0f);
  671. Commands->Create_Explosion("Chateau_Explosions_Twiddler", explode_loc, obj);
  672. float shake_timer = Commands->Get_Random(1.0f, 5.0f);
  673. Commands->Start_Timer (obj, this, Commands->Get_Random(2.0f, 8.0f), SHAKE_TIMER);
  674. // Shake the Chateau to simulate collapse
  675. float camera_intensity = Commands->Get_Random(.01f,.09f);
  676. float camera_duration = shake_timer - 1.0f;
  677. Commands->Shake_Camera(Vector3 (-12.0f, 40.0f, -9.0f), 1000.0f, camera_intensity, camera_duration);
  678. }
  679. }
  680. };
  681. DECLARE_SCRIPT(M06_Mendoza, "")
  682. {
  683. void Killed (GameObject * obj, GameObject * killer)
  684. {
  685. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 604, 1, 0.0f);
  686. }
  687. };
  688. DECLARE_SCRIPT(M06_GDI_Prisoner, "")
  689. {
  690. bool conversation;
  691. bool poked;
  692. enum{ESCAPE_CHATEAU};
  693. // Register variables to be Auto-Saved
  694. // All variables must have a unique ID, less than 256, that never changes
  695. REGISTER_VARIABLES()
  696. {
  697. SAVE_VARIABLE( conversation, 1 );
  698. SAVE_VARIABLE( poked, 2 );
  699. }
  700. void Created (GameObject * obj)
  701. {
  702. conversation = false;
  703. poked = false;
  704. Commands->Set_Innate_Is_Stationary(obj, true);
  705. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  706. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  707. }
  708. void Poked(GameObject * obj, GameObject * poker)
  709. {
  710. if ((Commands->Is_A_Star(poker)) && (!conversation) && (!poked))
  711. {
  712. // Thank for the release. I've got a Nod officer I've got to hunt down.\n
  713. const char *conv_name = ("M06_CON008");
  714. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  715. Commands->Join_Conversation(obj, conv_id, false, true);
  716. Commands->Join_Conversation(poker, conv_id, false, true);
  717. Commands->Start_Conversation (conv_id, 300607);
  718. Commands->Monitor_Conversation (obj, conv_id);
  719. conversation = true;
  720. poked = true;
  721. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  722. Commands->Grant_Key (STAR, 3, true);
  723. }
  724. }
  725. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  726. {
  727. ActionParamsStruct params;
  728. if(action_id == 300607 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  729. {
  730. conversation = false;
  731. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 607, 1, 0.5f);
  732. Commands->Set_Innate_Is_Stationary(obj, false);
  733. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  734. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  735. Commands->Select_Weapon(obj, "Weapon_Chaingun_Ai" );
  736. Commands->Grant_Key (obj, 1, true);
  737. Commands->Grant_Key (obj, 2, true);
  738. Commands->Grant_Key (obj, 3, true);
  739. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  740. params.Set_Movement (Commands->Find_Object(104967), RUN, 3.0f);
  741. Commands->Action_Goto (obj, params);
  742. Commands->Start_Timer (obj, this, 10.0f, ESCAPE_CHATEAU);
  743. }
  744. }
  745. void Timer_Expired(GameObject * obj, int timer_id )
  746. {
  747. ActionParamsStruct params;
  748. if(timer_id == ESCAPE_CHATEAU)
  749. {
  750. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  751. params.Set_Movement (Commands->Find_Object(104967), RUN, 3.0f);
  752. Commands->Action_Goto (obj, params);
  753. }
  754. }
  755. };
  756. DECLARE_SCRIPT(M06_Activate_Secret_Door, "Secret_Door_ID=0:int")
  757. {
  758. bool already_poked;
  759. // Register variables to be Auto-Saved
  760. // All variables must have a unique ID, less than 256, that never changes
  761. REGISTER_VARIABLES()
  762. {
  763. SAVE_VARIABLE( already_poked, 1 );
  764. }
  765. void Created(GameObject * obj)
  766. {
  767. already_poked = false;
  768. }
  769. void Poked(GameObject * obj, GameObject * poker)
  770. {
  771. if (Commands->Is_A_Star(poker) && (!already_poked))
  772. {
  773. already_poked = true;
  774. // Looks like Raveshaw's private stash. Time for a five-finger discount.\n
  775. const char *conv_name = ("M06_CON061");
  776. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
  777. Commands->Join_Conversation(STAR, conv_id, false, true);
  778. Commands->Start_Conversation (conv_id, 300608);
  779. Commands->Monitor_Conversation (obj, conv_id);
  780. }
  781. }
  782. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  783. {
  784. ActionParamsStruct params;
  785. if(action_id == 300608 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  786. {
  787. Commands->Static_Anim_Phys_Goto_Last_Frame ( Get_Int_Parameter("Secret_Door_ID"), "BK.BK" );
  788. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 608, 1, 0.0f);
  789. }
  790. }
  791. };
  792. DECLARE_SCRIPT(M06_Civ_Prisoner, "")
  793. {
  794. int poke_id;
  795. bool conversation;
  796. enum{WAYPATH};
  797. // Register variables to be Auto-Saved
  798. // All variables must have a unique ID, less than 256, that never changes
  799. REGISTER_VARIABLES()
  800. {
  801. SAVE_VARIABLE( poke_id, 1 );
  802. SAVE_VARIABLE( conversation, 2 );
  803. }
  804. void Created(GameObject * obj)
  805. {
  806. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  807. Commands->Set_Innate_Is_Stationary(obj, true);
  808. poke_id = 1;
  809. conversation = false;
  810. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  811. }
  812. void Poked(GameObject * obj, GameObject * poker)
  813. {
  814. if(conversation)
  815. {
  816. return;
  817. }
  818. ActionParamsStruct params;
  819. switch(poke_id)
  820. {
  821. case 1:
  822. {
  823. conversation = true;
  824. // I am in your debt.\n
  825. const char *conv_name = ("M06_CON009");
  826. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
  827. Commands->Join_Conversation(obj, conv_id, false, true);
  828. Commands->Join_Conversation(STAR, conv_id, false, true);
  829. Commands->Start_Conversation (conv_id, 300123);
  830. Commands->Monitor_Conversation (obj, conv_id);
  831. Vector3 pos = Commands->Get_Position(obj);
  832. float facing = Commands->Get_Facing(obj);
  833. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  834. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  835. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  836. Commands->Create_Object("POW_Health_100", powerup_loc);
  837. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  838. }
  839. break;
  840. case 2:
  841. {
  842. conversation = true;
  843. // I must rest.
  844. const char *conv_name = ("M06_CON063");
  845. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
  846. Commands->Join_Conversation(obj, conv_id, false, true);
  847. Commands->Join_Conversation(STAR, conv_id, false, true);
  848. Commands->Start_Conversation (conv_id, 300124);
  849. Commands->Monitor_Conversation (obj, conv_id);
  850. }
  851. break;
  852. }
  853. }
  854. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  855. {
  856. ActionParamsStruct params;
  857. if(reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED)
  858. {
  859. conversation = false;
  860. }
  861. if(action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  862. {
  863. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 605, 1, 0.0f);
  864. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  865. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  866. params.WaypathID = 101552;
  867. Commands->Action_Goto( obj, params );
  868. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  869. Commands->Set_Innate_Is_Stationary(obj, false);
  870. }
  871. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  872. {
  873. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 12 );
  874. params.Set_Animation ("S_A_HUMAN.h_a_b0c0", true);
  875. Commands->Action_Play_Animation (obj, params);
  876. poke_id = 2;
  877. conversation = false;
  878. }
  879. }
  880. void Killed (GameObject * obj, GameObject * killer)
  881. {
  882. // Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 605, 2, 0.0f);
  883. }
  884. };
  885. DECLARE_SCRIPT(M06_Enable_Guard_Tower, "")
  886. {
  887. bool already_entered;
  888. // Register variables to be Auto-Saved
  889. // All variables must have a unique ID, less than 256, that never changes
  890. REGISTER_VARIABLES()
  891. {
  892. SAVE_VARIABLE( already_entered, 1 );
  893. }
  894. void Created (GameObject * obj)
  895. {
  896. already_entered = false;
  897. }
  898. void Entered (GameObject * obj, GameObject * enterer)
  899. {
  900. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  901. {
  902. already_entered = true;
  903. // Warning: Nod Security Measures Detected.\n
  904. // const char *conv_name = ("M06_CON010");
  905. // int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  906. // Commands->Join_Conversation(NULL, conv_id, true, true);
  907. // Commands->Join_Conversation(STAR, conv_id, true, true);
  908. // Commands->Start_Conversation (conv_id, 300606);
  909. // Commands->Monitor_Conversation (obj, conv_id);
  910. // Patrols
  911. Commands->Enable_Spawner(101046, true);
  912. Commands->Enable_Spawner(101053, true);
  913. // Engineer
  914. Commands->Enable_Spawner(101054, true);
  915. }
  916. }
  917. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  918. {
  919. ActionParamsStruct params;
  920. if(action_id == 300606 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  921. {
  922. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 610, 1, 0.0f);
  923. }
  924. }
  925. };
  926. DECLARE_SCRIPT(M06_Gate_Guards, "Soldier_ID=0:int")
  927. {
  928. int soldier_id;
  929. bool disable_tower_spawn;
  930. enum {M06_GATE_GUARD_WAYPATH = 105, WAYPATH, CONVERSATION};
  931. // Register variables to be Auto-Saved
  932. // All variables must have a unique ID, less than 256, that never changes
  933. REGISTER_VARIABLES()
  934. {
  935. SAVE_VARIABLE( disable_tower_spawn, 1 );
  936. }
  937. void Created (GameObject * obj)
  938. {
  939. soldier_id = Get_Int_Parameter("Soldier_ID");
  940. Commands->Set_Innate_Is_Stationary(obj, true);
  941. Commands->Innate_Soldier_Enable_Footsteps_Heard( obj, false );
  942. disable_tower_spawn = false;
  943. Commands->Start_Timer(obj, this, 15.0f, CONVERSATION);
  944. Commands->Send_Custom_Event (obj, obj, M06_GATE_GUARD_WAYPATH, 1, 0.0f);
  945. Commands->Send_Custom_Event (obj, Commands->Find_Object(110908), M06_GATE_GUARD_WAYPATH, 1, 0.0f);
  946. }
  947. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  948. {
  949. ActionParamsStruct params;
  950. Commands->Debug_Message("Action_Complete on Gate Guard. action_id %d reason %d.\n", action_id, reason);
  951. if(action_id == 1109081 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  952. {
  953. }
  954. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  955. {
  956. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  957. }
  958. }
  959. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  960. {
  961. ActionParamsStruct params;
  962. if(type == M06_GATE_GUARD_WAYPATH)
  963. {
  964. Commands->Set_Innate_Is_Stationary(obj, false);
  965. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  966. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  967. params.WaypathID = 101023;
  968. params.WaypointStartID = 101024;
  969. params.WaypointEndID = 101027;
  970. params.WaypathSplined = true;
  971. Commands->Action_Goto( obj, params );
  972. }
  973. }
  974. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  975. {
  976. if ( sound.Type == M06_DISABLE_TOWER_SPAWN )
  977. {
  978. disable_tower_spawn = true;
  979. }
  980. }
  981. void Timer_Expired(GameObject * obj, int timer_id )
  982. {
  983. ActionParamsStruct params;
  984. if(timer_id == WAYPATH)
  985. {
  986. Commands->Set_Innate_Is_Stationary(obj, false);
  987. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  988. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  989. params.WaypathID = 101023;
  990. params.WaypointStartID = 101024;
  991. params.WaypointEndID = 101027;
  992. Commands->Action_Goto( obj, params );
  993. }
  994. if(timer_id == CONVERSATION)
  995. {
  996. switch(soldier_id)
  997. {
  998. case 1:
  999. {
  1000. if(Commands->Find_Object(101021))
  1001. {
  1002. // The new security protocols are tight.\n
  1003. const char *conv_name = ("M06_CON011");
  1004. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5, 15.0f, false);
  1005. Commands->Join_Conversation(obj, conv_id, false, true);
  1006. Commands->Join_Conversation(Commands->Find_Object(110908), conv_id, false, true);
  1007. Commands->Start_Conversation (conv_id, 1109081);
  1008. Commands->Monitor_Conversation (obj, conv_id);
  1009. }
  1010. }
  1011. break;
  1012. }
  1013. }
  1014. }
  1015. void Killed (GameObject * obj, GameObject * killer)
  1016. {
  1017. if(Commands->Find_Object(101037) && (!disable_tower_spawn)) // Officer in tower
  1018. {
  1019. /* const char * conv_name[6];
  1020. conv_name[0] = ("M06_CON012"); // This is Tower, What's your situation brother?\n
  1021. conv_name[1] = ("M06_CON013"); // This is Tower, please respond.\n
  1022. conv_name[2] = ("M06_CON014"); // This is Tower, I'm sending a recon to your position.\n
  1023. conv_name[3] = ("M06_CON015"); // This is Tower. Hold position brother, reinforcements enroute.\n
  1024. conv_name[4] = ("M06_CON016"); // This is Tower, report in.\n
  1025. conv_name[5] = ("M06_CON017"); // This is Tower. We've a possible man down, Bravo patrol inspect.\n
  1026. int random = Get_Int_Random(0, 5);
  1027. int conv_id = Commands->Create_Conversation (conv_name[random]);
  1028. Commands->Join_Conversation(NULL, conv_id, false, true);
  1029. Commands->Start_Conversation (conv_id, 1);*/
  1030. switch(soldier_id)
  1031. {
  1032. case 1:
  1033. {
  1034. // Commands->Enable_Spawner(101035, true);
  1035. }
  1036. break;
  1037. case 2:
  1038. {
  1039. // Commands->Enable_Spawner(101036, true);
  1040. }
  1041. break;
  1042. }
  1043. }
  1044. }
  1045. };
  1046. DECLARE_SCRIPT(M06_Escort_Tank, "")
  1047. {
  1048. bool attacking;
  1049. enum {ARRIVE_COURTYARD, START_ESCORT};
  1050. // Register variables to be Auto-Saved
  1051. // All variables must have a unique ID, less than 256, that never changes
  1052. REGISTER_VARIABLES()
  1053. {
  1054. SAVE_VARIABLE( attacking, 1 );
  1055. }
  1056. void Created (GameObject * obj)
  1057. {
  1058. Commands->Start_Timer (obj, this, 1.5f, START_ESCORT);
  1059. // Commands->Enable_Enemy_Seen(obj, true);
  1060. Commands->Enable_Hibernation(obj, false);
  1061. attacking = false;
  1062. }
  1063. void Timer_Expired(GameObject * obj, int timer_id )
  1064. {
  1065. if(timer_id == START_ESCORT)
  1066. {
  1067. ActionParamsStruct params;
  1068. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ARRIVE_COURTYARD );
  1069. params.Set_Movement( Vector3(0,0,0), 0.8f, 1.5f );
  1070. params.WaypathID = 102252;
  1071. // params.WaypathSplined = true;
  1072. Commands->Action_Goto( obj, params );
  1073. }
  1074. }
  1075. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1076. {
  1077. ActionParamsStruct params;
  1078. Commands->Debug_Message("Action Complete on Escort Tank. action_id %d reason %d.\n", action_id, reason);
  1079. if(action_id == ARRIVE_COURTYARD && reason == ACTION_COMPLETE_NORMAL)
  1080. {
  1081. Commands->Enable_Engine(obj, false);
  1082. Commands->Enable_Hibernation(obj, true);
  1083. }
  1084. }
  1085. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1086. {
  1087. if(!attacking)
  1088. {
  1089. Commands->Enable_Hibernation(obj, true);
  1090. Commands->Enable_Engine(obj, true);
  1091. attacking = true;
  1092. Commands->Attach_Script(obj, "M08_Mobile_Vehicle", "111422, 111423, 111424, 111425, 111426, 111427, 111428, 111429, 111430, 111431");
  1093. }
  1094. }
  1095. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1096. {
  1097. ActionParamsStruct params;
  1098. if(damager == STAR)
  1099. {
  1100. if(!attacking)
  1101. {
  1102. Commands->Enable_Hibernation(obj, true);
  1103. Commands->Enable_Engine(obj, true);
  1104. attacking = true;
  1105. Commands->Attach_Script(obj, "M08_Mobile_Vehicle", "111422, 111423, 111424, 111425, 111426, 111427, 111428, 111429, 111430, 111431");
  1106. }
  1107. }
  1108. }
  1109. void Killed (GameObject * obj, GameObject * killer)
  1110. {
  1111. }
  1112. };
  1113. DECLARE_SCRIPT(M06_Alarm_Controller, "")
  1114. {
  1115. bool alarm_sounded;
  1116. bool triggered;
  1117. bool stand_down;
  1118. bool alarmed;
  1119. enum {STAND_DOWN};
  1120. // Register variables to be Auto-Saved
  1121. // All variables must have a unique ID, less than 256, that never changes
  1122. REGISTER_VARIABLES()
  1123. {
  1124. SAVE_VARIABLE( alarm_sounded, 1 );
  1125. SAVE_VARIABLE( triggered, 2 );
  1126. SAVE_VARIABLE( stand_down, 3 );
  1127. SAVE_VARIABLE( alarmed, 4 );
  1128. }
  1129. void Created (GameObject * obj)
  1130. {
  1131. Commands->Enable_Hibernation(obj, false);
  1132. alarm_sounded = false;
  1133. triggered = false;
  1134. stand_down = false;
  1135. alarmed = false;
  1136. Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
  1137. }
  1138. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1139. {
  1140. Vector3 sender_pos = Commands->Get_Position(sender);
  1141. Commands->Debug_Message("Custom received Alarm_Controller. type %d param %d sender_id %d sender_pos X %d, Y %d, Z %d.\n", type, param, Commands->Get_ID(sender), sender_pos.X, sender_pos.Y, sender_pos.Z );
  1142. ActionParamsStruct params;
  1143. if(type == M06_ALARMED) // Send custom to new spawns status of alarm
  1144. {
  1145. Commands->Send_Custom_Event (obj, sender, M06_ALARMED, alarm_sounded, 0.0f);
  1146. }
  1147. if((type == M06_STAND_DOWN)) // && (alarm_sounded) && !stand_down)
  1148. {
  1149. stand_down = true;
  1150. Commands->Start_Timer (obj, this, 0.0f, STAND_DOWN);
  1151. }
  1152. if((type == M06_SOUND_ALARM) && (!alarm_sounded))
  1153. {
  1154. alarm_sounded = true;
  1155. Commands->Create_Sound ( "M06_Alarm", Vector3 (0,0,0), obj);
  1156. Commands->Create_Logical_Sound(obj, M06_SOUND_ALARM_ON, Vector3 (0,0,0), 2500.0f);
  1157. // Commands->Monitor_Sound (obj, alarm_sound);
  1158. Spawn_Response (true);
  1159. Alarm_Trigger_Zones (obj, true);
  1160. }
  1161. if((type == M00_CUSTOM_CAMERA_ALARM) && (!alarm_sounded))
  1162. {
  1163. alarm_sounded = true;
  1164. Commands->Create_Sound ( "M06_Alarm", Vector3 (0,0,0), obj);
  1165. // Commands->Monitor_Sound (obj, alarm_sound);
  1166. Spawn_Response (true);
  1167. Alarm_Trigger_Zones (obj, true);
  1168. }
  1169. }
  1170. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1171. {
  1172. if(action_id == 300609 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1173. {
  1174. alarmed = true;
  1175. // Deactivate alarm system
  1176. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 609, 3, 0.0f);
  1177. }
  1178. }
  1179. void Timer_Expired(GameObject * obj, int timer_id )
  1180. {
  1181. if((timer_id == STAND_DOWN)) // && (alarm_sounded) && (alarmed))
  1182. {
  1183. if(alarm_sounded)
  1184. {
  1185. // Stand down general alarm. Intruder alert canceled.\n
  1186. const char *conv_name = ("M06_CON018");
  1187. int conv_id = Commands->Create_Conversation (conv_name);
  1188. Commands->Join_Conversation(NULL, conv_id, false, true);
  1189. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0.0f,0.0f,0.0f)), conv_id, false, true);
  1190. Commands->Start_Conversation (conv_id, 300000);
  1191. Commands->Monitor_Conversation (obj, conv_id);
  1192. }
  1193. // Stand down spawn units
  1194. Spawn_Response (false);
  1195. Alarm_Trigger_Zones (obj, false);
  1196. // alarm_sounded = false commented out to simulate shut down of alarm system
  1197. // alarm_sounded = false;
  1198. Commands->Create_Logical_Sound(obj, M06_SOUND_ALARM_OFF, Vector3 (0,0,0), 2500.0f);
  1199. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 609, 1, 0.0f);
  1200. alarm_sounded = true;
  1201. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 610, 1, 0.0f);
  1202. }
  1203. }
  1204. void Alarm_Trigger_Zones (GameObject * obj, bool alarm)
  1205. {
  1206. }
  1207. void Spawn_Response (bool alarm)
  1208. {
  1209. }
  1210. };
  1211. DECLARE_SCRIPT(M06_Alarm_Behavior, "Alarm_Enemy_Seen=0.0:float, Alarm_Damaged=0.0:float")
  1212. {
  1213. int alarm_switch_id[8];
  1214. int alarm_switch_amnt;
  1215. int closest_id;
  1216. bool sound_alarm;
  1217. bool alarmed;
  1218. float alarm_enemy_seen;
  1219. float alarm_damaged;
  1220. bool hear_footsteps;
  1221. int havoc_id;
  1222. bool attacking_havoc;
  1223. enum {HEAR_FOOTSTEPS};
  1224. // Register variables to be Auto-Saved
  1225. // All variables must have a unique ID, less than 256, that never changes
  1226. REGISTER_VARIABLES()
  1227. {
  1228. SAVE_VARIABLE( closest_id, 1 );
  1229. SAVE_VARIABLE( sound_alarm, 2 );
  1230. SAVE_VARIABLE( alarmed, 3 );
  1231. SAVE_VARIABLE( hear_footsteps, 4 );
  1232. SAVE_VARIABLE( havoc_id, 5 );
  1233. SAVE_VARIABLE( attacking_havoc, 6 );
  1234. }
  1235. void Created(GameObject * obj)
  1236. {
  1237. // No starting units can hear footsteps until otherwise alerted
  1238. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  1239. hear_footsteps = false;
  1240. alarm_enemy_seen = Get_Float_Parameter("Alarm_Enemy_Seen");
  1241. alarm_damaged = Get_Float_Parameter("Alarm_Damaged");
  1242. int difficulty = Commands->Get_Difficulty_Level();
  1243. alarm_enemy_seen *= difficulty + 1;
  1244. alarm_damaged *= difficulty + 1;
  1245. closest_id = 0;
  1246. alarm_switch_amnt = 8;
  1247. sound_alarm = false;
  1248. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_ALARMED, 1, 0.2f);
  1249. alarmed = false;
  1250. havoc_id = 0;
  1251. attacking_havoc = false;
  1252. // Hardcode all alarm switch IDs
  1253. alarm_switch_id[0] = 100157;
  1254. alarm_switch_id[1] = 100330;
  1255. alarm_switch_id[2] = 100423;
  1256. alarm_switch_id[3] = 100445;
  1257. alarm_switch_id[4] = 101003;
  1258. alarm_switch_id[5] = 101004;
  1259. alarm_switch_id[6] = 101005;
  1260. alarm_switch_id[7] = 101006;
  1261. }
  1262. int Nearest (GameObject * obj) // Get nearest alarm switch to soldier
  1263. {
  1264. Vector3 alarm_pos;
  1265. Vector3 soldier_pos = Commands->Get_Position(obj);
  1266. float this_distance = 0.0f;
  1267. float closest_distance = 0.0f;
  1268. int i = 0;
  1269. while (i < alarm_switch_amnt)
  1270. {
  1271. if(Commands->Find_Object(alarm_switch_id[i]))
  1272. {
  1273. alarm_pos = Commands->Get_Position(Commands->Find_Object(alarm_switch_id[i]));
  1274. this_distance = Commands->Get_Distance(soldier_pos, alarm_pos);
  1275. if(closest_distance == 0.0f)
  1276. {
  1277. closest_distance = this_distance;
  1278. }
  1279. if(WWMath::Min(this_distance, closest_distance) == this_distance)
  1280. {
  1281. closest_distance = this_distance;
  1282. closest_id = alarm_switch_id[i];
  1283. }
  1284. }
  1285. i++;
  1286. }
  1287. return closest_id;
  1288. }
  1289. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1290. {
  1291. ActionParamsStruct params;
  1292. if(action_id == 10 && reason == ACTION_COMPLETE_NORMAL && !alarmed)
  1293. {
  1294. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
  1295. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 11);
  1296. params.Set_Face_Location( alarm_pos, 1.5f);
  1297. Commands->Action_Face_Location ( obj, params );
  1298. Commands->Send_Custom_Event (obj, Commands->Find_Object(closest_id), M06_CHECK_ALARM, Commands->Get_ID(obj), 0.0f);
  1299. }
  1300. }
  1301. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1302. {
  1303. ActionParamsStruct params;
  1304. if(type == M06_ALARMED) // Custom returned from alarm controller for new spawns to set alarmed status
  1305. {
  1306. alarmed = (param == 1) ? true : false;
  1307. }
  1308. if(type == M06_CHECK_ALARM && !alarmed)
  1309. {
  1310. if(param == 1)
  1311. {
  1312. // The alarm switch is destroyed, we need engineering!\n
  1313. const char *conv_name = ("M06_CON019");
  1314. int conv_id = Commands->Create_Conversation (conv_name);
  1315. Commands->Join_Conversation(obj, conv_id, false, true);
  1316. Commands->Start_Conversation (conv_id, 1);
  1317. Commands->Monitor_Conversation (obj, conv_id);
  1318. int i = 0;
  1319. int curr_alarm_switch_id = Commands->Get_ID(sender);
  1320. while (i < alarm_switch_amnt)
  1321. {
  1322. if(curr_alarm_switch_id == alarm_switch_id[i])
  1323. {
  1324. alarm_switch_id[i] = 0;
  1325. }
  1326. i++;
  1327. }
  1328. // Go to another alarm box
  1329. closest_id = Nearest(obj);
  1330. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
  1331. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1332. params.Set_Movement( alarm_pos, RUN, 1.5f );
  1333. Commands->Action_Goto( obj, params );
  1334. }
  1335. else
  1336. {
  1337. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 12 );
  1338. params.Set_Animation ("S_A_HUMAN.H_A_A0F0", false);
  1339. Commands->Action_Play_Animation (obj, params);
  1340. // Send custom to sound alarm
  1341. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_SOUND_ALARM, 1, 0.0f);
  1342. // Once alarm has been sounded
  1343. }
  1344. }
  1345. if(type == M06_YOU_ATTACK_HAVOC)
  1346. {
  1347. Commands->Debug_Message("Soldier got M06_YOU_ATTACK_HAVOC custom, attacking STAR.\n");
  1348. attacking_havoc = true;
  1349. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
  1350. params.Set_Attack (STAR, 50.0f, 0.0f, 1);
  1351. Commands->Action_Attack (obj, params);
  1352. }
  1353. }
  1354. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1355. {
  1356. if ( sound.Type == M06_SOUND_ALARM_ON )
  1357. {
  1358. alarmed = true;
  1359. sound_alarm = false;
  1360. Vector3 pos = Commands->Get_Position(obj);
  1361. Commands->Innate_Force_State_Gunshots_Heard(obj, pos);
  1362. }
  1363. if ( sound.Type == M06_SOUND_ALARM_OFF )
  1364. {
  1365. alarmed = false;
  1366. attacking_havoc = false;
  1367. Commands->Action_Reset ( obj, 100 );
  1368. }
  1369. if ( sound.Type == M06_ATTACK_HAVOC_SOUND )
  1370. {
  1371. havoc_id = Commands->Get_ID(sound.Creator);
  1372. // Let Havoc know this soldier is coming to attack
  1373. Commands->Send_Custom_Event (obj, Commands->Find_Object(havoc_id), M06_ATTACK_HAVOC, 1, 0.0f);
  1374. }
  1375. if (((sound.Type == SOUND_TYPE_GUNSHOT) || (sound.Type == SOUND_TYPE_BULLET_HIT)) && (!hear_footsteps))
  1376. {
  1377. hear_footsteps = true;
  1378. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  1379. Commands->Start_Timer (obj, this, 60.0f, HEAR_FOOTSTEPS);
  1380. }
  1381. }
  1382. void Timer_Expired(GameObject * obj, int timer_id )
  1383. {
  1384. if(timer_id == HEAR_FOOTSTEPS)
  1385. {
  1386. hear_footsteps = false;
  1387. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  1388. }
  1389. }
  1390. void Damaged (GameObject * obj, GameObject * damager, float amount)
  1391. {
  1392. ActionParamsStruct params;
  1393. if(Commands->Get_Random(0.0f, 1.0f) <= alarm_damaged)
  1394. {
  1395. if((!sound_alarm) && (!alarmed) && (obj))
  1396. {
  1397. sound_alarm = true;
  1398. // Sound the alarm!\n
  1399. const char *conv_name = ("M06_CON020");
  1400. int conv_id = Commands->Create_Conversation (conv_name);
  1401. Commands->Join_Conversation(obj, conv_id, false, true);
  1402. Commands->Start_Conversation (conv_id, 1);
  1403. closest_id = Nearest(obj);
  1404. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
  1405. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1406. params.Set_Movement( alarm_pos, RUN, 1.5f );
  1407. Commands->Action_Goto( obj, params );
  1408. }
  1409. }
  1410. }
  1411. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1412. {
  1413. ActionParamsStruct params;
  1414. if(Commands->Get_Random(0.0f, 1.0f) <= alarm_enemy_seen)
  1415. {
  1416. if((!sound_alarm) && (!alarmed))
  1417. {
  1418. sound_alarm = true;
  1419. // Sound the alarm!\n
  1420. const char *conv_name = ("M06_CON020");
  1421. int conv_id = Commands->Create_Conversation (conv_name);
  1422. Commands->Join_Conversation(obj, conv_id, false, true);
  1423. Commands->Start_Conversation (conv_id, 1);
  1424. closest_id = Nearest(obj);
  1425. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
  1426. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1427. params.Set_Movement( alarm_pos, RUN, 1.5f );
  1428. Commands->Action_Goto( obj, params );
  1429. }
  1430. }
  1431. }
  1432. void Killed (GameObject * obj, GameObject * killer)
  1433. {
  1434. if(attacking_havoc)
  1435. {
  1436. Commands->Send_Custom_Event (obj, Commands->Find_Object(havoc_id), M06_DEAD_HAVOC_ATTACKER, 1, 0.0f);
  1437. }
  1438. }
  1439. };
  1440. DECLARE_SCRIPT(M06_Alarm_Switch, "")
  1441. {
  1442. bool destroyed;
  1443. enum{DAMAGE_ALARM};
  1444. // Register variables to be Auto-Saved
  1445. // All variables must have a unique ID, less than 256, that never changes
  1446. REGISTER_VARIABLES()
  1447. {
  1448. SAVE_VARIABLE( destroyed, 1 );
  1449. }
  1450. void Created(GameObject * obj)
  1451. {
  1452. Vector3 alarm_pos = Commands->Get_Position(obj);
  1453. Commands->Debug_Message("Position of alarm switch %d: X: %d, Y: %d, Z:%d", Commands->Get_ID(obj), alarm_pos.X, alarm_pos.Y, alarm_pos.Z );
  1454. Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 0);
  1455. destroyed = false;
  1456. }
  1457. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1458. {
  1459. if(type == M06_CHECK_ALARM)
  1460. {
  1461. Commands->Send_Custom_Event (obj, sender, M06_CHECK_ALARM, destroyed, 0.0f);
  1462. }
  1463. }
  1464. void Damaged (GameObject * obj, GameObject * damager, float amount)
  1465. {
  1466. if(Commands->Get_Health(obj) > 1.0f)
  1467. {
  1468. Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 0);
  1469. }
  1470. else
  1471. {
  1472. Commands->Set_Health(obj, 1.0f);
  1473. if(!destroyed)
  1474. {
  1475. destroyed = true;
  1476. Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 60);
  1477. }
  1478. else
  1479. {
  1480. Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 60);
  1481. }
  1482. }
  1483. }
  1484. };
  1485. DECLARE_SCRIPT(M06_Alarm_Terminal_DLS, "")
  1486. {
  1487. bool poked;
  1488. // Register variables to be Auto-Saved
  1489. // All variables must have a unique ID, less than 256, that never changes
  1490. REGISTER_VARIABLES()
  1491. {
  1492. SAVE_VARIABLE( poked, 1 );
  1493. }
  1494. void Created (GameObject * obj)
  1495. {
  1496. Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
  1497. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  1498. poked = false;
  1499. }
  1500. void Poked(GameObject * obj, GameObject * poker)
  1501. {
  1502. if (Commands->Is_A_Star(poker))
  1503. {
  1504. poked = true;
  1505. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  1506. // Custom to alarm controller to stand down
  1507. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STAND_DOWN, 1, 0.0f);
  1508. }
  1509. }
  1510. void Killed (GameObject * obj, GameObject * killer)
  1511. {
  1512. if(!poked)
  1513. {
  1514. // Custom to alarm controller to stand down
  1515. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STAND_DOWN, 1, 0.0f);
  1516. }
  1517. Vector3 myPositon = Commands->Get_Position ( obj );
  1518. float myFacing = Commands->Get_Facing ( obj );
  1519. GameObject * destroyedMCT = Commands->Create_Object ( "Nod_MCT_Alarm_Destroyed", myPositon);
  1520. Commands->Set_Facing ( destroyedMCT, myFacing );
  1521. }
  1522. };
  1523. DECLARE_SCRIPT(M06_Tower_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1524. {
  1525. int waypath_id;
  1526. Vector3 waypath_loc;
  1527. bool disable_tower_spawn;
  1528. bool chateau_destruction;
  1529. enum {WAYPATH, GO_WAYPATH};
  1530. // Register variables to be Auto-Saved
  1531. // All variables must have a unique ID, less than 256, that never changes
  1532. REGISTER_VARIABLES()
  1533. {
  1534. // SAVE_VARIABLE( waypath_id, 1 );
  1535. // SAVE_VARIABLE( waypath_loc, 2 );
  1536. SAVE_VARIABLE( disable_tower_spawn, 1 );
  1537. SAVE_VARIABLE( chateau_destruction, 2 );
  1538. }
  1539. void Created (GameObject * obj)
  1540. {
  1541. waypath_id = Get_Int_Parameter("Waypath_ID");
  1542. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1543. ActionParamsStruct params;
  1544. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1545. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1546. Commands->Action_Goto( obj, params );
  1547. disable_tower_spawn = false;
  1548. chateau_destruction = false;
  1549. }
  1550. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1551. {
  1552. ActionParamsStruct params;
  1553. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1554. {
  1555. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  1556. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1557. params.WaypathID = waypath_id;
  1558. Commands->Action_Goto( obj, params );
  1559. }
  1560. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1561. {
  1562. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1563. }
  1564. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1565. {
  1566. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1567. }
  1568. }
  1569. void Timer_Expired(GameObject * obj, int timer_id )
  1570. {
  1571. ActionParamsStruct params;
  1572. if(timer_id == WAYPATH)
  1573. {
  1574. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1575. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1576. Commands->Action_Goto( obj, params );
  1577. }
  1578. }
  1579. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1580. {
  1581. if ( sound.Type == M06_DISABLE_TOWER_SPAWN )
  1582. {
  1583. disable_tower_spawn = true;
  1584. }
  1585. if ( sound.Type == M06_CHATEAU_DESTRUCTION )
  1586. {
  1587. chateau_destruction = true;
  1588. }
  1589. }
  1590. void Killed (GameObject * obj, GameObject * killer)
  1591. {
  1592. if(Commands->Find_Object(101037) && (!disable_tower_spawn) && (!chateau_destruction)) // Officer in tower
  1593. {
  1594. const char * conv_name[6];
  1595. conv_name[0] = ("M06_CON012"); // This is Tower, What's your situation brother?\n
  1596. conv_name[1] = ("M06_CON013"); // This is Tower, please respond.\n
  1597. conv_name[2] = ("M06_CON014"); // This is Tower, I'm sending a recon to your position.\n
  1598. conv_name[3] = ("M06_CON015"); // This is Tower. Hold position brother, reinforcements enroute.\n
  1599. conv_name[4] = ("M06_CON016"); // This is Tower, report in.\n
  1600. conv_name[5] = ("M06_CON017"); // This is Tower. We've a possible man down, Bravo patrol inspect.\n
  1601. int random = Get_Int_Random(0, 10);
  1602. if(random < 6)
  1603. {
  1604. int conv_id = Commands->Create_Conversation (conv_name[random]);
  1605. Commands->Join_Conversation(NULL, conv_id, false, true);
  1606. Commands->Start_Conversation (conv_id, 1);
  1607. }
  1608. }
  1609. }
  1610. };
  1611. DECLARE_SCRIPT(M06_Courtyard_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1612. {
  1613. int waypath_id;
  1614. Vector3 waypath_loc;
  1615. bool disable_courtyard_spawn;
  1616. bool chateau_destruction;
  1617. enum {WAYPATH, GO_WAYPATH};
  1618. // Register variables to be Auto-Saved
  1619. // All variables must have a unique ID, less than 256, that never changes
  1620. REGISTER_VARIABLES()
  1621. {
  1622. // SAVE_VARIABLE( waypath_id, 1 );
  1623. // SAVE_VARIABLE( waypath_loc, 2 );
  1624. SAVE_VARIABLE( disable_courtyard_spawn, 1 );
  1625. SAVE_VARIABLE( chateau_destruction, 2 );
  1626. }
  1627. void Created (GameObject * obj)
  1628. {
  1629. waypath_id = Get_Int_Parameter("Waypath_ID");
  1630. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1631. ActionParamsStruct params;
  1632. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1633. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1634. Commands->Action_Goto( obj, params );
  1635. disable_courtyard_spawn = false;
  1636. chateau_destruction = false;
  1637. }
  1638. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1639. {
  1640. ActionParamsStruct params;
  1641. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1642. {
  1643. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  1644. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1645. params.WaypathID = waypath_id;
  1646. Commands->Action_Goto( obj, params );
  1647. }
  1648. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1649. {
  1650. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1651. }
  1652. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1653. {
  1654. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1655. }
  1656. }
  1657. void Timer_Expired(GameObject * obj, int timer_id )
  1658. {
  1659. ActionParamsStruct params;
  1660. if(timer_id == WAYPATH)
  1661. {
  1662. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1663. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1664. Commands->Action_Goto( obj, params );
  1665. }
  1666. }
  1667. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1668. {
  1669. if ( sound.Type == M06_DISABLE_COURTYARD_SPAWN )
  1670. {
  1671. disable_courtyard_spawn = true;
  1672. }
  1673. if ( sound.Type == M06_CHATEAU_DESTRUCTION )
  1674. {
  1675. chateau_destruction = true;
  1676. }
  1677. }
  1678. void Killed (GameObject * obj, GameObject * killer)
  1679. {
  1680. if((!disable_courtyard_spawn) && (!chateau_destruction))
  1681. {
  1682. const char * conv_name[5];
  1683. conv_name[0] = ("M06_CON021"); // This is Courtyard, report in.\n
  1684. conv_name[1] = ("M06_CON022"); // Courtyard here. Squad enroute.\n
  1685. conv_name[2] = ("M06_CON023"); // This is Courtyard, get me a response team.\n
  1686. conv_name[3] = ("M06_CON024"); // Courtyard here. What's the situation brothers?\n
  1687. conv_name[4] = ("M06_CON025"); // Courtyard here. Intruder response to your location.\n
  1688. int random = Get_Int_Random(0, 10);
  1689. if(random < 5)
  1690. {
  1691. int conv_id = Commands->Create_Conversation (conv_name[random]);
  1692. Commands->Join_Conversation(NULL, conv_id, false, true);
  1693. Commands->Start_Conversation (conv_id, 1);
  1694. }
  1695. }
  1696. }
  1697. };
  1698. DECLARE_SCRIPT(M06_Hedgemaze_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1699. {
  1700. int waypath_id;
  1701. Vector3 waypath_loc;
  1702. bool disable_hedgemaze_spawn;
  1703. bool chateau_destruction;
  1704. enum {WAYPATH, GO_WAYPATH};
  1705. // Register variables to be Auto-Saved
  1706. // All variables must have a unique ID, less than 256, that never changes
  1707. REGISTER_VARIABLES()
  1708. {
  1709. // SAVE_VARIABLE( waypath_id, 1 );
  1710. // SAVE_VARIABLE( waypath_loc, 2 );
  1711. SAVE_VARIABLE( disable_hedgemaze_spawn, 1 );
  1712. SAVE_VARIABLE( chateau_destruction, 2 );
  1713. }
  1714. void Created (GameObject * obj)
  1715. {
  1716. waypath_id = Get_Int_Parameter("Waypath_ID");
  1717. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1718. ActionParamsStruct params;
  1719. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1720. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1721. Commands->Action_Goto( obj, params );
  1722. disable_hedgemaze_spawn = false;
  1723. chateau_destruction = false;
  1724. }
  1725. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1726. {
  1727. ActionParamsStruct params;
  1728. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1729. {
  1730. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  1731. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1732. params.WaypathID = waypath_id;
  1733. Commands->Action_Goto( obj, params );
  1734. }
  1735. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1736. {
  1737. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1738. }
  1739. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1740. {
  1741. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1742. }
  1743. }
  1744. void Timer_Expired(GameObject * obj, int timer_id )
  1745. {
  1746. ActionParamsStruct params;
  1747. if(timer_id == WAYPATH)
  1748. {
  1749. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1750. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1751. Commands->Action_Goto( obj, params );
  1752. }
  1753. }
  1754. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1755. {
  1756. if ( sound.Type == M06_DISABLE_HEDGEMAZE_SPAWN )
  1757. {
  1758. disable_hedgemaze_spawn = true;
  1759. }
  1760. if ( sound.Type == M06_CHATEAU_DESTRUCTION )
  1761. {
  1762. chateau_destruction = true;
  1763. }
  1764. }
  1765. void Killed (GameObject * obj, GameObject * killer)
  1766. {
  1767. if((!disable_hedgemaze_spawn) && (!chateau_destruction))
  1768. {
  1769. const char * conv_name[4];
  1770. conv_name[0] = ("M06_CON026"); // This is Hedge Maze, Please respond.\n
  1771. conv_name[1] = ("M06_CON027"); // This is Hedge Maze. Get a patrol to that position.\n
  1772. conv_name[2] = ("M06_CON028"); // Hedge Maze here, report in please.\n
  1773. conv_name[3] = ("M06_CON029"); // Hedge Maze here, please respond.\n
  1774. int random = Get_Int_Random(0, 10);
  1775. if(random < 4)
  1776. {
  1777. int conv_id = Commands->Create_Conversation (conv_name[random]);
  1778. Commands->Join_Conversation(NULL, conv_id, false, true);
  1779. Commands->Start_Conversation (conv_id, 1);
  1780. }
  1781. }
  1782. }
  1783. };
  1784. DECLARE_SCRIPT(M06_Interior_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1785. {
  1786. int waypath_id;
  1787. Vector3 waypath_loc;
  1788. enum {WAYPATH, GO_WAYPATH};
  1789. // Register variables to be Auto-Saved
  1790. // All variables must have a unique ID, less than 256, that never changes
  1791. REGISTER_VARIABLES()
  1792. {
  1793. SAVE_VARIABLE( waypath_id, 1 );
  1794. SAVE_VARIABLE( waypath_loc, 2 );
  1795. }
  1796. void Created (GameObject * obj)
  1797. {
  1798. waypath_id = Get_Int_Parameter("Waypath_ID");
  1799. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1800. ActionParamsStruct params;
  1801. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1802. params.Set_Movement( waypath_loc, RUN, 1.5f );
  1803. Commands->Action_Goto( obj, params );
  1804. }
  1805. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1806. {
  1807. ActionParamsStruct params;
  1808. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1809. {
  1810. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  1811. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1812. params.WaypathID = waypath_id;
  1813. Commands->Action_Goto( obj, params );
  1814. }
  1815. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1816. {
  1817. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1818. }
  1819. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1820. {
  1821. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1822. }
  1823. }
  1824. void Timer_Expired(GameObject * obj, int timer_id )
  1825. {
  1826. ActionParamsStruct params;
  1827. if(timer_id == WAYPATH)
  1828. {
  1829. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1830. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1831. Commands->Action_Goto( obj, params );
  1832. }
  1833. }
  1834. void Killed (GameObject * obj, GameObject * killer)
  1835. {
  1836. Commands->Send_Custom_Event (obj, Commands->Find_Object(101309), M06_DEAD_INTERIOR_PATROL, 1, 0.0f);
  1837. }
  1838. };
  1839. DECLARE_SCRIPT(M06_Lab_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
  1840. {
  1841. int waypath_id;
  1842. Vector3 waypath_loc;
  1843. enum {WAYPATH, GO_WAYPATH};
  1844. // Register variables to be Auto-Saved
  1845. // All variables must have a unique ID, less than 256, that never changes
  1846. REGISTER_VARIABLES()
  1847. {
  1848. // SAVE_VARIABLE( waypath_id, 1 );
  1849. // SAVE_VARIABLE( waypath_loc, 2 );
  1850. }
  1851. void Created (GameObject * obj)
  1852. {
  1853. waypath_id = Get_Int_Parameter("Waypath_ID");
  1854. waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
  1855. ActionParamsStruct params;
  1856. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1857. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1858. Commands->Action_Goto( obj, params );
  1859. }
  1860. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1861. {
  1862. ActionParamsStruct params;
  1863. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1864. {
  1865. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  1866. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  1867. params.WaypathID = waypath_id;
  1868. Commands->Action_Goto( obj, params );
  1869. }
  1870. if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1871. {
  1872. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1873. }
  1874. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1875. {
  1876. Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
  1877. }
  1878. }
  1879. void Timer_Expired(GameObject * obj, int timer_id )
  1880. {
  1881. ActionParamsStruct params;
  1882. if(timer_id == WAYPATH)
  1883. {
  1884. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
  1885. params.Set_Movement( waypath_loc, WALK, 1.5f );
  1886. Commands->Action_Goto( obj, params );
  1887. }
  1888. }
  1889. };
  1890. DECLARE_SCRIPT(M06_Barracks_Patrol, "")
  1891. {
  1892. bool disable_barracks_spawn;
  1893. int barracks_drop[5];
  1894. int barracks_pickup[6];
  1895. bool chateau_destruction;
  1896. enum {WAYPATH, PICKUP, DROP};
  1897. // Register variables to be Auto-Saved
  1898. // All variables must have a unique ID, less than 256, that never changes
  1899. REGISTER_VARIABLES()
  1900. {
  1901. SAVE_VARIABLE( disable_barracks_spawn, 1 );
  1902. SAVE_VARIABLE( chateau_destruction, 2 );
  1903. }
  1904. void Created (GameObject * obj)
  1905. {
  1906. Commands->Enable_Hibernation(obj, false);
  1907. ActionParamsStruct params;
  1908. barracks_drop[0] = 101534;
  1909. barracks_drop[1] = 101535;
  1910. barracks_drop[2] = 101536;
  1911. barracks_drop[3] = 101537;
  1912. barracks_drop[4] = 101538;
  1913. barracks_pickup[0] = 101539;
  1914. barracks_pickup[1] = 101540;
  1915. barracks_pickup[2] = 101541;
  1916. barracks_pickup[3] = 101542;
  1917. barracks_pickup[4] = 101543;
  1918. barracks_pickup[5] = 101544;
  1919. int random = Get_Int_Random(0, 5);
  1920. params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
  1921. params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
  1922. Commands->Action_Goto (obj, params);
  1923. disable_barracks_spawn = false;
  1924. chateau_destruction = false;
  1925. }
  1926. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1927. {
  1928. if ( sound.Type == M06_DISABLE_BARRACKS_SPAWN )
  1929. {
  1930. disable_barracks_spawn = true;
  1931. }
  1932. if ( sound.Type == M06_CHATEAU_DESTRUCTION )
  1933. {
  1934. chateau_destruction = true;
  1935. }
  1936. }
  1937. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1938. {
  1939. ActionParamsStruct params;
  1940. }
  1941. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1942. {
  1943. ActionParamsStruct params;
  1944. if(action_id == PICKUP && reason == ACTION_COMPLETE_NORMAL)
  1945. {
  1946. Commands->Enable_Hibernation(obj, true);
  1947. int random = Get_Int_Random(0, 4);
  1948. params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), DROP);
  1949. params.Set_Movement (Commands->Find_Object(barracks_drop[random]), WALK, 1.5f);
  1950. Commands->Action_Goto (obj, params);
  1951. }
  1952. if(action_id == PICKUP && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1953. {
  1954. Commands->Start_Timer (obj, this, 20.0f, PICKUP);
  1955. }
  1956. if(action_id == DROP && reason == ACTION_COMPLETE_NORMAL)
  1957. {
  1958. Vector3 pos = Commands->Get_Position(obj);
  1959. float facing = Commands->Get_Facing(obj);
  1960. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  1961. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  1962. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  1963. Commands->Create_Object("M06_Barracks_Powerups_Twiddler", powerup_loc);
  1964. int random = Get_Int_Random(0, 5);
  1965. params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
  1966. params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
  1967. Commands->Action_Goto (obj, params);
  1968. }
  1969. if(action_id == DROP && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1970. {
  1971. Commands->Start_Timer (obj, this, 20.0f, PICKUP);
  1972. }
  1973. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1974. {
  1975. Commands->Destroy_Object(obj);
  1976. }
  1977. }
  1978. void Timer_Expired(GameObject * obj, int timer_id )
  1979. {
  1980. ActionParamsStruct params;
  1981. if(timer_id == PICKUP)
  1982. {
  1983. int random = Get_Int_Random(0, 5);
  1984. params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
  1985. params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
  1986. Commands->Action_Goto (obj, params);
  1987. }
  1988. }
  1989. void Killed (GameObject * obj, GameObject * killer)
  1990. {
  1991. if((!disable_barracks_spawn) && (!chateau_destruction))
  1992. {
  1993. const char * conv_name[5];
  1994. conv_name[0] = ("M06_CON030"); // This is Barracks, what's going on?\n
  1995. conv_name[1] = ("M06_CON031"); // Barracks here, what's your status?\n
  1996. conv_name[2] = ("M06_CON032"); // Barracks here. Alpha team to last known location.\n
  1997. conv_name[3] = ("M06_CON033"); // Barracks here, report in brothers.\n
  1998. conv_name[4] = ("M06_CON034"); // This is Barracks. You there, please respond.\n
  1999. int random = Get_Int_Random(0, 10);
  2000. if(random < 5)
  2001. {
  2002. int conv_id = Commands->Create_Conversation (conv_name[random]);
  2003. Commands->Join_Conversation(NULL, conv_id, false, true);
  2004. Commands->Start_Conversation (conv_id, 1);
  2005. }
  2006. }
  2007. }
  2008. };
  2009. DECLARE_SCRIPT(M06_Lab_Guard, "")
  2010. {
  2011. void Created (GameObject * obj)
  2012. {
  2013. Commands->Set_Innate_Is_Stationary(obj, true);
  2014. }
  2015. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2016. {
  2017. Commands->Set_Innate_Is_Stationary(obj, false);
  2018. }
  2019. };
  2020. DECLARE_SCRIPT(M06_Nod_Tower, "")
  2021. {
  2022. // Register variables to be Auto-Saved
  2023. // All variables must have a unique ID, less than 256, that never changes
  2024. REGISTER_VARIABLES()
  2025. {
  2026. // SAVE_VARIABLE( waypath_id, 1 );
  2027. }
  2028. void Created (GameObject * obj)
  2029. {
  2030. Commands->Set_Innate_Is_Stationary(obj, true);
  2031. }
  2032. void Killed (GameObject * obj, GameObject * killer)
  2033. {
  2034. // Disable reinforcement spawners
  2035. Commands->Enable_Spawner(101035, false);
  2036. Commands->Enable_Spawner(101036, false);
  2037. Commands->Enable_Spawner(101046, false);
  2038. Commands->Enable_Spawner(101053, false);
  2039. }
  2040. };
  2041. DECLARE_SCRIPT(M06_Courtyard_Controller, "")
  2042. {
  2043. int dead_courtyard_eagle;
  2044. // Register variables to be Auto-Saved
  2045. // All variables must have a unique ID, less than 256, that never changes
  2046. REGISTER_VARIABLES()
  2047. {
  2048. SAVE_VARIABLE( dead_courtyard_eagle, 1 );
  2049. }
  2050. void Created(GameObject * obj)
  2051. {
  2052. Commands->Enable_Hibernation(obj, false);
  2053. dead_courtyard_eagle = 0;
  2054. }
  2055. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2056. {
  2057. ActionParamsStruct params;
  2058. if(type == M06_DEAD_COURTYARD_EAGLE)
  2059. {
  2060. dead_courtyard_eagle++;
  2061. if(dead_courtyard_eagle == 3)
  2062. {
  2063. Commands->Enable_Spawner(101063, false);
  2064. Commands->Enable_Spawner(101064, false);
  2065. Commands->Enable_Spawner(101073, false);
  2066. Commands->Enable_Spawner(101082, false);
  2067. Commands->Enable_Spawner(101095, false);
  2068. Commands->Create_Logical_Sound(obj, M06_DISABLE_COURTYARD_SPAWN, Vector3 (0,0,0), 2500.0f);
  2069. // Create Search Apche in Courtyard
  2070. // GameObject * search_apache = Commands->Create_Object ( "Nod_Apache", Vector3(-99.996f, -135.659f, 37.552f));
  2071. // Commands->Attach_Script(search_apache, "M06_Courtyard_Apache", "");
  2072. }
  2073. }
  2074. }
  2075. };
  2076. DECLARE_SCRIPT(M06_Hedgemaze_Controller, "")
  2077. {
  2078. int dead_hedgemaze_eagle;
  2079. // Register variables to be Auto-Saved
  2080. // All variables must have a unique ID, less than 256, that never changes
  2081. REGISTER_VARIABLES()
  2082. {
  2083. SAVE_VARIABLE( dead_hedgemaze_eagle, 1 );
  2084. }
  2085. void Created(GameObject * obj)
  2086. {
  2087. Commands->Enable_Hibernation(obj, false);
  2088. dead_hedgemaze_eagle = 0;
  2089. }
  2090. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2091. {
  2092. ActionParamsStruct params;
  2093. if(type == M06_DEAD_HEDGEMAZE_EAGLE)
  2094. {
  2095. dead_hedgemaze_eagle++;
  2096. if(dead_hedgemaze_eagle == 2)
  2097. {
  2098. Commands->Enable_Spawner(101143, false);
  2099. Commands->Enable_Spawner(101144, false);
  2100. Commands->Enable_Spawner(101145, false);
  2101. Commands->Enable_Spawner(101146, false);
  2102. Commands->Create_Logical_Sound(obj, M06_DISABLE_HEDGEMAZE_SPAWN, Vector3 (0,0,0), 2500.0f);
  2103. }
  2104. }
  2105. }
  2106. };
  2107. DECLARE_SCRIPT(M06_Barracks_Controller, "")
  2108. {
  2109. int dead_barracks_eagle;
  2110. int evac_soldiers;
  2111. // Register variables to be Auto-Saved
  2112. // All variables must have a unique ID, less than 256, that never changes
  2113. REGISTER_VARIABLES()
  2114. {
  2115. SAVE_VARIABLE( dead_barracks_eagle, 1 );
  2116. SAVE_VARIABLE( evac_soldiers, 2 );
  2117. }
  2118. void Created(GameObject * obj)
  2119. {
  2120. Commands->Enable_Hibernation(obj, false);
  2121. dead_barracks_eagle = 0;
  2122. evac_soldiers = 0;
  2123. // GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-37.824f, 30.975f, 1.605f));
  2124. // Commands->Set_Facing(chinook_obj, 0.000f);
  2125. // Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M06_XG_EV4_1.txt");
  2126. // Commands->Start_Timer (obj, this, 30.0f, M06_NEXT_EVAC);
  2127. }
  2128. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2129. {
  2130. if(type == M06_EVAC_ARRIVED)
  2131. {
  2132. evac_soldiers = 0;
  2133. Commands->Create_Logical_Sound(obj, M06_SOLDIER_TO_EVAC, Vector3 (0,0,0), 2500.0f);
  2134. }
  2135. if(type == M06_TO_EVAC)
  2136. {
  2137. evac_soldiers++;
  2138. if(evac_soldiers < 3)
  2139. {
  2140. Commands->Send_Custom_Event(obj, sender, M06_TO_EVAC, 1, 0.0f);
  2141. }
  2142. }
  2143. if(type == M06_DEAD_BARRACKS_EAGLE)
  2144. {
  2145. dead_barracks_eagle++;
  2146. if(dead_barracks_eagle == 2)
  2147. {
  2148. Commands->Enable_Spawner(101531, false);
  2149. Commands->Enable_Spawner(101532, false);
  2150. Commands->Enable_Spawner(101533, false);
  2151. Commands->Create_Logical_Sound(obj, M06_DISABLE_BARRACKS_SPAWN, Vector3 (0,0,0), 2500.0f);
  2152. }
  2153. }
  2154. }
  2155. void Timer_Expired(GameObject * obj, int timer_id )
  2156. {
  2157. if(timer_id == M06_NEXT_EVAC)
  2158. {
  2159. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-37.824f, 30.975f, 1.605f));
  2160. Commands->Set_Facing(chinook_obj, 0.000f);
  2161. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M06_XG_EV4_1.txt");
  2162. Commands->Start_Timer (obj, this, 30.0f, M06_NEXT_EVAC);
  2163. }
  2164. }
  2165. };
  2166. DECLARE_SCRIPT(M06_Interior_Controller, "")
  2167. {
  2168. int dead_interior_patrol;
  2169. // Register variables to be Auto-Saved
  2170. // All variables must have a unique ID, less than 256, that never changes
  2171. REGISTER_VARIABLES()
  2172. {
  2173. SAVE_VARIABLE( dead_interior_patrol, 1 );
  2174. }
  2175. void Created(GameObject * obj)
  2176. {
  2177. Commands->Enable_Hibernation(obj, false);
  2178. dead_interior_patrol = 0;
  2179. }
  2180. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2181. {
  2182. ActionParamsStruct params;
  2183. if(type == M06_DEAD_INTERIOR_PATROL)
  2184. {
  2185. Vector3 dead_loc = Commands->Get_Position(sender);
  2186. dead_interior_patrol++;
  2187. switch(dead_interior_patrol)
  2188. {
  2189. case 4:
  2190. {
  2191. // Contact lost with patrols. Reserve patrols to your assigned areas. Chem units to standby.\n
  2192. const char * conv_name = ("M06_CON035");
  2193. int conv_id = Commands->Create_Conversation (conv_name);
  2194. Commands->Join_Conversation(NULL, conv_id, false, true);
  2195. Commands->Start_Conversation (conv_id, 1);
  2196. // Disable initial interior spawns
  2197. Commands->Enable_Spawner(101280, false);
  2198. Commands->Enable_Spawner(101283, false);
  2199. Commands->Enable_Spawner(101286, false);
  2200. Commands->Enable_Spawner(101289, false);
  2201. Commands->Enable_Spawner(101292, false);
  2202. Commands->Enable_Spawner(101295, false);
  2203. Commands->Enable_Spawner(101298, false);
  2204. Commands->Enable_Spawner(101301, false);
  2205. // Enable grade 2 patrols
  2206. Commands->Enable_Spawner(101281, true);
  2207. Commands->Enable_Spawner(101284, true);
  2208. Commands->Enable_Spawner(101287, true);
  2209. Commands->Enable_Spawner(101290, true);
  2210. Commands->Enable_Spawner(101293, true);
  2211. Commands->Enable_Spawner(101296, true);
  2212. Commands->Enable_Spawner(101299, true);
  2213. Commands->Enable_Spawner(101302, true);
  2214. }
  2215. break;
  2216. case 10:
  2217. {
  2218. // Additional patrols lost, brothers. Chem units to stations.\n
  2219. const char * conv_name = ("M06_CON036");
  2220. int conv_id = Commands->Create_Conversation (conv_name);
  2221. Commands->Join_Conversation(NULL, conv_id, false, true);
  2222. Commands->Start_Conversation (conv_id, 1);
  2223. // Enable grade 3 patrols
  2224. Commands->Enable_Spawner(101282, true);
  2225. Commands->Enable_Spawner(101285, true);
  2226. Commands->Enable_Spawner(101288, true);
  2227. Commands->Enable_Spawner(101291, true);
  2228. Commands->Enable_Spawner(101294, true);
  2229. Commands->Enable_Spawner(101297, true);
  2230. Commands->Enable_Spawner(101300, true);
  2231. Commands->Enable_Spawner(101303, true);
  2232. }
  2233. break;
  2234. case 26:
  2235. {
  2236. // Disable grade 2 patrols
  2237. Commands->Enable_Spawner(101281, false);
  2238. Commands->Enable_Spawner(101284, false);
  2239. Commands->Enable_Spawner(101287, false);
  2240. Commands->Enable_Spawner(101290, false);
  2241. Commands->Enable_Spawner(101293, false);
  2242. Commands->Enable_Spawner(101296, false);
  2243. Commands->Enable_Spawner(101299, false);
  2244. Commands->Enable_Spawner(101302, false);
  2245. }
  2246. break;
  2247. case 42:
  2248. {
  2249. // Disable grade 3 patrols
  2250. Commands->Enable_Spawner(101282, false);
  2251. Commands->Enable_Spawner(101285, false);
  2252. Commands->Enable_Spawner(101288, false);
  2253. Commands->Enable_Spawner(101291, false);
  2254. Commands->Enable_Spawner(101294, false);
  2255. Commands->Enable_Spawner(101297, false);
  2256. Commands->Enable_Spawner(101300, false);
  2257. Commands->Enable_Spawner(101303, false);
  2258. }
  2259. break;
  2260. default:
  2261. {
  2262. const char * conv_name;
  2263. conv_name = NULL;
  2264. if((dead_loc.X < 12.0f) && (dead_loc.Y < -22.0f) && (dead_loc.Z >= 5.0f))
  2265. {
  2266. // Possible disturbance. Second floor, near main library.\n
  2267. conv_name = ("M06_CON037");
  2268. }
  2269. else if((dead_loc.X < 12.0f) && (dead_loc.Y < -22.0f) && (dead_loc.Z < 5.0f))
  2270. {
  2271. // Response team to bottom floor, main stairwell.\n
  2272. conv_name = ("M06_CON038");
  2273. }
  2274. else if((dead_loc.X < 12.0f) && (dead_loc.Y >= -22.0f) && (dead_loc.Y < 4.0f) && (dead_loc.Z < 5.0f))
  2275. {
  2276. // Nearby patrols, investigate area on bottom floor, main gallery.\n
  2277. conv_name = ("M06_CON039");
  2278. }
  2279. else if((dead_loc.X < 12.0f) && (dead_loc.Y >= -22.0f) && (dead_loc.Y < 4.0f) && (dead_loc.Z >= 5.0f))
  2280. {
  2281. // Fire team to top floor, main gallery.
  2282. conv_name = ("M06_CON040");
  2283. }
  2284. else if((dead_loc.X < 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z < 5.0f))
  2285. {
  2286. // Possible intruder. Disturbance bottom floor, open air courtyard.\n
  2287. conv_name = ("M06_CON041");
  2288. }
  2289. else if((dead_loc.X < 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z >= 5.0f))
  2290. {
  2291. // Lost contact with patrol, second level of open air courtyard. Investigate.\n
  2292. conv_name = ("M06_CON042");
  2293. }
  2294. else if((dead_loc.X >= 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z >= 5.0f))
  2295. {
  2296. // Man down. Team to the top floor of the main dining area.\n
  2297. conv_name = ("M06_CON043");
  2298. }
  2299. else if((dead_loc.X >= 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z < 5.0f))
  2300. {
  2301. // Patrol to main dining area. Weapons live, brothers.\n
  2302. conv_name = ("M06_CON044");
  2303. }
  2304. if(conv_name != NULL)
  2305. {
  2306. int conv_id = Commands->Create_Conversation (conv_name);
  2307. Commands->Join_Conversation(NULL, conv_id, false, true);
  2308. Commands->Start_Conversation (conv_id, 1);
  2309. }
  2310. }
  2311. break;
  2312. }
  2313. }
  2314. }
  2315. };
  2316. DECLARE_SCRIPT(M06_Apply_Damage, "")
  2317. {
  2318. enum{APPLY_DAMAGE};
  2319. void Created(GameObject * obj)
  2320. {
  2321. Commands->Start_Timer (obj, this, 3.0f, APPLY_DAMAGE);
  2322. }
  2323. void Timer_Expired(GameObject * obj, int timer_id )
  2324. {
  2325. ActionParamsStruct params;
  2326. if(timer_id == APPLY_DAMAGE)
  2327. {
  2328. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  2329. }
  2330. }
  2331. };
  2332. DECLARE_SCRIPT(M06_Enable_Exterior_Courtyard, "")
  2333. {
  2334. bool already_entered;
  2335. // Register variables to be Auto-Saved
  2336. // All variables must have a unique ID, less than 256, that never changes
  2337. REGISTER_VARIABLES()
  2338. {
  2339. SAVE_VARIABLE( already_entered, 1 );
  2340. }
  2341. void Created (GameObject * obj)
  2342. {
  2343. already_entered = false;
  2344. }
  2345. void Entered (GameObject * obj, GameObject * enterer)
  2346. {
  2347. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2348. {
  2349. already_entered = true;
  2350. // Disable reinforcement spawners for tower
  2351. Commands->Enable_Spawner(101035, false);
  2352. Commands->Enable_Spawner(101036, false);
  2353. Commands->Enable_Spawner(101046, false);
  2354. Commands->Enable_Spawner(101053, false);
  2355. Commands->Create_Logical_Sound(obj, M06_DISABLE_TOWER_SPAWN, Vector3 (0,0,0), 2500.0f);
  2356. // Enable reinforcements for courtyard
  2357. Commands->Enable_Spawner(101063, true);
  2358. Commands->Enable_Spawner(101064, true);
  2359. Commands->Enable_Spawner(101073, true);
  2360. Commands->Enable_Spawner(101082, true);
  2361. Commands->Enable_Spawner(101095, true);
  2362. }
  2363. }
  2364. };
  2365. DECLARE_SCRIPT(M06_Enable_Hedgemaze, "")
  2366. {
  2367. bool already_entered;
  2368. // Register variables to be Auto-Saved
  2369. // All variables must have a unique ID, less than 256, that never changes
  2370. REGISTER_VARIABLES()
  2371. {
  2372. SAVE_VARIABLE( already_entered, 1 );
  2373. }
  2374. void Created (GameObject * obj)
  2375. {
  2376. already_entered = false;
  2377. }
  2378. void Entered (GameObject * obj, GameObject * enterer)
  2379. {
  2380. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2381. {
  2382. already_entered = true;
  2383. // Enable reinforcements for hedgemaze
  2384. Commands->Enable_Spawner(101143, true);
  2385. Commands->Enable_Spawner(101144, true);
  2386. Commands->Enable_Spawner(101145, true);
  2387. Commands->Enable_Spawner(101146, true);
  2388. Commands->Send_Custom_Event (obj, Commands->Find_Object(101148), M06_DISABLE_ZONE, 1, 0.0f);
  2389. Commands->Send_Custom_Event (obj, Commands->Find_Object(101149), M06_DISABLE_ZONE, 1, 0.0f);
  2390. }
  2391. }
  2392. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2393. {
  2394. if(type == M06_DISABLE_ZONE)
  2395. {
  2396. already_entered = true;
  2397. }
  2398. }
  2399. };
  2400. DECLARE_SCRIPT(M06_Enable_Barracks, "")
  2401. {
  2402. bool already_entered;
  2403. // Register variables to be Auto-Saved
  2404. // All variables must have a unique ID, less than 256, that never changes
  2405. REGISTER_VARIABLES()
  2406. {
  2407. SAVE_VARIABLE( already_entered, 1 );
  2408. }
  2409. void Created (GameObject * obj)
  2410. {
  2411. already_entered = false;
  2412. }
  2413. void Entered (GameObject * obj, GameObject * enterer)
  2414. {
  2415. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2416. {
  2417. already_entered = true;
  2418. // Enable reinforcements for barracks
  2419. Commands->Enable_Spawner(101531, true);
  2420. Commands->Enable_Spawner(101532, true);
  2421. Commands->Enable_Spawner(101533, true);
  2422. // Disable remaining zones
  2423. Commands->Send_Custom_Event (obj, Commands->Find_Object(101012), M06_DISABLE_ZONE, 1, 0.0f);
  2424. Commands->Send_Custom_Event (obj, Commands->Find_Object(101212), M06_DISABLE_ZONE, 1, 0.0f);
  2425. }
  2426. }
  2427. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2428. {
  2429. if(type == M06_DISABLE_ZONE)
  2430. {
  2431. already_entered = true;
  2432. }
  2433. }
  2434. };
  2435. DECLARE_SCRIPT(M06_Enable_Interior, "")
  2436. {
  2437. bool already_entered;
  2438. // Register variables to be Auto-Saved
  2439. // All variables must have a unique ID, less than 256, that never changes
  2440. REGISTER_VARIABLES()
  2441. {
  2442. SAVE_VARIABLE( already_entered, 1 );
  2443. }
  2444. void Created (GameObject * obj)
  2445. {
  2446. already_entered = false;
  2447. }
  2448. void Entered (GameObject * obj, GameObject * enterer)
  2449. {
  2450. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2451. {
  2452. already_entered = true;
  2453. // Spawn initial interior patrol population
  2454. Commands->Enable_Spawner(101280, true);
  2455. Commands->Enable_Spawner(101283, true);
  2456. Commands->Enable_Spawner(101286, true);
  2457. Commands->Enable_Spawner(101289, true);
  2458. Commands->Enable_Spawner(101292, true);
  2459. Commands->Enable_Spawner(101295, true);
  2460. Commands->Enable_Spawner(101298, true);
  2461. Commands->Enable_Spawner(101301, true);
  2462. // Shut down all enable_interior zones
  2463. Commands->Send_Custom_Event (obj, Commands->Find_Object(101304), M06_DISABLE_ZONE, 1, 0.0f);
  2464. Commands->Send_Custom_Event (obj, Commands->Find_Object(101305), M06_DISABLE_ZONE, 1, 0.0f);
  2465. Commands->Send_Custom_Event (obj, Commands->Find_Object(101306), M06_DISABLE_ZONE, 1, 0.0f);
  2466. Commands->Send_Custom_Event (obj, Commands->Find_Object(101307), M06_DISABLE_ZONE, 1, 0.0f);
  2467. Commands->Send_Custom_Event (obj, Commands->Find_Object(101308), M06_DISABLE_ZONE, 1, 0.0f);
  2468. }
  2469. }
  2470. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2471. {
  2472. if(type == M06_DISABLE_ZONE)
  2473. {
  2474. already_entered = true;
  2475. }
  2476. }
  2477. };
  2478. DECLARE_SCRIPT(M06_Enable_Greenhouse, "")
  2479. {
  2480. bool already_entered;
  2481. // Register variables to be Auto-Saved
  2482. // All variables must have a unique ID, less than 256, that never changes
  2483. REGISTER_VARIABLES()
  2484. {
  2485. SAVE_VARIABLE( already_entered, 1 );
  2486. }
  2487. void Created (GameObject * obj)
  2488. {
  2489. already_entered = false;
  2490. }
  2491. void Entered (GameObject * obj, GameObject * enterer)
  2492. {
  2493. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2494. {
  2495. already_entered = true;
  2496. // Enable greenhouse units
  2497. Commands->Send_Custom_Event (obj, Commands->Find_Object(101509), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  2498. Commands->Send_Custom_Event (obj, Commands->Find_Object(101356), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  2499. Commands->Send_Custom_Event (obj, Commands->Find_Object(101357), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  2500. // Shut down all greenhouse zones
  2501. Commands->Send_Custom_Event (obj, Commands->Find_Object(101350), M06_DISABLE_ZONE, 1, 0.0f);
  2502. Commands->Send_Custom_Event (obj, Commands->Find_Object(101351), M06_DISABLE_ZONE, 1, 0.0f);
  2503. }
  2504. }
  2505. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2506. {
  2507. if(type == M06_DISABLE_ZONE)
  2508. {
  2509. already_entered = true;
  2510. }
  2511. }
  2512. };
  2513. DECLARE_SCRIPT(M06_Enable_Lab, "")
  2514. {
  2515. bool already_entered;
  2516. // Register variables to be Auto-Saved
  2517. // All variables must have a unique ID, less than 256, that never changes
  2518. REGISTER_VARIABLES()
  2519. {
  2520. SAVE_VARIABLE( already_entered, 1 );
  2521. }
  2522. void Created (GameObject * obj)
  2523. {
  2524. already_entered = false;
  2525. }
  2526. void Entered (GameObject * obj, GameObject * enterer)
  2527. {
  2528. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2529. {
  2530. already_entered = true;
  2531. // Enable units for laboratory
  2532. Commands->Enable_Spawner(101332, true);
  2533. Commands->Enable_Spawner(101334, true);
  2534. Commands->Enable_Spawner(101335, true);
  2535. Commands->Enable_Spawner(101336, true);
  2536. Commands->Enable_Spawner(101337, true);
  2537. Commands->Enable_Spawner(101344, true);
  2538. Commands->Enable_Spawner(101345, true);
  2539. Commands->Enable_Spawner(101346, true);
  2540. Commands->Enable_Spawner(101347, true);
  2541. }
  2542. }
  2543. };
  2544. DECLARE_SCRIPT(M06_Alarm_Engineer, "")
  2545. {
  2546. int broken_alarm_id;
  2547. bool fixing_alarm;
  2548. // Register variables to be Auto-Saved
  2549. // All variables must have a unique ID, less than 256, that never changes
  2550. REGISTER_VARIABLES()
  2551. {
  2552. SAVE_VARIABLE( fixing_alarm, 1 );
  2553. }
  2554. void Created(GameObject * obj)
  2555. {
  2556. Commands->Enable_Hibernation(obj, false);
  2557. broken_alarm_id = 0;
  2558. fixing_alarm = false;
  2559. }
  2560. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2561. {
  2562. ActionParamsStruct params;
  2563. if(action_id == 10 && reason == ACTION_COMPLETE_NORMAL)
  2564. {
  2565. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(broken_alarm_id));
  2566. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 11);
  2567. params.Set_Face_Location( alarm_pos, 1.5f);
  2568. Commands->Action_Face_Location ( obj, params );
  2569. }
  2570. if(action_id == 11 && reason == ACTION_COMPLETE_NORMAL)
  2571. {
  2572. GameObject * broken_alarm = Commands->Find_Object(broken_alarm_id);
  2573. if((Commands->Get_Health(broken_alarm) / Commands->Get_Max_Health(broken_alarm)) < 1.0f)
  2574. {
  2575. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 12 );
  2576. params.Set_Movement( Commands->Get_Position(obj), 0.0f, 2.0f );
  2577. params.Set_Attack (broken_alarm, 5.0f, 0.0f, 1);
  2578. Commands->Action_Attack( obj, params );
  2579. }
  2580. else
  2581. {
  2582. fixing_alarm = false;
  2583. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 10.0f);
  2584. }
  2585. }
  2586. }
  2587. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2588. {
  2589. ActionParamsStruct params;
  2590. if (( sound.Type == M06_FIX_ALARM ) && (!fixing_alarm))
  2591. {
  2592. fixing_alarm = true;
  2593. broken_alarm_id = Commands->Get_ID(sound.Creator);
  2594. Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(broken_alarm_id));
  2595. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  2596. params.Set_Movement (alarm_pos, RUN, 2.0f);
  2597. Commands->Action_Goto (obj, params);
  2598. }
  2599. }
  2600. };
  2601. DECLARE_SCRIPT(M06_Courtyard_Eagle, "")
  2602. {
  2603. enum {WAYPATH};
  2604. // Register variables to be Auto-Saved
  2605. // All variables must have a unique ID, less than 256, that never changes
  2606. REGISTER_VARIABLES()
  2607. {
  2608. // SAVE_VARIABLE( already_seen, 1 );
  2609. }
  2610. void Created (GameObject * obj)
  2611. {
  2612. ActionParamsStruct params;
  2613. if(Commands->Get_ID(obj) == 101099)
  2614. {
  2615. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  2616. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  2617. params.WaypathID = 101100;
  2618. params.WaypointStartID = 101101;
  2619. params.WaypointEndID = 101102;
  2620. Commands->Action_Goto( obj, params );
  2621. }
  2622. else
  2623. {
  2624. Commands->Set_Innate_Is_Stationary(obj, true);
  2625. }
  2626. }
  2627. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2628. {
  2629. ActionParamsStruct params;
  2630. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  2631. {
  2632. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
  2633. params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
  2634. params.WaypathID = 101100;
  2635. params.WaypointStartID = 101102;
  2636. params.WaypointEndID = 101101;
  2637. Commands->Action_Goto( obj, params );
  2638. }
  2639. if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
  2640. {
  2641. Commands->Set_Innate_Is_Stationary(obj, true);
  2642. }
  2643. }
  2644. void Killed (GameObject * obj, GameObject * killer)
  2645. {
  2646. Commands->Send_Custom_Event (obj, Commands->Find_Object(101104), M06_DEAD_COURTYARD_EAGLE, 1, 0.0f);
  2647. }
  2648. };
  2649. DECLARE_SCRIPT(M06_Hedgemaze_Eagle, "")
  2650. {
  2651. // Register variables to be Auto-Saved
  2652. // All variables must have a unique ID, less than 256, that never changes
  2653. REGISTER_VARIABLES()
  2654. {
  2655. // SAVE_VARIABLE( already_seen, 1 );
  2656. }
  2657. void Created (GameObject * obj)
  2658. {
  2659. Commands->Set_Innate_Is_Stationary(obj, true);
  2660. }
  2661. void Killed (GameObject * obj, GameObject * killer)
  2662. {
  2663. Commands->Send_Custom_Event (obj, Commands->Find_Object(101147), M06_DEAD_HEDGEMAZE_EAGLE, 1, 0.0f);
  2664. }
  2665. };
  2666. DECLARE_SCRIPT(M06_Barracks_Eagle, "")
  2667. {
  2668. // Register variables to be Auto-Saved
  2669. // All variables must have a unique ID, less than 256, that never changes
  2670. REGISTER_VARIABLES()
  2671. {
  2672. // SAVE_VARIABLE( already_seen, 1 );
  2673. }
  2674. void Created (GameObject * obj)
  2675. {
  2676. Commands->Set_Innate_Is_Stationary(obj, true);
  2677. }
  2678. void Killed (GameObject * obj, GameObject * killer)
  2679. {
  2680. Commands->Send_Custom_Event (obj, Commands->Find_Object(101204), M06_DEAD_BARRACKS_EAGLE, 1, 0.0f);
  2681. }
  2682. };
  2683. //Grants initial weapons
  2684. DECLARE_SCRIPT(M06_Havoc_DLS, "")
  2685. {
  2686. bool alarmed;
  2687. int attacking_havoc;
  2688. // Register variables to be Auto-Saved
  2689. // All variables must have a unique ID, less than 256, that never changes
  2690. REGISTER_VARIABLES()
  2691. {
  2692. SAVE_VARIABLE( alarmed, 1 );
  2693. SAVE_VARIABLE( attacking_havoc, 2 );
  2694. }
  2695. enum {HAVOC_ALARM_SOUND};
  2696. void Created(GameObject * obj)
  2697. {
  2698. alarmed = false;
  2699. Commands->Grant_Key (obj, 10, true);
  2700. // Give Havoc the key to the barracks
  2701. Commands->Grant_Key (STAR, 9, true);
  2702. Commands->Give_PowerUp(obj, "POW_Chaingun_Player");
  2703. Commands->Give_PowerUp(obj, "POW_SniperRifle_Player");
  2704. Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
  2705. Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
  2706. Commands->Give_PowerUp(obj, "POW_GrenadeLauncher_Player");
  2707. }
  2708. void Destroyed(GameObject * obj)
  2709. {
  2710. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 666, 666, 0.0f);
  2711. }
  2712. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2713. {
  2714. if ( sound.Type == M06_SOUND_ALARM_ON )
  2715. {
  2716. if(!alarmed)
  2717. {
  2718. Commands->Start_Timer (obj, this, 0.0f, HAVOC_ALARM_SOUND);
  2719. Commands->Debug_Message("Alarm heard on Havoc, play M06_ATTACK_HAVOC_SOUND.\n");
  2720. Commands->Create_Logical_Sound(obj, M06_ATTACK_HAVOC_SOUND, Vector3 (0,0,0), 55.0f);
  2721. alarmed = true;
  2722. }
  2723. }
  2724. if ( sound.Type == M06_SOUND_ALARM_OFF )
  2725. {
  2726. alarmed = false;
  2727. attacking_havoc = 0;
  2728. }
  2729. }
  2730. void Timer_Expired(GameObject * obj, int timer_id )
  2731. {
  2732. if((timer_id == HAVOC_ALARM_SOUND) && (alarmed))
  2733. {
  2734. Commands->Create_Logical_Sound(obj, SOUND_TYPE_GUNSHOT, Vector3 (0,0,0), 30.0f);
  2735. Commands->Start_Timer (obj, this, 8.0f, HAVOC_ALARM_SOUND);
  2736. }
  2737. }
  2738. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2739. {
  2740. ActionParamsStruct params;
  2741. if(type == M06_ATTACK_HAVOC)
  2742. {
  2743. Commands->Debug_Message("Soldier heard M06_ATTACK_HAVOC_SOUND, custom to attack Havoc.\n");
  2744. if(attacking_havoc <= 3)
  2745. {
  2746. attacking_havoc++;
  2747. Commands->Send_Custom_Event(obj, sender, M06_YOU_ATTACK_HAVOC, 1, 0.0f);
  2748. }
  2749. }
  2750. if(type == M06_DEAD_HAVOC_ATTACKER)
  2751. {
  2752. Commands->Debug_Message("Soldier attacking Havoc killed, get new one.\n");
  2753. attacking_havoc = 3;
  2754. Commands->Create_Logical_Sound(obj, M06_ATTACK_HAVOC_SOUND, Vector3 (0,0,0), 55.0f);
  2755. }
  2756. if(type == M06_RELOCATE)
  2757. {
  2758. if(param == 0)
  2759. {
  2760. Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(107607)));
  2761. Commands->Set_Facing (obj, -85.0F);
  2762. }
  2763. if(param == 1)
  2764. {
  2765. //Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108278)));
  2766. Commands->Set_Position (obj, Vector3 (-34.998F, 24.173F, 0.593F));
  2767. Commands->Set_Facing (obj, 140.0F);
  2768. }
  2769. }
  2770. }
  2771. };
  2772. DECLARE_SCRIPT(M06_Resistance_Raider_DLS, "")
  2773. {
  2774. bool talking;
  2775. // Register variables to be Auto-Saved
  2776. // All variables must have a unique ID, less than 256, that never changes
  2777. REGISTER_VARIABLES()
  2778. {
  2779. SAVE_VARIABLE( talking, 1 );
  2780. }
  2781. void Created (GameObject * obj)
  2782. {
  2783. Commands->Set_Innate_Is_Stationary(obj, true);
  2784. Commands->Set_Animation(obj, "S_A_HUMAN.H_A_601A", true);
  2785. Commands->Apply_Damage( obj, 25.0f, "STEEL");
  2786. talking = false;
  2787. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  2788. }
  2789. void Poked(GameObject * obj, GameObject * poker)
  2790. {
  2791. ActionParamsStruct params;
  2792. if (Commands->Is_A_Star(poker) && !talking)
  2793. {
  2794. talking = true;
  2795. // Looks like you're bleedin'.\n
  2796. const char *conv_name = ("M06_CON045");
  2797. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2798. Commands->Join_Conversation(STAR, conv_id, false, true);
  2799. Commands->Join_Conversation(obj, conv_id, false, true);
  2800. Commands->Start_Conversation (conv_id, 100823);
  2801. Commands->Monitor_Conversation (obj, conv_id);
  2802. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2803. }
  2804. }
  2805. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2806. {
  2807. if(action_id == 100823 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2808. {
  2809. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  2810. Vector3 pos = Commands->Get_Position(obj);
  2811. float facing = Commands->Get_Facing(obj);
  2812. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  2813. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  2814. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  2815. Commands->Create_Object("POW_GrenadeLauncher_Player", powerup_loc);
  2816. }
  2817. }
  2818. };
  2819. DECLARE_SCRIPT(M06_Assistance_Farmer_DLS, "")
  2820. {
  2821. int poke_id;
  2822. bool give_health;
  2823. enum {GO_STAR, TALK_STAR, GIVE_HEALTH};
  2824. // Register variables to be Auto-Saved
  2825. // All variables must have a unique ID, less than 256, that never changes
  2826. REGISTER_VARIABLES()
  2827. {
  2828. SAVE_VARIABLE( poke_id, 1 );
  2829. SAVE_VARIABLE( give_health, 2 );
  2830. }
  2831. void Created (GameObject * obj)
  2832. {
  2833. Commands->Innate_Disable(obj);
  2834. give_health = false;
  2835. }
  2836. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2837. {
  2838. if(type == M06_CUSTOM_ACTIVATE)
  2839. {
  2840. Commands->Innate_Enable(obj);
  2841. ActionParamsStruct params;
  2842. poke_id = 1;
  2843. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
  2844. params.Set_Movement( STAR, RUN, 1.5f );
  2845. Commands->Action_Goto( obj, params );
  2846. }
  2847. }
  2848. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2849. {
  2850. ActionParamsStruct params;
  2851. if(action_id == TALK_STAR && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2852. {
  2853. Vector3 pos = Commands->Get_Position(obj);
  2854. float facing = Commands->Get_Facing(obj);
  2855. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  2856. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  2857. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  2858. Commands->Create_Object("POW_GrenadeLauncher_Player", powerup_loc);
  2859. // Send custom to M06_Trigger_A04 zone to start conversation in maintenance shaft
  2860. Commands->Send_Custom_Event(obj, Commands->Find_Object(101357), M06_START_CONVERSATION, 1, 0.0f);
  2861. }
  2862. if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
  2863. {
  2864. // Assume hands over head anim
  2865. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1);
  2866. params.Set_Animation( "H_A_HOST_L1B", true );
  2867. Commands->Action_Play_Animation (obj, params);
  2868. // There are two of 'em in the maintenance shaft. Here, take this.\n
  2869. const char *conv_name = ("M06_CON046");
  2870. int conv_id = Commands->Create_Conversation (conv_name);
  2871. Commands->Join_Conversation(obj, conv_id, false, true);
  2872. Commands->Start_Conversation (conv_id, TALK_STAR);
  2873. Commands->Monitor_Conversation (obj, conv_id);
  2874. }
  2875. }
  2876. void Poked(GameObject * obj, GameObject * poker)
  2877. {
  2878. if(give_health)
  2879. {
  2880. give_health = false;
  2881. // \\Partner.\n
  2882. const char *conv_name = ("M06_CON062");
  2883. int conv_id = Commands->Create_Conversation (conv_name);
  2884. Commands->Join_Conversation(obj, conv_id, false, true);
  2885. Commands->Start_Conversation (conv_id, 10);
  2886. Commands->Monitor_Conversation (obj, conv_id);
  2887. Vector3 pos = Commands->Get_Position(obj);
  2888. float facing = Commands->Get_Facing(obj);
  2889. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  2890. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  2891. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  2892. Commands->Create_Object("tw_POW00_Health", powerup_loc);
  2893. Commands->Start_Timer (obj, this, 10.0f, GIVE_HEALTH);
  2894. }
  2895. }
  2896. void Timer_Expired(GameObject * obj, int timer_id )
  2897. {
  2898. if(timer_id == GIVE_HEALTH)
  2899. {
  2900. give_health = true;
  2901. }
  2902. }
  2903. };
  2904. DECLARE_SCRIPT(M06_Greenhouse_Shaft_Unit, "")
  2905. {
  2906. int soldier_id;
  2907. // Register variables to be Auto-Saved
  2908. // All variables must have a unique ID, less than 256, that never changes
  2909. REGISTER_VARIABLES()
  2910. {
  2911. SAVE_VARIABLE( soldier_id, 1 );
  2912. }
  2913. void Created (GameObject * obj)
  2914. {
  2915. Commands->Innate_Disable(obj);
  2916. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  2917. }
  2918. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2919. {
  2920. if(type == M06_CUSTOM_ACTIVATE)
  2921. {
  2922. Commands->Innate_Enable(obj);
  2923. }
  2924. if(type == M06_START_CONVERSATION)
  2925. {
  2926. if(Commands->Find_Object(101356))
  2927. {
  2928. // But sir, there are two&\n
  2929. const char *conv_name = ("M06_CON047");
  2930. int conv_id = Commands->Create_Conversation (conv_name);
  2931. Commands->Join_Conversation(obj, conv_id, false, true);
  2932. Commands->Join_Conversation(Commands->Find_Object(101356), conv_id, false, true);
  2933. Commands->Start_Conversation (conv_id, 10);
  2934. Commands->Monitor_Conversation (obj, conv_id);
  2935. }
  2936. }
  2937. }
  2938. };
  2939. DECLARE_SCRIPT(M06_Floor1_Library_Unit, "")
  2940. {
  2941. int soldier_id;
  2942. // Register variables to be Auto-Saved
  2943. // All variables must have a unique ID, less than 256, that never changes
  2944. REGISTER_VARIABLES()
  2945. {
  2946. SAVE_VARIABLE( soldier_id, 1 );
  2947. }
  2948. void Created (GameObject * obj)
  2949. {
  2950. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  2951. Commands->Innate_Disable(obj);
  2952. }
  2953. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2954. {
  2955. if(type == M06_CUSTOM_ACTIVATE)
  2956. {
  2957. Commands->Innate_Enable(obj);
  2958. }
  2959. if(type == M06_START_CONVERSATION)
  2960. {
  2961. if(Commands->Find_Object(101358))
  2962. {
  2963. // I see little reason for them to resist.\n
  2964. const char *conv_name = ("M06_CON048");
  2965. int conv_id = Commands->Create_Conversation (conv_name);
  2966. Commands->Join_Conversation(obj, conv_id, false, true);
  2967. Commands->Join_Conversation(Commands->Find_Object(101358), conv_id, false, true);
  2968. Commands->Start_Conversation (conv_id, 10);
  2969. Commands->Monitor_Conversation (obj, conv_id);
  2970. }
  2971. }
  2972. }
  2973. };
  2974. DECLARE_SCRIPT(M06_Enable_Floor1_Library, "")
  2975. {
  2976. bool already_entered;
  2977. // Register variables to be Auto-Saved
  2978. // All variables must have a unique ID, less than 256, that never changes
  2979. REGISTER_VARIABLES()
  2980. {
  2981. SAVE_VARIABLE( already_entered, 1 );
  2982. }
  2983. void Created (GameObject * obj)
  2984. {
  2985. already_entered = false;
  2986. }
  2987. void Entered (GameObject * obj, GameObject * enterer)
  2988. {
  2989. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2990. {
  2991. // Custom to activate innate
  2992. Commands->Send_Custom_Event (obj, Commands->Find_Object(101358), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  2993. Commands->Send_Custom_Event (obj, Commands->Find_Object(101360), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  2994. // Send custom to activate conversation
  2995. Commands->Send_Custom_Event(obj, Commands->Find_Object(101360), M06_START_CONVERSATION, 1, 0.0f);
  2996. Commands->Send_Custom_Event (obj, Commands->Find_Object(101361), M06_DISABLE_ZONE, 1, 0.0f);
  2997. Commands->Send_Custom_Event (obj, Commands->Find_Object(101362), M06_DISABLE_ZONE, 1, 0.0f);
  2998. }
  2999. }
  3000. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3001. {
  3002. if(type == M06_DISABLE_ZONE)
  3003. {
  3004. already_entered = true;
  3005. }
  3006. }
  3007. };
  3008. DECLARE_SCRIPT(M06_Floor1_Bedroom_Unit, "")
  3009. {
  3010. // Register variables to be Auto-Saved
  3011. // All variables must have a unique ID, less than 256, that never changes
  3012. REGISTER_VARIABLES()
  3013. {
  3014. // SAVE_VARIABLE( soldier_id, 1 );
  3015. }
  3016. void Created (GameObject * obj)
  3017. {
  3018. ActionParamsStruct params;
  3019. Commands->Innate_Disable(obj);
  3020. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3021. }
  3022. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3023. {
  3024. if(type == M06_CUSTOM_ACTIVATE)
  3025. {
  3026. Commands->Innate_Enable(obj);
  3027. }
  3028. }
  3029. };
  3030. DECLARE_SCRIPT(M06_Enable_Floor1_Bedroom, "")
  3031. {
  3032. bool already_entered;
  3033. // Register variables to be Auto-Saved
  3034. // All variables must have a unique ID, less than 256, that never changes
  3035. REGISTER_VARIABLES()
  3036. {
  3037. SAVE_VARIABLE( already_entered, 1 );
  3038. }
  3039. void Created (GameObject * obj)
  3040. {
  3041. already_entered = false;
  3042. }
  3043. void Entered (GameObject * obj, GameObject * enterer)
  3044. {
  3045. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3046. {
  3047. Commands->Send_Custom_Event (obj, Commands->Find_Object(101363), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3048. }
  3049. }
  3050. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3051. {
  3052. if(type == M06_DISABLE_ZONE)
  3053. {
  3054. already_entered = true;
  3055. }
  3056. }
  3057. };
  3058. DECLARE_SCRIPT(M06_Enable_Floor2_Bedroom, "")
  3059. {
  3060. bool already_entered;
  3061. // Register variables to be Auto-Saved
  3062. // All variables must have a unique ID, less than 256, that never changes
  3063. REGISTER_VARIABLES()
  3064. {
  3065. SAVE_VARIABLE( already_entered, 1 );
  3066. }
  3067. void Created (GameObject * obj)
  3068. {
  3069. already_entered = false;
  3070. }
  3071. void Entered (GameObject * obj, GameObject * enterer)
  3072. {
  3073. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3074. {
  3075. Commands->Send_Custom_Event (obj, Commands->Find_Object(101364), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3076. }
  3077. }
  3078. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3079. {
  3080. if(type == M06_DISABLE_ZONE)
  3081. {
  3082. already_entered = true;
  3083. }
  3084. }
  3085. };
  3086. DECLARE_SCRIPT(M06_Floor2_Bedroom_Unit, "")
  3087. {
  3088. // Register variables to be Auto-Saved
  3089. // All variables must have a unique ID, less than 256, that never changes
  3090. REGISTER_VARIABLES()
  3091. {
  3092. // SAVE_VARIABLE( soldier_id, 1 );
  3093. }
  3094. void Created (GameObject * obj)
  3095. {
  3096. ActionParamsStruct params;
  3097. Commands->Innate_Disable(obj);
  3098. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3099. }
  3100. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3101. {
  3102. if(type == M06_CUSTOM_ACTIVATE)
  3103. {
  3104. Commands->Innate_Enable(obj);
  3105. }
  3106. }
  3107. };
  3108. DECLARE_SCRIPT(M06_Floor2_Library_Unit, "")
  3109. {
  3110. // Register variables to be Auto-Saved
  3111. // All variables must have a unique ID, less than 256, that never changes
  3112. REGISTER_VARIABLES()
  3113. {
  3114. // SAVE_VARIABLE( soldier_id, 1 );
  3115. }
  3116. void Created (GameObject * obj)
  3117. {
  3118. Commands->Innate_Disable(obj);
  3119. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3120. }
  3121. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3122. {
  3123. if(type == M06_CUSTOM_ACTIVATE)
  3124. {
  3125. Commands->Innate_Enable(obj);
  3126. }
  3127. if(type == M06_START_CONVERSATION)
  3128. {
  3129. if(Commands->Find_Object(101366))
  3130. {
  3131. // What could Raveshaw possibly want with references to Incan astrology?\n
  3132. const char *conv_name = ("M06_CON049");
  3133. int conv_id = Commands->Create_Conversation (conv_name);
  3134. Commands->Join_Conversation(obj, conv_id, false, true);
  3135. Commands->Join_Conversation(Commands->Find_Object(101366), conv_id, false, true);
  3136. Commands->Start_Conversation (conv_id, 10);
  3137. Commands->Monitor_Conversation (obj, conv_id);
  3138. }
  3139. }
  3140. }
  3141. };
  3142. DECLARE_SCRIPT(M06_Enable_Floor2_Library, "")
  3143. {
  3144. bool already_entered;
  3145. // Register variables to be Auto-Saved
  3146. // All variables must have a unique ID, less than 256, that never changes
  3147. REGISTER_VARIABLES()
  3148. {
  3149. SAVE_VARIABLE( already_entered, 1 );
  3150. }
  3151. void Created (GameObject * obj)
  3152. {
  3153. already_entered = false;
  3154. }
  3155. void Entered (GameObject * obj, GameObject * enterer)
  3156. {
  3157. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3158. {
  3159. already_entered = true;
  3160. Commands->Send_Custom_Event (obj, Commands->Find_Object(101365), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3161. Commands->Send_Custom_Event (obj, Commands->Find_Object(101366), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3162. // Send custom to activate conversation
  3163. Commands->Send_Custom_Event(obj, Commands->Find_Object(101365), M06_START_CONVERSATION, 1, 0.0f);
  3164. }
  3165. }
  3166. };
  3167. DECLARE_SCRIPT(M06_Floor2_Conference_Unit, "")
  3168. {
  3169. // Register variables to be Auto-Saved
  3170. // All variables must have a unique ID, less than 256, that never changes
  3171. REGISTER_VARIABLES()
  3172. {
  3173. // SAVE_VARIABLE( soldier_id, 1 );
  3174. }
  3175. void Created (GameObject * obj)
  3176. {
  3177. Commands->Innate_Disable(obj);
  3178. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3179. }
  3180. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3181. {
  3182. if(type == M06_CUSTOM_ACTIVATE)
  3183. {
  3184. Commands->Innate_Enable(obj);
  3185. }
  3186. if(type == M06_START_CONVERSATION)
  3187. {
  3188. if(Commands->Find_Object(101370))
  3189. {
  3190. // We should simply bombard the village with long range artillery.\n
  3191. const char *conv_name = ("M06_CON050");
  3192. int conv_id = Commands->Create_Conversation (conv_name);
  3193. Commands->Join_Conversation(obj, conv_id, false, true);
  3194. Commands->Join_Conversation(Commands->Find_Object(101370), conv_id, false, true);
  3195. Commands->Start_Conversation (conv_id, 10);
  3196. Commands->Monitor_Conversation (obj, conv_id);
  3197. }
  3198. }
  3199. }
  3200. };
  3201. DECLARE_SCRIPT(M06_Enable_Floor2_Conference, "")
  3202. {
  3203. bool already_entered;
  3204. // Register variables to be Auto-Saved
  3205. // All variables must have a unique ID, less than 256, that never changes
  3206. REGISTER_VARIABLES()
  3207. {
  3208. SAVE_VARIABLE( already_entered, 1 );
  3209. }
  3210. void Created (GameObject * obj)
  3211. {
  3212. already_entered = false;
  3213. }
  3214. void Entered (GameObject * obj, GameObject * enterer)
  3215. {
  3216. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3217. {
  3218. already_entered = true;
  3219. Commands->Send_Custom_Event (obj, Commands->Find_Object(101369), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3220. Commands->Send_Custom_Event (obj, Commands->Find_Object(101370), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3221. // Send custom to activate conversation
  3222. Commands->Send_Custom_Event(obj, Commands->Find_Object(101369), M06_START_CONVERSATION, 1, 0.0f);
  3223. }
  3224. }
  3225. };
  3226. // WarRoom Officer
  3227. DECLARE_SCRIPT(M06_WarRoom_Officer_DLS, "")
  3228. {
  3229. bool has_keycard;
  3230. // Register variables to be Auto-Saved
  3231. // All variables must have a unique ID, less than 256, that never changes
  3232. REGISTER_VARIABLES()
  3233. {
  3234. SAVE_VARIABLE( has_keycard, 1 );
  3235. }
  3236. void Created (GameObject * obj)
  3237. {
  3238. Commands->Innate_Disable(obj);
  3239. Commands->Set_Innate_Is_Stationary(obj, true);
  3240. has_keycard = false;
  3241. }
  3242. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3243. {
  3244. ActionParamsStruct params;
  3245. if(type == M06_CUSTOM_ACTIVATE)
  3246. {
  3247. Commands->Innate_Enable(obj);
  3248. }
  3249. if(type == M06_START_CONVERSATION)
  3250. {
  3251. // Do not patronize me, when are you going to move the scientists to the Research Facility?\n
  3252. // const char *conv_name = ("M06_CON051");
  3253. // int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5);
  3254. // Commands->Join_Conversation(NULL, conv_id, false, true);
  3255. // Commands->Join_Conversation(obj, conv_id, false, true);
  3256. // Commands->Start_Conversation (conv_id, 300123);
  3257. // Commands->Monitor_Conversation (obj, conv_id);
  3258. }
  3259. if(type == M06_WR_KCARD_ACQUIRED)
  3260. {
  3261. has_keycard = true;
  3262. }
  3263. }
  3264. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3265. {
  3266. Commands->Set_Innate_Is_Stationary(obj, false);
  3267. }
  3268. };
  3269. DECLARE_SCRIPT(M06_WarRoom_Bodyguard_DLS, "")
  3270. {
  3271. bool has_keycard;
  3272. // Register variables to be Auto-Saved
  3273. // All variables must have a unique ID, less than 256, that never changes
  3274. REGISTER_VARIABLES()
  3275. {
  3276. SAVE_VARIABLE( has_keycard, 1 );
  3277. }
  3278. void Created (GameObject * obj)
  3279. {
  3280. has_keycard = false;
  3281. Commands->Innate_Disable(obj);
  3282. }
  3283. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3284. {
  3285. if(type == M06_CUSTOM_ACTIVATE)
  3286. {
  3287. Commands->Innate_Enable(obj);
  3288. }
  3289. if(type == M06_WR_KCARD_ACQUIRED)
  3290. {
  3291. has_keycard = true;
  3292. }
  3293. }
  3294. };
  3295. DECLARE_SCRIPT(M06_Enable_Warroom_DoorGuard, "")
  3296. {
  3297. bool already_entered;
  3298. // Register variables to be Auto-Saved
  3299. // All variables must have a unique ID, less than 256, that never changes
  3300. REGISTER_VARIABLES()
  3301. {
  3302. SAVE_VARIABLE( already_entered, 1 );
  3303. }
  3304. void Created (GameObject * obj)
  3305. {
  3306. already_entered = false;
  3307. }
  3308. void Entered (GameObject * obj, GameObject * enterer)
  3309. {
  3310. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3311. {
  3312. already_entered = true;
  3313. Commands->Send_Custom_Event (obj, Commands->Find_Object(101516), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3314. }
  3315. }
  3316. };
  3317. DECLARE_SCRIPT(M06_WarRoom_DoorGuard, "")
  3318. {
  3319. bool has_keycard;
  3320. // Register variables to be Auto-Saved
  3321. // All variables must have a unique ID, less than 256, that never changes
  3322. REGISTER_VARIABLES()
  3323. {
  3324. SAVE_VARIABLE( has_keycard, 1 );
  3325. }
  3326. void Created (GameObject * obj)
  3327. {
  3328. has_keycard = false;
  3329. Commands->Innate_Disable(obj);
  3330. Commands->Set_Innate_Is_Stationary(obj, true);
  3331. }
  3332. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3333. {
  3334. if(type == M06_CUSTOM_ACTIVATE)
  3335. {
  3336. Commands->Innate_Enable(obj);
  3337. }
  3338. if(type == M06_WR_KCARD_ACQUIRED)
  3339. {
  3340. has_keycard = true;
  3341. }
  3342. }
  3343. };
  3344. DECLARE_SCRIPT(M06_Enable_WarRoom, "")
  3345. {
  3346. bool already_entered;
  3347. // Register variables to be Auto-Saved
  3348. // All variables must have a unique ID, less than 256, that never changes
  3349. REGISTER_VARIABLES()
  3350. {
  3351. SAVE_VARIABLE( already_entered, 1 );
  3352. }
  3353. void Created (GameObject * obj)
  3354. {
  3355. already_entered = false;
  3356. }
  3357. void Entered (GameObject * obj, GameObject * enterer)
  3358. {
  3359. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3360. {
  3361. already_entered = true;
  3362. // Activate innate on courtyard units
  3363. Commands->Send_Custom_Event (obj, Commands->Find_Object(101008), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3364. Commands->Send_Custom_Event (obj, Commands->Find_Object(101009), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3365. // Send custom to activate conversation
  3366. // Commands->Send_Custom_Event(obj, Commands->Find_Object(101008), M06_START_CONVERSATION, 1, 0.0f);
  3367. // Kane conversation with Warroom Officer
  3368. GameObject * holograph = Commands->Find_Object(112464);
  3369. GameObject * kane = Commands->Create_Object_At_Bone ( holograph, "Nod_Kane_HologramHead_small", "O_ARROW" );
  3370. Commands->Attach_To_Object_Bone( kane, holograph, "O_ARROW" );
  3371. Commands->Disable_All_Collisions ( kane );
  3372. Commands->Set_Facing (kane, Commands->Get_Facing (holograph));
  3373. Commands->Set_Loiters_Allowed( kane, false );
  3374. Commands->Attach_Script(kane, "M06_KaneHead", "");
  3375. }
  3376. }
  3377. };
  3378. DECLARE_SCRIPT(M06_KaneHead, "")
  3379. {
  3380. bool already_entered;
  3381. // Register variables to be Auto-Saved
  3382. // All variables must have a unique ID, less than 256, that never changes
  3383. REGISTER_VARIABLES()
  3384. {
  3385. SAVE_VARIABLE( already_entered, 1 );
  3386. }
  3387. void Created (GameObject * obj)
  3388. {
  3389. // Do not patronize me, when are you going to move the scientists to the Research Facility?\n
  3390. const char *conv_name = ("M06_CON051");
  3391. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5);
  3392. Commands->Join_Conversation(obj, conv_id, false, true);
  3393. Commands->Join_Conversation(Commands->Find_Object(101008), conv_id, false, true);
  3394. Commands->Start_Conversation (conv_id, 300123);
  3395. Commands->Monitor_Conversation (obj, conv_id);
  3396. }
  3397. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3398. {
  3399. if((action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_ENDED) || (action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  3400. {
  3401. // Kane conversation with Havoc
  3402. const char *conv_name = ("M06_CON064");
  3403. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
  3404. Commands->Join_Conversation(obj, conv_id, false, true);
  3405. Commands->Join_Conversation(STAR, conv_id, false, true);
  3406. Commands->Start_Conversation (conv_id, 300124);
  3407. Commands->Monitor_Conversation (obj, conv_id);
  3408. }
  3409. if((action_id == 300124 && reason == ACTION_COMPLETE_CONVERSATION_ENDED) || (action_id == 300124 && reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  3410. {
  3411. Commands->Destroy_Object(obj);
  3412. }
  3413. }
  3414. };
  3415. DECLARE_SCRIPT(M06_Enable_Officers_Mess, "")
  3416. {
  3417. bool already_entered;
  3418. // Register variables to be Auto-Saved
  3419. // All variables must have a unique ID, less than 256, that never changes
  3420. REGISTER_VARIABLES()
  3421. {
  3422. SAVE_VARIABLE( already_entered, 1 );
  3423. }
  3424. void Created (GameObject * obj)
  3425. {
  3426. already_entered = false;
  3427. }
  3428. void Entered (GameObject * obj, GameObject * enterer)
  3429. {
  3430. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3431. {
  3432. already_entered = true;
  3433. // Activate innate on courtyard units
  3434. Commands->Send_Custom_Event (obj, Commands->Find_Object(101374), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3435. Commands->Send_Custom_Event (obj, Commands->Find_Object(101375), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3436. // Send custom to activate conversation
  3437. Commands->Send_Custom_Event(obj, Commands->Find_Object(101374), M06_START_CONVERSATION, 1, 0.0f);
  3438. // Disable zones
  3439. Commands->Send_Custom_Event (obj, Commands->Find_Object(101376), M06_DISABLE_ZONE, 1, 0.0f);
  3440. Commands->Send_Custom_Event (obj, Commands->Find_Object(101377), M06_DISABLE_ZONE, 1, 0.0f);
  3441. Commands->Send_Custom_Event (obj, Commands->Find_Object(101378), M06_DISABLE_ZONE, 1, 0.0f);
  3442. Commands->Send_Custom_Event (obj, Commands->Find_Object(101379), M06_DISABLE_ZONE, 1, 0.0f);
  3443. Commands->Send_Custom_Event (obj, Commands->Find_Object(101380), M06_DISABLE_ZONE, 1, 0.0f);
  3444. Commands->Send_Custom_Event (obj, Commands->Find_Object(101381), M06_DISABLE_ZONE, 1, 0.0f);
  3445. Commands->Send_Custom_Event (obj, Commands->Find_Object(101382), M06_DISABLE_ZONE, 1, 0.0f);
  3446. }
  3447. }
  3448. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3449. {
  3450. if(type == M06_DISABLE_ZONE)
  3451. {
  3452. already_entered = true;
  3453. }
  3454. }
  3455. };
  3456. DECLARE_SCRIPT(M06_Officers_Mess_Unit, "")
  3457. {
  3458. // Register variables to be Auto-Saved
  3459. // All variables must have a unique ID, less than 256, that never changes
  3460. REGISTER_VARIABLES()
  3461. {
  3462. // SAVE_VARIABLE( soldier_id, 1 );
  3463. }
  3464. void Created (GameObject * obj)
  3465. {
  3466. Commands->Innate_Disable(obj);
  3467. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3468. }
  3469. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3470. {
  3471. if(type == M06_CUSTOM_ACTIVATE)
  3472. {
  3473. Commands->Innate_Enable(obj);
  3474. }
  3475. if(type == M06_START_CONVERSATION)
  3476. {
  3477. if(Commands->Find_Object(101375))
  3478. {
  3479. // It is the electromagnetic system that revolutionizes it.\n
  3480. const char *conv_name = ("M06_CON052");
  3481. int conv_id = Commands->Create_Conversation (conv_name);
  3482. Commands->Join_Conversation(obj, conv_id, false, true);
  3483. Commands->Join_Conversation(Commands->Find_Object(101375), conv_id, false, true);
  3484. Commands->Start_Conversation (conv_id, 10);
  3485. Commands->Monitor_Conversation (obj, conv_id);
  3486. }
  3487. }
  3488. }
  3489. };
  3490. DECLARE_SCRIPT(M06_Courtyard_Unit, "")
  3491. {
  3492. // Register variables to be Auto-Saved
  3493. // All variables must have a unique ID, less than 256, that never changes
  3494. REGISTER_VARIABLES()
  3495. {
  3496. // SAVE_VARIABLE( soldier_id, 1 );
  3497. }
  3498. void Created (GameObject * obj)
  3499. {
  3500. Commands->Innate_Disable(obj);
  3501. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3502. }
  3503. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3504. {
  3505. if(type == M06_CUSTOM_ACTIVATE)
  3506. {
  3507. Commands->Innate_Enable(obj);
  3508. }
  3509. if(type == M06_START_CONVERSATION)
  3510. {
  3511. if(Commands->Find_Object(101384) && Commands->Find_Object(101385))
  3512. {
  3513. // Both of you have proven yourself loyal, and as such I feel you are prime candidates for a very sensitive mission.\n
  3514. const char *conv_name = ("M06_CON053");
  3515. int conv_id = Commands->Create_Conversation (conv_name);
  3516. Commands->Join_Conversation(obj, conv_id, false, true);
  3517. Commands->Join_Conversation(Commands->Find_Object(101384), conv_id, false, true);
  3518. Commands->Join_Conversation(Commands->Find_Object(101385), conv_id, false, true);
  3519. Commands->Start_Conversation (conv_id, 10);
  3520. Commands->Monitor_Conversation (obj, conv_id);
  3521. }
  3522. }
  3523. }
  3524. };
  3525. DECLARE_SCRIPT(M06_Enable_Courtyard, "")
  3526. {
  3527. bool already_entered;
  3528. // Register variables to be Auto-Saved
  3529. // All variables must have a unique ID, less than 256, that never changes
  3530. REGISTER_VARIABLES()
  3531. {
  3532. SAVE_VARIABLE( already_entered, 1 );
  3533. }
  3534. void Created (GameObject * obj)
  3535. {
  3536. already_entered = false;
  3537. }
  3538. void Entered (GameObject * obj, GameObject * enterer)
  3539. {
  3540. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3541. {
  3542. already_entered = true;
  3543. // Activate innate on courtyard units
  3544. Commands->Send_Custom_Event (obj, Commands->Find_Object(101383), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3545. Commands->Send_Custom_Event (obj, Commands->Find_Object(101384), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3546. Commands->Send_Custom_Event (obj, Commands->Find_Object(101385), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3547. // Send custom to activate conversation
  3548. Commands->Send_Custom_Event(obj, Commands->Find_Object(101383), M06_START_CONVERSATION, 1, 0.0f);
  3549. // Disable zones
  3550. Commands->Send_Custom_Event (obj, Commands->Find_Object(101386), M06_DISABLE_ZONE, 1, 0.0f);
  3551. Commands->Send_Custom_Event (obj, Commands->Find_Object(101387), M06_DISABLE_ZONE, 1, 0.0f);
  3552. Commands->Send_Custom_Event (obj, Commands->Find_Object(101388), M06_DISABLE_ZONE, 1, 0.0f);
  3553. Commands->Send_Custom_Event (obj, Commands->Find_Object(101389), M06_DISABLE_ZONE, 1, 0.0f);
  3554. Commands->Send_Custom_Event (obj, Commands->Find_Object(101390), M06_DISABLE_ZONE, 1, 0.0f);
  3555. }
  3556. }
  3557. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3558. {
  3559. if(type == M06_DISABLE_ZONE)
  3560. {
  3561. already_entered = true;
  3562. }
  3563. }
  3564. };
  3565. DECLARE_SCRIPT(M06_Enable_Bathroom, "")
  3566. {
  3567. bool already_entered;
  3568. // Register variables to be Auto-Saved
  3569. // All variables must have a unique ID, less than 256, that never changes
  3570. REGISTER_VARIABLES()
  3571. {
  3572. SAVE_VARIABLE( already_entered, 1 );
  3573. }
  3574. void Created (GameObject * obj)
  3575. {
  3576. already_entered = false;
  3577. }
  3578. void Entered (GameObject * obj, GameObject * enterer)
  3579. {
  3580. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3581. {
  3582. already_entered = true;
  3583. // Activate innate on north barracks units
  3584. Commands->Send_Custom_Event (obj, Commands->Find_Object(101391), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3585. Commands->Send_Custom_Event (obj, Commands->Find_Object(101393), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3586. // Send custom to activate conversation
  3587. Commands->Send_Custom_Event(obj, Commands->Find_Object(101393), M06_START_CONVERSATION, 1, 0.0f);
  3588. // Disable zones
  3589. Commands->Send_Custom_Event (obj, Commands->Find_Object(101394), M06_DISABLE_ZONE, 1, 0.0f);
  3590. Commands->Send_Custom_Event (obj, Commands->Find_Object(101395), M06_DISABLE_ZONE, 1, 0.0f);
  3591. }
  3592. }
  3593. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3594. {
  3595. if(type == M06_DISABLE_ZONE)
  3596. {
  3597. already_entered = true;
  3598. }
  3599. }
  3600. };
  3601. DECLARE_SCRIPT(M06_Enable_Barracks_Mess, "")
  3602. {
  3603. bool already_entered;
  3604. // Register variables to be Auto-Saved
  3605. // All variables must have a unique ID, less than 256, that never changes
  3606. REGISTER_VARIABLES()
  3607. {
  3608. SAVE_VARIABLE( already_entered, 1 );
  3609. }
  3610. void Created (GameObject * obj)
  3611. {
  3612. already_entered = false;
  3613. }
  3614. void Entered (GameObject * obj, GameObject * enterer)
  3615. {
  3616. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3617. {
  3618. already_entered = true;
  3619. // Activate innate on north barracks units
  3620. Commands->Send_Custom_Event (obj, Commands->Find_Object(101502), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3621. Commands->Send_Custom_Event (obj, Commands->Find_Object(101503), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3622. // Send custom to activate conversation
  3623. Commands->Send_Custom_Event(obj, Commands->Find_Object(101502), M06_START_CONVERSATION, 1, 0.0f);
  3624. // Disable zones
  3625. Commands->Send_Custom_Event (obj, Commands->Find_Object(101504), M06_DISABLE_ZONE, 1, 0.0f);
  3626. Commands->Send_Custom_Event (obj, Commands->Find_Object(101505), M06_DISABLE_ZONE, 1, 0.0f);
  3627. Commands->Send_Custom_Event (obj, Commands->Find_Object(101506), M06_DISABLE_ZONE, 1, 0.0f);
  3628. Commands->Send_Custom_Event (obj, Commands->Find_Object(101507), M06_DISABLE_ZONE, 1, 0.0f);
  3629. Commands->Send_Custom_Event (obj, Commands->Find_Object(101508), M06_DISABLE_ZONE, 1, 0.0f);
  3630. }
  3631. }
  3632. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3633. {
  3634. if(type == M06_DISABLE_ZONE)
  3635. {
  3636. already_entered = true;
  3637. }
  3638. }
  3639. };
  3640. DECLARE_SCRIPT(M06_Barracks_Mess_Unit, "")
  3641. {
  3642. // Register variables to be Auto-Saved
  3643. // All variables must have a unique ID, less than 256, that never changes
  3644. REGISTER_VARIABLES()
  3645. {
  3646. // SAVE_VARIABLE( soldier_id, 1 );
  3647. }
  3648. void Created (GameObject * obj)
  3649. {
  3650. Commands->Innate_Disable(obj);
  3651. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3652. }
  3653. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3654. {
  3655. if(type == M06_CUSTOM_ACTIVATE)
  3656. {
  3657. Commands->Innate_Enable(obj);
  3658. }
  3659. if(type == M06_START_CONVERSATION)
  3660. {
  3661. if(Commands->Find_Object(101503))
  3662. {
  3663. // Put it over there, and don't slop it around.\n
  3664. const char *conv_name = ("M06_CON054");
  3665. int conv_id = Commands->Create_Conversation (conv_name);
  3666. Commands->Join_Conversation(obj, conv_id, false, true);
  3667. Commands->Join_Conversation(Commands->Find_Object(101503), conv_id, false, true);
  3668. Commands->Start_Conversation (conv_id, 10);
  3669. Commands->Monitor_Conversation (obj, conv_id);
  3670. }
  3671. }
  3672. }
  3673. };
  3674. DECLARE_SCRIPT(M06_Bathroom_Unit, "")
  3675. {
  3676. // Register variables to be Auto-Saved
  3677. // All variables must have a unique ID, less than 256, that never changes
  3678. REGISTER_VARIABLES()
  3679. {
  3680. // SAVE_VARIABLE( soldier_id, 1 );
  3681. }
  3682. void Created (GameObject * obj)
  3683. {
  3684. Commands->Innate_Disable(obj);
  3685. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3686. }
  3687. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3688. {
  3689. if(type == M06_CUSTOM_ACTIVATE)
  3690. {
  3691. Commands->Innate_Enable(obj);
  3692. }
  3693. if(type == M06_START_CONVERSATION)
  3694. {
  3695. if(Commands->Find_Object(101391))
  3696. {
  3697. // Man, this new chem suit insulation itches something awful.\n
  3698. const char *conv_name = ("M06_CON055");
  3699. int conv_id = Commands->Create_Conversation (conv_name);
  3700. Commands->Join_Conversation(obj, conv_id, false, true);
  3701. Commands->Join_Conversation(Commands->Find_Object(101391), conv_id, false, true);
  3702. Commands->Start_Conversation (conv_id, 10);
  3703. Commands->Monitor_Conversation (obj, conv_id);
  3704. }
  3705. }
  3706. }
  3707. };
  3708. DECLARE_SCRIPT(M06_Enable_South_Barracks, "")
  3709. {
  3710. bool already_entered;
  3711. // Register variables to be Auto-Saved
  3712. // All variables must have a unique ID, less than 256, that never changes
  3713. REGISTER_VARIABLES()
  3714. {
  3715. SAVE_VARIABLE( already_entered, 1 );
  3716. }
  3717. void Created (GameObject * obj)
  3718. {
  3719. already_entered = false;
  3720. }
  3721. void Entered (GameObject * obj, GameObject * enterer)
  3722. {
  3723. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3724. {
  3725. already_entered = true;
  3726. // Activate innate on barracks units
  3727. Commands->Send_Custom_Event (obj, Commands->Find_Object(101399), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3728. Commands->Send_Custom_Event (obj, Commands->Find_Object(101400), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3729. Commands->Send_Custom_Event (obj, Commands->Find_Object(101403), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3730. // Send custom to activate conversation
  3731. Commands->Send_Custom_Event(obj, Commands->Find_Object(101400), M06_START_CONVERSATION, 1, 0.0f);
  3732. // Disable zones
  3733. Commands->Send_Custom_Event (obj, Commands->Find_Object(101401), M06_DISABLE_ZONE, 1, 0.0f);
  3734. Commands->Send_Custom_Event (obj, Commands->Find_Object(101402), M06_DISABLE_ZONE, 1, 0.0f);
  3735. }
  3736. }
  3737. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3738. {
  3739. if(type == M06_DISABLE_ZONE)
  3740. {
  3741. already_entered = true;
  3742. }
  3743. }
  3744. };
  3745. DECLARE_SCRIPT(M06_South_Barracks_Unit, "")
  3746. {
  3747. // Register variables to be Auto-Saved
  3748. // All variables must have a unique ID, less than 256, that never changes
  3749. REGISTER_VARIABLES()
  3750. {
  3751. // SAVE_VARIABLE( soldier_id, 1 );
  3752. }
  3753. void Created (GameObject * obj)
  3754. {
  3755. Commands->Innate_Disable(obj);
  3756. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3757. }
  3758. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3759. {
  3760. if(type == M06_CUSTOM_ACTIVATE)
  3761. {
  3762. Commands->Innate_Enable(obj);
  3763. }
  3764. if(type == M06_START_CONVERSATION)
  3765. {
  3766. if(Commands->Find_Object(101399))
  3767. {
  3768. // I just don't get it, we are finely trained soldiers. What do we need mercs for?\n
  3769. const char *conv_name = ("M06_CON056");
  3770. int conv_id = Commands->Create_Conversation (conv_name);
  3771. Commands->Join_Conversation(obj, conv_id, false, true);
  3772. Commands->Join_Conversation(Commands->Find_Object(101399), conv_id, false, true);
  3773. Commands->Start_Conversation (conv_id, 10);
  3774. Commands->Monitor_Conversation (obj, conv_id);
  3775. }
  3776. }
  3777. }
  3778. };
  3779. DECLARE_SCRIPT(M06_Enable_North_Barracks, "")
  3780. {
  3781. bool already_entered;
  3782. // Register variables to be Auto-Saved
  3783. // All variables must have a unique ID, less than 256, that never changes
  3784. REGISTER_VARIABLES()
  3785. {
  3786. SAVE_VARIABLE( already_entered, 1 );
  3787. }
  3788. void Created (GameObject * obj)
  3789. {
  3790. already_entered = false;
  3791. }
  3792. void Entered (GameObject * obj, GameObject * enterer)
  3793. {
  3794. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3795. {
  3796. already_entered = true;
  3797. // Activate innate on barracks units
  3798. Commands->Send_Custom_Event (obj, Commands->Find_Object(101396), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3799. Commands->Send_Custom_Event (obj, Commands->Find_Object(101397), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3800. Commands->Send_Custom_Event (obj, Commands->Find_Object(101398), M06_CUSTOM_ACTIVATE, 1, 0.0f);
  3801. // Disable zones
  3802. Commands->Send_Custom_Event (obj, Commands->Find_Object(101500), M06_DISABLE_ZONE, 1, 0.0f);
  3803. Commands->Send_Custom_Event (obj, Commands->Find_Object(101501), M06_DISABLE_ZONE, 1, 0.0f);
  3804. }
  3805. }
  3806. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3807. {
  3808. if(type == M06_DISABLE_ZONE)
  3809. {
  3810. already_entered = true;
  3811. }
  3812. }
  3813. };
  3814. DECLARE_SCRIPT(M06_North_Barracks_Unit, "")
  3815. {
  3816. // Register variables to be Auto-Saved
  3817. // All variables must have a unique ID, less than 256, that never changes
  3818. REGISTER_VARIABLES()
  3819. {
  3820. // SAVE_VARIABLE( soldier_id, 1 );
  3821. }
  3822. void Created (GameObject * obj)
  3823. {
  3824. Commands->Innate_Disable(obj);
  3825. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3826. ActionParamsStruct params;
  3827. }
  3828. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3829. {
  3830. if(type == M06_CUSTOM_ACTIVATE)
  3831. {
  3832. Commands->Innate_Enable(obj);
  3833. }
  3834. }
  3835. };
  3836. DECLARE_SCRIPT (M06_Courtyard_Apache, "")
  3837. {
  3838. bool out_of_range;
  3839. enum {COURTYARD};
  3840. // Register variables to be Auto-Saved
  3841. // All variables must have a unique ID, less than 256, that never changes
  3842. REGISTER_VARIABLES()
  3843. {
  3844. SAVE_VARIABLE( out_of_range, 1 );
  3845. }
  3846. void Created (GameObject *obj)
  3847. {
  3848. ActionParamsStruct params;
  3849. params.Set_Basic( this, 100, COURTYARD );
  3850. params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
  3851. params.WaypathID = 101428;
  3852. params.WaypathSplined = true;
  3853. Commands->Action_Goto( obj, params );
  3854. }
  3855. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason reason ) //this is called when the servant reaches the destination location.
  3856. {
  3857. ActionParamsStruct params;
  3858. if (action_id == COURTYARD && reason == ACTION_COMPLETE_NORMAL)
  3859. {
  3860. params.Set_Basic( this, 100, COURTYARD );
  3861. params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
  3862. params.Set_Attack (STAR, 150.0f, 1.0f, 1);
  3863. params.WaypathID = 101428;
  3864. params.WaypathSplined = true;
  3865. Commands->Action_Attack( obj, params );
  3866. }
  3867. if (action_id == COURTYARD && reason == ACTION_COMPLETE_ATTACK_OUT_OF_RANGE)
  3868. {
  3869. out_of_range = true;
  3870. }
  3871. }
  3872. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3873. {
  3874. if(out_of_range)
  3875. {
  3876. ActionParamsStruct params;
  3877. out_of_range = false;
  3878. params.Set_Basic( this, 100, COURTYARD );
  3879. params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
  3880. params.Set_Attack (STAR, 150.0f, 1.0f, 1);
  3881. params.WaypathID = 101428;
  3882. params.WaypathSplined = true;
  3883. Commands->Action_Attack( obj, params );
  3884. }
  3885. }
  3886. };
  3887. DECLARE_SCRIPT(M06_Flyover_Controller, "") // 100018
  3888. {
  3889. int last;
  3890. bool flyovers;
  3891. // Register variables to be Auto-Saved
  3892. // All variables must have a unique ID, less than 256, that never changes
  3893. REGISTER_VARIABLES()
  3894. {
  3895. SAVE_VARIABLE( last, 1 );
  3896. SAVE_VARIABLE( flyovers, 2 );
  3897. }
  3898. void Created(GameObject * obj)
  3899. {
  3900. last = 0;
  3901. flyovers = true;
  3902. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, 1, 0.0f);
  3903. }
  3904. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3905. {
  3906. ActionParamsStruct params;
  3907. if(type == M06_FLYOVER_COMPLETE && flyovers)
  3908. {
  3909. last = param;
  3910. char *flyovers[11] =
  3911. {
  3912. "M06_XG_VehicleDrop0.txt",
  3913. "M06_XG_VehicleDrop1.txt",
  3914. "M06_XG_VehicleDrop2.txt",
  3915. "X6A_Apache_03.txt",
  3916. "X6A_Apache_04.txt",
  3917. "X6A_Apache_05.txt",
  3918. "X6A_Apache_06.txt",
  3919. "X6A_Apache_07.txt",
  3920. "X6A_Apache_08.txt",
  3921. "X6A_Apache_09.txt",
  3922. "M06_XG_EV2_1.txt",
  3923. };
  3924. int random = Get_Int_Random(0, 10);
  3925. while(random == last)
  3926. {
  3927. random = Get_Int_Random(0, 10);
  3928. }
  3929. switch(random)
  3930. {
  3931. case 1:
  3932. case 2:
  3933. case 3:
  3934. case 10:
  3935. {
  3936. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-44.177f, 30.547f, 1.605f));
  3937. Commands->Set_Facing(controller, 0.000f);
  3938. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  3939. }
  3940. break;
  3941. case 4:
  3942. case 5:
  3943. case 6:
  3944. case 7:
  3945. case 8:
  3946. case 9:
  3947. {
  3948. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3949. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  3950. }
  3951. break;
  3952. }
  3953. }
  3954. if(type == M06_ACTIVATE_FLYOVERS)
  3955. {
  3956. if(param == 1 && !flyovers)
  3957. {
  3958. flyovers = true;
  3959. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, 1, 0.0f);
  3960. }
  3961. else if (param == 0 && flyovers)
  3962. {
  3963. flyovers = false;
  3964. }
  3965. }
  3966. }
  3967. };
  3968. DECLARE_SCRIPT(M06_Activate_Flyovers, "Active=0:int")
  3969. {
  3970. bool already_entered;
  3971. // Register variables to be Auto-Saved
  3972. // All variables must have a unique ID, less than 256, that never changes
  3973. REGISTER_VARIABLES()
  3974. {
  3975. SAVE_VARIABLE( already_entered, 1 );
  3976. }
  3977. void Created (GameObject * obj)
  3978. {
  3979. }
  3980. void Entered (GameObject * obj, GameObject * enterer)
  3981. {
  3982. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3983. {
  3984. bool active = (Get_Int_Parameter("Active") == 1) ? true : false;
  3985. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_ACTIVATE_FLYOVERS, active, 0.0f);
  3986. }
  3987. }
  3988. };
  3989. DECLARE_SCRIPT(M06_Flyover, "Flyover_ID=0:int")
  3990. {
  3991. int flyover_id;
  3992. void Created( GameObject * obj )
  3993. {
  3994. Commands->Disable_Physical_Collisions ( obj );
  3995. flyover_id = Get_Int_Parameter("Flyover_ID");
  3996. }
  3997. void Destroyed(GameObject * obj)
  3998. {
  3999. Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, flyover_id, 0.0f);
  4000. }
  4001. };
  4002. DECLARE_SCRIPT(M06_Drop_Thunder_Squad, "")
  4003. {
  4004. bool already_entered;
  4005. // Register variables to be Auto-Saved
  4006. // All variables must have a unique ID, less than 256, that never changes
  4007. REGISTER_VARIABLES()
  4008. {
  4009. SAVE_VARIABLE( already_entered, 1 );
  4010. }
  4011. void Created (GameObject * obj)
  4012. {
  4013. already_entered = false;
  4014. }
  4015. void Entered (GameObject * obj, GameObject * enterer)
  4016. {
  4017. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4018. {
  4019. already_entered = true;
  4020. // This is Nod Helo Delta 14. We are hot dropping a squad of Black Hand at your doorstep, be advised they are on the ground only long enough to re-equip, skip the standard check in. Raveshaw's orders.\n
  4021. const char *conv_name = ("M06_CON057");
  4022. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  4023. Commands->Join_Conversation(NULL, conv_id, true, true);
  4024. Commands->Join_Conversation(STAR, conv_id, false, true);
  4025. Commands->Start_Conversation (conv_id, 300603);
  4026. Commands->Monitor_Conversation (obj, conv_id);
  4027. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-55.305f, -87.235f, -0.767f));
  4028. Commands->Set_Facing(chinook_obj, 85.000f);
  4029. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X6I_TroopDrop1.txt");
  4030. }
  4031. }
  4032. };
  4033. DECLARE_SCRIPT(M06_Thunder_Unit, "")
  4034. {
  4035. enum{WAYPATH};
  4036. void Created( GameObject * obj )
  4037. {
  4038. ActionParamsStruct params;
  4039. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
  4040. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4041. params.WaypathID = 101520;
  4042. Commands->Action_Goto( obj, params );
  4043. }
  4044. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4045. {
  4046. ActionParamsStruct params;
  4047. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  4048. {
  4049. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  4050. }
  4051. }
  4052. void Killed (GameObject * obj, GameObject * killer)
  4053. {
  4054. Vector3 powerup_loc = Commands->Get_Position(obj);
  4055. Commands->Create_Object("POW_RocketLauncher_Player", powerup_loc);
  4056. }
  4057. };
  4058. DECLARE_SCRIPT(M06_Servant_Behavior, "Loc1_ID=0:int, Loc2_ID=0:int, Loc3_ID=0:int, Animation=S_A_HUMAN.H_A_A0F0:string")
  4059. {
  4060. bool enemy_seen;
  4061. enum{GO_FIRST_LOC, FACING_FIRST_LOC, ANIMATE_FIRST_LOC, GO_SECOND_LOC, FACING_SECOND_LOC, ANIMATE_SECOND_LOC,
  4062. GO_THIRD_LOC, FACING_THIRD_LOC, ANIMATE_THIRD_LOC, HANDS_OVER_HEAD, START_OVER};
  4063. // Register variables to be Auto-Saved
  4064. // All variables must have a unique ID, less than 256, that never changes
  4065. REGISTER_VARIABLES()
  4066. {
  4067. SAVE_VARIABLE( enemy_seen, 1 );
  4068. }
  4069. void Created (GameObject * obj)
  4070. {
  4071. ActionParamsStruct params;
  4072. enemy_seen = false;
  4073. params.Set_Basic (this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_FIRST_LOC);
  4074. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
  4075. Commands->Action_Goto (obj, params);
  4076. }
  4077. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4078. {
  4079. ActionParamsStruct params;
  4080. const char *anim = Get_Parameter("Animation");
  4081. // First Loc
  4082. if(action_id == GO_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4083. {
  4084. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_FIRST_LOC);
  4085. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc1_ID"))), 1.5f);
  4086. Commands->Action_Face_Location ( obj, params );
  4087. }
  4088. if(action_id == FACING_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4089. {
  4090. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_FIRST_LOC );
  4091. params.Set_Animation (anim, false);
  4092. Commands->Action_Play_Animation (obj, params);
  4093. }
  4094. if(action_id == ANIMATE_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
  4095. {
  4096. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_SECOND_LOC);
  4097. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc2_ID")), WALK, 1.5f);
  4098. Commands->Action_Goto (obj, params);
  4099. }
  4100. // Second Loc
  4101. if(action_id == GO_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4102. {
  4103. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_SECOND_LOC);
  4104. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc2_ID"))), 1.5f);
  4105. Commands->Action_Face_Location ( obj, params );
  4106. }
  4107. if(action_id == FACING_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4108. {
  4109. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_SECOND_LOC );
  4110. params.Set_Animation (anim, false);
  4111. Commands->Action_Play_Animation (obj, params);
  4112. }
  4113. if(action_id == ANIMATE_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
  4114. {
  4115. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_THIRD_LOC);
  4116. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc3_ID")), WALK, 1.5f);
  4117. Commands->Action_Goto (obj, params);
  4118. }
  4119. // Third Loc
  4120. if(action_id == GO_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4121. {
  4122. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_THIRD_LOC);
  4123. params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc3_ID"))), 1.5f);
  4124. Commands->Action_Face_Location ( obj, params );
  4125. }
  4126. if(action_id == FACING_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4127. {
  4128. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_THIRD_LOC );
  4129. params.Set_Animation (anim, false);
  4130. Commands->Action_Play_Animation (obj, params);
  4131. }
  4132. if(action_id == ANIMATE_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
  4133. {
  4134. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_FIRST_LOC);
  4135. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
  4136. Commands->Action_Goto (obj, params);
  4137. }
  4138. if(action_id == HANDS_OVER_HEAD && reason == ACTION_COMPLETE_NORMAL)
  4139. {
  4140. // In hands over head anim
  4141. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  4142. params.Set_Animation( "H_A_HOST_L1B", true );
  4143. Commands->Action_Play_Animation (obj, params);
  4144. }
  4145. }
  4146. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4147. {
  4148. ActionParamsStruct params;
  4149. Commands->Create_Logical_Sound(obj, SOUND_TYPE_GUNSHOT, Commands->Get_Position(obj), 8.0f);
  4150. if(!enemy_seen)
  4151. {
  4152. // Help! Intruder! Help!\n
  4153. const char *conv_name = ("M06_CON058");
  4154. int conv_id = Commands->Create_Conversation (conv_name);
  4155. Commands->Join_Conversation(obj, conv_id, false, true);
  4156. Commands->Start_Conversation (conv_id, 1010211);
  4157. // Assume hands over head anim
  4158. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, HANDS_OVER_HEAD);
  4159. params.Set_Animation( "H_A_HOST_L1A", false );
  4160. Commands->Action_Play_Animation (obj, params);
  4161. Commands->Start_Timer (obj, this, 20.0f, START_OVER);
  4162. enemy_seen = true;
  4163. }
  4164. }
  4165. void Timer_Expired(GameObject * obj, int timer_id )
  4166. {
  4167. ActionParamsStruct params;
  4168. if(timer_id == START_OVER)
  4169. {
  4170. enemy_seen = false;
  4171. // Exit hands over head anim
  4172. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  4173. params.Set_Animation( "H_A_HOST_L1C", false );
  4174. Commands->Action_Play_Animation (obj, params);
  4175. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_FIRST_LOC);
  4176. params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
  4177. Commands->Action_Goto (obj, params);
  4178. }
  4179. }
  4180. };
  4181. DECLARE_SCRIPT(M06_Move_Sydney, "Move_Loc=0:int")
  4182. {
  4183. // Register variables to be Auto-Saved
  4184. // All variables must have a unique ID, less than 256, that never changes
  4185. REGISTER_VARIABLES()
  4186. {
  4187. // SAVE_VARIABLE( already_entered, 1 );
  4188. }
  4189. void Created (GameObject * obj)
  4190. {
  4191. }
  4192. void Entered (GameObject * obj, GameObject * enterer)
  4193. {
  4194. if (Commands->Is_A_Star(enterer))
  4195. {
  4196. int move_loc = Get_Int_Parameter("Move_Loc");
  4197. Commands->Send_Custom_Event(obj, Commands->Find_Object(101010), M06_MOVE_SYDNEY, move_loc, 0.0f);
  4198. }
  4199. }
  4200. };
  4201. DECLARE_SCRIPT(M06_Collapse_Zone, "Zone_ID=0:int")
  4202. {
  4203. bool already_entered;
  4204. // Register variables to be Auto-Saved
  4205. // All variables must have a unique ID, less than 256, that never changes
  4206. REGISTER_VARIABLES()
  4207. {
  4208. SAVE_VARIABLE( already_entered, 1 );
  4209. }
  4210. void Created (GameObject * obj)
  4211. {
  4212. already_entered = true;
  4213. }
  4214. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4215. {
  4216. if(type == M06_CHATEAU_COLLAPSE)
  4217. {
  4218. already_entered = false;
  4219. }
  4220. }
  4221. void Entered (GameObject * obj, GameObject * enterer)
  4222. {
  4223. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4224. {
  4225. already_entered = true;
  4226. switch(Get_Int_Parameter("Zone_ID"))
  4227. {
  4228. // First section of crypt, immediately past the lab door
  4229. case 1:
  4230. {
  4231. GameObject * l6_falldust01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4232. Commands->Set_Model ( l6_falldust01, "L6_falldust01" );
  4233. GameObject * l6_falldust02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4234. Commands->Set_Model ( l6_falldust02, "L6_falldust02" );
  4235. GameObject * l6_fallrocks01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4236. Commands->Set_Model ( l6_fallrocks01, "L6_fallrocks01" );
  4237. GameObject * l6_fallrocks07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4238. Commands->Set_Model ( l6_fallrocks07, "L6_fallrocks07" );
  4239. GameObject * l6_fallrocks08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4240. Commands->Set_Model ( l6_fallrocks08, "L6_fallrocks08" );
  4241. }
  4242. break;
  4243. // Back section of crypt, right before you exit out to the stairs up to Chateau
  4244. case 2:
  4245. {
  4246. GameObject * l6_fallrocks09 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4247. Commands->Set_Model ( l6_fallrocks09, "L6_fallrocks09" );
  4248. GameObject * l6_fallrocks11 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4249. Commands->Set_Model ( l6_fallrocks11, "L6_fallrocks11" );
  4250. GameObject * l6_fallrocks10 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4251. Commands->Set_Model ( l6_fallrocks10, "L6_fallrocks10" );
  4252. GameObject * l6_fallfire01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4253. Commands->Set_Model ( l6_fallfire01, "L6_fallfire01" );
  4254. Commands->Set_Animation(l6_fallfire01, "L6_Fallfire01.L6_Fallfire01", true);
  4255. GameObject * l6_floorfire01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4256. Commands->Set_Model ( l6_floorfire01, "L6_floorfire01" );
  4257. Commands->Set_Animation(l6_floorfire01, "L6_floorfire01.L6_floorfire01", true);
  4258. }
  4259. break;
  4260. // Staircase leading out of crypt and hallway immediately up that staircase
  4261. case 3:
  4262. {
  4263. GameObject * l6_falldust03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4264. Commands->Set_Model ( l6_falldust03, "L6_falldust03" );
  4265. GameObject * l6_fallrocks12 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4266. Commands->Set_Model ( l6_fallrocks12, "L6_fallrocks12" );
  4267. GameObject * l6_fallfire02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4268. Commands->Set_Model ( l6_fallfire02, "L6_fallfire02" );
  4269. Commands->Set_Animation(l6_fallfire02, "L6_Fallfire02.L6_Fallfire02", true);
  4270. GameObject * l6_floorfire02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4271. Commands->Set_Model ( l6_floorfire02, "L6_floorfire02" );
  4272. Commands->Set_Animation(l6_floorfire02, "L6_floorfire02.L6_floorfire02", true);
  4273. GameObject * l6_falldust04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4274. Commands->Set_Model ( l6_falldust04, "L6_falldust04" );
  4275. }
  4276. break;
  4277. // Hallway at the top of the staircase leading from crypt, immediately before wooden beam mess hall
  4278. case 4:
  4279. {
  4280. GameObject * l6_fallrocks02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4281. Commands->Set_Model ( l6_fallrocks02, "L6_fallrocks02" );
  4282. GameObject * l6_falldust05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4283. Commands->Set_Model ( l6_falldust05, "L6_falldust05" );
  4284. }
  4285. break;
  4286. // Large mess hall with wooden beams supporting the ceiling
  4287. case 5:
  4288. {
  4289. GameObject * l6_fallwood02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4290. Commands->Set_Model ( l6_fallwood02, "L6_fallwood02" );
  4291. GameObject * l6_fallwood03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4292. Commands->Set_Model ( l6_fallwood03, "L6_fallwood02" );
  4293. GameObject * l6_fallrocks03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4294. Commands->Set_Model ( l6_fallrocks03, "L6_fallrocks03" );
  4295. GameObject * l6_fallwood04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4296. Commands->Set_Model ( l6_fallwood04, "L6_fallwood04" );
  4297. GameObject * l6_falldust10 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4298. Commands->Set_Model ( l6_falldust10, "L6_falldust10" );
  4299. GameObject * l6_falldust06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4300. Commands->Set_Model ( l6_falldust06, "L6_falldust06" );
  4301. GameObject * l6_falldust21 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4302. Commands->Set_Model ( l6_falldust21, "L6_falldust21" );
  4303. GameObject * l6_falldust07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4304. Commands->Set_Model ( l6_falldust07, "L6_falldust07" );
  4305. }
  4306. break;
  4307. // Staircase leading out of mess and into main artwork area
  4308. case 6:
  4309. {
  4310. GameObject * l6_falldust08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4311. Commands->Set_Model ( l6_falldust08, "L6_falldust08" );
  4312. GameObject * l6_fallfire03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4313. Commands->Set_Model ( l6_fallfire03, "L6_fallfire03" );
  4314. Commands->Set_Animation(l6_fallfire03, "L6_Fallfire03.L6_Fallfire03", true);
  4315. GameObject * l6_falldust09 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4316. Commands->Set_Model ( l6_falldust09, "L6_falldust09" );
  4317. GameObject * l6_falldust11 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4318. Commands->Set_Model ( l6_falldust11, "L6_falldust11" );
  4319. }
  4320. break;
  4321. // Columned room
  4322. case 7:
  4323. {
  4324. GameObject * l6_fallwood05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4325. Commands->Set_Model ( l6_fallwood05, "L6_fallwood05" );
  4326. GameObject * l6_fallrocks05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4327. Commands->Set_Model ( l6_fallrocks05, "L6_fallrocks05" );
  4328. GameObject * l6_fallwood06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4329. Commands->Set_Model ( l6_fallwood06, "L6_fallwood06" );
  4330. GameObject * l6_fallrocks06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4331. Commands->Set_Model ( l6_fallrocks06, "L6_fallrocks06" );
  4332. GameObject * l6_falldust17 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4333. Commands->Set_Model ( l6_falldust17, "L6_falldust17" );
  4334. GameObject * l6_floorfire06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4335. Commands->Set_Model ( l6_floorfire06, "L6_floorfire06" );
  4336. Commands->Set_Animation(l6_floorfire06, "L6_floorfire06.L6_floorfire06", true);
  4337. GameObject * l6_falldust18 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4338. Commands->Set_Model ( l6_falldust18, "L6_falldust18" );
  4339. }
  4340. break;
  4341. // Master staircase
  4342. case 8:
  4343. {
  4344. GameObject * l6_fallwood07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4345. Commands->Set_Model ( l6_fallwood07, "L6_fallwood07" );
  4346. GameObject * l6_falldust12 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4347. Commands->Set_Model ( l6_falldust12, "L6_falldust12" );
  4348. GameObject * l6_falldust13 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4349. Commands->Set_Model ( l6_falldust13, "L6_falldust13" );
  4350. GameObject * l6_falldust16 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4351. Commands->Set_Model ( l6_falldust16, "L6_falldust16" );
  4352. GameObject * l6_floorfire04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4353. Commands->Set_Model ( l6_floorfire04, "L6_floorfire04" );
  4354. Commands->Set_Animation(l6_floorfire04, "L6_floorfire04.L6_floorfire04", true);
  4355. GameObject * l6_floorfire05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4356. Commands->Set_Model ( l6_floorfire05, "L6_floorfire05" );
  4357. Commands->Set_Animation(l6_floorfire05, "L6_floorfire04.L6_floorfire05", true);
  4358. GameObject * l6_falldust15 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4359. Commands->Set_Model ( l6_falldust15, "L6_falldust15" );
  4360. GameObject * l6_fallfire05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4361. Commands->Set_Model ( l6_fallfire05, "L6_fallfire05" );
  4362. Commands->Set_Animation(l6_fallfire05, "L6_Fallfire05.L6_Fallfire05", true);
  4363. GameObject * l6_falldust14 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4364. Commands->Set_Model ( l6_falldust14, "L6_falldust14" );
  4365. }
  4366. break;
  4367. // Escape hall and outside room
  4368. case 9:
  4369. {
  4370. GameObject * l6_falldust19 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4371. Commands->Set_Model ( l6_falldust19, "L6_falldust19" );
  4372. GameObject * l6_falldust20 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4373. Commands->Set_Model ( l6_falldust20, "L6_falldust20" );
  4374. GameObject * l6_falldust22 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4375. Commands->Set_Model ( l6_falldust22, "L6_falldust22" );
  4376. GameObject * l6_fallwood08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4377. Commands->Set_Model ( l6_fallwood08, "L6_fallwood08" );
  4378. GameObject * l6_falldust23 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4379. Commands->Set_Model ( l6_falldust23, "L6_falldust23" );
  4380. GameObject * l6_falldust24 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4381. Commands->Set_Model ( l6_falldust24, "L6_falldust24" );
  4382. GameObject * l6_falldust25 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  4383. Commands->Set_Model ( l6_falldust25, "L6_falldust25" );
  4384. }
  4385. break;
  4386. }
  4387. }
  4388. }
  4389. };
  4390. DECLARE_SCRIPT(M06_Activate_MidtroC, "")
  4391. {
  4392. bool already_entered;
  4393. // Register variables to be Auto-Saved
  4394. // All variables must have a unique ID, less than 256, that never changes
  4395. REGISTER_VARIABLES()
  4396. {
  4397. SAVE_VARIABLE( already_entered, 1 );
  4398. }
  4399. void Created (GameObject * obj)
  4400. {
  4401. already_entered = true;
  4402. }
  4403. void Entered (GameObject * obj, GameObject * enterer)
  4404. {
  4405. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4406. {
  4407. already_entered = true;
  4408. // Commands->Send_Custom_Event (obj, Commands->Find_Object(101010), 100, 100, 0.0f);
  4409. // Block for Mendoza arena
  4410. GameObject *crate28 = Commands->Create_Object("X6_Rubble2", Vector3(-49.309f, 1.010f, -0.016f));
  4411. Commands->Set_Facing( crate28, 140.000f );
  4412. GameObject *crate29 = Commands->Create_Object("X6_Rubble2", Vector3(-50.727f, 0.514f, -0.020f));
  4413. Commands->Set_Facing( crate29, 5.000f );
  4414. GameObject *crate30 = Commands->Create_Object("X6_Rubble1", Vector3(-11.987f, 8.771f, 0.000f));
  4415. Commands->Set_Facing( crate30, 90.000f );
  4416. GameObject *crate1 = Commands->Create_Object("X6_Rubble5", Vector3(-6.280f, 9.196f, 0.000f));
  4417. Commands->Set_Facing( crate1, 50.000f );
  4418. GameObject *crate2 = Commands->Create_Object("X6_Rubble5", Vector3(-5.988f, 7.571f, -0.010f));
  4419. Commands->Set_Facing( crate2, 135.000f );
  4420. Vector3 havoc_loc = Commands->Get_Position (STAR);
  4421. havoc_loc.Z += 7.0f;
  4422. Commands->Set_Position (STAR, havoc_loc );
  4423. GameObject * sydney = Commands->Find_Object(101010);
  4424. Vector3 sydney_loc = Commands->Get_Position (sydney);
  4425. havoc_loc.Z += 7.0f;
  4426. Commands->Set_Position (sydney, sydney_loc );
  4427. GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  4428. Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X6C_MIDTRO.txt");
  4429. // Take key to the barracks away from Havoc so that Mendoza will not follow him in and get stuck
  4430. Commands->Grant_Key (STAR, 9, false);
  4431. }
  4432. }
  4433. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4434. {
  4435. if(type == M06_CUSTOM_ACTIVATE)
  4436. {
  4437. already_entered = false;
  4438. }
  4439. }
  4440. };
  4441. DECLARE_SCRIPT (M06_Clear_For_Mendoza, "")
  4442. {
  4443. bool open;
  4444. const char * anim;
  4445. void Created (GameObject * obj)
  4446. {
  4447. }
  4448. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  4449. {
  4450. if ( sound.Type == M06_CLEAR_FOR_MENDOZA )
  4451. {
  4452. Commands->Destroy_Object(obj);
  4453. }
  4454. }
  4455. };
  4456. DECLARE_SCRIPT(M06_DataDisc_01_DLS, "")//
  4457. {
  4458. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4459. {
  4460. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  4461. {
  4462. // Reveal Mutant Templar
  4463. bool reveal = Commands->Reveal_Encyclopedia_Character(28);
  4464. if ( reveal == 1 )
  4465. {
  4466. Commands->Display_Encyclopedia_Event_UI();
  4467. }
  4468. }
  4469. }
  4470. };
  4471. DECLARE_SCRIPT(M06_Enable_Alarm_Objective, "")
  4472. {
  4473. bool already_entered;
  4474. // Register variables to be Auto-Saved
  4475. // All variables must have a unique ID, less than 256, that never changes
  4476. REGISTER_VARIABLES()
  4477. {
  4478. SAVE_VARIABLE( already_entered, 1 );
  4479. }
  4480. void Created (GameObject * obj)
  4481. {
  4482. already_entered = false;
  4483. }
  4484. void Entered (GameObject * obj, GameObject * enterer)
  4485. {
  4486. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4487. {
  4488. already_entered = true;
  4489. // Warning: Nod Security Measures Detected.
  4490. const char *conv_name = ("M06_CON060");
  4491. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  4492. Commands->Join_Conversation(NULL, conv_id, false, true);
  4493. Commands->Start_Conversation (conv_id, 300609);
  4494. Commands->Monitor_Conversation (obj, conv_id);
  4495. }
  4496. }
  4497. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4498. {
  4499. if(action_id == 300609 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  4500. {
  4501. // Deactivate alarm system
  4502. Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 609, 3, 0.0f);
  4503. }
  4504. }
  4505. };