Mission05.cpp 196 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859
  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. * Mission05.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 5 script
  25. *
  26. * PROGRAMMER
  27. * Rich Donnelly
  28. *
  29. * VERSION INFO
  30. * $Author: Darren_k $
  31. * $Revision: 266 $
  32. * $Modtime: 1/12/02 1:52p $
  33. * $Archive: /Commando/Code/Scripts/Mission05.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "mission5.h"
  37. #include "toolkit.h"
  38. #include "scripts.h"
  39. // M05C
  40. DECLARE_SCRIPT(M05_Objective_Controller, "") // 100001
  41. {
  42. bool m05_512_failed;
  43. enum {HAVOCS_SCRIPT, HOTWIRE};
  44. // Register variables to be Auto-Saved
  45. // All variables must have a unique ID, less than 256, that never changes
  46. REGISTER_VARIABLES()
  47. {
  48. SAVE_VARIABLE( m05_512_failed, 1);
  49. }
  50. void Created(GameObject * obj)
  51. {
  52. // Background Music
  53. // Commands->Set_Background_Music ("05-moveit.mp3");
  54. Commands->Set_Background_Music ("05-moveit.mp3");
  55. Commands->Enable_Hibernation(obj, false);
  56. Commands->Start_Timer (obj, this, 1.0f, HAVOCS_SCRIPT);
  57. Commands->Start_Timer (obj, this, 1.0f, HOTWIRE);
  58. m05_512_failed = false;
  59. // Capture Nod Vehicles
  60. Add_An_Objective(514);
  61. Add_An_Objective(515);
  62. Add_An_Objective(516);
  63. Add_An_Objective(517);
  64. // Drop Mendoza
  65. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-555.290f, -89.967f, 31.411f));
  66. Commands->Set_Facing(chinook_obj1, 100.000f);
  67. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5I_TroopDrop7.txt");
  68. }
  69. void Add_An_Objective(int id)
  70. {
  71. GameObject *object;
  72. switch (id)
  73. {
  74. // Contact Gunner
  75. case 501:
  76. {
  77. Commands->Add_Objective(501, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M05_02, NULL, IDS_Enc_Obj_Primary_M05_02);
  78. object = Commands->Find_Object(100003);
  79. if(object)
  80. {
  81. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0175I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  82. Commands->Set_Objective_Radar_Blip_Object(501, object);
  83. Commands->Set_Objective_HUD_Info_Position(501, 90.0f, "POG_M05_1_04.tga", IDS_POG_CONTACT, Commands->Get_Position (object));
  84. }
  85. }
  86. break;
  87. // Contact Deadeye
  88. case 502:
  89. {
  90. Commands->Add_Objective(502, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M05_03, NULL, IDS_Enc_Obj_Primary_M05_03);
  91. object = Commands->Find_Object(100004);
  92. if(object)
  93. {
  94. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0177I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  95. Commands->Set_Objective_Radar_Blip_Object(502, object);
  96. Commands->Set_Objective_HUD_Info_Position(502, 90.0f, "POG_M05_1_05.tga", IDS_POG_CONTACT, Commands->Get_Position (object));
  97. }
  98. }
  99. break;
  100. // Rescue Hotwire
  101. case 503:
  102. {
  103. Commands->Add_Objective(503, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M05_01, NULL, IDS_Enc_Obj_Primary_M05_01);
  104. object = Commands->Find_Object(100002);
  105. if(object)
  106. {
  107. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0173I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  108. Commands->Set_Objective_Radar_Blip_Object(503, object);
  109. Commands->Set_Objective_HUD_Info_Position(503, 90.0f, "POG_M05_1_03.tga", IDS_POG_RESCUE, Commands->Get_Position (object));
  110. }
  111. }
  112. break;
  113. // Contact Patch
  114. case 504:
  115. {
  116. Commands->Add_Objective(504, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M05_04, NULL, IDS_Enc_Obj_Primary_M05_04);
  117. object = Commands->Find_Object(100006);
  118. if(object)
  119. {
  120. Commands->Set_Objective_Radar_Blip_Object(504, object);
  121. Commands->Set_Objective_HUD_Info_Position(504, 90.0f, "POG_M05_1_02.tga", IDS_POG_CONTACT, Commands->Get_Position (object));
  122. }
  123. }
  124. break;
  125. // Eliminate Black Hand
  126. case 506:
  127. {
  128. Commands->Add_Objective(506, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M05_05, NULL, IDS_Enc_Obj_Primary_M05_05);
  129. object = Commands->Find_Object(100287);
  130. if(object)
  131. {
  132. Commands->Set_Objective_Radar_Blip_Object(506, object);
  133. Commands->Set_Objective_HUD_Info_Position(506, 90.0f, "POG_M05_1_01.tga", IDS_POG_ELIMINATE, Commands->Get_Position (object));
  134. }
  135. }
  136. break;
  137. // Secure Town Square
  138. case 507:
  139. {
  140. Commands->Add_Objective(507, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M05_01, NULL, IDS_Enc_Obj_Secondary_M05_01);
  141. object = Commands->Find_Object(100112);
  142. if(object)
  143. {
  144. Commands->Set_Objective_Radar_Blip_Object(507, object);
  145. Commands->Set_Objective_HUD_Info_Position(507, 90.0f, "POG_M05_2_01.tga", IDS_POG_SECURE, Commands->Get_Position (object));
  146. }
  147. }
  148. break;
  149. // Escort Resistance
  150. case 508:
  151. {
  152. Commands->Add_Objective(508, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M05_02, NULL, IDS_Enc_Obj_Secondary_M05_02);
  153. object = Commands->Find_Object(101261);
  154. if(object)
  155. {
  156. Commands->Set_Objective_Radar_Blip_Object(508, object);
  157. Commands->Set_Objective_HUD_Info_Position(508, 90.0f, "POG_M05_2_07.tga", IDS_POG_ESCORT, Commands->Get_Position (object));
  158. }
  159. }
  160. break;
  161. // Contact Escapee
  162. case 509:
  163. {
  164. Commands->Add_Objective(509, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M05_03, NULL, IDS_Enc_Obj_Secondary_M05_03);
  165. object = Commands->Find_Object(100038);
  166. if(object)
  167. {
  168. Commands->Set_Objective_Radar_Blip_Object(509, object);
  169. Commands->Set_Objective_HUD_Info_Position(509, 90.0f, "POG_M05_2_03.tga", IDS_POG_CONTACT, Commands->Get_Position (object));
  170. }
  171. }
  172. break;
  173. // Contact Babushka
  174. case 510:
  175. {
  176. Commands->Add_Objective(510, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M05_05, NULL, IDS_Enc_Obj_Secondary_M05_05);
  177. object = Commands->Find_Object(100050);
  178. if(object)
  179. {
  180. Commands->Set_Objective_Radar_Blip_Object(510, object);
  181. Commands->Set_Objective_HUD_Info_Position(510, 90.0f, "POG_M05_2_06.tga", IDS_POG_CONTACT, Commands->Get_Position (object));
  182. }
  183. }
  184. break;
  185. // Eliminate Engineers
  186. case 512:
  187. {
  188. Commands->Add_Objective(512, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M05_04, NULL, IDS_Enc_Obj_Secondary_M05_04);
  189. object = Commands->Find_Object(100632);
  190. if(object)
  191. {
  192. Commands->Set_Objective_Radar_Blip_Object(512, object);
  193. Commands->Set_Objective_HUD_Info_Position(512, 90.0f, "POG_M05_2_04.tga", IDS_POG_ELIMINATE, Commands->Get_Position (object));
  194. }
  195. }
  196. break;
  197. }
  198. }
  199. void Remove_Pog(int id)
  200. {
  201. switch (id)
  202. {
  203. // Rescue Dead-6 Special Forces Unit - Gunner
  204. case 501:
  205. {
  206. Commands->Set_Objective_HUD_Info(501, -1, "POG_M05_1_04.tga", IDS_POG_RESCUE);
  207. }
  208. break;
  209. // Rescue Dead-6 Special Forces Unit - Deadeye
  210. case 502:
  211. {
  212. Commands->Set_Objective_HUD_Info(502, -1, "POG_M05_1_05.tga", IDS_POG_RESCUE);
  213. }
  214. break;
  215. // Rescue Dead-6 Special Forces Unit - Hotwire
  216. case 503:
  217. {
  218. Commands->Set_Objective_HUD_Info(503, -1, "POG_M05_1_03.tga", IDS_POG_RESCUE);
  219. }
  220. break;
  221. // Rendezvous with Special Forces Unit - Patch
  222. case 504:
  223. {
  224. Commands->Set_Objective_HUD_Info(501, -1, "POG_M05_1_02.tga", IDS_POG_RENDEZVOUS);
  225. }
  226. break;
  227. // Repel Black Hand assault
  228. case 506:
  229. {
  230. Commands->Set_Objective_HUD_Info(501, -1, "POG_M05_1_02.tga", IDS_POG_RENDEZVOUS);
  231. }
  232. break;
  233. // Assist village resistance in retaking Town Square
  234. case 507:
  235. {
  236. Commands->Set_Objective_HUD_Info(507, -1, "POG_M05_2_01.tga", IDS_POG_ASSIST);
  237. }
  238. break;
  239. // Escort village resistance to crashed Nod Transport Helicopter
  240. case 508:
  241. {
  242. Commands->Set_Objective_HUD_Info(508, -1, "POG_M05_2_07.tga", IDS_POG_ESCORT);
  243. }
  244. break;
  245. // Contact Chateau escapee and gather intelligence
  246. case 509:
  247. {
  248. Commands->Set_Objective_HUD_Info(509, -1, "POG_M05_2_03.tga", IDS_POG_CONTACT);
  249. }
  250. break;
  251. // Free Babushka, village resistance leader
  252. case 510:
  253. {
  254. Commands->Set_Objective_HUD_Info(510, -1, "POG_M05_2_06.tga", IDS_POG_FREE);
  255. }
  256. break;
  257. // Eliminate Nod Engineers in Village Park
  258. case 512:
  259. {
  260. Commands->Set_Objective_HUD_Info(512, -1, "POG_M05_2_04.tga", IDS_POG_ELIMINATE);
  261. }
  262. break;
  263. // Commandeer Nod Light Tank
  264. case 514:
  265. {
  266. }
  267. break;
  268. }
  269. }
  270. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  271. {
  272. switch (param)
  273. {
  274. case 1:
  275. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_ACCOMPLISHED);
  276. Remove_Pog(type);
  277. if(type == 506)
  278. {
  279. Commands->Mission_Complete ( true );
  280. }
  281. break;
  282. case 2:
  283. if(type == 512 && !m05_512_failed)
  284. {
  285. m05_512_failed = true;
  286. }
  287. else if(type == 512 && m05_512_failed)
  288. {
  289. return;
  290. }
  291. if(type == 503)
  292. {
  293. Commands->Mission_Complete ( false );
  294. }
  295. if(type == 501)
  296. {
  297. Commands->Mission_Complete ( false );
  298. }
  299. if(type == 502)
  300. {
  301. Commands->Mission_Complete ( false );
  302. }
  303. Commands->Clear_Radar_Marker (type);
  304. Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_FAILED);
  305. Remove_Pog(type);
  306. break;
  307. case 3: Add_An_Objective(type);
  308. break;
  309. case 4: Commands->Set_Objective_Status(type, OBJECTIVE_STATUS_PENDING);
  310. break;
  311. }
  312. if(type == M05_RELOCATE)
  313. {
  314. if(param == 0)
  315. {
  316. //Hotwire Midtro
  317. Commands->Set_Position (STAR, Commands->Get_Position(Commands->Find_Object(108474)));
  318. }
  319. if(param == 1)
  320. {
  321. // Gunner Midtro
  322. Commands->Set_Position (STAR, Commands->Get_Position(Commands->Find_Object(108475)));
  323. }
  324. }
  325. }
  326. void Timer_Expired(GameObject * obj, int timer_id )
  327. {
  328. if(timer_id == HAVOCS_SCRIPT)
  329. {
  330. Commands->Attach_Script(STAR, "M05_Havoc_DLS", "");
  331. }
  332. if(timer_id == HOTWIRE)
  333. {
  334. // Hotwire here, I can't rendezvous at your position, I've got tons of armor pounding my location in the southwest quarter.\n
  335. const char *conv_name = ("M05_CON001");
  336. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  337. Commands->Join_Conversation(NULL, conv_id, false, true);
  338. Commands->Join_Conversation(STAR, conv_id, false, true);
  339. Commands->Start_Conversation (conv_id, 300503);
  340. Commands->Monitor_Conversation (obj, conv_id);
  341. }
  342. }
  343. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  344. {
  345. ActionParamsStruct params;
  346. if(action_id == 300503)
  347. {
  348. Add_An_Objective(503);
  349. }
  350. }
  351. };
  352. //Grants initial weapons
  353. DECLARE_SCRIPT(M05_Havoc_DLS, "")
  354. {
  355. // Register variables to be Auto-Saved
  356. // All variables must have a unique ID, less than 256, that never changes
  357. REGISTER_VARIABLES()
  358. {
  359. // SAVE_VARIABLE( just_sent, 1 );
  360. }
  361. void Created(GameObject * obj)
  362. {
  363. Commands->Give_PowerUp(obj, "POW_Chaingun_Player");
  364. Commands->Give_PowerUp(obj, "POW_SniperRifle_Player");
  365. }
  366. };
  367. DECLARE_SCRIPT(M05_Activate_Objective_501, "")
  368. {
  369. bool already_entered;
  370. // Register variables to be Auto-Saved
  371. // All variables must have a unique ID, less than 256, that never changes
  372. REGISTER_VARIABLES()
  373. {
  374. SAVE_VARIABLE( already_entered, 1 );
  375. }
  376. void Created (GameObject * obj)
  377. {
  378. already_entered = false;
  379. }
  380. void Entered (GameObject * obj, GameObject * enterer)
  381. {
  382. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  383. {
  384. already_entered = true;
  385. // This is Gunner, I'm pinned down under heavy fire on the south side of the village, requesting backup!\n
  386. const char *conv_name = ("M05_CON003");
  387. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  388. Commands->Join_Conversation(NULL, conv_id, false, true);
  389. Commands->Join_Conversation(STAR, conv_id, false, true);
  390. Commands->Start_Conversation (conv_id, 300501);
  391. Commands->Monitor_Conversation (obj, conv_id);
  392. }
  393. }
  394. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  395. {
  396. ActionParamsStruct params;
  397. if(action_id == 300501 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  398. {
  399. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 501, 3, 0.0f);
  400. }
  401. }
  402. };
  403. DECLARE_SCRIPT(M05_Activate_Objective_502, "")
  404. {
  405. bool already_entered;
  406. // Register variables to be Auto-Saved
  407. // All variables must have a unique ID, less than 256, that never changes
  408. REGISTER_VARIABLES()
  409. {
  410. SAVE_VARIABLE( already_entered, 1 );
  411. }
  412. void Created (GameObject * obj)
  413. {
  414. already_entered = false;
  415. }
  416. void Entered (GameObject * obj, GameObject * enterer)
  417. {
  418. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  419. {
  420. already_entered = true;
  421. // This is Deadeye - I'm held up in the Fancy Inn on the east side with some local resistance fighters. Need further assistance.\n
  422. const char *conv_name = ("M05_CON004");
  423. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  424. Commands->Join_Conversation(NULL, conv_id, false, true);
  425. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0.0f,0.0f,0.0f)), conv_id, false, true);
  426. Commands->Start_Conversation (conv_id, 300502);
  427. Commands->Monitor_Conversation (obj, conv_id);
  428. }
  429. }
  430. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  431. {
  432. ActionParamsStruct params;
  433. if(type == 100 && param == 100)
  434. {
  435. already_entered = true;
  436. }
  437. }
  438. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  439. {
  440. ActionParamsStruct params;
  441. if(action_id == 300502 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  442. {
  443. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 502, 3, 0.0f);
  444. }
  445. }
  446. };
  447. DECLARE_SCRIPT(M05_Activate_Objective_504, "")
  448. {
  449. bool already_entered;
  450. // Register variables to be Auto-Saved
  451. // All variables must have a unique ID, less than 256, that never changes
  452. REGISTER_VARIABLES()
  453. {
  454. SAVE_VARIABLE( already_entered, 1 );
  455. }
  456. void Created (GameObject * obj)
  457. {
  458. already_entered = false;
  459. }
  460. void Entered (GameObject * obj, GameObject * enterer)
  461. {
  462. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  463. {
  464. already_entered = true;
  465. // Havoc, this is Patch. I'm at the Cathedral. Nod's gathering for major bloodletting. Get up here.\n
  466. const char *conv_name = ("M05_CON005");
  467. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  468. Commands->Join_Conversation(NULL, conv_id, false, true);
  469. Commands->Join_Conversation(STAR, conv_id, false, true);
  470. Commands->Start_Conversation (conv_id, 300504);
  471. Commands->Monitor_Conversation (obj, conv_id);
  472. }
  473. }
  474. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  475. {
  476. ActionParamsStruct params;
  477. if(type == 100 && param == 100)
  478. {
  479. already_entered = true;
  480. }
  481. }
  482. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  483. {
  484. ActionParamsStruct params;
  485. if(action_id == 300504 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  486. {
  487. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 504, 3, 0.0f);
  488. }
  489. }
  490. };
  491. DECLARE_SCRIPT(M05_Activate_Objective_507, "")
  492. {
  493. bool already_entered;
  494. // Register variables to be Auto-Saved
  495. // All variables must have a unique ID, less than 256, that never changes
  496. REGISTER_VARIABLES()
  497. {
  498. SAVE_VARIABLE( already_entered, 1 );
  499. }
  500. void Created (GameObject * obj)
  501. {
  502. already_entered = false;
  503. }
  504. void Entered (GameObject * obj, GameObject * enterer)
  505. {
  506. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  507. {
  508. already_entered = true;
  509. // Attention GDI forces, this is Resistance Radio. Nod is assaulting the Town Square, on the south side of village. Requesting assistance.\n
  510. const char *conv_name = ("M05_CON006");
  511. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  512. Commands->Join_Conversation(NULL, conv_id, false, true);
  513. Commands->Join_Conversation(STAR, conv_id, false, true);
  514. Commands->Start_Conversation (conv_id, 300507);
  515. Commands->Monitor_Conversation (obj, conv_id);
  516. }
  517. }
  518. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  519. {
  520. ActionParamsStruct params;
  521. if(type == 100 && param == 100)
  522. {
  523. already_entered = true;
  524. }
  525. }
  526. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  527. {
  528. ActionParamsStruct params;
  529. if(action_id == 300507 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  530. {
  531. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 507, 3, 0.0f);
  532. }
  533. }
  534. };
  535. DECLARE_SCRIPT(M05_Activate_Objective_508, "")
  536. {
  537. bool already_entered;
  538. // Register variables to be Auto-Saved
  539. // All variables must have a unique ID, less than 256, that never changes
  540. REGISTER_VARIABLES()
  541. {
  542. SAVE_VARIABLE( already_entered, 1 );
  543. }
  544. void Created (GameObject * obj)
  545. {
  546. already_entered = false;
  547. }
  548. void Entered (GameObject * obj, GameObject * enterer)
  549. {
  550. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  551. {
  552. already_entered = true;
  553. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  554. Commands->Attach_Script(controller, "Test_Cinematic", "X5B_CH_DOWN.txt");
  555. // This is Nod supply helo Delta-12, possible rooftop sighting of terrorists in quadrant 4. Are those rocket launchers? Evasive- <explosion and static>\n
  556. const char *conv_name = ("M05_CON007");
  557. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  558. Commands->Join_Conversation(NULL, conv_id, false, true);
  559. Commands->Join_Conversation(STAR, conv_id, false, true);
  560. Commands->Start_Conversation (conv_id, 300501);
  561. Commands->Monitor_Conversation (obj, conv_id);
  562. }
  563. }
  564. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  565. {
  566. ActionParamsStruct params;
  567. if(action_id == 300501 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  568. {
  569. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 508, 3, 0.0f);
  570. }
  571. }
  572. };
  573. DECLARE_SCRIPT(M05_Activate_Nod_Apc, "")
  574. {
  575. bool already_entered;
  576. // Register variables to be Auto-Saved
  577. // All variables must have a unique ID, less than 256, that never changes
  578. REGISTER_VARIABLES()
  579. {
  580. SAVE_VARIABLE( already_entered, 1 );
  581. }
  582. void Created (GameObject * obj)
  583. {
  584. already_entered = false;
  585. }
  586. void Entered (GameObject * obj, GameObject * enterer)
  587. {
  588. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  589. {
  590. already_entered = true;
  591. // Activate corridor APC onto waypath
  592. Commands->Send_Custom_Event(obj, Commands->Find_Object(100144), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  593. }
  594. }
  595. };
  596. DECLARE_SCRIPT(M05_Activate_Objective_509, "")
  597. {
  598. bool already_entered;
  599. // Register variables to be Auto-Saved
  600. // All variables must have a unique ID, less than 256, that never changes
  601. REGISTER_VARIABLES()
  602. {
  603. SAVE_VARIABLE( already_entered, 1 );
  604. }
  605. void Created (GameObject * obj)
  606. {
  607. already_entered = false;
  608. }
  609. void Entered (GameObject * obj, GameObject * enterer)
  610. {
  611. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  612. {
  613. already_entered = true;
  614. // GDI forces, this is Resistance Radio. Communications indicate an escapee from the Chateau is in our custody on the northern side of the village. He has valuable information, make contact if needed.\n
  615. const char *conv_name = ("M05_CON038");
  616. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  617. Commands->Join_Conversation(NULL, conv_id, false, true);
  618. Commands->Join_Conversation(STAR, conv_id, false, true);
  619. Commands->Start_Conversation (conv_id, 300509);
  620. Commands->Monitor_Conversation (obj, conv_id);
  621. // Buggy and Tank
  622. Commands->Enable_Spawner(100164, true);
  623. // Paradrop cache
  624. GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(-495.497f, 40.504f, 22.714f));
  625. Commands->Set_Facing(controller1, -5.000f);
  626. Commands->Attach_Script(controller1, "Test_Cinematic", "X5D_CHTroopdrop3.txt");
  627. // Paradrop cache
  628. GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(-401.111f, 43.222f, 20.018f));
  629. Commands->Set_Facing(controller2, -180.000f);
  630. Commands->Attach_Script(controller2, "Test_Cinematic", "X5D_CHTroopdrop4.txt");
  631. }
  632. }
  633. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  634. {
  635. ActionParamsStruct params;
  636. if(action_id == 300509 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  637. {
  638. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 509, 3, 0.0f);
  639. }
  640. }
  641. };
  642. DECLARE_SCRIPT(M05_Activate_Objective_510, "")
  643. {
  644. bool already_entered;
  645. // Register variables to be Auto-Saved
  646. // All variables must have a unique ID, less than 256, that never changes
  647. REGISTER_VARIABLES()
  648. {
  649. SAVE_VARIABLE( already_entered, 1 );
  650. }
  651. void Created (GameObject * obj)
  652. {
  653. already_entered = false;
  654. }
  655. void Entered (GameObject * obj, GameObject * enterer)
  656. {
  657. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  658. {
  659. already_entered = true;
  660. // How's this work? Okay... Attention, this is Resistance Radio. Rumours are true, our leader Babushka is kidnapped. Is anybody around to help? Hello? Is this on?
  661. const char *conv_name = ("M05_CON008");
  662. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  663. Commands->Join_Conversation(NULL, conv_id, false, true);
  664. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0.0f,0.0f,0.0f)), conv_id, false, true);
  665. Commands->Start_Conversation (conv_id, 300510);
  666. Commands->Monitor_Conversation (obj, conv_id);
  667. }
  668. }
  669. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  670. {
  671. ActionParamsStruct params;
  672. if(type == 100 && param == 100)
  673. {
  674. already_entered = true;
  675. }
  676. }
  677. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  678. {
  679. ActionParamsStruct params;
  680. if(action_id == 300510 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  681. {
  682. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 510, 3, 0.0f);
  683. }
  684. }
  685. };
  686. DECLARE_SCRIPT(M05_DEAD6_Engineer, "") // first hotwire
  687. {
  688. int poke_id;
  689. bool conversation;
  690. // Register variables to be Auto-Saved
  691. // All variables must have a unique ID, less than 256, that never changes
  692. REGISTER_VARIABLES()
  693. {
  694. SAVE_VARIABLE( poke_id, 1 );
  695. SAVE_VARIABLE( conversation, 2 );
  696. }
  697. void Created (GameObject * obj)
  698. {
  699. ActionParamsStruct params;
  700. poke_id = 1;
  701. conversation = false;
  702. Commands->Set_Innate_Is_Stationary(obj, true);
  703. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  704. Commands->Set_Player_Type( obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  705. Commands->Set_Obj_Radar_Blip_Color ( obj, RADAR_BLIP_COLOR_GDI );
  706. }
  707. void Damaged( GameObject * obj, GameObject * damager, float amount )
  708. {
  709. }
  710. void Killed (GameObject * obj, GameObject * killer)
  711. {
  712. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0174I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  713. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 503, 2, 1.0f);
  714. }
  715. void Poked(GameObject * obj, GameObject * poker)
  716. {
  717. if (Commands->Is_A_Star(poker) && (!conversation))
  718. {
  719. conversation = true;
  720. switch(poke_id)
  721. {
  722. case 1:
  723. {
  724. // Work your way to the Cathedral and secure comm link to Locke.\n
  725. const char *conv_name = ("M05_CON009");
  726. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  727. Commands->Join_Conversation(obj, conv_id, false, true);
  728. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0.0f,0.0f,0.0f)), conv_id, false, true);
  729. Commands->Start_Conversation (conv_id, 300551);
  730. Commands->Monitor_Conversation (obj, conv_id);
  731. poke_id = 2;
  732. }
  733. break;
  734. }
  735. }
  736. }
  737. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  738. {
  739. if(type == M05_DESTROY_OBJECT)
  740. {
  741. Commands->Destroy_Object(obj);
  742. }
  743. }
  744. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  745. {
  746. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  747. {
  748. conversation = false;
  749. }
  750. if(action_id == 300551)
  751. {
  752. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 503, 1, 0.0f);
  753. Commands->Destroy_Object(obj);
  754. }
  755. }
  756. };
  757. DECLARE_SCRIPT(M05_DEAD6_Engineer2, "")
  758. {
  759. enum{GO_STAR, ATTACK_STAR};
  760. // Register variables to be Auto-Saved
  761. // All variables must have a unique ID, less than 256, that never changes
  762. REGISTER_VARIABLES()
  763. {
  764. // SAVE_VARIABLE( poke_id, 1 );
  765. }
  766. void Created (GameObject * obj)
  767. {
  768. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  769. }
  770. void Damaged( GameObject * obj, GameObject * damager, float amount )
  771. {
  772. }
  773. void Killed (GameObject * obj, GameObject * killer)
  774. {
  775. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0174I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  776. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 503, 2, 1.0f);
  777. Commands->Mission_Complete ( false );
  778. }
  779. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  780. {
  781. if(type == M05_PROTECT_HAVOC)
  782. {
  783. Commands->Start_Timer (obj, this, 5.0f, GO_STAR);
  784. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 40.0f);
  785. }
  786. }
  787. void Timer_Expired(GameObject* obj, int timer_id)
  788. {
  789. ActionParamsStruct params;
  790. float distance = Commands->Get_Distance (Commands->Get_Position(obj), Commands->Get_Position(STAR));
  791. if(timer_id == GO_STAR && distance > 30.0f)
  792. {
  793. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), GO_STAR);
  794. params.Set_Movement (STAR, RUN, 30.0f);
  795. Commands->Action_Goto (obj, params);
  796. }
  797. else
  798. {
  799. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  800. }
  801. }
  802. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  803. {
  804. ActionParamsStruct params;
  805. if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
  806. {
  807. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), ATTACK_STAR);
  808. params.Set_Movement (STAR, RUN, 3.0f);
  809. Commands->Action_Goto (obj, params);
  810. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  811. }
  812. }
  813. };
  814. DECLARE_SCRIPT(M05_DEAD6_Rocket_Soldier2, "")
  815. {
  816. enum{GO_STAR, ATTACK_STAR};
  817. // Register variables to be Auto-Saved
  818. // All variables must have a unique ID, less than 256, that never changes
  819. REGISTER_VARIABLES()
  820. {
  821. // SAVE_VARIABLE( poke_id, 1 );
  822. }
  823. void Created (GameObject * obj)
  824. {
  825. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  826. }
  827. void Damaged( GameObject * obj, GameObject * damager, float amount )
  828. {
  829. if(Commands->Get_Health(obj) < 10.0f)
  830. {
  831. Commands->Set_Health(obj, 10.0f);
  832. }
  833. if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  834. {
  835. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  836. }
  837. }
  838. void Killed (GameObject * obj, GameObject * killer)
  839. {
  840. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0176I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  841. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 503, 2, 1.0f);
  842. }
  843. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  844. {
  845. if(type == M05_PROTECT_HAVOC)
  846. {
  847. Commands->Start_Timer (obj, this, 5.0f, GO_STAR);
  848. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 40.0f);
  849. }
  850. }
  851. void Timer_Expired(GameObject* obj, int timer_id)
  852. {
  853. ActionParamsStruct params;
  854. float distance = Commands->Get_Distance (Commands->Get_Position(obj), Commands->Get_Position(STAR));
  855. if(timer_id == GO_STAR && distance > 30.0f)
  856. {
  857. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), GO_STAR);
  858. params.Set_Movement (STAR, RUN, 30.0f);
  859. Commands->Action_Goto (obj, params);
  860. }
  861. else
  862. {
  863. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  864. }
  865. }
  866. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  867. {
  868. ActionParamsStruct params;
  869. if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
  870. {
  871. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), ATTACK_STAR);
  872. params.Set_Movement (STAR, RUN, 3.0f);
  873. Commands->Action_Goto (obj, params);
  874. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  875. }
  876. }
  877. };
  878. DECLARE_SCRIPT(M05_DEAD6_Rocket_Soldier, "") // first gunner
  879. {
  880. int poke_id;
  881. bool conversation;
  882. bool immortal;
  883. int healed;
  884. // Register variables to be Auto-Saved
  885. // All variables must have a unique ID, less than 256, that never changes
  886. REGISTER_VARIABLES()
  887. {
  888. SAVE_VARIABLE( poke_id, 1 );
  889. SAVE_VARIABLE( conversation, 2 );
  890. SAVE_VARIABLE( immortal, 3 );
  891. SAVE_VARIABLE( healed, 4 );
  892. }
  893. void Created (GameObject * obj)
  894. {
  895. poke_id = 1;
  896. conversation = false;
  897. immortal = true;
  898. Commands->Set_Innate_Is_Stationary(obj, true);
  899. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  900. }
  901. void Killed (GameObject * obj, GameObject * killer)
  902. {
  903. Commands->Debug_Message("Gunner in Town Square was Killed. \n");
  904. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0176I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  905. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 501, 2, 1.0f);
  906. }
  907. void Damaged( GameObject * obj, GameObject * damager, float amount )
  908. {
  909. }
  910. void Poked(GameObject * obj, GameObject * poker)
  911. {
  912. if (Commands->Is_A_Star(poker) && (!conversation))
  913. {
  914. conversation = true;
  915. switch (poke_id)
  916. {
  917. case 1:
  918. {
  919. // I'm going to take this town if I have to vaporize every Nod reject in existence. I assume you're assisting?\n
  920. const char *conv_name = ("M05_CON010");
  921. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  922. Commands->Join_Conversation(obj, conv_id, false, true);
  923. Commands->Join_Conversation(STAR, conv_id, false, true);
  924. Commands->Start_Conversation (conv_id, 300001);
  925. Commands->Monitor_Conversation (obj, conv_id);
  926. poke_id = 2;
  927. immortal = false;
  928. }
  929. break;
  930. case 2:
  931. {
  932. // We won't make it out of here if we don't clear the area.\n
  933. const char *conv_name = ("M05_CON011");
  934. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  935. Commands->Join_Conversation(obj, conv_id, false, true);
  936. Commands->Start_Conversation (conv_id, 300002);
  937. Commands->Monitor_Conversation (obj, conv_id);
  938. }
  939. break;
  940. case 3:
  941. {
  942. Vector3 havoc_loc = Commands->Get_Position (STAR);
  943. havoc_loc.Z += 7.0f;
  944. Commands->Set_Position (STAR, havoc_loc );
  945. GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  946. Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X5M_MIDTRO_A.txt");
  947. Commands->Destroy_Object(obj);
  948. // Gunner, make your way to the Cathedral, we'll rendezvous there.\n
  949. // const char *conv_name = ("M05_CON012");
  950. // int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  951. // Commands->Join_Conversation(Commands->Get_A_Star(Commands->Get_Position(obj)), conv_id, false, true);
  952. // Commands->Join_Conversation(obj, conv_id, false, true);
  953. // Commands->Start_Conversation (conv_id, 300003);
  954. // Commands->Monitor_Conversation (obj, conv_id);
  955. }
  956. break;
  957. }
  958. }
  959. }
  960. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  961. {
  962. ActionParamsStruct params;
  963. if(type == 500 && param == 500)
  964. {
  965. // Village Resistance has seized town square
  966. poke_id = 3;
  967. }
  968. if(type == 500 && param == 501)
  969. {
  970. // Nod has seized town square
  971. poke_id = 4;
  972. }
  973. }
  974. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  975. {
  976. ActionParamsStruct params;
  977. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  978. {
  979. conversation = false;
  980. }
  981. if(action_id == 300003 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  982. {
  983. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 501, 1, 0.0f);
  984. Commands->Destroy_Object(obj);
  985. }
  986. }
  987. };
  988. DECLARE_SCRIPT(M05_DEAD6_MiniGunner, "") // deadeye
  989. {
  990. int poke_id;
  991. bool immortal;
  992. bool conversation;
  993. bool hold;
  994. bool objective_513;
  995. int move_loc[6];
  996. int current_move_loc;
  997. enum {DESTROY_WINDOW, GO_WINDOW, GO_STAR, DEADEYE_MOVE_LOC, MOVE_LOC_LOW_PRIORITY};
  998. // Register variables to be Auto-Saved
  999. // All variables must have a unique ID, less than 256, that never changes
  1000. REGISTER_VARIABLES()
  1001. {
  1002. SAVE_VARIABLE( poke_id, 1 );
  1003. SAVE_VARIABLE( immortal, 2 );
  1004. SAVE_VARIABLE( conversation, 3 );
  1005. SAVE_VARIABLE( hold, 4 );
  1006. SAVE_VARIABLE( objective_513, 5 );
  1007. SAVE_VARIABLE( current_move_loc, 6 );
  1008. }
  1009. void Created (GameObject * obj)
  1010. {
  1011. Commands->Set_Innate_Is_Stationary(obj, true);
  1012. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  1013. objective_513 = false;
  1014. poke_id = 1;
  1015. hold = false;
  1016. immortal = true;
  1017. conversation = false;
  1018. current_move_loc = 0;
  1019. move_loc[0] = 101332;
  1020. move_loc[1] = 101333;
  1021. move_loc[2] = 101334;
  1022. move_loc[3] = 100260;
  1023. move_loc[4] = 100286;
  1024. move_loc[5] = 100287;
  1025. }
  1026. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1027. {
  1028. ActionParamsStruct params;
  1029. if(type == M05_STAR_INN)
  1030. {
  1031. Commands->Start_Timer(obj, this, 2.0f, GO_WINDOW);
  1032. }
  1033. if(type == M05_MOVE_DEADEYE)
  1034. {
  1035. current_move_loc = param;
  1036. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), DEADEYE_MOVE_LOC);
  1037. params.Set_Movement (Commands->Find_Object(move_loc[current_move_loc]), RUN, 3.0f);
  1038. Commands->Action_Goto (obj, params);
  1039. }
  1040. }
  1041. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1042. {
  1043. ActionParamsStruct params;
  1044. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1045. {
  1046. conversation = false;
  1047. }
  1048. if(action_id == 300004 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1049. {
  1050. Commands->Set_Innate_Is_Stationary(obj, false);
  1051. // Rescued Deadeye objective
  1052. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 502, 1, 0.0f);
  1053. // Deadeye_Freed
  1054. Commands->Send_Custom_Event (obj, Commands->Find_Object(112559), M05_DEADEYE_FREED, 1, 0.0f);
  1055. Commands->Send_Custom_Event (obj, Commands->Find_Object(100049), M05_DEADEYE_FREED, 1, 0.0f);
  1056. // Vaporize Fancy Inn objective
  1057. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 513, 3, 2.0f);
  1058. // Inn can now be nuked
  1059. objective_513 = true;
  1060. // Goto Cathedral
  1061. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), DEADEYE_MOVE_LOC);
  1062. params.Set_Movement (Commands->Find_Object(100287), 0.6f, 3.0f);
  1063. Commands->Action_Goto (obj, params);
  1064. }
  1065. if(action_id == DEADEYE_MOVE_LOC && reason == ACTION_COMPLETE_NORMAL)
  1066. {
  1067. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  1068. }
  1069. if(action_id == DEADEYE_MOVE_LOC && reason == ACTION_COMPLETE_LOW_PRIORITY)
  1070. {
  1071. Commands->Start_Timer(obj, this, 4.0f, MOVE_LOC_LOW_PRIORITY);
  1072. }
  1073. }
  1074. void Timer_Expired(GameObject* obj, int timer_id)
  1075. {
  1076. ActionParamsStruct params;
  1077. if(timer_id == GO_WINDOW)
  1078. {
  1079. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  1080. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  1081. params.WaypathID = 100040;
  1082. params.Set_Attack (Commands->Find_Object(100044), 250.0f, 0.0f, 1);
  1083. params.AttackWanderAllowed = false ;
  1084. params.AttackCheckBlocked = false;
  1085. Commands->Action_Attack( obj, params );
  1086. Commands->Start_Timer(obj, this, 3.0f, DESTROY_WINDOW);
  1087. }
  1088. if(timer_id == MOVE_LOC_LOW_PRIORITY)
  1089. {
  1090. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), DEADEYE_MOVE_LOC);
  1091. params.Set_Movement (Commands->Find_Object(100287), RUN, 3.0f);
  1092. Commands->Action_Goto (obj, params);
  1093. }
  1094. if(timer_id == DESTROY_WINDOW)
  1095. {
  1096. Commands->Action_Reset ( obj, INNATE_PRIORITY_ENEMY_SEEN + 5 );
  1097. immortal = false;
  1098. }
  1099. }
  1100. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1101. {
  1102. if(immortal)
  1103. {
  1104. if(Commands->Get_Health(obj) < 10.0f)
  1105. {
  1106. Commands->Set_Health(obj, 10.0f);
  1107. }
  1108. if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  1109. {
  1110. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  1111. }
  1112. }
  1113. }
  1114. void Killed (GameObject * obj, GameObject * killer)
  1115. {
  1116. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0178I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  1117. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 502, 2, 1.0f);
  1118. }
  1119. void Poked(GameObject * obj, GameObject * poker)
  1120. {
  1121. ActionParamsStruct params;
  1122. if (Commands->Is_A_Star(poker) && (!conversation))
  1123. {
  1124. conversation = true;
  1125. switch(poke_id)
  1126. {
  1127. case 1:
  1128. {
  1129. // Nod is about to roll over this place, time to move out Deadeye.\n
  1130. const char *conv_name = ("M05_CON013");
  1131. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1132. Commands->Join_Conversation(STAR, conv_id, false, true);
  1133. Commands->Join_Conversation(obj, conv_id, false, true);
  1134. Commands->Start_Conversation (conv_id, 300004);
  1135. Commands->Monitor_Conversation (obj, conv_id);
  1136. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  1137. poke_id = 3;
  1138. }
  1139. break;
  1140. case 2:
  1141. {
  1142. // Alright, let's keep moving.
  1143. }
  1144. break;
  1145. case 3:
  1146. {
  1147. // Hold here. I'll be back.
  1148. }
  1149. break;
  1150. }
  1151. }
  1152. }
  1153. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  1154. {
  1155. ActionParamsStruct params;
  1156. if ( sound.Type == SOUND_TYPE_DESIGNER07 )
  1157. {
  1158. if(objective_513)
  1159. {
  1160. GameObject * inn = Commands->Find_Object(100244);
  1161. float nuke_radius = Commands->Get_Distance(sound.Position, Commands->Get_Position( inn ));
  1162. if(nuke_radius < 30.0f)
  1163. {
  1164. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 513, 1, 0.0f);
  1165. }
  1166. }
  1167. }
  1168. }
  1169. };
  1170. DECLARE_SCRIPT(M05_DEAD6_Grenadier, "")
  1171. {
  1172. int poke_id;
  1173. bool conversation;
  1174. enum{GO_STAR, ATTACK_STAR};
  1175. // Register variables to be Auto-Saved
  1176. // All variables must have a unique ID, less than 256, that never changes
  1177. REGISTER_VARIABLES()
  1178. {
  1179. SAVE_VARIABLE( poke_id, 1 );
  1180. SAVE_VARIABLE( conversation, 2 );
  1181. }
  1182. void Created (GameObject * obj)
  1183. {
  1184. poke_id = 1;
  1185. conversation = false;
  1186. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  1187. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  1188. }
  1189. void Killed (GameObject * obj, GameObject * killer)
  1190. {
  1191. Commands->Set_HUD_Help_Text ( IDS_M07DSGN_DSGN0092I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  1192. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 504, 2, 0.0f);
  1193. Commands->Mission_Complete ( false );
  1194. }
  1195. void Poked(GameObject * obj, GameObject * poker)
  1196. {
  1197. if (Commands->Is_A_Star(poker) && (!conversation))
  1198. {
  1199. conversation = true;
  1200. switch (poke_id)
  1201. {
  1202. case 1:
  1203. {
  1204. // Havoc! Black Hand squads are arriving from the Chateau! Support fire needed!\n
  1205. const char *conv_name = ("M05_CON014");
  1206. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1207. Commands->Join_Conversation(obj, conv_id, false, true);
  1208. Commands->Join_Conversation(STAR, conv_id, false, true);
  1209. Commands->Start_Conversation (conv_id, 300004);
  1210. Commands->Monitor_Conversation (obj, conv_id);
  1211. poke_id = 2;
  1212. // Send custom to cathedral controller to initiate attack
  1213. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_INITIATE_CATHEDRAL, 1, 0.0f);
  1214. // Change soundtrack to attack
  1215. Commands->Set_Background_Music ("In the Line of Fire.mp3");
  1216. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  1217. }
  1218. break;
  1219. }
  1220. }
  1221. }
  1222. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1223. {
  1224. ActionParamsStruct params;
  1225. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1226. {
  1227. conversation = false;
  1228. }
  1229. if(action_id == 300004 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  1230. {
  1231. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 504, 1, 0.0f);
  1232. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 506, 3, 3.0f);
  1233. // Activate DEAD6 to protect Havoc
  1234. Commands->Send_Custom_Event(obj, Commands->Find_Object(100047), M05_PROTECT_HAVOC, 1, 0.0f);
  1235. Commands->Send_Custom_Event(obj, Commands->Find_Object(100006), M05_PROTECT_HAVOC, 1, 0.0f);
  1236. Commands->Send_Custom_Event(obj, Commands->Find_Object(100048), M05_PROTECT_HAVOC, 1, 0.0f);
  1237. }
  1238. if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
  1239. {
  1240. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), ATTACK_STAR);
  1241. params.Set_Movement (STAR, RUN, 3.0f);
  1242. Commands->Action_Goto (obj, params);
  1243. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  1244. }
  1245. }
  1246. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1247. {
  1248. }
  1249. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1250. {
  1251. if(type == M05_PROTECT_HAVOC)
  1252. {
  1253. Commands->Start_Timer (obj, this, 5.0f, GO_STAR);
  1254. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 40.0f);
  1255. }
  1256. }
  1257. };
  1258. DECLARE_SCRIPT(M05_Mendoza, "")
  1259. {
  1260. bool exiting;
  1261. float health;
  1262. enum {PLACE_C4, BYE_MENDOZA};
  1263. // Register variables to be Auto-Saved
  1264. // All variables must have a unique ID, less than 256, that never changes
  1265. REGISTER_VARIABLES()
  1266. {
  1267. SAVE_VARIABLE( exiting, 1 );
  1268. SAVE_VARIABLE( health, 2 );
  1269. }
  1270. void Created (GameObject * obj)
  1271. {
  1272. Commands->Set_Innate_Is_Stationary(obj, true);
  1273. Commands->Start_Timer (obj, this, 3.0f, PLACE_C4);
  1274. exiting = false;
  1275. health = Commands->Get_Max_Health(obj);
  1276. }
  1277. void Timer_Expired(GameObject * obj, int timer_id )
  1278. {
  1279. ActionParamsStruct params;
  1280. if(timer_id == PLACE_C4)
  1281. {
  1282. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15);
  1283. params.Set_Animation("S_A_HUMAN.H_A_J12C", false);
  1284. Commands->Action_Play_Animation(obj, params);
  1285. }
  1286. if(timer_id == BYE_MENDOZA)
  1287. {
  1288. Commands->Destroy_Object(obj);
  1289. }
  1290. }
  1291. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1292. {
  1293. ActionParamsStruct params;
  1294. if(action_id == 15 && reason == ACTION_COMPLETE_NORMAL)
  1295. {
  1296. // You hear me in there GDI? Comfy? This is gonna be your tomb, get used to it!\n
  1297. const char *conv_name = ("M05_CON015");
  1298. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  1299. Commands->Join_Conversation(obj, conv_id, false, true);
  1300. Commands->Join_Conversation(Commands->Find_Object(100652), conv_id, false, true);
  1301. Commands->Start_Conversation (conv_id, 16);
  1302. Commands->Monitor_Conversation (obj, conv_id);
  1303. Commands->Send_Custom_Event(obj, Commands->Find_Object(100010), M05_BLOW_BUILDING, 1, 0.0f);
  1304. }
  1305. if(action_id == 16 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1306. {
  1307. Commands->Start_Timer (obj, this, 6.0f, BYE_MENDOZA);
  1308. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  1309. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  1310. params.WaypathID = 100011;
  1311. Commands->Action_Goto( obj, params );
  1312. }
  1313. }
  1314. void Damaged (GameObject * obj, GameObject * damager, float amount)
  1315. {
  1316. ActionParamsStruct params;
  1317. if(health > (.5 * Commands->Get_Max_Health(obj)))
  1318. {
  1319. float damage = health - Commands->Get_Health(obj);
  1320. damage *= 0.25f;
  1321. health -= damage;
  1322. Commands->Set_Health(obj, health);
  1323. }
  1324. if((Commands->Get_Health(obj)) < (Commands->Get_Max_Health(obj) * .23))
  1325. {
  1326. Commands->Set_Health( obj, (Commands->Get_Max_Health(obj) * .23) );
  1327. if(!exiting)
  1328. {
  1329. // Is that all you got?
  1330. const char *conv_name = ("M05_CON016");
  1331. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  1332. Commands->Join_Conversation(obj, conv_id, false, true);
  1333. Commands->Start_Conversation (conv_id, 1);
  1334. Commands->Monitor_Conversation (obj, conv_id);
  1335. exiting = true;
  1336. }
  1337. }
  1338. }
  1339. };
  1340. DECLARE_SCRIPT(M05_Building_Collapse, "")
  1341. {
  1342. bool already_entered;
  1343. int m06_roof_id;
  1344. // Register variables to be Auto-Saved
  1345. // All variables must have a unique ID, less than 256, that never changes
  1346. REGISTER_VARIABLES()
  1347. {
  1348. SAVE_VARIABLE( already_entered, 1 );
  1349. }
  1350. void Created (GameObject * obj)
  1351. {
  1352. already_entered = false;
  1353. GameObject * m06_roof = Commands->Create_Object("M05_Roof", Vector3(0,0,0));
  1354. m06_roof_id = Commands->Get_ID(m06_roof);
  1355. }
  1356. void Entered (GameObject * obj, GameObject * enterer)
  1357. {
  1358. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1359. {
  1360. already_entered = true;
  1361. }
  1362. }
  1363. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1364. {
  1365. ActionParamsStruct params;
  1366. Commands->Debug_Message("Custom received from object %d. Type and param of %d and %d.\n", Commands->Get_ID(sender), type, param);
  1367. if(type == 50 && param == 50)
  1368. {
  1369. // GameObject * debris = Commands->Create_Object("M05_X5A_AG_DLoiter", Vector3(0,0,0));
  1370. GameObject * debris = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f) );
  1371. Commands->Set_Model ( debris, "x5a_debris" );
  1372. Commands->Attach_Script(debris, "M05_Building_Debris", "");
  1373. }
  1374. if(type == M05_BLOW_BUILDING)
  1375. {
  1376. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  1377. Commands->Attach_Script(controller, "Test_Cinematic", "X5A_BCollapse.txt");
  1378. Commands->Destroy_Object(Commands->Find_Object(m06_roof_id));
  1379. }
  1380. }
  1381. };
  1382. DECLARE_SCRIPT(M05_Triangle_Tank, "")
  1383. {
  1384. int fire_loc[3];
  1385. bool attacking;
  1386. enum {TANK_TIMER, WAYPATH};
  1387. // Register variables to be Auto-Saved
  1388. // All variables must have a unique ID, less than 256, that never changes
  1389. REGISTER_VARIABLES()
  1390. {
  1391. SAVE_VARIABLE( attacking, 1 );
  1392. }
  1393. void Created (GameObject * obj)
  1394. {
  1395. attacking = false;
  1396. ActionParamsStruct params;
  1397. fire_loc[0] = 100020;
  1398. fire_loc[1] = 100021;
  1399. fire_loc[2] = 100022;
  1400. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1401. params.Set_Movement( Vector3(0,0,0), WALK, 2.0f );
  1402. params.WaypathID = 100015;
  1403. params.WaypathSplined = true;
  1404. Commands->Action_Goto( obj, params );
  1405. // Fire upon building
  1406. Commands->Start_Timer (obj, this, 6.0f, TANK_TIMER);
  1407. }
  1408. void Timer_Expired(GameObject * obj, int timer_id )
  1409. {
  1410. ActionParamsStruct params;
  1411. if(timer_id == TANK_TIMER)
  1412. {
  1413. ActionParamsStruct params;
  1414. attacking = false;
  1415. int random = Commands->Get_Random_Int(0,ARRAY_ELEMENT_COUNT(fire_loc));
  1416. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1417. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 250.0f, 10.0f, 1);
  1418. params.AttackCheckBlocked = false;
  1419. Commands->Action_Attack( obj, params );
  1420. // Fire upon building
  1421. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  1422. }
  1423. }
  1424. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1425. {
  1426. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  1427. {
  1428. return;
  1429. }
  1430. ActionParamsStruct params;
  1431. if(!attacking)
  1432. {
  1433. attacking = true;
  1434. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1435. params.Set_Attack (damager, 200.0f, 5.0f, 1);
  1436. params.AttackCheckBlocked = true;
  1437. Commands->Action_Attack (obj, params);
  1438. }
  1439. }
  1440. };
  1441. DECLARE_SCRIPT(M05_TownSquare_Tank, "")
  1442. {
  1443. int fire_loc[3];
  1444. enum {TANK_TIMER, WAYPATH};
  1445. // Register variables to be Auto-Saved
  1446. // All variables must have a unique ID, less than 256, that never changes
  1447. REGISTER_VARIABLES()
  1448. {
  1449. SAVE_VARIABLE( fire_loc, 1 );
  1450. }
  1451. void Created (GameObject * obj)
  1452. {
  1453. ActionParamsStruct params;
  1454. fire_loc[0] = 100024;
  1455. fire_loc[1] = 100025;
  1456. fire_loc[2] = 100026;
  1457. // Fire upon building
  1458. Commands->Start_Timer (obj, this, 3.0f, TANK_TIMER);
  1459. }
  1460. void Timer_Expired(GameObject * obj, int timer_id )
  1461. {
  1462. ActionParamsStruct params;
  1463. if(timer_id == TANK_TIMER)
  1464. {
  1465. ActionParamsStruct params;
  1466. int random = Commands->Get_Random_Int(0, ARRAY_ELEMENT_COUNT(fire_loc));
  1467. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1468. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 250.0f, 10.0f, 1);
  1469. params.AttackCheckBlocked = false;
  1470. Commands->Action_Attack( obj, params );
  1471. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  1472. }
  1473. }
  1474. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1475. {
  1476. ActionParamsStruct params;
  1477. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1478. params.Set_Attack (damager, 200.0f, 5.0f, 1);
  1479. params.AttackCheckBlocked = true;
  1480. Commands->Action_Attack (obj, params);
  1481. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  1482. }
  1483. void Killed (GameObject * obj, GameObject * killer)
  1484. {
  1485. Commands->Send_Custom_Event(obj, Commands->Find_Object(100112), M05_TOWNSQUARE_REINFORCE, 3, 0.0f);
  1486. }
  1487. };
  1488. DECLARE_SCRIPT(M05_Bridge_Tank, "")
  1489. {
  1490. bool attacking;
  1491. int fire_loc[3];
  1492. enum {TANK_TIMER, WAYPATH};
  1493. // Register variables to be Auto-Saved
  1494. // All variables must have a unique ID, less than 256, that never changes
  1495. REGISTER_VARIABLES()
  1496. {
  1497. SAVE_VARIABLE( attacking, 1 );
  1498. SAVE_VARIABLE( fire_loc, 2 );
  1499. }
  1500. void Created (GameObject * obj)
  1501. {
  1502. ActionParamsStruct params;
  1503. fire_loc[0] = 100029;
  1504. fire_loc[1] = 100030;
  1505. fire_loc[2] = 100031;
  1506. // Fire upon building
  1507. Commands->Start_Timer (obj, this, 3.0f, TANK_TIMER);
  1508. attacking = false;
  1509. }
  1510. void Timer_Expired(GameObject * obj, int timer_id )
  1511. {
  1512. ActionParamsStruct params;
  1513. if(timer_id == TANK_TIMER)
  1514. {
  1515. ActionParamsStruct params;
  1516. attacking = false;
  1517. int random = Commands->Get_Random_Int(0, ARRAY_ELEMENT_COUNT(fire_loc));
  1518. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1519. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 250.0f, 10.0f, 1);
  1520. params.AttackCheckBlocked = false;
  1521. Commands->Action_Attack( obj, params );
  1522. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  1523. }
  1524. }
  1525. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1526. {
  1527. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  1528. {
  1529. return;
  1530. }
  1531. ActionParamsStruct params;
  1532. if(!attacking)
  1533. {
  1534. attacking = true;
  1535. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  1536. params.Set_Attack (damager, 200.0f, 5.0f, 1);
  1537. params.AttackCheckBlocked = false;
  1538. Commands->Action_Attack (obj, params);
  1539. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  1540. }
  1541. }
  1542. };
  1543. DECLARE_SCRIPT(M05_Enable_Overlook, "")
  1544. {
  1545. bool already_entered;
  1546. enum {DROP_SNIPER};
  1547. // Register variables to be Auto-Saved
  1548. // All variables must have a unique ID, less than 256, that never changes
  1549. REGISTER_VARIABLES()
  1550. {
  1551. SAVE_VARIABLE( already_entered, 1 );
  1552. }
  1553. void Created (GameObject * obj)
  1554. {
  1555. already_entered = false;
  1556. }
  1557. void Entered (GameObject * obj, GameObject * enterer)
  1558. {
  1559. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  1560. {
  1561. already_entered = true;
  1562. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-298.246f, -48.874f, 14.633f));
  1563. Commands->Set_Facing(chinook_obj, 90.0f);
  1564. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X5I_TroopDrop1.txt");
  1565. // Activate Bridge Gun emplacement
  1566. Commands->Send_Custom_Event(obj, Commands->Find_Object(100127), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  1567. Commands->Start_Timer (obj, this, 2.0f, DROP_SNIPER);
  1568. }
  1569. }
  1570. void Timer_Expired(GameObject * obj, int timer_id )
  1571. {
  1572. // Drop sniper on balcony
  1573. if(timer_id == DROP_SNIPER)
  1574. {
  1575. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-335.883f, -82.737f, 24.550f));
  1576. Commands->Set_Facing(chinook_obj, 80.0f);
  1577. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X5I_TroopDrop2.txt");
  1578. }
  1579. }
  1580. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1581. {
  1582. ActionParamsStruct params;
  1583. if(type == 100 && param == 100)
  1584. {
  1585. already_entered = true;
  1586. }
  1587. }
  1588. };
  1589. DECLARE_SCRIPT(M05_Cache_Escort, "")
  1590. {
  1591. int poke_id;
  1592. bool arrived;
  1593. bool hold;
  1594. bool conversation;
  1595. enum {GO_CHINOOK};
  1596. // Register variables to be Auto-Saved
  1597. // All variables must have a unique ID, less than 256, that never changes
  1598. REGISTER_VARIABLES()
  1599. {
  1600. SAVE_VARIABLE( poke_id, 1 );
  1601. SAVE_VARIABLE( arrived, 2 );
  1602. SAVE_VARIABLE( hold, 3 );
  1603. SAVE_VARIABLE( conversation, 4 );
  1604. }
  1605. void Created (GameObject * obj)
  1606. {
  1607. poke_id = 1;
  1608. arrived = false;
  1609. hold = false;
  1610. conversation = false;
  1611. Commands->Set_Innate_Is_Stationary(obj, true);
  1612. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  1613. }
  1614. void Killed (GameObject * obj, GameObject * killer)
  1615. {
  1616. Commands->Send_Custom_Event(obj, Commands->Find_Object(100162), M05_CACHE_CIV_KILLED, 1, 0.0f);
  1617. }
  1618. void Poked(GameObject * obj, GameObject * poker)
  1619. {
  1620. ActionParamsStruct params;
  1621. if (Commands->Is_A_Star(poker) && !conversation)
  1622. {
  1623. conversation = true;
  1624. switch(poke_id)
  1625. {
  1626. case 1:
  1627. {
  1628. // Send custom to the remainder of the civ resist to turn off poke, and have them follow
  1629. Commands->Send_Custom_Event (obj, Commands->Find_Object(100033), 100, 100, 0.0f);
  1630. Commands->Send_Custom_Event (obj, Commands->Find_Object(100034), 100, 100, 0.0f);
  1631. // Paratroop in 3 Chemwarriors to hunt escort group
  1632. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-529.402f, 23.791f, 23.472f));
  1633. Commands->Set_Facing(chinook_obj1, -95.000f);
  1634. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_C130TroopDrop2.txt");
  1635. // GDI, you've come to help? There's a crashed chopper with supplies all over nearby. Come with us, we'll show you.\n
  1636. const char *conv_name = ("M05_CON017");
  1637. int conv_id = Commands->Create_Conversation (conv_name);
  1638. Commands->Join_Conversation(obj, conv_id, false, true);
  1639. Commands->Join_Conversation(STAR, conv_id, false, true);
  1640. Commands->Start_Conversation (conv_id, 300508);
  1641. Commands->Monitor_Conversation (obj, conv_id);
  1642. // start objective 508
  1643. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 508, 3, 0.0f);
  1644. poke_id = 3;
  1645. }
  1646. break;
  1647. case 2:
  1648. {
  1649. // \\Let's keep moving.\n
  1650. const char *conv_name = ("M05_CON018");
  1651. int conv_id = Commands->Create_Conversation (conv_name);
  1652. Commands->Join_Conversation(obj, conv_id, false, true);
  1653. Commands->Start_Conversation (conv_id, 1);
  1654. Commands->Monitor_Conversation (obj, conv_id);
  1655. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_CHINOOK);
  1656. params.Set_Movement (Commands->Find_Object(104374), RUN, 3.0f);
  1657. Commands->Action_Goto (obj, params);
  1658. Commands->Set_Innate_Is_Stationary(obj, false);
  1659. hold = false;
  1660. poke_id = 3;
  1661. }
  1662. break;
  1663. case 3:
  1664. {
  1665. // \\Hold here. I'll be back.\n
  1666. const char *conv_name = ("M05_CON019");
  1667. int conv_id = Commands->Create_Conversation (conv_name);
  1668. Commands->Join_Conversation(obj, conv_id, false, true);
  1669. Commands->Start_Conversation (conv_id, 1);
  1670. Commands->Monitor_Conversation (obj, conv_id);
  1671. Vector3 my_loc = Commands->Get_Position(obj);
  1672. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  1673. params.Set_Movement (my_loc, RUN, 3.0f);
  1674. Commands->Action_Goto (obj, params);
  1675. Commands->Set_Innate_Is_Stationary(obj, true);
  1676. hold = true;
  1677. poke_id = 2;
  1678. }
  1679. break;
  1680. case 4:
  1681. {
  1682. // We shall never surrender!\n
  1683. const char *conv_name = ("M05_CON021");
  1684. int conv_id = Commands->Create_Conversation (conv_name);
  1685. Commands->Join_Conversation(obj, conv_id, false, true);
  1686. Commands->Start_Conversation (conv_id, 1);
  1687. Commands->Monitor_Conversation (obj, conv_id);
  1688. }
  1689. break;
  1690. }
  1691. }
  1692. }
  1693. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1694. {
  1695. ActionParamsStruct params;
  1696. if(type == 100 && param == 100)
  1697. {
  1698. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  1699. poke_id = 3;
  1700. // Enable Mendoza above cache
  1701. Commands->Enable_Spawner(100076, true);
  1702. Commands->Action_Reset ( obj, INNATE_PRIORITY_ENEMY_SEEN - 5 );
  1703. Commands->Set_Innate_Is_Stationary(obj, false);
  1704. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_CHINOOK);
  1705. params.Set_Movement (Commands->Find_Object(104374), RUN, 3.0f);
  1706. Commands->Action_Goto (obj, params);
  1707. }
  1708. if(type == 100 && param == 101)
  1709. {
  1710. arrived = true;
  1711. Commands->Action_Reset(obj, true);
  1712. // Commands->Set_Innate_Is_Stationary(obj, true);
  1713. if(obj == Commands->Find_Object(100033))
  1714. {
  1715. if(!Commands->Find_Object(100034))
  1716. {
  1717. // Thank you GDI, these weapons will help.\n
  1718. const char *conv_name = ("M05_CON020");
  1719. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1720. Commands->Join_Conversation(obj, conv_id, false, true);
  1721. Commands->Join_Conversation(STAR, conv_id, false, true);
  1722. Commands->Start_Conversation (conv_id, 1);
  1723. Commands->Monitor_Conversation (obj, conv_id);
  1724. }
  1725. }
  1726. else
  1727. {
  1728. // Thank you GDI, these weapons will help.\n
  1729. const char *conv_name = ("M05_CON020");
  1730. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1731. Commands->Join_Conversation(obj, conv_id, false, true);
  1732. Commands->Join_Conversation(STAR, conv_id, false, true);
  1733. Commands->Start_Conversation (conv_id, 1);
  1734. Commands->Monitor_Conversation (obj, conv_id);
  1735. }
  1736. // Establish homepoints around cache
  1737. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  1738. poke_id = 4;
  1739. }
  1740. }
  1741. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1742. {
  1743. ActionParamsStruct params;
  1744. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1745. {
  1746. conversation = false;
  1747. }
  1748. if(action_id == GO_CHINOOK && reason == ACTION_COMPLETE_NORMAL)
  1749. {
  1750. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 4.0f);
  1751. }
  1752. if((action_id == GO_CHINOOK) && (action_id != Commands->Get_Action_ID(obj)) && (!Commands->Is_Performing_Pathfind_Action(obj)) && (reason == ACTION_COMPLETE_LOW_PRIORITY))
  1753. {
  1754. Commands->Start_Timer(obj, this, 4.0f, GO_CHINOOK);
  1755. }
  1756. }
  1757. void Timer_Expired(GameObject* obj, int timer_id)
  1758. {
  1759. ActionParamsStruct params;
  1760. if(timer_id == GO_CHINOOK)
  1761. {
  1762. if(!hold)
  1763. {
  1764. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_CHINOOK);
  1765. params.Set_Movement (Commands->Find_Object(104374), RUN, 3.0f);
  1766. Commands->Action_Goto (obj, params);
  1767. }
  1768. }
  1769. }
  1770. };
  1771. DECLARE_SCRIPT(M05_Cache_Assault, "")
  1772. {
  1773. // Register variables to be Auto-Saved
  1774. // All variables must have a unique ID, less than 256, that never changes
  1775. REGISTER_VARIABLES()
  1776. {
  1777. // SAVE_VARIABLE( poke_id, 1 );
  1778. }
  1779. void Created (GameObject * obj)
  1780. {
  1781. ActionParamsStruct params;
  1782. if(Commands->Find_Object(100133))
  1783. {
  1784. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  1785. params.Set_Movement (Commands->Find_Object(100133), RUN, 3.0f);
  1786. params.MoveFollow = true;
  1787. Commands->Action_Goto (obj, params);
  1788. }
  1789. else if(Commands->Find_Object(100134))
  1790. {
  1791. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  1792. params.Set_Movement (Commands->Find_Object(100134), RUN, 3.0f);
  1793. params.MoveFollow = true;
  1794. Commands->Action_Goto (obj, params);
  1795. }
  1796. }
  1797. };
  1798. DECLARE_SCRIPT(M05_Chinook_Supply_Cache, "")
  1799. {
  1800. bool already_entered;
  1801. // Register variables to be Auto-Saved
  1802. // All variables must have a unique ID, less than 256, that never changes
  1803. REGISTER_VARIABLES()
  1804. {
  1805. SAVE_VARIABLE( already_entered, 1 );
  1806. }
  1807. void Created (GameObject * obj)
  1808. {
  1809. already_entered = false;
  1810. }
  1811. void Entered (GameObject * obj, GameObject * enterer)
  1812. {
  1813. if (((enterer == Commands->Find_Object(100033)) || (enterer == Commands->Find_Object(100034))) && (!already_entered))
  1814. {
  1815. already_entered = true;
  1816. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 508, 1, 0.0f);
  1817. Commands->Send_Custom_Event(obj, Commands->Find_Object(100162), M05_CIV_ARRIVED, 1, 0.0f);
  1818. // Send custom to the two civ resist escort to inform them of arrival
  1819. if(Commands->Find_Object(100033))
  1820. {
  1821. Commands->Send_Custom_Event(obj, Commands->Find_Object(100033), 100, 101, 0.0f);
  1822. }
  1823. if(Commands->Find_Object(100034))
  1824. {
  1825. Commands->Send_Custom_Event(obj, Commands->Find_Object(100034), 100, 101, 0.0f);
  1826. }
  1827. }
  1828. }
  1829. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  1830. {
  1831. ActionParamsStruct params;
  1832. if(type == 100 && param == 100)
  1833. {
  1834. already_entered = true;
  1835. }
  1836. }
  1837. };
  1838. DECLARE_SCRIPT(M05_Chateau_Escapee, "")
  1839. {
  1840. enum{DESTROY_SELF};
  1841. // Register variables to be Auto-Saved
  1842. // All variables must have a unique ID, less than 256, that never changes
  1843. REGISTER_VARIABLES()
  1844. {
  1845. // SAVE_VARIABLE( already_entered, 1 );
  1846. }
  1847. void Created (GameObject * obj)
  1848. {
  1849. ActionParamsStruct params;
  1850. Commands->Innate_Disable(obj);
  1851. Commands->Set_Animation ( obj, "S_A_HUMAN.H_A_601A", true );
  1852. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  1853. }
  1854. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1855. {
  1856. if (type == M05_CUSTOM_ACTIVATE)
  1857. {
  1858. Commands->Set_Animation ( obj, "S_A_HUMAN.H_A_7002", true );
  1859. Vector3 myPosition = Commands->Get_Position ( obj );
  1860. Commands->Create_Object ( "Visceroid", myPosition );
  1861. Commands->Start_Timer (obj, this, 0.5f, DESTROY_SELF);
  1862. }
  1863. }
  1864. void Timer_Expired (GameObject* obj, int timer_id)
  1865. {
  1866. ActionParamsStruct params;
  1867. if(timer_id == DESTROY_SELF)
  1868. {
  1869. Commands->Apply_Damage( obj, 10000, "STEEL", NULL );
  1870. }
  1871. }
  1872. };
  1873. DECLARE_SCRIPT(M05_Escapee_Brother, "")
  1874. {
  1875. int poke_id;
  1876. bool conversation;
  1877. bool complete;
  1878. // Register variables to be Auto-Saved
  1879. // All variables must have a unique ID, less than 256, that never changes
  1880. REGISTER_VARIABLES()
  1881. {
  1882. SAVE_VARIABLE( poke_id, 1 );
  1883. SAVE_VARIABLE( conversation, 2 );
  1884. SAVE_VARIABLE( complete, 3 );
  1885. }
  1886. void Created (GameObject * obj)
  1887. {
  1888. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  1889. Commands->Set_Innate_Is_Stationary(obj, true);
  1890. poke_id = 1;
  1891. conversation = false;
  1892. complete = false;
  1893. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  1894. Commands->Give_PowerUp(obj, "POW_Shotgun_AI");
  1895. }
  1896. void Poked(GameObject * obj, GameObject * poker)
  1897. {
  1898. if (Commands->Is_A_Star(poker) && (!conversation))
  1899. {
  1900. conversation = true;
  1901. switch (poke_id)
  1902. {
  1903. case 1:
  1904. {
  1905. // Got one back from the dead huh? What you got for me?\n
  1906. const char *conv_name = ("M05_CON022");
  1907. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  1908. Commands->Join_Conversation(STAR, conv_id, false, true);
  1909. Commands->Join_Conversation(obj, conv_id, false, true);
  1910. Commands->Start_Conversation (conv_id, 300509);
  1911. Commands->Monitor_Conversation (obj, conv_id);
  1912. poke_id = 2;
  1913. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  1914. }
  1915. break;
  1916. }
  1917. }
  1918. }
  1919. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1920. {
  1921. ActionParamsStruct params;
  1922. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1923. {
  1924. conversation = false;
  1925. }
  1926. if(action_id == 300509 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1927. {
  1928. Commands->Select_Weapon(obj, "Weapon_Shotgun_Ai" );
  1929. complete = true;
  1930. Commands->Set_Innate_Is_Stationary(obj, false);
  1931. Vector3 pos = Commands->Get_Position(obj);
  1932. float facing = Commands->Get_Facing(obj);
  1933. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  1934. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  1935. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  1936. Commands->Create_Object("POW_PersonalIonCannon_Player", powerup_loc);
  1937. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 509, 1, 0.0f);
  1938. GameObject * window_shooter = Commands->Create_Object ( "Nod_Gun_Emplacement_Dec", Vector3(-346.865f, 40.418f, 22.279f));
  1939. Commands->Set_Facing(window_shooter, -145.000f);
  1940. Commands->Attach_Script(window_shooter, "M05_Escapee_Windows", "");
  1941. // Spawn Escapee Invaders
  1942. Commands->Enable_Spawner(100749, true);
  1943. Commands->Enable_Spawner(100750, true);
  1944. Commands->Enable_Spawner(100751, true);
  1945. // Turn escapee into Visceroid
  1946. Commands->Send_Custom_Event(obj, Commands->Find_Object(100037), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  1947. }
  1948. }
  1949. void Killed (GameObject * obj, GameObject * killer)
  1950. {
  1951. if(!complete)
  1952. {
  1953. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 509, 2, 0.0f);
  1954. }
  1955. }
  1956. };
  1957. DECLARE_SCRIPT(M05_Escapee_Invaders, "")
  1958. {
  1959. // Register variables to be Auto-Saved
  1960. // All variables must have a unique ID, less than 256, that never changes
  1961. REGISTER_VARIABLES()
  1962. {
  1963. // SAVE_VARIABLE( poke_id, 1 );
  1964. }
  1965. void Created (GameObject * obj)
  1966. {
  1967. ActionParamsStruct params;
  1968. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  1969. params.Set_Movement (STAR, RUN, 3.0f);
  1970. Commands->Action_Goto (obj, params);
  1971. }
  1972. };
  1973. DECLARE_SCRIPT(M05_Escapee_Windows, "")
  1974. {
  1975. enum{DESTROY_WINDOWS, DESTROY_SELF};
  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( poke_id, 1 );
  1981. }
  1982. void Created (GameObject * obj)
  1983. {
  1984. ActionParamsStruct params;
  1985. Commands->Set_Is_Rendered(obj, false);
  1986. GameObject * window1 = Commands->Find_Object(100754);
  1987. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, DESTROY_WINDOWS );
  1988. params.Set_Attack (window1, 250.0f, 0.0f, 1);
  1989. params.AttackCheckBlocked = false;
  1990. Commands->Action_Attack( obj, params );
  1991. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(window1));
  1992. Commands->Start_Timer (obj, this, 1.0f, DESTROY_WINDOWS);
  1993. Commands->Start_Timer (obj, this, 3.0f, DESTROY_SELF);
  1994. }
  1995. void Timer_Expired (GameObject* obj, int timer_id)
  1996. {
  1997. ActionParamsStruct params;
  1998. if(timer_id == DESTROY_WINDOWS)
  1999. {
  2000. GameObject * window2 = Commands->Find_Object(100755);
  2001. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, DESTROY_WINDOWS );
  2002. params.Set_Attack (window2, 250.0f, 0.0f, 1);
  2003. params.AttackCheckBlocked = false;
  2004. Commands->Modify_Action (obj, DESTROY_WINDOWS, params);
  2005. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(window2));
  2006. }
  2007. if(timer_id == DESTROY_SELF)
  2008. {
  2009. Commands->Destroy_Object(obj);
  2010. }
  2011. }
  2012. };
  2013. DECLARE_SCRIPT(M05_Activate_Deadeye, "")
  2014. {
  2015. bool already_entered;
  2016. // Register variables to be Auto-Saved
  2017. // All variables must have a unique ID, less than 256, that never changes
  2018. REGISTER_VARIABLES()
  2019. {
  2020. SAVE_VARIABLE( already_entered, 1 );
  2021. }
  2022. void Created (GameObject * obj)
  2023. {
  2024. already_entered = false;
  2025. }
  2026. void Entered (GameObject * obj, GameObject * enterer)
  2027. {
  2028. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2029. {
  2030. already_entered = true;
  2031. // Send custom to Deadeye to activate him
  2032. Commands->Send_Custom_Event (obj, Commands->Find_Object(100004), M05_STAR_INN, 1, 0.0f);
  2033. }
  2034. }
  2035. };
  2036. DECLARE_SCRIPT(M05_Heal_Dead6, "")
  2037. {
  2038. enum{HEAL_DEAD6};
  2039. bool already_entered;
  2040. // Register variables to be Auto-Saved
  2041. // All variables must have a unique ID, less than 256, that never changes
  2042. REGISTER_VARIABLES()
  2043. {
  2044. SAVE_VARIABLE( already_entered, 1 );
  2045. }
  2046. void Created (GameObject * obj)
  2047. {
  2048. already_entered = false;
  2049. }
  2050. void Entered (GameObject * obj, GameObject * enterer)
  2051. {
  2052. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2053. {
  2054. already_entered = true;
  2055. Commands->Start_Timer (obj, this, 0.0f, HEAL_DEAD6);
  2056. }
  2057. }
  2058. void Timer_Expired(GameObject * obj, int timer_id )
  2059. {
  2060. ActionParamsStruct params;
  2061. if(timer_id == HEAL_DEAD6)
  2062. {
  2063. // Gunner
  2064. Commands->Apply_Damage(Commands->Find_Object(100048), -10000.0f, "STEEL", NULL );
  2065. // Deadeye
  2066. Commands->Apply_Damage(Commands->Find_Object(100004), -10000.0f, "STEEL", NULL );
  2067. // Hotwire
  2068. Commands->Apply_Damage(Commands->Find_Object(100047), -10000.0f, "STEEL", NULL );
  2069. // Patch
  2070. Commands->Apply_Damage(Commands->Find_Object(100006), -10000.0f, "STEEL", NULL );
  2071. Commands->Start_Timer (obj, this, 12.0f, HEAL_DEAD6);
  2072. }
  2073. }
  2074. };
  2075. DECLARE_SCRIPT(M05_Activate_Babushka_Encounter, "")
  2076. {
  2077. bool already_entered;
  2078. // Register variables to be Auto-Saved
  2079. // All variables must have a unique ID, less than 256, that never changes
  2080. REGISTER_VARIABLES()
  2081. {
  2082. SAVE_VARIABLE( already_entered, 1 );
  2083. }
  2084. void Created (GameObject * obj)
  2085. {
  2086. already_entered = false;
  2087. }
  2088. void Entered (GameObject * obj, GameObject * enterer)
  2089. {
  2090. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2091. {
  2092. // Custom sent to Nod_Minigunner_2SF holding Babushka to start interrogation
  2093. Commands->Send_Custom_Event(obj, Commands->Find_Object(100052), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  2094. }
  2095. }
  2096. };
  2097. DECLARE_SCRIPT(M05_Babushka, "")
  2098. {
  2099. int poke_id;
  2100. bool conversation;
  2101. bool saved;
  2102. enum{ARM_SHOTGUN};
  2103. // Register variables to be Auto-Saved
  2104. // All variables must have a unique ID, less than 256, that never changes
  2105. REGISTER_VARIABLES()
  2106. {
  2107. SAVE_VARIABLE( poke_id, 1 );
  2108. SAVE_VARIABLE( conversation, 2 );
  2109. SAVE_VARIABLE( saved, 3 );
  2110. }
  2111. void Created (GameObject * obj)
  2112. {
  2113. ActionParamsStruct params;
  2114. conversation = false;
  2115. saved = false;
  2116. poke_id = 1;
  2117. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  2118. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  2119. Commands->Set_Innate_Is_Stationary(obj, true);
  2120. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1000);
  2121. params.Set_Animation( "H_A_Host_L1b", true );
  2122. Commands->Action_Play_Animation (obj, params);
  2123. }
  2124. void Timer_Expired(GameObject * obj, int timer_id )
  2125. {
  2126. ActionParamsStruct params;
  2127. if(timer_id == ARM_SHOTGUN)
  2128. {
  2129. // Commands->Select_Weapon(obj, "Weapon_Chaingun_AI" );
  2130. }
  2131. }
  2132. void Poked(GameObject * obj, GameObject * poker)
  2133. {
  2134. ActionParamsStruct params;
  2135. if (Commands->Is_A_Star(poker) && (!conversation))
  2136. {
  2137. conversation = true;
  2138. switch (poke_id)
  2139. {
  2140. case 1:
  2141. {
  2142. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1000);
  2143. params.Set_Animation( "H_A_Host_L1c", false );
  2144. Commands->Action_Play_Animation (obj, params);
  2145. Commands->Action_Reset(obj, 100);
  2146. // Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  2147. Commands->Start_Timer (obj, this, 1.0f, ARM_SHOTGUN);
  2148. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  2149. // You have my thanks, brave warrior. Our village is in debt to you.\n
  2150. const char *conv_name = ("M05_CON023");
  2151. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN - 5, 200.0f, false);
  2152. Commands->Join_Conversation(obj, conv_id, false, true);
  2153. Commands->Join_Conversation(STAR, conv_id, false, true);
  2154. Commands->Start_Conversation (conv_id, 300509);
  2155. Commands->Monitor_Conversation (obj, conv_id);
  2156. poke_id = 2;
  2157. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2158. }
  2159. break;
  2160. }
  2161. }
  2162. }
  2163. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2164. {
  2165. ActionParamsStruct params;
  2166. if(type == M05_CUSTOM_ACTIVATE)
  2167. {
  2168. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  2169. }
  2170. }
  2171. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2172. {
  2173. ActionParamsStruct params;
  2174. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2175. {
  2176. conversation = false;
  2177. }
  2178. if(action_id == 300509 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2179. {
  2180. saved = true;
  2181. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 510, 1, 0.0f);
  2182. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 5);
  2183. params.Set_Movement (Vector3 (-75.498f, 191.288f, 30.246f), RUN, 3.0f);
  2184. Commands->Action_Goto (obj, params);
  2185. }
  2186. }
  2187. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2188. {
  2189. if(Commands->Get_Health(obj) < 10.0f)
  2190. {
  2191. // Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  2192. Commands->Start_Timer (obj, this, 1.0f, ARM_SHOTGUN);
  2193. // Commands->Set_Health(obj, 10.0f);
  2194. }
  2195. /* if(Commands->Get_Health(obj) < (.3 * Commands->Get_Max_Health(obj)))
  2196. {
  2197. Commands->Apply_Damage( obj, -10000.0f, "STEEL", NULL );
  2198. }*/
  2199. }
  2200. void Killed (GameObject * obj, GameObject * killer)
  2201. {
  2202. if(!saved)
  2203. {
  2204. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 510, 2, 0.0f);
  2205. }
  2206. }
  2207. };
  2208. DECLARE_SCRIPT(M05_Babushka_Guard, "")
  2209. {
  2210. // Register variables to be Auto-Saved
  2211. // All variables must have a unique ID, less than 256, that never changes
  2212. REGISTER_VARIABLES()
  2213. {
  2214. // SAVE_VARIABLE( poke_id, 1 );
  2215. }
  2216. void Created (GameObject * obj)
  2217. {
  2218. Commands->Set_Innate_Is_Stationary(obj, true);
  2219. }
  2220. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2221. {
  2222. if(Commands->Is_A_Star(enemy))
  2223. {
  2224. Commands->Set_Innate_Is_Stationary(obj, false);
  2225. }
  2226. }
  2227. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2228. {
  2229. ActionParamsStruct params;
  2230. if(type == M05_CUSTOM_ACTIVATE)
  2231. {
  2232. if(Commands->Find_Object(100051) && Commands->Find_Object(100050))
  2233. {
  2234. // We know that you are their leader.\n
  2235. const char *conv_name = ("M05_CON024");
  2236. int conv_id = Commands->Create_Conversation (conv_name);
  2237. Commands->Join_Conversation(obj, conv_id, false, true);
  2238. Commands->Join_Conversation(Commands->Find_Object(100051), conv_id, false, true);
  2239. Commands->Join_Conversation(Commands->Find_Object(100050), conv_id, false, true);
  2240. Commands->Start_Conversation (conv_id, 300000);
  2241. Commands->Monitor_Conversation (obj, conv_id);
  2242. }
  2243. }
  2244. }
  2245. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2246. {
  2247. if(action_id == 300000)
  2248. {
  2249. // Send custom to Babushka to make her playertype GDI
  2250. Commands->Send_Custom_Event(obj, Commands->Find_Object(100050), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  2251. }
  2252. }
  2253. void Killed (GameObject * obj, GameObject * killer)
  2254. {
  2255. Commands->Send_Custom_Event(obj, Commands->Find_Object(100050), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  2256. }
  2257. };
  2258. DECLARE_SCRIPT (M05_Park_Activate, "")
  2259. {
  2260. bool already_entered;
  2261. // Register variables to be Auto-Saved
  2262. // All variables must have a unique ID, less than 256, that never changes
  2263. REGISTER_VARIABLES()
  2264. {
  2265. SAVE_VARIABLE( already_entered, 1 );
  2266. }
  2267. void Created (GameObject * obj)
  2268. {
  2269. already_entered = false;
  2270. }
  2271. void Entered (GameObject * obj, GameObject * enterer)
  2272. {
  2273. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2274. {
  2275. already_entered = true;
  2276. // Attention GDI forces, this is Resistance Radio. Nod is completing construction of an Obelisk in the Park, on the northwestern side. If anyone is near the area, eliminate all Nod Engineers to stop construction.\n
  2277. const char *conv_name = ("M05_CON037");
  2278. int conv_id = Commands->Create_Conversation (conv_name);
  2279. Commands->Join_Conversation(NULL, conv_id, false, true);
  2280. Commands->Join_Conversation(STAR, conv_id, false, true);
  2281. Commands->Start_Conversation (conv_id, 300512);
  2282. Commands->Monitor_Conversation (obj, conv_id);
  2283. }
  2284. }
  2285. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2286. {
  2287. if(action_id == 300512 && (reason == ACTION_COMPLETE_CONVERSATION_ENDED || reason == ACTION_COMPLETE_CONVERSATION_INTERRUPTED))
  2288. {
  2289. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 512, 3, 0.0f);
  2290. }
  2291. }
  2292. };
  2293. DECLARE_SCRIPT (M05_Park_Controller, "")
  2294. {
  2295. int m05_park_engineer_killed;
  2296. int m05_park_unit_killed;
  2297. int m05_park_vehicle_killed;
  2298. int artillery_sound1;
  2299. int artillery_sound2;
  2300. int artillery_sound3;
  2301. Vector3 artillery_loc1;
  2302. Vector3 artillery_loc2;
  2303. Vector3 artillery_loc3;
  2304. int loop_count;
  2305. int loop_amnt;
  2306. enum{START_ARTILLERY, PARK_ROCKET_SOLDIERS};
  2307. // Register variables to be Auto-Saved
  2308. // All variables must have a unique ID, less than 256, that never changes
  2309. REGISTER_VARIABLES()
  2310. {
  2311. SAVE_VARIABLE( m05_park_engineer_killed, 1 );
  2312. SAVE_VARIABLE( m05_park_unit_killed, 2 );
  2313. SAVE_VARIABLE( m05_park_vehicle_killed, 3 );
  2314. SAVE_VARIABLE( artillery_sound1, 4 );
  2315. SAVE_VARIABLE( artillery_sound2, 5 );
  2316. SAVE_VARIABLE( artillery_sound3, 6 );
  2317. SAVE_VARIABLE( loop_count, 7 );
  2318. SAVE_VARIABLE( loop_amnt, 8 );
  2319. }
  2320. void Created (GameObject * obj)
  2321. {
  2322. m05_park_engineer_killed = 0;
  2323. m05_park_unit_killed = 0;
  2324. m05_park_vehicle_killed = 0;
  2325. artillery_sound1 = 0;
  2326. artillery_sound2 = 0;
  2327. artillery_sound3 = 0;
  2328. loop_count = 0;
  2329. loop_amnt = 0;
  2330. }
  2331. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  2332. {
  2333. if(type == M05_PARK_ENGINEER_KILLED)
  2334. {
  2335. m05_park_engineer_killed++;
  2336. if (m05_park_engineer_killed == 1)
  2337. {
  2338. Commands->Enable_Spawner(100074, true);
  2339. }
  2340. if (m05_park_engineer_killed == 2)
  2341. {
  2342. Commands->Enable_Spawner(100075, true);
  2343. }
  2344. if (m05_park_engineer_killed == 6)
  2345. {
  2346. // Accomplished mission objective by killing all of the engineers
  2347. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 512, 1, 0.0f);
  2348. // Grant armor increase medal
  2349. Commands->Create_Object ( "POW_Medal_Armor", Vector3(-405.399f, 64.234f, 28.250f));
  2350. }
  2351. }
  2352. if(type == M05_PARK_UNIT_KILLED)
  2353. {
  2354. m05_park_unit_killed++;
  2355. if (m05_park_unit_killed%2 == 0 && m05_park_unit_killed < 8)
  2356. {
  2357. // Respawn Park Rocket Soldiers
  2358. Commands->Start_Timer (obj, this, 10.0f, PARK_ROCKET_SOLDIERS);
  2359. }
  2360. else
  2361. {
  2362. // Start Artillery
  2363. Commands->Start_Timer (obj, this, 1.0f, START_ARTILLERY);
  2364. }
  2365. }
  2366. if(type == M05_PARK_VEHICLE_KILLED)
  2367. {
  2368. m05_park_vehicle_killed++;
  2369. if (m05_park_vehicle_killed == 1)
  2370. {
  2371. // Spawn Apache
  2372. Commands->Enable_Spawner(100721, true);
  2373. }
  2374. else
  2375. {
  2376. // Start Artillery
  2377. Commands->Start_Timer (obj, this, 1.0f, START_ARTILLERY);
  2378. }
  2379. }
  2380. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound1)
  2381. {
  2382. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc1);
  2383. }
  2384. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound2)
  2385. {
  2386. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc2);
  2387. }
  2388. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound3)
  2389. {
  2390. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc3);
  2391. }
  2392. }
  2393. void Timer_Expired(GameObject * obj, int timer_id )
  2394. {
  2395. if(timer_id == PARK_ROCKET_SOLDIERS)
  2396. {
  2397. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-446.924f, 103.269f, 17.665f));
  2398. Commands->Set_Facing(chinook_obj1, 10.000f);
  2399. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_C130TroopDrop7.txt");
  2400. }
  2401. if(timer_id == START_ARTILLERY && loop_count < loop_amnt)
  2402. {
  2403. loop_count++;
  2404. int artillery_id1 = Get_Int_Parameter("Artillery_ID1");
  2405. artillery_loc1 = Commands->Get_Position(Commands->Find_Object(artillery_id1));
  2406. int artillery_id2 = Get_Int_Parameter("Artillery_ID2");
  2407. artillery_loc2 = Commands->Get_Position(Commands->Find_Object(artillery_id2));
  2408. int artillery_id3 = Get_Int_Parameter("Artillery_ID3");
  2409. artillery_loc3 = Commands->Get_Position(Commands->Find_Object(artillery_id3));
  2410. char *bomb[3] =
  2411. {
  2412. "Falling_Bomb_01",
  2413. "Falling_Bomb_02",
  2414. "Falling_Bomb_03",
  2415. };
  2416. int random = Commands->Get_Random_Int(0, 2);
  2417. artillery_sound1 = Commands->Create_Sound ( bomb[random], artillery_loc1, obj );
  2418. Commands->Monitor_Sound (obj, artillery_sound1);
  2419. random = Commands->Get_Random_Int(0, 2);
  2420. artillery_sound2 = Commands->Create_Sound ( bomb[random], artillery_loc2, obj );
  2421. Commands->Monitor_Sound (obj, artillery_sound2);
  2422. random = Commands->Get_Random_Int(0, 2);
  2423. artillery_sound3 = Commands->Create_Sound ( bomb[random], artillery_loc3, obj );
  2424. Commands->Monitor_Sound (obj, artillery_sound3);
  2425. float time = Commands->Get_Random(0.5f, 3.0f);
  2426. Commands->Start_Timer (obj, this, time, START_ARTILLERY);
  2427. }
  2428. }
  2429. };
  2430. DECLARE_SCRIPT(M05_Park_Apache, "")
  2431. {
  2432. bool attacking;
  2433. bool alerted;
  2434. enum{WAYPATH, NEW_CLOSEST, ATTACK_OVER};
  2435. // Register variables to be Auto-Saved
  2436. // All variables must have a unique ID, less than 256, that never changes
  2437. REGISTER_VARIABLES()
  2438. {
  2439. SAVE_VARIABLE( attacking, 1 );
  2440. SAVE_VARIABLE( alerted, 2 );
  2441. }
  2442. void Created(GameObject * obj)
  2443. {
  2444. attacking = false;
  2445. alerted = false;
  2446. ActionParamsStruct params;
  2447. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2448. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2449. params.WaypathID = 100722;
  2450. Commands->Action_Attack( obj, params );
  2451. Commands->Enable_Enemy_Seen( obj, true);
  2452. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  2453. }
  2454. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2455. {
  2456. ActionParamsStruct params;
  2457. if(!attacking)
  2458. {
  2459. attacking = true;
  2460. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
  2461. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2462. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  2463. params.WaypathID = 100722;
  2464. Commands->Modify_Action (obj, WAYPATH, params);
  2465. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2466. }
  2467. }
  2468. void Timer_Expired (GameObject* obj, int timer_id)
  2469. {
  2470. ActionParamsStruct params;
  2471. if(timer_id == ATTACK_OVER)
  2472. {
  2473. attacking = false;
  2474. }
  2475. }
  2476. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2477. {
  2478. ActionParamsStruct params;
  2479. if ( sound.Type == M05_PARK_ALERT )
  2480. {
  2481. if(!alerted)
  2482. {
  2483. alerted = true;
  2484. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  2485. }
  2486. }
  2487. }
  2488. };
  2489. DECLARE_SCRIPT(M05_ParkSniper, "")
  2490. {
  2491. bool already_seen;
  2492. bool alerted;
  2493. // Register variables to be Auto-Saved
  2494. // All variables must have a unique ID, less than 256, that never changes
  2495. REGISTER_VARIABLES()
  2496. {
  2497. SAVE_VARIABLE( already_seen, 1 );
  2498. SAVE_VARIABLE( alerted, 2 );
  2499. }
  2500. void Created (GameObject * obj)
  2501. {
  2502. Commands->Set_Innate_Is_Stationary(obj, true);
  2503. already_seen = false;
  2504. alerted = false;
  2505. }
  2506. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2507. {
  2508. if(Commands->Is_A_Star(enemy))
  2509. {
  2510. Commands->Create_Logical_Sound(obj, M05_PARK_ALERT, Commands->Get_Position(obj), 5000.0f);
  2511. }
  2512. }
  2513. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2514. {
  2515. ActionParamsStruct params;
  2516. if ( sound.Type == M05_PARK_ALERT )
  2517. {
  2518. if(!alerted)
  2519. {
  2520. alerted = true;
  2521. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  2522. }
  2523. }
  2524. }
  2525. void Damaged (GameObject * obj, GameObject * damager, float amount)
  2526. {
  2527. if(Commands->Is_A_Star(damager))
  2528. {
  2529. Commands->Create_Logical_Sound(obj, M05_PARK_ALERT, Commands->Get_Position(obj), 5000.0f);
  2530. }
  2531. }
  2532. void Killed (GameObject * obj, GameObject * killer)
  2533. {
  2534. Commands->Send_Custom_Event(obj, Commands->Find_Object(100632), M05_PARK_UNIT_KILLED, 1, 0.0f);
  2535. }
  2536. };
  2537. DECLARE_SCRIPT(M05_Park_Buggy, "")
  2538. {
  2539. bool attacking;
  2540. bool alerted;
  2541. enum{ATTACK_OVER};
  2542. // Register variables to be Auto-Saved
  2543. // All variables must have a unique ID, less than 256, that never changes
  2544. REGISTER_VARIABLES()
  2545. {
  2546. SAVE_VARIABLE( attacking, 1 );
  2547. SAVE_VARIABLE( alerted, 2 );
  2548. }
  2549. void Created (GameObject * obj)
  2550. {
  2551. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NOD );
  2552. Commands->Enable_Enemy_Seen( obj, true);
  2553. attacking = false;
  2554. alerted = false;
  2555. }
  2556. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2557. {
  2558. ActionParamsStruct params;
  2559. if(!attacking)
  2560. {
  2561. attacking = true;
  2562. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  2563. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  2564. params.AttackCheckBlocked = false;
  2565. Commands->Action_Attack( obj, params );
  2566. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2567. }
  2568. }
  2569. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2570. {
  2571. ActionParamsStruct params;
  2572. if ( sound.Type == M05_PARK_ALERT )
  2573. {
  2574. if(!alerted)
  2575. {
  2576. alerted = true;
  2577. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  2578. }
  2579. }
  2580. }
  2581. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2582. {
  2583. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  2584. {
  2585. return;
  2586. }
  2587. ActionParamsStruct params;
  2588. if(!attacking)
  2589. {
  2590. attacking = true;
  2591. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  2592. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  2593. params.AttackCheckBlocked = false;
  2594. Commands->Action_Attack( obj, params );
  2595. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  2596. }
  2597. }
  2598. void Timer_Expired (GameObject* obj, int timer_id)
  2599. {
  2600. ActionParamsStruct params;
  2601. if(timer_id == ATTACK_OVER)
  2602. {
  2603. attacking = false;
  2604. }
  2605. }
  2606. void Killed (GameObject * obj, GameObject * killer)
  2607. {
  2608. Commands->Send_Custom_Event(obj, Commands->Find_Object(100632), M05_PARK_VEHICLE_KILLED, 1, 0.0f);
  2609. }
  2610. };
  2611. DECLARE_SCRIPT(M05_ParkEngineer, "")
  2612. {
  2613. int truck_id[4];
  2614. int truck_cnt;
  2615. bool alerted;
  2616. enum {ESCAPE_ROUTE, ESCAPED};
  2617. // Register variables to be Auto-Saved
  2618. // All variables must have a unique ID, less than 256, that never changes
  2619. REGISTER_VARIABLES()
  2620. {
  2621. SAVE_VARIABLE( truck_cnt, 1 );
  2622. SAVE_VARIABLE( alerted, 2 );
  2623. }
  2624. void Created (GameObject * obj)
  2625. {
  2626. alerted = false;
  2627. ActionParamsStruct params;
  2628. truck_id[0] = 100060;
  2629. truck_id[1] = 100061;
  2630. truck_id[2] = 100062;
  2631. truck_id[3] = 100063;
  2632. truck_cnt = 0;
  2633. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  2634. params.Set_Movement( Commands->Find_Object(truck_id[truck_cnt]), WALK, 1.5f );
  2635. Commands->Action_Goto( obj, params );
  2636. }
  2637. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2638. {
  2639. ActionParamsStruct params;
  2640. // Technicians working on the obelisk
  2641. if(action_id == 10 && reason == ACTION_COMPLETE_NORMAL)
  2642. {
  2643. Vector3 hedge_pos = Commands->Get_Position(Commands->Find_Object(truck_id[truck_cnt]));
  2644. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 11);
  2645. params.Set_Face_Location( hedge_pos, 1.0f);
  2646. Commands->Action_Face_Location ( obj, params );
  2647. }
  2648. if(action_id == 11 && reason == ACTION_COMPLETE_NORMAL)
  2649. {
  2650. Commands->Start_Timer(obj, this, 4.0f, 12);
  2651. truck_cnt++;
  2652. if(truck_cnt == 3)
  2653. {
  2654. truck_cnt = 0;
  2655. }
  2656. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 12 );
  2657. params.Set_Animation ("H_A_a0f0", false);
  2658. Commands->Action_Play_Animation (obj, params);
  2659. }
  2660. if(action_id == ESCAPE_ROUTE && reason == ACTION_COMPLETE_NORMAL)
  2661. {
  2662. int waypath_id[3];
  2663. waypath_id[0] = 100681;
  2664. waypath_id[1] = 100692;
  2665. waypath_id[2] = 100703;
  2666. int random = Commands->Get_Random_Int(0, 2);
  2667. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ESCAPED );
  2668. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2669. params.WaypathID = waypath_id[random];
  2670. Commands->Action_Goto( obj, params );
  2671. }
  2672. if(action_id == ESCAPED && reason == ACTION_COMPLETE_NORMAL)
  2673. {
  2674. Commands->Destroy_Object(obj);
  2675. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 512, 2, 0.0f);
  2676. }
  2677. }
  2678. void Timer_Expired(GameObject * obj, int timer_id)
  2679. {
  2680. ActionParamsStruct params;
  2681. if(timer_id == 12)
  2682. {
  2683. params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD + 5, 10 );
  2684. params.Set_Movement( Commands->Find_Object(truck_id[truck_cnt]), WALK, 1.5f );
  2685. Commands->Action_Goto( obj, params );
  2686. }
  2687. }
  2688. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  2689. {
  2690. ActionParamsStruct params;
  2691. if ( sound.Type == M05_PARK_ALERT )
  2692. {
  2693. if(!alerted)
  2694. {
  2695. int engineer_conv = Commands->Get_Random_Int(0, 1);
  2696. if(engineer_conv == 0)
  2697. {
  2698. // Let's get out of here!\n
  2699. const char *conv_name = ("M05_CON025");
  2700. int conv_id = Commands->Create_Conversation (conv_name);
  2701. Commands->Join_Conversation(obj, conv_id, false, true);
  2702. Commands->Start_Conversation (conv_id, 1);
  2703. Commands->Monitor_Conversation (obj, conv_id);
  2704. }
  2705. else
  2706. {
  2707. // Make a run for the chopper!\n
  2708. const char *conv_name = ("M05_CON026");
  2709. int conv_id = Commands->Create_Conversation (conv_name);
  2710. Commands->Join_Conversation(obj, conv_id, false, true);
  2711. Commands->Start_Conversation (conv_id, 1);
  2712. Commands->Monitor_Conversation (obj, conv_id);
  2713. }
  2714. alerted = true;
  2715. int waypath_start_loc[3];
  2716. waypath_start_loc[0] = 101300;
  2717. waypath_start_loc[1] = 101301;
  2718. waypath_start_loc[2] = 101302;
  2719. int random = Commands->Get_Random_Int(0, 2);
  2720. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ESCAPE_ROUTE );
  2721. params.Set_Movement( Commands->Find_Object(waypath_start_loc[random]), RUN, 1.5f );
  2722. Commands->Action_Goto( obj, params );
  2723. }
  2724. }
  2725. }
  2726. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2727. {
  2728. if(Commands->Is_A_Star(enemy))
  2729. {
  2730. Commands->Create_Logical_Sound(obj, M05_PARK_ALERT, Commands->Get_Position(obj), 5000.0f);
  2731. }
  2732. }
  2733. void Damaged (GameObject * obj, GameObject * damager, float amount)
  2734. {
  2735. if(Commands->Is_A_Star(damager))
  2736. {
  2737. Commands->Create_Logical_Sound(obj, M05_PARK_ALERT, Commands->Get_Position(obj), 5000.0f);
  2738. }
  2739. }
  2740. void Killed (GameObject * obj, GameObject * killer)
  2741. {
  2742. Commands->Send_Custom_Event(obj, Commands->Find_Object(100632), M05_PARK_ENGINEER_KILLED, 1, 0.0f);
  2743. }
  2744. };
  2745. DECLARE_SCRIPT(M05_FleeEngineer, "")
  2746. {
  2747. bool already_seen;
  2748. enum {ESCAPE_ROUTE, ESCAPED};
  2749. // Register variables to be Auto-Saved
  2750. // All variables must have a unique ID, less than 256, that never changes
  2751. REGISTER_VARIABLES()
  2752. {
  2753. SAVE_VARIABLE( already_seen, 1 );
  2754. }
  2755. void Created (GameObject * obj)
  2756. {
  2757. int engineer_conv = Commands->Get_Random_Int(0, 1);
  2758. if(engineer_conv == 0)
  2759. {
  2760. // Let's get out of here!\n
  2761. const char *conv_name = ("M05_CON025");
  2762. int conv_id = Commands->Create_Conversation (conv_name);
  2763. Commands->Join_Conversation(obj, conv_id, false, true);
  2764. Commands->Start_Conversation (conv_id, 1);
  2765. Commands->Monitor_Conversation (obj, conv_id);
  2766. }
  2767. else
  2768. {
  2769. // Make a run for the chopper!\n
  2770. const char *conv_name = ("M05_CON026");
  2771. int conv_id = Commands->Create_Conversation (conv_name);
  2772. Commands->Join_Conversation(obj, conv_id, false, true);
  2773. Commands->Start_Conversation (conv_id, 1);
  2774. Commands->Monitor_Conversation (obj, conv_id);
  2775. }
  2776. ActionParamsStruct params;
  2777. int waypath_start_loc[3];
  2778. waypath_start_loc[0] = 101300;
  2779. waypath_start_loc[1] = 101301;
  2780. waypath_start_loc[2] = 101302;
  2781. int random = Commands->Get_Random_Int(0, 2);
  2782. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ESCAPE_ROUTE );
  2783. params.Set_Movement( Commands->Find_Object(waypath_start_loc[random]), RUN, 1.5f );
  2784. Commands->Action_Goto( obj, params );
  2785. }
  2786. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2787. {
  2788. if(action_id == ESCAPE_ROUTE && reason == ACTION_COMPLETE_NORMAL)
  2789. {
  2790. ActionParamsStruct params;
  2791. int waypath_id[3];
  2792. waypath_id[0] = 100681;
  2793. waypath_id[1] = 100692;
  2794. waypath_id[2] = 100703;
  2795. int random = Commands->Get_Random_Int(0, 2);
  2796. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ESCAPED );
  2797. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  2798. params.WaypathID = waypath_id[random];
  2799. Commands->Action_Goto( obj, params );
  2800. }
  2801. if(action_id == ESCAPED && reason == ACTION_COMPLETE_NORMAL)
  2802. {
  2803. Commands->Destroy_Object(obj);
  2804. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 512, 2, 0.0f);
  2805. }
  2806. }
  2807. void Killed (GameObject * obj, GameObject * killer)
  2808. {
  2809. Commands->Send_Custom_Event(obj, Commands->Find_Object(100632), M05_PARK_ENGINEER_KILLED, 1, 0.0f);
  2810. }
  2811. };
  2812. DECLARE_SCRIPT(M05_Mendoza3, "")
  2813. {
  2814. bool exiting;
  2815. bool saw_enemy;
  2816. float health;
  2817. enum {BYE_MENDOZA3};
  2818. // Register variables to be Auto-Saved
  2819. // All variables must have a unique ID, less than 256, that never changes
  2820. REGISTER_VARIABLES()
  2821. {
  2822. SAVE_VARIABLE( exiting, 1 );
  2823. SAVE_VARIABLE( saw_enemy, 2 );
  2824. SAVE_VARIABLE( health, 3 );
  2825. }
  2826. void Created (GameObject * obj)
  2827. {
  2828. Commands->Set_Innate_Is_Stationary(obj, true);
  2829. saw_enemy = false;
  2830. exiting = false;
  2831. health = Commands->Get_Max_Health(obj);
  2832. Commands->Give_PowerUp(obj, "POW_LaserRifle_AI");
  2833. Commands->Select_Weapon(obj, "Weapon_LaserRifle_AI" );
  2834. }
  2835. void Timer_Expired(GameObject * obj, int timer_id )
  2836. {
  2837. ActionParamsStruct params;
  2838. if(timer_id == BYE_MENDOZA3)
  2839. {
  2840. Commands->Destroy_Object(obj);
  2841. }
  2842. }
  2843. void Damaged (GameObject * obj, GameObject * damager, float amount)
  2844. {
  2845. ActionParamsStruct params;
  2846. if(health > (.2 * Commands->Get_Max_Health(obj)))
  2847. {
  2848. float damage = health - Commands->Get_Health(obj);
  2849. damage *= 0.5f;
  2850. health -= damage;
  2851. Commands->Set_Health(obj, health);
  2852. }
  2853. if((Commands->Get_Health(obj)) < (Commands->Get_Max_Health(obj) * .13))
  2854. {
  2855. Commands->Set_Health( obj, (Commands->Get_Max_Health(obj) * .13) );
  2856. if(!exiting)
  2857. {
  2858. // All right, I'm bored. Enough of this.\n
  2859. const char *conv_name = ("M05_CON027");
  2860. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  2861. Commands->Join_Conversation(obj, conv_id, false, true);
  2862. Commands->Start_Conversation (conv_id, 1);
  2863. Commands->Monitor_Conversation (obj, conv_id);
  2864. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  2865. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  2866. params.WaypathID = 100077;
  2867. Commands->Action_Goto( obj, params );
  2868. Commands->Start_Timer (obj, this, 3.0f, BYE_MENDOZA3);
  2869. exiting = true;
  2870. }
  2871. }
  2872. }
  2873. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  2874. {
  2875. if(!saw_enemy)
  2876. {
  2877. // Like sheep to the slaughter!\n
  2878. const char *conv_name = ("M05_CON028");
  2879. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  2880. Commands->Join_Conversation(obj, conv_id, false, true);
  2881. Commands->Start_Conversation (conv_id, 1);
  2882. Commands->Monitor_Conversation (obj, conv_id);
  2883. saw_enemy = true;
  2884. }
  2885. }
  2886. };
  2887. DECLARE_SCRIPT(M05_Activate_Nuke_Encounter, "")
  2888. {
  2889. bool already_entered;
  2890. // Register variables to be Auto-Saved
  2891. // All variables must have a unique ID, less than 256, that never changes
  2892. REGISTER_VARIABLES()
  2893. {
  2894. SAVE_VARIABLE( already_entered, 1 );
  2895. }
  2896. void Created (GameObject * obj)
  2897. {
  2898. already_entered = false;
  2899. }
  2900. void Entered (GameObject * obj, GameObject * enterer)
  2901. {
  2902. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  2903. {
  2904. // Entrapement Technician
  2905. Commands->Enable_Spawner(100083, true);
  2906. // Sniper Alley Snipers
  2907. /* Commands->Enable_Spawner(100218, true);
  2908. Commands->Enable_Spawner(100219, true);
  2909. Commands->Enable_Spawner(100220, true);
  2910. Commands->Enable_Spawner(100221, true);
  2911. Commands->Enable_Spawner(100222, true);
  2912. Commands->Enable_Spawner(100223, true);
  2913. Commands->Enable_Spawner(100224, true);
  2914. Commands->Enable_Spawner(100225, true);*/
  2915. // Alley Sprint
  2916. Commands->Enable_Spawner(100227, true);
  2917. Commands->Enable_Spawner(100228, true);
  2918. }
  2919. }
  2920. };
  2921. DECLARE_SCRIPT(M05_Entrapment_Technician, "")
  2922. {
  2923. bool poked;
  2924. bool called_mendoza;
  2925. enum {HELP_ME, SOMEONE, MENDOZA_ITS_HIM};
  2926. // Register variables to be Auto-Saved
  2927. // All variables must have a unique ID, less than 256, that never changes
  2928. REGISTER_VARIABLES()
  2929. {
  2930. SAVE_VARIABLE( poked, 1 );
  2931. SAVE_VARIABLE( called_mendoza, 2 );
  2932. }
  2933. void Created(GameObject * obj)
  2934. {
  2935. ActionParamsStruct params;
  2936. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  2937. params.Set_Animation("S_A_HUMAN.H_A_601A", true);
  2938. Commands->Action_Play_Animation(obj, params);
  2939. // Help me! Oh please, help me!\n
  2940. const char *conv_name = ("M05_CON029");
  2941. int conv_id = Commands->Create_Conversation (conv_name);
  2942. Commands->Join_Conversation(obj, conv_id, false, true);
  2943. Commands->Start_Conversation (conv_id, HELP_ME);
  2944. Commands->Monitor_Conversation (obj, conv_id);
  2945. Commands->Start_Timer (obj, this, 5.0f, SOMEONE);
  2946. poked = false;
  2947. called_mendoza = false;
  2948. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  2949. }
  2950. void Timer_Expired(GameObject * obj, int timer_id )
  2951. {
  2952. ActionParamsStruct params;
  2953. if((timer_id == HELP_ME) && (!poked))
  2954. {
  2955. // Someone, anyone!\n
  2956. const char *conv_name = ("M05_CON030");
  2957. int conv_id = Commands->Create_Conversation (conv_name);
  2958. Commands->Join_Conversation(obj, conv_id, false, true);
  2959. Commands->Start_Conversation (conv_id, SOMEONE);
  2960. Commands->Monitor_Conversation (obj, conv_id);
  2961. Commands->Start_Timer (obj, this, 5.0f, SOMEONE);
  2962. }
  2963. if((timer_id == SOMEONE) && (!poked))
  2964. {
  2965. // Help me! Oh please, help me!
  2966. const char *conv_name = ("M05_CON029");
  2967. int conv_id = Commands->Create_Conversation (conv_name);
  2968. Commands->Join_Conversation(obj, conv_id, false, true);
  2969. Commands->Start_Conversation (conv_id, HELP_ME);
  2970. Commands->Monitor_Conversation (obj, conv_id);
  2971. Commands->Start_Timer (obj, this, 5.0f, HELP_ME);
  2972. }
  2973. }
  2974. void Poked(GameObject * obj, GameObject * poker)
  2975. {
  2976. if ((Commands->Is_A_Star(poker)) && (!poked))
  2977. {
  2978. poked = true;
  2979. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  2980. // Mendoza, it's Havoc!\n
  2981. const char *conv_name = ("M05_CON031");
  2982. int conv_id = Commands->Create_Conversation (conv_name);
  2983. Commands->Join_Conversation(obj, conv_id, false, true);
  2984. Commands->Start_Conversation (conv_id, MENDOZA_ITS_HIM);
  2985. Commands->Monitor_Conversation (obj, conv_id);
  2986. }
  2987. }
  2988. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2989. {
  2990. ActionParamsStruct params;
  2991. if(action_id == MENDOZA_ITS_HIM && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2992. {
  2993. Commands->Enable_Spawner(100084, true);
  2994. // Transition from sleeping to neutral standing
  2995. params.Set_Basic(this, 100, 10);
  2996. params.Set_Animation("S_A_HUMAN.H_A_j13c", false);
  2997. Commands->Action_Play_Animation(obj, params);
  2998. called_mendoza = true;
  2999. }
  3000. }
  3001. void Killed (GameObject * obj, GameObject * killer)
  3002. {
  3003. if(!called_mendoza)
  3004. {
  3005. Commands->Enable_Spawner(100084, true);
  3006. }
  3007. }
  3008. };
  3009. DECLARE_SCRIPT(M05_Mendoza4, "")
  3010. {
  3011. bool exiting;
  3012. bool saw_enemy;
  3013. float health;
  3014. enum {BYE_MENDOZA4, FLEE_NUKE, BOTH_TEAMS};
  3015. // Register variables to be Auto-Saved
  3016. // All variables must have a unique ID, less than 256, that never changes
  3017. REGISTER_VARIABLES()
  3018. {
  3019. SAVE_VARIABLE( exiting, 1 );
  3020. SAVE_VARIABLE( saw_enemy, 2 );
  3021. SAVE_VARIABLE( health, 3 );
  3022. }
  3023. void Created (GameObject * obj)
  3024. {
  3025. ActionParamsStruct params;
  3026. saw_enemy = false;
  3027. exiting = false;
  3028. health = Commands->Get_Max_Health(obj);
  3029. // Both teams drop! Now! Now! Now!\n
  3030. const char *conv_name = ("M05_CON032");
  3031. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  3032. Commands->Join_Conversation(obj, conv_id, false, true);
  3033. Commands->Start_Conversation (conv_id, BOTH_TEAMS);
  3034. Commands->Monitor_Conversation (obj, conv_id);
  3035. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  3036. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  3037. params.WaypathID = 100085;
  3038. params.Set_Attack (STAR, 250.0f, 0.0f, 1);
  3039. params.AttackWanderAllowed = false ;
  3040. params.AttackCheckBlocked = false;
  3041. Commands->Action_Attack( obj, params );
  3042. Commands->Start_Timer (obj, this, 7.0f, FLEE_NUKE);
  3043. // Send custom to nuke to start countdown
  3044. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100096), 100, 100, 2.0f);
  3045. Commands->Give_PowerUp(obj, "POW_LaserRifle_AI");
  3046. Commands->Select_Weapon(obj, "Weapon_LaserRifle_AI" );
  3047. }
  3048. void Timer_Expired(GameObject * obj, int timer_id )
  3049. {
  3050. ActionParamsStruct params;
  3051. if((timer_id == FLEE_NUKE) && (!exiting))
  3052. {
  3053. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  3054. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  3055. params.WaypathID = 100089;
  3056. Commands->Action_Goto( obj, params );
  3057. Commands->Start_Timer (obj, this, 5.0f, BYE_MENDOZA4);
  3058. exiting = true;
  3059. }
  3060. if(timer_id == BYE_MENDOZA4)
  3061. {
  3062. Commands->Destroy_Object(obj);
  3063. }
  3064. }
  3065. void Damaged (GameObject * obj, GameObject * damager, float amount)
  3066. {
  3067. ActionParamsStruct params;
  3068. if(health > (.2 * Commands->Get_Max_Health(obj)))
  3069. {
  3070. float damage = health - Commands->Get_Health(obj);
  3071. damage *= 0.5f;
  3072. health -= damage;
  3073. Commands->Set_Health(obj, health);
  3074. }
  3075. if((Commands->Get_Health(obj)) < (Commands->Get_Max_Health(obj) * .13))
  3076. {
  3077. Commands->Set_Health( obj, (Commands->Get_Max_Health(obj) * .13) );
  3078. if(!exiting)
  3079. {
  3080. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  3081. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  3082. params.WaypathID = 100089;
  3083. Commands->Action_Goto( obj, params );
  3084. Commands->Start_Timer (obj, this, 5.0f, BYE_MENDOZA4);
  3085. exiting = true;
  3086. }
  3087. }
  3088. }
  3089. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3090. {
  3091. ActionParamsStruct params;
  3092. if(action_id == BOTH_TEAMS && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  3093. {
  3094. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-230.672f, -23.591f, 12.130f));
  3095. Commands->Set_Facing(chinook_obj1, -165.000f);
  3096. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_C130TroopDrop8.txt");
  3097. }
  3098. }
  3099. };
  3100. DECLARE_SCRIPT(M05_Civ_Warn, "")
  3101. {
  3102. enum {GO_CACHE, GO_STAR};
  3103. // Register variables to be Auto-Saved
  3104. // All variables must have a unique ID, less than 256, that never changes
  3105. REGISTER_VARIABLES()
  3106. {
  3107. // SAVE_VARIABLE( already_entered, 1 );
  3108. }
  3109. void Created (GameObject * obj)
  3110. {
  3111. Commands->Start_Timer (obj, this, 5.5f, GO_STAR);
  3112. Commands->Enable_Hibernation( obj, false );
  3113. Commands->Give_PowerUp(obj, "POW_Shotgun_AI");
  3114. }
  3115. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3116. {
  3117. ActionParamsStruct params;
  3118. if(action_id == 100097)
  3119. {
  3120. // Don't shoot, I am a friend! There are enemies shooting from the balcony. Can you help?\n
  3121. const char *conv_name = ("M05_CON002");
  3122. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  3123. Commands->Join_Conversation(obj, conv_id, false, true);
  3124. Commands->Join_Conversation(STAR, conv_id, false, true);
  3125. Commands->Start_Conversation (conv_id, 1000971);
  3126. Commands->Monitor_Conversation (obj, conv_id);
  3127. }
  3128. if(action_id == 1000971 && reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  3129. {
  3130. Commands->Start_Timer (obj, this, 0.5f, GO_CACHE);
  3131. Commands->Select_Weapon(obj, "Weapon_Shotgun_Ai" );
  3132. }
  3133. }
  3134. void Timer_Expired (GameObject* obj, int timer_id)
  3135. {
  3136. ActionParamsStruct params;
  3137. if(timer_id == GO_STAR)
  3138. {
  3139. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 100097);
  3140. params.Set_Movement (STAR, RUN, 2.0f);
  3141. Commands->Action_Goto (obj, params);
  3142. }
  3143. if(timer_id == GO_CACHE)
  3144. {
  3145. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  3146. params.Set_Movement (Vector3 (-482.504f, -94.474f, 13.726f), RUN, 5.0f);
  3147. Commands->Action_Goto (obj, params);
  3148. Commands->Start_Timer (obj, this, 8.0f, GO_CACHE);
  3149. }
  3150. }
  3151. void Killed (GameObject * obj, GameObject * killer)
  3152. {
  3153. Commands->Enable_Spawner(100104, true);
  3154. }
  3155. };
  3156. DECLARE_SCRIPT(M05_Civ_Lead, "")
  3157. {
  3158. int poke_id;
  3159. bool hold;
  3160. bool conversation;
  3161. bool first_poke;
  3162. bool at_resistance;
  3163. enum {GO_CIV_CACHE_TIMER, GO_CIV_CACHE};
  3164. // Register variables to be Auto-Saved
  3165. // All variables must have a unique ID, less than 256, that never changes
  3166. REGISTER_VARIABLES()
  3167. {
  3168. SAVE_VARIABLE( poke_id, 1 );
  3169. SAVE_VARIABLE( hold, 2 );
  3170. SAVE_VARIABLE( conversation, 3 );
  3171. SAVE_VARIABLE( first_poke, 4 );
  3172. SAVE_VARIABLE( at_resistance, 5 );
  3173. }
  3174. void Created (GameObject * obj)
  3175. {
  3176. ActionParamsStruct params;
  3177. at_resistance = false;
  3178. poke_id = 1;
  3179. hold = false;
  3180. conversation = false;
  3181. first_poke = true;
  3182. Commands->Innate_Disable(obj);
  3183. Commands->Enable_HUD_Pokable_Indicator( obj, true );
  3184. }
  3185. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3186. {
  3187. ActionParamsStruct params;
  3188. if(type == M05_CUSTOM_ACTIVATE)
  3189. {
  3190. Commands->Innate_Enable(obj);
  3191. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 100755);
  3192. params.Set_Movement (STAR, RUN, 2.0f);
  3193. Commands->Action_Goto (obj, params);
  3194. }
  3195. }
  3196. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3197. {
  3198. ActionParamsStruct params;
  3199. // if(action_id == GO_CIV_CACHE && reason == ACTION_COMPLETE_NORMAL)
  3200. // {
  3201. // }
  3202. // if(action_id == 100755)
  3203. // {
  3204. // GDI - I'll take you to the resistance. Follow quickly!\n
  3205. // const char *conv_name = ("M05_CON033");
  3206. // int conv_id = Commands->Create_Conversation (conv_name);
  3207. // Commands->Join_Conversation(obj, conv_id, false, true);
  3208. // Commands->Start_Conversation (conv_id, 1007551);
  3209. // Commands->Monitor_Conversation (obj, conv_id);
  3210. // }
  3211. if(action_id == 1007551)
  3212. {
  3213. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_CIV_CACHE);
  3214. params.Set_Movement (Vector3 (-513.603f, 8.030f, 28.080f), RUN, 5.0f);
  3215. Commands->Action_Goto (obj, params);
  3216. Commands->Start_Timer (obj, this, 6.0f, GO_CIV_CACHE_TIMER);
  3217. }
  3218. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  3219. {
  3220. conversation = false;
  3221. }
  3222. if(action_id == GO_CIV_CACHE )
  3223. {
  3224. // at resistance. no longer pokable
  3225. at_resistance = true;
  3226. }
  3227. }
  3228. void Poked(GameObject * obj, GameObject * poker)
  3229. {
  3230. if(Commands->Is_A_Star(poker) && first_poke)
  3231. {
  3232. first_poke = false;
  3233. // GDI - I'll take you to the resistance. Follow quickly!\n
  3234. const char *conv_name = ("M05_CON033");
  3235. int conv_id = Commands->Create_Conversation (conv_name);
  3236. Commands->Join_Conversation(obj, conv_id, false, true);
  3237. Commands->Start_Conversation (conv_id, 1007551);
  3238. Commands->Monitor_Conversation (obj, conv_id);
  3239. Commands->Enable_HUD_Pokable_Indicator( obj, false );
  3240. }
  3241. else if ( !at_resistance ) // stop / go conversation.
  3242. {
  3243. if(Commands->Is_A_Star(poker) && !conversation)
  3244. {
  3245. conversation = true;
  3246. ActionParamsStruct params;
  3247. switch(poke_id)
  3248. {
  3249. case 1:
  3250. {
  3251. // \\Hold here. I'll be back.\n
  3252. const char *conv_name = ("M05_CON019");
  3253. int conv_id = Commands->Create_Conversation (conv_name);
  3254. Commands->Join_Conversation(STAR, conv_id, false, true);
  3255. Commands->Start_Conversation (conv_id, 1);
  3256. Commands->Monitor_Conversation (obj, conv_id);
  3257. Vector3 my_loc = Commands->Get_Position(obj);
  3258. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 6);
  3259. params.Set_Movement (my_loc, RUN, 3.0f);
  3260. Commands->Action_Goto (obj, params);
  3261. Commands->Set_Innate_Is_Stationary(obj, true);
  3262. hold = true;
  3263. poke_id = 2;
  3264. }
  3265. break;
  3266. case 2:
  3267. {
  3268. // \\Let's keep moving.\n
  3269. const char *conv_name = ("M05_CON018");
  3270. int conv_id = Commands->Create_Conversation (conv_name);
  3271. Commands->Join_Conversation(STAR, conv_id, false, true);
  3272. Commands->Start_Conversation (conv_id, 1);
  3273. Commands->Monitor_Conversation (obj, conv_id);
  3274. Commands->Set_Innate_Is_Stationary(obj, false);
  3275. hold = false;
  3276. Commands->Start_Timer (obj, this, 1.0f, GO_CIV_CACHE_TIMER);
  3277. poke_id = 1;
  3278. }
  3279. break;
  3280. }
  3281. }
  3282. }
  3283. }
  3284. void Timer_Expired (GameObject* obj, int timer_id)
  3285. {
  3286. ActionParamsStruct params;
  3287. if(timer_id == GO_CIV_CACHE_TIMER)
  3288. {
  3289. if(!hold)
  3290. {
  3291. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_CIV_CACHE);
  3292. params.Set_Movement (Vector3 (-513.603f, 8.030f, 28.080f), RUN, 5.0f);
  3293. Commands->Action_Goto (obj, params);
  3294. }
  3295. Commands->Start_Timer (obj, this, 6.0f, GO_CIV_CACHE_TIMER);
  3296. }
  3297. }
  3298. };
  3299. DECLARE_SCRIPT(M05_Triangle_Unit, "Unit_ID=0:int")
  3300. {
  3301. int unit_id;
  3302. enum{GO_TRIANGLE};
  3303. // Register variables to be Auto-Saved
  3304. // All variables must have a unique ID, less than 256, that never changes
  3305. REGISTER_VARIABLES()
  3306. {
  3307. SAVE_VARIABLE( unit_id, 1 );
  3308. }
  3309. void Created (GameObject * obj)
  3310. {
  3311. Commands->Start_Timer (obj, this, 3.0f, GO_TRIANGLE);
  3312. unit_id = Get_Int_Parameter("Unit_ID");
  3313. }
  3314. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3315. {
  3316. if(type == CUSTOM_EVENT_FALLING_DAMAGE)
  3317. {
  3318. float health = Commands->Get_Health(obj);
  3319. health = health + 1;
  3320. }
  3321. }
  3322. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3323. {
  3324. ActionParamsStruct params;
  3325. float health = Commands->Get_Health(obj);
  3326. health = health + 1;
  3327. }
  3328. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3329. {
  3330. ActionParamsStruct params;
  3331. if(action_id == GO_TRIANGLE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3332. {
  3333. Commands->Start_Timer (obj, this, 6.0f, GO_TRIANGLE);
  3334. }
  3335. if(action_id == GO_TRIANGLE && reason == ACTION_COMPLETE_NORMAL)
  3336. {
  3337. Commands->Start_Timer (obj, this, 20.0f, GO_TRIANGLE);
  3338. }
  3339. }
  3340. void Timer_Expired(GameObject * obj, int timer_id )
  3341. {
  3342. ActionParamsStruct params;
  3343. if(timer_id == GO_TRIANGLE)
  3344. {
  3345. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_TRIANGLE);
  3346. params.Set_Movement (Commands->Find_Object(100105), RUN, 5.0f);
  3347. Commands->Action_Goto (obj, params);
  3348. }
  3349. }
  3350. void Killed (GameObject * obj, GameObject * killer)
  3351. {
  3352. Commands->Send_Custom_Event(obj, Commands->Find_Object(100105), M05_TRIANGLE_REINFORCE, unit_id, 0.0f);
  3353. }
  3354. };
  3355. DECLARE_SCRIPT(M05_Triangle_Controller, "") // 100105
  3356. {
  3357. int reinforce_cnt;
  3358. int unit_id1;
  3359. int unit_id2;
  3360. int unit_id3;
  3361. int unit_id4;
  3362. // Register variables to be Auto-Saved
  3363. // All variables must have a unique ID, less than 256, that never changes
  3364. REGISTER_VARIABLES()
  3365. {
  3366. SAVE_VARIABLE( reinforce_cnt, 1 );
  3367. SAVE_VARIABLE( unit_id1, 2 );
  3368. SAVE_VARIABLE( unit_id2, 3 );
  3369. SAVE_VARIABLE( unit_id3, 4 );
  3370. SAVE_VARIABLE( unit_id4, 5 );
  3371. }
  3372. void Created (GameObject * obj)
  3373. {
  3374. reinforce_cnt = 3;
  3375. unit_id1 = 0;
  3376. unit_id2 = 0;
  3377. unit_id3 = 0;
  3378. unit_id4 = 0;
  3379. }
  3380. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3381. {
  3382. ActionParamsStruct params;
  3383. if(type == M05_TRIANGLE_REINFORCE)
  3384. {
  3385. switch(param)
  3386. {
  3387. case 1:
  3388. {
  3389. unit_id1++;
  3390. if(unit_id1 < reinforce_cnt)
  3391. {
  3392. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-521.328f, -68.988f, 17.960f));
  3393. Commands->Set_Facing(controller, 105.000f);
  3394. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops01.txt");
  3395. }
  3396. else
  3397. {
  3398. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-521.328f, -68.988f, 17.960f));
  3399. Commands->Set_Facing(controller, 105.000f);
  3400. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops11.txt");
  3401. }
  3402. }
  3403. break;
  3404. case 2:
  3405. {
  3406. unit_id2++;
  3407. if(unit_id2 < reinforce_cnt)
  3408. {
  3409. // GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-485.633f, -94.664f, 18.238f));
  3410. // Commands->Set_Facing(controller, 175.000f);
  3411. // Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops02.txt");
  3412. }
  3413. else
  3414. {
  3415. // GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-485.633f, -94.664f, 18.238f));
  3416. // Commands->Set_Facing(controller, 175.000f);
  3417. // Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops21.txt");
  3418. }
  3419. }
  3420. break;
  3421. case 3:
  3422. {
  3423. unit_id3++;
  3424. if(unit_id3 < reinforce_cnt)
  3425. {
  3426. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-518.077f, -96.536f, 17.114f));
  3427. Commands->Set_Facing(controller, -20.000f);
  3428. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops03.txt");
  3429. }
  3430. else
  3431. {
  3432. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-518.077f, -96.536f, 17.114f));
  3433. Commands->Set_Facing(controller, -20.000f);
  3434. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops13.txt");
  3435. }
  3436. }
  3437. break;
  3438. case 4:
  3439. {
  3440. unit_id4++;
  3441. if(unit_id4%2 == 0 && unit_id4 < reinforce_cnt * 2)
  3442. {
  3443. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-493.674f, -63.951f, 14.002f));
  3444. Commands->Set_Facing(controller, 10.000f);
  3445. Commands->Attach_Script(controller, "Test_Cinematic", "X5D_CHTroopdrop9.txt");
  3446. }
  3447. }
  3448. break;
  3449. }
  3450. }
  3451. }
  3452. };
  3453. DECLARE_SCRIPT(M05_TownSquare_Sniper, "")
  3454. {
  3455. // Register variables to be Auto-Saved
  3456. // All variables must have a unique ID, less than 256, that never changes
  3457. REGISTER_VARIABLES()
  3458. {
  3459. // SAVE_VARIABLE( poke_id, 1 );
  3460. }
  3461. void Created (GameObject * obj)
  3462. {
  3463. ActionParamsStruct params;
  3464. Commands->Set_Innate_Is_Stationary(obj, true);
  3465. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  3466. params.Set_Attack (Commands->Find_Object(100114), 250.0f, 0.0f, 1);
  3467. params.AttackCheckBlocked = false;
  3468. Commands->Action_Attack( obj, params );
  3469. }
  3470. void Killed (GameObject * obj, GameObject * killer)
  3471. {
  3472. Commands->Enable_Spawner(100115, true);
  3473. }
  3474. };
  3475. DECLARE_SCRIPT(M05_TownSquare_Controller, "") // 100112
  3476. {
  3477. int unit_id1;
  3478. int unit_id2;
  3479. int unit_id3;
  3480. int unit_id4;
  3481. bool townsquare_retaken;
  3482. // Register variables to be Auto-Saved
  3483. // All variables must have a unique ID, less than 256, that never changes
  3484. REGISTER_VARIABLES()
  3485. {
  3486. SAVE_VARIABLE( unit_id1, 1 );
  3487. SAVE_VARIABLE( unit_id2, 2 );
  3488. SAVE_VARIABLE( unit_id3, 3 );
  3489. SAVE_VARIABLE( unit_id4, 4 );
  3490. SAVE_VARIABLE( townsquare_retaken, 5 );
  3491. }
  3492. void Created (GameObject * obj)
  3493. {
  3494. unit_id1 = 0;
  3495. unit_id2 = 0;
  3496. unit_id3 = 0;
  3497. unit_id4 = 0;
  3498. townsquare_retaken = false;
  3499. }
  3500. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3501. {
  3502. ActionParamsStruct params;
  3503. if(type == M05_TOWNSQUARE_REINFORCE)
  3504. {
  3505. switch(param)
  3506. {
  3507. case 1:
  3508. {
  3509. unit_id1++;
  3510. if((unit_id1%2 == 0) && (unit_id1 < 5))
  3511. {
  3512. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-344.528f, -144.159f, 5.168f));
  3513. Commands->Set_Facing(chinook_obj1, 90.000f);
  3514. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop1.txt");
  3515. }
  3516. else
  3517. {
  3518. Commands->Enable_Spawner(100117, true);
  3519. }
  3520. }
  3521. break;
  3522. case 2:
  3523. {
  3524. unit_id2++;
  3525. if((unit_id2%2 == 0) && (unit_id2 < 5))
  3526. {
  3527. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-320.817f, -128.650f, 5.289f));
  3528. Commands->Set_Facing(chinook_obj1, -90.000f);
  3529. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop2.txt");
  3530. }
  3531. else
  3532. {
  3533. Commands->Enable_Spawner(100118, true);
  3534. }
  3535. }
  3536. break;
  3537. case 3:
  3538. {
  3539. unit_id3++;
  3540. }
  3541. break;
  3542. case 4:
  3543. {
  3544. unit_id4++;
  3545. }
  3546. break;
  3547. }
  3548. // Check that all Nod soldiers, tank, cannon emplacement killed
  3549. if((unit_id1 == 6) && (unit_id2 == 6) && (unit_id3 == 1) && (unit_id4 == 1) && (!townsquare_retaken))
  3550. {
  3551. Commands->Debug_Message("Resistance have taken town square, Gunner will now leave");
  3552. // Resistance have taken town square
  3553. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 507, 1, 0.0f);
  3554. // Gunner will now leave
  3555. Commands->Send_Custom_Event(obj, Commands->Find_Object(100003), 500, 500, 0.0f);
  3556. townsquare_retaken = true;
  3557. }
  3558. }
  3559. }
  3560. };
  3561. DECLARE_SCRIPT(M05_TownSquare_Unit, "Unit_ID=0:int")
  3562. {
  3563. enum{GO_TOWNSQUARE};
  3564. // Register variables to be Auto-Saved
  3565. // All variables must have a unique ID, less than 256, that never changes
  3566. REGISTER_VARIABLES()
  3567. {
  3568. // SAVE_VARIABLE( unit_id, 1 );
  3569. }
  3570. void Created (GameObject * obj)
  3571. {
  3572. Commands->Start_Timer (obj, this, 3.0f, GO_TOWNSQUARE);
  3573. }
  3574. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3575. {
  3576. ActionParamsStruct params;
  3577. if(action_id == GO_TOWNSQUARE && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3578. {
  3579. Commands->Start_Timer (obj, this, 6.0f, GO_TOWNSQUARE);
  3580. }
  3581. if(action_id == GO_TOWNSQUARE && reason == ACTION_COMPLETE_NORMAL)
  3582. {
  3583. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
  3584. }
  3585. }
  3586. void Timer_Expired(GameObject * obj, int timer_id )
  3587. {
  3588. ActionParamsStruct params;
  3589. if(timer_id == GO_TOWNSQUARE)
  3590. {
  3591. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, GO_TOWNSQUARE );
  3592. params.Set_Movement( Commands->Find_Object(100112), RUN, 5.0f );
  3593. Commands->Action_Goto( obj, params );
  3594. }
  3595. }
  3596. void Killed (GameObject * obj, GameObject * killer)
  3597. {
  3598. int unit_id = Get_Int_Parameter("Unit_ID");
  3599. Commands->Send_Custom_Event(obj, Commands->Find_Object(100112), M05_TOWNSQUARE_REINFORCE, unit_id, 0.0f);
  3600. }
  3601. };
  3602. DECLARE_SCRIPT(M05_TownSquare_FlameTank, "Unit_ID=0:int")
  3603. {
  3604. void Killed (GameObject * obj, GameObject * killer)
  3605. {
  3606. int unit_id = Get_Int_Parameter("Unit_ID");
  3607. Commands->Send_Custom_Event(obj, Commands->Find_Object(100112), M05_TOWNSQUARE_REINFORCE, unit_id, 0.0f);
  3608. }
  3609. };
  3610. DECLARE_SCRIPT(M05_Nod_Gun_Emplacement, "")
  3611. {
  3612. bool attacking;
  3613. enum{ATTACK_OVER};
  3614. // Register variables to be Auto-Saved
  3615. // All variables must have a unique ID, less than 256, that never changes
  3616. REGISTER_VARIABLES()
  3617. {
  3618. SAVE_VARIABLE( attacking, 1 );
  3619. }
  3620. void Created (GameObject * obj)
  3621. {
  3622. Commands->Enable_Enemy_Seen( obj, true);
  3623. attacking = false;
  3624. }
  3625. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3626. {
  3627. ActionParamsStruct params;
  3628. if(!attacking)
  3629. {
  3630. attacking = true;
  3631. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3632. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3633. params.AttackCheckBlocked = false;
  3634. Commands->Action_Attack( obj, params );
  3635. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3636. }
  3637. }
  3638. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3639. {
  3640. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  3641. {
  3642. return;
  3643. }
  3644. ActionParamsStruct params;
  3645. if(!attacking)
  3646. {
  3647. attacking = true;
  3648. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3649. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3650. params.AttackCheckBlocked = false;
  3651. Commands->Action_Attack( obj, params );
  3652. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3653. }
  3654. }
  3655. void Timer_Expired (GameObject* obj, int timer_id)
  3656. {
  3657. ActionParamsStruct params;
  3658. if(timer_id == ATTACK_OVER)
  3659. {
  3660. attacking = false;
  3661. }
  3662. }
  3663. };
  3664. DECLARE_SCRIPT(M05_Nod_Bridge_Gun_Emplacement, "")
  3665. {
  3666. bool attacking;
  3667. enum{ATTACK_OVER};
  3668. // Register variables to be Auto-Saved
  3669. // All variables must have a unique ID, less than 256, that never changes
  3670. REGISTER_VARIABLES()
  3671. {
  3672. SAVE_VARIABLE( attacking, 1 );
  3673. }
  3674. void Created (GameObject * obj)
  3675. {
  3676. attacking = false;
  3677. }
  3678. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  3679. {
  3680. ActionParamsStruct params;
  3681. if(!attacking)
  3682. {
  3683. attacking = true;
  3684. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3685. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  3686. params.AttackCheckBlocked = false;
  3687. Commands->Action_Attack( obj, params );
  3688. Commands->Start_Timer(obj, this, 12.0f, ATTACK_OVER);
  3689. }
  3690. }
  3691. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3692. {
  3693. ActionParamsStruct params;
  3694. if(type == M05_CUSTOM_ACTIVATE)
  3695. {
  3696. Commands->Enable_Enemy_Seen( obj, true);
  3697. }
  3698. }
  3699. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3700. {
  3701. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  3702. {
  3703. return;
  3704. }
  3705. ActionParamsStruct params;
  3706. if(!attacking)
  3707. {
  3708. attacking = true;
  3709. Commands->Enable_Enemy_Seen( obj, true);
  3710. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  3711. params.Set_Attack (damager, 250.0f, 0.0f, 1);
  3712. params.AttackCheckBlocked = false;
  3713. Commands->Action_Attack( obj, params );
  3714. Commands->Start_Timer(obj, this, 6.0f, ATTACK_OVER);
  3715. }
  3716. }
  3717. void Timer_Expired (GameObject* obj, int timer_id)
  3718. {
  3719. ActionParamsStruct params;
  3720. if(timer_id == ATTACK_OVER)
  3721. {
  3722. attacking = false;
  3723. }
  3724. }
  3725. void Killed (GameObject * obj, GameObject * killer)
  3726. {
  3727. GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(-292.298f, -82.194f, 10.478f));
  3728. Commands->Set_Facing(controller1, -150.000f);
  3729. Commands->Attach_Script(controller1, "Test_Cinematic", "X5D_CHTroopdrop3.txt");
  3730. }
  3731. };
  3732. DECLARE_SCRIPT(M05_Overlook_Captives, "")
  3733. {
  3734. enum{GO_POWERUPS, ARM_CHAINGUN};
  3735. // Register variables to be Auto-Saved
  3736. // All variables must have a unique ID, less than 256, that never changes
  3737. REGISTER_VARIABLES()
  3738. {
  3739. // SAVE_VARIABLE( unit_id, 1 );
  3740. }
  3741. void Created (GameObject * obj)
  3742. {
  3743. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  3744. Commands->Set_Innate_Is_Stationary(obj, true);
  3745. }
  3746. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3747. {
  3748. ActionParamsStruct params;
  3749. if(type == M05_FREE_OVERLOOK_CAPTIVES)
  3750. {
  3751. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  3752. Commands->Set_Innate_Is_Stationary(obj, false);
  3753. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), GO_POWERUPS);
  3754. params.Set_Movement (Commands->Find_Object(100131), RUN, 3.0f);
  3755. Commands->Action_Goto (obj, params);
  3756. }
  3757. }
  3758. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3759. {
  3760. ActionParamsStruct params;
  3761. if(action_id == GO_POWERUPS && reason == ACTION_COMPLETE_NORMAL)
  3762. {
  3763. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  3764. Commands->Start_Timer(obj, this, 1.0f, ARM_CHAINGUN);
  3765. }
  3766. }
  3767. void Timer_Expired(GameObject * obj, int timer_id )
  3768. {
  3769. ActionParamsStruct params;
  3770. if(timer_id == ARM_CHAINGUN)
  3771. {
  3772. Commands->Select_Weapon(obj, "Weapon_Chaingun_AI" );
  3773. }
  3774. }
  3775. void Killed (GameObject * obj, GameObject * killer)
  3776. {
  3777. Commands->Send_Custom_Event(obj, Commands->Find_Object(100136), M05_OVERLOOK_REINFORCE, 1, 0.0f);
  3778. }
  3779. };
  3780. DECLARE_SCRIPT(M05_Free_Overlook_Captives, "")
  3781. {
  3782. bool already_entered;
  3783. // Register variables to be Auto-Saved
  3784. // All variables must have a unique ID, less than 256, that never changes
  3785. REGISTER_VARIABLES()
  3786. {
  3787. SAVE_VARIABLE( already_entered, 1 );
  3788. }
  3789. void Created (GameObject * obj)
  3790. {
  3791. already_entered = false;
  3792. }
  3793. void Entered (GameObject * obj, GameObject * enterer)
  3794. {
  3795. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  3796. {
  3797. already_entered = true;
  3798. Commands->Send_Custom_Event(obj, Commands->Find_Object(100129), M05_FREE_OVERLOOK_CAPTIVES, 1, 0.0f);
  3799. Commands->Send_Custom_Event(obj, Commands->Find_Object(100130), M05_FREE_OVERLOOK_CAPTIVES, 1, 0.0f);
  3800. }
  3801. }
  3802. };
  3803. DECLARE_SCRIPT(M05_Overlook_Controller, "") // 100136
  3804. {
  3805. int unit_id1;
  3806. int unit_id2;
  3807. int reinforce_cnt;
  3808. // Register variables to be Auto-Saved
  3809. // All variables must have a unique ID, less than 256, that never changes
  3810. REGISTER_VARIABLES()
  3811. {
  3812. SAVE_VARIABLE( unit_id1, 1 );
  3813. SAVE_VARIABLE( unit_id2, 2 );
  3814. SAVE_VARIABLE( reinforce_cnt, 3 );
  3815. }
  3816. void Created (GameObject * obj)
  3817. {
  3818. unit_id1 = 0;
  3819. unit_id2 = 0;
  3820. reinforce_cnt = 5;
  3821. }
  3822. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3823. {
  3824. ActionParamsStruct params;
  3825. if(type == M05_OVERLOOK_REINFORCE)
  3826. {
  3827. switch(param)
  3828. {
  3829. case 1:
  3830. {
  3831. unit_id1++;
  3832. if(unit_id1 == 1)
  3833. {
  3834. Commands->Enable_Spawner(100142, true);
  3835. }
  3836. if(unit_id1 == 2)
  3837. {
  3838. Commands->Enable_Spawner(100143, true);
  3839. }
  3840. }
  3841. break;
  3842. case 2:
  3843. {
  3844. unit_id2++;
  3845. if(unit_id2%2 == 0 && unit_id2 < reinforce_cnt)
  3846. {
  3847. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-312.794f, -48.780f, 14.414f));
  3848. Commands->Set_Facing(chinook_obj1, 15.000f);
  3849. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_C130TroopDrop1.txt");
  3850. }
  3851. else
  3852. {
  3853. Commands->Enable_Spawner(100140, true);
  3854. Commands->Enable_Spawner(100141, true);
  3855. }
  3856. }
  3857. break;
  3858. }
  3859. }
  3860. }
  3861. };
  3862. DECLARE_SCRIPT(M05_Overlook_Nod, "")
  3863. {
  3864. // Register variables to be Auto-Saved
  3865. // All variables must have a unique ID, less than 256, that never changes
  3866. REGISTER_VARIABLES()
  3867. {
  3868. // SAVE_VARIABLE( unit_id1, 1 );
  3869. }
  3870. void Created (GameObject * obj)
  3871. {
  3872. ActionParamsStruct params;
  3873. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  3874. params.Set_Movement (Commands->Find_Object(100136), RUN, 3.0f);
  3875. Commands->Action_Goto (obj, params);
  3876. }
  3877. void Killed (GameObject * obj, GameObject * killer)
  3878. {
  3879. Commands->Send_Custom_Event(obj, Commands->Find_Object(100136), M05_OVERLOOK_REINFORCE, 2, 0.0f);
  3880. }
  3881. };
  3882. DECLARE_SCRIPT(M05_Overlook_Civ, "")
  3883. {
  3884. // Register variables to be Auto-Saved
  3885. // All variables must have a unique ID, less than 256, that never changes
  3886. REGISTER_VARIABLES()
  3887. {
  3888. // SAVE_VARIABLE( unit_id1, 1 );
  3889. }
  3890. void Created (GameObject * obj)
  3891. {
  3892. ActionParamsStruct params;
  3893. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 1);
  3894. params.Set_Movement (Commands->Find_Object(100136), RUN, 3.0f);
  3895. Commands->Action_Goto (obj, params);
  3896. }
  3897. void Killed (GameObject * obj, GameObject * killer)
  3898. {
  3899. }
  3900. };
  3901. DECLARE_SCRIPT(M05_Nod_APC, "")
  3902. {
  3903. // Register variables to be Auto-Saved
  3904. // All variables must have a unique ID, less than 256, that never changes
  3905. REGISTER_VARIABLES()
  3906. {
  3907. // SAVE_VARIABLE( attacking, 1 );
  3908. }
  3909. void Created (GameObject * obj)
  3910. {
  3911. }
  3912. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3913. {
  3914. ActionParamsStruct params;
  3915. if(type == M05_CUSTOM_ACTIVATE)
  3916. {
  3917. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  3918. params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
  3919. params.WaypathID = 100145;
  3920. params.WaypathSplined = true;
  3921. Commands->Action_Goto( obj, params );
  3922. }
  3923. }
  3924. };
  3925. DECLARE_SCRIPT(M05_Cache_Controller, "") // 100162
  3926. {
  3927. int reinforce_cnt;
  3928. int unit_id1;
  3929. int unit_id2;
  3930. int unit_id3;
  3931. bool civ_arrived;
  3932. int civ_killed;
  3933. // Register variables to be Auto-Saved
  3934. // All variables must have a unique ID, less than 256, that never changes
  3935. REGISTER_VARIABLES()
  3936. {
  3937. SAVE_VARIABLE( reinforce_cnt, 1 );
  3938. SAVE_VARIABLE( unit_id1, 2 );
  3939. SAVE_VARIABLE( unit_id2, 3 );
  3940. SAVE_VARIABLE( unit_id3, 4 );
  3941. SAVE_VARIABLE( civ_arrived, 5 );
  3942. SAVE_VARIABLE( civ_killed, 6 );
  3943. }
  3944. void Created (GameObject * obj)
  3945. {
  3946. reinforce_cnt = 3;
  3947. unit_id1 = 0;
  3948. unit_id2 = 0;
  3949. unit_id3 = 0;
  3950. civ_arrived = false;
  3951. civ_killed = 0;
  3952. }
  3953. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  3954. {
  3955. ActionParamsStruct params;
  3956. if(type == M05_CACHE_REINFORCE)
  3957. {
  3958. Vector3 star_pos = Commands->Get_Position(STAR);
  3959. GameObject * drop_loc1 = Commands->Find_Object(100162);
  3960. GameObject * drop_loc2 = Commands->Find_Object(100163);
  3961. Vector3 drop_loc1_pos = Commands->Get_Position(drop_loc1);
  3962. Vector3 drop_loc2_pos = Commands->Get_Position(drop_loc2);
  3963. float dist_drop_loc1 = Commands->Get_Distance(star_pos, drop_loc1_pos);
  3964. float dist_drop_loc2 = Commands->Get_Distance(star_pos, drop_loc2_pos);
  3965. float least_dist = WWMath::Min(dist_drop_loc1, dist_drop_loc2);
  3966. switch(param)
  3967. {
  3968. case 1:
  3969. {
  3970. unit_id1++;
  3971. if(unit_id1%2 == 0 && unit_id1 < 8)
  3972. {
  3973. if(dist_drop_loc1 == least_dist)
  3974. {
  3975. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-495.497f, 40.504f, 22.714f));
  3976. Commands->Set_Facing(controller, -5.000f);
  3977. Commands->Attach_Script(controller, "Test_Cinematic", "X5D_CHTroopdrop4.txt");
  3978. }
  3979. else
  3980. {
  3981. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-401.111f, 43.222f, 20.018f));
  3982. Commands->Set_Facing(controller, -180.000f);
  3983. Commands->Attach_Script(controller, "Test_Cinematic", "X5D_CHTroopdrop4.txt");
  3984. }
  3985. }
  3986. else
  3987. {
  3988. }
  3989. }
  3990. break;
  3991. }
  3992. }
  3993. if(type == M05_CACHE_CIV_KILLED)
  3994. {
  3995. if(!civ_arrived)
  3996. {
  3997. civ_killed++;
  3998. if(civ_killed == 2)
  3999. {
  4000. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 508, 2, 0.0f);
  4001. }
  4002. }
  4003. }
  4004. if(type == M05_CIV_ARRIVED)
  4005. {
  4006. civ_arrived = true;
  4007. }
  4008. }
  4009. };
  4010. DECLARE_SCRIPT(M05_Cache_Unit, "")
  4011. {
  4012. enum{ATTACK_STAR};
  4013. // Register variables to be Auto-Saved
  4014. // All variables must have a unique ID, less than 256, that never changes
  4015. REGISTER_VARIABLES()
  4016. {
  4017. // SAVE_VARIABLE( poke_id, 1 );
  4018. }
  4019. void Created (GameObject * obj)
  4020. {
  4021. ActionParamsStruct params;
  4022. Commands->Start_Timer(obj, this, 3.0f, ATTACK_STAR);
  4023. }
  4024. void Killed (GameObject * obj, GameObject * killer)
  4025. {
  4026. Commands->Send_Custom_Event(obj, Commands->Find_Object(100162), M05_CACHE_REINFORCE, 1, 0.0f);
  4027. }
  4028. void Timer_Expired (GameObject* obj, int timer_id)
  4029. {
  4030. ActionParamsStruct params;
  4031. if(timer_id == ATTACK_STAR)
  4032. {
  4033. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), 10);
  4034. params.Set_Movement (STAR, RUN, 3.0f);
  4035. Commands->Action_Goto (obj, params);
  4036. }
  4037. }
  4038. };
  4039. DECLARE_SCRIPT(M05_Free_Dump_Captives, "")
  4040. {
  4041. bool already_entered;
  4042. // Register variables to be Auto-Saved
  4043. // All variables must have a unique ID, less than 256, that never changes
  4044. REGISTER_VARIABLES()
  4045. {
  4046. SAVE_VARIABLE( already_entered, 1 );
  4047. }
  4048. void Created (GameObject * obj)
  4049. {
  4050. already_entered = false;
  4051. }
  4052. void Entered (GameObject * obj, GameObject * enterer)
  4053. {
  4054. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4055. {
  4056. already_entered = true;
  4057. Commands->Send_Custom_Event(obj, Commands->Find_Object(100167), M05_FREE_DUMP_CAPTIVES, 1, 0.0f);
  4058. Commands->Send_Custom_Event(obj, Commands->Find_Object(100168), M05_FREE_DUMP_CAPTIVES, 1, 0.0f);
  4059. // Shutdown Alley Sprint
  4060. Commands->Enable_Spawner(100760, true);
  4061. Commands->Enable_Spawner(100766, true);
  4062. }
  4063. }
  4064. };
  4065. DECLARE_SCRIPT(M05_Dump_Captives, "")
  4066. {
  4067. enum{GO_POWERUPS, ARM_SHOTGUN};
  4068. // Register variables to be Auto-Saved
  4069. // All variables must have a unique ID, less than 256, that never changes
  4070. REGISTER_VARIABLES()
  4071. {
  4072. // SAVE_VARIABLE( unit_id, 1 );
  4073. }
  4074. void Created (GameObject * obj)
  4075. {
  4076. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_NEUTRAL );
  4077. Commands->Set_Innate_Is_Stationary(obj, true);
  4078. }
  4079. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4080. {
  4081. ActionParamsStruct params;
  4082. if(type == M05_FREE_DUMP_CAPTIVES)
  4083. {
  4084. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4085. Commands->Set_Innate_Is_Stationary(obj, false);
  4086. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_POWERUPS );
  4087. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4088. params.WaypathID = 100756;
  4089. Commands->Action_Goto( obj, params );
  4090. }
  4091. }
  4092. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4093. {
  4094. ActionParamsStruct params;
  4095. if(action_id == GO_POWERUPS && reason == ACTION_COMPLETE_NORMAL)
  4096. {
  4097. Commands->Give_PowerUp(obj, "POW_Chaingun_AI");
  4098. Commands->Start_Timer (obj, this, 1.0f, ARM_SHOTGUN);
  4099. }
  4100. }
  4101. Vector3 Get_Circle_Position( GameObject *obj, GameObject *target , float radius , float reverseprob)
  4102. {
  4103. double theta_angle = (360/5);
  4104. float reverse = Commands->Get_Random(0.0f,1.0f);
  4105. if ( reverse < reverseprob)
  4106. {
  4107. theta_angle *= -1;
  4108. }
  4109. Vector3 position = Commands->Get_Position(obj);
  4110. Vector3 targetlocation = Commands->Get_Position( target ) - position;
  4111. targetlocation.Normalize();
  4112. targetlocation *= radius;
  4113. targetlocation.Rotate_Z(DEG_TO_RADF(theta_angle));
  4114. targetlocation += position;
  4115. return targetlocation;
  4116. }
  4117. void Timer_Expired(GameObject * obj, int timer_id )
  4118. {
  4119. ActionParamsStruct params;
  4120. if(timer_id == ARM_SHOTGUN)
  4121. {
  4122. Commands->Select_Weapon(obj, "Weapon_Chaingun_AI" );
  4123. Vector3 curr_loc = Commands->Get_Position(obj);
  4124. Commands->Debug_Message("Current Location: %d", curr_loc);
  4125. Vector3 go_loc = Get_Circle_Position(obj, obj, 5.0f, 0.0f);
  4126. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_POWERUPS );
  4127. params.Set_Movement( go_loc, RUN, 0.5f );
  4128. Commands->Action_Goto( obj, params );
  4129. }
  4130. }
  4131. void Killed (GameObject * obj, GameObject * killer)
  4132. {
  4133. Commands->Send_Custom_Event(obj, Commands->Find_Object(100173), M05_DUMP_REINFORCE, 1, 0.0f);
  4134. }
  4135. };
  4136. DECLARE_SCRIPT(M05_Dump_Unit, "Unit_ID=0:int")
  4137. {
  4138. int unit_id;
  4139. // Register variables to be Auto-Saved
  4140. // All variables must have a unique ID, less than 256, that never changes
  4141. REGISTER_VARIABLES()
  4142. {
  4143. SAVE_VARIABLE( unit_id, 1 );
  4144. }
  4145. void Created (GameObject * obj)
  4146. {
  4147. unit_id = Get_Int_Parameter("Unit_ID");
  4148. if(unit_id == 3)
  4149. {
  4150. Commands->Set_Innate_Is_Stationary(obj, true);
  4151. }
  4152. }
  4153. void Killed (GameObject * obj, GameObject * killer)
  4154. {
  4155. Commands->Send_Custom_Event(obj, Commands->Find_Object(100173), M05_DUMP_REINFORCE, unit_id, 0.0f);
  4156. }
  4157. };
  4158. DECLARE_SCRIPT(M05_Dump_Controller, "") // 100173
  4159. {
  4160. int reinforce_cnt;
  4161. int unit_id1;
  4162. int unit_id2;
  4163. int unit_id3;
  4164. // Register variables to be Auto-Saved
  4165. // All variables must have a unique ID, less than 256, that never changes
  4166. REGISTER_VARIABLES()
  4167. {
  4168. SAVE_VARIABLE( reinforce_cnt, 1 );
  4169. SAVE_VARIABLE( unit_id1, 2 );
  4170. SAVE_VARIABLE( unit_id2, 3 );
  4171. SAVE_VARIABLE( unit_id3, 4 );
  4172. }
  4173. void Created (GameObject * obj)
  4174. {
  4175. reinforce_cnt = 3;
  4176. unit_id1 = 0;
  4177. unit_id2 = 0;
  4178. unit_id3 = 0;
  4179. }
  4180. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4181. {
  4182. ActionParamsStruct params;
  4183. if(type == M05_DUMP_REINFORCE)
  4184. {
  4185. switch(param)
  4186. {
  4187. case 1:
  4188. {
  4189. unit_id1++;
  4190. if(unit_id1%2 == 0)
  4191. {
  4192. // Additional civilian resistance
  4193. Commands->Enable_Spawner(100771, true);
  4194. Commands->Enable_Spawner(100772, true);
  4195. }
  4196. }
  4197. break;
  4198. case 2:
  4199. {
  4200. unit_id2++;
  4201. if(unit_id2%2 == 0 && unit_id2 < 7)
  4202. {
  4203. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-275.241f, 12.450f, 16.044f));
  4204. Commands->Set_Facing(chinook_obj, -125.000f);
  4205. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X5I_TroopDrop3.txt");
  4206. }
  4207. else
  4208. {
  4209. }
  4210. }
  4211. break;
  4212. case 3:
  4213. {
  4214. unit_id3++;
  4215. if(unit_id3 < 3)
  4216. {
  4217. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-283.920f, 21.640f, 20.110f));
  4218. Commands->Set_Facing(controller, 75.000f);
  4219. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_WINTROOPS04.txt");
  4220. }
  4221. else
  4222. {
  4223. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-283.920f, 21.640f, 20.110f));
  4224. Commands->Set_Facing(controller, 75.000f);
  4225. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_WINTROOPS05.txt");
  4226. }
  4227. }
  4228. break;
  4229. }
  4230. }
  4231. }
  4232. };
  4233. DECLARE_SCRIPT(M05_SniperAlley_Sniper, "Sniper_ID=0:int")
  4234. {
  4235. int sniper_id;
  4236. enum {SNIPER_LOC};
  4237. // Register variables to be Auto-Saved
  4238. // All variables must have a unique ID, less than 256, that never changes
  4239. REGISTER_VARIABLES()
  4240. {
  4241. SAVE_VARIABLE( sniper_id, 1 );
  4242. }
  4243. void Created (GameObject * obj)
  4244. {
  4245. ActionParamsStruct params;
  4246. sniper_id = Get_Int_Parameter("Sniper_ID");
  4247. switch(sniper_id)
  4248. {
  4249. case 1:
  4250. {
  4251. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4252. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4253. params.WaypathID = 100184;
  4254. Commands->Action_Goto( obj, params );
  4255. }
  4256. break;
  4257. case 2:
  4258. {
  4259. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4260. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4261. params.WaypathID = 100189;
  4262. Commands->Action_Goto( obj, params );
  4263. }
  4264. break;
  4265. case 3:
  4266. {
  4267. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4268. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4269. params.WaypathID = 100193;
  4270. Commands->Action_Goto( obj, params );
  4271. }
  4272. break;
  4273. case 4:
  4274. {
  4275. Commands->Set_Innate_Is_Stationary(obj, true);
  4276. }
  4277. break;
  4278. case 5:
  4279. {
  4280. Commands->Set_Innate_Is_Stationary(obj, true);
  4281. }
  4282. break;
  4283. case 6:
  4284. {
  4285. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4286. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4287. params.WaypathID = 100201;
  4288. Commands->Action_Goto( obj, params );
  4289. }
  4290. break;
  4291. case 7:
  4292. {
  4293. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4294. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4295. params.WaypathID = 100205;
  4296. Commands->Action_Goto( obj, params );
  4297. }
  4298. break;
  4299. case 8:
  4300. {
  4301. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4302. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4303. params.WaypathID = 100214;
  4304. Commands->Action_Goto( obj, params );
  4305. }
  4306. break;
  4307. case 9:
  4308. {
  4309. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4310. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4311. params.WaypathID = 100761;
  4312. Commands->Action_Goto( obj, params );
  4313. }
  4314. break;
  4315. case 10:
  4316. {
  4317. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, SNIPER_LOC );
  4318. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4319. params.WaypathID = 100767;
  4320. Commands->Action_Goto( obj, params );
  4321. }
  4322. break;
  4323. }
  4324. }
  4325. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4326. {
  4327. ActionParamsStruct params;
  4328. if(action_id == SNIPER_LOC)
  4329. {
  4330. Commands->Set_Innate_Is_Stationary(obj, true);
  4331. Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
  4332. }
  4333. }
  4334. void Killed (GameObject * obj, GameObject * killer)
  4335. {
  4336. }
  4337. };
  4338. DECLARE_SCRIPT(M05_Alley_Sprint, "")
  4339. {
  4340. // Register variables to be Auto-Saved
  4341. // All variables must have a unique ID, less than 256, that never changes
  4342. REGISTER_VARIABLES()
  4343. {
  4344. // SAVE_VARIABLE( sniper_id, 1 );
  4345. }
  4346. void Created (GameObject * obj)
  4347. {
  4348. ActionParamsStruct params;
  4349. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  4350. params.Set_Movement( Vector3(0,0,0), RUN, 0.5f );
  4351. params.WaypathID = 100235;
  4352. Commands->Action_Goto( obj, params );
  4353. }
  4354. };
  4355. DECLARE_SCRIPT(M05_Deactivate_Alley_Sprint, "")
  4356. {
  4357. bool already_entered;
  4358. // Register variables to be Auto-Saved
  4359. // All variables must have a unique ID, less than 256, that never changes
  4360. REGISTER_VARIABLES()
  4361. {
  4362. SAVE_VARIABLE( already_entered, 1 );
  4363. }
  4364. void Created (GameObject * obj)
  4365. {
  4366. already_entered = false;
  4367. }
  4368. void Entered (GameObject * obj, GameObject * enterer)
  4369. {
  4370. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4371. {
  4372. already_entered = true;
  4373. // Shutdown Alley Sprint
  4374. Commands->Enable_Spawner(100227, false);
  4375. Commands->Enable_Spawner(100228, false);
  4376. }
  4377. }
  4378. };
  4379. DECLARE_SCRIPT(M05_Inn_Tank, "")
  4380. {
  4381. int fire_loc[3];
  4382. bool attacking;
  4383. enum {TANK_TIMER, WAYPATH};
  4384. // Register variables to be Auto-Saved
  4385. // All variables must have a unique ID, less than 256, that never changes
  4386. REGISTER_VARIABLES()
  4387. {
  4388. SAVE_VARIABLE( fire_loc, 2 );
  4389. SAVE_VARIABLE( attacking, 2 );
  4390. }
  4391. void Created (GameObject * obj)
  4392. {
  4393. ActionParamsStruct params;
  4394. fire_loc[0] = 100249;
  4395. fire_loc[1] = 100250;
  4396. fire_loc[2] = 100251;
  4397. attacking = false;
  4398. // Fire upon building
  4399. Commands->Start_Timer (obj, this, 0.0f, TANK_TIMER);
  4400. }
  4401. void Timer_Expired(GameObject * obj, int timer_id )
  4402. {
  4403. ActionParamsStruct params;
  4404. if(timer_id == TANK_TIMER)
  4405. {
  4406. ActionParamsStruct params;
  4407. attacking = false;
  4408. int random = Commands->Get_Random_Int(0,ARRAY_ELEMENT_COUNT(fire_loc));
  4409. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  4410. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 250.0f, 10.0f, 1);
  4411. params.AttackCheckBlocked = false;
  4412. Commands->Action_Attack( obj, params );
  4413. // Fire upon building
  4414. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  4415. }
  4416. }
  4417. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4418. {
  4419. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  4420. {
  4421. return;
  4422. }
  4423. ActionParamsStruct params;
  4424. if(!attacking)
  4425. {
  4426. attacking = true;
  4427. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  4428. params.Set_Attack (damager, 200.0f, 5.0f, 1);
  4429. params.AttackCheckBlocked = true;
  4430. Commands->Action_Attack (obj, params);
  4431. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  4432. }
  4433. }
  4434. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  4435. {
  4436. ActionParamsStruct params;
  4437. if(!attacking)
  4438. {
  4439. attacking = true;
  4440. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  4441. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  4442. params.AttackCheckBlocked = false;
  4443. Commands->Action_Attack( obj, params );
  4444. Commands->Start_Timer (obj, this, 15.0f, TANK_TIMER);
  4445. }
  4446. }
  4447. };
  4448. DECLARE_SCRIPT(M05_Inn_Controller, "") // 100244
  4449. {
  4450. int unit_id1;
  4451. int unit_id2;
  4452. // Register variables to be Auto-Saved
  4453. // All variables must have a unique ID, less than 256, that never changes
  4454. REGISTER_VARIABLES()
  4455. {
  4456. SAVE_VARIABLE( unit_id1, 1 );
  4457. SAVE_VARIABLE( unit_id2, 2 );
  4458. }
  4459. void Created (GameObject * obj)
  4460. {
  4461. unit_id1 = 0;
  4462. unit_id2 = 0;
  4463. }
  4464. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4465. {
  4466. ActionParamsStruct params;
  4467. if(type == M05_INN_REINFORCE)
  4468. {
  4469. switch(param)
  4470. {
  4471. case 1:
  4472. {
  4473. unit_id1++;
  4474. if(unit_id1%2 == 0)
  4475. {
  4476. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-50.117f, -62.048f, 4.001f));
  4477. Commands->Set_Facing(chinook_obj1, 95.000f);
  4478. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop5.txt");
  4479. }
  4480. else
  4481. {
  4482. }
  4483. }
  4484. break;
  4485. case 2:
  4486. {
  4487. unit_id2++;
  4488. if(unit_id2%2 == 0)
  4489. {
  4490. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-98.226f, -75.228f, 4.042f));
  4491. Commands->Set_Facing(chinook_obj1, -80.000f);
  4492. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop6.txt");
  4493. }
  4494. else
  4495. {
  4496. }
  4497. }
  4498. break;
  4499. }
  4500. }
  4501. }
  4502. };
  4503. DECLARE_SCRIPT (M05_Apc_Drop_DME, "")
  4504. {
  4505. int path_sec;
  4506. int daves_1, daves_2, daves_3;
  4507. // Register variables to be Auto-Saved
  4508. // All variables must have a unique ID, less than 256, that never changes
  4509. REGISTER_VARIABLES()
  4510. {
  4511. SAVE_VARIABLE( path_sec, 1 );
  4512. SAVE_VARIABLE( daves_1, 2 );
  4513. SAVE_VARIABLE( daves_2, 3 );
  4514. SAVE_VARIABLE( daves_3, 4 );
  4515. }
  4516. void Created (GameObject *obj)
  4517. {
  4518. path_sec = 0;
  4519. daves_1 = 100258;
  4520. daves_2 = 100259;
  4521. daves_3 = 100260;
  4522. }
  4523. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  4524. {
  4525. if (sender == STAR && type == 100 && param == 100)
  4526. {
  4527. GameObject *point_1 = Commands->Find_Object (daves_1);
  4528. GameObject *point_2 = Commands->Find_Object (daves_2);
  4529. GameObject *point_3 = Commands->Find_Object (daves_3);
  4530. Vector3 loc_1 = Commands->Get_Position (point_1);
  4531. Vector3 loc_2 = Commands->Get_Position (point_2);
  4532. Vector3 loc_3 = Commands->Get_Position (point_3);
  4533. switch (path_sec)
  4534. {
  4535. case 0:
  4536. {
  4537. path_sec++;
  4538. ActionParamsStruct params;
  4539. params.Set_Basic( this, 99, 90 );
  4540. params.Set_Movement( loc_1, 1.5f, 2.0f );
  4541. Commands->Action_Goto( obj, params );
  4542. }
  4543. break;
  4544. case 1:
  4545. {
  4546. path_sec++;
  4547. ActionParamsStruct params;
  4548. params.Set_Basic( this, 99, 90 );
  4549. params.Set_Movement( loc_2, 1.5f, 2.0f );
  4550. Commands->Action_Goto( obj, params );
  4551. }
  4552. break;
  4553. case 2:
  4554. {
  4555. path_sec++;
  4556. ActionParamsStruct params;
  4557. params.Set_Basic( this, 99, 90 );
  4558. params.Set_Movement( loc_3, 1.5f, 2.0f );
  4559. Commands->Action_Goto( obj, params );
  4560. }
  4561. break;
  4562. }
  4563. }
  4564. }
  4565. };
  4566. DECLARE_SCRIPT (M05_Apc_Drop_Zone_DME, "")
  4567. {
  4568. void Entered(GameObject * obj, GameObject * enterer)
  4569. {
  4570. if (enterer == STAR)
  4571. {
  4572. GameObject *apc1 = Commands->Find_Object (100256);
  4573. Commands->Send_Custom_Event ( STAR, apc1, 100, 100, 0.0f );
  4574. }
  4575. }
  4576. };
  4577. DECLARE_SCRIPT(M05_Activate_Surprise_Tank, "")
  4578. {
  4579. bool already_entered;
  4580. enum{EXPLODE_BLOCK};
  4581. // Register variables to be Auto-Saved
  4582. // All variables must have a unique ID, less than 256, that never changes
  4583. REGISTER_VARIABLES()
  4584. {
  4585. SAVE_VARIABLE( already_entered, 1 );
  4586. }
  4587. void Created (GameObject * obj)
  4588. {
  4589. already_entered = false;
  4590. }
  4591. void Entered (GameObject * obj, GameObject * enterer)
  4592. {
  4593. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4594. {
  4595. already_entered = true;
  4596. Commands->Enable_Spawner(100271, true);
  4597. Commands->Start_Timer (obj, this, 1.0f, EXPLODE_BLOCK);
  4598. }
  4599. }
  4600. void Timer_Expired(GameObject * obj, int timer_id )
  4601. {
  4602. if(timer_id == EXPLODE_BLOCK)
  4603. {
  4604. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(105382)));
  4605. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(101865)));
  4606. Commands->Destroy_Object(Commands->Find_Object(105382));
  4607. Commands->Destroy_Object(Commands->Find_Object(101865));
  4608. Commands->Destroy_Object(obj);
  4609. }
  4610. }
  4611. };
  4612. DECLARE_SCRIPT(M05_Surprise_Tank, "")
  4613. {
  4614. // Register variables to be Auto-Saved
  4615. // All variables must have a unique ID, less than 256, that never changes
  4616. REGISTER_VARIABLES()
  4617. {
  4618. // SAVE_VARIABLE( attacking, 1 );
  4619. }
  4620. void Created (GameObject * obj)
  4621. {
  4622. ActionParamsStruct params;
  4623. Commands->Enable_Enemy_Seen( obj, true);
  4624. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 10 );
  4625. params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
  4626. params.WaypathID = 101236;
  4627. params.WaypathSplined = true;
  4628. Commands->Action_Attack( obj, params );
  4629. }
  4630. };
  4631. DECLARE_SCRIPT(M05_Execution_Civilian, "")
  4632. {
  4633. bool poked;
  4634. // Register variables to be Auto-Saved
  4635. // All variables must have a unique ID, less than 256, that never changes
  4636. REGISTER_VARIABLES()
  4637. {
  4638. SAVE_VARIABLE( poked, 1 );
  4639. }
  4640. void Created(GameObject * obj)
  4641. {
  4642. ActionParamsStruct params;
  4643. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  4644. params.Set_Animation("S_A_HUMAN.H_A_Host_L2b", true);
  4645. Commands->Action_Play_Animation(obj, params);
  4646. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4647. poked = false;
  4648. Commands->Innate_Disable(obj);
  4649. }
  4650. void Poked(GameObject * obj, GameObject * poker)
  4651. {
  4652. ActionParamsStruct params;
  4653. if ((Commands->Is_A_Star(poker)) && (!poked))
  4654. {
  4655. poked = true;
  4656. Commands->Innate_Enable(obj);
  4657. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4658. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
  4659. params.Set_Animation("S_A_HUMAN.H_A_Host_L2c", false);
  4660. Commands->Action_Play_Animation(obj, params);
  4661. // You are so brave, GDI! How can I ever repay you for your help?
  4662. const char *conv_name = ("M05_CON034");
  4663. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  4664. Commands->Join_Conversation(obj, conv_id, false, true);
  4665. Commands->Join_Conversation(STAR, conv_id, false, true);
  4666. Commands->Start_Conversation (conv_id, 300509);
  4667. Vector3 pos = Commands->Get_Position(obj);
  4668. float facing = Commands->Get_Facing(obj);
  4669. float a = cos(DEG_TO_RADF(facing)) * 1.5;
  4670. float b = sin(DEG_TO_RADF(facing)) * 1.5;
  4671. Vector3 powerup_loc = pos + Vector3(a, b, 0.5f);
  4672. Commands->Create_Object("tw_POW00_Health", powerup_loc);
  4673. }
  4674. }
  4675. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4676. {
  4677. ActionParamsStruct params;
  4678. }
  4679. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4680. {
  4681. ActionParamsStruct params;
  4682. if(type == M05_CUSTOM_ACTIVATE)
  4683. {
  4684. Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
  4685. }
  4686. }
  4687. };
  4688. DECLARE_SCRIPT(M05_Execution_Nod, "")
  4689. {
  4690. // Register variables to be Auto-Saved
  4691. // All variables must have a unique ID, less than 256, that never changes
  4692. REGISTER_VARIABLES()
  4693. {
  4694. // SAVE_VARIABLE( poked, 1 );
  4695. }
  4696. void Created(GameObject * obj)
  4697. {
  4698. ActionParamsStruct params;
  4699. Commands->Innate_Disable(obj);
  4700. }
  4701. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4702. {
  4703. ActionParamsStruct params;
  4704. if(type == M05_CUSTOM_ACTIVATE)
  4705. {
  4706. Commands->Innate_Enable(obj);
  4707. /* if(Commands->Find_Object(101239))
  4708. {
  4709. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 10 );
  4710. params.Set_Attack (Commands->Find_Object(101239), 250.0f, 0.0f, 1);
  4711. Commands->Action_Attack (obj, params);
  4712. }
  4713. */
  4714. }
  4715. }
  4716. };
  4717. DECLARE_SCRIPT(M05_Activate_Entrapment_Civ, "")
  4718. {
  4719. bool already_entered;
  4720. // Register variables to be Auto-Saved
  4721. // All variables must have a unique ID, less than 256, that never changes
  4722. REGISTER_VARIABLES()
  4723. {
  4724. SAVE_VARIABLE( already_entered, 1 );
  4725. }
  4726. void Created (GameObject * obj)
  4727. {
  4728. already_entered = false;
  4729. }
  4730. void Entered (GameObject * obj, GameObject * enterer)
  4731. {
  4732. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  4733. {
  4734. already_entered = true;
  4735. // Send custom to Civs to change playertype
  4736. Commands->Send_Custom_Event (obj, Commands->Find_Object(100272), 100, 100, 0.0f);
  4737. Commands->Send_Custom_Event (obj, Commands->Find_Object(100273), 100, 100, 0.0f);
  4738. // Mendoza
  4739. Commands->Enable_Spawner(100275, true);
  4740. // Drop balcony soldiers
  4741. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-158.668f, 53.528f, 28.338f));
  4742. Commands->Set_Facing(chinook_obj1, -30.000f);
  4743. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_C130TroopDrop3.txt");
  4744. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-126.819f, 76.467f, 34.683f));
  4745. Commands->Set_Facing(chinook_obj2, -30.000f);
  4746. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X5D_C130TroopDrop4.txt");
  4747. // GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(-121.787f, 43.174f, 21.511f));
  4748. // Commands->Set_Facing(chinook_obj3, -30.000f);
  4749. // Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "X5D_C130TroopDrop5.txt");
  4750. }
  4751. }
  4752. };
  4753. DECLARE_SCRIPT(M05_Entrapment_Mendoza, "")
  4754. {
  4755. bool exiting;
  4756. float health;
  4757. enum{BYE_MENDOZA};
  4758. // Register variables to be Auto-Saved
  4759. // All variables must have a unique ID, less than 256, that never changes
  4760. REGISTER_VARIABLES()
  4761. {
  4762. SAVE_VARIABLE( health, 1 );
  4763. SAVE_VARIABLE( exiting, 2 );
  4764. }
  4765. void Created (GameObject * obj)
  4766. {
  4767. ActionParamsStruct params;
  4768. exiting = false;
  4769. health = Commands->Get_Max_Health(obj);
  4770. // You're gonna bleed, GDI!\n
  4771. const char *conv_name = ("M05_CON035");
  4772. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  4773. Commands->Join_Conversation(obj, conv_id, false, true);
  4774. Commands->Start_Conversation (conv_id, 1);
  4775. Commands->Monitor_Conversation (obj, conv_id);
  4776. Commands->Set_Innate_Is_Stationary(obj, true);
  4777. }
  4778. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4779. {
  4780. ActionParamsStruct params;
  4781. if(action_id == 15 && reason == ACTION_COMPLETE_NORMAL)
  4782. {
  4783. Commands->Set_Innate_Is_Stationary(obj, true);
  4784. Commands->Set_Facing(obj, -180.0f);
  4785. }
  4786. if(action_id == BYE_MENDOZA && reason == ACTION_COMPLETE_NORMAL)
  4787. {
  4788. Commands->Destroy_Object(obj);
  4789. }
  4790. }
  4791. void Damaged (GameObject * obj, GameObject * damager, float amount)
  4792. {
  4793. ActionParamsStruct params;
  4794. if(health > (.2 * Commands->Get_Max_Health(obj)))
  4795. {
  4796. float damage = health - Commands->Get_Health(obj);
  4797. damage *= 0.5f;
  4798. health -= damage;
  4799. Commands->Set_Health(obj, health);
  4800. }
  4801. if((Commands->Get_Health(obj)) < (Commands->Get_Max_Health(obj) * .23))
  4802. {
  4803. Commands->Set_Health( obj, (Commands->Get_Max_Health(obj) * .23) );
  4804. if(!exiting)
  4805. {
  4806. // Hah! Is that all you got?\n
  4807. const char *conv_name = ("M05_CON016");
  4808. int conv_id = Commands->Create_Conversation (conv_name, INNATE_PRIORITY_ENEMY_SEEN + 5, 200.0f, false);
  4809. Commands->Join_Conversation(obj, conv_id, false, true);
  4810. Commands->Start_Conversation (conv_id, 1);
  4811. Commands->Monitor_Conversation (obj, conv_id);
  4812. exiting = true;
  4813. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
  4814. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  4815. params.WaypathID = 100282;
  4816. Commands->Action_Goto( obj, params );
  4817. }
  4818. }
  4819. }
  4820. };
  4821. DECLARE_SCRIPT(M05_Cathedral_Controller, "") // 100287
  4822. {
  4823. int soldier_id1;
  4824. int soldier_id2;
  4825. int soldier_id3;
  4826. int m05_cathedral_vehicle_killed;
  4827. int blackhand_cnt;
  4828. enum{SECOND_APACHE};
  4829. // Register variables to be Auto-Saved
  4830. // All variables must have a unique ID, less than 256, that never changes
  4831. REGISTER_VARIABLES()
  4832. {
  4833. SAVE_VARIABLE( soldier_id1, 1 );
  4834. SAVE_VARIABLE( soldier_id2, 2 );
  4835. SAVE_VARIABLE( soldier_id3, 3 );
  4836. SAVE_VARIABLE( m05_cathedral_vehicle_killed, 4 );
  4837. SAVE_VARIABLE( blackhand_cnt, 5 );
  4838. }
  4839. void Created (GameObject * obj)
  4840. {
  4841. soldier_id1 = 0;
  4842. soldier_id2 = 0;
  4843. soldier_id3 = 0;
  4844. m05_cathedral_vehicle_killed = 0;
  4845. blackhand_cnt = 0;
  4846. }
  4847. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  4848. {
  4849. ActionParamsStruct params;
  4850. if(type == M05_INITIATE_CATHEDRAL)
  4851. {
  4852. GameObject * apache1 = Commands->Create_Object ( "Nod_Apache", Vector3(-182.814f, 226.598f, 65.317f));
  4853. Commands->Attach_Script(apache1, "M05_Cathedral_Apache", "1");
  4854. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_CREATED, 1, 0.0f);
  4855. Commands->Start_Timer(obj, this, 3.0f, SECOND_APACHE);
  4856. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-237.069f, 182.809f, 30.381f));
  4857. Commands->Set_Facing(chinook_obj1, 125.000f);
  4858. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "M05_XG_VehicleDrop4.txt");
  4859. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-120.930f, 108.820f, 29.828f));
  4860. Commands->Set_Facing(chinook_obj2, -45.000f);
  4861. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "M05_XG_VehicleDrop5.txt");
  4862. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(-252.027f, 118.122f, 29.883f));
  4863. Commands->Set_Facing(chinook_obj3, -150.000f);
  4864. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "M05_XG_VehicleDrop6.txt");
  4865. }
  4866. if(type == M05_CATHEDRAL_VEHICLE_CREATED)
  4867. {
  4868. m05_cathedral_vehicle_killed++;
  4869. }
  4870. if(type == M05_CATHEDRAL_VEHICLE_KILLED)
  4871. {
  4872. m05_cathedral_vehicle_killed--;
  4873. }
  4874. if(type == M05_CATHEDRAL_REINFORCE && blackhand_cnt < 9)
  4875. {
  4876. blackhand_cnt++;
  4877. switch(param)
  4878. {
  4879. case 7:
  4880. {
  4881. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-167.978f, 178.023f, 29.226f));
  4882. Commands->Set_Facing(chinook_obj1, 0.000f);
  4883. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop7.txt");
  4884. }
  4885. break;
  4886. case 8:
  4887. {
  4888. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-179.221f, 110.382f, 28.744f));
  4889. Commands->Set_Facing(chinook_obj2, 0.000f);
  4890. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X5D_CHTroopdrop8.txt");
  4891. }
  4892. break;
  4893. case 10:
  4894. {
  4895. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(-137.472f, 141.174f, 29.144f));
  4896. Commands->Set_Facing(chinook_obj3, 0.000f);
  4897. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "X5D_CHTroopdrop10.txt");
  4898. }
  4899. break;
  4900. }
  4901. }
  4902. if(m05_cathedral_vehicle_killed == 0 && blackhand_cnt > 7)
  4903. {
  4904. Commands->Create_Logical_Sound(obj, M05_CATHEDRAL_FREE, Commands->Get_Position(obj), 5000.0f);
  4905. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 506, 1, 0.0f);
  4906. }
  4907. }
  4908. void Timer_Expired(GameObject* obj, int timer_id)
  4909. {
  4910. if(timer_id == SECOND_APACHE)
  4911. {
  4912. GameObject * apache2 = Commands->Create_Object ( "Nod_Apache", Vector3(-116.199f, 300.494f, 54.718f));
  4913. Commands->Attach_Script(apache2, "M05_Cathedral_Apache", "2");
  4914. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_CREATED, 1, 0.0f);
  4915. // Blackhand infantry
  4916. GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(-167.978f, 178.023f, 29.226f));
  4917. Commands->Set_Facing(chinook_obj1, 0.000f);
  4918. Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X5D_CHTroopdrop7.txt");
  4919. GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(-179.221f, 110.382f, 28.744f));
  4920. Commands->Set_Facing(chinook_obj2, 0.000f);
  4921. Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X5D_CHTroopdrop8.txt");
  4922. GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(-137.472f, 141.174f, 29.144f));
  4923. Commands->Set_Facing(chinook_obj3, 0.000f);
  4924. Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "X5D_CHTroopdrop10.txt");
  4925. }
  4926. }
  4927. };
  4928. DECLARE_SCRIPT(M05_Cathedral_Apache, "Apache_ID=0:int") // 100287
  4929. {
  4930. int apache_id;
  4931. int fire_loc[10];
  4932. bool attacking;
  4933. enum{ASSAULT_WAYPATH};
  4934. // Register variables to be Auto-Saved
  4935. // All variables must have a unique ID, less than 256, that never changes
  4936. REGISTER_VARIABLES()
  4937. {
  4938. SAVE_VARIABLE( apache_id, 1 );
  4939. // SAVE_VARIABLE( fire_loc, 2 );
  4940. SAVE_VARIABLE( attacking, 3 );
  4941. }
  4942. void Created (GameObject * obj)
  4943. {
  4944. fire_loc[0] = 100326;
  4945. fire_loc[1] = 100327;
  4946. fire_loc[2] = 100328;
  4947. fire_loc[3] = 100329;
  4948. fire_loc[4] = 100330;
  4949. fire_loc[5] = 100331;
  4950. fire_loc[6] = 100332;
  4951. fire_loc[7] = 100333;
  4952. fire_loc[8] = 100334;
  4953. fire_loc[9] = 100335;
  4954. ActionParamsStruct params;
  4955. Commands->Enable_Enemy_Seen( obj, true);
  4956. apache_id = Get_Int_Parameter("Apache_ID");
  4957. attacking = true;
  4958. Commands->Disable_Physical_Collisions(obj);
  4959. // Initial Apache Path
  4960. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ASSAULT_WAYPATH );
  4961. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  4962. params.WaypathID = 101320;
  4963. Commands->Action_Goto( obj, params );
  4964. }
  4965. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4966. {
  4967. ActionParamsStruct params;
  4968. if(action_id == ASSAULT_WAYPATH)
  4969. {
  4970. switch(apache_id)
  4971. {
  4972. case 1:
  4973. {
  4974. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  4975. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  4976. params.WaypathID = 100300;
  4977. Commands->Action_Attack( obj, params );
  4978. }
  4979. break;
  4980. case 2:
  4981. {
  4982. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  4983. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  4984. params.WaypathID = 100310;
  4985. Commands->Action_Attack( obj, params );
  4986. }
  4987. break;
  4988. }
  4989. // Fire at attack locs
  4990. Commands->Start_Timer(obj, this, 1.0f, apache_id);
  4991. }
  4992. }
  4993. void Timer_Expired(GameObject* obj, int timer_id)
  4994. {
  4995. ActionParamsStruct params;
  4996. int random = Commands->Get_Random_Int(0,ARRAY_ELEMENT_COUNT(fire_loc));
  4997. attacking = false;
  4998. if(timer_id == 1)
  4999. {
  5000. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  5001. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  5002. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 100, 0.5f, true);
  5003. params.WaypathID = 100300;
  5004. params.AttackCheckBlocked = false;
  5005. Commands->Modify_Action (obj, 10, params);
  5006. }
  5007. if(timer_id == 2)
  5008. {
  5009. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  5010. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  5011. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 100, 0.5f, true);
  5012. params.WaypathID = 100310;
  5013. params.AttackCheckBlocked = false;
  5014. Commands->Modify_Action (obj, 10, params);
  5015. }
  5016. Commands->Start_Timer(obj, this, 6.0f, apache_id);
  5017. }
  5018. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  5019. {
  5020. if ( sound.Type == M05_CATHEDRAL_FREE )
  5021. {
  5022. Commands->Apply_Damage( obj, 100000, "DEATH", obj );
  5023. }
  5024. }
  5025. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  5026. {
  5027. ActionParamsStruct params;
  5028. if(!attacking)
  5029. {
  5030. attacking = true;
  5031. switch(apache_id)
  5032. {
  5033. case 1:
  5034. {
  5035. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  5036. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  5037. params.Set_Attack (enemy, 100, 0.5f, true);
  5038. params.WaypathID = 100300;
  5039. params.AttackCheckBlocked = false;
  5040. Commands->Modify_Action (obj, 10, params);
  5041. }
  5042. break;
  5043. case 2:
  5044. {
  5045. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
  5046. params.Set_Movement( Vector3(0,0,0), RUN, 0.0f );
  5047. params.Set_Attack (enemy, 100, 0.5f, true);
  5048. params.WaypathID = 100310;
  5049. params.AttackCheckBlocked = false;
  5050. Commands->Modify_Action (obj, 10, params);
  5051. }
  5052. break;
  5053. }
  5054. Commands->Start_Timer(obj, this, 6.0f, apache_id);
  5055. }
  5056. }
  5057. void Killed (GameObject * obj, GameObject * killer)
  5058. {
  5059. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_KILLED, 1, 0.0f);
  5060. }
  5061. };
  5062. DECLARE_SCRIPT(M05_Cathedral_Para_Unit, "Soldier_ID=0:int")
  5063. {
  5064. bool cathedral_free;
  5065. enum{GO_STAR, ATTACK_STAR};
  5066. // Register variables to be Auto-Saved
  5067. // All variables must have a unique ID, less than 256, that never changes
  5068. REGISTER_VARIABLES()
  5069. {
  5070. SAVE_VARIABLE( cathedral_free, 1 );
  5071. }
  5072. void Created (GameObject * obj)
  5073. {
  5074. cathedral_free = false;
  5075. ActionParamsStruct params;
  5076. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), GO_STAR);
  5077. params.Set_Movement (STAR, RUN, 30.0f);
  5078. Commands->Action_Goto (obj, params);
  5079. }
  5080. void Timer_Expired(GameObject* obj, int timer_id)
  5081. {
  5082. ActionParamsStruct params;
  5083. float distance = Commands->Get_Distance (Commands->Get_Position(obj), Commands->Get_Position(STAR));
  5084. if(timer_id == GO_STAR && distance > 30.0f)
  5085. {
  5086. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), GO_STAR);
  5087. params.Set_Movement (STAR, RUN, 30.0f);
  5088. Commands->Action_Goto (obj, params);
  5089. }
  5090. else
  5091. {
  5092. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  5093. }
  5094. }
  5095. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5096. {
  5097. ActionParamsStruct params;
  5098. if(action_id == GO_STAR && reason == ACTION_COMPLETE_NORMAL)
  5099. {
  5100. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), ATTACK_STAR);
  5101. params.Set_Movement (STAR, RUN, 3.0f);
  5102. Commands->Action_Goto (obj, params);
  5103. Commands->Start_Timer (obj, this, 15.0f, GO_STAR);
  5104. }
  5105. }
  5106. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  5107. {
  5108. if ( sound.Type == M05_CATHEDRAL_FREE )
  5109. {
  5110. cathedral_free = true;
  5111. Commands->Apply_Damage( obj, 100000, "DEATH", obj );
  5112. }
  5113. }
  5114. void Killed (GameObject * obj, GameObject * killer)
  5115. {
  5116. if(!cathedral_free)
  5117. {
  5118. int soldier_id = Get_Int_Parameter("Soldier_ID");
  5119. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_REINFORCE, soldier_id, 0.0f);
  5120. }
  5121. }
  5122. };
  5123. DECLARE_SCRIPT(M05_Cache_Surprise, "")
  5124. {
  5125. bool already_entered;
  5126. // Register variables to be Auto-Saved
  5127. // All variables must have a unique ID, less than 256, that never changes
  5128. REGISTER_VARIABLES()
  5129. {
  5130. SAVE_VARIABLE( already_entered, 1 );
  5131. }
  5132. void Created (GameObject * obj)
  5133. {
  5134. already_entered = false;
  5135. }
  5136. void Entered (GameObject * obj, GameObject * enterer)
  5137. {
  5138. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5139. {
  5140. already_entered = true;
  5141. GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(-481.123f, -106.686f, 15.787f));
  5142. Commands->Set_Facing(controller1, -90.000f);
  5143. Commands->Attach_Script(controller1, "Test_Cinematic", "X5C_Wintroops06.txt");
  5144. GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(-486.106f, -93.892f, 18.440f));
  5145. Commands->Set_Facing(controller2, 175.000f);
  5146. Commands->Attach_Script(controller2, "Test_Cinematic", "X5C_Wintroops07.txt");
  5147. }
  5148. }
  5149. };
  5150. DECLARE_SCRIPT(M05_Vehicle_Dec, "")
  5151. {
  5152. bool attacking;
  5153. enum{ATTACK_OVER, ATTACKING};
  5154. // Register variables to be Auto-Saved
  5155. // All variables must have a unique ID, less than 256, that never changes
  5156. REGISTER_VARIABLES()
  5157. {
  5158. SAVE_VARIABLE( attacking, 1 );
  5159. }
  5160. void Created (GameObject * obj)
  5161. {
  5162. Commands->Enable_Enemy_Seen( obj, true);
  5163. attacking = false;
  5164. }
  5165. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  5166. {
  5167. ActionParamsStruct params;
  5168. if(!attacking)
  5169. {
  5170. attacking = true;
  5171. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ATTACKING );
  5172. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  5173. Commands->Action_Attack (obj, params);
  5174. Commands->Start_Timer (obj, this, 10.0f, ATTACK_OVER);
  5175. }
  5176. }
  5177. void Timer_Expired(GameObject * obj, int timer_id )
  5178. {
  5179. ActionParamsStruct params;
  5180. if(timer_id == ATTACK_OVER)
  5181. {
  5182. attacking = false;
  5183. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, ATTACKING );
  5184. params.Set_Attack (NULL, 250.0f, 0.0f, 1);
  5185. Commands->Modify_Action (obj, ATTACKING, params);
  5186. }
  5187. }
  5188. };
  5189. DECLARE_SCRIPT(M05_Roadblock_Controller, "") //100614
  5190. {
  5191. int unit_id1;
  5192. int unit_id2;
  5193. // Register variables to be Auto-Saved
  5194. // All variables must have a unique ID, less than 256, that never changes
  5195. REGISTER_VARIABLES()
  5196. {
  5197. SAVE_VARIABLE( unit_id1, 1 );
  5198. SAVE_VARIABLE( unit_id2, 2 );
  5199. }
  5200. void Created (GameObject * obj)
  5201. {
  5202. unit_id1 = 0;
  5203. unit_id2 = 0;
  5204. GameObject *controller1 = Commands->Create_Object("Invisible_Object", Vector3(-484.498f, -130.355f, 14.680f));
  5205. Commands->Set_Facing(controller1, -115.000f);
  5206. Commands->Attach_Script(controller1, "Test_Cinematic", "X5C_Wintroops18.txt");
  5207. GameObject *controller2 = Commands->Create_Object("Invisible_Object", Vector3(-483.220f, -122.518f, 17.043f));
  5208. Commands->Set_Facing(controller2, 90.000f);
  5209. Commands->Attach_Script(controller2, "Test_Cinematic", "X5C_Wintroops19.txt");
  5210. }
  5211. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  5212. {
  5213. if(type == M05_ROADBLOCK_REINFORCE)
  5214. {
  5215. switch(param)
  5216. {
  5217. case 1:
  5218. {
  5219. unit_id1++;
  5220. if(unit_id1 < 3)
  5221. {
  5222. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-484.498f, -130.355f, 14.680f));
  5223. Commands->Set_Facing(controller, -115.000f);
  5224. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops18.txt");
  5225. }
  5226. else if(unit_id1 >= 3 && unit_id1 < 5)
  5227. {
  5228. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-484.498f, -130.355f, 14.680f));
  5229. Commands->Set_Facing(controller, -115.000f);
  5230. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops08.txt");
  5231. }
  5232. }
  5233. break;
  5234. case 2:
  5235. {
  5236. unit_id2++;
  5237. if(unit_id2 < 3)
  5238. {
  5239. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-483.220f, -122.518f, 17.043f));
  5240. Commands->Set_Facing(controller, 90.000f);
  5241. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops19.txt");
  5242. }
  5243. else if(unit_id2 >= 3 && unit_id1 < 5)
  5244. {
  5245. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-483.220f, -122.518f, 17.043f));
  5246. Commands->Set_Facing(controller, 90.000f);
  5247. Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops09.txt");
  5248. }
  5249. }
  5250. break;
  5251. }
  5252. }
  5253. }
  5254. };
  5255. DECLARE_SCRIPT(M05_Roadblock_Unit, "Unit_ID=0:int")
  5256. {
  5257. int unit_id;
  5258. enum{GO_ROADLBOCK};
  5259. // Register variables to be Auto-Saved
  5260. // All variables must have a unique ID, less than 256, that never changes
  5261. REGISTER_VARIABLES()
  5262. {
  5263. SAVE_VARIABLE( unit_id, 1 );
  5264. }
  5265. void Created (GameObject * obj)
  5266. {
  5267. Commands->Start_Timer (obj, this, 3.0f, GO_ROADLBOCK);
  5268. unit_id = Get_Int_Parameter("Unit_ID");
  5269. }
  5270. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5271. {
  5272. ActionParamsStruct params;
  5273. if(action_id == GO_ROADLBOCK && reason == ACTION_COMPLETE_LOW_PRIORITY)
  5274. {
  5275. Commands->Start_Timer (obj, this, 6.0f, GO_ROADLBOCK);
  5276. }
  5277. if(action_id == GO_ROADLBOCK && reason == ACTION_COMPLETE_NORMAL)
  5278. {
  5279. Commands->Start_Timer (obj, this, 20.0f, GO_ROADLBOCK);
  5280. }
  5281. }
  5282. void Timer_Expired(GameObject * obj, int timer_id )
  5283. {
  5284. ActionParamsStruct params;
  5285. if(timer_id == GO_ROADLBOCK)
  5286. {
  5287. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_ROADLBOCK);
  5288. params.Set_Movement (Commands->Find_Object(100614), RUN, 5.0f);
  5289. Commands->Action_Goto (obj, params);
  5290. }
  5291. }
  5292. void Killed (GameObject * obj, GameObject * killer)
  5293. {
  5294. Commands->Send_Custom_Event(obj, Commands->Find_Object(100614), M05_ROADBLOCK_REINFORCE, unit_id, 0.0f);
  5295. }
  5296. };
  5297. DECLARE_SCRIPT(M05_Activate_Roadblock_Tank, "")
  5298. {
  5299. bool already_entered;
  5300. enum{EXPLODE_BLOCK};
  5301. // Register variables to be Auto-Saved
  5302. // All variables must have a unique ID, less than 256, that never changes
  5303. REGISTER_VARIABLES()
  5304. {
  5305. SAVE_VARIABLE( already_entered, 1 );
  5306. }
  5307. void Created (GameObject * obj)
  5308. {
  5309. already_entered = false;
  5310. }
  5311. void Entered (GameObject * obj, GameObject * enterer)
  5312. {
  5313. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5314. {
  5315. already_entered = true;
  5316. Commands->Enable_Spawner(100618, true);
  5317. Commands->Start_Timer (obj, this, 1.0f, EXPLODE_BLOCK);
  5318. }
  5319. }
  5320. void Timer_Expired(GameObject * obj, int timer_id )
  5321. {
  5322. ActionParamsStruct params;
  5323. if(timer_id == EXPLODE_BLOCK)
  5324. {
  5325. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(101858)));
  5326. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(Commands->Find_Object(101859)));
  5327. Commands->Destroy_Object(Commands->Find_Object(101858));
  5328. Commands->Destroy_Object(Commands->Find_Object(101859));
  5329. }
  5330. }
  5331. };
  5332. DECLARE_SCRIPT(M05_Building_Debris, "")
  5333. {
  5334. int health;
  5335. bool already_entered;
  5336. // Register variables to be Auto-Saved
  5337. // All variables must have a unique ID, less than 256, that never changes
  5338. REGISTER_VARIABLES()
  5339. {
  5340. SAVE_VARIABLE( health, 1 );
  5341. SAVE_VARIABLE( already_entered, 2 );
  5342. }
  5343. void Created (GameObject * obj)
  5344. {
  5345. health = Commands->Get_Max_Health(obj);
  5346. //Commands->Set_Shield_Type ( obj, "ShieldKevlar" );
  5347. }
  5348. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5349. {
  5350. if(Commands->Get_Player_Type(damager) == SCRIPT_PLAYERTYPE_NOD)
  5351. {
  5352. Commands->Set_Health(obj, health);
  5353. }
  5354. else
  5355. {
  5356. health = Commands->Get_Health(obj);
  5357. }
  5358. }
  5359. void Killed(GameObject * obj, GameObject *killer )
  5360. {
  5361. Commands->Create_Explosion("Ground Explosions Twiddler", Commands->Get_Position(obj));
  5362. GameObject * explode_debris = Commands->Create_Object("M05_X5A_AG_DExplode", Vector3(0,0,0));
  5363. Commands->Attach_Script(explode_debris, "M05_Explode_Debris", "");
  5364. Commands->Destroy_Object(obj);
  5365. }
  5366. };
  5367. DECLARE_SCRIPT(M05_Explode_Debris, "")
  5368. {
  5369. bool already_entered;
  5370. // Register variables to be Auto-Saved
  5371. // All variables must have a unique ID, less than 256, that never changes
  5372. REGISTER_VARIABLES()
  5373. {
  5374. SAVE_VARIABLE( already_entered, 2 );
  5375. }
  5376. void Created (GameObject * obj)
  5377. {
  5378. ActionParamsStruct params;
  5379. // params.Set_Basic(this, 100, 10);
  5380. // params.Set_Animation("X5A_Debris.X5A_Debris_Boom", true);
  5381. // Commands->Action_Play_Animation(obj, params);
  5382. Commands->Set_Animation(obj, "X5A_Debris.X5A_Debris_Boom", false);
  5383. Commands->Start_Timer (obj, this, 1.0f, 10);
  5384. Commands->Create_Sound("Medium Explosion Sound Twiddler", Commands->Get_Position(obj), obj);
  5385. }
  5386. void Timer_Expired(GameObject * obj, int timer_id)
  5387. {
  5388. if(timer_id == 10)
  5389. {
  5390. Commands->Destroy_Object(obj);
  5391. }
  5392. }
  5393. };
  5394. DECLARE_SCRIPT(M05_Flyover_Controller, "")
  5395. {
  5396. int last;
  5397. REGISTER_VARIABLES()
  5398. {
  5399. SAVE_VARIABLE(last, 1);
  5400. }
  5401. void Created(GameObject * obj)
  5402. {
  5403. Commands->Start_Timer(obj, this, 25.0f, 0);
  5404. last = 21;
  5405. }
  5406. void Timer_Expired(GameObject * obj, int timer_id)
  5407. {
  5408. char *flyovers[3] =
  5409. {
  5410. "X5H_Apache_1.txt",
  5411. "X5H_Apache_2.txt",
  5412. "X5H_Apache_3.txt",
  5413. };
  5414. int random = int(Commands->Get_Random(0, 3-WWMATH_EPSILON));
  5415. while (random == last) {
  5416. random = int(Commands->Get_Random(0, 3-WWMATH_EPSILON));
  5417. }
  5418. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  5419. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  5420. Commands->Start_Timer(obj, this, 10.0f, 0);
  5421. last = random;
  5422. }
  5423. };
  5424. DECLARE_SCRIPT(M00_InnateIsStationary, "")
  5425. {
  5426. void Created (GameObject * obj)
  5427. {
  5428. Commands->Set_Innate_Is_Stationary(obj, true);
  5429. }
  5430. };
  5431. DECLARE_SCRIPT(M05_Dead6_Help, "Message_ID=0:int")
  5432. {
  5433. bool already_entered;
  5434. int message_id;
  5435. bool deadeye_freed;
  5436. int mission_failed_text;
  5437. // Register variables to be Auto-Saved
  5438. // All variables must have a unique ID, less than 256, that never changes
  5439. REGISTER_VARIABLES()
  5440. {
  5441. SAVE_VARIABLE( already_entered, 1 );
  5442. SAVE_VARIABLE( deadeye_freed, 2 );
  5443. SAVE_VARIABLE( message_id, 3 );
  5444. }
  5445. void Created (GameObject * obj)
  5446. {
  5447. already_entered = false;
  5448. message_id = Get_Int_Parameter("Message_ID");
  5449. deadeye_freed = false;
  5450. }
  5451. void Entered (GameObject * obj, GameObject * enterer)
  5452. {
  5453. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5454. {
  5455. already_entered = true;
  5456. switch(message_id)
  5457. {
  5458. case 1:
  5459. {
  5460. // Gunner
  5461. if(Commands->Find_Object(100003))
  5462. {
  5463. // I need help! Where's the second insertion team?! Backup needed at the Town Square!\n
  5464. const char *conv_name = ("M05_CON039");
  5465. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5466. Commands->Join_Conversation(NULL, conv_id, false, true);
  5467. Commands->Start_Conversation (conv_id, 100003);
  5468. }
  5469. }
  5470. break;
  5471. case 2:
  5472. {
  5473. // Hotwire
  5474. if(Commands->Find_Object(100002))
  5475. {
  5476. // Hotwire here - I'm losing ground. I need support or my own body bag!\n
  5477. const char *conv_name = ("M05_CON040");
  5478. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5479. Commands->Join_Conversation(NULL, conv_id, false, true);
  5480. Commands->Start_Conversation (conv_id, 100002);
  5481. }
  5482. }
  5483. break;
  5484. case 3:
  5485. {
  5486. // Deadeye
  5487. if(!deadeye_freed)
  5488. {
  5489. // Havoc, this is Deadeye. Nod pressure increasing. Need backup immediately!\n
  5490. const char *conv_name = ("M05_CON041");
  5491. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5492. Commands->Join_Conversation(NULL, conv_id, false, true);
  5493. Commands->Start_Conversation (conv_id, 100650);
  5494. }
  5495. }
  5496. break;
  5497. // Death message, mission failure
  5498. case 4:
  5499. {
  5500. // Hotwire
  5501. if(Commands->Find_Object(100002))
  5502. {
  5503. mission_failed_text = 1;
  5504. // This is Hotwire, I can't hold this position! Requesting - oh great! <gunfire and static>\n
  5505. const char *conv_name = ("M05_CON043");
  5506. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5507. Commands->Join_Conversation(NULL, conv_id, false, true);
  5508. Commands->Start_Conversation (conv_id, 100002);
  5509. Commands->Monitor_Conversation (obj, conv_id);
  5510. }
  5511. // Gunner
  5512. else if(Commands->Find_Object(100003))
  5513. {
  5514. mission_failed_text = 2;
  5515. // This is Gunner, too many Nod reinforcements... <gunfire> <static>\n
  5516. const char *conv_name = ("M05_CON042");
  5517. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5518. Commands->Join_Conversation(NULL, conv_id, false, true);
  5519. Commands->Start_Conversation (conv_id, 100003);
  5520. Commands->Monitor_Conversation (obj, conv_id);
  5521. }
  5522. // Deadeye
  5523. else if(!deadeye_freed)
  5524. {
  5525. mission_failed_text = 3;
  5526. // This is Deadeye, I'm being overrun - <exchanges of gunfire - static>\n
  5527. const char *conv_name = ("M05_CON044");
  5528. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5529. Commands->Join_Conversation(NULL, conv_id, false, true);
  5530. Commands->Start_Conversation (conv_id, 100652);
  5531. Commands->Monitor_Conversation (obj, conv_id);
  5532. }
  5533. }
  5534. break;
  5535. }
  5536. }
  5537. }
  5538. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  5539. {
  5540. if(type == M05_DEADEYE_FREED)
  5541. {
  5542. deadeye_freed = true;
  5543. }
  5544. }
  5545. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5546. {
  5547. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  5548. {
  5549. if(action_id == 100003 || action_id == 100002 || action_id == 100652)
  5550. {
  5551. switch(mission_failed_text)
  5552. {
  5553. case 1:
  5554. {
  5555. // hotwire killed.
  5556. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0174I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5557. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 503, 2, 1.0f);
  5558. }
  5559. break;
  5560. case 2:
  5561. {
  5562. // gunner killed
  5563. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0176I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5564. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 501, 2, 1.0f);
  5565. }
  5566. break;
  5567. case 3:
  5568. {
  5569. // deadeye killed
  5570. Commands->Set_HUD_Help_Text ( IDS_M05DSGN_DSGN0178I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5571. Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), 502, 2, 1.0f);
  5572. }
  5573. break;
  5574. }
  5575. }
  5576. }
  5577. }
  5578. };
  5579. DECLARE_SCRIPT(M05_Hotwire_Conversation, "")
  5580. {
  5581. bool already_entered;
  5582. // Register variables to be Auto-Saved
  5583. // All variables must have a unique ID, less than 256, that never changes
  5584. REGISTER_VARIABLES()
  5585. {
  5586. SAVE_VARIABLE( already_entered, 1 );
  5587. }
  5588. void Created (GameObject * obj)
  5589. {
  5590. already_entered = false;
  5591. }
  5592. void Entered (GameObject * obj, GameObject * enterer)
  5593. {
  5594. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5595. {
  5596. already_entered = true;
  5597. // Havoc? Bust me outta here?\n
  5598. const char *conv_name = ("M05_CON036");
  5599. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  5600. Commands->Join_Conversation(NULL, conv_id, false, true);
  5601. Commands->Join_Conversation(STAR, conv_id, false, true);
  5602. Commands->Start_Conversation (conv_id, 300503);
  5603. Commands->Monitor_Conversation (obj, conv_id);
  5604. }
  5605. }
  5606. };
  5607. DECLARE_SCRIPT(M05_Activate_Surprise, "Spawner_ID1=0:int, Spawner_ID2=0:int, Spawner_ID3=0:int")
  5608. {
  5609. bool already_entered;
  5610. // Register variables to be Auto-Saved
  5611. // All variables must have a unique ID, less than 256, that never changes
  5612. REGISTER_VARIABLES()
  5613. {
  5614. SAVE_VARIABLE( already_entered, 1 );
  5615. }
  5616. void Created (GameObject * obj)
  5617. {
  5618. already_entered = false;
  5619. }
  5620. void Entered (GameObject * obj, GameObject * enterer)
  5621. {
  5622. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5623. {
  5624. already_entered = true;
  5625. int spawner_id1 = Get_Int_Parameter("Spawner_ID1");
  5626. int spawner_id2 = Get_Int_Parameter("Spawner_ID2");
  5627. int spawner_id3 = Get_Int_Parameter("Spawner_ID3");
  5628. if(spawner_id1 != 0)
  5629. {
  5630. Commands->Enable_Spawner(spawner_id1, true);
  5631. }
  5632. if(spawner_id2 != 0)
  5633. {
  5634. Commands->Enable_Spawner(spawner_id2, true);
  5635. }
  5636. if(spawner_id3 != 0)
  5637. {
  5638. Commands->Enable_Spawner(spawner_id3, true);
  5639. }
  5640. }
  5641. }
  5642. };
  5643. DECLARE_SCRIPT(M05_Surprise_Unit, "")
  5644. {
  5645. enum{DIE_SURPRISE};
  5646. // Register variables to be Auto-Saved
  5647. // All variables must have a unique ID, less than 256, that never changes
  5648. REGISTER_VARIABLES()
  5649. {
  5650. // SAVE_VARIABLE( poke_id, 1 );
  5651. }
  5652. void Created (GameObject * obj)
  5653. {
  5654. ActionParamsStruct params;
  5655. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, 1 );
  5656. params.Set_Movement( STAR, RUN, 2.0f );
  5657. Commands->Action_Goto ( obj, params );
  5658. // Commands->Start_Timer (obj, this, 10.0f, DIE_SURPRISE);
  5659. }
  5660. void Timer_Expired(GameObject* obj, int timer_id)
  5661. {
  5662. if(timer_id == DIE_SURPRISE)
  5663. {
  5664. Commands->Apply_Damage( obj, 100000, "STEEL", NULL );
  5665. Vector3 obj_pos = Commands->Get_Position(obj);
  5666. Vector3 shot_pos;
  5667. shot_pos.X = obj_pos.X + 4.0f;
  5668. shot_pos.Y = obj_pos.Y + 4.0f;
  5669. shot_pos.Z = obj_pos.Z + 4.0f;
  5670. Commands->Create_Sound("Sniper_Fire_01", shot_pos, obj);
  5671. }
  5672. }
  5673. };
  5674. DECLARE_SCRIPT(M05_Activate_Artillery, "Artillery_ID1=0:int, Artillery_ID2=0:int, Artillery_ID3=0:int")
  5675. {
  5676. bool already_entered;
  5677. int loop_amnt;
  5678. int loop_count;
  5679. int artillery_sound1;
  5680. int artillery_sound2;
  5681. int artillery_sound3;
  5682. Vector3 artillery_loc1;
  5683. Vector3 artillery_loc2;
  5684. Vector3 artillery_loc3;
  5685. enum{START_ARTILLERY};
  5686. // Register variables to be Auto-Saved
  5687. // All variables must have a unique ID, less than 256, that never changes
  5688. REGISTER_VARIABLES()
  5689. {
  5690. SAVE_VARIABLE( already_entered, 1 );
  5691. SAVE_VARIABLE( loop_amnt, 2 );
  5692. SAVE_VARIABLE( loop_count, 3 );
  5693. SAVE_VARIABLE( artillery_sound1, 4 );
  5694. SAVE_VARIABLE( artillery_sound2, 5 );
  5695. SAVE_VARIABLE( artillery_sound3, 6 );
  5696. SAVE_VARIABLE( artillery_loc1, 7 );
  5697. SAVE_VARIABLE( artillery_loc2, 8 );
  5698. SAVE_VARIABLE( artillery_loc3, 9 );
  5699. }
  5700. void Created (GameObject * obj)
  5701. {
  5702. already_entered = false;
  5703. loop_amnt = 0;
  5704. loop_count = 0;
  5705. artillery_sound1 = 0;
  5706. artillery_sound2 = 0;
  5707. artillery_sound3 = 0;
  5708. }
  5709. void Entered (GameObject * obj, GameObject * enterer)
  5710. {
  5711. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5712. {
  5713. already_entered = true;
  5714. loop_amnt = Commands->Get_Random_Int(2, 4);
  5715. Commands->Start_Timer (obj, this, 1.0f, START_ARTILLERY);
  5716. }
  5717. }
  5718. void Timer_Expired(GameObject * obj, int timer_id )
  5719. {
  5720. if(timer_id == START_ARTILLERY && loop_count < loop_amnt)
  5721. {
  5722. loop_count++;
  5723. int artillery_id1 = Get_Int_Parameter("Artillery_ID1");
  5724. artillery_loc1 = Commands->Get_Position(Commands->Find_Object(artillery_id1));
  5725. int artillery_id2 = Get_Int_Parameter("Artillery_ID2");
  5726. artillery_loc2 = Commands->Get_Position(Commands->Find_Object(artillery_id2));
  5727. int artillery_id3 = Get_Int_Parameter("Artillery_ID3");
  5728. artillery_loc3 = Commands->Get_Position(Commands->Find_Object(artillery_id3));
  5729. char *bomb[3] =
  5730. {
  5731. "Falling_Bomb_01",
  5732. "Falling_Bomb_02",
  5733. "Falling_Bomb_03",
  5734. };
  5735. int random = Commands->Get_Random_Int(0, 2);
  5736. artillery_sound1 = Commands->Create_Sound ( bomb[random], artillery_loc1, obj );
  5737. Commands->Monitor_Sound (obj, artillery_sound1);
  5738. random = Commands->Get_Random_Int(0, 2);
  5739. artillery_sound2 = Commands->Create_Sound ( bomb[random], artillery_loc2, obj );
  5740. Commands->Monitor_Sound (obj, artillery_sound2);
  5741. random = Commands->Get_Random_Int(0, 2);
  5742. artillery_sound3 = Commands->Create_Sound ( bomb[random], artillery_loc3, obj );
  5743. Commands->Monitor_Sound (obj, artillery_sound3);
  5744. float time = Commands->Get_Random(0.5f, 3.0f);
  5745. Commands->Start_Timer (obj, this, time, START_ARTILLERY);
  5746. }
  5747. }
  5748. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  5749. {
  5750. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound1)
  5751. {
  5752. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc1);
  5753. }
  5754. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound2)
  5755. {
  5756. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc2);
  5757. }
  5758. if(type == CUSTOM_EVENT_SOUND_ENDED && param == artillery_sound3)
  5759. {
  5760. Commands->Create_Explosion("Ground Explosions Twiddler", artillery_loc3);
  5761. }
  5762. }
  5763. };
  5764. DECLARE_SCRIPT(M05_Activate_ApacheStrike, "Strike_Loc_ID=0:int")
  5765. {
  5766. bool already_entered;
  5767. // Register variables to be Auto-Saved
  5768. // All variables must have a unique ID, less than 256, that never changes
  5769. REGISTER_VARIABLES()
  5770. {
  5771. SAVE_VARIABLE( already_entered, 1 );
  5772. }
  5773. void Created (GameObject * obj)
  5774. {
  5775. already_entered = false;
  5776. }
  5777. void Entered (GameObject * obj, GameObject * enterer)
  5778. {
  5779. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5780. {
  5781. // already_entered = true;
  5782. int strike_loc_id = Get_Int_Parameter("Strike_Loc_ID");
  5783. GameObject * strike_loc = Commands->Find_Object(strike_loc_id);
  5784. Vector3 pos = Commands->Get_Position(strike_loc);
  5785. float facing = Commands->Get_Facing(strike_loc);
  5786. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", pos);
  5787. Commands->Set_Facing(chinook_obj, facing);
  5788. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X7B_ApacheStk.txt");
  5789. }
  5790. }
  5791. };
  5792. DECLARE_SCRIPT(M05_Activate_Truck_Spill, "")
  5793. {
  5794. bool already_entered;
  5795. // Register variables to be Auto-Saved
  5796. // All variables must have a unique ID, less than 256, that never changes
  5797. REGISTER_VARIABLES()
  5798. {
  5799. SAVE_VARIABLE( already_entered, 1 );
  5800. }
  5801. void Created (GameObject * obj)
  5802. {
  5803. already_entered = false;
  5804. }
  5805. void Entered (GameObject * obj, GameObject * enterer)
  5806. {
  5807. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5808. {
  5809. already_entered = true;
  5810. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  5811. Commands->Set_Facing(chinook_obj, 0.0f);
  5812. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X5E_TibSpill.txt");
  5813. }
  5814. }
  5815. };
  5816. DECLARE_SCRIPT(M05_Activate_Triangle_Tank_Drop, "")
  5817. {
  5818. bool already_entered;
  5819. // Register variables to be Auto-Saved
  5820. // All variables must have a unique ID, less than 256, that never changes
  5821. REGISTER_VARIABLES()
  5822. {
  5823. SAVE_VARIABLE( already_entered, 1 );
  5824. }
  5825. void Created (GameObject * obj)
  5826. {
  5827. already_entered = false;
  5828. }
  5829. void Entered (GameObject * obj, GameObject * enterer)
  5830. {
  5831. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5832. {
  5833. already_entered = true;
  5834. // Drop tank
  5835. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(Commands->Find_Object(108970)));
  5836. Commands->Set_Facing(chinook_obj, -35.000f);
  5837. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "M05_XG_VehicleDrop2.txt");
  5838. }
  5839. }
  5840. };
  5841. DECLARE_SCRIPT(M05_Aggressiveness_Take_Cover, "Aggessiveness=0.0:float, Take_Cover=0.0:float")
  5842. {
  5843. // Register variables to be Auto-Saved
  5844. // All variables must have a unique ID, less than 256, that never changes
  5845. REGISTER_VARIABLES()
  5846. {
  5847. // SAVE_VARIABLE( already_entered, 1 );
  5848. }
  5849. void Created (GameObject * obj)
  5850. {
  5851. float aggressiveness = Get_Float_Parameter("Aggessiveness");
  5852. float take_cover = Get_Float_Parameter("Take_Cover");
  5853. Commands->Set_Innate_Aggressiveness(obj, aggressiveness );
  5854. Commands->Set_Innate_Take_Cover_Probability(obj, take_cover );
  5855. }
  5856. };
  5857. DECLARE_SCRIPT(M05_Activate_Execution, "")
  5858. {
  5859. bool already_entered;
  5860. // Register variables to be Auto-Saved
  5861. // All variables must have a unique ID, less than 256, that never changes
  5862. REGISTER_VARIABLES()
  5863. {
  5864. SAVE_VARIABLE( already_entered, 1 );
  5865. }
  5866. void Created (GameObject * obj)
  5867. {
  5868. already_entered = false;
  5869. }
  5870. void Entered (GameObject * obj, GameObject * enterer)
  5871. {
  5872. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5873. {
  5874. already_entered = true;
  5875. // Execution players
  5876. Commands->Send_Custom_Event(obj, Commands->Find_Object(101239), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5877. Commands->Send_Custom_Event(obj, Commands->Find_Object(101240), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5878. Commands->Send_Custom_Event(obj, Commands->Find_Object(101241), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5879. Commands->Send_Custom_Event(obj, Commands->Find_Object(101242), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5880. Commands->Send_Custom_Event(obj, Commands->Find_Object(101243), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5881. // Civ lead
  5882. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100098), M05_CUSTOM_ACTIVATE, 1, 0.0f);
  5883. }
  5884. }
  5885. };
  5886. DECLARE_SCRIPT(M05_Swap_Artillery, "Artillery_ID=0:int")
  5887. {
  5888. bool swapped;
  5889. // Register variables to be Auto-Saved
  5890. // All variables must have a unique ID, less than 256, that never changes
  5891. REGISTER_VARIABLES()
  5892. {
  5893. SAVE_VARIABLE( swapped, 1 );
  5894. }
  5895. void Created (GameObject * obj)
  5896. {
  5897. swapped = false;
  5898. }
  5899. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5900. {
  5901. if ( type == M05_SWAP_ARTILLERY )
  5902. {
  5903. swapped = true;
  5904. Commands->Destroy_Object(obj);
  5905. Vector3 curr_loc = Commands->Get_Position(obj);
  5906. curr_loc.Z -= 1.0f;
  5907. float facing = Commands->Get_Facing(obj);
  5908. GameObject * new_artillery = Commands->Create_Object("Nod_Mobile_Artillery", curr_loc);
  5909. switch(Get_Int_Parameter("Artillery_ID"))
  5910. {
  5911. case 4:
  5912. {
  5913. Commands->Attach_Script(new_artillery, "M05_Cathedral_Artillery", "100335, 100333");
  5914. }
  5915. break;
  5916. case 5:
  5917. {
  5918. Commands->Attach_Script(new_artillery, "M05_Cathedral_Artillery", "100328, 101327");
  5919. }
  5920. break;
  5921. case 6:
  5922. {
  5923. Commands->Attach_Script(new_artillery, "M05_Cathedral_Artillery", "100333, 100330");
  5924. }
  5925. break;
  5926. }
  5927. Commands->Set_Facing(new_artillery, facing);
  5928. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_CREATED, 1, 0.0f);
  5929. }
  5930. }
  5931. void Destroyed(GameObject * obj)
  5932. {
  5933. if(!swapped)
  5934. {
  5935. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_KILLED, 1, 0.0f);
  5936. }
  5937. }
  5938. void Killed (GameObject * obj, GameObject * killer)
  5939. {
  5940. // Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_KILLED, 1, 0.0f);
  5941. }
  5942. };
  5943. DECLARE_SCRIPT(M05_Cathedral_Artillery, "Fire_Loc1=0:int, Fire_Loc2=0:int")
  5944. {
  5945. int fire_loc[2];
  5946. enum {TANK_TIMER};
  5947. // Register variables to be Auto-Saved
  5948. // All variables must have a unique ID, less than 256, that never changes
  5949. REGISTER_VARIABLES()
  5950. {
  5951. SAVE_VARIABLE( fire_loc[0], 1 );
  5952. SAVE_VARIABLE( fire_loc[1], 1 );
  5953. // SAVE_VARIABLE( already_entered, 1 );
  5954. }
  5955. void Created (GameObject * obj)
  5956. {
  5957. ActionParamsStruct params;
  5958. fire_loc[0] = Get_Int_Parameter("Fire_Loc1");
  5959. fire_loc[1] = Get_Int_Parameter("Fire_Loc2");
  5960. // Fire upon cathedral
  5961. Commands->Start_Timer (obj, this, 1.0f, TANK_TIMER);
  5962. }
  5963. void Timer_Expired(GameObject * obj, int timer_id )
  5964. {
  5965. ActionParamsStruct params;
  5966. if(timer_id == TANK_TIMER)
  5967. {
  5968. ActionParamsStruct params;
  5969. int random = Commands->Get_Random_Int(0,ARRAY_ELEMENT_COUNT(fire_loc));
  5970. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
  5971. params.Set_Attack (Commands->Find_Object(fire_loc[random]), 250.0f, 0.0f, 1);
  5972. params.AttackCheckBlocked = false;
  5973. Commands->Action_Attack( obj, params );
  5974. // Fire upon building
  5975. Commands->Start_Timer (obj, this, 5.0f, TANK_TIMER);
  5976. }
  5977. }
  5978. void Killed (GameObject * obj, GameObject * killer)
  5979. {
  5980. Commands->Send_Custom_Event(obj, Commands->Find_Object(100287), M05_CATHEDRAL_VEHICLE_KILLED, 1, 0.0f);
  5981. }
  5982. };
  5983. DECLARE_SCRIPT(M05_X5N_MIDTRO_B, "")
  5984. {
  5985. bool already_entered;
  5986. // Register variables to be Auto-Saved
  5987. // All variables must have a unique ID, less than 256, that never changes
  5988. REGISTER_VARIABLES()
  5989. {
  5990. SAVE_VARIABLE( already_entered, 1 );
  5991. }
  5992. void Created (GameObject * obj)
  5993. {
  5994. already_entered = false;
  5995. }
  5996. void Entered (GameObject * obj, GameObject * enterer)
  5997. {
  5998. if ((Commands->Is_A_Star(enterer)) && (!already_entered))
  5999. {
  6000. already_entered = true;
  6001. Commands->Send_Custom_Event(obj, Commands->Find_Object(100002), M05_DESTROY_OBJECT, 0, 0.0f);
  6002. Vector3 havoc_loc = Commands->Get_Position (STAR);
  6003. havoc_loc.Z += 7.0f;
  6004. Commands->Set_Position (STAR, havoc_loc );
  6005. GameObject * cinematic_obj = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
  6006. Commands->Attach_Script(cinematic_obj, "Test_Cinematic", "X5N_MIDTRO_B.txt");
  6007. }
  6008. }
  6009. };
  6010. DECLARE_SCRIPT(M05_Barrel_Explosion, "")
  6011. {
  6012. // Register variables to be Auto-Saved
  6013. // All variables must have a unique ID, less than 256, that never changes
  6014. REGISTER_VARIABLES()
  6015. {
  6016. // SAVE_VARIABLE( poke_id, 1 );
  6017. }
  6018. void Destroyed(GameObject * obj)
  6019. {
  6020. Vector3 myPosition = Commands->Get_Position ( obj );
  6021. Commands->Create_Explosion ( "Explosion_Barrel_Toxic", myPosition, NULL );
  6022. }
  6023. /* void Killed (GameObject * obj, GameObject * killer)
  6024. {
  6025. Vector3 myPosition = Commands->Get_Position ( obj );
  6026. Commands->Create_Explosion ( "Explosion_Barrel_Toxic", myPosition, NULL );
  6027. }*/
  6028. };
  6029. DECLARE_SCRIPT(M05_APC_Deploy, "Preset:string, Soldier_Qty=0:int, Fire_Gun=1:int")
  6030. {
  6031. bool attacking;
  6032. bool fire_gun;
  6033. enum{DEPLOY_SOLDIER1, DEPLOY_SOLDIER2, DEPLOY_SOLDIER3};
  6034. // Register variables to be Auto-Saved
  6035. // All variables must have a unique ID, less than 256, that never changes
  6036. REGISTER_VARIABLES()
  6037. {
  6038. SAVE_VARIABLE( attacking, 1 );
  6039. SAVE_VARIABLE( fire_gun, 2 );
  6040. }
  6041. void Created (GameObject * obj)
  6042. {
  6043. Commands->Enable_Enemy_Seen( obj, true);
  6044. attacking = false;
  6045. fire_gun = (Get_Int_Parameter("Fire_Gun")) ? true : false;
  6046. }
  6047. void Deploy_Soldiers(GameObject * obj)
  6048. {
  6049. Commands->Set_Animation(obj, "V_NOD_APC.V_NOD_APC", 0);
  6050. int soldier_qty = Get_Int_Parameter("Soldier_Qty");
  6051. if(soldier_qty > 0)
  6052. {
  6053. Commands->Start_Timer (obj, this, 50.0f/30.0f, DEPLOY_SOLDIER1);
  6054. }
  6055. if(soldier_qty > 1)
  6056. {
  6057. Commands->Start_Timer (obj, this, 70.0f/30.0f, DEPLOY_SOLDIER2);
  6058. }
  6059. if(soldier_qty > 2)
  6060. {
  6061. Commands->Start_Timer (obj, this, 97.0f/30.0f, DEPLOY_SOLDIER3);
  6062. }
  6063. }
  6064. void Enemy_Seen(GameObject * obj, GameObject *enemy )
  6065. {
  6066. ActionParamsStruct params;
  6067. if((enemy == STAR) && (!attacking))
  6068. {
  6069. attacking = true;
  6070. Deploy_Soldiers(obj);
  6071. }
  6072. if(fire_gun)
  6073. {
  6074. params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
  6075. params.Set_Attack (enemy, 250.0f, 0.0f, 1);
  6076. params.AttackCheckBlocked = false;
  6077. Commands->Action_Attack( obj, params );
  6078. }
  6079. }
  6080. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6081. {
  6082. if((damager == STAR) && (!attacking))
  6083. {
  6084. attacking = true;
  6085. Deploy_Soldiers(obj);
  6086. }
  6087. }
  6088. void Timer_Expired(GameObject * obj, int timer_id )
  6089. {
  6090. char param1[10];
  6091. sprintf(param1, "%d", Commands->Get_ID(obj));
  6092. const char * preset = Get_Parameter("Preset");
  6093. if(timer_id == DEPLOY_SOLDIER1)
  6094. {
  6095. GameObject * soldier = Commands->Create_Object_At_Bone(obj, preset, "BN_Troop_01");
  6096. Commands->Attach_To_Object_Bone(soldier, obj, "BN_Troop_01");
  6097. Commands->Attach_Script(soldier, "M05_APC_Deploy_Soldier", param1);
  6098. }
  6099. if(timer_id == DEPLOY_SOLDIER2)
  6100. {
  6101. GameObject * soldier = Commands->Create_Object_At_Bone(obj, preset, "BN_Troop_02");
  6102. Commands->Attach_To_Object_Bone(soldier, obj, "BN_Troop_02");
  6103. Commands->Attach_Script(soldier, "M05_APC_Deploy_Soldier", param1);
  6104. }
  6105. if(timer_id == DEPLOY_SOLDIER3)
  6106. {
  6107. GameObject * soldier = Commands->Create_Object_At_Bone(obj, preset, "BN_Troop_03");
  6108. Commands->Attach_To_Object_Bone(soldier, obj, "BN_Troop_03");
  6109. Commands->Attach_Script(soldier, "M05_APC_Deploy_Soldier", param1);
  6110. }
  6111. }
  6112. };
  6113. DECLARE_SCRIPT(M05_APC_Deploy_Soldier, "APC_ID=0:int")
  6114. {
  6115. enum{GO_STAR, CLEAR_APC};
  6116. void Created (GameObject * obj)
  6117. {
  6118. Commands->Set_Animation(obj, "S_A_Human.H_A_XG_NAPC_OUT", 0);
  6119. Commands->Enable_Hibernation (obj, false);
  6120. }
  6121. void Animation_Complete(GameObject * obj, const char *anim)
  6122. {
  6123. if (stricmp(anim, "S_A_Human.H_A_XG_NAPC_OUT") == 0)
  6124. {
  6125. GameObject * apc = Commands->Find_Object(Get_Int_Parameter("APC_ID"));
  6126. Commands->Attach_To_Object_Bone(obj, NULL, NULL);
  6127. Vector3 pos = Commands->Get_Position(apc);
  6128. float facing = Commands->Get_Facing(apc);
  6129. float a = cos(DEG_TO_RADF(facing)) * Commands->Get_Random(-8.0f, -10.0f);
  6130. float b = sin(DEG_TO_RADF(facing)) * Commands->Get_Random(-8.0f, -10.0f);
  6131. Vector3 soldier_loc = pos + Vector3(a, b, 0.0f);
  6132. ActionParamsStruct params;
  6133. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), CLEAR_APC);
  6134. params.Set_Movement (soldier_loc, RUN, 1.5f);
  6135. Commands->Action_Goto (obj, params);
  6136. }
  6137. }
  6138. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  6139. {
  6140. if (action_id == CLEAR_APC)
  6141. {
  6142. Commands->Enable_Hibernation (obj, true);
  6143. ActionParamsStruct params;
  6144. params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN - 5), GO_STAR);
  6145. params.Set_Movement (STAR, RUN, 10.0f);
  6146. Commands->Action_Goto (obj, params);
  6147. }
  6148. }
  6149. };
  6150. DECLARE_SCRIPT(M05_Inn_APC, "")
  6151. {
  6152. int reinforcement;
  6153. bool paradrop;
  6154. // Register variables to be Auto-Saved
  6155. // All variables must have a unique ID, less than 256, that never changes
  6156. REGISTER_VARIABLES()
  6157. {
  6158. SAVE_VARIABLE( reinforcement, 1 );
  6159. SAVE_VARIABLE( paradrop, 2 );
  6160. }
  6161. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  6162. {
  6163. if(type == M05_REINFORCEMENT_KILLED)
  6164. {
  6165. reinforcement++;
  6166. if((reinforcement%2 == 0) && (reinforcement < 3))
  6167. {
  6168. }
  6169. else if (reinforcement%2 == 0)
  6170. {
  6171. if(obj == Commands->Find_Object(100247))
  6172. {
  6173. paradrop = true;
  6174. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 1, 0.0f);
  6175. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 1, 0.5f);
  6176. }
  6177. else
  6178. {
  6179. paradrop = true;
  6180. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 2, 0.0f);
  6181. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 2, 0.5f);
  6182. }
  6183. }
  6184. }
  6185. }
  6186. void Killed (GameObject * obj, GameObject * killer)
  6187. {
  6188. if((obj == Commands->Find_Object(100247)) && (!paradrop))
  6189. {
  6190. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 1, 0.0f);
  6191. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 1, 0.5f);
  6192. }
  6193. else if (!paradrop)
  6194. {
  6195. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 2, 0.0f);
  6196. Commands->Send_Custom_Event(obj, Commands->Find_Object(100244), M05_INN_REINFORCE, 2, 0.5f);
  6197. }
  6198. }
  6199. };
  6200. #define RESISTANCE_CONV_TABLE_SIZE ( sizeof(Resistance_Conv_Table) / sizeof (Resistance_Conv_Table[0]) )
  6201. const char * Resistance_Conv_Table[] =
  6202. {
  6203. "M05_CON044",
  6204. "M05_CON045",
  6205. "M05_CON046",
  6206. "M05_CON047",
  6207. "M05_CON048",
  6208. "M05_CON049",
  6209. "M05_CON050",
  6210. "M05_CON051",
  6211. "M05_CON052",
  6212. "M05_CON053",
  6213. "M05_CON054",
  6214. "M05_CON055", //GCF1 11
  6215. "M05_CON056",
  6216. "M05_CON057",
  6217. "M05_CON058",
  6218. "M05_CON059",
  6219. "M05_CON060",
  6220. "M05_CON061",
  6221. "M05_CON062",
  6222. "M05_CON063",
  6223. "M05_CON064",
  6224. "M05_CON065", //GCM1 21
  6225. "M05_CON066",
  6226. "M05_CON067",
  6227. "M05_CON068",
  6228. "M05_CON069",
  6229. "M05_CON070",
  6230. "M05_CON071",
  6231. "M05_CON072",
  6232. "M05_CON073",
  6233. "M05_CON074",
  6234. "M05_CON075",
  6235. "M05_CON076",
  6236. "M05_CON077",
  6237. "M05_CON078",
  6238. "M05_CON079",
  6239. "M05_CON080" //GCM2 36
  6240. };
  6241. DECLARE_SCRIPT(M05_Resistance_Poke_Conversation, "")
  6242. {
  6243. int random;
  6244. int last;
  6245. bool conversation;
  6246. enum{CONVERSATION};
  6247. // Register variables to be Auto-Saved
  6248. // All variables must have a unique ID, less than 256, that never changes
  6249. REGISTER_VARIABLES()
  6250. {
  6251. SAVE_VARIABLE( random, 1 );
  6252. SAVE_VARIABLE( last, 2 );
  6253. SAVE_VARIABLE( conversation, 3 );
  6254. }
  6255. void Created (GameObject * obj)
  6256. {
  6257. random = Commands->Get_Random_Int(0, RESISTANCE_CONV_TABLE_SIZE);
  6258. conversation = false;
  6259. }
  6260. void Poked(GameObject * obj, GameObject * poker)
  6261. {
  6262. if(conversation)
  6263. {
  6264. return;
  6265. }
  6266. conversation = true;
  6267. const char * preset_name = Commands->Get_Preset_Name( obj );
  6268. int min = 0;
  6269. int max = 0;
  6270. if((::strncmp( "Civ_Resist_Female_v0a", preset_name, ::strlen( "Civ_Resist_Female_v0a" ) ) == 0 ) ||
  6271. (::strncmp( "Civ_Resist_Female_v0b", preset_name, ::strlen( "Civ_Resist_Female_v0b" ) ) == 0 ) ||
  6272. (::strncmp( "Civ_Resist_Female_v0c", preset_name, ::strlen( "Civ_Resist_Female_v0c" ) ) == 0 ) ||
  6273. (::strncmp( "Civ_Resist_Female_v0d", preset_name, ::strlen( "Civ_Resist_Female_v0d" ) ) == 0 ))
  6274. {
  6275. min = 0;
  6276. max = 11;
  6277. }
  6278. if((::strncmp( "Civ_Resist_Male_v0a", preset_name, ::strlen( "Civ_Resist_Male_v0a" ) ) == 0 ) ||
  6279. (::strncmp( "Civ_Resist_Male_v0b", preset_name, ::strlen( "Civ_Resist_Male_v0b" ) ) == 0 ) ||
  6280. (::strncmp( "Civ_Resist_Male_v0c", preset_name, ::strlen( "Civ_Resist_Male_v0c" ) ) == 0 ) ||
  6281. (::strncmp( "Civ_Resist_Male_v0d", preset_name, ::strlen( "Civ_Resist_Male_v0d" ) ) == 0 ))
  6282. {
  6283. min = 12;
  6284. max = 21;
  6285. }
  6286. if((::strncmp( "Civ_Resist_Male_v1a", preset_name, ::strlen( "Civ_Resist_Male_v1a" ) ) == 0 ) ||
  6287. (::strncmp( "Civ_Resist_Male_v1b", preset_name, ::strlen( "Civ_Resist_Male_v1b" ) ) == 0 ) ||
  6288. (::strncmp( "Civ_Resist_Male_v1c", preset_name, ::strlen( "Civ_Resist_Male_v1c" ) ) == 0 ) ||
  6289. (::strncmp( "Civ_Resist_Male_v1d", preset_name, ::strlen( "Civ_Resist_Male_v1d" ) ) == 0 ))
  6290. {
  6291. min = 22;
  6292. max = 36;
  6293. }
  6294. Play_Conversation(obj, min, max);
  6295. }
  6296. int Index(int Min, int Max)
  6297. {
  6298. while(random == last || random < Min || random > Max)
  6299. {
  6300. random = Commands->Get_Random_Int(0, RESISTANCE_CONV_TABLE_SIZE);
  6301. }
  6302. last = random;
  6303. return last;
  6304. }
  6305. void Play_Conversation(GameObject * obj, int Min, int Max)
  6306. {
  6307. const char *conv_name = Resistance_Conv_Table[Index(Min, Max)];
  6308. int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
  6309. Commands->Join_Conversation(obj, conv_id, false, true);
  6310. Commands->Start_Conversation (conv_id, 0);
  6311. }
  6312. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  6313. {
  6314. if(reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  6315. {
  6316. conversation = false;
  6317. }
  6318. }
  6319. };
  6320. DECLARE_SCRIPT(M05_DataDisc_01_DLS, "")//
  6321. {
  6322. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6323. {
  6324. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  6325. {
  6326. // Reveal Raveshaw
  6327. bool reveal = Commands->Reveal_Encyclopedia_Character( 42 );
  6328. if ( reveal == 1 )
  6329. {
  6330. Commands->Display_Encyclopedia_Event_UI();
  6331. }
  6332. }
  6333. }
  6334. };