Mission07.cpp 163 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * Mission07.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 7 specific scripts
  25. *
  26. * PROGRAMMER
  27. * Ryan Vervack
  28. *
  29. * VERSION INFO
  30. * $Author: Dan_e $
  31. * $Revision: 122 $
  32. * $Modtime: 1/08/02 12:14p $
  33. * $Archive: /Commando/Code/Scripts/Mission07.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include "mission7.h"
  39. // M07B
  40. // Objective Controller
  41. DECLARE_SCRIPT(M07_Objective_Controller, "") // 100657
  42. {
  43. bool accomplished_705;
  44. bool accomplished_701;
  45. enum {HAVOCS_SCRIPT, M07_DEAD_HAVOC, INITIAL_CONV, PROTECT_TEAM};
  46. // Register variables to be Auto-Saved
  47. // All variables must have a unique ID, less than 256, that never changes
  48. REGISTER_VARIABLES()
  49. {
  50. SAVE_VARIABLE( accomplished_705, 1 );
  51. SAVE_VARIABLE( accomplished_701, 2 );
  52. }
  53. void Created(GameObject * obj)
  54. {
  55. // Background Music
  56. Commands->Set_Background_Music ("07-Got A Present For Ya.mp3");
  57. Commands->Start_Timer (obj, this, 0.5f, HAVOCS_SCRIPT);
  58. Commands->Start_Timer (obj, this, 1.0f, INITIAL_CONV);
  59. Add_An_Objective(709);
  60. accomplished_705 = false;
  61. accomplished_701 = false;
  62. }
  63. void Add_An_Objective(int id)
  64. {
  65. GameObject *object;
  66. switch (id)
  67. {
  68. // Evacuate Sydney
  69. case 701:
  70. {
  71. Commands->Add_Objective(701, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M07_01, NULL, IDS_Enc_Obj_Primary_M07_01);
  72. object = Commands->Find_Object(100664);
  73. if(object)
  74. {
  75. Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1007I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  76. Commands->Set_Objective_Radar_Blip_Object(701, object);
  77. Commands->Set_Objective_HUD_Info_Position(701, 90.0f, "POG_M07_1_04.tga", IDS_POG_EVACUATE, Commands->Get_Position (object));
  78. }
  79. }
  80. break;
  81. // Secure SAM Sites
  82. case 702:
  83. {
  84. Commands->Add_Objective(702, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M07_03, NULL, IDS_Enc_Obj_Primary_M07_03);
  85. object = Commands->Find_Object(100673);
  86. if(object)
  87. {
  88. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0089I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  89. Commands->Set_Objective_Radar_Blip_Object(702, object);
  90. Commands->Set_Objective_HUD_Info_Position(702, 90.0f, "POG_M07_1_01.tga", IDS_POG_SECURE, Commands->Get_Position (object));
  91. }
  92. }
  93. break;
  94. // Destroy SSM Launchers
  95. case 703:
  96. {
  97. Commands->Add_Objective(703, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M07_04, NULL, IDS_Enc_Obj_Primary_M07_04);
  98. object = Commands->Find_Object(100798);
  99. if(object)
  100. {
  101. Commands->Set_Objective_Radar_Blip_Object(703, object);
  102. Commands->Set_Objective_HUD_Info_Position(703, 90.0f, "POG_M07_1_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  103. }
  104. }
  105. break;
  106. // Destroy Radar Installations
  107. case 704:
  108. {
  109. Commands->Add_Objective(704, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M07_01, NULL, IDS_Enc_Obj_Secondary_M07_01);
  110. object = Commands->Find_Object(100721);
  111. if(object)
  112. {
  113. Commands->Set_Objective_Radar_Blip_Object(704, object);
  114. Commands->Set_Objective_HUD_Info_Position(704, 90.0f, "POG_M07_2_07.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  115. }
  116. }
  117. break;
  118. // Rescue Resistance
  119. case 705:
  120. {
  121. Commands->Add_Objective(705, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M07_02, NULL, IDS_Enc_Obj_Secondary_M07_02);
  122. object = Commands->Find_Object(115842);
  123. if(object)
  124. {
  125. Commands->Set_Objective_Radar_Blip_Object(705, object);
  126. Commands->Set_Objective_HUD_Info_Position(705, 90.0f, "POG_M07_2_04.tga", IDS_POG_RESCUE, Commands->Get_Position (object));
  127. }
  128. }
  129. break;
  130. // Destroy Napalm Stockpile
  131. case 706:
  132. {
  133. Commands->Add_Objective(706, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M07_03, NULL, IDS_Enc_Obj_Secondary_M07_03);
  134. object = Commands->Find_Object(100781);
  135. if(object)
  136. {
  137. Commands->Set_Objective_Radar_Blip_Object(706, object);
  138. Commands->Set_Objective_HUD_Info_Position(706, 90.0f, "POG_M07_2_06.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  139. }
  140. }
  141. break;
  142. // Destroy Stealth Tank
  143. case 707:
  144. {
  145. Commands->Add_Objective(707, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M07_04, NULL, IDS_Enc_Obj_Secondary_M07_04);
  146. object = Commands->Find_Object(100801);
  147. if(object)
  148. {
  149. Commands->Set_Objective_Radar_Blip_Object(707, object);
  150. Commands->Set_Objective_HUD_Info_Position(707, 90.0f, "POG_M07_2_03.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  151. }
  152. }
  153. break;
  154. // Defeat Obelisk
  155. case 708:
  156. {
  157. Commands->Add_Objective(708, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M07_05, NULL, IDS_Enc_Obj_Secondary_M07_05);
  158. object = Commands->Find_Object(168926);
  159. if(object)
  160. {
  161. Commands->Set_Objective_Radar_Blip_Object(708, object);
  162. Commands->Set_Objective_HUD_Info_Position(708, 90.0f, "POG_M07_2_05.tga", IDS_POG_DEFEAT, Commands->Get_Position (object));
  163. }
  164. }
  165. break;
  166. // Protect Team Members
  167. case 709:
  168. {
  169. Commands->Add_Objective(709, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M07_05, NULL, IDS_Enc_Obj_Primary_M07_05);
  170. object = Commands->Find_Object(100717);
  171. if(object)
  172. {
  173. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0091I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  174. Commands->Set_Objective_Radar_Blip_Object(709, object);
  175. Commands->Set_Objective_HUD_Info_Position(709, 90.0f, "POG_M07_1_05.tga", IDS_POG_PROTECT, Commands->Get_Position (object));
  176. }
  177. }
  178. break;
  179. // Escape Nuclear Strike
  180. case 710:
  181. {
  182. Commands->Add_Objective(710, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M07_02, NULL, IDS_Enc_Obj_Primary_M07_02);
  183. object = Commands->Find_Object(100717);
  184. if(object)
  185. {
  186. Commands->Set_Objective_Radar_Blip_Object(710, object);
  187. Commands->Set_Objective_HUD_Info_Position(710, 90.0f, "POG_M07_1_03.tga", IDS_POG_ESCAPE, Commands->Get_Position (object));
  188. }
  189. }
  190. break;
  191. }
  192. }
  193. void Remove_Pog(int id)
  194. {
  195. switch (id)
  196. {
  197. // Evacuate Dr. Sydney Mobius
  198. case 701:
  199. {
  200. Commands->Set_Objective_HUD_Info (701, -1, "POG_M07_1_04.tga", IDS_POG_PROTECT);
  201. }
  202. break;
  203. }
  204. }
  205. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  206. {
  207. switch (param)
  208. {
  209. case 1:
  210. {
  211. if(type == 705 && accomplished_705)
  212. {
  213. return;
  214. }
  215. if(type == 705)
  216. {
  217. accomplished_705 = true;
  218. }
  219. if(type == 701)
  220. {
  221. accomplished_701 = true;
  222. }
  223. Commands->Clear_Radar_Marker (type);
  224. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  225. Remove_Pog(type);
  226. if(type == 703)
  227. {
  228. Commands->Mission_Complete ( true );
  229. }
  230. }
  231. break;
  232. case 2:
  233. {
  234. if(type == 702 && accomplished_701)
  235. {
  236. return;
  237. }
  238. Commands->Clear_Radar_Marker (type);
  239. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  240. Remove_Pog(type);
  241. if(type == 701)
  242. {
  243. Commands->Mission_Complete ( false );
  244. }
  245. if(type == 702)
  246. {
  247. Commands->Mission_Complete ( false );
  248. }
  249. if(type == 709)
  250. {
  251. Commands->Mission_Complete ( false );
  252. }
  253. if(type == 710)
  254. {
  255. Commands->Mission_Complete ( false );
  256. }
  257. }
  258. break;
  259. case 3:
  260. Add_An_Objective(type);
  261. break;
  262. case 4:
  263. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  264. break;
  265. case 5:
  266. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_HIDDEN);
  267. break;
  268. }
  269. }
  270. void Timer_Expired(GameObject * obj, int timer_id )
  271. {
  272. if(timer_id == INITIAL_CONV)
  273. {
  274. // How are Dr. Mobius and Sydney?\n
  275. const char *conv_name = ("M07_CON001");
  276. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5, 200.0f, false);
  277. Commands->Join_Conversation(NULL, conv_id, false, true);
  278. Commands->Join_Conversation(STAR, conv_id, false, true);
  279. Commands->Join_Conversation(NULL, conv_id, false, true);
  280. Commands->Join_Conversation(GUNNER, conv_id, true, true);
  281. Commands->Start_Conversation (conv_id, 300701);
  282. Commands->Monitor_Conversation (obj, conv_id);
  283. }
  284. if(timer_id == PROTECT_TEAM)
  285. {
  286. Add_An_Objective(710);
  287. }
  288. }
  289. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  290. {
  291. ActionParamsStruct params;
  292. if(action_id == 300701 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  293. {
  294. Add_An_Objective(701);
  295. Commands->Start_Timer (obj, this, 2.0f, PROTECT_TEAM);
  296. // Start nuclear strike countdown
  297. Commands->Send_Custom_Event(obj, Commands->Find_Object(100663), M07_GO_EVAC_SITE, 1, 0.0f);
  298. // Customs to move team to evac site
  299. // Gunner
  300. Commands->Send_Custom_Event(obj, GUNNER, M07_GO_ASSEMBLY, 1, 0.0f);
  301. // Deadeye
  302. Commands->Send_Custom_Event(obj, DEADEYE, M07_GO_ASSEMBLY, 1, 0.0f);
  303. // Sydney
  304. Commands->Send_Custom_Event(obj, SYDNEY, M07_GO_ASSEMBLY, 1, 0.0f);
  305. // Hotwire
  306. Commands->Send_Custom_Event(obj, HOTWIRE, M07_GO_ASSEMBLY, 1, 2.0f);
  307. // Patch
  308. Commands->Send_Custom_Event(obj, PATCH, M07_GO_ASSEMBLY, 1, 2.0f);
  309. }
  310. }
  311. };
  312. //Grants initial weapons
  313. DECLARE_SCRIPT(M07_Havoc_DLS, "")
  314. {
  315. bool nuke_blast;
  316. enum {HAVOC_ALARM_SOUND};
  317. // Register variables to be Auto-Saved
  318. // All variables must have a unique ID, less than 256, that never changes
  319. REGISTER_VARIABLES()
  320. {
  321. SAVE_VARIABLE( nuke_blast, 1 );
  322. }
  323. void Created(GameObject * obj)
  324. {
  325. nuke_blast = true;
  326. Commands->Give_PowerUp(obj, "POW_Chaingun_Player");
  327. Commands->Give_PowerUp(obj, "POW_SniperRifle_Player");
  328. Commands->Give_PowerUp(obj, "POW_RocketLauncher_Player");
  329. Commands->Give_PowerUp(obj, "POW_MineRemote_Player");
  330. }
  331. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  332. {
  333. if ( type == M07_NUKE_BLAST )
  334. {
  335. nuke_blast = (param == 1) ? true : false;
  336. }
  337. }
  338. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  339. {
  340. if (sound.Type == M07_NUKE_IMPACT)
  341. {
  342. if(nuke_blast)
  343. {
  344. Commands->Apply_Damage( obj, 10000.0f, "DEATH");
  345. }
  346. }
  347. }
  348. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  349. {
  350. if(enemy == Commands->Find_Object(100801))
  351. {
  352. // You've got to be kidding.\n
  353. const char *conv_name = ("M07_CON015");
  354. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  355. Commands->Join_Conversation(STAR, conv_id, false, true);
  356. Commands->Start_Conversation (conv_id, 300707);
  357. Commands->Monitor_Conversation (obj, conv_id);
  358. }
  359. }
  360. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  361. {
  362. if (action_id == 300702 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  363. {
  364. // Defeat Stealth Tank.
  365. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 707, 3, 0.0f);
  366. // Change soundtrack to attack
  367. Commands->Set_Background_Music ("Raveshaw_Act on Instinct");
  368. }
  369. }
  370. void Killed (GameObject * obj, GameObject * killer)
  371. {
  372. Commands->Mission_Complete(false);
  373. }
  374. };
  375. DECLARE_SCRIPT(M07_Dead6_Minigunner, "") // Deadeye
  376. {
  377. bool nuke_blast;
  378. float health;
  379. float shield;
  380. // Register variables to be Auto-Saved
  381. // All variables must have a unique ID, less than 256, that never changes
  382. REGISTER_VARIABLES()
  383. {
  384. SAVE_VARIABLE( nuke_blast, 1 );
  385. SAVE_VARIABLE( health, 2 );
  386. SAVE_VARIABLE( shield, 3 );
  387. }
  388. void Created(GameObject * obj)
  389. {
  390. nuke_blast = true;
  391. Commands->Set_Innate_Is_Stationary(obj, true);
  392. health = Commands->Get_Max_Health(obj);
  393. shield = Commands->Get_Max_Shield_Strength(obj);
  394. Commands->Enable_Hibernation(obj, false);
  395. }
  396. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  397. {
  398. ActionParamsStruct params;
  399. if ( type == M07_GO_ASSEMBLY )
  400. {
  401. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, M07_GO_ASSEMBLY );
  402. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  403. params.WaypathID = 102495;
  404. Commands->Action_Goto (obj, params);
  405. }
  406. if ( type == M07_GO_EVAC_SITE )
  407. {
  408. Commands->Apply_Damage( obj, -10000.0f, "DEATH");
  409. Commands->Set_Innate_Is_Stationary(obj, false);
  410. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  411. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  412. Commands->Action_Goto (obj, params);
  413. }
  414. if ( type == M07_NUKE_BLAST )
  415. {
  416. nuke_blast = (param == 1) ? true : false;
  417. }
  418. if ( type == M07_CAPTURE_SAM )
  419. {
  420. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), M07_CAPTURE_SAM);
  421. params.Set_Movement (Commands->Find_Object(100682), RUN, 3.0f);
  422. Commands->Action_Goto (obj, params);
  423. Commands->Enable_Hibernation(obj, true);
  424. }
  425. }
  426. void Timer_Expired(GameObject * obj, int timer_id)
  427. {
  428. ActionParamsStruct params;
  429. if(timer_id == M07_GO_EVAC_SITE)
  430. {
  431. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  432. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  433. Commands->Action_Goto (obj, params);
  434. }
  435. }
  436. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  437. {
  438. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_NORMAL)
  439. {
  440. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj));
  441. }
  442. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  443. {
  444. Commands->Start_Timer(obj, this, 6.0f, M07_GO_EVAC_SITE);
  445. }
  446. if (action_id == M07_CAPTURE_SAM && reason == ACTION_COMPLETE_NORMAL)
  447. {
  448. Commands->Set_Innate_Is_Stationary(obj, true);
  449. }
  450. }
  451. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  452. {
  453. if (sound.Type == M07_NUKE_IMPACT)
  454. {
  455. if(nuke_blast)
  456. {
  457. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  458. }
  459. }
  460. }
  461. void Damaged( GameObject * obj, GameObject * damager, float amount )
  462. {
  463. if(damager == obj || damager == GUNNER || damager == PATCH || damager == HOTWIRE)
  464. {
  465. Commands->Set_Health(obj, health);
  466. Commands->Set_Shield_Strength(obj, shield);
  467. }
  468. else
  469. {
  470. health = Commands->Get_Health(obj);
  471. shield = Commands->Get_Shield_Strength(obj);
  472. }
  473. }
  474. void Killed (GameObject * obj, GameObject * killer)
  475. {
  476. // Deadeye Killed
  477. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0178I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  478. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  479. }
  480. };
  481. DECLARE_SCRIPT(M07_Dead6_Rocket_Soldier, "") // Gunner
  482. {
  483. bool nuke_blast;
  484. float health;
  485. float shield;
  486. // Register variables to be Auto-Saved
  487. // All variables must have a unique ID, less than 256, that never changes
  488. REGISTER_VARIABLES()
  489. {
  490. SAVE_VARIABLE( nuke_blast, 1 );
  491. SAVE_VARIABLE( health, 2 );
  492. SAVE_VARIABLE( shield, 3 );
  493. }
  494. void Created(GameObject * obj)
  495. {
  496. nuke_blast = true;
  497. Commands->Set_Innate_Is_Stationary(obj, true);
  498. health = Commands->Get_Max_Health(obj);
  499. shield = Commands->Get_Max_Shield_Strength(obj);
  500. Commands->Enable_Hibernation(obj, false);
  501. }
  502. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  503. {
  504. ActionParamsStruct params;
  505. if ( type == M07_GO_ASSEMBLY )
  506. {
  507. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, M07_GO_ASSEMBLY );
  508. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  509. params.WaypathID = 102479;
  510. Commands->Action_Goto (obj, params);
  511. }
  512. if ( type == M07_GO_EVAC_SITE )
  513. {
  514. Commands->Set_Innate_Is_Stationary(obj, false);
  515. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  516. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  517. Commands->Action_Goto (obj, params);
  518. }
  519. if ( type == M07_NUKE_BLAST )
  520. {
  521. nuke_blast = (param == 1) ? true : false;
  522. }
  523. if ( type == M07_CAPTURE_SAM )
  524. {
  525. Commands->Apply_Damage( obj, -10000.0f, "DEATH");
  526. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), M07_CAPTURE_SAM);
  527. params.Set_Movement (Commands->Find_Object(100681), RUN, 3.0f);
  528. Commands->Action_Goto (obj, params);
  529. Commands->Enable_Hibernation(obj, true);
  530. }
  531. }
  532. void Timer_Expired(GameObject * obj, int timer_id)
  533. {
  534. ActionParamsStruct params;
  535. if(timer_id == M07_GO_EVAC_SITE)
  536. {
  537. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  538. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  539. Commands->Action_Goto (obj, params);
  540. }
  541. }
  542. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  543. {
  544. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_NORMAL)
  545. {
  546. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj));
  547. }
  548. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  549. {
  550. Commands->Start_Timer(obj, this, 6.0f, M07_GO_EVAC_SITE);
  551. }
  552. if (action_id == M07_CAPTURE_SAM && reason == ACTION_COMPLETE_NORMAL)
  553. {
  554. Commands->Set_Innate_Is_Stationary(obj, true);
  555. }
  556. }
  557. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  558. {
  559. if (sound.Type == M07_NUKE_IMPACT)
  560. {
  561. if(nuke_blast)
  562. {
  563. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  564. }
  565. }
  566. }
  567. void Damaged( GameObject * obj, GameObject * damager, float amount )
  568. {
  569. if(damager == obj || damager == DEADEYE || damager == PATCH || damager == HOTWIRE)
  570. {
  571. Commands->Set_Health(obj, health);
  572. Commands->Set_Shield_Strength(obj, shield);
  573. }
  574. else
  575. {
  576. health = Commands->Get_Health(obj);
  577. shield = Commands->Get_Shield_Strength(obj);
  578. }
  579. }
  580. void Killed (GameObject * obj, GameObject * killer)
  581. {
  582. // Gunner Killed
  583. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0176I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  584. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  585. }
  586. };
  587. DECLARE_SCRIPT(M07_Dead6_Grenadier, "") // Patch
  588. {
  589. bool nuke_blast;
  590. float health;
  591. float shield;
  592. // Register variables to be Auto-Saved
  593. // All variables must have a unique ID, less than 256, that never changes
  594. REGISTER_VARIABLES()
  595. {
  596. SAVE_VARIABLE( nuke_blast, 1 );
  597. SAVE_VARIABLE( health, 2 );
  598. SAVE_VARIABLE( shield, 3 );
  599. }
  600. void Created(GameObject * obj)
  601. {
  602. nuke_blast = true;
  603. Commands->Set_Innate_Is_Stationary(obj, true);
  604. health = Commands->Get_Max_Health(obj);
  605. shield = Commands->Get_Max_Shield_Strength(obj);
  606. Commands->Enable_Hibernation(obj, false);
  607. }
  608. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  609. {
  610. ActionParamsStruct params;
  611. if ( type == M07_GO_ASSEMBLY )
  612. {
  613. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, M07_GO_ASSEMBLY );
  614. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  615. params.WaypathID = 102495;
  616. Commands->Action_Goto (obj, params);
  617. }
  618. if ( type == M07_GO_EVAC_SITE )
  619. {
  620. Commands->Apply_Damage( obj, -10000.0f, "DEATH");
  621. Commands->Set_Innate_Is_Stationary(obj, false);
  622. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  623. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  624. Commands->Action_Goto (obj, params);
  625. }
  626. if ( type == M07_NUKE_BLAST )
  627. {
  628. nuke_blast = (param == 1) ? true : false;
  629. }
  630. if ( type == M07_CAPTURE_SAM )
  631. {
  632. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_CAPTURE_SAM);
  633. params.Set_Movement (SYDNEY, RUN, 3.0f);
  634. params.MoveFollow = true;
  635. Commands->Action_Goto (obj, params);
  636. Commands->Enable_Hibernation(obj, true);
  637. }
  638. }
  639. void Timer_Expired(GameObject * obj, int timer_id)
  640. {
  641. ActionParamsStruct params;
  642. if(timer_id == M07_GO_EVAC_SITE)
  643. {
  644. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  645. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  646. Commands->Action_Goto (obj, params);
  647. }
  648. if(timer_id == M07_CAPTURE_SAM)
  649. {
  650. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_CAPTURE_SAM);
  651. params.Set_Movement (SYDNEY, RUN, 3.0f);
  652. params.MoveFollow = true;
  653. Commands->Action_Goto (obj, params);
  654. }
  655. }
  656. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  657. {
  658. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_NORMAL)
  659. {
  660. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj));
  661. }
  662. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  663. {
  664. Commands->Start_Timer(obj, this, 6.0f, M07_GO_EVAC_SITE);
  665. }
  666. if (action_id == M07_CAPTURE_SAM && reason == ACTION_COMPLETE_LOW_PRIORITY)
  667. {
  668. Commands->Start_Timer(obj, this, 6.0f, M07_CAPTURE_SAM);
  669. }
  670. }
  671. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  672. {
  673. if (sound.Type == M07_NUKE_IMPACT)
  674. {
  675. if(nuke_blast)
  676. {
  677. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  678. }
  679. }
  680. }
  681. void Damaged( GameObject * obj, GameObject * damager, float amount )
  682. {
  683. if(damager == obj || damager == DEADEYE || damager == GUNNER || damager == HOTWIRE)
  684. {
  685. Commands->Set_Health(obj, health);
  686. Commands->Set_Shield_Strength(obj, shield);
  687. }
  688. else
  689. {
  690. health = Commands->Get_Health(obj);
  691. shield = Commands->Get_Shield_Strength(obj);
  692. }
  693. }
  694. void Killed (GameObject * obj, GameObject * killer)
  695. {
  696. // Patch Killed
  697. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0092I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  698. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  699. }
  700. };
  701. DECLARE_SCRIPT(M07_Dead6_Grenadier2, "") // Patch2
  702. {
  703. enum{WAYPATH};
  704. // Register variables to be Auto-Saved
  705. // All variables must have a unique ID, less than 256, that never changes
  706. REGISTER_VARIABLES()
  707. {
  708. // SAVE_VARIABLE( nuke_blast, 1 );
  709. }
  710. void Created(GameObject * obj)
  711. {
  712. Commands->Enable_Hibernation(obj, false);
  713. ActionParamsStruct params;
  714. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  715. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  716. params.WaypathID = 103837;
  717. Commands->Action_Goto( obj, params );
  718. }
  719. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  720. {
  721. if (action_id == WAYPATH)
  722. {
  723. int dead6_id = Commands->Get_ID(obj);
  724. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  725. }
  726. }
  727. void Damaged( GameObject * obj, GameObject * damager, float amount )
  728. {
  729. }
  730. void Killed (GameObject * obj, GameObject * killer)
  731. {
  732. // Patch Killed
  733. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0092I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  734. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  735. }
  736. };
  737. DECLARE_SCRIPT(M07_Dead6_MiniGunner2, "") // Deadeye2
  738. {
  739. enum{WAYPATH};
  740. // Register variables to be Auto-Saved
  741. // All variables must have a unique ID, less than 256, that never changes
  742. REGISTER_VARIABLES()
  743. {
  744. // SAVE_VARIABLE( nuke_blast, 1 );
  745. }
  746. void Created(GameObject * obj)
  747. {
  748. Commands->Enable_Hibernation(obj, false);
  749. ActionParamsStruct params;
  750. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  751. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  752. params.WaypathID = 103837;
  753. Commands->Action_Goto( obj, params );
  754. }
  755. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  756. {
  757. if (action_id == WAYPATH)
  758. {
  759. int dead6_id = Commands->Get_ID(obj);
  760. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  761. }
  762. }
  763. void Damaged( GameObject * obj, GameObject * damager, float amount )
  764. {
  765. }
  766. void Killed (GameObject * obj, GameObject * killer)
  767. {
  768. // Deadeye Killed
  769. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0178I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  770. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  771. }
  772. };
  773. DECLARE_SCRIPT(M07_Dead6_Rocket_Soldier2, "") // Gunner2
  774. {
  775. enum{WAYPATH};
  776. // Register variables to be Auto-Saved
  777. // All variables must have a unique ID, less than 256, that never changes
  778. REGISTER_VARIABLES()
  779. {
  780. // SAVE_VARIABLE( nuke_blast, 1 );
  781. }
  782. void Created(GameObject * obj)
  783. {
  784. Commands->Enable_Hibernation(obj, false);
  785. ActionParamsStruct params;
  786. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  787. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  788. params.WaypathID = 103837;
  789. Commands->Action_Goto( obj, params );
  790. }
  791. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  792. {
  793. if (action_id == WAYPATH)
  794. {
  795. int dead6_id = Commands->Get_ID(obj);
  796. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  797. }
  798. }
  799. void Damaged( GameObject * obj, GameObject * damager, float amount )
  800. {
  801. }
  802. void Killed (GameObject * obj, GameObject * killer)
  803. {
  804. // Gunner Killed
  805. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0176I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  806. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  807. }
  808. };
  809. DECLARE_SCRIPT(M07_Sydney2, "")
  810. {
  811. enum{WAYPATH};
  812. // Register variables to be Auto-Saved
  813. // All variables must have a unique ID, less than 256, that never changes
  814. REGISTER_VARIABLES()
  815. {
  816. // SAVE_VARIABLE( nuke_blast, 1 );
  817. }
  818. void Created(GameObject * obj)
  819. {
  820. Commands->Enable_Hibernation(obj, false);
  821. ActionParamsStruct params;
  822. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  823. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  824. params.WaypathID = 103837;
  825. Commands->Action_Goto( obj, params );
  826. }
  827. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  828. {
  829. if (action_id == WAYPATH)
  830. {
  831. int dead6_id = Commands->Get_ID(obj);
  832. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  833. }
  834. }
  835. void Damaged( GameObject * obj, GameObject * damager, float amount )
  836. {
  837. }
  838. void Killed (GameObject * obj, GameObject * killer)
  839. {
  840. Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1008I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  841. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 701, 2, 1.0f);
  842. }
  843. };
  844. DECLARE_SCRIPT(M07_Dead6_Engineer, "") // Hotwire
  845. {
  846. bool nuke_blast;
  847. bool go_evac_site;
  848. bool dont_move;
  849. int current_move_loc;
  850. int move_loc[10];
  851. bool evac;
  852. float health;
  853. float shield;
  854. enum{GO_SAM1, ATTACK_SAM1, GO_SAM2, ATTACK_SAM2,
  855. HOTWIRE_MOVE_LOC, MOVE_LOC_LOW_PRIORITY, TANK_STILL_THERE, ARRIVE_EVAC_SPOT};
  856. // Register variables to be Auto-Saved
  857. // All variables must have a unique ID, less than 256, that never changes
  858. REGISTER_VARIABLES()
  859. {
  860. SAVE_VARIABLE( nuke_blast, 1 );
  861. SAVE_VARIABLE( go_evac_site, 2 );
  862. SAVE_VARIABLE( dont_move, 3 );
  863. SAVE_VARIABLE( current_move_loc, 4 );
  864. SAVE_VARIABLE( evac, 5 );
  865. SAVE_VARIABLE( health, 6 );
  866. SAVE_VARIABLE( shield, 7 );
  867. SAVE_VARIABLE( move_loc, 8 );
  868. }
  869. void Created(GameObject * obj)
  870. {
  871. Commands->Enable_Hibernation(obj, false);
  872. nuke_blast = true;
  873. go_evac_site = false;
  874. Commands->Set_Innate_Is_Stationary(obj, true);
  875. dont_move = true;
  876. evac = false;
  877. current_move_loc = 0;
  878. move_loc[0] = 102469;
  879. move_loc[1] = 102470;
  880. move_loc[2] = 102471;
  881. move_loc[3] = 102472;
  882. move_loc[4] = 102473;
  883. move_loc[5] = 102474;
  884. move_loc[6] = 102475;
  885. move_loc[7] = 102476;
  886. move_loc[8] = 102477;
  887. move_loc[9] = 102478;
  888. health = Commands->Get_Max_Health(obj);
  889. shield = Commands->Get_Max_Shield_Strength(obj);
  890. }
  891. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  892. {
  893. ActionParamsStruct params;
  894. if (type == M07_EVAC_INN) //SAM sites captured, evac DEAD6 and Sydney
  895. {
  896. evac = true;
  897. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), ARRIVE_EVAC_SPOT);
  898. params.Set_Movement (Commands->Find_Object(105151), RUN, 3.0f);
  899. Commands->Action_Goto (obj, params);
  900. }
  901. if ( type == M07_GO_ASSEMBLY )
  902. {
  903. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, M07_GO_ASSEMBLY );
  904. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  905. params.WaypathID = 102510;
  906. Commands->Action_Goto (obj, params);
  907. }
  908. if ( type == M07_GO_EVAC_SITE )
  909. {
  910. Commands->Apply_Damage( obj, -10000.0f, "DEATH");
  911. Commands->Set_Innate_Is_Stationary(obj, false);
  912. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  913. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  914. Commands->Action_Goto (obj, params);
  915. }
  916. if ( type == M07_NUKE_BLAST )
  917. {
  918. nuke_blast = (param == 1) ? true : false;
  919. }
  920. if ( type == M07_CAPTURE_SAM )
  921. {
  922. go_evac_site = true;
  923. // params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), M07_CAPTURE_SAM);
  924. // params.Set_Movement (STAR, RUN, 3.0f);
  925. // params.MoveFollow = true;
  926. // Commands->Action_Goto (obj, params);
  927. dont_move = false;
  928. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), HOTWIRE_MOVE_LOC);
  929. params.Set_Movement (Commands->Find_Object(move_loc[current_move_loc]), RUN, 3.0f);
  930. Commands->Action_Goto (obj, params);
  931. }
  932. if ( type == M07_HOTWIRE_CAPTURE_SAMS && (!Commands->Find_Object(100905)))
  933. {
  934. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  935. if(Commands->Find_Object(100674))
  936. {
  937. Commands->Set_Innate_Is_Stationary(obj, false);
  938. dont_move = true;
  939. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_SAM1 );
  940. params.Set_Movement (Commands->Find_Object(100674), RUN, 10.0f);
  941. Commands->Action_Goto( obj, params );
  942. GameObject * inn_loc = Commands->Find_Object(100718);
  943. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(inn_loc));
  944. }
  945. else if(Commands->Find_Object(100673))
  946. {
  947. Commands->Set_Innate_Is_Stationary(obj, false);
  948. dont_move = true;
  949. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_SAM2 );
  950. params.Set_Movement (Commands->Find_Object(100673), RUN, 10.0f);
  951. Commands->Action_Goto( obj, params );
  952. GameObject * inn_loc = Commands->Find_Object(100718);
  953. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(inn_loc));
  954. }
  955. }
  956. if ( type == M07_HOTWIRE_CAPTURE_SAMS && (Commands->Find_Object(100905)))
  957. {
  958. Commands->Start_Timer(obj, this, 5.0f, TANK_STILL_THERE);
  959. }
  960. if(type == M07_MOVE_HOTWIRE && !dont_move)
  961. {
  962. current_move_loc = param;
  963. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), HOTWIRE_MOVE_LOC);
  964. params.Set_Movement (Commands->Find_Object(move_loc[current_move_loc]), RUN, 3.0f);
  965. Commands->Action_Goto (obj, params);
  966. }
  967. }
  968. void Timer_Expired(GameObject * obj, int timer_id)
  969. {
  970. ActionParamsStruct params;
  971. if(timer_id == M07_GO_EVAC_SITE && !go_evac_site && !evac)
  972. {
  973. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  974. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  975. Commands->Action_Goto (obj, params);
  976. }
  977. if(timer_id == ATTACK_SAM1 && !evac)
  978. {
  979. // Custom to change SAMs playertype to GDI
  980. Commands->Send_Custom_Event (obj, Commands->Find_Object(100674), M07_CHANGE_SAM_TEAM, 1, 0.0f);
  981. Commands->Send_Custom_Event (obj, Commands->Find_Object(100679), M07_CHANGE_SAM_TEAM, 1, 0.0f);
  982. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  983. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_SAM2 );
  984. params.Set_Movement (Commands->Find_Object(100673), RUN, 10.0f);
  985. Commands->Action_Goto( obj, params );
  986. }
  987. if(timer_id == ATTACK_SAM2 && !evac)
  988. {
  989. // Custom to change SAMs playertype to GDI
  990. Commands->Send_Custom_Event (obj, Commands->Find_Object(100673), M07_CHANGE_SAM_TEAM, 1, 0.0f);
  991. Commands->Send_Custom_Event (obj, Commands->Find_Object(100680), M07_CHANGE_SAM_TEAM, 1, 0.0f);
  992. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  993. Commands->Select_Weapon(obj, NULL );
  994. }
  995. if(timer_id == MOVE_LOC_LOW_PRIORITY)
  996. {
  997. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), HOTWIRE_MOVE_LOC);
  998. params.Set_Movement (Commands->Find_Object(move_loc[current_move_loc]), RUN, 3.0f);
  999. Commands->Action_Goto (obj, params);
  1000. }
  1001. if(timer_id == TANK_STILL_THERE)
  1002. {
  1003. Commands->Send_Custom_Event (obj, obj, M07_HOTWIRE_CAPTURE_SAMS, 1, 0.0f);
  1004. }
  1005. }
  1006. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1007. {
  1008. ActionParamsStruct params;
  1009. if (action_id == ARRIVE_EVAC_SPOT && reason == ACTION_COMPLETE_NORMAL && evac)
  1010. {
  1011. int dead6_id = Commands->Get_ID(obj);
  1012. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  1013. }
  1014. if (action_id == ARRIVE_EVAC_SPOT && reason == ACTION_COMPLETE_MOVE_NO_PROGRESS_MADE && evac)
  1015. {
  1016. // This is a hack for the moment, need to have pathfinding around dec_phys vehicles at inn
  1017. int dead6_id = Commands->Get_ID(obj);
  1018. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, dead6_id, 0.0f);
  1019. }
  1020. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_NORMAL && !evac)
  1021. {
  1022. go_evac_site = true;
  1023. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj));
  1024. }
  1025. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_LOW_PRIORITY && !evac)
  1026. {
  1027. Commands->Start_Timer(obj, this, 6.0f, M07_GO_EVAC_SITE);
  1028. }
  1029. if (action_id == GO_SAM1 && reason == ACTION_COMPLETE_NORMAL && !evac)
  1030. {
  1031. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100 );
  1032. params.Set_Attack (Commands->Find_Object(100679), 250.0f, 0.0f, 0);
  1033. params.AttackCheckBlocked = true;
  1034. Commands->Action_Attack( obj, params );
  1035. Commands->Start_Timer(obj, this, 6.0f, ATTACK_SAM1);
  1036. }
  1037. if (action_id == GO_SAM1 && reason == ACTION_COMPLETE_LOW_PRIORITY && !evac)
  1038. {
  1039. // Keep trying to GO_SAM1
  1040. Commands->Send_Custom_Event (obj, HOTWIRE, M07_HOTWIRE_CAPTURE_SAMS, 1, 2.0f);
  1041. }
  1042. if (action_id == GO_SAM2 && reason == ACTION_COMPLETE_NORMAL && !evac)
  1043. {
  1044. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100 );
  1045. params.Set_Attack (Commands->Find_Object(100680), 250.0f, 0.0f, 0);
  1046. params.AttackCheckBlocked = true;
  1047. Commands->Action_Attack( obj, params );
  1048. Commands->Start_Timer(obj, this, 6.0f, ATTACK_SAM2);
  1049. }
  1050. if(action_id == HOTWIRE_MOVE_LOC && reason == ACTION_COMPLETE_NORMAL && !evac)
  1051. {
  1052. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  1053. }
  1054. if(action_id == HOTWIRE_MOVE_LOC && reason == ACTION_COMPLETE_LOW_PRIORITY && !evac)
  1055. {
  1056. Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
  1057. }
  1058. }
  1059. void Destroyed(GameObject * obj)
  1060. {
  1061. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_DEAD6_EVAC, 1, 0.0f);
  1062. }
  1063. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  1064. {
  1065. if (sound.Type == M07_NUKE_IMPACT)
  1066. {
  1067. if(nuke_blast)
  1068. {
  1069. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  1070. }
  1071. }
  1072. }
  1073. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1074. {
  1075. if(damager == obj || damager == DEADEYE || damager == GUNNER || damager == HOTWIRE)
  1076. {
  1077. Commands->Set_Health(obj, health);
  1078. Commands->Set_Shield_Strength(obj, shield);
  1079. }
  1080. else
  1081. {
  1082. health = Commands->Get_Health(obj);
  1083. shield = Commands->Get_Shield_Strength(obj);
  1084. }
  1085. }
  1086. void Killed (GameObject * obj, GameObject * killer)
  1087. {
  1088. // Hotwire Killed
  1089. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0174I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  1090. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 2, 1.0f);
  1091. }
  1092. };
  1093. DECLARE_SCRIPT(M07_Sydney, "")
  1094. {
  1095. bool nuke_blast;
  1096. float health;
  1097. float shield;
  1098. // Register variables to be Auto-Saved
  1099. // All variables must have a unique ID, less than 256, that never changes
  1100. REGISTER_VARIABLES()
  1101. {
  1102. SAVE_VARIABLE( nuke_blast, 1 );
  1103. SAVE_VARIABLE( health, 2 );
  1104. SAVE_VARIABLE( shield, 3 );
  1105. }
  1106. void Created(GameObject * obj)
  1107. {
  1108. nuke_blast = true;
  1109. Commands->Set_Innate_Is_Stationary(obj, true);
  1110. Commands->Enable_Hibernation(obj, false);
  1111. health = Commands->Get_Max_Health(obj);
  1112. shield = Commands->Get_Max_Shield_Strength(obj);
  1113. // Give Sydney initial pistol
  1114. Commands->Give_PowerUp(obj, "POW_Pistol_AI");
  1115. Commands->Select_Weapon(obj, "Weapon_Pistol_Ai" );
  1116. }
  1117. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1118. {
  1119. ActionParamsStruct params;
  1120. if ( type == M07_GO_ASSEMBLY )
  1121. {
  1122. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, M07_GO_ASSEMBLY );
  1123. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1124. params.WaypathID = 102479;
  1125. Commands->Action_Goto (obj, params);
  1126. }
  1127. if(type == M07_GO_EVAC_SITE)
  1128. {
  1129. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  1130. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  1131. Commands->Action_Goto (obj, params);
  1132. }
  1133. if ( type == M07_NUKE_BLAST )
  1134. {
  1135. nuke_blast = (param == 1) ? true : false;
  1136. }
  1137. if ( type == M07_CAPTURE_SAM )
  1138. {
  1139. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), M07_CAPTURE_SAM);
  1140. params.Set_Movement (Commands->Find_Object(100664), RUN, 3.0f);
  1141. Commands->Action_Goto (obj, params);
  1142. Commands->Enable_Hibernation(obj, true);
  1143. }
  1144. }
  1145. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1146. {
  1147. if (action_id == M07_CAPTURE_SAM && reason == ACTION_COMPLETE_NORMAL)
  1148. {
  1149. Commands->Set_Innate_Is_Stationary(obj, true);
  1150. }
  1151. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_NORMAL)
  1152. {
  1153. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj));
  1154. }
  1155. if (action_id == M07_GO_EVAC_SITE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1156. {
  1157. Commands->Start_Timer(obj, this, 6.0f, M07_GO_EVAC_SITE);
  1158. }
  1159. }
  1160. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  1161. {
  1162. if (sound.Type == M07_NUKE_IMPACT)
  1163. {
  1164. if(nuke_blast)
  1165. {
  1166. Commands->Apply_Damage( obj, 10000.0f, "STEEL");
  1167. }
  1168. }
  1169. }
  1170. void Timer_Expired(GameObject * obj, int timer_id)
  1171. {
  1172. ActionParamsStruct params;
  1173. if(timer_id == M07_GO_EVAC_SITE)
  1174. {
  1175. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), M07_GO_EVAC_SITE);
  1176. params.Set_Movement (Commands->Find_Object(100664), RUN, 10.0f);
  1177. Commands->Action_Goto (obj, params);
  1178. }
  1179. }
  1180. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1181. {
  1182. if(damager == obj || damager == DEADEYE || damager == GUNNER || damager == HOTWIRE || damager == PATCH)
  1183. {
  1184. Commands->Set_Health(obj, health);
  1185. Commands->Set_Shield_Strength(obj, shield);
  1186. }
  1187. else
  1188. {
  1189. health = Commands->Get_Health(obj);
  1190. shield = Commands->Get_Shield_Strength(obj);
  1191. }
  1192. }
  1193. void Killed (GameObject * obj, GameObject * killer)
  1194. {
  1195. // Sydney Killed
  1196. Commands->Set_HUD_Help_Text ( IDS_M11DSGN_DSGN1008I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  1197. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 701, 2, 1.0f);
  1198. }
  1199. };
  1200. DECLARE_SCRIPT(M07_Cathedral_Controller, "") // 100663
  1201. {
  1202. enum{TWO_MIN, ONE_MIN, THIRTY, TWENTY, TEN, FIVE, FOUR, THREE, TWO, ONE, ESCAPED, NUKEBITS};
  1203. // Register variables to be Auto-Saved
  1204. // All variables must have a unique ID, less than 256, that never changes
  1205. REGISTER_VARIABLES()
  1206. {
  1207. // SAVE_VARIABLE( alarmed, 1 );
  1208. }
  1209. void Created(GameObject * obj)
  1210. {
  1211. }
  1212. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1213. {
  1214. ActionParamsStruct params;
  1215. if ( type == M07_GO_EVAC_SITE )
  1216. {
  1217. // Impact: 2 Minutes.\n
  1218. const char *conv_name = ("M07_CON003");
  1219. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1220. Commands->Join_Conversation(NULL, conv_id, false, true);
  1221. Commands->Start_Conversation (conv_id, 10);
  1222. Commands->Start_Timer(obj, this, 60.0f, TWO_MIN);
  1223. }
  1224. }
  1225. void Timer_Expired(GameObject * obj, int timer_id)
  1226. {
  1227. if(timer_id == TWO_MIN)
  1228. {
  1229. // Impact: 1 Minute.\n
  1230. const char *conv_name = ("M07_CON004");
  1231. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1232. Commands->Join_Conversation(NULL, conv_id, false, true);
  1233. Commands->Start_Conversation (conv_id, 10);
  1234. Commands->Start_Timer(obj, this, 30.0f, ONE_MIN);
  1235. }
  1236. if(timer_id == ONE_MIN)
  1237. {
  1238. // Impact: 30 seconds.\n
  1239. const char *conv_name = ("M07_CON005");
  1240. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1241. Commands->Join_Conversation(NULL, conv_id, false, true);
  1242. Commands->Start_Conversation (conv_id, 10);
  1243. Commands->Start_Timer(obj, this, 10.0f, THIRTY);
  1244. }
  1245. if(timer_id == THIRTY)
  1246. {
  1247. // Impact: 20 seconds.\n
  1248. const char *conv_name = ("M07_CON006");
  1249. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1250. Commands->Join_Conversation(NULL, conv_id, false, true);
  1251. Commands->Start_Conversation (conv_id, 10);
  1252. Commands->Start_Timer(obj, this, 10.0f, TWENTY);
  1253. }
  1254. if(timer_id == TWENTY)
  1255. {
  1256. // Impact: 10 seconds.\n
  1257. const char *conv_name = ("M07_CON007");
  1258. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1259. Commands->Join_Conversation(NULL, conv_id, false, true);
  1260. Commands->Start_Conversation (conv_id, 10);
  1261. Commands->Start_Timer(obj, this, 5.0f, TEN);
  1262. }
  1263. if(timer_id == TEN)
  1264. {
  1265. // Impact: 5 seconds.\n
  1266. const char *conv_name = ("M07_CON008");
  1267. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1268. Commands->Join_Conversation(NULL, conv_id, false, true);
  1269. Commands->Start_Conversation (conv_id, 10);
  1270. Commands->Start_Timer(obj, this, 1.0f, FIVE);
  1271. }
  1272. if(timer_id == FIVE)
  1273. {
  1274. GameObject * cinematic_controller = Commands->Create_Object ( "Invisible_Object", Vector3(-100.879f, 88.570f, 29.184f));
  1275. Commands->Attach_Script(cinematic_controller, "Test_Cinematic", "XG_NukeStrike.txt");
  1276. // 4 seconds.\n
  1277. const char *conv_name = ("M07_CON009");
  1278. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1279. Commands->Join_Conversation(NULL, conv_id, false, true);
  1280. Commands->Start_Conversation (conv_id, 10);
  1281. Commands->Start_Timer(obj, this, 1.0f, FOUR);
  1282. }
  1283. if(timer_id == FOUR)
  1284. {
  1285. // 3 seconds.\n
  1286. const char *conv_name = ("M07_CON010");
  1287. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1288. Commands->Join_Conversation(NULL, conv_id, false, true);
  1289. Commands->Start_Conversation (conv_id, 10);
  1290. Commands->Start_Timer(obj, this, 1.0f, THREE);
  1291. }
  1292. if(timer_id == THREE)
  1293. {
  1294. // 2 seconds.\n
  1295. const char *conv_name = ("M07_CON011");
  1296. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1297. Commands->Join_Conversation(NULL, conv_id, false, true);
  1298. Commands->Start_Conversation (conv_id, 10);
  1299. Commands->Start_Timer(obj, this, 1.0f, TWO);
  1300. }
  1301. if(timer_id == TWO)
  1302. {
  1303. // 1 seconds.\n
  1304. const char *conv_name = ("M07_CON012");
  1305. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1306. Commands->Join_Conversation(NULL, conv_id, false, true);
  1307. Commands->Start_Conversation (conv_id, 10);
  1308. Commands->Start_Timer(obj, this, 1.0f, ONE);
  1309. Commands->Set_Clouds (1.0f, 1.0f, 3.0f);
  1310. }
  1311. if(timer_id == ONE)
  1312. {
  1313. // Send customs to Nuke Blast Radius determination zones to deactivate them
  1314. Commands->Send_Custom_Event (obj, Commands->Find_Object(100665), M07_DEACTIVATE_NUKE_BLAST, 1, 0.0f);
  1315. Commands->Send_Custom_Event (obj, Commands->Find_Object(100666), M07_DEACTIVATE_NUKE_BLAST, 1, 0.0f);
  1316. // Boom!
  1317. Commands->Create_Logical_Sound(obj, M07_NUKE_IMPACT, Commands->Get_Position(obj), 2500.0f);
  1318. Commands->Set_Ash(0.15f, 3.0f, false);
  1319. Commands->Set_Wind(90.0f, 5.0f, 2.0f, 0.0f);
  1320. Commands->Start_Timer(obj, this, 2.0f, NUKEBITS);
  1321. }
  1322. if(timer_id == NUKEBITS)
  1323. {
  1324. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(119890)));
  1325. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(119891)));
  1326. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(119892)));
  1327. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(119893)));
  1328. GameObject * nukebits = Commands->Create_Object("M07_Nukebits", Vector3(-128.295f, 71.892f, 26.754f));
  1329. Commands->Set_Facing( nukebits, -10.000f );
  1330. Commands->Start_Timer(obj, this, 3.0f, ESCAPED);
  1331. }
  1332. if(timer_id == ESCAPED)
  1333. {
  1334. if(SYDNEY)
  1335. {
  1336. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 1, 0.0f);
  1337. }
  1338. }
  1339. }
  1340. };
  1341. DECLARE_SCRIPT(M07_In_Nuke_Blast, "")
  1342. {
  1343. bool already_entered;
  1344. bool star_in_blast;
  1345. bool active;
  1346. // Register variables to be Auto-Saved
  1347. // All variables must have a unique ID, less than 256, that never changes
  1348. REGISTER_VARIABLES()
  1349. {
  1350. SAVE_VARIABLE( already_entered, 1 );
  1351. SAVE_VARIABLE( star_in_blast, 2 );
  1352. SAVE_VARIABLE( active, 3 );
  1353. }
  1354. void Created (GameObject * obj)
  1355. {
  1356. already_entered = false;
  1357. star_in_blast = true;
  1358. active = true;
  1359. }
  1360. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1361. {
  1362. if ( type == M07_NUKE_BLAST )
  1363. {
  1364. star_in_blast = false;
  1365. }
  1366. if ( type == M07_DEACTIVATE_NUKE_BLAST )
  1367. {
  1368. active = false;
  1369. }
  1370. }
  1371. void Entered (GameObject * obj, GameObject * enterer)
  1372. {
  1373. if(!active)
  1374. {
  1375. return;
  1376. }
  1377. // Send to enterer to let script know in blast zone
  1378. Commands->Send_Custom_Event (obj, enterer, M07_NUKE_BLAST, 1, 0.0f);
  1379. if(!star_in_blast && enterer == STAR)
  1380. {
  1381. star_in_blast = true;
  1382. // Send custom to in blast script to let it know player is out of blast
  1383. Commands->Send_Custom_Event (obj, Commands->Find_Object(100666), M07_NUKE_BLAST, 1, 0.0f);
  1384. // Warning - Your are within the Nuclear Strike blast radius. Evacuate immediately.\n
  1385. const char *conv_name = ("M07_CON013");
  1386. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1387. Commands->Join_Conversation(NULL, conv_id, false, true);
  1388. Commands->Start_Conversation (conv_id, 10);
  1389. }
  1390. }
  1391. };
  1392. DECLARE_SCRIPT(M07_Out_Nuke_Blast, "")
  1393. {
  1394. bool already_entered;
  1395. bool star_in_blast;
  1396. bool active;
  1397. // Register variables to be Auto-Saved
  1398. // All variables must have a unique ID, less than 256, that never changes
  1399. REGISTER_VARIABLES()
  1400. {
  1401. SAVE_VARIABLE( already_entered, 1 );
  1402. SAVE_VARIABLE( star_in_blast, 2 );
  1403. SAVE_VARIABLE( active, 3 );
  1404. }
  1405. void Created (GameObject * obj)
  1406. {
  1407. already_entered = false;
  1408. star_in_blast = true;
  1409. active = true;
  1410. }
  1411. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1412. {
  1413. if ( type == M07_NUKE_BLAST )
  1414. {
  1415. star_in_blast = true;
  1416. }
  1417. if ( type == M07_DEACTIVATE_NUKE_BLAST )
  1418. {
  1419. active = false;
  1420. }
  1421. }
  1422. void Entered (GameObject * obj, GameObject * enterer)
  1423. {
  1424. if(!active)
  1425. {
  1426. return;
  1427. }
  1428. // Send to enterer to let script know out blast zone
  1429. Commands->Send_Custom_Event (obj, enterer, M07_NUKE_BLAST, 0, 0.0f);
  1430. if(star_in_blast && enterer == STAR)
  1431. {
  1432. star_in_blast = false;
  1433. // Minimum safe distance achieved.\n
  1434. const char *conv_name = ("M07_CON014");
  1435. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1436. Commands->Join_Conversation(NULL, conv_id, false, true);
  1437. Commands->Start_Conversation (conv_id, 10);
  1438. // Send custom to in blast script to let it know player is out of blast
  1439. Commands->Send_Custom_Event (obj, Commands->Find_Object(100665), M07_NUKE_BLAST, 1, 0.0f);
  1440. }
  1441. }
  1442. };
  1443. DECLARE_SCRIPT(M07_Nod_Gun_Emplacement, "")
  1444. {
  1445. bool attacking;
  1446. enum{ATTACK_OVER};
  1447. // Register variables to be Auto-Saved
  1448. // All variables must have a unique ID, less than 256, that never changes
  1449. REGISTER_VARIABLES()
  1450. {
  1451. SAVE_VARIABLE( attacking, 1 );
  1452. }
  1453. void Created (GameObject * obj)
  1454. {
  1455. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  1456. Commands->Enable_Enemy_Seen( obj, true);
  1457. attacking = false;
  1458. }
  1459. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1460. {
  1461. ActionParamsStruct params;
  1462. if(!attacking)
  1463. {
  1464. attacking = true;
  1465. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  1466. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1467. params.AttackCheckBlocked = false;
  1468. Commands->Action_Attack( obj, params );
  1469. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  1470. }
  1471. }
  1472. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1473. {
  1474. ActionParamsStruct params;
  1475. if(!attacking)
  1476. {
  1477. attacking = true;
  1478. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  1479. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  1480. params.AttackCheckBlocked = false;
  1481. Commands->Action_Attack( obj, params );
  1482. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  1483. }
  1484. }
  1485. void Timer_Expired (GameObject* obj, int timer_id)
  1486. {
  1487. ActionParamsStruct params;
  1488. if(timer_id == ATTACK_OVER)
  1489. {
  1490. attacking = false;
  1491. }
  1492. }
  1493. void Killed (GameObject * obj, GameObject * killer)
  1494. {
  1495. // Custom to evac site controller to count when four vehicles in area destroyed
  1496. Commands->Send_Custom_Event (obj, Commands->Find_Object(100664), M07_EVAC_SITE_VEHICLE_KILLED, 1, 0.0f);
  1497. Commands->Debug_Message("Evac Site Vehicle Killed = %d \n", Commands->Get_ID(obj));
  1498. }
  1499. };
  1500. DECLARE_SCRIPT(M07_Evac_Site_Controller, "") // 100664
  1501. {
  1502. int m07_evac_site_vehicle_killed;
  1503. enum{WHERE_EVAC};
  1504. // Register variables to be Auto-Saved
  1505. // All variables must have a unique ID, less than 256, that never changes
  1506. REGISTER_VARIABLES()
  1507. {
  1508. SAVE_VARIABLE( m07_evac_site_vehicle_killed, 1 );
  1509. }
  1510. void Created (GameObject * obj)
  1511. {
  1512. m07_evac_site_vehicle_killed = 0;
  1513. }
  1514. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1515. {
  1516. if (type == M07_EVAC_SITE_VEHICLE_KILLED)
  1517. {
  1518. m07_evac_site_vehicle_killed++;
  1519. Commands->Debug_Message("Evac Site Vehicle Killed = %d \n", m07_evac_site_vehicle_killed);
  1520. if(m07_evac_site_vehicle_killed == 4)
  1521. {
  1522. Commands->Debug_Message("Evac Site is clear. Play Locke, where evac conversation");
  1523. Commands->Start_Timer (obj, this, 4.0f, WHERE_EVAC);
  1524. }
  1525. }
  1526. }
  1527. void Timer_Expired(GameObject * obj, int timer_id )
  1528. {
  1529. if(timer_id == WHERE_EVAC)
  1530. {
  1531. // Locke, what's my evac status?\n
  1532. const char *conv_name = ("M07_CON002");
  1533. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 2000.0f, false);
  1534. Commands->Join_Conversation(STAR, conv_id, false, true);
  1535. Commands->Join_Conversation(NULL, conv_id, false, true);
  1536. Commands->Join_Conversation(GUNNER, conv_id, false, true);
  1537. Commands->Join_Conversation(HOTWIRE, conv_id, false, true);
  1538. Commands->Join_Conversation(NULL, conv_id, false, true);
  1539. Commands->Start_Conversation (conv_id, 300702);
  1540. Commands->Monitor_Conversation (obj, conv_id);
  1541. }
  1542. }
  1543. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1544. {
  1545. if (action_id == 300702 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  1546. {
  1547. // Activate Hotwire to SAM sites primary objective
  1548. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 702, 3, 0.0f);
  1549. // Customs to position team for Primary MO 702
  1550. // Hotwire
  1551. Commands->Send_Custom_Event(obj, HOTWIRE, M07_CAPTURE_SAM, 1, 0.0f);
  1552. // Patch
  1553. Commands->Send_Custom_Event(obj, PATCH, M07_CAPTURE_SAM, 1, 0.0f);
  1554. // Gunner
  1555. Commands->Send_Custom_Event(obj, GUNNER, M07_CAPTURE_SAM, 1, 0.0f);
  1556. // Deadeye
  1557. Commands->Send_Custom_Event(obj, DEADEYE, M07_CAPTURE_SAM, 1, 0.0f);
  1558. // Sydney
  1559. Commands->Send_Custom_Event(obj, SYDNEY, M07_CAPTURE_SAM, 1, 0.0f);
  1560. }
  1561. }
  1562. };
  1563. DECLARE_SCRIPT(M07_Evac_Site_APC, "")
  1564. {
  1565. void Killed (GameObject * obj, GameObject * killer)
  1566. {
  1567. // Custom to evac site controller to count when four vehicles in area destroyed
  1568. Commands->Send_Custom_Event (obj, Commands->Find_Object(100664), M07_EVAC_SITE_VEHICLE_KILLED, 1);
  1569. Commands->Debug_Message("Evac Site Vehicle Killed = %d \n", Commands->Get_ID(obj));
  1570. }
  1571. };
  1572. DECLARE_SCRIPT(M07_Evac_Site_APC_Soldier, "APC_ID=0:int")
  1573. {
  1574. int apc_id;
  1575. // Register variables to be Auto-Saved
  1576. // All variables must have a unique ID, less than 256, that never changes
  1577. REGISTER_VARIABLES()
  1578. {
  1579. // SAVE_VARIABLE( apc_id, 1 );
  1580. }
  1581. void Created (GameObject * obj)
  1582. {
  1583. ActionParamsStruct params;
  1584. apc_id = Get_Int_Parameter("APC_ID");
  1585. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 1 );
  1586. params.Set_Movement( STAR, RUN, 20.0f );
  1587. Commands->Action_Goto (obj, params);
  1588. }
  1589. void Killed (GameObject * obj, GameObject * killer)
  1590. {
  1591. if(Commands->Find_Object(apc_id))
  1592. {
  1593. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  1594. }
  1595. }
  1596. };
  1597. DECLARE_SCRIPT(M07_Evac_Site_Soldier, "APC_ID=0:int")
  1598. {
  1599. int apc_id;
  1600. // Register variables to be Auto-Saved
  1601. // All variables must have a unique ID, less than 256, that never changes
  1602. REGISTER_VARIABLES()
  1603. {
  1604. // SAVE_VARIABLE( apc_id, 1 );
  1605. }
  1606. void Created (GameObject * obj)
  1607. {
  1608. apc_id = Get_Int_Parameter("APC_ID");
  1609. Commands->Set_Innate_Is_Stationary(obj, true);
  1610. }
  1611. void Killed (GameObject * obj, GameObject * killer)
  1612. {
  1613. if(Commands->Find_Object(apc_id))
  1614. {
  1615. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  1616. }
  1617. }
  1618. };
  1619. DECLARE_SCRIPT(M07_Activate_Hotwire, "")
  1620. {
  1621. bool already_entered;
  1622. enum{HOTWIRE_CAPTURE_SAMS};
  1623. // Register variables to be Auto-Saved
  1624. // All variables must have a unique ID, less than 256, that never changes
  1625. REGISTER_VARIABLES()
  1626. {
  1627. SAVE_VARIABLE( already_entered, 1 );
  1628. }
  1629. void Created (GameObject * obj)
  1630. {
  1631. already_entered = false;
  1632. }
  1633. void Entered (GameObject * obj, GameObject * enterer)
  1634. {
  1635. if(enterer == HOTWIRE && !already_entered)
  1636. {
  1637. already_entered = true;
  1638. Commands->Enable_Spawner(100715, true);
  1639. // Keep those Nod forces off my back, Havoc. I'll crack these SAM's in no time.\n
  1640. const char *conv_name = ("M07_CON016");
  1641. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1642. Commands->Join_Conversation(HOTWIRE, conv_id, true, true);
  1643. Commands->Start_Conversation (conv_id, HOTWIRE_CAPTURE_SAMS);
  1644. Commands->Monitor_Conversation(obj, conv_id);
  1645. }
  1646. }
  1647. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1648. {
  1649. if (action_id == HOTWIRE_CAPTURE_SAMS && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1650. {
  1651. Commands->Send_Custom_Event (obj, HOTWIRE, M07_HOTWIRE_CAPTURE_SAMS, 1, 0.0f);
  1652. }
  1653. }
  1654. };
  1655. DECLARE_SCRIPT(M07_Fancy_Inn_Sam, "")
  1656. {
  1657. // Register variables to be Auto-Saved
  1658. // All variables must have a unique ID, less than 256, that never changes
  1659. REGISTER_VARIABLES()
  1660. {
  1661. // SAVE_VARIABLE( already_entered, 1 );
  1662. }
  1663. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1664. {
  1665. ActionParamsStruct params;
  1666. if(type == M07_CHANGE_SAM_TEAM)
  1667. {
  1668. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  1669. Commands->Send_Custom_Event(obj, Commands->Find_Object(100685), M07_SAM_CONVERTED, 1, 0.0f);
  1670. }
  1671. }
  1672. void Killed(GameObject * obj, GameObject * killer)
  1673. {
  1674. Commands->Send_Custom_Event(obj, Commands->Find_Object(100685), M07_SAM_KILLED, 1, 0.0f);
  1675. }
  1676. };
  1677. DECLARE_SCRIPT(M07_SAM_Truck_100680, "")
  1678. {
  1679. float health;
  1680. // Register variables to be Auto-Saved
  1681. // All variables must have a unique ID, less than 256, that never changes
  1682. REGISTER_VARIABLES()
  1683. {
  1684. SAVE_VARIABLE( health, 1 );
  1685. }
  1686. void Created (GameObject * obj)
  1687. {
  1688. health = Commands->Get_Max_Health(obj);
  1689. }
  1690. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1691. {
  1692. ActionParamsStruct params;
  1693. if(type == M07_CHANGE_SAM_TEAM)
  1694. {
  1695. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  1696. }
  1697. }
  1698. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1699. {
  1700. if(health > (.2 * Commands->Get_Max_Health(obj)))
  1701. {
  1702. float damage = health - Commands->Get_Health(obj);
  1703. damage *= 0.5f;
  1704. health -= damage;
  1705. Commands->Set_Health(obj, health);
  1706. }
  1707. }
  1708. void Killed(GameObject * obj, GameObject * killer)
  1709. {
  1710. Commands->Apply_Damage( Commands->Find_Object(100680), 10000.0f, "DEATH");
  1711. }
  1712. };
  1713. DECLARE_SCRIPT(M07_SAM_Truck_100679, "")
  1714. {
  1715. float health;
  1716. // Register variables to be Auto-Saved
  1717. // All variables must have a unique ID, less than 256, that never changes
  1718. REGISTER_VARIABLES()
  1719. {
  1720. SAVE_VARIABLE( health, 1 );
  1721. }
  1722. void Created (GameObject * obj)
  1723. {
  1724. health = Commands->Get_Max_Health(obj);
  1725. }
  1726. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1727. {
  1728. ActionParamsStruct params;
  1729. if(type == M07_CHANGE_SAM_TEAM)
  1730. {
  1731. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  1732. }
  1733. }
  1734. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1735. {
  1736. if(health > (.2 * Commands->Get_Max_Health(obj)))
  1737. {
  1738. float damage = health - Commands->Get_Health(obj);
  1739. damage *= 0.5f;
  1740. health -= damage;
  1741. Commands->Set_Health(obj, health);
  1742. }
  1743. }
  1744. void Killed(GameObject * obj, GameObject * killer)
  1745. {
  1746. Commands->Apply_Damage( Commands->Find_Object(100679), 10000.0f, "DEATH");
  1747. }
  1748. };
  1749. DECLARE_SCRIPT(M07_Fancy_Inn_Controller, "")
  1750. {
  1751. int m07_sam_converted;
  1752. int m07_sam_killed;
  1753. enum{CONTROL_SAMS, DESTROY_SYDNEY, DROP_DEAD6_INN};
  1754. // Register variables to be Auto-Saved
  1755. // All variables must have a unique ID, less than 256, that never changes
  1756. REGISTER_VARIABLES()
  1757. {
  1758. SAVE_VARIABLE( m07_sam_converted, 1 );
  1759. SAVE_VARIABLE( m07_sam_killed, 2 );
  1760. }
  1761. void Created (GameObject * obj)
  1762. {
  1763. m07_sam_converted = 0;
  1764. m07_sam_killed = 0;
  1765. }
  1766. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1767. {
  1768. if(type == M07_SAM_CONVERTED)
  1769. {
  1770. m07_sam_converted++;
  1771. if(m07_sam_converted == 1)
  1772. {
  1773. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 702, 1, 0.0f);
  1774. Commands->Enable_Spawner(100715, false);
  1775. Commands->Send_Custom_Event(obj, Commands->Find_Object(104496), M07_EVAC_INN, 1, 0.0f);
  1776. Commands->Start_Timer(obj, this, 3.0f, CONTROL_SAMS);
  1777. // Spawn DEAD6 and Sydney to evacuate
  1778. Commands->Enable_Spawner(103833, true);
  1779. Commands->Enable_Spawner(103834, true);
  1780. Commands->Enable_Spawner(103835, true);
  1781. Commands->Enable_Spawner(103836, true);
  1782. // Destroy the initial group of people
  1783. Commands->Destroy_Object(Commands->Find_Object(100659));
  1784. Commands->Destroy_Object(Commands->Find_Object(100660));
  1785. Commands->Destroy_Object(Commands->Find_Object(100661));
  1786. Commands->Destroy_Object(Commands->Find_Object(100662));
  1787. // Grant health increase medal
  1788. Commands->Create_Object ( "POW_Medal_Health", Vector3(-45.888f, -73.569f, 4.222f));
  1789. // Grant armor increase medal
  1790. Commands->Create_Object ( "POW_Medal_Armor", Vector3(-43.445f, -73.384f, 4.222f));
  1791. }
  1792. }
  1793. if(type == M07_SAM_KILLED)
  1794. {
  1795. m07_sam_killed++;
  1796. if(m07_sam_killed == 2)
  1797. {
  1798. // SAMs Killed
  1799. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0090I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  1800. // Objective failed if both SAMs destroyed
  1801. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 702, 2, 1.0f);
  1802. }
  1803. }
  1804. }
  1805. };
  1806. DECLARE_SCRIPT(M07_Inn_Apache, "")
  1807. {
  1808. bool attacking;
  1809. enum{WAYPATH, INN_PATROL, ATTACK_OVER};
  1810. // Register variables to be Auto-Saved
  1811. // All variables must have a unique ID, less than 256, that never changes
  1812. REGISTER_VARIABLES()
  1813. {
  1814. SAVE_VARIABLE( attacking, 1 );
  1815. }
  1816. void Created (GameObject * obj)
  1817. {
  1818. ActionParamsStruct params;
  1819. attacking = false;
  1820. Commands->Disable_Physical_Collisions(obj);
  1821. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  1822. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1823. params.WaypathID = 100707;
  1824. params.MovePathfind = false;
  1825. Commands->Action_Goto( obj, params );
  1826. }
  1827. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1828. {
  1829. ActionParamsStruct params;
  1830. if (action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  1831. {
  1832. Commands->Enable_Enemy_Seen(obj, true);
  1833. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INN_PATROL );
  1834. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1835. params.WaypathID = 100687;
  1836. params.MovePathfind = false;
  1837. Commands->Action_Attack( obj, params );
  1838. }
  1839. }
  1840. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  1841. {
  1842. ActionParamsStruct params;
  1843. if(!attacking)
  1844. {
  1845. attacking = true;
  1846. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INN_PATROL );
  1847. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  1848. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  1849. params.WaypathID = 100687;
  1850. params.MovePathfind = false;
  1851. Commands->Modify_Action (obj, INN_PATROL, params);
  1852. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  1853. }
  1854. }
  1855. void Timer_Expired (GameObject* obj, int timer_id)
  1856. {
  1857. ActionParamsStruct params;
  1858. if(timer_id == ATTACK_OVER)
  1859. {
  1860. attacking = false;
  1861. }
  1862. }
  1863. };
  1864. DECLARE_SCRIPT(M07_Activate_Objective_704, "")
  1865. {
  1866. bool already_entered;
  1867. // Register variables to be Auto-Saved
  1868. // All variables must have a unique ID, less than 256, that never changes
  1869. REGISTER_VARIABLES()
  1870. {
  1871. SAVE_VARIABLE( already_entered, 1 );
  1872. }
  1873. void Created (GameObject * obj)
  1874. {
  1875. already_entered = false;
  1876. }
  1877. void Entered (GameObject * obj, GameObject * enterer)
  1878. {
  1879. if (Commands->Is_A_Star(enterer) && !already_entered )
  1880. {
  1881. already_entered = true;
  1882. // Attention GDI, this is Resistance Radio. Nod's aerial reinforcements are coordinated from mobile radar stations in the Town Square. We need those radar dishes destroyed.\n
  1883. const char *conv_name = ("M07_CON018");
  1884. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1885. Commands->Join_Conversation(NULL, conv_id, false, true);
  1886. Commands->Join_Conversation(STAR, conv_id, false, true);
  1887. Commands->Start_Conversation (conv_id, 300704);
  1888. Commands->Monitor_Conversation (obj, conv_id);
  1889. // Engineers in Town Square
  1890. Commands->Enable_Spawner(100726, true);
  1891. Commands->Enable_Spawner(100727, true);
  1892. Commands->Send_Custom_Event(obj, Commands->Find_Object(100746), M07_TOWNSQUARE_CHINOOK, 1, 0.0f);
  1893. }
  1894. }
  1895. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1896. {
  1897. if (action_id == 300704 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  1898. {
  1899. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 704, 3, 0.0f);
  1900. }
  1901. }
  1902. };
  1903. DECLARE_SCRIPT(M07_Activate_Objective_705, "")
  1904. {
  1905. bool already_entered;
  1906. // Register variables to be Auto-Saved
  1907. // All variables must have a unique ID, less than 256, that never changes
  1908. REGISTER_VARIABLES()
  1909. {
  1910. SAVE_VARIABLE( already_entered, 1 );
  1911. }
  1912. void Created (GameObject * obj)
  1913. {
  1914. already_entered = false;
  1915. }
  1916. void Entered (GameObject * obj, GameObject * enterer)
  1917. {
  1918. if (Commands->Is_A_Star(enterer) && !already_entered )
  1919. {
  1920. already_entered = true;
  1921. // This is Resistance Radio, I have reports of captured resistance fighters west of your position. Can anyone assist?\n
  1922. const char *conv_name = ("M07_CON019");
  1923. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1924. Commands->Join_Conversation(NULL, conv_id, false, true);
  1925. Commands->Join_Conversation(STAR, conv_id, false, true);
  1926. Commands->Start_Conversation (conv_id, 300705);
  1927. Commands->Monitor_Conversation (obj, conv_id);
  1928. }
  1929. }
  1930. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1931. {
  1932. if (action_id == 300705 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  1933. {
  1934. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 705, 3, 0.0f);
  1935. }
  1936. }
  1937. };
  1938. DECLARE_SCRIPT(M07_Activate_Objective_706, "")
  1939. {
  1940. bool already_entered;
  1941. // Register variables to be Auto-Saved
  1942. // All variables must have a unique ID, less than 256, that never changes
  1943. REGISTER_VARIABLES()
  1944. {
  1945. SAVE_VARIABLE( already_entered, 1 );
  1946. }
  1947. void Created (GameObject * obj)
  1948. {
  1949. already_entered = false;
  1950. }
  1951. void Entered (GameObject * obj, GameObject * enterer)
  1952. {
  1953. if (Commands->Is_A_Star(enterer) && !already_entered )
  1954. {
  1955. already_entered = true;
  1956. // Havoc, we've spotted an SSM napalm stockpile to your west.\n
  1957. const char *conv_name = ("M07_CON020");
  1958. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1959. Commands->Join_Conversation(NULL, conv_id, false, true);
  1960. Commands->Join_Conversation(STAR, conv_id, false, true);
  1961. Commands->Start_Conversation (conv_id, 300706);
  1962. Commands->Monitor_Conversation (obj, conv_id);
  1963. }
  1964. }
  1965. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1966. {
  1967. if (action_id == 300706 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  1968. {
  1969. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 706, 3, 0.0f);
  1970. }
  1971. }
  1972. };
  1973. DECLARE_SCRIPT(M07_Activate_Objective_707, "")
  1974. {
  1975. bool already_entered;
  1976. // Register variables to be Auto-Saved
  1977. // All variables must have a unique ID, less than 256, that never changes
  1978. REGISTER_VARIABLES()
  1979. {
  1980. SAVE_VARIABLE( already_entered, 1 );
  1981. }
  1982. void Created (GameObject * obj)
  1983. {
  1984. already_entered = false;
  1985. }
  1986. void Entered (GameObject * obj, GameObject * enterer)
  1987. {
  1988. if (Commands->Is_A_Star(enterer) && !already_entered )
  1989. {
  1990. already_entered = true;
  1991. // Those must be the SSMs. Time to get to work.\n
  1992. const char *conv_name = ("M07_CON021");
  1993. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1994. Commands->Join_Conversation(STAR, conv_id, false, true);
  1995. Commands->Start_Conversation (conv_id, 300707);
  1996. Commands->Monitor_Conversation (obj, conv_id);
  1997. }
  1998. }
  1999. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2000. {
  2001. if (action_id == 300707 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  2002. {
  2003. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 707, 3, 0.0f);
  2004. }
  2005. }
  2006. };
  2007. DECLARE_SCRIPT(M07_Activate_Objective_708, "")
  2008. {
  2009. bool already_entered;
  2010. // Register variables to be Auto-Saved
  2011. // All variables must have a unique ID, less than 256, that never changes
  2012. REGISTER_VARIABLES()
  2013. {
  2014. SAVE_VARIABLE( already_entered, 1 );
  2015. }
  2016. void Created (GameObject * obj)
  2017. {
  2018. already_entered = false;
  2019. }
  2020. void Entered (GameObject * obj, GameObject * enterer)
  2021. {
  2022. if (Commands->Is_A_Star(enterer) && !already_entered )
  2023. {
  2024. already_entered = true;
  2025. // \\Warning - Nod Obelisk detected.\n
  2026. const char *conv_name = ("M07_CON022");
  2027. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2028. Commands->Join_Conversation(NULL, conv_id, false, true);
  2029. Commands->Join_Conversation(STAR, conv_id, false, true);
  2030. Commands->Start_Conversation (conv_id, 300708);
  2031. Commands->Monitor_Conversation (obj, conv_id);
  2032. }
  2033. }
  2034. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2035. {
  2036. if (action_id == 300708 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  2037. {
  2038. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 708, 3, 0.0f);
  2039. }
  2040. }
  2041. };
  2042. DECLARE_SCRIPT(M07_Activate_Objective_710, "")
  2043. {
  2044. bool already_entered;
  2045. // Register variables to be Auto-Saved
  2046. // All variables must have a unique ID, less than 256, that never changes
  2047. REGISTER_VARIABLES()
  2048. {
  2049. SAVE_VARIABLE( already_entered, 1 );
  2050. }
  2051. void Created (GameObject * obj)
  2052. {
  2053. already_entered = false;
  2054. }
  2055. void Entered (GameObject * obj, GameObject * enterer)
  2056. {
  2057. if ( Commands->Is_A_Star(enterer) )
  2058. {
  2059. already_entered = true;
  2060. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 710, 3, 0.0f);
  2061. }
  2062. }
  2063. };
  2064. DECLARE_SCRIPT(M07_SAM_Site_Logic, "")
  2065. {
  2066. bool target_acquired;
  2067. int current, ignore_ids[10];
  2068. REGISTER_VARIABLES()
  2069. {
  2070. SAVE_VARIABLE(target_acquired, 1);
  2071. SAVE_VARIABLE(ignore_ids, 2);
  2072. SAVE_VARIABLE(current, 3);
  2073. }
  2074. void Created(GameObject * obj)
  2075. {
  2076. Commands->Enable_Enemy_Seen(obj, true);
  2077. target_acquired = false;
  2078. current = 0;
  2079. for (int x = 0; x < 10; x++)
  2080. {
  2081. ignore_ids[x] = 0;
  2082. }
  2083. Commands->Start_Timer(obj, this, Commands->Get_Random(2, 3), 1);
  2084. }
  2085. bool Is_Ignore_Target(int id)
  2086. {
  2087. bool retval = false;
  2088. for (int x = 0; x < current; x++)
  2089. {
  2090. if (ignore_ids[x] == id)
  2091. {
  2092. retval = true;
  2093. break;
  2094. }
  2095. }
  2096. return retval;
  2097. }
  2098. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  2099. {
  2100. if (target_acquired)
  2101. {
  2102. return;
  2103. }
  2104. if (Commands->Is_A_Star(enemy) || Is_Ignore_Target(Commands->Get_ID(enemy)))
  2105. {
  2106. return;
  2107. }
  2108. Vector3 target_pos = Commands->Get_Position(enemy);
  2109. Vector3 my_pos = Commands->Get_Position(obj);
  2110. if (target_pos.Z - my_pos.Z >= 5.0f)
  2111. {
  2112. target_acquired = true;
  2113. ActionParamsStruct params;
  2114. params.Set_Basic(this, 90, 0);
  2115. params.Set_Attack(enemy, 500.0f, 0.0f, true);
  2116. params.AttackCheckBlocked = false;
  2117. Commands->Action_Attack(obj, params);
  2118. Commands->Start_Timer(obj, this, 2.0f, 0);
  2119. }
  2120. }
  2121. void Timer_Expired(GameObject * obj, int timer_id)
  2122. {
  2123. if (timer_id == 0)
  2124. {
  2125. target_acquired = false;
  2126. Commands->Action_Reset(obj, 95);
  2127. }
  2128. if (timer_id == 1)
  2129. {
  2130. Vector3 my_target = Commands->Get_Position(obj);
  2131. my_target.X += Commands->Get_Random( -10.0f , 10.0f);
  2132. my_target.Y += Commands->Get_Random( -10.0f , 10.0f);
  2133. my_target.Z += Commands->Get_Random( 2.0f, 6.0f);
  2134. ActionParamsStruct params;
  2135. params.Set_Basic( this, 80, 20 );
  2136. params.Set_Attack( my_target, 0, 0, true );
  2137. params.AttackCheckBlocked = true;
  2138. Commands->Action_Attack (obj, params);
  2139. Commands->Start_Timer(obj, this, Commands->Get_Random(2, 3), 1);
  2140. }
  2141. }
  2142. void Killed(GameObject * obj, GameObject * killer)
  2143. {
  2144. // Vector3 my_position = Commands->Get_Position ( obj );
  2145. // float my_facing = Commands->Get_Facing ( obj );
  2146. // GameObject * destroyedSam = Commands->Create_Object ( "M01_Destroyed_SAM", my_position);
  2147. // Commands->Set_Facing ( destroyedSam, my_facing );
  2148. // Commands->Attach_Script(destroyedSam, "M07_Destroyed_SAM_Site", "");
  2149. }
  2150. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2151. {
  2152. if (type == M00_CUSTOM_SAM_SITE_IGNORE && current < 10)
  2153. {
  2154. ignore_ids[current++] = param;
  2155. }
  2156. }
  2157. };
  2158. DECLARE_SCRIPT(M07_Destroyed_SAM_Site, "")
  2159. {
  2160. void Created(GameObject * obj)
  2161. {
  2162. Commands->Start_Timer(obj, this, 1.0f, 0);
  2163. }
  2164. void Timer_Expired(GameObject * obj, int timer_id)
  2165. {
  2166. Commands->Create_2D_Sound("00-N170E");
  2167. }
  2168. };
  2169. DECLARE_SCRIPT(M07_Mobile_Radar, "")
  2170. {
  2171. // Register variables to be Auto-Saved
  2172. // All variables must have a unique ID, less than 256, that never changes
  2173. REGISTER_VARIABLES()
  2174. {
  2175. // SAVE_VARIABLE( already_entered, 1 );
  2176. }
  2177. void Created (GameObject * obj)
  2178. {
  2179. Commands->Set_Animation(obj, "v_nod_radar.v_nod_radar", true);
  2180. }
  2181. void Damaged(GameObject * obj, GameObject * damager, float amount)
  2182. {
  2183. if(Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  2184. {
  2185. Commands->Create_Logical_Sound(obj, M07_RADAR_DAMAGED, Commands->Get_Position(obj), 10.0f);
  2186. }
  2187. else
  2188. {
  2189. Commands->Create_Logical_Sound(obj, M07_RADAR_FIXED, Commands->Get_Position(obj), 10.0f);
  2190. }
  2191. }
  2192. void Killed(GameObject * obj, GameObject * killer)
  2193. {
  2194. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(obj));
  2195. Commands->Send_Custom_Event(obj, Commands->Find_Object(100746), M07_RADAR_KILLED, 0, 0.0f);
  2196. }
  2197. };
  2198. DECLARE_SCRIPT(M07_Radar_Engineer, "Radar_ID=0:int")
  2199. {
  2200. enum{GO_RADAR};
  2201. // Register variables to be Auto-Saved
  2202. // All variables must have a unique ID, less than 256, that never changes
  2203. REGISTER_VARIABLES()
  2204. {
  2205. // SAVE_VARIABLE( already_entered, 1 );
  2206. }
  2207. void Created (GameObject * obj)
  2208. {
  2209. Commands->Enable_Enemy_Seen(obj, false);
  2210. int radar_id = Get_Int_Parameter("Radar_ID");
  2211. ActionParamsStruct params;
  2212. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_RADAR);
  2213. params.Set_Movement(Commands->Find_Object(radar_id), RUN, 1.0f);
  2214. Commands->Action_Goto(obj, params);
  2215. }
  2216. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  2217. {
  2218. ActionParamsStruct params;
  2219. if (sound.Type == M07_RADAR_DAMAGED)
  2220. {
  2221. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100 );
  2222. params.Set_Attack (sound.Creator, 250.0f, 0.0f, 0);
  2223. params.AttackCheckBlocked = false;
  2224. Commands->Action_Attack( obj, params );
  2225. }
  2226. if (sound.Type == M07_RADAR_FIXED)
  2227. {
  2228. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  2229. }
  2230. }
  2231. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2232. {
  2233. if (action_id == GO_RADAR && reason == ACTION_COMPLETE_NORMAL)
  2234. {
  2235. Commands->Set_Innate_Is_Stationary(obj, true);
  2236. }
  2237. }
  2238. };
  2239. DECLARE_SCRIPT(M07_TownSquare_Unit, "Spawn_ID=0:int, Waypath_ID=0:int")
  2240. {
  2241. enum{WAYPATH};
  2242. // Register variables to be Auto-Saved
  2243. // All variables must have a unique ID, less than 256, that never changes
  2244. REGISTER_VARIABLES()
  2245. {
  2246. // SAVE_VARIABLE( already_entered, 1 );
  2247. }
  2248. void Created (GameObject * obj)
  2249. {
  2250. ActionParamsStruct params;
  2251. int waypath_id = Get_Int_Parameter("Waypath_ID");
  2252. if(waypath_id == 0)
  2253. {
  2254. Commands->Set_Innate_Is_Stationary(obj, true);
  2255. }
  2256. else
  2257. {
  2258. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2259. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  2260. params.WaypathID = waypath_id;
  2261. Commands->Action_Goto( obj, params );
  2262. }
  2263. }
  2264. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2265. {
  2266. if (action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  2267. {
  2268. Commands->Set_Innate_Is_Stationary(obj, true);
  2269. }
  2270. }
  2271. void Killed(GameObject * obj, GameObject * killer)
  2272. {
  2273. int spawn_id = Get_Int_Parameter("Spawn_ID");
  2274. Commands->Enable_Spawner(spawn_id, true);
  2275. }
  2276. };
  2277. DECLARE_SCRIPT(M07_TownSquare_Controller, "") //
  2278. {
  2279. bool chinooks_active;
  2280. int m07_radar_killed;
  2281. enum{CHINOOK1, CHINOOK2};
  2282. // Register variables to be Auto-Saved
  2283. // All variables must have a unique ID, less than 256, that never changes
  2284. REGISTER_VARIABLES()
  2285. {
  2286. SAVE_VARIABLE( chinooks_active, 1 );
  2287. SAVE_VARIABLE( m07_radar_killed, 2 );
  2288. }
  2289. void Created (GameObject * obj)
  2290. {
  2291. chinooks_active = false;
  2292. m07_radar_killed = 0;
  2293. }
  2294. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2295. {
  2296. if (type == M07_TOWNSQUARE_CHINOOK)
  2297. {
  2298. if(param == 1)
  2299. {
  2300. chinooks_active = true;
  2301. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-316.374f, -149.140f, 5.023f));
  2302. Commands->Set_Facing(chinook_obj1, 95.000f);
  2303. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_EV3_1.txt");
  2304. Commands->Start_Timer(obj, this, 20.0f, CHINOOK1);
  2305. Commands->Start_Timer(obj, this, 10.0f, CHINOOK2);
  2306. }
  2307. if(param == 0)
  2308. {
  2309. chinooks_active = false;
  2310. }
  2311. }
  2312. if (type == M07_RADAR_KILLED)
  2313. {
  2314. m07_radar_killed++;
  2315. if(m07_radar_killed == 2)
  2316. {
  2317. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 704, 1, 0.0f);
  2318. }
  2319. }
  2320. }
  2321. void Timer_Expired(GameObject * obj, int timer_id)
  2322. {
  2323. if(timer_id == CHINOOK1 && chinooks_active)
  2324. {
  2325. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-316.374f, -149.140f, 5.023f));
  2326. Commands->Set_Facing(chinook_obj1, 95.000f);
  2327. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_EV3_1.txt");
  2328. Commands->Start_Timer(obj, this, 20.0f, CHINOOK1);
  2329. }
  2330. if(timer_id == CHINOOK2 && chinooks_active)
  2331. {
  2332. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-343.696f, -145.495f, 5.136f));
  2333. Commands->Set_Facing(chinook_obj2, -55.000f);
  2334. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "M07_XG_EV3_1.txt");
  2335. Commands->Start_Timer(obj, this, 20.0f, CHINOOK2);
  2336. }
  2337. }
  2338. };
  2339. DECLARE_SCRIPT(M07_Deactivate_TownSquare_Chinook, "")
  2340. {
  2341. bool already_entered;
  2342. // Register variables to be Auto-Saved
  2343. // All variables must have a unique ID, less than 256, that never changes
  2344. REGISTER_VARIABLES()
  2345. {
  2346. SAVE_VARIABLE( already_entered, 1 );
  2347. }
  2348. void Created (GameObject * obj)
  2349. {
  2350. already_entered = false;
  2351. }
  2352. void Entered (GameObject * obj, GameObject * enterer)
  2353. {
  2354. if (Commands->Is_A_Star(enterer) && !already_entered )
  2355. {
  2356. already_entered = true;
  2357. Commands->Send_Custom_Event(obj, Commands->Find_Object(100746), M07_TOWNSQUARE_CHINOOK, 0, 0.0f);
  2358. }
  2359. }
  2360. };
  2361. DECLARE_SCRIPT(M07_TownSquare_Gun_Emp, "")
  2362. {
  2363. // Register variables to be Auto-Saved
  2364. // All variables must have a unique ID, less than 256, that never changes
  2365. REGISTER_VARIABLES()
  2366. {
  2367. // SAVE_VARIABLE( already_entered, 1 );
  2368. }
  2369. void Killed(GameObject * obj, GameObject * killer)
  2370. {
  2371. Commands->Enable_Spawner(100748, true);
  2372. }
  2373. };
  2374. DECLARE_SCRIPT(M07_Prisoner_Gate, "")
  2375. {
  2376. // Register variables to be Auto-Saved
  2377. // All variables must have a unique ID, less than 256, that never changes
  2378. REGISTER_VARIABLES()
  2379. {
  2380. // SAVE_VARIABLE( already_entered, 1 );
  2381. }
  2382. void Created (GameObject * obj)
  2383. {
  2384. Commands->Set_Animation_Frame(obj, "cht_jail.cht_jail", 0);
  2385. }
  2386. void Killed(GameObject * obj, GameObject * killer)
  2387. {
  2388. Commands->Send_Custom_Event(obj, Commands->Find_Object(115842), M07_FREE_CIV, 1, 0.0f);
  2389. Commands->Send_Custom_Event(obj, Commands->Find_Object(100751), M07_FREE_CIV, 1, 0.0f);
  2390. }
  2391. };
  2392. DECLARE_SCRIPT(M07_Captured_Civ_Resist, "")
  2393. {
  2394. bool poked;
  2395. bool freed;
  2396. // Register variables to be Auto-Saved
  2397. // All variables must have a unique ID, less than 256, that never changes
  2398. REGISTER_VARIABLES()
  2399. {
  2400. SAVE_VARIABLE( poked, 1 );
  2401. SAVE_VARIABLE( freed, 2 );
  2402. }
  2403. void Created (GameObject * obj)
  2404. {
  2405. Commands->Set_Innate_Is_Stationary(obj, true);
  2406. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  2407. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  2408. poked = false;
  2409. freed = false;
  2410. }
  2411. void Poked(GameObject * obj, GameObject * poker)
  2412. {
  2413. ActionParamsStruct params;
  2414. if ((Commands->Is_A_Star(poker)) && (!poked) && (!freed))
  2415. {
  2416. Commands->Create_Logical_Sound(obj, M07_FREE_CIV_RESIST, Commands->Get_Position(obj), 40.0f);
  2417. }
  2418. }
  2419. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  2420. {
  2421. if (sound.Type == M07_FREE_CIV_RESIST)
  2422. {
  2423. freed = true;
  2424. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2425. Commands->Set_Innate_Is_Stationary(obj, false);
  2426. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  2427. Commands->Select_Weapon(obj, "Weapon_Chaingun_Ai" );
  2428. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  2429. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 705, 1, 0.0f);
  2430. ActionParamsStruct params;
  2431. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  2432. params.Set_Movement(Commands->Find_Object(115823), RUN, 1.0f);
  2433. Commands->Action_Goto(obj, params);
  2434. }
  2435. }
  2436. void Killed(GameObject * obj, GameObject * killer)
  2437. {
  2438. // Spawn reinforcment civ resist
  2439. Commands->Send_Custom_Event(obj, Commands->Find_Object(101056), M07_SPAWN_TRIANGLE_CIV, 1, 0.0f);
  2440. }
  2441. };
  2442. DECLARE_SCRIPT(M07_Activate_Present, "")
  2443. {
  2444. bool already_entered;
  2445. // Register variables to be Auto-Saved
  2446. // All variables must have a unique ID, less than 256, that never changes
  2447. REGISTER_VARIABLES()
  2448. {
  2449. SAVE_VARIABLE( already_entered, 1 );
  2450. }
  2451. void Created (GameObject * obj)
  2452. {
  2453. already_entered = false;
  2454. }
  2455. void Entered (GameObject * obj, GameObject * enterer)
  2456. {
  2457. if ( Commands->Is_A_Star(enterer) && !already_entered)
  2458. {
  2459. already_entered = true;
  2460. // Havoc, got a present for ya.\n
  2461. const char *conv_name = ("M07_CON023");
  2462. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2463. Commands->Join_Conversation(NULL, conv_id, false, true);
  2464. Commands->Join_Conversation(STAR, conv_id, false, true);
  2465. Commands->Start_Conversation (conv_id, 300700);
  2466. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-446.944f, -25.105f, 14.134f));
  2467. Commands->Set_Facing(chinook_obj1, 155.000f);
  2468. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_VehicleDrop1.txt");
  2469. }
  2470. }
  2471. };
  2472. DECLARE_SCRIPT(M07_Player_Vehicle, "")
  2473. {
  2474. float health;
  2475. // Register variables to be Auto-Saved
  2476. // All variables must have a unique ID, less than 256, that never changes
  2477. REGISTER_VARIABLES()
  2478. {
  2479. SAVE_VARIABLE( health, 1 );
  2480. }
  2481. void Created (GameObject * obj)
  2482. {
  2483. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  2484. health = Commands->Get_Max_Health(obj);
  2485. int vehicle_id = Commands->Get_ID(obj);
  2486. // Let enemy tank drop controller know player vehicle id
  2487. Commands->Send_Custom_Event(obj, Commands->Find_Object(101131), M07_PLAYER_VEHICLE_ID, vehicle_id);
  2488. }
  2489. void Damaged(GameObject * obj, GameObject * damager, float amount)
  2490. {
  2491. if(health > (.2 * Commands->Get_Max_Health(obj)))
  2492. {
  2493. float damage = health - Commands->Get_Health(obj);
  2494. damage *= 0.5f;
  2495. health -= damage;
  2496. Commands->Set_Health(obj, health);
  2497. }
  2498. }
  2499. void Killed(GameObject * obj, GameObject * killer)
  2500. {
  2501. Commands->Send_Custom_Event(obj, Commands->Find_Object(100757), M07_PLAYER_VEHICLE_KILLED, 1);
  2502. }
  2503. };
  2504. DECLARE_SCRIPT(M07_Vehicle_Drop_Controller, "")
  2505. {
  2506. int vehicle_drop[8];
  2507. int drop_zone;
  2508. int m07_player_vehicle_killed;
  2509. // Register variables to be Auto-Saved
  2510. // All variables must have a unique ID, less than 256, that never changes
  2511. REGISTER_VARIABLES()
  2512. {
  2513. SAVE_VARIABLE( vehicle_drop, 1 );
  2514. SAVE_VARIABLE( drop_zone, 2 );
  2515. SAVE_VARIABLE( m07_player_vehicle_killed, 3 );
  2516. }
  2517. void Created (GameObject * obj)
  2518. {
  2519. vehicle_drop[0] = 100755;
  2520. vehicle_drop[1] = 100758;
  2521. vehicle_drop[2] = 100759;
  2522. vehicle_drop[3] = 100760;
  2523. vehicle_drop[4] = 100761;
  2524. vehicle_drop[5] = 100762;
  2525. vehicle_drop[6] = 100768;
  2526. vehicle_drop[7] = 100769;
  2527. drop_zone = 0;
  2528. m07_player_vehicle_killed = 0;
  2529. }
  2530. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2531. {
  2532. if (type == M07_VEHICLE_DROP_ZONE)
  2533. {
  2534. if(param == 10 && m07_player_vehicle_killed < 7)
  2535. {
  2536. // Havoc! Taking missile fire over the park. Launcher is unseen. Repeat, launcher is unseen.\n
  2537. const char *conv_name = ("M07_CON024");
  2538. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2539. Commands->Join_Conversation(NULL, conv_id, false, true);
  2540. Commands->Join_Conversation(STAR, conv_id, false, true);
  2541. Commands->Start_Conversation (conv_id, 300700);
  2542. }
  2543. else
  2544. {
  2545. drop_zone = param;
  2546. }
  2547. }
  2548. if (type == M07_PLAYER_VEHICLE_KILLED)
  2549. {
  2550. m07_player_vehicle_killed++;
  2551. if(m07_player_vehicle_killed < 4)
  2552. {
  2553. if(m07_player_vehicle_killed < 3)
  2554. {
  2555. // Got you another ride, inbound now!\n
  2556. const char *conv_name = ("M07_CON025");
  2557. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2558. Commands->Join_Conversation(NULL, conv_id, false, true);
  2559. Commands->Start_Conversation (conv_id, 300700);
  2560. GameObject * drop_loc = Commands->Find_Object(vehicle_drop[drop_zone]);
  2561. float drop_facing = Commands->Get_Facing(drop_loc);
  2562. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2563. Commands->Set_Facing(chinook_obj1, drop_facing);
  2564. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_VehicleDrop1.txt");
  2565. }
  2566. else
  2567. {
  2568. // Complements of the local resistance.\n
  2569. const char *conv_name = ("M07_CON026");
  2570. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2571. Commands->Join_Conversation(NULL, conv_id, false, true);
  2572. Commands->Join_Conversation(STAR, conv_id, false, true);
  2573. Commands->Start_Conversation (conv_id, 300700);
  2574. GameObject * drop_loc = Commands->Find_Object(vehicle_drop[drop_zone]);
  2575. float drop_facing = Commands->Get_Facing(drop_loc);
  2576. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2577. Commands->Set_Facing(chinook_obj1, drop_facing);
  2578. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_VehicleDrop4.txt");
  2579. }
  2580. }
  2581. else
  2582. {
  2583. // Last one, Captain. Recon show Nod's pulling back to the park.\n
  2584. const char *conv_name = ("M07_CON027");
  2585. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  2586. Commands->Join_Conversation(NULL, conv_id, false, true);
  2587. Commands->Join_Conversation(STAR, conv_id, false, true);
  2588. Commands->Start_Conversation (conv_id, 300700);
  2589. GameObject * drop_loc = Commands->Find_Object(vehicle_drop[drop_zone]);
  2590. float drop_facing = Commands->Get_Facing(drop_loc);
  2591. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  2592. Commands->Set_Facing(chinook_obj1, drop_facing);
  2593. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_VehicleDrop3.txt");
  2594. }
  2595. }
  2596. }
  2597. };
  2598. DECLARE_SCRIPT(M07_Vehicle_Drop_Zone, "Zone_ID=0:int")
  2599. {
  2600. bool already_entered;
  2601. // Register variables to be Auto-Saved
  2602. // All variables must have a unique ID, less than 256, that never changes
  2603. REGISTER_VARIABLES()
  2604. {
  2605. SAVE_VARIABLE( already_entered, 1 );
  2606. }
  2607. void Created (GameObject * obj)
  2608. {
  2609. already_entered = false;
  2610. }
  2611. void Entered(GameObject * obj, GameObject * enterer)
  2612. {
  2613. int zone_id = Get_Int_Parameter("Zone_ID");
  2614. if(Commands->Is_A_Star(enterer) && !already_entered)
  2615. {
  2616. if(zone_id == 10)
  2617. {
  2618. already_entered = true;
  2619. }
  2620. Commands->Send_Custom_Event(obj, Commands->Find_Object(100757), M07_VEHICLE_DROP_ZONE, zone_id);
  2621. }
  2622. }
  2623. };
  2624. DECLARE_SCRIPT(M07_Biohazard_Barrel, "")
  2625. {
  2626. enum{BOOM};
  2627. // Register variables to be Auto-Saved
  2628. // All variables must have a unique ID, less than 256, that never changes
  2629. REGISTER_VARIABLES()
  2630. {
  2631. // SAVE_VARIABLE( vehicle_drop, 1 );
  2632. }
  2633. void Created (GameObject * obj)
  2634. {
  2635. Commands->Set_Animation_Frame(obj, "o_barrl_bio.o_barrl_bio", 0);
  2636. }
  2637. void Killed(GameObject * obj, GameObject * killer)
  2638. {
  2639. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(obj));
  2640. Commands->Send_Custom_Event(obj, Commands->Find_Object(100781), M07_EXPLODE_BARRELS, 1);
  2641. }
  2642. };
  2643. DECLARE_SCRIPT(M07_Stockpile_Object, "")
  2644. {
  2645. bool damaged;
  2646. enum{BOOM, STILL_DAMAGED};
  2647. // Register variables to be Auto-Saved
  2648. // All variables must have a unique ID, less than 256, that never changes
  2649. REGISTER_VARIABLES()
  2650. {
  2651. SAVE_VARIABLE( damaged, 1 );
  2652. }
  2653. void Created (GameObject * obj)
  2654. {
  2655. damaged = false;
  2656. }
  2657. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  2658. {
  2659. if (sound.Type == M07_EXPLODE_BARRELS)
  2660. {
  2661. Commands->Apply_Damage( obj, 100000.0f, "STEEL");
  2662. }
  2663. }
  2664. void Timer_Expired(GameObject * obj, int timer_id)
  2665. {
  2666. if(timer_id == STILL_DAMAGED && damaged)
  2667. {
  2668. Commands->Create_Logical_Sound(obj, M07_ENGINEER_DAMAGED, Commands->Get_Position(obj), 40.0f);
  2669. Commands->Start_Timer(obj, this, 8.0f, STILL_DAMAGED);
  2670. damaged = true;
  2671. }
  2672. }
  2673. void Damaged(GameObject * obj, GameObject * damager, float amount)
  2674. {
  2675. if(Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  2676. {
  2677. Commands->Create_Logical_Sound(obj, M07_ENGINEER_DAMAGED, Commands->Get_Position(obj), 40.0f);
  2678. Commands->Start_Timer(obj, this, 8.0f, STILL_DAMAGED);
  2679. damaged = true;
  2680. }
  2681. else
  2682. {
  2683. damaged = false;
  2684. Commands->Create_Logical_Sound(obj, M07_ENGINEER_FIXED, Commands->Get_Position(obj), 40.0f);
  2685. }
  2686. }
  2687. };
  2688. DECLARE_SCRIPT(M07_Stockpile_Controller, "")
  2689. {
  2690. int ssm_crate_killed;
  2691. // Register variables to be Auto-Saved
  2692. // All variables must have a unique ID, less than 256, that never changes
  2693. REGISTER_VARIABLES()
  2694. {
  2695. SAVE_VARIABLE( ssm_crate_killed, 1 );
  2696. }
  2697. void Created (GameObject * obj)
  2698. {
  2699. Commands->Enable_Spawner(100795, true);
  2700. ssm_crate_killed = 0;
  2701. }
  2702. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2703. {
  2704. if (type == M07_SSM_CRATE_KILLED)
  2705. {
  2706. ssm_crate_killed++;
  2707. if(ssm_crate_killed == 4)
  2708. {
  2709. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 706, 1, 0.0f);
  2710. }
  2711. }
  2712. }
  2713. };
  2714. DECLARE_SCRIPT(M07_Stockpile_Engineer, "")
  2715. {
  2716. enum{GO_STOCKPILE};
  2717. // Register variables to be Auto-Saved
  2718. // All variables must have a unique ID, less than 256, that never changes
  2719. REGISTER_VARIABLES()
  2720. {
  2721. // SAVE_VARIABLE( already_entered, 1 );
  2722. }
  2723. void Created (GameObject * obj)
  2724. {
  2725. Commands->Enable_Enemy_Seen(obj, false);
  2726. ActionParamsStruct params;
  2727. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_STOCKPILE);
  2728. params.Set_Movement(Commands->Find_Object(100781), RUN, 1.0f);
  2729. Commands->Action_Goto(obj, params);
  2730. }
  2731. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  2732. {
  2733. ActionParamsStruct params;
  2734. if (sound.Type == M07_ENGINEER_DAMAGED)
  2735. {
  2736. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100 );
  2737. params.Set_Attack (sound.Creator, 250.0f, 0.0f, 0);
  2738. params.AttackCheckBlocked = false;
  2739. Commands->Action_Attack( obj, params );
  2740. }
  2741. if (sound.Type == M07_ENGINEER_FIXED)
  2742. {
  2743. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  2744. }
  2745. }
  2746. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2747. {
  2748. if (action_id == GO_STOCKPILE && reason == ACTION_COMPLETE_NORMAL)
  2749. {
  2750. Commands->Set_Innate_Is_Stationary(obj, true);
  2751. }
  2752. }
  2753. };
  2754. DECLARE_SCRIPT(M07_Park_Controller, "")
  2755. {
  2756. int m07_artillery_killed;
  2757. // Register variables to be Auto-Saved
  2758. // All variables must have a unique ID, less than 256, that never changes
  2759. REGISTER_VARIABLES()
  2760. {
  2761. SAVE_VARIABLE( m07_artillery_killed, 1 );
  2762. }
  2763. void Created (GameObject * obj)
  2764. {
  2765. m07_artillery_killed = 0;
  2766. }
  2767. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2768. {
  2769. if(type == M07_ARTILLERY_KILLED)
  2770. {
  2771. m07_artillery_killed++;
  2772. if(m07_artillery_killed == 2)
  2773. {
  2774. // Destroy Artillery Piece Objective
  2775. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 703, 1, 5.0f);
  2776. }
  2777. }
  2778. }
  2779. };
  2780. DECLARE_SCRIPT(M07_Park_SSM, "")
  2781. {
  2782. enum{STILL_DAMAGED};
  2783. // Register variables to be Auto-Saved
  2784. // All variables must have a unique ID, less than 256, that never changes
  2785. REGISTER_VARIABLES()
  2786. {
  2787. // SAVE_VARIABLE( destroy_stockpile, 1 );
  2788. }
  2789. void Created (GameObject * obj)
  2790. {
  2791. }
  2792. void Timer_Expired(GameObject * obj, int timer_id)
  2793. {
  2794. if(timer_id == STILL_DAMAGED)
  2795. {
  2796. if(Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  2797. {
  2798. Commands->Create_Logical_Sound(obj, M07_SSM_DAMAGED, Commands->Get_Position(obj), 1000.0f);
  2799. Commands->Start_Timer(obj, this, 10.0f, STILL_DAMAGED);
  2800. }
  2801. else
  2802. {
  2803. Commands->Create_Logical_Sound(obj, M07_SSM_FIXED, Commands->Get_Position(obj), 1000.0f);
  2804. }
  2805. }
  2806. }
  2807. void Damaged(GameObject * obj, GameObject * damager, float amount)
  2808. {
  2809. if(Commands->Get_Health(obj) < Commands->Get_Max_Health(obj))
  2810. {
  2811. Commands->Create_Logical_Sound(obj, M07_SSM_DAMAGED, Commands->Get_Position(obj), 1000.0f);
  2812. }
  2813. else
  2814. {
  2815. Commands->Create_Logical_Sound(obj, M07_SSM_FIXED, Commands->Get_Position(obj), 1000.0f);
  2816. }
  2817. }
  2818. void Killed(GameObject * obj, GameObject * killer)
  2819. {
  2820. Commands->Send_Custom_Event(obj, Commands->Find_Object(100799), M07_ARTILLERY_KILLED, 1);
  2821. }
  2822. };
  2823. DECLARE_SCRIPT(M07_Nod_Obelisk, "")
  2824. {
  2825. int obelisk_weapon_id;
  2826. bool converted;
  2827. // Register variables to be Auto-Saved
  2828. // All variables must have a unique ID, less than 256, that never changes
  2829. REGISTER_VARIABLES()
  2830. {
  2831. SAVE_VARIABLE( obelisk_weapon_id, 1 );
  2832. SAVE_VARIABLE( converted, 2 );
  2833. }
  2834. void Created (GameObject * obj)
  2835. {
  2836. obelisk_weapon_id = 0;
  2837. converted = false;
  2838. }
  2839. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2840. {
  2841. if(type == M07_PLAYERTYPE_CHANGE_OBELISK)
  2842. {
  2843. converted = true;
  2844. Commands->Set_Player_Type(Commands->Find_Object(obelisk_weapon_id), SCRIPT_PLAYERTYPE_GDI );
  2845. }
  2846. if(type == M00_OBELISK_WEAPON_ID)
  2847. {
  2848. obelisk_weapon_id = param;
  2849. }
  2850. }
  2851. void Killed (GameObject * obj, GameObject * killer)
  2852. {
  2853. if(!converted)
  2854. {
  2855. // Custom to Objective_Controller that Obelisk has been destroyed
  2856. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 708, 1, 0.0f);
  2857. // Custom to Obelisk Poke to turn it off so that it cannot be converted
  2858. Commands->Send_Custom_Event(obj, Commands->Find_Object(100805), M07_OBELISK_KILLED, 1, 0.0f);
  2859. }
  2860. }
  2861. };
  2862. DECLARE_SCRIPT(M07_Nod_Obelisk_MCT, "")
  2863. {
  2864. bool poked;
  2865. // Register variables to be Auto-Saved
  2866. // All variables must have a unique ID, less than 256, that never changes
  2867. REGISTER_VARIABLES()
  2868. {
  2869. SAVE_VARIABLE( poked, 1 );
  2870. }
  2871. void Created (GameObject * obj)
  2872. {
  2873. poked = false;
  2874. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  2875. }
  2876. void Poked(GameObject * obj, GameObject * poker)
  2877. {
  2878. if ((Commands->Is_A_Star(poker)) && (!poked))
  2879. {
  2880. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2881. Commands->Create_Sound("Computer_Operate_02", Commands->Get_Position(obj), obj);
  2882. poked = true;
  2883. // Change playertype of Nod Obelisk
  2884. Commands->Send_Custom_Event(obj, Commands->Find_Object(168926), M07_PLAYERTYPE_CHANGE_OBELISK, 1, 0.0f);
  2885. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 708, 1, 0.0f);
  2886. }
  2887. }
  2888. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2889. {
  2890. if(type == M07_OBELISK_KILLED)
  2891. {
  2892. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2893. poked = true;
  2894. }
  2895. }
  2896. };
  2897. DECLARE_SCRIPT(M07_Park_Zone, "Zone=0:int")
  2898. {
  2899. bool already_entered;
  2900. // Register variables to be Auto-Saved
  2901. // All variables must have a unique ID, less than 256, that never changes
  2902. REGISTER_VARIABLES()
  2903. {
  2904. SAVE_VARIABLE( already_entered, 1 );
  2905. }
  2906. void Created (GameObject * obj)
  2907. {
  2908. }
  2909. void Entered (GameObject * obj, GameObject * enterer)
  2910. {
  2911. if ((Commands->Is_A_Star(enterer)))
  2912. {
  2913. int activate_zone = Get_Int_Parameter("Zone");
  2914. Commands->Send_Custom_Event(obj, Commands->Find_Object(100801), M07_MOVE_STEALTH_TANK, activate_zone);
  2915. }
  2916. }
  2917. };
  2918. DECLARE_SCRIPT(M07_Activate_Encounter, "Spawner_ID1=0:int, Spawner_ID2=0:int, Spawner_ID3=0:int, Spawner_ID4=0:int, Spawner_ID5=0:int, Spawner_ID6=0:int")
  2919. {
  2920. bool already_entered;
  2921. // Register variables to be Auto-Saved
  2922. // All variables must have a unique ID, less than 256, that never changes
  2923. REGISTER_VARIABLES()
  2924. {
  2925. SAVE_VARIABLE( already_entered, 1 );
  2926. }
  2927. void Created (GameObject * obj)
  2928. {
  2929. already_entered = false;
  2930. }
  2931. void Entered (GameObject * obj, GameObject * enterer)
  2932. {
  2933. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2934. {
  2935. already_entered = true;
  2936. int spawner_id1 = Get_Int_Parameter("Spawner_ID1");
  2937. int spawner_id2 = Get_Int_Parameter("Spawner_ID2");
  2938. int spawner_id3 = Get_Int_Parameter("Spawner_ID3");
  2939. int spawner_id4 = Get_Int_Parameter("Spawner_ID4");
  2940. int spawner_id5 = Get_Int_Parameter("Spawner_ID5");
  2941. int spawner_id6 = Get_Int_Parameter("Spawner_ID6");
  2942. if(spawner_id1 != 0)
  2943. {
  2944. Commands->Enable_Spawner(spawner_id1, true);
  2945. }
  2946. if(spawner_id2 != 0)
  2947. {
  2948. Commands->Enable_Spawner(spawner_id2, true);
  2949. }
  2950. if(spawner_id3 != 0)
  2951. {
  2952. Commands->Enable_Spawner(spawner_id3, true);
  2953. }
  2954. if(spawner_id4 != 0)
  2955. {
  2956. Commands->Enable_Spawner(spawner_id4, true);
  2957. }
  2958. if(spawner_id5 != 0)
  2959. {
  2960. Commands->Enable_Spawner(spawner_id5, true);
  2961. }
  2962. if(spawner_id6 != 0)
  2963. {
  2964. Commands->Enable_Spawner(spawner_id6, true);
  2965. }
  2966. }
  2967. }
  2968. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2969. {
  2970. if (type == M07_DEACTIVATE_ENCOUNTER)
  2971. {
  2972. int spawner_id1 = Get_Int_Parameter("Spawner_ID1");
  2973. int spawner_id2 = Get_Int_Parameter("Spawner_ID2");
  2974. int spawner_id3 = Get_Int_Parameter("Spawner_ID3");
  2975. int spawner_id4 = Get_Int_Parameter("Spawner_ID4");
  2976. int spawner_id5 = Get_Int_Parameter("Spawner_ID5");
  2977. int spawner_id6 = Get_Int_Parameter("Spawner_ID6");
  2978. if(spawner_id1 != 0)
  2979. {
  2980. Commands->Enable_Spawner(spawner_id1, false);
  2981. }
  2982. if(spawner_id2 != 0)
  2983. {
  2984. Commands->Enable_Spawner(spawner_id2, false);
  2985. }
  2986. if(spawner_id3 != 0)
  2987. {
  2988. Commands->Enable_Spawner(spawner_id3, false);
  2989. }
  2990. if(spawner_id4 != 0)
  2991. {
  2992. Commands->Enable_Spawner(spawner_id4, false);
  2993. }
  2994. if(spawner_id5 != 0)
  2995. {
  2996. Commands->Enable_Spawner(spawner_id5, false);
  2997. }
  2998. if(spawner_id6 != 0)
  2999. {
  3000. Commands->Enable_Spawner(spawner_id6, false);
  3001. }
  3002. }
  3003. }
  3004. };
  3005. DECLARE_SCRIPT(M07_Deactivate_Encounter, "Activate_Zone=0:int")
  3006. {
  3007. bool already_entered;
  3008. // Register variables to be Auto-Saved
  3009. // All variables must have a unique ID, less than 256, that never changes
  3010. REGISTER_VARIABLES()
  3011. {
  3012. SAVE_VARIABLE( already_entered, 1 );
  3013. }
  3014. void Created (GameObject * obj)
  3015. {
  3016. already_entered = false;
  3017. }
  3018. void Entered (GameObject * obj, GameObject * enterer)
  3019. {
  3020. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3021. {
  3022. already_entered = true;
  3023. int activate_zone = Get_Int_Parameter("Activate_Zone");
  3024. Commands->Send_Custom_Event(obj, Commands->Find_Object(activate_zone), M07_DEACTIVATE_ENCOUNTER, 1);
  3025. }
  3026. }
  3027. };
  3028. DECLARE_SCRIPT(M07_Encounter_Unit, "Waypath_ID=0:int, Priority=0:int, Suicide=0:int, Stationary_at_End=0:int")
  3029. {
  3030. int waypath_id;
  3031. int priority;
  3032. bool suicide;
  3033. bool stationary;
  3034. enum{DIE_SURPRISE, GO_STAR, WAYPATH};
  3035. // Register variables to be Auto-Saved
  3036. // All variables must have a unique ID, less than 256, that never changes
  3037. REGISTER_VARIABLES()
  3038. {
  3039. // SAVE_VARIABLE( poke_id, 1 );
  3040. }
  3041. void Created (GameObject * obj)
  3042. {
  3043. ActionParamsStruct params;
  3044. waypath_id = Get_Int_Parameter("Waypath_ID");
  3045. priority = Get_Int_Parameter("Priority");
  3046. suicide = (Get_Int_Parameter("Suicide") == 1) ? true : false;
  3047. stationary = (Get_Int_Parameter("Stationary_at_End") == 1) ? true : false;
  3048. if(waypath_id == 0)
  3049. {
  3050. Commands->Set_Innate_Is_Stationary(obj, true);
  3051. }
  3052. else if(waypath_id == 1)
  3053. {
  3054. params.Set_Basic( this, priority, GO_STAR );
  3055. params.Set_Movement( STAR, RUN, 2.0f );
  3056. Commands->Action_Goto ( obj, params );
  3057. }
  3058. else
  3059. {
  3060. params.Set_Basic( this, priority, WAYPATH );
  3061. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3062. params.WaypathID = waypath_id;
  3063. Commands->Action_Goto( obj, params );
  3064. }
  3065. if(suicide)
  3066. {
  3067. Commands->Start_Timer (obj, this, 15.0f, DIE_SURPRISE);
  3068. }
  3069. }
  3070. void Timer_Expired(GameObject* obj, int timer_id)
  3071. {
  3072. if(timer_id == DIE_SURPRISE)
  3073. {
  3074. Commands->Apply_Damage( obj, 100000, "STEEL", NULL );
  3075. Vector3 obj_pos = Commands->Get_Position(obj);
  3076. Vector3 shot_pos;
  3077. shot_pos.X = obj_pos.X + 4.0f;
  3078. shot_pos.Y = obj_pos.Y + 4.0f;
  3079. shot_pos.Z = obj_pos.Z + 4.0f;
  3080. Commands->Create_Sound("Sniper_Fire_01", shot_pos, obj);
  3081. }
  3082. }
  3083. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3084. {
  3085. if (reason != ACTION_COMPLETE_NORMAL)
  3086. {
  3087. return;
  3088. }
  3089. if (action_id == WAYPATH)
  3090. {
  3091. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  3092. if(stationary)
  3093. {
  3094. Commands->Set_Innate_Is_Stationary(obj, true);
  3095. }
  3096. }
  3097. }
  3098. };
  3099. DECLARE_SCRIPT(M07_V05_Controller, "")
  3100. {
  3101. bool encounter;
  3102. int m07_v05_units;
  3103. bool reinforce;
  3104. enum{REINFORCEMENT_CHECK};
  3105. // Register variables to be Auto-Saved
  3106. // All variables must have a unique ID, less than 256, that never changes
  3107. REGISTER_VARIABLES()
  3108. {
  3109. SAVE_VARIABLE( encounter, 1 );
  3110. SAVE_VARIABLE( m07_v05_units, 2 );
  3111. SAVE_VARIABLE( reinforce, 3 );
  3112. }
  3113. void Created (GameObject * obj)
  3114. {
  3115. m07_v05_units = 0;
  3116. encounter= true;
  3117. reinforce = true;
  3118. }
  3119. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3120. {
  3121. if(type == M07_REINFORCEMENT_UNIT_KILLED)
  3122. {
  3123. m07_v05_units--;
  3124. }
  3125. if(type == M07_REINFORCEMENT_UNIT_CREATED)
  3126. {
  3127. m07_v05_units++;
  3128. }
  3129. if (type == M07_DEACTIVATE_ENCOUNTER)
  3130. {
  3131. encounter = false;
  3132. }
  3133. if (type == M07_ACTIVATE_ENCOUNTER)
  3134. {
  3135. Commands->Start_Timer(obj, this, 0.0f, REINFORCEMENT_CHECK);
  3136. }
  3137. if (type == M07_V05_OFFICER_KILLED)
  3138. {
  3139. reinforce = false;
  3140. }
  3141. }
  3142. void Timer_Expired(GameObject * obj, int timer_id)
  3143. {
  3144. if(timer_id == REINFORCEMENT_CHECK && encounter)
  3145. {
  3146. if(m07_v05_units < 3 && reinforce)
  3147. {
  3148. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(30.873f, -9.825f, 5.346f));
  3149. Commands->Set_Facing(chinook_obj1, -80.000f);
  3150. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7I_TroopDrop1.txt");
  3151. }
  3152. }
  3153. Commands->Start_Timer(obj, this, 30.0f, REINFORCEMENT_CHECK);
  3154. }
  3155. };
  3156. DECLARE_SCRIPT(M07_V05_Officer, "")
  3157. {
  3158. enum{REINFORCEMENT_CHECK};
  3159. // Register variables to be Auto-Saved
  3160. // All variables must have a unique ID, less than 256, that never changes
  3161. REGISTER_VARIABLES()
  3162. {
  3163. // SAVE_VARIABLE( encounter, 1 );
  3164. // SAVE_VARIABLE( m07_v05_units, 2 );
  3165. }
  3166. void Created (GameObject * obj)
  3167. {
  3168. }
  3169. void Killed(GameObject * obj, GameObject * killer)
  3170. {
  3171. Commands->Send_Custom_Event(obj, Commands->Find_Object(100899), M07_V05_OFFICER_KILLED, 1, 0.0f);
  3172. }
  3173. };
  3174. DECLARE_SCRIPT(M07_V05_Unit, "Stationary=0:int")
  3175. {
  3176. // Register variables to be Auto-Saved
  3177. // All variables must have a unique ID, less than 256, that never changes
  3178. REGISTER_VARIABLES()
  3179. {
  3180. // SAVE_VARIABLE( poke_id, 1 );
  3181. }
  3182. void Created (GameObject * obj)
  3183. {
  3184. bool stationary = (Get_Int_Parameter("Stationary") == 1) ? true : false;
  3185. if(stationary)
  3186. {
  3187. Commands->Set_Innate_Is_Stationary(obj, true);
  3188. }
  3189. Commands->Send_Custom_Event(obj, Commands->Find_Object(100899), M07_REINFORCEMENT_UNIT_CREATED, 1, 2.0f);
  3190. }
  3191. void Killed(GameObject * obj, GameObject * killer)
  3192. {
  3193. Commands->Send_Custom_Event(obj, Commands->Find_Object(100899), M07_REINFORCEMENT_UNIT_KILLED, 1, 2.0f);
  3194. }
  3195. };
  3196. DECLARE_SCRIPT(M07_Activate_V05, "")
  3197. {
  3198. bool already_entered;
  3199. // Register variables to be Auto-Saved
  3200. // All variables must have a unique ID, less than 256, that never changes
  3201. REGISTER_VARIABLES()
  3202. {
  3203. SAVE_VARIABLE( already_entered, 1 );
  3204. }
  3205. void Created (GameObject * obj)
  3206. {
  3207. already_entered = false;
  3208. }
  3209. void Entered(GameObject * obj, GameObject * enterer)
  3210. {
  3211. {
  3212. if(Commands->Is_A_Star(enterer) && !already_entered)
  3213. {
  3214. already_entered = true;
  3215. Commands->Send_Custom_Event(obj, Commands->Find_Object(100899), M07_ACTIVATE_ENCOUNTER, 1);
  3216. }
  3217. }
  3218. }
  3219. };
  3220. DECLARE_SCRIPT(M07_Nod_Light_Tank_Dec, "Attack_ID0=0:int, Attack_ID1=0:int, Attack_ID2=0:int")
  3221. {
  3222. bool attacking;
  3223. int attack_id[3];
  3224. enum{ATTACK_OVER, ATTACK_LOC};
  3225. // Register variables to be Auto-Saved
  3226. // All variables must have a unique ID, less than 256, that never changes
  3227. REGISTER_VARIABLES()
  3228. {
  3229. SAVE_VARIABLE( attacking, 1 );
  3230. SAVE_VARIABLE( attack_id, 2 );
  3231. }
  3232. void Created (GameObject * obj)
  3233. {
  3234. ActionParamsStruct params;
  3235. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  3236. Commands->Enable_Enemy_Seen( obj, true);
  3237. attacking = false;
  3238. attack_id[0] = Get_Int_Parameter("Attack_ID0");
  3239. attack_id[1] = Get_Int_Parameter("Attack_ID1");
  3240. attack_id[2] = Get_Int_Parameter("Attack_ID2");
  3241. if(attack_id[0] != 0)
  3242. {
  3243. int random = Commands->Get_Random_Int(0,2);
  3244. while(attack_id[random] == 0)
  3245. {
  3246. random = Commands->Get_Random_Int(0,2);
  3247. }
  3248. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3249. params.Set_Attack (Commands->Find_Object(attack_id[random]), 250.0f, 0.0f, 1);
  3250. params.AttackCheckBlocked = true;
  3251. Commands->Action_Attack( obj, params );
  3252. Commands->Start_Timer(obj, this, 6.0f, ATTACK_LOC);
  3253. }
  3254. }
  3255. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3256. {
  3257. ActionParamsStruct params;
  3258. if(!attacking)
  3259. {
  3260. attacking = true;
  3261. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3262. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3263. params.AttackCheckBlocked = true;
  3264. Commands->Action_Attack( obj, params );
  3265. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3266. }
  3267. }
  3268. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3269. {
  3270. ActionParamsStruct params;
  3271. if(!attacking)
  3272. {
  3273. attacking = true;
  3274. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3275. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3276. params.AttackCheckBlocked = true;
  3277. Commands->Action_Attack( obj, params );
  3278. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3279. }
  3280. }
  3281. void Timer_Expired (GameObject* obj, int timer_id)
  3282. {
  3283. ActionParamsStruct params;
  3284. if(timer_id == ATTACK_OVER)
  3285. {
  3286. attacking = false;
  3287. }
  3288. if(timer_id == ATTACK_LOC && !attacking)
  3289. {
  3290. int random = Commands->Get_Random_Int(0,2);
  3291. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3292. params.Set_Attack (Commands->Find_Object(attack_id[random]), 250.0f, 0.0f, 1);
  3293. params.AttackCheckBlocked = true;
  3294. Commands->Action_Attack( obj, params );
  3295. Commands->Start_Timer(obj, this, 6.0f, ATTACK_LOC);
  3296. }
  3297. }
  3298. void Killed (GameObject * obj, GameObject * killer)
  3299. {
  3300. }
  3301. };
  3302. DECLARE_SCRIPT(M07_Nod_Inn_Light_Tank_Dec, "APC_ID=0:int")
  3303. {
  3304. bool attacking;
  3305. int apc_id;
  3306. enum{ATTACK_OVER};
  3307. // Register variables to be Auto-Saved
  3308. // All variables must have a unique ID, less than 256, that never changes
  3309. REGISTER_VARIABLES()
  3310. {
  3311. SAVE_VARIABLE( attacking, 1 );
  3312. }
  3313. void Created (GameObject * obj)
  3314. {
  3315. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  3316. Commands->Enable_Enemy_Seen( obj, true);
  3317. attacking = false;
  3318. apc_id = Get_Int_Parameter("APC_ID");
  3319. }
  3320. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3321. {
  3322. ActionParamsStruct params;
  3323. if(!attacking)
  3324. {
  3325. attacking = true;
  3326. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3327. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3328. params.AttackCheckBlocked = false;
  3329. Commands->Action_Attack( obj, params );
  3330. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3331. }
  3332. }
  3333. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3334. {
  3335. ActionParamsStruct params;
  3336. if(!attacking)
  3337. {
  3338. attacking = true;
  3339. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3340. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3341. params.AttackCheckBlocked = false;
  3342. Commands->Action_Attack( obj, params );
  3343. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3344. }
  3345. }
  3346. void Timer_Expired (GameObject* obj, int timer_id)
  3347. {
  3348. ActionParamsStruct params;
  3349. if(timer_id == ATTACK_OVER)
  3350. {
  3351. attacking = false;
  3352. }
  3353. }
  3354. void Killed (GameObject * obj, GameObject * killer)
  3355. {
  3356. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  3357. }
  3358. };
  3359. DECLARE_SCRIPT(M07_Inn_APC, "")
  3360. {
  3361. bool attacking;
  3362. int reinforce;
  3363. enum{DROP_SOLDIERS, CHECK_ENEMY};
  3364. // Register variables to be Auto-Saved
  3365. // All variables must have a unique ID, less than 256, that never changes
  3366. REGISTER_VARIABLES()
  3367. {
  3368. SAVE_VARIABLE( attacking, 1 );
  3369. SAVE_VARIABLE( reinforce, 2 );
  3370. }
  3371. void Created (GameObject * obj)
  3372. {
  3373. Commands->Enable_Enemy_Seen( obj, true);
  3374. attacking = false;
  3375. reinforce = 0;
  3376. }
  3377. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3378. {
  3379. ActionParamsStruct params;
  3380. if(!attacking)
  3381. {
  3382. attacking = true;
  3383. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  3384. params.Set_Attack (enemy, 200.0f, 5.0f, 1);
  3385. params.AttackCheckBlocked = true;
  3386. Commands->Action_Attack (obj, params);
  3387. Commands->Start_Timer (obj, this, 30.0f, CHECK_ENEMY);
  3388. }
  3389. }
  3390. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3391. {
  3392. ActionParamsStruct params;
  3393. if(type == M07_REINFORCEMENT_KILLED)
  3394. {
  3395. reinforce++;
  3396. if(reinforce < 7)
  3397. {
  3398. char param1[10];
  3399. sprintf(param1, "%d", Commands->Get_ID(obj));
  3400. Vector3 pos = Commands->Get_Position(obj);
  3401. float facing = Commands->Get_Facing(obj);
  3402. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  3403. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  3404. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  3405. GameObject * soldier1 = Commands->Create_Object("M07_Nod_APC", soldier_loc1);
  3406. Commands->Attach_Script(soldier1, "M07_Inn_APC_Soldier", param1);
  3407. }
  3408. }
  3409. }
  3410. void Timer_Expired(GameObject * obj, int timer_id )
  3411. {
  3412. if(timer_id == CHECK_ENEMY)
  3413. {
  3414. attacking = false;
  3415. }
  3416. }
  3417. void Killed (GameObject * obj, GameObject * killer)
  3418. {
  3419. }
  3420. };
  3421. DECLARE_SCRIPT(M07_Inn_APC_Soldier, "APC_ID=0:int")
  3422. {
  3423. int apc_id;
  3424. // Register variables to be Auto-Saved
  3425. // All variables must have a unique ID, less than 256, that never changes
  3426. REGISTER_VARIABLES()
  3427. {
  3428. // SAVE_VARIABLE( apc_id, 1 );
  3429. }
  3430. void Created (GameObject * obj)
  3431. {
  3432. ActionParamsStruct params;
  3433. apc_id = Get_Int_Parameter("APC_ID");
  3434. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 1 );
  3435. params.Set_Movement( STAR, RUN, 20.0f );
  3436. Commands->Action_Goto (obj, params);
  3437. }
  3438. void Killed (GameObject * obj, GameObject * killer)
  3439. {
  3440. if(Commands->Find_Object(apc_id))
  3441. {
  3442. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  3443. }
  3444. }
  3445. };
  3446. DECLARE_SCRIPT(M07_Inn_Balcony_Sniper, "APC_ID=0:int")
  3447. {
  3448. int apc_id;
  3449. // Register variables to be Auto-Saved
  3450. // All variables must have a unique ID, less than 256, that never changes
  3451. REGISTER_VARIABLES()
  3452. {
  3453. // SAVE_VARIABLE( apc_id, 1 );
  3454. }
  3455. void Created (GameObject * obj)
  3456. {
  3457. apc_id = Get_Int_Parameter("APC_ID");
  3458. Commands->Set_Innate_Is_Stationary(obj, true);
  3459. }
  3460. void Killed (GameObject * obj, GameObject * killer)
  3461. {
  3462. if(Commands->Find_Object(apc_id))
  3463. {
  3464. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  3465. }
  3466. }
  3467. };
  3468. DECLARE_SCRIPT(M07_Activate_V01, "")
  3469. {
  3470. // Register variables to be Auto-Saved
  3471. // All variables must have a unique ID, less than 256, that never changes
  3472. REGISTER_VARIABLES()
  3473. {
  3474. // SAVE_VARIABLE( apc_id, 1 );
  3475. }
  3476. void Created (GameObject * obj)
  3477. {
  3478. }
  3479. void Entered(GameObject * obj, GameObject * enterer)
  3480. {
  3481. if(Commands->Is_A_Star(enterer))
  3482. {
  3483. Commands->Send_Custom_Event (obj, Commands->Find_Object(100952), M07_ACTIVATE_V01, 1, 0.0f);
  3484. }
  3485. }
  3486. };
  3487. DECLARE_SCRIPT(M07_Deactivate_V01, "")
  3488. {
  3489. // Register variables to be Auto-Saved
  3490. // All variables must have a unique ID, less than 256, that never changes
  3491. REGISTER_VARIABLES()
  3492. {
  3493. // SAVE_VARIABLE( apc_id, 1 );
  3494. }
  3495. void Created (GameObject * obj)
  3496. {
  3497. }
  3498. void Entered(GameObject * obj, GameObject * enterer)
  3499. {
  3500. if(Commands->Is_A_Star(enterer))
  3501. {
  3502. Commands->Send_Custom_Event (obj, Commands->Find_Object(100953), M07_DEACTIVATE_V01, 1, 0.0f);
  3503. }
  3504. }
  3505. };
  3506. DECLARE_SCRIPT(M07_V01_Controller, "")
  3507. {
  3508. bool activated;
  3509. int m07_v01_unit_killed;
  3510. // Register variables to be Auto-Saved
  3511. // All variables must have a unique ID, less than 256, that never changes
  3512. REGISTER_VARIABLES()
  3513. {
  3514. SAVE_VARIABLE( activated, 1 );
  3515. SAVE_VARIABLE( m07_v01_unit_killed, 2 );
  3516. }
  3517. void Created (GameObject * obj)
  3518. {
  3519. activated = false;
  3520. m07_v01_unit_killed = 0;
  3521. }
  3522. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3523. {
  3524. ActionParamsStruct params;
  3525. if(type == M07_ACTIVATE_V01 && !activated)
  3526. {
  3527. activated = true;
  3528. Commands->Enable_Spawner(100956, true);
  3529. Commands->Enable_Spawner(100962, true);
  3530. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-193.706f, -82.114f, 4.987f));
  3531. Commands->Set_Facing(chinook_obj1, 20.000f);
  3532. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop2.txt");
  3533. }
  3534. if(type == M07_V01_UNIT_KILLED && activated)
  3535. {
  3536. m07_v01_unit_killed++;
  3537. if(m07_v01_unit_killed%2 == 0)
  3538. {
  3539. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-193.706f, -82.114f, 4.987f));
  3540. Commands->Set_Facing(chinook_obj1, 20.000f);
  3541. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop2.txt");
  3542. }
  3543. }
  3544. if(type == M07_DEACTIVATE_V01 && activated)
  3545. {
  3546. activated = false;
  3547. Commands->Enable_Spawner(100956, false);
  3548. Commands->Enable_Spawner(100962, false);
  3549. }
  3550. }
  3551. };
  3552. DECLARE_SCRIPT(M07_V01_Destroyed_Flame_Tank, "")
  3553. {
  3554. // Register variables to be Auto-Saved
  3555. // All variables must have a unique ID, less than 256, that never changes
  3556. REGISTER_VARIABLES()
  3557. {
  3558. // SAVE_VARIABLE( apc_id, 1 );
  3559. }
  3560. void Created (GameObject * obj)
  3561. {
  3562. }
  3563. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3564. {
  3565. ActionParamsStruct params;
  3566. if(type == M07_ACTIVATE_V01)
  3567. {
  3568. Commands->Apply_Damage( obj, 10000.0f, "DEATH");
  3569. }
  3570. }
  3571. void Killed(GameObject * obj, GameObject * killer)
  3572. {
  3573. Commands->Send_Custom_Event (obj, Commands->Find_Object(100953), M07_ACTIVATE_V01, 1, 0.0f);
  3574. }
  3575. };
  3576. DECLARE_SCRIPT(M07_Nod_Buggy_Dec, "")
  3577. {
  3578. bool attacking;
  3579. enum{ATTACK_OVER};
  3580. // Register variables to be Auto-Saved
  3581. // All variables must have a unique ID, less than 256, that never changes
  3582. REGISTER_VARIABLES()
  3583. {
  3584. SAVE_VARIABLE( attacking, 1 );
  3585. }
  3586. void Created (GameObject * obj)
  3587. {
  3588. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  3589. Commands->Enable_Enemy_Seen( obj, true);
  3590. attacking = false;
  3591. }
  3592. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3593. {
  3594. ActionParamsStruct params;
  3595. if(!attacking)
  3596. {
  3597. attacking = true;
  3598. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3599. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3600. params.AttackCheckBlocked = false;
  3601. Commands->Action_Attack( obj, params );
  3602. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3603. }
  3604. }
  3605. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3606. {
  3607. ActionParamsStruct params;
  3608. if(!attacking)
  3609. {
  3610. attacking = true;
  3611. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3612. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3613. params.AttackCheckBlocked = false;
  3614. Commands->Action_Attack( obj, params );
  3615. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3616. }
  3617. }
  3618. void Timer_Expired (GameObject* obj, int timer_id)
  3619. {
  3620. ActionParamsStruct params;
  3621. if(timer_id == ATTACK_OVER)
  3622. {
  3623. attacking = false;
  3624. }
  3625. }
  3626. void Killed (GameObject * obj, GameObject * killer)
  3627. {
  3628. }
  3629. };
  3630. DECLARE_SCRIPT(M07_Nod_Recon_Bike_Dec, "")
  3631. {
  3632. bool attacking;
  3633. enum{ATTACK_OVER};
  3634. // Register variables to be Auto-Saved
  3635. // All variables must have a unique ID, less than 256, that never changes
  3636. REGISTER_VARIABLES()
  3637. {
  3638. SAVE_VARIABLE( attacking, 1 );
  3639. }
  3640. void Created (GameObject * obj)
  3641. {
  3642. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  3643. Commands->Enable_Enemy_Seen( obj, true);
  3644. attacking = false;
  3645. }
  3646. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3647. {
  3648. ActionParamsStruct params;
  3649. if(!attacking)
  3650. {
  3651. attacking = true;
  3652. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3653. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3654. params.AttackCheckBlocked = false;
  3655. Commands->Action_Attack( obj, params );
  3656. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3657. }
  3658. }
  3659. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3660. {
  3661. ActionParamsStruct params;
  3662. if(!attacking)
  3663. {
  3664. attacking = true;
  3665. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3666. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3667. params.AttackCheckBlocked = false;
  3668. Commands->Action_Attack( obj, params );
  3669. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3670. }
  3671. }
  3672. void Timer_Expired (GameObject* obj, int timer_id)
  3673. {
  3674. ActionParamsStruct params;
  3675. if(timer_id == ATTACK_OVER)
  3676. {
  3677. attacking = false;
  3678. }
  3679. }
  3680. void Killed (GameObject * obj, GameObject * killer)
  3681. {
  3682. }
  3683. };
  3684. DECLARE_SCRIPT(M07_V01_Unit, "")
  3685. {
  3686. enum{GO_STAR};
  3687. // Register variables to be Auto-Saved
  3688. // All variables must have a unique ID, less than 256, that never changes
  3689. REGISTER_VARIABLES()
  3690. {
  3691. // SAVE_VARIABLE( already_entered, 1 );
  3692. }
  3693. void Created (GameObject * obj)
  3694. {
  3695. Commands->Start_Timer(obj, this, 3.0f, 10);
  3696. }
  3697. void Timer_Expired(GameObject * obj, int timer_id)
  3698. {
  3699. ActionParamsStruct params;
  3700. if(timer_id == GO_STAR)
  3701. {
  3702. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, GO_STAR );
  3703. params.Set_Movement( STAR, RUN, 2.0f );
  3704. Commands->Action_Goto ( obj, params );
  3705. }
  3706. }
  3707. void Killed(GameObject * obj, GameObject * killer)
  3708. {
  3709. Commands->Send_Custom_Event (obj, Commands->Find_Object(100953), M07_V01_UNIT_KILLED, 1, 0.0f);
  3710. }
  3711. };
  3712. DECLARE_SCRIPT(M07_Activate_Triangle_Apache, "")
  3713. {
  3714. // Register variables to be Auto-Saved
  3715. // All variables must have a unique ID, less than 256, that never changes
  3716. REGISTER_VARIABLES()
  3717. {
  3718. // SAVE_VARIABLE( apc_id, 1 );
  3719. }
  3720. void Created (GameObject * obj)
  3721. {
  3722. }
  3723. void Entered(GameObject * obj, GameObject * enterer)
  3724. {
  3725. if(Commands->Is_A_Star(enterer))
  3726. {
  3727. Commands->Enable_Spawner(101010, true);
  3728. }
  3729. }
  3730. };
  3731. DECLARE_SCRIPT(M07_Triangle_Apache, "")
  3732. {
  3733. bool attacking;
  3734. int curr_waypath;
  3735. enum{WAYPATH, TRIANGLE_PATROL, ATTACK_OVER};
  3736. // Register variables to be Auto-Saved
  3737. // All variables must have a unique ID, less than 256, that never changes
  3738. REGISTER_VARIABLES()
  3739. {
  3740. SAVE_VARIABLE( attacking, 1 );
  3741. SAVE_VARIABLE( curr_waypath, 2 );
  3742. }
  3743. void Created (GameObject * obj)
  3744. {
  3745. ActionParamsStruct params;
  3746. attacking = false;
  3747. curr_waypath = 101011;
  3748. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  3749. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3750. params.WaypathID = 101011;
  3751. Commands->Action_Goto( obj, params );
  3752. }
  3753. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3754. {
  3755. ActionParamsStruct params;
  3756. if (action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  3757. {
  3758. Commands->Enable_Enemy_Seen(obj, true);
  3759. curr_waypath = 101016;
  3760. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, TRIANGLE_PATROL );
  3761. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3762. params.WaypathID = curr_waypath;
  3763. Commands->Action_Attack( obj, params );
  3764. }
  3765. }
  3766. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3767. {
  3768. ActionParamsStruct params;
  3769. if(!attacking)
  3770. {
  3771. attacking = true;
  3772. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, TRIANGLE_PATROL );
  3773. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3774. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3775. params.WaypathID = curr_waypath;
  3776. Commands->Modify_Action (obj, TRIANGLE_PATROL, params);
  3777. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3778. }
  3779. }
  3780. void Timer_Expired (GameObject* obj, int timer_id)
  3781. {
  3782. ActionParamsStruct params;
  3783. if(timer_id == ATTACK_OVER)
  3784. {
  3785. attacking = false;
  3786. }
  3787. }
  3788. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  3789. {
  3790. ActionParamsStruct params;
  3791. if (sound.Type == M07_RELOCATE_TRIANGLE_APACHE)
  3792. {
  3793. curr_waypath = 101033;
  3794. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, TRIANGLE_PATROL );
  3795. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3796. params.WaypathID = curr_waypath;
  3797. Commands->Action_Attack( obj, params );
  3798. }
  3799. }
  3800. };
  3801. DECLARE_SCRIPT(M07_Relocate_Triangle_Apache, "")
  3802. {
  3803. // Register variables to be Auto-Saved
  3804. // All variables must have a unique ID, less than 256, that never changes
  3805. REGISTER_VARIABLES()
  3806. {
  3807. // SAVE_VARIABLE( apc_id, 1 );
  3808. }
  3809. void Created (GameObject * obj)
  3810. {
  3811. }
  3812. void Entered(GameObject * obj, GameObject * enterer)
  3813. {
  3814. if(Commands->Is_A_Star(enterer))
  3815. {
  3816. Commands->Create_Logical_Sound(obj, M07_RELOCATE_TRIANGLE_APACHE, Commands->Get_Position(obj), 100.0f);
  3817. }
  3818. }
  3819. };
  3820. DECLARE_SCRIPT(M07_Triangle_APC, "")
  3821. {
  3822. void Killed (GameObject * obj, GameObject * killer)
  3823. {
  3824. Commands->Send_Custom_Event (obj, Commands->Find_Object(101056), M07_TRIANGLE_APC_KILLED, 1, 0.0f);
  3825. }
  3826. };
  3827. DECLARE_SCRIPT(M07_Triangle_APC_Soldier, "APC_ID=0:int")
  3828. {
  3829. int apc_id;
  3830. // Register variables to be Auto-Saved
  3831. // All variables must have a unique ID, less than 256, that never changes
  3832. REGISTER_VARIABLES()
  3833. {
  3834. // SAVE_VARIABLE( apc_id, 1 );
  3835. }
  3836. void Created (GameObject * obj)
  3837. {
  3838. ActionParamsStruct params;
  3839. apc_id = Get_Int_Parameter("APC_ID");
  3840. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 1 );
  3841. params.Set_Movement( STAR, RUN, 20.0f );
  3842. Commands->Action_Goto (obj, params);
  3843. }
  3844. void Killed (GameObject * obj, GameObject * killer)
  3845. {
  3846. if(Commands->Find_Object(apc_id))
  3847. {
  3848. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  3849. }
  3850. }
  3851. };
  3852. DECLARE_SCRIPT(M07_Triangle_Guard, "APC_ID=0:int")
  3853. {
  3854. int apc_id;
  3855. // Register variables to be Auto-Saved
  3856. // All variables must have a unique ID, less than 256, that never changes
  3857. REGISTER_VARIABLES()
  3858. {
  3859. // SAVE_VARIABLE( apc_id, 1 );
  3860. }
  3861. void Created (GameObject * obj)
  3862. {
  3863. ActionParamsStruct params;
  3864. apc_id = Get_Int_Parameter("APC_ID");
  3865. Commands->Set_Innate_Is_Stationary(obj, true);
  3866. }
  3867. void Killed (GameObject * obj, GameObject * killer)
  3868. {
  3869. if(Commands->Find_Object(apc_id))
  3870. {
  3871. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  3872. }
  3873. }
  3874. };
  3875. DECLARE_SCRIPT(M07_Triangle_Controller, "")
  3876. {
  3877. int m07_triangle_apc_killed;
  3878. int m07_triangle_unit_killed;
  3879. int civ_captive_killed;
  3880. // Register variables to be Auto-Saved
  3881. // All variables must have a unique ID, less than 256, that never changes
  3882. REGISTER_VARIABLES()
  3883. {
  3884. SAVE_VARIABLE( m07_triangle_apc_killed, 1 );
  3885. SAVE_VARIABLE( m07_triangle_unit_killed, 2 );
  3886. SAVE_VARIABLE( civ_captive_killed, 3 );
  3887. }
  3888. void Created (GameObject * obj)
  3889. {
  3890. m07_triangle_apc_killed = 0;
  3891. m07_triangle_unit_killed = 0;
  3892. civ_captive_killed = 0;
  3893. }
  3894. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3895. {
  3896. if(type == M07_TRIANGLE_APC_KILLED)
  3897. {
  3898. m07_triangle_apc_killed++;
  3899. if(m07_triangle_apc_killed == 2)
  3900. {
  3901. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-531.675f, -87.333f, 13.908f));
  3902. Commands->Set_Facing(chinook_obj1, -70.000f);
  3903. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop3.txt");
  3904. }
  3905. }
  3906. if(type == M07_TRIANGLE_UNIT_KILLED)
  3907. {
  3908. m07_triangle_unit_killed++;
  3909. if(m07_triangle_unit_killed%3 == 0 && m07_triangle_unit_killed < 9)
  3910. {
  3911. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-531.675f, -87.333f, 13.908f));
  3912. Commands->Set_Facing(chinook_obj1, -70.000f);
  3913. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop3.txt");
  3914. }
  3915. }
  3916. if(type == M07_SPAWN_TRIANGLE_CIV)
  3917. {
  3918. civ_captive_killed++;
  3919. if(civ_captive_killed == 2)
  3920. {
  3921. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 705, 2, 0.0f);
  3922. }
  3923. switch(param)
  3924. {
  3925. case 1:
  3926. {
  3927. Commands->Enable_Spawner(101057, true);
  3928. }
  3929. break;
  3930. case 2:
  3931. {
  3932. Commands->Enable_Spawner(101058, true);
  3933. }
  3934. break;
  3935. }
  3936. }
  3937. }
  3938. };
  3939. DECLARE_SCRIPT(M07_Triangle_Unit, "")
  3940. {
  3941. // Register variables to be Auto-Saved
  3942. // All variables must have a unique ID, less than 256, that never changes
  3943. REGISTER_VARIABLES()
  3944. {
  3945. // SAVE_VARIABLE( apc_id, 1 );
  3946. }
  3947. void Created (GameObject * obj)
  3948. {
  3949. }
  3950. void Killed (GameObject * obj, GameObject * killer)
  3951. {
  3952. Commands->Send_Custom_Event (obj, Commands->Find_Object(101056), M07_TRIANGLE_UNIT_KILLED, 1, 0.0f);
  3953. }
  3954. };
  3955. DECLARE_SCRIPT(M07_Activate_Hostage_Encounter, "")
  3956. {
  3957. // Register variables to be Auto-Saved
  3958. // All variables must have a unique ID, less than 256, that never changes
  3959. REGISTER_VARIABLES()
  3960. {
  3961. // SAVE_VARIABLE( apc_id, 1 );
  3962. }
  3963. void Created (GameObject * obj)
  3964. {
  3965. }
  3966. void Entered(GameObject * obj, GameObject * enterer)
  3967. {
  3968. if(Commands->Is_A_Star(enterer))
  3969. {
  3970. // Hostage
  3971. Commands->Enable_Spawner(101066, true);
  3972. // Hostage Takers
  3973. Commands->Enable_Spawner(101073, true);
  3974. Commands->Enable_Spawner(101074, true);
  3975. Commands->Enable_Spawner(101079, true);
  3976. }
  3977. }
  3978. };
  3979. DECLARE_SCRIPT(M07_Fuel_Barrel, "")
  3980. {
  3981. enum{BOOM};
  3982. // Register variables to be Auto-Saved
  3983. // All variables must have a unique ID, less than 256, that never changes
  3984. REGISTER_VARIABLES()
  3985. {
  3986. // SAVE_VARIABLE( vehicle_drop, 1 );
  3987. }
  3988. void Created (GameObject * obj)
  3989. {
  3990. Commands->Set_Animation_Frame(obj, "o_barrl_fuel.o_barrl_fuel", 0);
  3991. }
  3992. void Killed(GameObject * obj, GameObject * killer)
  3993. {
  3994. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(obj));
  3995. Commands->Send_Custom_Event(obj, Commands->Find_Object(101059), M07_EXPLODE_BARRELS, 1);
  3996. }
  3997. };
  3998. DECLARE_SCRIPT(M07_Hostage_Controller, "")
  3999. {
  4000. bool destroy_stockpile;
  4001. enum{BOOM};
  4002. // Register variables to be Auto-Saved
  4003. // All variables must have a unique ID, less than 256, that never changes
  4004. REGISTER_VARIABLES()
  4005. {
  4006. SAVE_VARIABLE( destroy_stockpile, 1 );
  4007. }
  4008. void Created (GameObject * obj)
  4009. {
  4010. destroy_stockpile = false;
  4011. Commands->Enable_Spawner(100795, true);
  4012. }
  4013. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4014. {
  4015. if (type == M07_EXPLODE_BARRELS && destroy_stockpile == false)
  4016. {
  4017. destroy_stockpile = true;
  4018. Commands->Apply_Damage( Commands->Find_Object(101060), 10000.0f, "STEEL");
  4019. Commands->Apply_Damage( Commands->Find_Object(101061), 10000.0f, "STEEL");
  4020. Commands->Apply_Damage( Commands->Find_Object(101062), 10000.0f, "STEEL");
  4021. Commands->Apply_Damage( Commands->Find_Object(101063), 10000.0f, "STEEL");
  4022. Commands->Apply_Damage( Commands->Find_Object(101064), 10000.0f, "STEEL");
  4023. Commands->Apply_Damage( Commands->Find_Object(101065), 10000.0f, "STEEL");
  4024. Commands->Apply_Damage( Commands->Find_Object(101084), 10000.0f, "STEEL");
  4025. }
  4026. }
  4027. };
  4028. DECLARE_SCRIPT(M07_Hostage, "")
  4029. {
  4030. bool poked;
  4031. enum{WAYPATH, SWITCH_TYPE};
  4032. // Register variables to be Auto-Saved
  4033. // All variables must have a unique ID, less than 256, that never changes
  4034. REGISTER_VARIABLES()
  4035. {
  4036. SAVE_VARIABLE( poked, 1 );
  4037. }
  4038. void Created (GameObject * obj)
  4039. {
  4040. ActionParamsStruct params;
  4041. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4042. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4043. params.WaypathID = 101067;
  4044. Commands->Action_Goto( obj, params );
  4045. Commands->Start_Timer(obj, this, 6.0f, SWITCH_TYPE);
  4046. poked = false;
  4047. }
  4048. void Poked(GameObject * obj, GameObject * poker)
  4049. {
  4050. ActionParamsStruct params;
  4051. if ((Commands->Is_A_Star(poker)) && (!poked))
  4052. {
  4053. poked = true;
  4054. // Assume hands over head anim
  4055. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1);
  4056. params.Set_Animation( "H_A_HOST_L1C", false );
  4057. Commands->Action_Play_Animation (obj, params);
  4058. Commands->Set_Innate_Is_Stationary(obj, false);
  4059. Vector3 pos = Commands->Get_Position(obj);
  4060. float facing = Commands->Get_Facing(obj);
  4061. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  4062. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  4063. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  4064. Commands->Create_Object("Ramjet_Weapon_Powerup", powerup_loc);
  4065. }
  4066. }
  4067. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4068. {
  4069. ActionParamsStruct params;
  4070. if (reason != ACTION_COMPLETE_NORMAL)
  4071. {
  4072. return;
  4073. }
  4074. if (action_id == WAYPATH)
  4075. {
  4076. Commands->Set_Innate_Is_Stationary(obj, true);
  4077. // Assume hands over head anim
  4078. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1);
  4079. params.Set_Animation( "H_A_HOST_L1B", true );
  4080. Commands->Action_Play_Animation (obj, params);
  4081. }
  4082. }
  4083. void Timer_Expired(GameObject * obj, int timer_id)
  4084. {
  4085. if(timer_id == SWITCH_TYPE)
  4086. {
  4087. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4088. }
  4089. }
  4090. };
  4091. DECLARE_SCRIPT(M07_Hostage_Taker, "Waypath_ID=0:int")
  4092. {
  4093. bool destroy_stockpile;
  4094. enum{WAYPATH};
  4095. // Register variables to be Auto-Saved
  4096. // All variables must have a unique ID, less than 256, that never changes
  4097. REGISTER_VARIABLES()
  4098. {
  4099. SAVE_VARIABLE( destroy_stockpile, 1 );
  4100. }
  4101. void Created (GameObject * obj)
  4102. {
  4103. ActionParamsStruct params;
  4104. int waypath_id = Get_Int_Parameter("Waypath_ID");
  4105. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, WAYPATH );
  4106. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  4107. params.WaypathID = waypath_id;
  4108. Commands->Action_Goto( obj, params );
  4109. }
  4110. };
  4111. DECLARE_SCRIPT(M07_APC_Dec, "")
  4112. {
  4113. bool attacking;
  4114. int reinforce;
  4115. enum{DROP_SOLDIERS, CHECK_ENEMY};
  4116. // Register variables to be Auto-Saved
  4117. // All variables must have a unique ID, less than 256, that never changes
  4118. REGISTER_VARIABLES()
  4119. {
  4120. SAVE_VARIABLE( attacking, 1 );
  4121. SAVE_VARIABLE( reinforce, 2 );
  4122. }
  4123. void Created (GameObject * obj)
  4124. {
  4125. Commands->Enable_Enemy_Seen( obj, true);
  4126. attacking = false;
  4127. reinforce = 0;
  4128. }
  4129. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4130. {
  4131. ActionParamsStruct params;
  4132. if(!attacking)
  4133. {
  4134. attacking = true;
  4135. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  4136. params.Set_Attack (enemy, 200.0f, 5.0f, 1);
  4137. params.AttackCheckBlocked = true;
  4138. Commands->Action_Attack (obj, params);
  4139. Commands->Start_Timer (obj, this, 30.0f, CHECK_ENEMY);
  4140. }
  4141. }
  4142. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4143. {
  4144. ActionParamsStruct params;
  4145. if(type == M07_REINFORCEMENT_KILLED)
  4146. {
  4147. reinforce++;
  4148. if(reinforce < 7)
  4149. {
  4150. char param1[10];
  4151. sprintf(param1, "%d", Commands->Get_ID(obj));
  4152. Vector3 pos = Commands->Get_Position(obj);
  4153. float facing = Commands->Get_Facing(obj);
  4154. float a = cos(DEG_TO_RADF(facing)) * -4.0;
  4155. float b = sin(DEG_TO_RADF(facing)) * -4.0;
  4156. Vector3 soldier_loc1 = pos + Vector3(a, b + .5f, 0.5f);
  4157. GameObject * soldier1 = Commands->Create_Object("M07_Nod_APC", soldier_loc1);
  4158. Commands->Attach_Script(soldier1, "M07_APC_Dec_Soldier", param1);
  4159. }
  4160. }
  4161. }
  4162. void Timer_Expired(GameObject * obj, int timer_id )
  4163. {
  4164. if(timer_id == CHECK_ENEMY)
  4165. {
  4166. attacking = false;
  4167. }
  4168. }
  4169. void Killed (GameObject * obj, GameObject * killer)
  4170. {
  4171. }
  4172. };
  4173. DECLARE_SCRIPT(M07_APC_Dec_Soldier, "APC_ID=0:int")
  4174. {
  4175. int apc_id;
  4176. // Register variables to be Auto-Saved
  4177. // All variables must have a unique ID, less than 256, that never changes
  4178. REGISTER_VARIABLES()
  4179. {
  4180. // SAVE_VARIABLE( apc_id, 1 );
  4181. }
  4182. void Created (GameObject * obj)
  4183. {
  4184. ActionParamsStruct params;
  4185. apc_id = Get_Int_Parameter("APC_ID");
  4186. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 1 );
  4187. params.Set_Movement( STAR, RUN, 20.0f );
  4188. Commands->Action_Goto (obj, params);
  4189. }
  4190. void Killed (GameObject * obj, GameObject * killer)
  4191. {
  4192. if(Commands->Find_Object(apc_id))
  4193. {
  4194. Commands->Send_Custom_Event (obj, Commands->Find_Object(apc_id), M07_REINFORCEMENT_KILLED, apc_id, 0.0f);
  4195. }
  4196. }
  4197. };
  4198. DECLARE_SCRIPT(M07_Activate_Bridge_Civ, "")
  4199. {
  4200. // Register variables to be Auto-Saved
  4201. // All variables must have a unique ID, less than 256, that never changes
  4202. REGISTER_VARIABLES()
  4203. {
  4204. // SAVE_VARIABLE( apc_id, 1 );
  4205. }
  4206. void Created (GameObject * obj)
  4207. {
  4208. }
  4209. void Entered(GameObject * obj, GameObject * enterer)
  4210. {
  4211. if(Commands->Is_A_Star(enterer))
  4212. {
  4213. // Bridge Civilians
  4214. Commands->Enable_Spawner(101109, true);
  4215. Commands->Enable_Spawner(101114, true);
  4216. // Bridge overlook Apache
  4217. Commands->Enable_Spawner(109150, true);
  4218. }
  4219. }
  4220. };
  4221. DECLARE_SCRIPT(M07_Bridge_Civ, "Waypath_ID=0:int")
  4222. {
  4223. enum{WAYPATH};
  4224. // Register variables to be Auto-Saved
  4225. // All variables must have a unique ID, less than 256, that never changes
  4226. REGISTER_VARIABLES()
  4227. {
  4228. // SAVE_VARIABLE( apc_id, 1 );
  4229. }
  4230. void Created (GameObject * obj)
  4231. {
  4232. ActionParamsStruct params;
  4233. int waypath_id = Get_Int_Parameter("Waypath_ID");
  4234. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  4235. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4236. params.WaypathID = waypath_id;
  4237. Commands->Action_Goto( obj, params );
  4238. }
  4239. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4240. {
  4241. Commands->Set_Innate_Is_Stationary(obj, true);
  4242. }
  4243. };
  4244. DECLARE_SCRIPT(M07_Activate_E10_Tank_Drop, "")
  4245. {
  4246. int m07_player_vehicle_id;
  4247. bool already_entered;
  4248. // Register variables to be Auto-Saved
  4249. // All variables must have a unique ID, less than 256, that never changes
  4250. REGISTER_VARIABLES()
  4251. {
  4252. SAVE_VARIABLE( m07_player_vehicle_id, 1 );
  4253. SAVE_VARIABLE( already_entered, 2 );
  4254. }
  4255. void Created (GameObject * obj)
  4256. {
  4257. m07_player_vehicle_id = 0;
  4258. already_entered = false;
  4259. }
  4260. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4261. {
  4262. if ( type == M07_PLAYER_VEHICLE_ID )
  4263. {
  4264. m07_player_vehicle_id = param;
  4265. }
  4266. if ( type == M07_E10_TANK_CREATED )
  4267. {
  4268. Commands->Send_Custom_Event(obj, sender, M07_PLAYER_VEHICLE_ID, Commands->Get_ID(sender));
  4269. }
  4270. }
  4271. void Entered(GameObject * obj, GameObject * enterer)
  4272. {
  4273. if(Commands->Is_A_Star(enterer) && !already_entered)
  4274. {
  4275. already_entered = true;
  4276. GameObject * drop_loc = Commands->Find_Object(101132);
  4277. float drop_facing = Commands->Get_Facing(drop_loc);
  4278. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  4279. Commands->Set_Facing(chinook_obj1, drop_facing);
  4280. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M07_XG_VehicleDrop2.txt");
  4281. }
  4282. }
  4283. };
  4284. DECLARE_SCRIPT(M07_E10_Tank, "")
  4285. {
  4286. int m07_player_vehicle_id;
  4287. enum{GO_PLAYER_VEHICLE};
  4288. // Register variables to be Auto-Saved
  4289. // All variables must have a unique ID, less than 256, that never changes
  4290. REGISTER_VARIABLES()
  4291. {
  4292. SAVE_VARIABLE( m07_player_vehicle_id, 1 );
  4293. }
  4294. void Created (GameObject * obj)
  4295. {
  4296. Commands->Enable_Enemy_Seen(obj, true);
  4297. m07_player_vehicle_id = 0;
  4298. Commands->Send_Custom_Event(obj, Commands->Find_Object(101131), M07_E10_TANK_CREATED, 1);
  4299. }
  4300. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4301. {
  4302. if ( type == M07_PLAYER_VEHICLE_ID )
  4303. {
  4304. m07_player_vehicle_id = param;
  4305. Commands->Start_Timer(obj, this, 3.0f, 10);
  4306. }
  4307. }
  4308. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  4309. {
  4310. ActionParamsStruct params;
  4311. if (Commands->Is_A_Star(enemy))
  4312. {
  4313. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_PLAYER_VEHICLE);
  4314. params.Set_Attack(Commands->Find_Object(m07_player_vehicle_id), 40.0f, 1.0f, true);
  4315. params.AttackCheckBlocked = false;
  4316. params.MoveFollow = true;
  4317. Commands->Modify_Action (obj, GO_PLAYER_VEHICLE, params);
  4318. }
  4319. }
  4320. void Timer_Expired(GameObject * obj, int timer_id)
  4321. {
  4322. if(timer_id == GO_PLAYER_VEHICLE)
  4323. {
  4324. ActionParamsStruct params;
  4325. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_PLAYER_VEHICLE);
  4326. params.Set_Attack(Commands->Find_Object(m07_player_vehicle_id), 40.0f, 1.0f, true);
  4327. params.AttackCheckBlocked = false;
  4328. params.MoveFollow = true;
  4329. Commands->Action_Attack(obj, params);
  4330. }
  4331. }
  4332. };
  4333. DECLARE_SCRIPT(M07_Para_Drop_Controller, "")
  4334. {
  4335. int para_drop[7];
  4336. int drop_zone;
  4337. int m07_paradrop_unit1_killed;
  4338. int m07_paradrop_unit2_killed;
  4339. int m07_paradrop_unit3_killed;
  4340. int m07_paradrop_unit4_killed;
  4341. bool active;
  4342. // Register variables to be Auto-Saved
  4343. // All variables must have a unique ID, less than 256, that never changes
  4344. REGISTER_VARIABLES()
  4345. {
  4346. // SAVE_VARIABLE( para_drop, 1 );
  4347. SAVE_VARIABLE( drop_zone, 2 );
  4348. SAVE_VARIABLE( m07_paradrop_unit1_killed, 3 );
  4349. SAVE_VARIABLE( m07_paradrop_unit2_killed, 4 );
  4350. SAVE_VARIABLE( m07_paradrop_unit3_killed, 5 );
  4351. SAVE_VARIABLE( m07_paradrop_unit4_killed, 6 );
  4352. SAVE_VARIABLE( active, 7 );
  4353. }
  4354. void Created (GameObject * obj)
  4355. {
  4356. para_drop[0] = 101134;
  4357. para_drop[1] = 101138;
  4358. para_drop[2] = 101139;
  4359. para_drop[3] = 101140;
  4360. para_drop[4] = 101141;
  4361. para_drop[5] = 101142;
  4362. para_drop[6] = 101143;
  4363. drop_zone = 0;
  4364. m07_paradrop_unit1_killed = 0;
  4365. m07_paradrop_unit2_killed = 0;
  4366. m07_paradrop_unit3_killed = 0;
  4367. m07_paradrop_unit4_killed = 0;
  4368. active = true;
  4369. }
  4370. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4371. {
  4372. if (type == M07_DEACTIVATE_PARADROP)
  4373. {
  4374. active = false;
  4375. }
  4376. if (type == M07_VEHICLE_DROP_ZONE)
  4377. {
  4378. drop_zone = param;
  4379. }
  4380. if(type == M07_PARADROP_UNIT_KILLED && active)
  4381. {
  4382. switch(param)
  4383. {
  4384. case 1:
  4385. {
  4386. m07_paradrop_unit1_killed++;
  4387. if(m07_paradrop_unit1_killed%3 == 0 && m07_paradrop_unit1_killed < 9)
  4388. {
  4389. GameObject * drop_loc = Commands->Find_Object(para_drop[drop_zone]);
  4390. float drop_facing = Commands->Get_Facing(drop_loc);
  4391. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  4392. Commands->Set_Facing(chinook_obj1, drop_facing);
  4393. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop4.txt");
  4394. }
  4395. }
  4396. break;
  4397. case 2:
  4398. {
  4399. m07_paradrop_unit2_killed++;
  4400. if(m07_paradrop_unit2_killed < 2)
  4401. {
  4402. GameObject * drop_loc = Commands->Find_Object(109837);
  4403. float drop_facing = Commands->Get_Facing(drop_loc);
  4404. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  4405. Commands->Set_Facing(chinook_obj1, drop_facing);
  4406. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop5.txt");
  4407. }
  4408. }
  4409. break;
  4410. case 3:
  4411. {
  4412. m07_paradrop_unit3_killed++;
  4413. if(m07_paradrop_unit3_killed < 2)
  4414. {
  4415. GameObject * drop_loc = Commands->Find_Object(109838);
  4416. float drop_facing = Commands->Get_Facing(drop_loc);
  4417. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  4418. Commands->Set_Facing(chinook_obj1, drop_facing);
  4419. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop6.txt");
  4420. }
  4421. }
  4422. break;
  4423. case 4:
  4424. {
  4425. m07_paradrop_unit4_killed++;
  4426. if(m07_paradrop_unit4_killed < 2)
  4427. {
  4428. GameObject * drop_loc = Commands->Find_Object(109839);
  4429. float drop_facing = Commands->Get_Facing(drop_loc);
  4430. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(drop_loc));
  4431. Commands->Set_Facing(chinook_obj1, drop_facing);
  4432. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop7.txt");
  4433. }
  4434. }
  4435. break;
  4436. }
  4437. }
  4438. }
  4439. };
  4440. DECLARE_SCRIPT(M07_Para_Drop_Zone, "Zone_ID=0:int")
  4441. {
  4442. // Register variables to be Auto-Saved
  4443. // All variables must have a unique ID, less than 256, that never changes
  4444. REGISTER_VARIABLES()
  4445. {
  4446. // SAVE_VARIABLE( already_entered, 1 );
  4447. }
  4448. void Created (GameObject * obj)
  4449. {
  4450. }
  4451. void Entered(GameObject * obj, GameObject * enterer)
  4452. {
  4453. int zone_id = Get_Int_Parameter("Zone_ID");
  4454. if(Commands->Is_A_Star(enterer))
  4455. {
  4456. Commands->Send_Custom_Event(obj, Commands->Find_Object(101133), M07_VEHICLE_DROP_ZONE, zone_id);
  4457. }
  4458. }
  4459. };
  4460. DECLARE_SCRIPT(M07_Para_Drop_Unit, "Unit_ID=0:int")
  4461. {
  4462. enum{GO_STAR};
  4463. // Register variables to be Auto-Saved
  4464. // All variables must have a unique ID, less than 256, that never changes
  4465. REGISTER_VARIABLES()
  4466. {
  4467. // SAVE_VARIABLE( already_entered, 1 );
  4468. }
  4469. void Created (GameObject * obj)
  4470. {
  4471. if(Get_Int_Parameter("Unit_ID") == 1)
  4472. {
  4473. Commands->Start_Timer(obj, this, 3.0f, GO_STAR);
  4474. }
  4475. else
  4476. {
  4477. Commands->Set_Innate_Is_Stationary(obj, true);
  4478. }
  4479. }
  4480. void Timer_Expired(GameObject * obj, int timer_id)
  4481. {
  4482. ActionParamsStruct params;
  4483. if(timer_id == GO_STAR)
  4484. {
  4485. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  4486. params.Set_Movement (STAR, RUN, 10.0f);
  4487. Commands->Action_Goto (obj, params);
  4488. }
  4489. }
  4490. void Killed(GameObject * obj, GameObject * killer)
  4491. {
  4492. int unit_id = Get_Int_Parameter("Unit_ID");
  4493. Commands->Send_Custom_Event(obj, Commands->Find_Object(101133), M07_PARADROP_UNIT_KILLED, unit_id);
  4494. }
  4495. };
  4496. DECLARE_SCRIPT(M07_Activate_Para_Drop, "")
  4497. {
  4498. bool already_entered;
  4499. // Register variables to be Auto-Saved
  4500. // All variables must have a unique ID, less than 256, that never changes
  4501. REGISTER_VARIABLES()
  4502. {
  4503. SAVE_VARIABLE( already_entered, 1 );
  4504. }
  4505. void Created (GameObject * obj)
  4506. {
  4507. already_entered = false;
  4508. }
  4509. void Entered(GameObject * obj, GameObject * enterer)
  4510. {
  4511. if(Commands->Is_A_Star(enterer) && !already_entered)
  4512. {
  4513. already_entered = true;
  4514. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-417.090f, 39.921f, 20.435f));
  4515. Commands->Set_Facing(chinook_obj1, 0.000f);
  4516. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7D_CHTroopdrop4.txt");
  4517. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-437.171f, 35.261f, 36.155f));
  4518. Commands->Set_Facing(chinook_obj2, -5.000f);
  4519. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X7D_CHTroopdrop5.txt");
  4520. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(-474.645f, 36.897f, 32.859f));
  4521. Commands->Set_Facing(chinook_obj3, 0.000f);
  4522. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "X7D_CHTroopdrop6.txt");
  4523. GameObject * chinook_obj4 = Commands->Create_Object ( "Invisible_Object", Vector3(-516.036f, 40.087f, 30.558f));
  4524. Commands->Set_Facing(chinook_obj4, -5.000f);
  4525. Commands->Attach_Script(chinook_obj4, "Test_Cinematic", "X7D_CHTroopdrop7.txt");
  4526. }
  4527. }
  4528. };
  4529. DECLARE_SCRIPT(M07_Deactivate_Para_Drop, "")
  4530. {
  4531. bool already_entered;
  4532. // Register variables to be Auto-Saved
  4533. // All variables must have a unique ID, less than 256, that never changes
  4534. REGISTER_VARIABLES()
  4535. {
  4536. SAVE_VARIABLE( already_entered, 1 );
  4537. }
  4538. void Created (GameObject * obj)
  4539. {
  4540. already_entered = false;
  4541. }
  4542. void Entered(GameObject * obj, GameObject * enterer)
  4543. {
  4544. if(Commands->Is_A_Star(enterer) && !already_entered)
  4545. {
  4546. already_entered = true;
  4547. Commands->Send_Custom_Event(obj, Commands->Find_Object(101133), M07_DEACTIVATE_PARADROP, 1);
  4548. }
  4549. }
  4550. };
  4551. DECLARE_SCRIPT(M07_Flyover_Controller, "")
  4552. {
  4553. int last;
  4554. REGISTER_VARIABLES()
  4555. {
  4556. SAVE_VARIABLE(last, 1);
  4557. }
  4558. void Created(GameObject * obj)
  4559. {
  4560. Commands->Start_Timer(obj, this, 10.0f, 0);
  4561. last = 0;
  4562. }
  4563. void Timer_Expired(GameObject * obj, int timer_id)
  4564. {
  4565. char *flyovers[8] =
  4566. {
  4567. "X7A_CPlane_00.txt",
  4568. "X7A_CPlane_01.txt",
  4569. "X7A_CPlane_02.txt",
  4570. "X7A_CPlane_03.txt",
  4571. "X7A_Apache_00.txt",
  4572. "X7A_Apache_01.txt",
  4573. "X7A_Apache_02.txt",
  4574. "X7A_Apache_03.txt",
  4575. };
  4576. int random = Commands->Get_Random_Int ( 0, 7 );
  4577. while (random == last)
  4578. {
  4579. random = Commands->Get_Random_Int ( 0, 7 );
  4580. }
  4581. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  4582. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  4583. Commands->Start_Timer(obj, this, 10.0f, 0);
  4584. last = random;
  4585. }
  4586. };
  4587. DECLARE_SCRIPT(M07_Activate_Flyover, "Text_File:string")
  4588. {
  4589. bool already_entered;
  4590. enum {PLAY_AGAIN};
  4591. REGISTER_VARIABLES()
  4592. {
  4593. SAVE_VARIABLE(already_entered, 1);
  4594. }
  4595. void Created(GameObject * obj)
  4596. {
  4597. already_entered = false;
  4598. }
  4599. void Entered(GameObject * obj, GameObject * enterer)
  4600. {
  4601. if(Commands->Is_A_Star(enterer) && !already_entered)
  4602. {
  4603. already_entered = true;
  4604. const char * flyover = Get_Parameter("Text_File");
  4605. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  4606. Commands->Attach_Script(controller, "Test_Cinematic", flyover);
  4607. Commands->Start_Timer(obj, this, 10.0f, PLAY_AGAIN);
  4608. }
  4609. }
  4610. void Timer_Expired(GameObject * obj, int timer_id)
  4611. {
  4612. if(timer_id == PLAY_AGAIN)
  4613. {
  4614. already_entered = false;
  4615. }
  4616. }
  4617. };
  4618. DECLARE_SCRIPT(M07_Disable_Hibernation, "")
  4619. {
  4620. // Register variables to be Auto-Saved
  4621. // All variables must have a unique ID, less than 256, that never changes
  4622. REGISTER_VARIABLES()
  4623. {
  4624. // SAVE_VARIABLE( m08_petra_a1_unit, 1 );
  4625. }
  4626. void Created(GameObject * obj)
  4627. {
  4628. Commands->Enable_Hibernation(obj, false);
  4629. }
  4630. };
  4631. DECLARE_SCRIPT(M07_Move_To_Evac, "")
  4632. {
  4633. bool already_entered;
  4634. bool star_in_blast;
  4635. // Register variables to be Auto-Saved
  4636. // All variables must have a unique ID, less than 256, that never changes
  4637. REGISTER_VARIABLES()
  4638. {
  4639. SAVE_VARIABLE( already_entered, 1 );
  4640. SAVE_VARIABLE( star_in_blast, 2 );
  4641. }
  4642. void Created (GameObject * obj)
  4643. {
  4644. already_entered = false;
  4645. }
  4646. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4647. {
  4648. }
  4649. void Entered (GameObject * obj, GameObject * enterer)
  4650. {
  4651. if(Commands->Is_A_Star(enterer))
  4652. {
  4653. // Customs to move team to evac site
  4654. // Havoc
  4655. Commands->Send_Custom_Event(obj, STAR, M07_GO_EVAC_SITE, 1, 0.0f);
  4656. // Hotwire
  4657. Commands->Send_Custom_Event(obj, HOTWIRE, M07_GO_EVAC_SITE, 1, 0.0f);
  4658. // Patch
  4659. Commands->Send_Custom_Event(obj, PATCH, M07_GO_EVAC_SITE, 1, 0.0f);
  4660. // Gunner
  4661. Commands->Send_Custom_Event(obj, GUNNER, M07_GO_EVAC_SITE, 1, 0.0f);
  4662. // Deadeye
  4663. Commands->Send_Custom_Event(obj, DEADEYE, M07_GO_EVAC_SITE, 1, 0.0f);
  4664. // Sydney
  4665. Commands->Send_Custom_Event(obj, SYDNEY, M07_GO_EVAC_SITE, 1, 0.0f);
  4666. }
  4667. }
  4668. };
  4669. DECLARE_SCRIPT(M07_Move_Hotwire, "Move_Loc=0:int")
  4670. {
  4671. // Register variables to be Auto-Saved
  4672. // All variables must have a unique ID, less than 256, that never changes
  4673. REGISTER_VARIABLES()
  4674. {
  4675. // SAVE_VARIABLE( already_entered, 1 );
  4676. }
  4677. void Created (GameObject * obj)
  4678. {
  4679. }
  4680. void Entered (GameObject * obj, GameObject * enterer)
  4681. {
  4682. if (Commands->Is_A_Star(enterer))
  4683. {
  4684. int move_loc = Get_Int_Parameter("Move_Loc");
  4685. Commands->Send_Custom_Event(obj, Commands->Find_Object(100658), M07_MOVE_HOTWIRE, move_loc, 0.0f);
  4686. }
  4687. }
  4688. };
  4689. DECLARE_SCRIPT(M07_Player_Rocket_Emplacement, "")
  4690. {
  4691. // Register variables to be Auto-Saved
  4692. // All variables must have a unique ID, less than 256, that never changes
  4693. REGISTER_VARIABLES()
  4694. {
  4695. // SAVE_VARIABLE( already_entered, 1 );
  4696. }
  4697. void Created (GameObject * obj)
  4698. {
  4699. }
  4700. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4701. {
  4702. if(damager == Commands->Find_Object(100905))
  4703. {
  4704. if(Commands->Get_Health(obj) < 10.0f)
  4705. {
  4706. Commands->Set_Health(obj, 10.0f);
  4707. }
  4708. if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  4709. {
  4710. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  4711. }
  4712. }
  4713. }
  4714. };
  4715. DECLARE_SCRIPT(M07_Playertype_Neutral, "")
  4716. {
  4717. // Register variables to be Auto-Saved
  4718. // All variables must have a unique ID, less than 256, that never changes
  4719. REGISTER_VARIABLES()
  4720. {
  4721. // SAVE_VARIABLE( already_entered, 1 );
  4722. }
  4723. void Created (GameObject * obj)
  4724. {
  4725. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  4726. }
  4727. };
  4728. DECLARE_SCRIPT(M07_Inn_Evac, "")//104496
  4729. {
  4730. int evac_waypath_id;
  4731. int evac_helicopter_id;
  4732. int dead6_cnt;
  4733. int evac_rope_id;
  4734. enum{LOWER_ROPE, CHINOOK_OUT, DESTROY_SYDNEY};
  4735. REGISTER_VARIABLES()
  4736. {
  4737. SAVE_VARIABLE(evac_waypath_id, 1);
  4738. SAVE_VARIABLE(evac_helicopter_id, 2);
  4739. SAVE_VARIABLE(dead6_cnt, 3);
  4740. SAVE_VARIABLE(evac_rope_id, 4);
  4741. }
  4742. void Created( GameObject * obj )
  4743. {
  4744. dead6_cnt = 0;
  4745. evac_waypath_id = 0;
  4746. evac_helicopter_id = 0;
  4747. evac_rope_id = 0;
  4748. }
  4749. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4750. {
  4751. if (type == M07_DEAD6_EVAC) //SAM sites captured, evac DEAD6 and Sydney
  4752. {
  4753. char param1[10];
  4754. sprintf(param1, "%d", param);
  4755. Vector3 evacPosition = Commands->Get_Position ( obj );
  4756. float evacFacing = Commands->Get_Facing ( obj );
  4757. GameObject *troopBone = Commands->Create_Object("Saveable_Invisible_Object", evacPosition );
  4758. Commands->Set_Model ( troopBone, "XG_EV5_troopBN" );
  4759. Commands->Set_Facing ( troopBone, evacFacing );
  4760. Commands->Attach_Script(troopBone, "M07_Inn_Evac_Climb", param1);
  4761. dead6_cnt++;
  4762. if(dead6_cnt == 4)
  4763. {
  4764. Commands->Send_Custom_Event(obj, Commands->Find_Object(100658), M07_EVAC_INN, 1, 0.0f);
  4765. }
  4766. if(dead6_cnt == 5)
  4767. {
  4768. // This is Resistance Radio. Nod SSM deployment confirmed. All available personnel to the park.\n
  4769. const char *conv_name = ("M07_CON017");
  4770. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  4771. Commands->Join_Conversation(NULL, conv_id, false, true);
  4772. Commands->Join_Conversation(STAR, conv_id, false, true);
  4773. Commands->Join_Conversation(NULL, conv_id, false, true);
  4774. Commands->Join_Conversation(NULL, conv_id, false, true);
  4775. Commands->Start_Conversation (conv_id, 300703);
  4776. Commands->Monitor_Conversation (obj, conv_id);
  4777. }
  4778. }
  4779. if (type == M07_EVAC_INN) //SAM sites captured, evac DEAD6 and Sydney
  4780. {
  4781. Vector3 evacPosition = Commands->Get_Position ( obj );
  4782. float evacFacing = Commands->Get_Facing ( obj );
  4783. GameObject *evacWaypath = Commands->Create_Object("Saveable_Invisible_Object", evacPosition );
  4784. Commands->Attach_Script(evacWaypath, "M07_Inn_Evac_Trajectory", "");
  4785. Commands->Set_Model ( evacWaypath, "XG_EV5_Path" );
  4786. Commands->Set_Facing ( evacWaypath, evacFacing );
  4787. Commands->Set_Animation ( evacWaypath, "XG_EV5_Path.XG_EV5_PathA", false );
  4788. Commands->Start_Timer (obj, this, 130.0f/30.0f, LOWER_ROPE);
  4789. evac_waypath_id = Commands->Get_ID(evacWaypath);
  4790. GameObject *evacChopper = Commands->Create_Object_At_Bone( evacWaypath, "GDI_Transport_Helicopter_Flyover", "BN_Trajectory" );
  4791. Commands->Attach_Script(evacChopper, "M07_Inn_Evac_Helicopter", "");
  4792. Commands->Set_Animation ( evacChopper, "v_GDI_trnspt.XG_EV5_trnsA", false );
  4793. Commands->Attach_To_Object_Bone( evacChopper, evacWaypath, "BN_Trajectory" );
  4794. evac_helicopter_id = Commands->Get_ID ( evacChopper );
  4795. }
  4796. }
  4797. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4798. {
  4799. if (action_id == 300703 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  4800. {
  4801. // Destroy Artillery Piece Objective
  4802. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 703, 3, 0.0f);
  4803. Commands->Start_Timer (obj, this, 3.0f, CHINOOK_OUT);
  4804. Commands->Start_Timer(obj, this, 10.0f, DESTROY_SYDNEY);
  4805. }
  4806. }
  4807. void Timer_Expired(GameObject * obj, int timer_id )
  4808. {
  4809. ActionParamsStruct params;
  4810. if(timer_id == DESTROY_SYDNEY)
  4811. {
  4812. // Once GDI evac has arrived destroy Sydney and DEAD-6 to give appearance of liftoff
  4813. Commands->Destroy_Object(DEADEYE);
  4814. Commands->Destroy_Object(GUNNER);
  4815. Commands->Destroy_Object(PATCH);
  4816. Commands->Destroy_Object(SYDNEY);
  4817. // Commands->Start_Timer(obj, this, 10.0f, DROP_DEAD6_INN);
  4818. }
  4819. if(timer_id == LOWER_ROPE)
  4820. {
  4821. Vector3 evacPosition = Commands->Get_Position ( obj );
  4822. float evacFacing = Commands->Get_Facing ( obj );
  4823. GameObject * evacRope = Commands->Create_Object("Saveable_Invisible_Object", evacPosition );
  4824. Commands->Attach_Script(evacRope, "M07_Inn_Evac_Rope", "");
  4825. Commands->Set_Model ( evacRope, "XG_EV5_rope" );
  4826. Commands->Set_Facing ( evacRope, evacFacing );
  4827. Commands->Set_Animation ( evacRope, "XG_EV5_rope.XG_EV5_ropeA", false );
  4828. evac_rope_id = Commands->Get_ID ( evacRope );
  4829. }
  4830. if(timer_id == CHINOOK_OUT)
  4831. {
  4832. GameObject * evacChopper = Commands->Find_Object ( evac_helicopter_id );
  4833. GameObject * evacWaypath = Commands->Find_Object ( evac_waypath_id );
  4834. GameObject * evacRope = Commands->Find_Object ( evac_rope_id );
  4835. if (evacChopper != NULL)
  4836. {
  4837. Commands->Send_Custom_Event ( obj, evacChopper, M07_INN_HELICOPTER_OUT, 1, 0 );
  4838. }
  4839. if (evacWaypath != NULL)
  4840. {
  4841. Commands->Send_Custom_Event ( obj, evacWaypath, M07_INN_HELICOPTER_OUT, 1, 0 );
  4842. }
  4843. if (evacRope != NULL)
  4844. {
  4845. Commands->Send_Custom_Event ( obj, evacRope, M07_INN_HELICOPTER_OUT, 1, 0 );
  4846. }
  4847. // Objective accomplished for rescuing Sydney
  4848. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 701, 1, 0.0f);
  4849. // Objective accomplished for protecting team
  4850. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 709, 1, 1.0f);
  4851. }
  4852. }
  4853. };
  4854. DECLARE_SCRIPT(M07_Inn_Evac_Climb, "Dead6_ID=0:int")
  4855. {
  4856. void Created( GameObject * obj )
  4857. {
  4858. int dead6_id = Get_Int_Parameter("Dead6_ID");
  4859. GameObject * dead6 = Commands->Find_Object(dead6_id);
  4860. Commands->Attach_Script(dead6, "M07_Climb_Rope", "");
  4861. Commands->Attach_To_Object_Bone(dead6, obj, "Troop_L" );
  4862. Commands->Set_Animation ( obj, "XG_EV5_troopBN.XG_EV5_troopBN", false );
  4863. }
  4864. void Animation_Complete(GameObject * obj, const char *anim)
  4865. {
  4866. if (stricmp(anim, "XG_EV5_troopBN.XG_EV5_troopBN") == 0)
  4867. {
  4868. Commands->Destroy_Object ( obj );
  4869. }
  4870. }
  4871. };
  4872. DECLARE_SCRIPT(M07_Climb_Rope, "")
  4873. {
  4874. enum{CLIMB_ROPE};
  4875. void Created( GameObject * obj )
  4876. {
  4877. ActionParamsStruct params;
  4878. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, CLIMB_ROPE );
  4879. params.Set_Animation ("S_A_Human.XG_EV5_Troop", false);
  4880. // params.Set_Animation ("S_A_HUMAN.H_A_A0F0", true);
  4881. Commands->Action_Play_Animation (obj, params);
  4882. }
  4883. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4884. {
  4885. if(action_id == CLIMB_ROPE && reason == ACTION_COMPLETE_NORMAL)
  4886. {
  4887. Commands->Destroy_Object(obj);
  4888. }
  4889. }
  4890. };
  4891. DECLARE_SCRIPT(M07_Inn_Evac_Rope, "")
  4892. {
  4893. void Animation_Complete(GameObject * obj, const char *anim)
  4894. {
  4895. if (stricmp(anim, "XG_EV5_rope.XG_EV5_ropeA") == 0)
  4896. {
  4897. Commands->Set_Animation ( obj, "XG_EV5_rope.XG_EV5_ropeL", true );
  4898. }
  4899. else if (stricmp(anim, "XG_EV5_rope.XG_EV5_ropeZ") == 0)
  4900. {
  4901. Commands->Destroy_Object ( obj );
  4902. }
  4903. }
  4904. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4905. {
  4906. switch (type)
  4907. {
  4908. case M07_INN_HELICOPTER_OUT:
  4909. {
  4910. Commands->Set_Animation ( obj, "XG_EV5_rope.XG_EV5_ropeZ", false );
  4911. }
  4912. break;
  4913. }
  4914. }
  4915. };
  4916. DECLARE_SCRIPT(M07_Inn_Evac_Trajectory, "")
  4917. {
  4918. void Animation_Complete(GameObject * obj, const char *anim)
  4919. {
  4920. if (stricmp(anim, "XG_EV5_Path.XG_EV5_PathA") == 0)
  4921. {
  4922. Commands->Set_Animation ( obj, "XG_EV5_Path.XG_EV5_PathL", true );
  4923. }
  4924. else if (stricmp(anim, "XG_EV5_Path.XG_EV5_PathZ") == 0)
  4925. {
  4926. Commands->Destroy_Object ( obj );
  4927. }
  4928. }
  4929. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4930. {
  4931. switch (type)
  4932. {
  4933. case M07_INN_HELICOPTER_OUT:
  4934. {
  4935. Commands->Set_Animation ( obj, "XG_EV5_Path.XG_EV5_PathZ", false );
  4936. }
  4937. break;
  4938. }
  4939. }
  4940. };
  4941. DECLARE_SCRIPT(M07_Inn_Evac_Helicopter, "")
  4942. {
  4943. void Created( GameObject * obj )
  4944. {
  4945. Commands->Enable_Hibernation( obj, false );
  4946. Commands->Disable_Physical_Collisions ( obj );
  4947. Commands->Send_Custom_Event ( obj, obj, M07_INN_HELO_COLLISIONS, 1, 3.0F );
  4948. }
  4949. void Animation_Complete(GameObject * obj, const char *anim)
  4950. {
  4951. if (stricmp(anim, "v_GDI_trnspt.XG_EV5_trnsA") == 0)
  4952. {
  4953. Commands->Set_Animation ( obj, "v_GDI_trnspt.XG_EV5_trnsL", true );
  4954. Commands->Enable_Collisions ( obj );
  4955. }
  4956. else if (stricmp(anim, "v_GDI_trnspt.XG_EV5_trnsz") == 0)
  4957. {
  4958. Commands->Destroy_Object ( obj );
  4959. }
  4960. }
  4961. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4962. {
  4963. switch (type)
  4964. {
  4965. case M07_INN_HELICOPTER_OUT:
  4966. {
  4967. Commands->Disable_Physical_Collisions ( obj );
  4968. Commands->Set_Animation ( obj, "v_GDI_trnspt.XG_EV5_trnsz", false );
  4969. }
  4970. break;
  4971. case M07_INN_HELO_COLLISIONS:
  4972. {
  4973. Commands->Enable_Collisions ( obj );
  4974. }
  4975. break;
  4976. }
  4977. }
  4978. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4979. {
  4980. if(Commands->Get_Health(obj) < 10.0f)
  4981. {
  4982. Commands->Set_Health(obj, 10.0f);
  4983. }
  4984. if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  4985. {
  4986. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  4987. }
  4988. }
  4989. };
  4990. DECLARE_SCRIPT(M07_Deadeye_Nod_Chinook, "")
  4991. {
  4992. // Register variables to be Auto-Saved
  4993. // All variables must have a unique ID, less than 256, that never changes
  4994. REGISTER_VARIABLES()
  4995. {
  4996. // SAVE_VARIABLE( apc_id, 1 );
  4997. }
  4998. void Created (GameObject * obj)
  4999. {
  5000. }
  5001. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5002. {
  5003. if(Commands->Get_Health(obj) < 10.0f)
  5004. {
  5005. Commands->Set_Health(obj, 10.0f);
  5006. }
  5007. if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  5008. {
  5009. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  5010. }
  5011. }
  5012. };
  5013. DECLARE_SCRIPT(M07_Alley_Vehicle, "Waypath_ID=0:int")
  5014. {
  5015. bool attacking;
  5016. int waypath_id;
  5017. bool active;
  5018. enum{ATTACK_OVER, ATTACKING, WAYPATH};
  5019. // Register variables to be Auto-Saved
  5020. // All variables must have a unique ID, less than 256, that never changes
  5021. REGISTER_VARIABLES()
  5022. {
  5023. SAVE_VARIABLE( attacking, 1 );
  5024. SAVE_VARIABLE( active, 2 );
  5025. SAVE_VARIABLE( waypath_id, 3 );
  5026. }
  5027. void Created (GameObject * obj)
  5028. {
  5029. Commands->Enable_Enemy_Seen( obj, true);
  5030. attacking = true;
  5031. active = false;
  5032. waypath_id = Get_Int_Parameter("Waypath_ID");
  5033. }
  5034. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5035. {
  5036. ActionParamsStruct params;
  5037. if ( type == M07_CUSTOM_ACTIVATE )
  5038. {
  5039. attacking = false;
  5040. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  5041. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  5042. params.WaypathID = waypath_id;
  5043. Commands->Action_Attack( obj, params );
  5044. }
  5045. }
  5046. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5047. {
  5048. ActionParamsStruct params;
  5049. if(action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  5050. {
  5051. attacking = false;
  5052. }
  5053. }
  5054. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  5055. {
  5056. ActionParamsStruct params;
  5057. if(!active)
  5058. {
  5059. active = true;
  5060. Commands->Send_Custom_Event (obj, obj, M07_CUSTOM_ACTIVATE, 0.0f);
  5061. }
  5062. if(!attacking)
  5063. {
  5064. attacking = true;
  5065. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  5066. params.Set_Movement( Vector3(0,0,0), 0.0f, 1.5f );
  5067. params.Set_Attack (enemy, 250.0f, 0.0f, 0);
  5068. params.WaypathID = waypath_id;
  5069. Commands->Modify_Action (obj, WAYPATH, params);
  5070. Commands->Start_Timer (obj, this, 5.0f, ATTACK_OVER);
  5071. }
  5072. }
  5073. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5074. {
  5075. ActionParamsStruct params;
  5076. if(!active)
  5077. {
  5078. active = true;
  5079. Commands->Send_Custom_Event (obj, obj, M07_CUSTOM_ACTIVATE, 0.0f);
  5080. }
  5081. if(!attacking && (Commands->Get_Player_Type(damager) != SCRIPT_PLAYERTYPE_NOD))
  5082. {
  5083. attacking = true;
  5084. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  5085. params.Set_Movement( Vector3(0,0,0), 0.0f, 1.5f );
  5086. params.Set_Attack (damager, 250.0f, 0.0f, 0);
  5087. params.WaypathID = waypath_id;
  5088. Commands->Modify_Action (obj, WAYPATH, params);
  5089. Commands->Start_Timer (obj, this, 5.0f, ATTACK_OVER);
  5090. }
  5091. }
  5092. void Timer_Expired(GameObject * obj, int timer_id )
  5093. {
  5094. ActionParamsStruct params;
  5095. if(timer_id == ATTACK_OVER)
  5096. {
  5097. attacking = false;
  5098. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  5099. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  5100. params.WaypathID = waypath_id;
  5101. Commands->Modify_Action (obj, WAYPATH, params);
  5102. }
  5103. }
  5104. };
  5105. DECLARE_SCRIPT(M07_Custom_Activate, "Object1_ID=0:int, Object2_ID=0:int, Object3_ID=0:int,")
  5106. {
  5107. bool already_entered;
  5108. // Register variables to be Auto-Saved
  5109. // All variables must have a unique ID, less than 256, that never changes
  5110. REGISTER_VARIABLES()
  5111. {
  5112. SAVE_VARIABLE( already_entered, 1 );
  5113. }
  5114. void Created (GameObject * obj)
  5115. {
  5116. already_entered = false;
  5117. }
  5118. void Entered (GameObject * obj, GameObject * enterer)
  5119. {
  5120. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5121. {
  5122. already_entered = true;
  5123. int object1_id = Get_Int_Parameter("Object1_ID");
  5124. int object2_id = Get_Int_Parameter("Object2_ID");
  5125. int object3_id = Get_Int_Parameter("Object3_ID");
  5126. if(object1_id != 0)
  5127. {
  5128. Commands->Send_Custom_Event (obj, Commands->Find_Object(object1_id), M07_CUSTOM_ACTIVATE, 1, 0.0f);
  5129. }
  5130. if(object2_id != 0)
  5131. {
  5132. Commands->Send_Custom_Event (obj, Commands->Find_Object(object2_id), M07_CUSTOM_ACTIVATE, 1, 0.0f);
  5133. }
  5134. if(object3_id != 0)
  5135. {
  5136. Commands->Send_Custom_Event (obj, Commands->Find_Object(object3_id), M07_CUSTOM_ACTIVATE, 1, 0.0f);
  5137. }
  5138. }
  5139. }
  5140. };
  5141. DECLARE_SCRIPT(M07_Bridge_Overlook_Apache, "")
  5142. {
  5143. bool attacking;
  5144. enum{WAYPATH, INN_PATROL, ATTACK_OVER};
  5145. // Register variables to be Auto-Saved
  5146. // All variables must have a unique ID, less than 256, that never changes
  5147. REGISTER_VARIABLES()
  5148. {
  5149. SAVE_VARIABLE( attacking, 1 );
  5150. }
  5151. void Created (GameObject * obj)
  5152. {
  5153. ActionParamsStruct params;
  5154. attacking = false;
  5155. Commands->Disable_Physical_Collisions(obj);
  5156. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  5157. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  5158. params.WaypathID = 109145;
  5159. Commands->Action_Goto( obj, params );
  5160. }
  5161. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5162. {
  5163. ActionParamsStruct params;
  5164. if (action_id == WAYPATH && reason == ACTION_COMPLETE_NORMAL)
  5165. {
  5166. Commands->Enable_Enemy_Seen(obj, true);
  5167. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INN_PATROL );
  5168. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  5169. params.WaypathID = 109151;
  5170. Commands->Action_Attack( obj, params );
  5171. }
  5172. }
  5173. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  5174. {
  5175. ActionParamsStruct params;
  5176. if(!attacking)
  5177. {
  5178. attacking = true;
  5179. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, INN_PATROL );
  5180. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  5181. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  5182. params.WaypathID = 109151;
  5183. Commands->Modify_Action (obj, INN_PATROL, params);
  5184. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  5185. }
  5186. }
  5187. void Timer_Expired (GameObject* obj, int timer_id)
  5188. {
  5189. ActionParamsStruct params;
  5190. if(timer_id == ATTACK_OVER)
  5191. {
  5192. attacking = false;
  5193. }
  5194. }
  5195. };
  5196. DECLARE_SCRIPT(M07_SSM_Unit, "")
  5197. {
  5198. enum{GO_STAR};
  5199. // Register variables to be Auto-Saved
  5200. // All variables must have a unique ID, less than 256, that never changes
  5201. REGISTER_VARIABLES()
  5202. {
  5203. // SAVE_VARIABLE( already_entered, 1 );
  5204. }
  5205. void Created (GameObject * obj)
  5206. {
  5207. Commands->Enable_Hibernation(obj, false);
  5208. Commands->Set_Innate_Aggressiveness(obj, 1.0f );
  5209. Commands->Set_Innate_Take_Cover_Probability(obj, 0.0f );
  5210. ActionParamsStruct params;
  5211. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_STAR);
  5212. params.Set_Movement(STAR, RUN, 1.0f);
  5213. Commands->Action_Goto(obj, params);
  5214. }
  5215. void Sound_Heard(GameObject * obj, const CombatSound &sound)
  5216. {
  5217. ActionParamsStruct params;
  5218. const char * preset_name = Commands->Get_Preset_Name( obj );
  5219. if (sound.Type == M07_SSM_DAMAGED && ( ::strncmp( "Nod_Engineer_0", preset_name, ::strlen( "Nod_Engineer_0" ) ) == 0 ))
  5220. {
  5221. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 100 );
  5222. params.Set_Movement( Vector3(0,0,0), RUN, 5.5f );
  5223. params.Set_Attack (sound.Creator, 250.0f, 0.0f, 0);
  5224. params.AttackCheckBlocked = false;
  5225. Commands->Action_Attack( obj, params );
  5226. }
  5227. if (sound.Type == M07_SSM_FIXED && ( ::strncmp( "Nod_Engineer_0", preset_name, ::strlen( "Nod_Engineer_0" ) ) == 0 ))
  5228. {
  5229. Commands->Action_Reset(obj, INNATE_PRIORITY_ENEMY_SEEN + 5);
  5230. }
  5231. }
  5232. };
  5233. DECLARE_SCRIPT(M07_Obelisk_Unit, "")
  5234. {
  5235. // Register variables to be Auto-Saved
  5236. // All variables must have a unique ID, less than 256, that never changes
  5237. REGISTER_VARIABLES()
  5238. {
  5239. // SAVE_VARIABLE( poked, 1 );
  5240. }
  5241. void Created(GameObject * obj)
  5242. {
  5243. Commands->Innate_Disable(obj);
  5244. }
  5245. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  5246. {
  5247. if(type == M07_CUSTOM_ACTIVATE)
  5248. {
  5249. Commands->Innate_Enable(obj);
  5250. }
  5251. }
  5252. };
  5253. DECLARE_SCRIPT (M07_Park_Stealth_Tank, "")
  5254. {
  5255. float health;
  5256. // Register variables to be Auto-Saved
  5257. // All variables must have a unique ID, less than 256, that never changes
  5258. REGISTER_VARIABLES()
  5259. {
  5260. SAVE_VARIABLE( health, 8 );
  5261. }
  5262. void Created(GameObject * obj)
  5263. {
  5264. health = Commands->Get_Health(obj);
  5265. }
  5266. void Damaged(GameObject * obj, GameObject * damager, float amount)
  5267. {
  5268. if(health > (.2 * Commands->Get_Max_Health(obj)))
  5269. {
  5270. float damage = health - Commands->Get_Health(obj);
  5271. damage *= 0.5f;
  5272. health -= damage;
  5273. Commands->Set_Health(obj, health);
  5274. }
  5275. }
  5276. void Killed (GameObject * obj, GameObject * killer)
  5277. {
  5278. // Defeat Stealth Tank.
  5279. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 707, 1, 0.0f);
  5280. }
  5281. };
  5282. DECLARE_SCRIPT(M07_SSM_Crate, "")
  5283. {
  5284. // Register variables to be Auto-Saved
  5285. // All variables must have a unique ID, less than 256, that never changes
  5286. REGISTER_VARIABLES()
  5287. {
  5288. // SAVE_VARIABLE( destroy_stockpile, 1 );
  5289. }
  5290. void Created (GameObject * obj)
  5291. {
  5292. }
  5293. void Killed (GameObject * obj, GameObject * killer)
  5294. {
  5295. Commands->Create_Explosion("Explosion_Rocket_SSM", Commands->Get_Position(obj));
  5296. Commands->Send_Custom_Event(obj, Commands->Find_Object(100781), M07_SSM_CRATE_KILLED, 1, 0.0f);
  5297. }
  5298. };
  5299. DECLARE_SCRIPT(M07_DataDisc_01_DLS, "")//
  5300. {
  5301. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5302. {
  5303. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  5304. {
  5305. // Reveal Stealth Tank
  5306. Commands->Reveal_Encyclopedia_Vehicle(33);
  5307. }
  5308. }
  5309. };
  5310. DECLARE_SCRIPT(M07_DataDisc_02_DLS, "")//
  5311. {
  5312. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5313. {
  5314. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  5315. {
  5316. // Reveal Stealth Soldier
  5317. Commands->Reveal_Encyclopedia_Character(47);
  5318. }
  5319. }
  5320. };
  5321. DECLARE_SCRIPT(M07_Hotwire_Help, "")
  5322. {
  5323. bool already_entered;
  5324. // Register variables to be Auto-Saved
  5325. // All variables must have a unique ID, less than 256, that never changes
  5326. REGISTER_VARIABLES()
  5327. {
  5328. SAVE_VARIABLE( already_entered, 1 );
  5329. }
  5330. void Created (GameObject * obj)
  5331. {
  5332. already_entered = false;
  5333. }
  5334. void Entered (GameObject * obj, GameObject * enterer)
  5335. {
  5336. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5337. {
  5338. already_entered = true;
  5339. // Hotwire
  5340. if(Commands->Find_Object(100658))
  5341. {
  5342. // Hotwire here, I need help! Now! Anyone!?
  5343. const char *conv_name = ("M07_CON028");
  5344. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5345. Commands->Join_Conversation(NULL, conv_id, false, true);
  5346. Commands->Start_Conversation (conv_id, 100658);
  5347. }
  5348. }
  5349. }
  5350. };
  5351. DECLARE_SCRIPT(M07_Hotwire_Dead, "")
  5352. {
  5353. bool already_entered;
  5354. // Register variables to be Auto-Saved
  5355. // All variables must have a unique ID, less than 256, that never changes
  5356. REGISTER_VARIABLES()
  5357. {
  5358. SAVE_VARIABLE( already_entered, 1 );
  5359. }
  5360. void Created (GameObject * obj)
  5361. {
  5362. already_entered = false;
  5363. }
  5364. void Entered (GameObject * obj, GameObject * enterer)
  5365. {
  5366. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5367. {
  5368. already_entered = true;
  5369. // Hotwire
  5370. if(Commands->Find_Object(100658))
  5371. {
  5372. // This is Hotwire, I can't hold this position! Requesting - oh great! <gunfire and static>
  5373. const char *conv_name = ("M07_CON029");
  5374. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5375. Commands->Join_Conversation(NULL, conv_id, false, true);
  5376. Commands->Start_Conversation (conv_id, 100658);
  5377. Commands->Monitor_Conversation (obj, conv_id);
  5378. }
  5379. }
  5380. }
  5381. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5382. {
  5383. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  5384. {
  5385. if(action_id == 100658)
  5386. {
  5387. // Hotwire Killed
  5388. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0174I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5389. // Protect Team Members
  5390. Commands->Send_Custom_Event(obj, Commands->Find_Object(100657), 709, 2, 0.0f);
  5391. }
  5392. }
  5393. }
  5394. };