| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /******************************************************************************
- *
- * FILE
- * Mission06.cpp
- *
- * DESCRIPTION
- * Mission 6 script
- *
- * PROGRAMMER
- * David Shuman
- *
- * VERSION INFO
- * $Author: Darren_k $
- * $Revision: 136 $
- * $Modtime: 2/05/02 4:18p $
- * $Archive: /Commando/Code/Scripts/Mission06.cpp $
- *
- ******************************************************************************/
- #include "scripts.h"
- #include "toolkit.h"
- #include "mission6.h"
- #include <string.h>
- #include <stdio.h>
- // ************************* M06B
- // Objective Controller
- DECLARE_SCRIPT(M06_Objective_Controller, "") // 100018
- {
- int mendoza_id;
- bool accomplished_609;
- enum {HAVOCS_SCRIPT, M06_INITIAL_APACHES};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( mendoza_id, 1 );
- SAVE_VARIABLE( accomplished_609, 2 );
- }
- void Created(GameObject * obj)
- {
- // Background Music
- Commands->Set_Background_Music ("06-onyourfeet.mp3");
- // Scale their sight and hearing back
- // Commands->Scale_AI_Awareness(.5f, .5f );
- Commands->Start_Timer (obj, this, 1.0f, HAVOCS_SCRIPT);
- Commands->Enable_Hibernation(obj, false);
- mendoza_id = 0;
- accomplished_609 = false;
-
- // EVA - Give me a position on the scientists.\n
- const char *conv_name = ("M06_CON059");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300601);
- Commands->Monitor_Conversation (obj, conv_id);
- Add_An_Objective(605);
- Add_An_Objective(607);
- Add_An_Objective(608);
- // Add_An_Objective(609);
- // Add_An_Objective(610);
- Commands->Start_Timer (obj, this, 6.0f, M06_INITIAL_APACHES);
- }
- void Add_An_Objective(int id)
- {
- GameObject *object;
-
- switch (id)
- {
- // Hack War Room Computer
- case 601:
- {
- Commands->Add_Objective(601, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_02, NULL, IDS_Enc_Obj_Primary_M06_02);
- object = Commands->Find_Object(106952);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(601, object);
- Commands->Set_Objective_HUD_Info_Position(601, 90.0f, "POG_M06_1_03.tga", IDS_POG_HACK, Commands->Get_Position (object));
- }
- }
- break;
- // Rescue Scientists
- case 603:
- {
- Commands->Add_Objective(603, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_01, NULL, IDS_Enc_Obj_Primary_M06_01);
- object = Commands->Find_Object(101010);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(603, object);
- Commands->Set_Objective_HUD_Info_Position(603, 90.0f, "POG_M06_1_04.tga", IDS_POG_RESCUE, Commands->Get_Position (object));
- }
- }
- break;
- // Eliminate Mendoza
- case 604:
- {
- Commands->Add_Objective(604, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_04, NULL, IDS_Enc_Obj_Primary_M06_04);
- // object = Commands->Find_Object(mendoza_id);
- object = Commands->Find_Object(108275);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(604, object);
- Commands->Set_Objective_HUD_Info_Position(604, 90.0f, "POG_M06_1_01.tga", IDS_POG_ELIMINATE, Commands->Get_Position (object));
- }
- }
- break;
- // Rescue Resistance
- case 605:
- {
- Commands->Add_Objective(605, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_02, NULL, IDS_Enc_Obj_Hidden_M06_02);
- object = Commands->Find_Object(101016);
-
- }
- break;
- // Release GDI prisoner
- case 607:
- {
- Commands->Add_Objective(607, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_03, NULL, IDS_Enc_Obj_Hidden_M06_03);
- }
- break;
- // Plunder Raveshaw's hidden cache
- case 608:
- {
- Commands->Add_Objective(608, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, IDS_Enc_ObjTitle_Hidden_M06_04, NULL, IDS_Enc_Obj_Hidden_M06_04);
- }
- break;
- // Deactivate alarm system
- case 609:
- {
- Commands->Add_Objective(609, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M06_01, NULL, IDS_Enc_Obj_Hidden_M06_01);
- Vector3 star_pos = Commands->Get_Position(STAR);
- Vector3 greenhouse_alarm = Commands->Get_Position(Commands->Find_Object(101548));
- Vector3 shower_alarm = Commands->Get_Position(Commands->Find_Object(101549));
- float star_greenhouse = Commands->Get_Distance(star_pos, greenhouse_alarm);
- float star_shower = Commands->Get_Distance(star_pos, shower_alarm);
- if(star_greenhouse == (WWMath::Min(star_greenhouse, star_shower)))
- {
- object = Commands->Find_Object(101548);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(609, object);
- Commands->Set_Objective_HUD_Info_Position(609, 90.0f, "POG_M08_2_02.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
- }
- }
- else
- {
- object = Commands->Find_Object(101549);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(609, object);
- Commands->Set_Objective_HUD_Info_Position(609, 90.0f, "POG_M08_2_02.tga", IDS_POG_DISABLE, Commands->Get_Position (object));
- }
- }
-
- }
- break;
- // Alarm State: Stand Down
- case 610:
- {
- Commands->Add_Objective(610, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_HIDDEN, 1000, NULL);
- }
- break;
- // Escape Chateau with Dr. Sydney Mobius
- case 611:
- {
- Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1007I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
- Commands->Add_Objective(611, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M06_03, NULL, IDS_Enc_Obj_Primary_M06_03);
- object = Commands->Find_Object(101527);
- if(object)
- {
- Commands->Set_Objective_Radar_Blip_Object(611, object);
- Commands->Set_Objective_HUD_Info_Position(611, 90.0f, "POG_M06_1_05.tga", IDS_POG_ESCORT, Commands->Get_Position (object));
- }
- }
- break;
- }
- }
- void Custom(GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_MENDOZA_ID)
- {
- mendoza_id = param;
-
- }
- if(type == 666 && param == 666)
- {
-
- Commands->Start_Timer (obj, this, 2.0f, M06_DEAD_HAVOC);
- }
- if(type > 611)
- {
- return;
- }
- switch (param)
- {
- case 1:
- {
- if(type == 609 && accomplished_609)
- {
- return;
- }
- Commands->Clear_Radar_Marker (type);
- Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
- if(type == 604)
- {
- Commands->Mission_Complete ( true );
- }
- if(type == 609)
- {
- accomplished_609 = true;
- }
-
- }
- break;
- case 2:
- {
- Commands->Clear_Radar_Marker (type);
- Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
- if(type == 611)
- {
- Commands->Mission_Complete ( false );
- }
- }
- break;
- case 3:
- Add_An_Objective(type);
- break;
- case 4:
- Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
- break;
- case 5:
- Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_HIDDEN);
- break;
- }
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if(action_id == 300601 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
- {
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 601, 3, 0.0f);
- }
- }
-
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if(timer_id == HAVOCS_SCRIPT)
- {
- // Commands->Attach_Script(STAR, "M06_Havoc_DLS", "");
-
- }
- if(timer_id == M06_DEAD_HAVOC)
- {
-
- // Commands->Attach_Script(STAR, "M06_Havoc_DLS", "");
-
- }
- if(timer_id == M06_INITIAL_APACHES)
- {
-
- // Initial Apaches
- GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
- Commands->Attach_Script(controller1, "Test_Cinematic", "X6A_Apache_01.txt");
-
- GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
- Commands->Attach_Script(controller2, "Test_Cinematic", "X6A_Apache_02.txt");
-
- }
- }
- };
- // WarRoom Computer
- DECLARE_SCRIPT(M06_WarRoom_Computer, "")
- {
- bool already_poked;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_poked, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_poked = false;
- Commands->Enable_HUD_Pokable_Indicator( obj, true );
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- if (Commands->Is_A_Star(poker) && (!already_poked))
- {
- // Data decryption complete. Internal computer systems indicate Dr. Ignatio Mobius is located beneath the Chateau. Access is gained through the dining hall.\n
- const char *conv_name = ("M06_CON001");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, true, true);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300603);
- Commands->Monitor_Conversation (obj, conv_id);
- already_poked = true;
- Commands->Enable_HUD_Pokable_Indicator( obj, false );
- Commands->Create_Object ("Level_03_Keycard", Vector3 (35.263F, 16.432F, 13.382F));
-
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 300603 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
- {
- // New Primary Mission Objective: Evacuate Doctors' Ignatio and Sydney Mobius. Basement, NE section. Requires level 2 security keycard.
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 601, 1, 0.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 603, 3, 1.0f);
-
- }
- }
- };
- #define SYDNEY_MOVE_TABLE_SIZE ( sizeof(Sydney_Move_Table) / sizeof (Sydney_Move_Table[0]) )
- const int Sydney_Move_Table[] =
- {
- 101567,
- 101569,
- 101571,
- 101573,
- 101575,
- 101577,
- 101579,
- 101581,
- 101582,
- 101584,
- 101586,
- 101587,
- 101588
- };
- DECLARE_SCRIPT(M06_Sydney_Mobius, "")
- {
- int poke_id;
- bool dont_move;
- int current_move_loc;
-
- enum {CHECK_DISTANCE = 20, SYDNEY_MOVE_LOC, MOVE_LOC_LOW_PRIORITY};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( poke_id, 1 );
- SAVE_VARIABLE( dont_move, 2 );
- SAVE_VARIABLE( current_move_loc, 3 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- Commands->Grant_Key (obj, 3, true);
- poke_id = 4;
- dont_move = true;
-
- current_move_loc = 0;
-
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- ActionParamsStruct params;
- switch(poke_id)
- {
- case 1:
- {
- // \\Hold here. I'll be back.\n
- const char *conv_name = ("M06_CON002");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
-
- Commands->Set_Innate_Is_Stationary(obj, true);
- dont_move = true;
- poke_id = 2;
- }
- break;
- case 2:
- {
- // \\Let's keep moving.\n
- const char *conv_name = ("M06_CON003");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
- Commands->Set_Innate_Is_Stationary(obj, false);
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
- params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
- Commands->Action_Goto (obj, params);
-
- poke_id = 1;
- dont_move = false;
- }
- break;
- }
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_RELOCATE)
- {
- if(param == 0)
- {
- Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(107606)));
- // Relocate Havoc
- Commands->Send_Custom_Event(obj, STAR, M06_RELOCATE, 0, 0.0f);
- // Activate MidtroC zone
- Commands->Send_Custom_Event (obj, Commands->Find_Object(108285), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Move Sydney to initial move location
- Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
- dont_move = false;
- // Start the destruction stub sequence
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 100, 100, 2.0f);
- // Accomplish mission objective to rescue scientists
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 603, 1, 1.0f);
- // Mission objective to escort Sydney out of Chateau
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 611, 3, 2.0f);
- // Clost and lock door to lab
- // Door to the lab
- Commands->Static_Anim_Phys_Goto_Frame ( 1300001615, 0, "DOOR_0.DOOR_0");
-
- }
- if(param == 1)
- {
- Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108277)));
- // Relocate Havoc
- Commands->Send_Custom_Event(obj, STAR, M06_RELOCATE, 1, 0.0f);
- // Accomplish Mission Objective for Sydney Escort out of Chateau
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 611, 1, 1.0f);
- // Relocate Mendoza
- //Commands->Send_Custom_Event(obj, Commands->Find_Object(108275), M06_RELOCATE, 0, 0.0f);
-
- //
- // Play the boss music
- //
- // Commands->Set_Background_Music ("Mendoza_Battle1.mp3");
- //
- // Create and position Mendoza
- //
- GameObject *mendoza = Commands->Create_Object ("Mendoza Boss", Vector3 (-40.572F, 28.942F, 1.605F));
- if (mendoza != NULL) {
- Commands->Set_Facing (mendoza, -50.0F);
- }
- // GameObject *mendoza = Commands->Create_Object ("Nod_FlameThrower_3Boss", Vector3 (-40.572F, 28.942F, 1.605F));
- // if (mendoza != NULL) {
- // Commands->Set_Facing (mendoza, -50.0F);
- // Commands->Attach_Script(mendoza, "M06_Mendoza", "");
- // }
-
- // Mission objective to defeat Mendoza
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 604, 3, 0.0f);
- // Make Sydney indestructible
- Commands->Set_Shield_Strength (obj, 100 );
- Commands->Set_Shield_Type (obj, "Blamo");
- //
- // Create logical sound to remove all other players in fight with Mendoza
- //
- Commands->Create_Logical_Sound(obj, M06_CLEAR_FOR_MENDOZA, Commands->Get_Position(obj), 2500.0f);
-
- }
- }
- if(type == M06_MOVE_SYDNEY && !dont_move)
- {
- current_move_loc = param;
- if(current_move_loc == 12)
- {
- poke_id = 4;
- }
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
- params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
- Commands->Action_Goto (obj, params);
- }
-
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- // Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
-
- if(action_id == SYDNEY_MOVE_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
- }
- if((action_id == SYDNEY_MOVE_LOC) && (action_id != Commands->Get_Action_ID(obj)) && (!Commands->Is_Performing_Pathfind_Action(obj)) && (reason == ACTION_COMPLETE_LOW_PRIORITY))
- {
- Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == MOVE_LOC_LOW_PRIORITY)
- {
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), SYDNEY_MOVE_LOC);
- params.Set_Movement (Commands->Find_Object(Sydney_Move_Table[current_move_loc]), 1.0f, 3.0f);
- Commands->Action_Goto (obj, params);
- }
- if(timer_id == CHECK_DISTANCE)
- {
- Commands->Start_Timer (obj, this, 10.0f, CHECK_DISTANCE);
- }
- if(timer_id == CHECK_DISTANCE && poke_id == 2)
- {
- Vector3 star_pos = Commands->Get_Position(STAR);
- Vector3 sydney_pos = Commands->Get_Position(obj);
- float distance_to_star = Commands->Get_Distance(star_pos, sydney_pos);
- if(distance_to_star > 15.0f)
- {
- // Don't leave me here!\n
- const char *conv_name = ("M06_CON005");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
- }
-
- }
- else if(timer_id == CHECK_DISTANCE && poke_id == 1)
- {
- Vector3 star_pos = Commands->Get_Position(STAR);
- Vector3 sydney_pos = Commands->Get_Position(obj);
- float distance_to_star = Commands->Get_Distance(star_pos, sydney_pos);
- if(distance_to_star > 15.0f)
- {
- // Wait for me!\n
- const char *conv_name = ("M06_CON006");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1008I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 611, 2, 0.0f);
-
- }
-
- };
- 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")
- {
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_MIDTRO_EXPLOSION)
- {
- int explode_loc[5];
- explode_loc[0] = Get_Int_Parameter("Loc0_ID");
- explode_loc[1] = Get_Int_Parameter("Loc1_ID");
- explode_loc[2] = Get_Int_Parameter("Loc2_ID");
- explode_loc[3] = Get_Int_Parameter("Loc3_ID");
- explode_loc[4] = Get_Int_Parameter("Loc4_ID");
- Commands->Create_Explosion("Chateau_Explosions_Twiddler", Commands->Get_Position(Commands->Find_Object(explode_loc[param])));
- }
- }
- };
- DECLARE_SCRIPT(M06_Activate_Midtro, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- // Door to the lab
- Commands->Static_Anim_Phys_Goto_Frame ( 1300001615, 0, "DOOR_0.DOOR_0");
- // Raveshaw/Mendoza door
- Commands->Static_Anim_Phys_Goto_Frame ( 1553454, 0, "DOOR_0.DOOR_0");
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- // Open door to lab
- Commands->Static_Anim_Phys_Goto_Last_Frame ( 1300001615, "DOOR_0.DOOR_0" );
- // Open Raveshaw/Mendoza Door
- Commands->Static_Anim_Phys_Goto_Last_Frame ( 1553454, "DOOR_0.DOOR_0" );
- already_entered = true;
- // Commands->Send_Custom_Event (obj, Commands->Find_Object(101010), 100, 100, 0.0f);
- Vector3 havoc_loc = Commands->Get_Position (STAR);
- havoc_loc.Z += 7.0f;
- Commands->Set_Position (STAR, havoc_loc );
-
- GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X6B_MIDTRO.txt");
- // Grant armor increase medal
- Commands->Create_Object ( "POW_Medal_Health", Vector3(-1.472f, 31.216f, -9.000f));
- }
- }
- };
- DECLARE_SCRIPT(M06_Destruction_Stub, "")
- {
- enum {SHAKE_TIMER};
-
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == 100 && param == 100)
- {
- // Activate destruction zones
- Commands->Send_Custom_Event(obj, Commands->Find_Object(104312), M06_CHATEAU_COLLAPSE, 1, 0.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(105635), M06_CHATEAU_COLLAPSE, 1, 0.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(105639), M06_CHATEAU_COLLAPSE, 1, 0.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(105640), M06_CHATEAU_COLLAPSE, 1, 0.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(105641), M06_CHATEAU_COLLAPSE, 1, 0.0f);
- // Create destruction path blocks
- GameObject *crate1 = Commands->Create_Object("X6_Rubble1", Vector3(23.453f, 16.340f, -2.000f));
- Commands->Set_Facing( crate1, -65.000f );
- GameObject *crate2 = Commands->Create_Object("X6_Rubble2", Vector3(27.086f, 28.569f, -1.454f));
- Commands->Set_Facing( crate2, 0.000f );
-
- GameObject *crate3 = Commands->Create_Object("X6_Rubble2", Vector3(25.614f, 33.324f, -0.043f));
- Commands->Set_Facing( crate3, 125.000f );
- GameObject *crate4 = Commands->Create_Object("X6_Rubble3", Vector3(14.597f, -30.510f, -0.033f));
- Commands->Set_Facing( crate4, 140.000f );
- GameObject *crate5 = Commands->Create_Object("X6_Rubble4", Vector3(25.079f, 28.012f, -2.007f));
- Commands->Set_Facing( crate5, -60.000f );
- GameObject *crate6 = Commands->Create_Object("X6_Rubble4", Vector3(26.463f, 27.382f, -2.003f));
- Commands->Set_Facing( crate6, 0.000f );
- GameObject *crate7 = Commands->Create_Object("X6_Rubble4", Vector3(38.426f, 2.889f, 2.574f));
- Commands->Set_Facing( crate7, -35.000f );
- GameObject *crate8 = Commands->Create_Object("X6_Rubble4", Vector3(40.258f, 3.442f, 2.798f));
- Commands->Set_Facing( crate8, -180.000f );
-
- GameObject *crate9 = Commands->Create_Object("X6_Rubble4", Vector3(9.832f, -35.126f, -0.014f));
- Commands->Set_Facing( crate9, 5.000f );
- GameObject *crate10 = Commands->Create_Object("X6_Rubble4", Vector3(4.503f, -33.694f, 3.003f));
- Commands->Set_Facing( crate10, 150.000f );
- GameObject *crate11 = Commands->Create_Object("X6_Rubble4", Vector3(1.179f, -33.281f, -0.042f));
- Commands->Set_Facing( crate11, -160.000f );
- GameObject *crate12 = Commands->Create_Object("X6_Rubble4", Vector3(-5.442f, -28.292f, 0.003f));
- Commands->Set_Facing( crate12, -15.000f );
- GameObject *crate13 = Commands->Create_Object("X6_Rubble4", Vector3(-5.423f, -12.960f, 0.000f));
- Commands->Set_Facing( crate13, 110.000f );
- GameObject *crate14 = Commands->Create_Object("X6_Rubble5", Vector3(8.042f, 27.962f, -0.150f));
- Commands->Set_Facing( crate14, 150.000f );
- GameObject *crate15 = Commands->Create_Object("X6_Rubble5", Vector3(9.271f, 28.300f, -0.001f));
- Commands->Set_Facing( crate15, -5.000f );
- GameObject *crate16 = Commands->Create_Object("X6_Rubble5", Vector3(7.208f, 30.813f, 4.400f));
- Commands->Set_Facing( crate16, 142.684f );
- GameObject *crate17 = Commands->Create_Object("X6_Rubble5", Vector3(5.628f, 29.865f, -0.025f));
- Commands->Set_Facing( crate17, 115.000f );
- GameObject *crate18 = Commands->Create_Object("X6_Rubble5", Vector3(38.716f, 4.235f, 2.374f));
- Commands->Set_Facing( crate18, 50.000f );
- GameObject *crate19 = Commands->Create_Object("X6_Rubble5", Vector3(13.124f, -30.323f, 0.000f));
- Commands->Set_Facing( crate19, 5.000f );
- GameObject *crate20 = Commands->Create_Object("X6_Rubble5", Vector3(8.932f, -34.790f, -0.000f));
- Commands->Set_Facing( crate20, -0.000f );
- GameObject *crate21 = Commands->Create_Object("X6_Rubble5", Vector3(6.464f, -33.466f, 2.978f));
- Commands->Set_Facing( crate21, 0.000f );
- GameObject *crate22 = Commands->Create_Object("X6_Rubble5", Vector3(2.144f, -33.484f, 0.007f));
- Commands->Set_Facing( crate22, 0.000f );
- GameObject *crate23 = Commands->Create_Object("X6_Rubble5", Vector3(-5.275f, -27.057f, 0.000f));
- Commands->Set_Facing( crate23, 70.000f );
- GameObject *crate24 = Commands->Create_Object("X6_Rubble5", Vector3(-5.932f, -11.340f, 0.000f));
- Commands->Set_Facing( crate24, 25.000f );
- GameObject *crate25 = Commands->Create_Object("X6_Rubble5", Vector3(-4.760f, -1.653f, 0.000f));
- Commands->Set_Facing( crate25, 110.000f );
- GameObject *crate26 = Commands->Create_Object("X6_Rubble5", Vector3(-5.332f, -2.713f, 0.277f));
- Commands->Set_Facing( crate26, 0.000f );
- GameObject *crate27 = Commands->Create_Object("X6_Rubble5", Vector3(5.699f, -32.438f, 2.563f));
- Commands->Set_Facing( crate27, -120.000f );
-
- float shake_timer = Commands->Get_Random(0.0f, 3.0f);
- Commands->Start_Timer (obj, this, shake_timer, SHAKE_TIMER);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- // Shake the Chateau to simulate collapse
- if(timer_id == SHAKE_TIMER)
- {
-
-
-
- // Explosions near Star to simulate collapse
- // Vector3 star_pos = Commands->Get_Position(STAR);
- // Vector3 explode_loc;
- // explode_loc.X = star_pos.X + Commands->Get_Random(5.0f, 10.0f);
- // explode_loc.Y = star_pos.Y + Commands->Get_Random(5.0f, 10.0f);
- // explode_loc.Z = star_pos.Z; //+ Commands->Get_Random(5.0f, 10.0f);
- float distance = Commands->Get_Random(-12.0f, 12.0f);
- distance *= 3;
- Vector3 pos = Commands->Get_Position(STAR);
- float facing = Commands->Get_Facing(STAR);
- float a = cos(DEG_TO_RADF(facing)) * distance;
- float b = sin(DEG_TO_RADF(facing)) * distance;
- Vector3 explode_loc = pos + Vector3(a, b, 0.0f);
- Commands->Create_Explosion("Chateau_Explosions_Twiddler", explode_loc, obj);
- float shake_timer = Commands->Get_Random(1.0f, 5.0f);
- Commands->Start_Timer (obj, this, Commands->Get_Random(2.0f, 8.0f), SHAKE_TIMER);
- // Shake the Chateau to simulate collapse
- float camera_intensity = Commands->Get_Random(.01f,.09f);
- float camera_duration = shake_timer - 1.0f;
- Commands->Shake_Camera(Vector3 (-12.0f, 40.0f, -9.0f), 1000.0f, camera_intensity, camera_duration);
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Mendoza, "")
- {
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 604, 1, 0.0f);
-
- }
- };
- DECLARE_SCRIPT(M06_GDI_Prisoner, "")
- {
- bool conversation;
- bool poked;
-
- enum{ESCAPE_CHATEAU};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( conversation, 1 );
- SAVE_VARIABLE( poked, 2 );
- }
- void Created (GameObject * obj)
- {
- conversation = false;
- poked = false;
- Commands->Set_Innate_Is_Stationary(obj, true);
- Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
- Commands->Enable_HUD_Pokable_Indicator( obj, true );
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- if ((Commands->Is_A_Star(poker)) && (!conversation) && (!poked))
- {
- // Thank for the release. I've got a Nod officer I've got to hunt down.\n
- const char *conv_name = ("M06_CON008");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(poker, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300607);
- Commands->Monitor_Conversation (obj, conv_id);
- conversation = true;
- poked = true;
- Commands->Enable_HUD_Pokable_Indicator( obj, false );
- Commands->Grant_Key (STAR, 3, true);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
-
- if(action_id == 300607 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- conversation = false;
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 607, 1, 0.5f);
- Commands->Set_Innate_Is_Stationary(obj, false);
- Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
- Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
- Commands->Select_Weapon(obj, "Weapon_Chaingun_Ai" );
- Commands->Grant_Key (obj, 1, true);
- Commands->Grant_Key (obj, 2, true);
- Commands->Grant_Key (obj, 3, true);
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
- params.Set_Movement (Commands->Find_Object(104967), RUN, 3.0f);
- Commands->Action_Goto (obj, params);
- Commands->Start_Timer (obj, this, 10.0f, ESCAPE_CHATEAU);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == ESCAPE_CHATEAU)
- {
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
- params.Set_Movement (Commands->Find_Object(104967), RUN, 3.0f);
- Commands->Action_Goto (obj, params);
-
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Activate_Secret_Door, "Secret_Door_ID=0:int")
- {
- bool already_poked;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_poked, 1 );
-
- }
- void Created(GameObject * obj)
- {
- already_poked = false;
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- if (Commands->Is_A_Star(poker) && (!already_poked))
- {
- already_poked = true;
-
-
- // Looks like Raveshaw's private stash. Time for a five-finger discount.\n
- const char *conv_name = ("M06_CON061");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300608);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 300608 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- Commands->Static_Anim_Phys_Goto_Last_Frame ( Get_Int_Parameter("Secret_Door_ID"), "BK.BK" );
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 608, 1, 0.0f);
- }
- }
- };
- DECLARE_SCRIPT(M06_Civ_Prisoner, "")
- {
-
- int poke_id;
- bool conversation;
-
- enum{WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( poke_id, 1 );
- SAVE_VARIABLE( conversation, 2 );
- }
- void Created(GameObject * obj)
- {
- Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
- Commands->Set_Innate_Is_Stationary(obj, true);
- poke_id = 1;
- conversation = false;
- Commands->Enable_HUD_Pokable_Indicator( obj, true );
- }
-
- void Poked(GameObject * obj, GameObject * poker)
- {
- if(conversation)
- {
- return;
- }
- ActionParamsStruct params;
- switch(poke_id)
- {
- case 1:
- {
- conversation = true;
- // I am in your debt.\n
- const char *conv_name = ("M06_CON009");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300123);
- Commands->Monitor_Conversation (obj, conv_id);
-
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing)) * 1.5;
- float b = sin(DEG_TO_RADF(facing)) * 1.5;
- Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
- Commands->Create_Object("POW_Health_100", powerup_loc);
- Commands->Enable_HUD_Pokable_Indicator( obj, false );
- }
- break;
- case 2:
- {
- conversation = true;
- // I must rest.
- const char *conv_name = ("M06_CON063");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300124);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- break;
-
- }
- }
-
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED)
- {
- conversation = false;
- }
- if(action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 605, 1, 0.0f);
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
- params.WaypathID = 101552;
- Commands->Action_Goto( obj, params );
-
- Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
- Commands->Set_Innate_Is_Stationary(obj, false);
-
- }
-
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 12 );
- params.Set_Animation ("S_A_HUMAN.h_a_b0c0", true);
- Commands->Action_Play_Animation (obj, params);
- poke_id = 2;
- conversation = false;
- }
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- // Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 605, 2, 0.0f);
- }
- };
- DECLARE_SCRIPT(M06_Enable_Guard_Tower, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- // Warning: Nod Security Measures Detected.\n
- // const char *conv_name = ("M06_CON010");
- // int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- // Commands->Join_Conversation(NULL, conv_id, true, true);
- // Commands->Join_Conversation(STAR, conv_id, true, true);
- // Commands->Start_Conversation (conv_id, 300606);
- // Commands->Monitor_Conversation (obj, conv_id);
-
- // Patrols
- Commands->Enable_Spawner(101046, true);
- Commands->Enable_Spawner(101053, true);
- // Engineer
- Commands->Enable_Spawner(101054, true);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 300606 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 610, 1, 0.0f);
- }
- }
- };
- DECLARE_SCRIPT(M06_Gate_Guards, "Soldier_ID=0:int")
- {
-
- int soldier_id;
- bool disable_tower_spawn;
-
- enum {M06_GATE_GUARD_WAYPATH = 105, WAYPATH, CONVERSATION};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( disable_tower_spawn, 1 );
- }
- void Created (GameObject * obj)
- {
- soldier_id = Get_Int_Parameter("Soldier_ID");
- Commands->Set_Innate_Is_Stationary(obj, true);
- Commands->Innate_Soldier_Enable_Footsteps_Heard( obj, false );
- disable_tower_spawn = false;
- Commands->Start_Timer(obj, this, 15.0f, CONVERSATION);
- Commands->Send_Custom_Event (obj, obj, M06_GATE_GUARD_WAYPATH, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(110908), M06_GATE_GUARD_WAYPATH, 1, 0.0f);
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- Commands->Debug_Message("Action_Complete on Gate Guard. action_id %d reason %d.\n", action_id, reason);
- if(action_id == 1109081 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
-
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Custom(GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
-
- if(type == M06_GATE_GUARD_WAYPATH)
- {
-
- Commands->Set_Innate_Is_Stationary(obj, false);
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = 101023;
- params.WaypointStartID = 101024;
- params.WaypointEndID = 101027;
- params.WaypathSplined = true;
- Commands->Action_Goto( obj, params );
- }
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_DISABLE_TOWER_SPAWN )
- {
- disable_tower_spawn = true;
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- Commands->Set_Innate_Is_Stationary(obj, false);
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = 101023;
- params.WaypointStartID = 101024;
- params.WaypointEndID = 101027;
- Commands->Action_Goto( obj, params );
- }
- if(timer_id == CONVERSATION)
- {
- switch(soldier_id)
- {
- case 1:
- {
- if(Commands->Find_Object(101021))
- {
- // The new security protocols are tight.\n
- const char *conv_name = ("M06_CON011");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5, 15.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(110908), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1109081);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- break;
- }
- }
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if(Commands->Find_Object(101037) && (!disable_tower_spawn)) // Officer in tower
- {
- /* const char * conv_name[6];
- conv_name[0] = ("M06_CON012"); // This is Tower, What's your situation brother?\n
- conv_name[1] = ("M06_CON013"); // This is Tower, please respond.\n
- conv_name[2] = ("M06_CON014"); // This is Tower, I'm sending a recon to your position.\n
- conv_name[3] = ("M06_CON015"); // This is Tower. Hold position brother, reinforcements enroute.\n
- conv_name[4] = ("M06_CON016"); // This is Tower, report in.\n
- conv_name[5] = ("M06_CON017"); // This is Tower. We've a possible man down, Bravo patrol inspect.\n
-
- int random = Get_Int_Random(0, 5);
- int conv_id = Commands->Create_Conversation (conv_name[random]);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);*/
- switch(soldier_id)
- {
- case 1:
- {
- // Commands->Enable_Spawner(101035, true);
- }
- break;
- case 2:
- {
- // Commands->Enable_Spawner(101036, true);
- }
- break;
- }
- }
- }
-
- };
- DECLARE_SCRIPT(M06_Escort_Tank, "")
- {
- bool attacking;
- enum {ARRIVE_COURTYARD, START_ESCORT};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( attacking, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Start_Timer (obj, this, 1.5f, START_ESCORT);
- // Commands->Enable_Enemy_Seen(obj, true);
- Commands->Enable_Hibernation(obj, false);
- attacking = false;
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if(timer_id == START_ESCORT)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ARRIVE_COURTYARD );
- params.Set_Movement( Vector3(0,0,0), 0.8f, 1.5f );
- params.WaypathID = 102252;
- // params.WaypathSplined = true;
- Commands->Action_Goto( obj, params );
- }
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- Commands->Debug_Message("Action Complete on Escort Tank. action_id %d reason %d.\n", action_id, reason);
- if(action_id == ARRIVE_COURTYARD && reason == ACTION_COMPLETE_NORMAL)
- {
- Commands->Enable_Engine(obj, false);
- Commands->Enable_Hibernation(obj, true);
- }
-
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- if(!attacking)
- {
- Commands->Enable_Hibernation(obj, true);
- Commands->Enable_Engine(obj, true);
- attacking = true;
- Commands->Attach_Script(obj, "M08_Mobile_Vehicle", "111422, 111423, 111424, 111425, 111426, 111427, 111428, 111429, 111430, 111431");
- }
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- ActionParamsStruct params;
-
- if(damager == STAR)
- {
- if(!attacking)
- {
- Commands->Enable_Hibernation(obj, true);
- Commands->Enable_Engine(obj, true);
- attacking = true;
- Commands->Attach_Script(obj, "M08_Mobile_Vehicle", "111422, 111423, 111424, 111425, 111426, 111427, 111428, 111429, 111430, 111431");
- }
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
-
- }
-
- };
- DECLARE_SCRIPT(M06_Alarm_Controller, "")
- {
- bool alarm_sounded;
- bool triggered;
- bool stand_down;
- bool alarmed;
- enum {STAND_DOWN};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( alarm_sounded, 1 );
- SAVE_VARIABLE( triggered, 2 );
- SAVE_VARIABLE( stand_down, 3 );
- SAVE_VARIABLE( alarmed, 4 );
- }
- void Created (GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- alarm_sounded = false;
- triggered = false;
- stand_down = false;
- alarmed = false;
- Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- Vector3 sender_pos = Commands->Get_Position(sender);
- 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 );
- ActionParamsStruct params;
- if(type == M06_ALARMED) // Send custom to new spawns status of alarm
- {
- Commands->Send_Custom_Event (obj, sender, M06_ALARMED, alarm_sounded, 0.0f);
- }
- if((type == M06_STAND_DOWN)) // && (alarm_sounded) && !stand_down)
- {
- stand_down = true;
- Commands->Start_Timer (obj, this, 0.0f, STAND_DOWN);
- }
- if((type == M06_SOUND_ALARM) && (!alarm_sounded))
- {
- alarm_sounded = true;
- Commands->Create_Sound ( "M06_Alarm", Vector3 (0,0,0), obj);
- Commands->Create_Logical_Sound(obj, M06_SOUND_ALARM_ON, Vector3 (0,0,0), 2500.0f);
- // Commands->Monitor_Sound (obj, alarm_sound);
- Spawn_Response (true);
- Alarm_Trigger_Zones (obj, true);
-
-
- }
-
- if((type == M00_CUSTOM_CAMERA_ALARM) && (!alarm_sounded))
- {
- alarm_sounded = true;
- Commands->Create_Sound ( "M06_Alarm", Vector3 (0,0,0), obj);
- // Commands->Monitor_Sound (obj, alarm_sound);
- Spawn_Response (true);
- Alarm_Trigger_Zones (obj, true);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if(action_id == 300609 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- alarmed = true;
- // Deactivate alarm system
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 609, 3, 0.0f);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if((timer_id == STAND_DOWN)) // && (alarm_sounded) && (alarmed))
- {
- if(alarm_sounded)
- {
- // Stand down general alarm. Intruder alert canceled.\n
- const char *conv_name = ("M06_CON018");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0.0f,0.0f,0.0f)), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300000);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- // Stand down spawn units
- Spawn_Response (false);
- Alarm_Trigger_Zones (obj, false);
- // alarm_sounded = false commented out to simulate shut down of alarm system
- // alarm_sounded = false;
- Commands->Create_Logical_Sound(obj, M06_SOUND_ALARM_OFF, Vector3 (0,0,0), 2500.0f);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 609, 1, 0.0f);
- alarm_sounded = true;
- // Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 610, 1, 0.0f);
-
- }
-
-
- }
- void Alarm_Trigger_Zones (GameObject * obj, bool alarm)
- {
-
-
-
- }
- void Spawn_Response (bool alarm)
- {
-
- }
- };
- DECLARE_SCRIPT(M06_Alarm_Behavior, "Alarm_Enemy_Seen=0.0:float, Alarm_Damaged=0.0:float")
- {
- int alarm_switch_id[8];
- int alarm_switch_amnt;
- int closest_id;
- bool sound_alarm;
- bool alarmed;
- float alarm_enemy_seen;
- float alarm_damaged;
- bool hear_footsteps;
- int havoc_id;
- bool attacking_havoc;
-
- enum {HEAR_FOOTSTEPS};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( closest_id, 1 );
- SAVE_VARIABLE( sound_alarm, 2 );
- SAVE_VARIABLE( alarmed, 3 );
- SAVE_VARIABLE( hear_footsteps, 4 );
- SAVE_VARIABLE( havoc_id, 5 );
- SAVE_VARIABLE( attacking_havoc, 6 );
- }
- void Created(GameObject * obj)
- {
-
- // No starting units can hear footsteps until otherwise alerted
- Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
- hear_footsteps = false;
- alarm_enemy_seen = Get_Float_Parameter("Alarm_Enemy_Seen");
- alarm_damaged = Get_Float_Parameter("Alarm_Damaged");
- int difficulty = Commands->Get_Difficulty_Level();
- alarm_enemy_seen *= difficulty + 1;
- alarm_damaged *= difficulty + 1;
- closest_id = 0;
- alarm_switch_amnt = 8;
- sound_alarm = false;
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_ALARMED, 1, 0.2f);
- alarmed = false;
- havoc_id = 0;
- attacking_havoc = false;
- // Hardcode all alarm switch IDs
- alarm_switch_id[0] = 100157;
- alarm_switch_id[1] = 100330;
- alarm_switch_id[2] = 100423;
- alarm_switch_id[3] = 100445;
- alarm_switch_id[4] = 101003;
- alarm_switch_id[5] = 101004;
- alarm_switch_id[6] = 101005;
- alarm_switch_id[7] = 101006;
- }
- int Nearest (GameObject * obj) // Get nearest alarm switch to soldier
- {
- Vector3 alarm_pos;
- Vector3 soldier_pos = Commands->Get_Position(obj);
- float this_distance = 0.0f;
- float closest_distance = 0.0f;
-
- int i = 0;
- while (i < alarm_switch_amnt)
- {
-
-
- if(Commands->Find_Object(alarm_switch_id[i]))
- {
- alarm_pos = Commands->Get_Position(Commands->Find_Object(alarm_switch_id[i]));
-
- this_distance = Commands->Get_Distance(soldier_pos, alarm_pos);
-
-
- if(closest_distance == 0.0f)
- {
- closest_distance = this_distance;
-
- }
- if(WWMath::Min(this_distance, closest_distance) == this_distance)
- {
- closest_distance = this_distance;
- closest_id = alarm_switch_id[i];
-
- }
- }
- i++;
- }
-
- return closest_id;
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 10 && reason == ACTION_COMPLETE_NORMAL && !alarmed)
- {
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 11);
- params.Set_Face_Location( alarm_pos, 1.5f);
- Commands->Action_Face_Location ( obj, params );
- Commands->Send_Custom_Event (obj, Commands->Find_Object(closest_id), M06_CHECK_ALARM, Commands->Get_ID(obj), 0.0f);
-
- }
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
-
- if(type == M06_ALARMED) // Custom returned from alarm controller for new spawns to set alarmed status
- {
- alarmed = (param == 1) ? true : false;
- }
- if(type == M06_CHECK_ALARM && !alarmed)
- {
-
- if(param == 1)
- {
- // The alarm switch is destroyed, we need engineering!\n
- const char *conv_name = ("M06_CON019");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
-
- int i = 0;
- int curr_alarm_switch_id = Commands->Get_ID(sender);
- while (i < alarm_switch_amnt)
- {
- if(curr_alarm_switch_id == alarm_switch_id[i])
- {
- alarm_switch_id[i] = 0;
- }
- i++;
- }
- // Go to another alarm box
- closest_id = Nearest(obj);
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( alarm_pos, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- else
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 12 );
- params.Set_Animation ("S_A_HUMAN.H_A_A0F0", false);
- Commands->Action_Play_Animation (obj, params);
- // Send custom to sound alarm
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_SOUND_ALARM, 1, 0.0f);
- // Once alarm has been sounded
-
- }
- }
- if(type == M06_YOU_ATTACK_HAVOC)
- {
- Commands->Debug_Message("Soldier got M06_YOU_ATTACK_HAVOC custom, attacking STAR.\n");
- attacking_havoc = true;
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 1);
- params.Set_Attack (STAR, 50.0f, 0.0f, 1);
- Commands->Action_Attack (obj, params);
- }
-
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
-
- if ( sound.Type == M06_SOUND_ALARM_ON )
- {
- alarmed = true;
- sound_alarm = false;
- Vector3 pos = Commands->Get_Position(obj);
- Commands->Innate_Force_State_Gunshots_Heard(obj, pos);
-
- }
- if ( sound.Type == M06_SOUND_ALARM_OFF )
- {
- alarmed = false;
- attacking_havoc = false;
- Commands->Action_Reset ( obj, 100 );
- }
- if ( sound.Type == M06_ATTACK_HAVOC_SOUND )
- {
-
- havoc_id = Commands->Get_ID(sound.Creator);
- // Let Havoc know this soldier is coming to attack
- Commands->Send_Custom_Event (obj, Commands->Find_Object(havoc_id), M06_ATTACK_HAVOC, 1, 0.0f);
- }
- if (((sound.Type == SOUND_TYPE_GUNSHOT) || (sound.Type == SOUND_TYPE_BULLET_HIT)) && (!hear_footsteps))
- {
- hear_footsteps = true;
- Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
- Commands->Start_Timer (obj, this, 60.0f, HEAR_FOOTSTEPS);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if(timer_id == HEAR_FOOTSTEPS)
- {
- hear_footsteps = false;
- Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
-
- }
-
- }
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- ActionParamsStruct params;
- if(Commands->Get_Random(0.0f, 1.0f) <= alarm_damaged)
- {
- if((!sound_alarm) && (!alarmed) && (obj))
- {
- sound_alarm = true;
- // Sound the alarm!\n
- const char *conv_name = ("M06_CON020");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- closest_id = Nearest(obj);
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( alarm_pos, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- ActionParamsStruct params;
- if(Commands->Get_Random(0.0f, 1.0f) <= alarm_enemy_seen)
- {
- if((!sound_alarm) && (!alarmed))
- {
- sound_alarm = true;
- // Sound the alarm!\n
- const char *conv_name = ("M06_CON020");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- closest_id = Nearest(obj);
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(closest_id));
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( alarm_pos, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if(attacking_havoc)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(havoc_id), M06_DEAD_HAVOC_ATTACKER, 1, 0.0f);
- }
- }
- };
- DECLARE_SCRIPT(M06_Alarm_Switch, "")
- {
- bool destroyed;
-
- enum{DAMAGE_ALARM};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( destroyed, 1 );
- }
- void Created(GameObject * obj)
- {
- Vector3 alarm_pos = Commands->Get_Position(obj);
- 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 );
- Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 0);
- destroyed = false;
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CHECK_ALARM)
- {
- Commands->Send_Custom_Event (obj, sender, M06_CHECK_ALARM, destroyed, 0.0f);
- }
-
- }
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- if(Commands->Get_Health(obj) > 1.0f)
- {
- Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 0);
- }
- else
- {
- Commands->Set_Health(obj, 1.0f);
- if(!destroyed)
- {
- destroyed = true;
- Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 60);
-
- }
- else
- {
- Commands->Set_Animation_Frame(obj, "dsp_doorswitch2.dsp_doorswitch2", 60);
- }
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Alarm_Terminal_DLS, "")
- {
- bool poked;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( poked, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Animation_Frame(obj, "mct_nod.mct_nod", 0);
- Commands->Enable_HUD_Pokable_Indicator( obj, true );
- poked = false;
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- if (Commands->Is_A_Star(poker))
- {
- poked = true;
- Commands->Enable_HUD_Pokable_Indicator( obj, false );
- // Custom to alarm controller to stand down
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STAND_DOWN, 1, 0.0f);
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if(!poked)
- {
- // Custom to alarm controller to stand down
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STAND_DOWN, 1, 0.0f);
- }
- Vector3 myPositon = Commands->Get_Position ( obj );
- float myFacing = Commands->Get_Facing ( obj );
-
- GameObject * destroyedMCT = Commands->Create_Object ( "Nod_MCT_Alarm_Destroyed", myPositon);
- Commands->Set_Facing ( destroyedMCT, myFacing );
- }
- };
- DECLARE_SCRIPT(M06_Tower_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
- {
- int waypath_id;
- Vector3 waypath_loc;
- bool disable_tower_spawn;
- bool chateau_destruction;
-
- enum {WAYPATH, GO_WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( waypath_id, 1 );
- // SAVE_VARIABLE( waypath_loc, 2 );
- SAVE_VARIABLE( disable_tower_spawn, 1 );
- SAVE_VARIABLE( chateau_destruction, 2 );
- }
- void Created (GameObject * obj)
- {
- waypath_id = Get_Int_Parameter("Waypath_ID");
- waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- disable_tower_spawn = false;
- chateau_destruction = false;
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = waypath_id;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_DISABLE_TOWER_SPAWN )
- {
- disable_tower_spawn = true;
- }
- if ( sound.Type == M06_CHATEAU_DESTRUCTION )
- {
- chateau_destruction = true;
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if(Commands->Find_Object(101037) && (!disable_tower_spawn) && (!chateau_destruction)) // Officer in tower
- {
- const char * conv_name[6];
- conv_name[0] = ("M06_CON012"); // This is Tower, What's your situation brother?\n
- conv_name[1] = ("M06_CON013"); // This is Tower, please respond.\n
- conv_name[2] = ("M06_CON014"); // This is Tower, I'm sending a recon to your position.\n
- conv_name[3] = ("M06_CON015"); // This is Tower. Hold position brother, reinforcements enroute.\n
- conv_name[4] = ("M06_CON016"); // This is Tower, report in.\n
- conv_name[5] = ("M06_CON017"); // This is Tower. We've a possible man down, Bravo patrol inspect.\n
-
- int random = Get_Int_Random(0, 10);
- if(random < 6)
- {
- int conv_id = Commands->Create_Conversation (conv_name[random]);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Courtyard_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
- {
- int waypath_id;
- Vector3 waypath_loc;
- bool disable_courtyard_spawn;
- bool chateau_destruction;
-
-
- enum {WAYPATH, GO_WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( waypath_id, 1 );
- // SAVE_VARIABLE( waypath_loc, 2 );
- SAVE_VARIABLE( disable_courtyard_spawn, 1 );
- SAVE_VARIABLE( chateau_destruction, 2 );
- }
- void Created (GameObject * obj)
- {
- waypath_id = Get_Int_Parameter("Waypath_ID");
- waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- disable_courtyard_spawn = false;
- chateau_destruction = false;
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = waypath_id;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_DISABLE_COURTYARD_SPAWN )
- {
- disable_courtyard_spawn = true;
- }
- if ( sound.Type == M06_CHATEAU_DESTRUCTION )
- {
- chateau_destruction = true;
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if((!disable_courtyard_spawn) && (!chateau_destruction))
- {
- const char * conv_name[5];
- conv_name[0] = ("M06_CON021"); // This is Courtyard, report in.\n
- conv_name[1] = ("M06_CON022"); // Courtyard here. Squad enroute.\n
- conv_name[2] = ("M06_CON023"); // This is Courtyard, get me a response team.\n
- conv_name[3] = ("M06_CON024"); // Courtyard here. What's the situation brothers?\n
- conv_name[4] = ("M06_CON025"); // Courtyard here. Intruder response to your location.\n
-
- int random = Get_Int_Random(0, 10);
- if(random < 5)
- {
- int conv_id = Commands->Create_Conversation (conv_name[random]);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Hedgemaze_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
- {
- int waypath_id;
- Vector3 waypath_loc;
- bool disable_hedgemaze_spawn;
- bool chateau_destruction;
-
-
- enum {WAYPATH, GO_WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( waypath_id, 1 );
- // SAVE_VARIABLE( waypath_loc, 2 );
- SAVE_VARIABLE( disable_hedgemaze_spawn, 1 );
- SAVE_VARIABLE( chateau_destruction, 2 );
- }
- void Created (GameObject * obj)
- {
- waypath_id = Get_Int_Parameter("Waypath_ID");
- waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- disable_hedgemaze_spawn = false;
- chateau_destruction = false;
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = waypath_id;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_DISABLE_HEDGEMAZE_SPAWN )
- {
- disable_hedgemaze_spawn = true;
- }
- if ( sound.Type == M06_CHATEAU_DESTRUCTION )
- {
- chateau_destruction = true;
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if((!disable_hedgemaze_spawn) && (!chateau_destruction))
- {
- const char * conv_name[4];
- conv_name[0] = ("M06_CON026"); // This is Hedge Maze, Please respond.\n
- conv_name[1] = ("M06_CON027"); // This is Hedge Maze. Get a patrol to that position.\n
- conv_name[2] = ("M06_CON028"); // Hedge Maze here, report in please.\n
- conv_name[3] = ("M06_CON029"); // Hedge Maze here, please respond.\n
-
- int random = Get_Int_Random(0, 10);
- if(random < 4)
- {
- int conv_id = Commands->Create_Conversation (conv_name[random]);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Interior_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
- {
- int waypath_id;
- Vector3 waypath_loc;
-
-
- enum {WAYPATH, GO_WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( waypath_id, 1 );
- SAVE_VARIABLE( waypath_loc, 2 );
- }
- void Created (GameObject * obj)
- {
- waypath_id = Get_Int_Parameter("Waypath_ID");
- waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = waypath_id;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101309), M06_DEAD_INTERIOR_PATROL, 1, 0.0f);
- }
- };
- DECLARE_SCRIPT(M06_Lab_Patrol, "Waypath_ID=0:int, Waypath_Loc:Vector3")
- {
- int waypath_id;
- Vector3 waypath_loc;
-
-
- enum {WAYPATH, GO_WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( waypath_id, 1 );
- // SAVE_VARIABLE( waypath_loc, 2 );
- }
- void Created (GameObject * obj)
- {
- waypath_id = Get_Int_Parameter("Waypath_ID");
- waypath_loc = Get_Vector3_Parameter("Waypath_Loc");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = waypath_id;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == GO_WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer(obj, this, 60.0f, WAYPATH);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == WAYPATH)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, GO_WAYPATH );
- params.Set_Movement( waypath_loc, WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- };
- DECLARE_SCRIPT(M06_Barracks_Patrol, "")
- {
- bool disable_barracks_spawn;
- int barracks_drop[5];
- int barracks_pickup[6];
- bool chateau_destruction;
-
- enum {WAYPATH, PICKUP, DROP};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( disable_barracks_spawn, 1 );
- SAVE_VARIABLE( chateau_destruction, 2 );
- }
-
- void Created (GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- ActionParamsStruct params;
- barracks_drop[0] = 101534;
- barracks_drop[1] = 101535;
- barracks_drop[2] = 101536;
- barracks_drop[3] = 101537;
- barracks_drop[4] = 101538;
- barracks_pickup[0] = 101539;
- barracks_pickup[1] = 101540;
- barracks_pickup[2] = 101541;
- barracks_pickup[3] = 101542;
- barracks_pickup[4] = 101543;
- barracks_pickup[5] = 101544;
- int random = Get_Int_Random(0, 5);
- params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
- params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- disable_barracks_spawn = false;
- chateau_destruction = false;
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
-
- if ( sound.Type == M06_DISABLE_BARRACKS_SPAWN )
- {
- disable_barracks_spawn = true;
- }
- if ( sound.Type == M06_CHATEAU_DESTRUCTION )
- {
- chateau_destruction = true;
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
-
- if(action_id == PICKUP && reason == ACTION_COMPLETE_NORMAL)
- {
- Commands->Enable_Hibernation(obj, true);
- int random = Get_Int_Random(0, 4);
- params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), DROP);
- params.Set_Movement (Commands->Find_Object(barracks_drop[random]), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
- if(action_id == PICKUP && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer (obj, this, 20.0f, PICKUP);
- }
- if(action_id == DROP && reason == ACTION_COMPLETE_NORMAL)
- {
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing)) * 1.5;
- float b = sin(DEG_TO_RADF(facing)) * 1.5;
- Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
- Commands->Create_Object("M06_Barracks_Powerups_Twiddler", powerup_loc);
- int random = Get_Int_Random(0, 5);
- params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
- params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
- if(action_id == DROP && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Start_Timer (obj, this, 20.0f, PICKUP);
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- Commands->Destroy_Object(obj);
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == PICKUP)
- {
- int random = Get_Int_Random(0, 5);
- params.Set_Basic (this, (INNATE_PRIORITY_GUNSHOT_HEARD - 5), PICKUP);
- params.Set_Movement (Commands->Find_Object(barracks_pickup[random]), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- if((!disable_barracks_spawn) && (!chateau_destruction))
- {
- const char * conv_name[5];
- conv_name[0] = ("M06_CON030"); // This is Barracks, what's going on?\n
- conv_name[1] = ("M06_CON031"); // Barracks here, what's your status?\n
- conv_name[2] = ("M06_CON032"); // Barracks here. Alpha team to last known location.\n
- conv_name[3] = ("M06_CON033"); // Barracks here, report in brothers.\n
- conv_name[4] = ("M06_CON034"); // This is Barracks. You there, please respond.\n
-
- int random = Get_Int_Random(0, 10);
- if(random < 5)
- {
- int conv_id = Commands->Create_Conversation (conv_name[random]);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Lab_Guard, "")
- {
-
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
-
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- Commands->Set_Innate_Is_Stationary(obj, false);
- }
- };
- DECLARE_SCRIPT(M06_Nod_Tower, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( waypath_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- // Disable reinforcement spawners
- Commands->Enable_Spawner(101035, false);
- Commands->Enable_Spawner(101036, false);
- Commands->Enable_Spawner(101046, false);
- Commands->Enable_Spawner(101053, false);
- }
- };
- DECLARE_SCRIPT(M06_Courtyard_Controller, "")
- {
- int dead_courtyard_eagle;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( dead_courtyard_eagle, 1 );
- }
- void Created(GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- dead_courtyard_eagle = 0;
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_DEAD_COURTYARD_EAGLE)
- {
- dead_courtyard_eagle++;
- if(dead_courtyard_eagle == 3)
- {
- Commands->Enable_Spawner(101063, false);
- Commands->Enable_Spawner(101064, false);
- Commands->Enable_Spawner(101073, false);
- Commands->Enable_Spawner(101082, false);
- Commands->Enable_Spawner(101095, false);
- Commands->Create_Logical_Sound(obj, M06_DISABLE_COURTYARD_SPAWN, Vector3 (0,0,0), 2500.0f);
- // Create Search Apche in Courtyard
- // GameObject * search_apache = Commands->Create_Object ( "Nod_Apache", Vector3(-99.996f, -135.659f, 37.552f));
- // Commands->Attach_Script(search_apache, "M06_Courtyard_Apache", "");
- }
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Hedgemaze_Controller, "")
- {
- int dead_hedgemaze_eagle;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( dead_hedgemaze_eagle, 1 );
- }
- void Created(GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- dead_hedgemaze_eagle = 0;
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_DEAD_HEDGEMAZE_EAGLE)
- {
- dead_hedgemaze_eagle++;
- if(dead_hedgemaze_eagle == 2)
- {
- Commands->Enable_Spawner(101143, false);
- Commands->Enable_Spawner(101144, false);
- Commands->Enable_Spawner(101145, false);
- Commands->Enable_Spawner(101146, false);
- Commands->Create_Logical_Sound(obj, M06_DISABLE_HEDGEMAZE_SPAWN, Vector3 (0,0,0), 2500.0f);
- }
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Barracks_Controller, "")
- {
- int dead_barracks_eagle;
- int evac_soldiers;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( dead_barracks_eagle, 1 );
- SAVE_VARIABLE( evac_soldiers, 2 );
- }
- void Created(GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- dead_barracks_eagle = 0;
- evac_soldiers = 0;
- // GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-37.824f, 30.975f, 1.605f));
- // Commands->Set_Facing(chinook_obj, 0.000f);
- // Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M06_XG_EV4_1.txt");
- // Commands->Start_Timer (obj, this, 30.0f, M06_NEXT_EVAC);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_EVAC_ARRIVED)
- {
- evac_soldiers = 0;
- Commands->Create_Logical_Sound(obj, M06_SOLDIER_TO_EVAC, Vector3 (0,0,0), 2500.0f);
- }
- if(type == M06_TO_EVAC)
- {
- evac_soldiers++;
- if(evac_soldiers < 3)
- {
- Commands->Send_Custom_Event(obj, sender, M06_TO_EVAC, 1, 0.0f);
- }
- }
- if(type == M06_DEAD_BARRACKS_EAGLE)
- {
- dead_barracks_eagle++;
- if(dead_barracks_eagle == 2)
- {
- Commands->Enable_Spawner(101531, false);
- Commands->Enable_Spawner(101532, false);
- Commands->Enable_Spawner(101533, false);
-
- Commands->Create_Logical_Sound(obj, M06_DISABLE_BARRACKS_SPAWN, Vector3 (0,0,0), 2500.0f);
- }
- }
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if(timer_id == M06_NEXT_EVAC)
- {
- GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-37.824f, 30.975f, 1.605f));
- Commands->Set_Facing(chinook_obj, 0.000f);
- Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M06_XG_EV4_1.txt");
-
- Commands->Start_Timer (obj, this, 30.0f, M06_NEXT_EVAC);
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Interior_Controller, "")
- {
- int dead_interior_patrol;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( dead_interior_patrol, 1 );
- }
- void Created(GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- dead_interior_patrol = 0;
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_DEAD_INTERIOR_PATROL)
- {
- Vector3 dead_loc = Commands->Get_Position(sender);
- dead_interior_patrol++;
- switch(dead_interior_patrol)
- {
- case 4:
- {
- // Contact lost with patrols. Reserve patrols to your assigned areas. Chem units to standby.\n
- const char * conv_name = ("M06_CON035");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- // Disable initial interior spawns
- Commands->Enable_Spawner(101280, false);
- Commands->Enable_Spawner(101283, false);
- Commands->Enable_Spawner(101286, false);
- Commands->Enable_Spawner(101289, false);
- Commands->Enable_Spawner(101292, false);
- Commands->Enable_Spawner(101295, false);
- Commands->Enable_Spawner(101298, false);
- Commands->Enable_Spawner(101301, false);
-
- // Enable grade 2 patrols
- Commands->Enable_Spawner(101281, true);
- Commands->Enable_Spawner(101284, true);
- Commands->Enable_Spawner(101287, true);
- Commands->Enable_Spawner(101290, true);
- Commands->Enable_Spawner(101293, true);
- Commands->Enable_Spawner(101296, true);
- Commands->Enable_Spawner(101299, true);
- Commands->Enable_Spawner(101302, true);
- }
- break;
- case 10:
- {
- // Additional patrols lost, brothers. Chem units to stations.\n
- const char * conv_name = ("M06_CON036");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- // Enable grade 3 patrols
- Commands->Enable_Spawner(101282, true);
- Commands->Enable_Spawner(101285, true);
- Commands->Enable_Spawner(101288, true);
- Commands->Enable_Spawner(101291, true);
- Commands->Enable_Spawner(101294, true);
- Commands->Enable_Spawner(101297, true);
- Commands->Enable_Spawner(101300, true);
- Commands->Enable_Spawner(101303, true);
- }
- break;
- case 26:
- {
- // Disable grade 2 patrols
- Commands->Enable_Spawner(101281, false);
- Commands->Enable_Spawner(101284, false);
- Commands->Enable_Spawner(101287, false);
- Commands->Enable_Spawner(101290, false);
- Commands->Enable_Spawner(101293, false);
- Commands->Enable_Spawner(101296, false);
- Commands->Enable_Spawner(101299, false);
- Commands->Enable_Spawner(101302, false);
- }
- break;
- case 42:
- {
- // Disable grade 3 patrols
- Commands->Enable_Spawner(101282, false);
- Commands->Enable_Spawner(101285, false);
- Commands->Enable_Spawner(101288, false);
- Commands->Enable_Spawner(101291, false);
- Commands->Enable_Spawner(101294, false);
- Commands->Enable_Spawner(101297, false);
- Commands->Enable_Spawner(101300, false);
- Commands->Enable_Spawner(101303, false);
- }
- break;
- default:
- {
- const char * conv_name;
- conv_name = NULL;
- if((dead_loc.X < 12.0f) && (dead_loc.Y < -22.0f) && (dead_loc.Z >= 5.0f))
- {
- // Possible disturbance. Second floor, near main library.\n
- conv_name = ("M06_CON037");
- }
- else if((dead_loc.X < 12.0f) && (dead_loc.Y < -22.0f) && (dead_loc.Z < 5.0f))
- {
- // Response team to bottom floor, main stairwell.\n
- conv_name = ("M06_CON038");
- }
- else if((dead_loc.X < 12.0f) && (dead_loc.Y >= -22.0f) && (dead_loc.Y < 4.0f) && (dead_loc.Z < 5.0f))
- {
- // Nearby patrols, investigate area on bottom floor, main gallery.\n
- conv_name = ("M06_CON039");
- }
- else if((dead_loc.X < 12.0f) && (dead_loc.Y >= -22.0f) && (dead_loc.Y < 4.0f) && (dead_loc.Z >= 5.0f))
- {
- // Fire team to top floor, main gallery.
- conv_name = ("M06_CON040");
- }
- else if((dead_loc.X < 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z < 5.0f))
- {
- // Possible intruder. Disturbance bottom floor, open air courtyard.\n
- conv_name = ("M06_CON041");
- }
- else if((dead_loc.X < 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z >= 5.0f))
- {
- // Lost contact with patrol, second level of open air courtyard. Investigate.\n
- conv_name = ("M06_CON042");
- }
- else if((dead_loc.X >= 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z >= 5.0f))
- {
- // Man down. Team to the top floor of the main dining area.\n
- conv_name = ("M06_CON043");
- }
- else if((dead_loc.X >= 25.0f) && (dead_loc.Y >= 5.0f) && (dead_loc.Z < 5.0f))
- {
- // Patrol to main dining area. Weapons live, brothers.\n
- conv_name = ("M06_CON044");
- }
- if(conv_name != NULL)
- {
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- }
- break;
- }
-
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Apply_Damage, "")
- {
- enum{APPLY_DAMAGE};
- void Created(GameObject * obj)
- {
- Commands->Start_Timer (obj, this, 3.0f, APPLY_DAMAGE);
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == APPLY_DAMAGE)
- {
- Commands->Apply_Damage( obj, 10000.0f, "STEEL");
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Exterior_Courtyard, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Disable reinforcement spawners for tower
- Commands->Enable_Spawner(101035, false);
- Commands->Enable_Spawner(101036, false);
- Commands->Enable_Spawner(101046, false);
- Commands->Enable_Spawner(101053, false);
-
- Commands->Create_Logical_Sound(obj, M06_DISABLE_TOWER_SPAWN, Vector3 (0,0,0), 2500.0f);
- // Enable reinforcements for courtyard
- Commands->Enable_Spawner(101063, true);
- Commands->Enable_Spawner(101064, true);
- Commands->Enable_Spawner(101073, true);
- Commands->Enable_Spawner(101082, true);
- Commands->Enable_Spawner(101095, true);
-
- }
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Hedgemaze, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- // Enable reinforcements for hedgemaze
- Commands->Enable_Spawner(101143, true);
- Commands->Enable_Spawner(101144, true);
- Commands->Enable_Spawner(101145, true);
- Commands->Enable_Spawner(101146, true);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101148), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101149), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Barracks, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- // Enable reinforcements for barracks
- Commands->Enable_Spawner(101531, true);
- Commands->Enable_Spawner(101532, true);
- Commands->Enable_Spawner(101533, true);
-
- // Disable remaining zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101012), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101212), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Interior, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Spawn initial interior patrol population
- Commands->Enable_Spawner(101280, true);
- Commands->Enable_Spawner(101283, true);
- Commands->Enable_Spawner(101286, true);
- Commands->Enable_Spawner(101289, true);
- Commands->Enable_Spawner(101292, true);
- Commands->Enable_Spawner(101295, true);
- Commands->Enable_Spawner(101298, true);
- Commands->Enable_Spawner(101301, true);
- // Shut down all enable_interior zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101304), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101305), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101306), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101307), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101308), M06_DISABLE_ZONE, 1, 0.0f);
-
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Greenhouse, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Enable greenhouse units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101509), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101356), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101357), M06_CUSTOM_ACTIVATE, 1, 0.0f);
-
-
- // Shut down all greenhouse zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101350), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101351), M06_DISABLE_ZONE, 1, 0.0f);
-
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Lab, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- // Enable units for laboratory
- Commands->Enable_Spawner(101332, true);
- Commands->Enable_Spawner(101334, true);
- Commands->Enable_Spawner(101335, true);
- Commands->Enable_Spawner(101336, true);
- Commands->Enable_Spawner(101337, true);
- Commands->Enable_Spawner(101344, true);
- Commands->Enable_Spawner(101345, true);
- Commands->Enable_Spawner(101346, true);
- Commands->Enable_Spawner(101347, true);
- }
- }
- };
- DECLARE_SCRIPT(M06_Alarm_Engineer, "")
- {
- int broken_alarm_id;
- bool fixing_alarm;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( fixing_alarm, 1 );
-
- }
- void Created(GameObject * obj)
- {
- Commands->Enable_Hibernation(obj, false);
- broken_alarm_id = 0;
- fixing_alarm = false;
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 10 && reason == ACTION_COMPLETE_NORMAL)
- {
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(broken_alarm_id));
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 11);
- params.Set_Face_Location( alarm_pos, 1.5f);
- Commands->Action_Face_Location ( obj, params );
- }
-
- if(action_id == 11 && reason == ACTION_COMPLETE_NORMAL)
- {
- GameObject * broken_alarm = Commands->Find_Object(broken_alarm_id);
- if((Commands->Get_Health(broken_alarm) / Commands->Get_Max_Health(broken_alarm)) < 1.0f)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 12 );
- params.Set_Movement( Commands->Get_Position(obj), 0.0f, 2.0f );
- params.Set_Attack (broken_alarm, 5.0f, 0.0f, 1);
- Commands->Action_Attack( obj, params );
- }
- else
- {
- fixing_alarm = false;
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 10.0f);
- }
- }
-
-
- }
-
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- ActionParamsStruct params;
- if (( sound.Type == M06_FIX_ALARM ) && (!fixing_alarm))
- {
- fixing_alarm = true;
- broken_alarm_id = Commands->Get_ID(sound.Creator);
- Vector3 alarm_pos = Commands->Get_Position(Commands->Find_Object(broken_alarm_id));
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
- params.Set_Movement (alarm_pos, RUN, 2.0f);
- Commands->Action_Goto (obj, params);
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Courtyard_Eagle, "")
- {
- enum {WAYPATH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( already_seen, 1 );
-
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- if(Commands->Get_ID(obj) == 101099)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = 101100;
- params.WaypointStartID = 101101;
- params.WaypointEndID = 101102;
- Commands->Action_Goto( obj, params );
- }
- else
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
-
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), WALK, 1.5f );
- params.WaypathID = 101100;
- params.WaypointStartID = 101102;
- params.WaypointEndID = 101101;
- Commands->Action_Goto( obj, params );
- }
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_LOW_PRIORITY)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101104), M06_DEAD_COURTYARD_EAGLE, 1, 0.0f);
- }
-
- };
- DECLARE_SCRIPT(M06_Hedgemaze_Eagle, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( already_seen, 1 );
-
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
-
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101147), M06_DEAD_HEDGEMAZE_EAGLE, 1, 0.0f);
- }
- };
- DECLARE_SCRIPT(M06_Barracks_Eagle, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( already_seen, 1 );
-
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
-
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101204), M06_DEAD_BARRACKS_EAGLE, 1, 0.0f);
- }
- };
- //Grants initial weapons
- DECLARE_SCRIPT(M06_Havoc_DLS, "")
- {
-
- bool alarmed;
- int attacking_havoc;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( alarmed, 1 );
- SAVE_VARIABLE( attacking_havoc, 2 );
- }
- enum {HAVOC_ALARM_SOUND};
- void Created(GameObject * obj)
- {
- alarmed = false;
- Commands->Grant_Key (obj, 10, true);
- // Give Havoc the key to the barracks
- Commands->Grant_Key (STAR, 9, true);
-
- Commands->Give_PowerUp(obj, "POW_Chaingun_Player");
- Commands->Give_PowerUp(obj, "POW_SniperRifle_Player");
- Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
- Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
- Commands->Give_PowerUp(obj, "POW_GrenadeLauncher_Player");
-
- }
- void Destroyed(GameObject * obj)
- {
- // Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), 666, 666, 0.0f);
-
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_SOUND_ALARM_ON )
- {
- if(!alarmed)
- {
- Commands->Start_Timer (obj, this, 0.0f, HAVOC_ALARM_SOUND);
- Commands->Debug_Message("Alarm heard on Havoc, play M06_ATTACK_HAVOC_SOUND.\n");
- Commands->Create_Logical_Sound(obj, M06_ATTACK_HAVOC_SOUND, Vector3 (0,0,0), 55.0f);
-
- alarmed = true;
- }
-
-
- }
- if ( sound.Type == M06_SOUND_ALARM_OFF )
- {
- alarmed = false;
- attacking_havoc = 0;
-
- }
-
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if((timer_id == HAVOC_ALARM_SOUND) && (alarmed))
- {
- Commands->Create_Logical_Sound(obj, SOUND_TYPE_GUNSHOT, Vector3 (0,0,0), 30.0f);
- Commands->Start_Timer (obj, this, 8.0f, HAVOC_ALARM_SOUND);
-
- }
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_ATTACK_HAVOC)
- {
- Commands->Debug_Message("Soldier heard M06_ATTACK_HAVOC_SOUND, custom to attack Havoc.\n");
- if(attacking_havoc <= 3)
- {
- attacking_havoc++;
- Commands->Send_Custom_Event(obj, sender, M06_YOU_ATTACK_HAVOC, 1, 0.0f);
-
- }
-
- }
- if(type == M06_DEAD_HAVOC_ATTACKER)
- {
- Commands->Debug_Message("Soldier attacking Havoc killed, get new one.\n");
- attacking_havoc = 3;
- Commands->Create_Logical_Sound(obj, M06_ATTACK_HAVOC_SOUND, Vector3 (0,0,0), 55.0f);
- }
- if(type == M06_RELOCATE)
- {
- if(param == 0)
- {
- Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(107607)));
- Commands->Set_Facing (obj, -85.0F);
- }
- if(param == 1)
- {
- //Commands->Set_Position (obj, Commands->Get_Position(Commands->Find_Object(108278)));
- Commands->Set_Position (obj, Vector3 (-34.998F, 24.173F, 0.593F));
- Commands->Set_Facing (obj, 140.0F);
- }
-
- }
-
- }
-
-
- };
- DECLARE_SCRIPT(M06_Resistance_Raider_DLS, "")
- {
- bool talking;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( talking, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- Commands->Set_Animation(obj, "S_A_HUMAN.H_A_601A", true);
- Commands->Apply_Damage( obj, 25.0f, "STEEL");
- talking = false;
- Commands->Enable_HUD_Pokable_Indicator( obj, true );
-
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- ActionParamsStruct params;
- if (Commands->Is_A_Star(poker) && !talking)
- {
- talking = true;
- // Looks like you're bleedin'.\n
- const char *conv_name = ("M06_CON045");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 100823);
- Commands->Monitor_Conversation (obj, conv_id);
- Commands->Enable_HUD_Pokable_Indicator( obj, false );
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if(action_id == 100823 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- Commands->Apply_Damage( obj, 10000.0f, "STEEL");
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing)) * 1.5;
- float b = sin(DEG_TO_RADF(facing)) * 1.5;
- Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
- Commands->Create_Object("POW_GrenadeLauncher_Player", powerup_loc);
-
- }
- }
- };
- DECLARE_SCRIPT(M06_Assistance_Farmer_DLS, "")
- {
- int poke_id;
- bool give_health;
- enum {GO_STAR, TALK_STAR, GIVE_HEALTH};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( poke_id, 1 );
- SAVE_VARIABLE( give_health, 2 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- give_health = false;
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- ActionParamsStruct params;
- poke_id = 1;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR );
- params.Set_Movement( STAR, RUN, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
-
-
- if(action_id == TALK_STAR && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing)) * 1.5;
- float b = sin(DEG_TO_RADF(facing)) * 1.5;
- Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
- Commands->Create_Object("POW_GrenadeLauncher_Player", powerup_loc);
- // Send custom to M06_Trigger_A04 zone to start conversation in maintenance shaft
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101357), M06_START_CONVERSATION, 1, 0.0f);
- }
-
- if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
- {
- // Assume hands over head anim
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1);
- params.Set_Animation( "H_A_HOST_L1B", true );
- Commands->Action_Play_Animation (obj, params);
-
- // There are two of 'em in the maintenance shaft. Here, take this.\n
- const char *conv_name = ("M06_CON046");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, TALK_STAR);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- if(give_health)
- {
- give_health = false;
- // \\Partner.\n
- const char *conv_name = ("M06_CON062");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing)) * 1.5;
- float b = sin(DEG_TO_RADF(facing)) * 1.5;
- Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
- Commands->Create_Object("tw_POW00_Health", powerup_loc);
- Commands->Start_Timer (obj, this, 10.0f, GIVE_HEALTH);
- }
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
-
- if(timer_id == GIVE_HEALTH)
- {
- give_health = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Greenhouse_Shaft_Unit, "")
- {
- int soldier_id;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101356))
- {
- // But sir, there are two&\n
- const char *conv_name = ("M06_CON047");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101356), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Floor1_Library_Unit, "")
- {
- int soldier_id;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- Commands->Innate_Disable(obj);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
-
- if(Commands->Find_Object(101358))
- {
- // I see little reason for them to resist.\n
- const char *conv_name = ("M06_CON048");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101358), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Floor1_Library, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- // Custom to activate innate
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101358), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101360), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101360), M06_START_CONVERSATION, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101361), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101362), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Floor1_Bedroom_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Floor1_Bedroom, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101363), M06_CUSTOM_ACTIVATE, 1, 0.0f);
-
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Floor2_Bedroom, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101364), M06_CUSTOM_ACTIVATE, 1, 0.0f);
-
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Floor2_Bedroom_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Floor2_Library_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
-
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
-
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101366))
- {
- // What could Raveshaw possibly want with references to Incan astrology?\n
- const char *conv_name = ("M06_CON049");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101366), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Floor2_Library, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101365), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101366), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101365), M06_START_CONVERSATION, 1, 0.0f);
- }
- }
-
- };
- DECLARE_SCRIPT(M06_Floor2_Conference_Unit, "")
- {
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101370))
- {
- // We should simply bombard the village with long range artillery.\n
- const char *conv_name = ("M06_CON050");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101370), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Floor2_Conference, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101369), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101370), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101369), M06_START_CONVERSATION, 1, 0.0f);
- }
- }
-
- };
- // WarRoom Officer
- DECLARE_SCRIPT(M06_WarRoom_Officer_DLS, "")
- {
- bool has_keycard;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( has_keycard, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Is_Stationary(obj, true);
- has_keycard = false;
- }
-
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- // Do not patronize me, when are you going to move the scientists to the Research Facility?\n
- // const char *conv_name = ("M06_CON051");
- // int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5);
- // Commands->Join_Conversation(NULL, conv_id, false, true);
- // Commands->Join_Conversation(obj, conv_id, false, true);
- // Commands->Start_Conversation (conv_id, 300123);
- // Commands->Monitor_Conversation (obj, conv_id);
- }
- if(type == M06_WR_KCARD_ACQUIRED)
- {
- has_keycard = true;
- }
-
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- Commands->Set_Innate_Is_Stationary(obj, false);
- }
- };
- DECLARE_SCRIPT(M06_WarRoom_Bodyguard_DLS, "")
- {
- bool has_keycard;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( has_keycard, 1 );
- }
- void Created (GameObject * obj)
- {
- has_keycard = false;
- Commands->Innate_Disable(obj);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_WR_KCARD_ACQUIRED)
- {
- has_keycard = true;
- }
-
- }
-
-
-
- };
- DECLARE_SCRIPT(M06_Enable_Warroom_DoorGuard, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101516), M06_CUSTOM_ACTIVATE, 1, 0.0f);
-
- }
- }
-
- };
- DECLARE_SCRIPT(M06_WarRoom_DoorGuard, "")
- {
- bool has_keycard;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( has_keycard, 1 );
- }
- void Created (GameObject * obj)
- {
- has_keycard = false;
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_WR_KCARD_ACQUIRED)
- {
- has_keycard = true;
- }
-
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_WarRoom, "")
- {
-
- bool already_entered;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on courtyard units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101008), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101009), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- // Commands->Send_Custom_Event(obj, Commands->Find_Object(101008), M06_START_CONVERSATION, 1, 0.0f);
- // Kane conversation with Warroom Officer
- GameObject * holograph = Commands->Find_Object(112464);
- GameObject * kane = Commands->Create_Object_At_Bone ( holograph, "Nod_Kane_HologramHead_small", "O_ARROW" );
- Commands->Attach_To_Object_Bone( kane, holograph, "O_ARROW" );
- Commands->Disable_All_Collisions ( kane );
- Commands->Set_Facing (kane, Commands->Get_Facing (holograph));
- Commands->Set_Loiters_Allowed( kane, false );
- Commands->Attach_Script(kane, "M06_KaneHead", "");
- }
- }
-
- };
- DECLARE_SCRIPT(M06_KaneHead, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- // Do not patronize me, when are you going to move the scientists to the Research Facility?\n
- const char *conv_name = ("M06_CON051");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101008), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300123);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if((action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_ENDED) || (action_id == 300123 && reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
- {
- // Kane conversation with Havoc
- const char *conv_name = ("M06_CON064");
- int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300124);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- if((action_id == 300124 && reason == ACTION_COMPLETE_CONVERSATION_ENDED) || (action_id == 300124 && reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
- {
- Commands->Destroy_Object(obj);
- }
- }
-
- };
- DECLARE_SCRIPT(M06_Enable_Officers_Mess, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
-
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on courtyard units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101374), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101375), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101374), M06_START_CONVERSATION, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101376), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101377), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101378), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101379), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101380), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101381), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101382), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Officers_Mess_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101375))
- {
- // It is the electromagnetic system that revolutionizes it.\n
- const char *conv_name = ("M06_CON052");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101375), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Courtyard_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101384) && Commands->Find_Object(101385))
- {
- // Both of you have proven yourself loyal, and as such I feel you are prime candidates for a very sensitive mission.\n
- const char *conv_name = ("M06_CON053");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101384), conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101385), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Courtyard, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on courtyard units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101383), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101384), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101385), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101383), M06_START_CONVERSATION, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101386), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101387), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101388), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101389), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101390), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Enable_Bathroom, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on north barracks units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101391), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101393), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101393), M06_START_CONVERSATION, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101394), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101395), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Enable_Barracks_Mess, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on north barracks units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101502), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101503), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101502), M06_START_CONVERSATION, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101504), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101505), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101506), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101507), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101508), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Barracks_Mess_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101503))
- {
- // Put it over there, and don't slop it around.\n
- const char *conv_name = ("M06_CON054");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101503), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Bathroom_Unit, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101391))
- {
- // Man, this new chem suit insulation itches something awful.\n
- const char *conv_name = ("M06_CON055");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101391), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_South_Barracks, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on barracks units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101399), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101400), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101403), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Send custom to activate conversation
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101400), M06_START_CONVERSATION, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101401), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101402), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_South_Barracks_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
- if(type == M06_START_CONVERSATION)
- {
- if(Commands->Find_Object(101399))
- {
- // I just don't get it, we are finely trained soldiers. What do we need mercs for?\n
- const char *conv_name = ("M06_CON056");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Join_Conversation(Commands->Find_Object(101399), conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_North_Barracks, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Activate innate on barracks units
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101396), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101397), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101398), M06_CUSTOM_ACTIVATE, 1, 0.0f);
- // Disable zones
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101500), M06_DISABLE_ZONE, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(101501), M06_DISABLE_ZONE, 1, 0.0f);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_DISABLE_ZONE)
- {
- already_entered = true;
- }
-
- }
- };
- DECLARE_SCRIPT(M06_North_Barracks_Unit, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( soldier_id, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- ActionParamsStruct params;
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- Commands->Innate_Enable(obj);
- }
-
- }
- };
- DECLARE_SCRIPT (M06_Courtyard_Apache, "")
- {
- bool out_of_range;
- enum {COURTYARD};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( out_of_range, 1 );
- }
- void Created (GameObject *obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, 100, COURTYARD );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
- params.WaypathID = 101428;
- params.WaypathSplined = true;
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason reason ) //this is called when the servant reaches the destination location.
- {
- ActionParamsStruct params;
- if (action_id == COURTYARD && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, 100, COURTYARD );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
- params.Set_Attack (STAR, 150.0f, 1.0f, 1);
- params.WaypathID = 101428;
- params.WaypathSplined = true;
- Commands->Action_Attack( obj, params );
- }
- if (action_id == COURTYARD && reason == ACTION_COMPLETE_ATTACK_OUT_OF_RANGE)
- {
- out_of_range = true;
- }
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- if(out_of_range)
- {
- ActionParamsStruct params;
- out_of_range = false;
- params.Set_Basic( this, 100, COURTYARD );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
- params.Set_Attack (STAR, 150.0f, 1.0f, 1);
- params.WaypathID = 101428;
- params.WaypathSplined = true;
- Commands->Action_Attack( obj, params );
- }
- }
- };
- DECLARE_SCRIPT(M06_Flyover_Controller, "") // 100018
- {
- int last;
- bool flyovers;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( last, 1 );
- SAVE_VARIABLE( flyovers, 2 );
- }
- void Created(GameObject * obj)
- {
- last = 0;
- flyovers = true;
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, 1, 0.0f);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == M06_FLYOVER_COMPLETE && flyovers)
- {
- last = param;
- char *flyovers[11] =
- {
- "M06_XG_VehicleDrop0.txt",
- "M06_XG_VehicleDrop1.txt",
- "M06_XG_VehicleDrop2.txt",
- "X6A_Apache_03.txt",
- "X6A_Apache_04.txt",
- "X6A_Apache_05.txt",
- "X6A_Apache_06.txt",
- "X6A_Apache_07.txt",
- "X6A_Apache_08.txt",
- "X6A_Apache_09.txt",
-
- "M06_XG_EV2_1.txt",
-
- };
-
- int random = Get_Int_Random(0, 10);
- while(random == last)
- {
- random = Get_Int_Random(0, 10);
- }
-
- switch(random)
- {
- case 1:
- case 2:
- case 3:
- case 10:
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-44.177f, 30.547f, 1.605f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
- }
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
- Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
- }
- break;
- }
-
-
- }
- if(type == M06_ACTIVATE_FLYOVERS)
- {
- if(param == 1 && !flyovers)
- {
- flyovers = true;
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, 1, 0.0f);
- }
- else if (param == 0 && flyovers)
- {
- flyovers = false;
- }
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Activate_Flyovers, "Active=0:int")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
-
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- bool active = (Get_Int_Parameter("Active") == 1) ? true : false;
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_ACTIVATE_FLYOVERS, active, 0.0f);
- }
- }
- };
- DECLARE_SCRIPT(M06_Flyover, "Flyover_ID=0:int")
- {
- int flyover_id;
-
- void Created( GameObject * obj )
- {
- Commands->Disable_Physical_Collisions ( obj );
- flyover_id = Get_Int_Parameter("Flyover_ID");
- }
- void Destroyed(GameObject * obj)
- {
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100018), M06_FLYOVER_COMPLETE, flyover_id, 0.0f);
-
- }
- };
- DECLARE_SCRIPT(M06_Drop_Thunder_Squad, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
-
- // 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
- const char *conv_name = ("M06_CON057");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, true, true);
- Commands->Join_Conversation(STAR, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300603);
- Commands->Monitor_Conversation (obj, conv_id);
-
- GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-55.305f, -87.235f, -0.767f));
- Commands->Set_Facing(chinook_obj, 85.000f);
- Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X6I_TroopDrop1.txt");
- }
- }
- };
- DECLARE_SCRIPT(M06_Thunder_Unit, "")
- {
- enum{WAYPATH};
- void Created( GameObject * obj )
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
- params.WaypathID = 101520;
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
- {
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
-
- }
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- Vector3 powerup_loc = Commands->Get_Position(obj);
- Commands->Create_Object("POW_RocketLauncher_Player", powerup_loc);
- }
- };
- 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")
- {
- bool enemy_seen;
-
- enum{GO_FIRST_LOC, FACING_FIRST_LOC, ANIMATE_FIRST_LOC, GO_SECOND_LOC, FACING_SECOND_LOC, ANIMATE_SECOND_LOC,
- GO_THIRD_LOC, FACING_THIRD_LOC, ANIMATE_THIRD_LOC, HANDS_OVER_HEAD, START_OVER};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( enemy_seen, 1 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- enemy_seen = false;
-
- params.Set_Basic (this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_FIRST_LOC);
- params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- const char *anim = Get_Parameter("Animation");
- // First Loc
- if(action_id == GO_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_FIRST_LOC);
- params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc1_ID"))), 1.5f);
- Commands->Action_Face_Location ( obj, params );
- }
- if(action_id == FACING_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_FIRST_LOC );
- params.Set_Animation (anim, false);
- Commands->Action_Play_Animation (obj, params);
- }
- if(action_id == ANIMATE_FIRST_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_SECOND_LOC);
- params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc2_ID")), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
- // Second Loc
- if(action_id == GO_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_SECOND_LOC);
- params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc2_ID"))), 1.5f);
- Commands->Action_Face_Location ( obj, params );
- }
- if(action_id == FACING_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_SECOND_LOC );
- params.Set_Animation (anim, false);
- Commands->Action_Play_Animation (obj, params);
- }
- if(action_id == ANIMATE_SECOND_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_THIRD_LOC);
- params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc3_ID")), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
-
- // Third Loc
- if(action_id == GO_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, FACING_THIRD_LOC);
- params.Set_Face_Location( Commands->Get_Position(Commands->Find_Object(Get_Int_Parameter("Loc3_ID"))), 1.5f);
- Commands->Action_Face_Location ( obj, params );
- }
- if(action_id == FACING_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, ANIMATE_THIRD_LOC );
- params.Set_Animation (anim, false);
- Commands->Action_Play_Animation (obj, params);
- }
- if(action_id == ANIMATE_THIRD_LOC && reason == ACTION_COMPLETE_NORMAL)
- {
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_FIRST_LOC);
- params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
- if(action_id == HANDS_OVER_HEAD && reason == ACTION_COMPLETE_NORMAL)
- {
- // In hands over head anim
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
- params.Set_Animation( "H_A_HOST_L1B", true );
- Commands->Action_Play_Animation (obj, params);
- }
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- ActionParamsStruct params;
-
-
- Commands->Create_Logical_Sound(obj, SOUND_TYPE_GUNSHOT, Commands->Get_Position(obj), 8.0f);
- if(!enemy_seen)
- {
- // Help! Intruder! Help!\n
- const char *conv_name = ("M06_CON058");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1010211);
- // Assume hands over head anim
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, HANDS_OVER_HEAD);
- params.Set_Animation( "H_A_HOST_L1A", false );
- Commands->Action_Play_Animation (obj, params);
- Commands->Start_Timer (obj, this, 20.0f, START_OVER);
- enemy_seen = true;
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
-
- if(timer_id == START_OVER)
- {
- enemy_seen = false;
-
- // Exit hands over head anim
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
- params.Set_Animation( "H_A_HOST_L1C", false );
- Commands->Action_Play_Animation (obj, params);
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_FIRST_LOC);
- params.Set_Movement (Commands->Find_Object(Get_Int_Parameter("Loc1_ID")), WALK, 1.5f);
- Commands->Action_Goto (obj, params);
- }
-
- }
- };
- DECLARE_SCRIPT(M06_Move_Sydney, "Move_Loc=0:int")
- {
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
-
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if (Commands->Is_A_Star(enterer))
- {
- int move_loc = Get_Int_Parameter("Move_Loc");
- Commands->Send_Custom_Event(obj, Commands->Find_Object(101010), M06_MOVE_SYDNEY, move_loc, 0.0f);
- }
- }
- };
- DECLARE_SCRIPT(M06_Collapse_Zone, "Zone_ID=0:int")
- {
- bool already_entered;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = true;
- }
- void Custom(GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CHATEAU_COLLAPSE)
- {
- already_entered = false;
- }
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- switch(Get_Int_Parameter("Zone_ID"))
- {
- // First section of crypt, immediately past the lab door
- case 1:
- {
- GameObject * l6_falldust01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust01, "L6_falldust01" );
- GameObject * l6_falldust02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust02, "L6_falldust02" );
- GameObject * l6_fallrocks01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks01, "L6_fallrocks01" );
- GameObject * l6_fallrocks07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks07, "L6_fallrocks07" );
- GameObject * l6_fallrocks08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks08, "L6_fallrocks08" );
- }
- break;
- // Back section of crypt, right before you exit out to the stairs up to Chateau
- case 2:
- {
- GameObject * l6_fallrocks09 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks09, "L6_fallrocks09" );
- GameObject * l6_fallrocks11 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks11, "L6_fallrocks11" );
- GameObject * l6_fallrocks10 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks10, "L6_fallrocks10" );
- GameObject * l6_fallfire01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallfire01, "L6_fallfire01" );
- Commands->Set_Animation(l6_fallfire01, "L6_Fallfire01.L6_Fallfire01", true);
- GameObject * l6_floorfire01 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_floorfire01, "L6_floorfire01" );
- Commands->Set_Animation(l6_floorfire01, "L6_floorfire01.L6_floorfire01", true);
- }
- break;
- // Staircase leading out of crypt and hallway immediately up that staircase
- case 3:
- {
- GameObject * l6_falldust03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust03, "L6_falldust03" );
- GameObject * l6_fallrocks12 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks12, "L6_fallrocks12" );
- GameObject * l6_fallfire02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallfire02, "L6_fallfire02" );
- Commands->Set_Animation(l6_fallfire02, "L6_Fallfire02.L6_Fallfire02", true);
- GameObject * l6_floorfire02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_floorfire02, "L6_floorfire02" );
- Commands->Set_Animation(l6_floorfire02, "L6_floorfire02.L6_floorfire02", true);
- GameObject * l6_falldust04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust04, "L6_falldust04" );
- }
- break;
- // Hallway at the top of the staircase leading from crypt, immediately before wooden beam mess hall
- case 4:
- {
- GameObject * l6_fallrocks02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks02, "L6_fallrocks02" );
- GameObject * l6_falldust05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust05, "L6_falldust05" );
-
- }
- break;
- // Large mess hall with wooden beams supporting the ceiling
- case 5:
- {
- GameObject * l6_fallwood02 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood02, "L6_fallwood02" );
- GameObject * l6_fallwood03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood03, "L6_fallwood02" );
- GameObject * l6_fallrocks03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks03, "L6_fallrocks03" );
- GameObject * l6_fallwood04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood04, "L6_fallwood04" );
- GameObject * l6_falldust10 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust10, "L6_falldust10" );
- GameObject * l6_falldust06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust06, "L6_falldust06" );
- GameObject * l6_falldust21 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust21, "L6_falldust21" );
- GameObject * l6_falldust07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust07, "L6_falldust07" );
-
- }
- break;
- // Staircase leading out of mess and into main artwork area
- case 6:
- {
- GameObject * l6_falldust08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust08, "L6_falldust08" );
- GameObject * l6_fallfire03 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallfire03, "L6_fallfire03" );
- Commands->Set_Animation(l6_fallfire03, "L6_Fallfire03.L6_Fallfire03", true);
- GameObject * l6_falldust09 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust09, "L6_falldust09" );
- GameObject * l6_falldust11 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust11, "L6_falldust11" );
- }
- break;
- // Columned room
- case 7:
- {
- GameObject * l6_fallwood05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood05, "L6_fallwood05" );
- GameObject * l6_fallrocks05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks05, "L6_fallrocks05" );
- GameObject * l6_fallwood06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood06, "L6_fallwood06" );
- GameObject * l6_fallrocks06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallrocks06, "L6_fallrocks06" );
- GameObject * l6_falldust17 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust17, "L6_falldust17" );
- GameObject * l6_floorfire06 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_floorfire06, "L6_floorfire06" );
- Commands->Set_Animation(l6_floorfire06, "L6_floorfire06.L6_floorfire06", true);
- GameObject * l6_falldust18 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust18, "L6_falldust18" );
- }
- break;
- // Master staircase
- case 8:
- {
- GameObject * l6_fallwood07 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood07, "L6_fallwood07" );
- GameObject * l6_falldust12 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust12, "L6_falldust12" );
- GameObject * l6_falldust13 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust13, "L6_falldust13" );
- GameObject * l6_falldust16 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust16, "L6_falldust16" );
- GameObject * l6_floorfire04 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_floorfire04, "L6_floorfire04" );
- Commands->Set_Animation(l6_floorfire04, "L6_floorfire04.L6_floorfire04", true);
- GameObject * l6_floorfire05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_floorfire05, "L6_floorfire05" );
- Commands->Set_Animation(l6_floorfire05, "L6_floorfire04.L6_floorfire05", true);
-
- GameObject * l6_falldust15 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust15, "L6_falldust15" );
- GameObject * l6_fallfire05 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallfire05, "L6_fallfire05" );
- Commands->Set_Animation(l6_fallfire05, "L6_Fallfire05.L6_Fallfire05", true);
- GameObject * l6_falldust14 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust14, "L6_falldust14" );
- }
- break;
- // Escape hall and outside room
- case 9:
- {
- GameObject * l6_falldust19 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust19, "L6_falldust19" );
- GameObject * l6_falldust20 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust20, "L6_falldust20" );
- GameObject * l6_falldust22 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust22, "L6_falldust22" );
- GameObject * l6_fallwood08 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_fallwood08, "L6_fallwood08" );
- GameObject * l6_falldust23 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust23, "L6_falldust23" );
- GameObject * l6_falldust24 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust24, "L6_falldust24" );
- GameObject * l6_falldust25 = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
- Commands->Set_Model ( l6_falldust25, "L6_falldust25" );
- }
- break;
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Activate_MidtroC, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = true;
-
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Commands->Send_Custom_Event (obj, Commands->Find_Object(101010), 100, 100, 0.0f);
- // Block for Mendoza arena
- GameObject *crate28 = Commands->Create_Object("X6_Rubble2", Vector3(-49.309f, 1.010f, -0.016f));
- Commands->Set_Facing( crate28, 140.000f );
- GameObject *crate29 = Commands->Create_Object("X6_Rubble2", Vector3(-50.727f, 0.514f, -0.020f));
- Commands->Set_Facing( crate29, 5.000f );
- GameObject *crate30 = Commands->Create_Object("X6_Rubble1", Vector3(-11.987f, 8.771f, 0.000f));
- Commands->Set_Facing( crate30, 90.000f );
- GameObject *crate1 = Commands->Create_Object("X6_Rubble5", Vector3(-6.280f, 9.196f, 0.000f));
- Commands->Set_Facing( crate1, 50.000f );
- GameObject *crate2 = Commands->Create_Object("X6_Rubble5", Vector3(-5.988f, 7.571f, -0.010f));
- Commands->Set_Facing( crate2, 135.000f );
- Vector3 havoc_loc = Commands->Get_Position (STAR);
- havoc_loc.Z += 7.0f;
- Commands->Set_Position (STAR, havoc_loc );
- GameObject * sydney = Commands->Find_Object(101010);
- Vector3 sydney_loc = Commands->Get_Position (sydney);
- havoc_loc.Z += 7.0f;
- Commands->Set_Position (sydney, sydney_loc );
-
- GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X6C_MIDTRO.txt");
- // Take key to the barracks away from Havoc so that Mendoza will not follow him in and get stuck
- Commands->Grant_Key (STAR, 9, false);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == M06_CUSTOM_ACTIVATE)
- {
- already_entered = false;
- }
- }
- };
- DECLARE_SCRIPT (M06_Clear_For_Mendoza, "")
- {
- bool open;
- const char * anim;
- void Created (GameObject * obj)
- {
-
- }
- void Sound_Heard(GameObject* obj, const CombatSound & sound)
- {
- if ( sound.Type == M06_CLEAR_FOR_MENDOZA )
- {
- Commands->Destroy_Object(obj);
- }
- }
- };
- DECLARE_SCRIPT(M06_DataDisc_01_DLS, "")//
- {
- void Custom( GameObject * obj, int type, int param, GameObject * sender )
- {
- if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
- {
- // Reveal Mutant Templar
- bool reveal = Commands->Reveal_Encyclopedia_Character(28);
- if ( reveal == 1 )
- {
- Commands->Display_Encyclopedia_Event_UI();
- }
- }
- }
- };
- DECLARE_SCRIPT(M06_Enable_Alarm_Objective, "")
- {
-
- bool already_entered;
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
-
- }
- void Created (GameObject * obj)
- {
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Warning: Nod Security Measures Detected.
- const char *conv_name = ("M06_CON060");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300609);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if(action_id == 300609 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
- {
- // Deactivate alarm system
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), 609, 3, 0.0f);
- }
- }
-
- };
|