Mission04.cpp 327 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518
  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. * Mission04.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 4 scripts
  25. *
  26. * PROGRAMMER
  27. * Design Team
  28. *
  29. * VERSION INFO
  30. * $Author: Joe_g $
  31. * $Revision: 122 $
  32. * $Modtime: 2/12/02 10:10a $
  33. * $Archive: /Commando/Code/Scripts/Mission04.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include <string.h>
  38. #include "toolkit.h"
  39. #include "mission1.h"
  40. #include "mission11.h"
  41. DECLARE_SCRIPT(M04_Objective_Controller_JDG, "")//this guys ID number is M04_OBJECTIVE_CONTROLLER_JDG 100424
  42. {
  43. int missile_01_sabotaged;
  44. int missile_02_sabotaged;
  45. int missile_03_sabotaged;
  46. int missile_04_sabotaged;
  47. int number_missiles_sabotaged;
  48. bool missile_primary_active;
  49. int torpedo_01_sabotaged;
  50. int torpedo_02_sabotaged;
  51. int number_torpedos_sabotaged;
  52. bool torpedo_primary_active;
  53. int engine_room_01_sabotaged;
  54. int engine_room_02_sabotaged;
  55. int engine_room_03_sabotaged;
  56. int engine_room_04_sabotaged;
  57. int number_engines_sabotaged;
  58. int announce_prisoner_objective;
  59. bool prisoner_primary_active;
  60. int announce_first_mate_objective;
  61. bool first_mate_primary_active;
  62. int announce_captain_objective;
  63. bool captain_primary_active;
  64. int announce_engine_room_objective;
  65. int announce_missile_room_objective;
  66. int announce_torpedo_room_objective;
  67. int announce_apache_objective;
  68. int announce_get_back_to_sub;
  69. int completed_prisoner_rescue;
  70. int completed_first_mate_objective;
  71. int completed_captain_objective;
  72. int completed_engine_room_objective;
  73. int completed_missile_room_objective;
  74. int completed_torpedo_room_objective;
  75. int completed_apache_objective;
  76. bool mission_started;
  77. int attach_havocs_script;
  78. int announce_prison_guard_objective;
  79. //int tell_where_guard_is;
  80. int completed_get_the_key;
  81. //new stuff
  82. int protectPOWsConv;
  83. int missionIntroConv;
  84. int missileConv;
  85. int engineIntroConv;
  86. int prisonKeyIntroConv;
  87. int medlab_conv;
  88. int firstmateConv;
  89. bool first_mate_primary_triggered;
  90. REGISTER_VARIABLES()
  91. {
  92. SAVE_VARIABLE( missile_01_sabotaged, 1 );
  93. SAVE_VARIABLE( missile_02_sabotaged, 2 );
  94. SAVE_VARIABLE( missile_03_sabotaged, 3 );
  95. SAVE_VARIABLE( missile_04_sabotaged, 4 );
  96. SAVE_VARIABLE( number_missiles_sabotaged, 5 );
  97. SAVE_VARIABLE( missile_primary_active, 6 );
  98. SAVE_VARIABLE( torpedo_01_sabotaged, 7 );
  99. SAVE_VARIABLE( torpedo_02_sabotaged, 8 );
  100. SAVE_VARIABLE( number_torpedos_sabotaged, 9 );
  101. SAVE_VARIABLE( torpedo_primary_active, 10 );
  102. SAVE_VARIABLE( engine_room_01_sabotaged, 11 );
  103. SAVE_VARIABLE( engine_room_02_sabotaged, 12 );
  104. SAVE_VARIABLE( engine_room_03_sabotaged, 13 );
  105. SAVE_VARIABLE( engine_room_04_sabotaged, 14 );
  106. SAVE_VARIABLE( number_engines_sabotaged, 15 );
  107. SAVE_VARIABLE( announce_prisoner_objective, 16 );
  108. SAVE_VARIABLE( prisoner_primary_active, 17 );
  109. SAVE_VARIABLE( announce_first_mate_objective, 18 );
  110. SAVE_VARIABLE( first_mate_primary_active, 19 );
  111. SAVE_VARIABLE( announce_captain_objective, 20 );
  112. SAVE_VARIABLE( captain_primary_active, 21 );
  113. SAVE_VARIABLE( announce_engine_room_objective, 22 );
  114. SAVE_VARIABLE( announce_missile_room_objective, 23 );
  115. SAVE_VARIABLE( announce_torpedo_room_objective, 24 );
  116. SAVE_VARIABLE( announce_apache_objective, 25 );
  117. SAVE_VARIABLE( announce_get_back_to_sub, 26 );
  118. SAVE_VARIABLE( completed_prisoner_rescue, 27 );
  119. SAVE_VARIABLE( completed_first_mate_objective, 28 );
  120. SAVE_VARIABLE( completed_captain_objective, 29 );
  121. SAVE_VARIABLE( completed_engine_room_objective, 30 );
  122. SAVE_VARIABLE( completed_missile_room_objective, 31 );
  123. SAVE_VARIABLE( completed_torpedo_room_objective, 32 );
  124. SAVE_VARIABLE( completed_apache_objective, 33 );
  125. SAVE_VARIABLE( mission_started, 34 );
  126. SAVE_VARIABLE( attach_havocs_script, 35 );
  127. SAVE_VARIABLE( announce_prison_guard_objective, 36 );
  128. SAVE_VARIABLE( firstmateConv, 37 );
  129. SAVE_VARIABLE( completed_get_the_key, 38 );
  130. SAVE_VARIABLE( protectPOWsConv, 39 );//
  131. SAVE_VARIABLE( missionIntroConv, 40 );
  132. SAVE_VARIABLE( missileConv, 41 );
  133. SAVE_VARIABLE( engineIntroConv, 42 );
  134. SAVE_VARIABLE( prisonKeyIntroConv, 43 );
  135. SAVE_VARIABLE( medlab_conv, 44 );
  136. SAVE_VARIABLE( firstmateConv, 45 );
  137. SAVE_VARIABLE( first_mate_primary_triggered, 46 );
  138. }
  139. void Created( GameObject * obj )
  140. {
  141. /**********************************************************************************************************
  142. The following are the custom parameter number values used to control objectives in mission 04
  143. ***********************************************************************************************************/
  144. missile_01_sabotaged = 100;
  145. missile_02_sabotaged = 110;
  146. missile_03_sabotaged = 120;
  147. missile_04_sabotaged = 130;
  148. number_missiles_sabotaged = 0;
  149. missile_primary_active = false;
  150. torpedo_01_sabotaged = 200;
  151. torpedo_02_sabotaged = 210;
  152. number_torpedos_sabotaged = 0;
  153. torpedo_primary_active = false;
  154. engine_room_01_sabotaged = 300;
  155. engine_room_02_sabotaged = 310;
  156. engine_room_03_sabotaged = 320;
  157. engine_room_04_sabotaged = 330;
  158. number_engines_sabotaged = 0;
  159. announce_prisoner_objective = 400;
  160. announce_prison_guard_objective = 401;
  161. //tell_where_guard_is = 402;
  162. prisoner_primary_active = false;
  163. announce_first_mate_objective = 410;
  164. first_mate_primary_active = false;
  165. first_mate_primary_triggered = false;
  166. announce_captain_objective = 420;
  167. captain_primary_active = false;
  168. announce_engine_room_objective = 430;
  169. announce_missile_room_objective = 440;
  170. announce_torpedo_room_objective = 450;
  171. announce_apache_objective = 460;
  172. announce_get_back_to_sub = 470;
  173. completed_prisoner_rescue = 500;
  174. completed_first_mate_objective = 510;
  175. completed_captain_objective = 520;
  176. completed_engine_room_objective = 530;
  177. completed_missile_room_objective = 540;
  178. completed_torpedo_room_objective = 550;
  179. completed_apache_objective = 560;
  180. completed_get_the_key = 590;
  181. mission_started = false;
  182. attach_havocs_script = 600;
  183. Commands->Send_Custom_Event( obj, obj, 0, announce_prisoner_objective, 3 );
  184. }
  185. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  186. {
  187. switch (complete_reason)
  188. {
  189. case ACTION_COMPLETE_CONVERSATION_ENDED: //
  190. {
  191. if (action_id == missionIntroConv) //rescue prisoners here
  192. {
  193. Commands->Debug_Message ( "**********************mission start conversation over--sending custom\n" );
  194. Commands->Send_Custom_Event( obj, obj, 0, 1, 0 );
  195. Commands->Add_Objective( 100, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_01, NULL, IDS_Enc_Obj_Primary_M04_01 );
  196. Commands->Add_Radar_Marker ( 101, Commands->Get_Position( Commands->Find_Object ( M04_PRISON_PRISONER_01_JDG )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  197. Commands->Add_Radar_Marker ( 102, Commands->Get_Position( Commands->Find_Object ( M04_PRISON_PRISONER_02_JDG )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  198. Commands->Add_Radar_Marker ( 103, Commands->Get_Position( Commands->Find_Object ( M04_PRISON_PRISONER_03_JDG )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  199. Vector3 prisoner01_position = Commands->Get_Position ( Commands->Find_Object ( M04_PRISON_PRISONER_01_JDG ) );
  200. Commands->Set_Objective_HUD_Info_Position( 100, 90, "POG_M04_1_01.tga", IDS_POG_RESCUE, prisoner01_position );
  201. }
  202. else if (action_id == missileConv) //sabotage missile racks M04_Add_MissileRoom_Objective_Conversation_02
  203. {
  204. //Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );
  205. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  206. Commands->Add_Objective( 300, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_03, NULL, IDS_Enc_Obj_Primary_M04_03 );
  207. GameObject * missile_target01 = Commands->Find_Object ( 100421 );
  208. GameObject * missile_target02 = Commands->Find_Object ( 100422 );
  209. GameObject * missile_target03 = Commands->Find_Object ( 100423 );
  210. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  211. if (missile_target01 != NULL)
  212. {
  213. Commands->Send_Custom_Event( obj, missile_target01, 0, M01_START_ACTING_JDG, 0 );
  214. }
  215. if (missile_target02 != NULL)
  216. {
  217. Commands->Send_Custom_Event( obj, missile_target02, 0, M01_START_ACTING_JDG, 0 );
  218. }
  219. if (missile_target03 != NULL)
  220. {
  221. Commands->Send_Custom_Event( obj, missile_target03, 0, M01_START_ACTING_JDG, 0 );
  222. }
  223. if (missile_target04 != NULL)
  224. {
  225. Commands->Send_Custom_Event( obj, missile_target04, 0, M01_START_ACTING_JDG, 0 );
  226. }
  227. /*int missileConv02 = Commands->Create_Conversation( "M04_Add_MissileRoom_Objective_Conversation_02", 100, 1000, false);
  228. Commands->Join_Conversation( NULL, missileConv02, false, false );
  229. Commands->Start_Conversation( missileConv02, missileConv02 );*/
  230. GameObject * pogController = Commands->Find_Object ( 104693 );
  231. if (pogController != NULL)
  232. {
  233. Commands->Send_Custom_Event( obj, pogController, M01_ADD_OBJECTIVE_POG_JDG, 300, 0 );
  234. }
  235. }
  236. else if (action_id == engineIntroConv) //destroy engine terminals
  237. {
  238. //Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );
  239. Commands->Add_Objective( 200, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M04_02, NULL, IDS_Enc_Obj_Secondary_M04_02 );
  240. GameObject * pogController = Commands->Find_Object ( 104693 );
  241. if (pogController != NULL)
  242. {
  243. Commands->Send_Custom_Event( obj, pogController, M01_ADD_OBJECTIVE_POG_JDG, 200, 0 );
  244. }
  245. GameObject * target01 = Commands->Find_Object ( M04_ENGINEROOM_TARGET_01_JDG );
  246. GameObject * target02 = Commands->Find_Object ( M04_ENGINEROOM_TARGET_02_JDG );
  247. GameObject * target03 = Commands->Find_Object ( M04_ENGINEROOM_TARGET_03_JDG );
  248. GameObject * target04 = Commands->Find_Object ( M04_ENGINEROOM_TARGET_04_JDG );
  249. if (target01 != NULL)
  250. {
  251. Commands->Set_Obj_Radar_Blip_Shape ( target01, RADAR_BLIP_SHAPE_OBJECTIVE );
  252. Commands->Set_Obj_Radar_Blip_Color ( target01, RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE );
  253. }
  254. if (target02 != NULL)
  255. {
  256. Commands->Set_Obj_Radar_Blip_Shape ( target02, RADAR_BLIP_SHAPE_OBJECTIVE );
  257. Commands->Set_Obj_Radar_Blip_Color ( target02, RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE );
  258. }
  259. if (target03 != NULL)
  260. {
  261. Commands->Set_Obj_Radar_Blip_Shape ( target03, RADAR_BLIP_SHAPE_OBJECTIVE );
  262. Commands->Set_Obj_Radar_Blip_Color ( target03, RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE );
  263. }
  264. if (target04 != NULL)
  265. {
  266. Commands->Set_Obj_Radar_Blip_Shape ( target04, RADAR_BLIP_SHAPE_OBJECTIVE );
  267. Commands->Set_Obj_Radar_Blip_Color ( target04, RADAR_BLIP_COLOR_SECONDARY_OBJECTIVE );
  268. }
  269. }
  270. else if (action_id == prisonKeyIntroConv) //get prison key from guard
  271. {
  272. Commands->Add_Objective( 110, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_02, NULL, IDS_Enc_Obj_Primary_M04_02 );
  273. medlab_conv = Commands->Create_Conversation( "M04_Eva_Tells_Where_Guard_Is", 100, 100, false);
  274. Commands->Join_Conversation( NULL, medlab_conv, false, true );
  275. Commands->Start_Conversation( medlab_conv, medlab_conv );
  276. Commands->Monitor_Conversation (obj, medlab_conv);
  277. }
  278. else if (action_id == medlab_conv) //get prison key from guard
  279. {
  280. GameObject * warden = Commands->Find_Object ( M04_PRISON_WARDEN_JDG );
  281. if (warden != NULL)
  282. {
  283. Vector3 wardenLocation = Commands->Get_Position(warden );
  284. Commands->Add_Radar_Marker ( 111, wardenLocation, RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  285. Commands->Set_Objective_HUD_Info_Position( 110, 92, "POG_M04_1_02.tga", IDS_POG_ACQUIRE, wardenLocation );
  286. }//
  287. }
  288. else if (action_id == firstmateConv) //get level 2 key from first mate protectPOWsConv
  289. {
  290. Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  291. Commands->Add_Objective( 600, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_07, NULL, IDS_Enc_Obj_Primary_M04_07 );
  292. Commands->Add_Radar_Marker ( 601, Commands->Get_Position( Commands->Find_Object ( M04_SHIPS_FIRST_MATE_JDG )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  293. Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );//this sets a small delay before havoc responds
  294. GameObject * firstmate = Commands->Find_Object ( M04_SHIPS_FIRST_MATE_JDG );
  295. if (firstmate != NULL)
  296. {
  297. Vector3 firstmateLocation = Commands->Get_Position(firstmate);
  298. Commands->Set_Objective_HUD_Info_Position( 600, 93, "POG_M04_1_07.tga", IDS_POG_ACQUIRE, firstmateLocation );
  299. }
  300. }
  301. else if (action_id == protectPOWsConv) //give protect prisoner objective
  302. {
  303. Commands->Add_Objective( 800, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_06, NULL, IDS_Enc_Obj_Primary_M04_06 );
  304. Commands->Add_Radar_Marker ( 801, Vector3 (2.55f, -5.29f, -16.96f), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  305. Vector3 subLocation (-0.401f, 3.878f, -8.850f);
  306. Commands->Set_Objective_HUD_Info_Position( 800, 99, "POG_M04_1_06.tga", IDS_POG_PROTECT, subLocation );
  307. }
  308. }
  309. break;
  310. }
  311. }
  312. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  313. {
  314. /**********************************************************************************************************
  315. The following are params for when the individual objectives are activated and announced
  316. ***********************************************************************************************************/
  317. if (type == 0)
  318. {
  319. if (param == 1)//this will play a twiddler of Havoc accepting the objective
  320. {
  321. Commands->Debug_Message ( "**********************controller should be playing havoc affirmative twiddler now\n" );
  322. Vector3 playerPosition = Commands->Get_Position (STAR);
  323. Commands->Create_Sound ( "M04_Havoc_Affirmative_Twiddler", playerPosition, obj);
  324. }
  325. else if (param == 2)//this will play a twiddler of Havoc having finished the objective
  326. {
  327. //Commands->Create_Sound ( "Havoc Finished Objective Twiddler", Vector3 (0,0,0), obj);
  328. }
  329. else if (param == announce_prisoner_objective)
  330. {
  331. Commands->Debug_Message ( "**********************starting mission start conversation\n" );
  332. missionIntroConv = Commands->Create_Conversation( "M04_Mission_Start_Conversation", 100, 1000, false);
  333. Commands->Join_Conversation( NULL, missionIntroConv, false, false );
  334. ///Commands->Join_Conversation( STAR, missionIntroConv, false, false );
  335. Commands->Start_Conversation( missionIntroConv, missionIntroConv );
  336. Commands->Monitor_Conversation (obj, missionIntroConv);
  337. prisoner_primary_active = true;
  338. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  339. //Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );//this sets a small delay before havoc responds
  340. mission_started = true;
  341. //Commands->Send_Custom_Event( obj, obj, 0, attach_havocs_script, 0 );
  342. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  343. if (objectiveReminder != NULL)
  344. {
  345. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 0, 0 );
  346. }
  347. }
  348. else if (param == announce_prison_guard_objective)
  349. {
  350. prisonKeyIntroConv = Commands->Create_Conversation( "M04_Add_PrisonKey_Objective", 100, 1000, false);
  351. Commands->Join_Conversation( NULL, prisonKeyIntroConv, false, false );
  352. Commands->Start_Conversation( prisonKeyIntroConv, prisonKeyIntroConv );
  353. Commands->Monitor_Conversation (obj, prisonKeyIntroConv);
  354. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  355. if (objectiveReminder != NULL)
  356. {
  357. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 2, 0 );
  358. }
  359. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  360. Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );//this sets a small delay before havoc responds
  361. //Commands->Send_Custom_Event( obj, obj, 0, tell_where_guard_is, 5 );
  362. }
  363. /*else if (param == attach_havocs_script)
  364. {
  365. if (STAR)
  366. {
  367. Commands->Attach_Script(STAR, "M04_Havocs_Script_JDG", "");
  368. }
  369. else
  370. {
  371. Commands->Send_Custom_Event( obj, obj, 0, attach_havocs_script, 1 );
  372. }
  373. }*/
  374. else if (param == announce_engine_room_objective)
  375. {
  376. engineIntroConv = Commands->Create_Conversation( "M04_Add_EngineRoom_Objective_Conversation", 100, 1000, false);
  377. Commands->Join_Conversation( NULL, engineIntroConv, false, false );
  378. //Commands->Join_Conversation( STAR, engineIntroConv, false, false );
  379. Commands->Start_Conversation( engineIntroConv, engineIntroConv );
  380. Commands->Monitor_Conversation (obj, engineIntroConv);
  381. }
  382. else if (param == announce_missile_room_objective)//
  383. {
  384. missileConv = Commands->Create_Conversation( "M04_Add_MissileRoom_Objective_Conversation", 100, 1000, false);
  385. Commands->Join_Conversation( NULL, missileConv, false, false );
  386. Commands->Start_Conversation( missileConv, missileConv );
  387. Commands->Monitor_Conversation (obj, missileConv);
  388. missile_primary_active = true;
  389. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  390. if (objectiveReminder != NULL)
  391. {
  392. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 1, 0 );
  393. }
  394. }
  395. else if (param == announce_torpedo_room_objective)
  396. {
  397. torpedo_primary_active = true;
  398. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  399. Commands->Add_Objective( 400, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_04, NULL, IDS_Enc_Obj_Primary_M04_04 );
  400. Commands->Add_Radar_Marker ( 401, Commands->Get_Position( Commands->Find_Object ( 100409 )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  401. Commands->Add_Radar_Marker ( 402, Commands->Get_Position( Commands->Find_Object ( 100410 )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  402. Commands->Send_Custom_Event( obj, obj, 0, 1, 2 );//this sets a small delay before havoc responds
  403. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  404. if (objectiveReminder != NULL)
  405. {
  406. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 5, 0 );
  407. }
  408. }
  409. else if (param == announce_apache_objective)
  410. {
  411. Commands->Create_Sound ( "00-n042e", Vector3 (0,0,0), obj);
  412. Commands->Add_Objective( 500, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M04_03, NULL, IDS_Enc_Obj_Secondary_M04_03 );
  413. Commands->Set_Objective_Radar_Blip_Object(500, sender );
  414. Commands->Set_Objective_HUD_Info( 500, 95, "POG_M04_2_02.tga", IDS_POG_DESTROY );
  415. }
  416. else if (param == announce_first_mate_objective && first_mate_primary_active != true && first_mate_primary_triggered == false)//
  417. {
  418. first_mate_primary_triggered = true;
  419. first_mate_primary_active = true;
  420. firstmateConv = Commands->Create_Conversation( "M04_Add_FirstMate_Objective_JDG", 100, 1000, false);
  421. Commands->Join_Conversation( NULL, firstmateConv, false, false );
  422. Commands->Start_Conversation( firstmateConv, firstmateConv );
  423. Commands->Monitor_Conversation (obj, firstmateConv);
  424. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  425. if (objectiveReminder != NULL)
  426. {
  427. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 3, 0 );
  428. }
  429. }
  430. else if (param == announce_captain_objective)//M04_Add_Captains_Key_Objective_Conversation
  431. {
  432. int captainConv = Commands->Create_Conversation( "M04_Add_Captains_Key_Objective_Conversation", 100, 1000, false);
  433. Commands->Join_Conversation( NULL, captainConv, false, false );
  434. Commands->Start_Conversation( captainConv, captainConv );
  435. captain_primary_active = true;
  436. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  437. Commands->Add_Objective( 700, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M04_05, NULL, IDS_Enc_Obj_Primary_M04_05 );
  438. Commands->Add_Radar_Marker ( 701, Commands->Get_Position( Commands->Find_Object ( M04_SHIPS_CAPTAIN_JDG )), RADAR_BLIP_SHAPE_OBJECTIVE, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  439. Commands->Send_Custom_Event( obj, obj, 0, 1, 4 );//this sets a small delay before havoc responds
  440. GameObject * captain = Commands->Find_Object ( M04_SHIPS_CAPTAIN_JDG );
  441. if (captain != NULL)
  442. {
  443. Vector3 captainLocation = Commands->Get_Position(captain);
  444. Commands->Set_Objective_HUD_Info_Position( 700, 94, "POG_M04_1_05.tga", IDS_POG_ACQUIRE, captainLocation );
  445. }
  446. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  447. if (objectiveReminder != NULL)
  448. {
  449. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 4, 0 );
  450. }
  451. }
  452. else if (param == announce_get_back_to_sub)//
  453. {
  454. protectPOWsConv = Commands->Create_Conversation( "M04_Protect_The_Prisoners_Conversation", 100, 1000, false);
  455. Commands->Join_Conversation( NULL, protectPOWsConv, false, false );
  456. Commands->Start_Conversation( protectPOWsConv, protectPOWsConv );
  457. Commands->Monitor_Conversation (obj, protectPOWsConv);
  458. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  459. if (objectiveReminder != NULL)
  460. {
  461. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 6, 0 );
  462. }
  463. //Commands->Create_Sound ( "00-n040e", Vector3 (0,0,0), obj);
  464. }
  465. /**********************************************************************************************************
  466. The following are params for when the individual objectives are completed.
  467. ***********************************************************************************************************/
  468. else if (param == completed_prisoner_rescue)
  469. {
  470. prisoner_primary_active = false;
  471. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  472. Commands->Set_Objective_Status( 100, OBJECTIVE_STATUS_ACCOMPLISHED );
  473. Commands->Clear_Radar_Marker ( 101 );
  474. Commands->Clear_Radar_Marker ( 102 );
  475. Commands->Clear_Radar_Marker ( 103 );
  476. Commands->Send_Custom_Event( obj, obj, 0, 2, 2 );//this sets a small delay before havoc responds
  477. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  478. if (objectiveReminder != NULL)
  479. {
  480. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 0, 0 );
  481. }
  482. }
  483. else if (param == completed_get_the_key)
  484. {
  485. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  486. Commands->Set_Objective_Status( 110, OBJECTIVE_STATUS_ACCOMPLISHED );
  487. Commands->Clear_Radar_Marker ( 111 );
  488. int cargo_conv1 = Commands->Create_Conversation( "M04_NowGoFreeThePrisoners_Conversation", 100, 1000, false);
  489. //Commands->Join_Conversation( NULL, cargo_conv1, false, false, false);
  490. Commands->Join_Conversation( STAR, cargo_conv1, false, false, false );
  491. Commands->Start_Conversation( cargo_conv1, cargo_conv1 );
  492. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  493. if (objectiveReminder != NULL)
  494. {
  495. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 2, 0 );
  496. }
  497. }
  498. else if (param == completed_engine_room_objective)
  499. {
  500. //Commands->Create_Sound ( "00-n050e", Vector3 (0,0,0), obj);
  501. Commands->Set_Objective_Status( 200, OBJECTIVE_STATUS_ACCOMPLISHED );
  502. Commands->Create_Object ( "POW_Armor_100", Vector3 (0.039f, -85.758f, -14.999f));
  503. Commands->Create_Object ( "POW_Health_100", Vector3 (0.014f, -98.215f, -14.999f));
  504. Commands->Create_Object ( "POW_GrenadeLauncher_Player", Vector3 (0.020f, -89.237f, -14.999f));
  505. Commands->Create_Object ( "POW_GrenadeLauncher_Player", Vector3 (0.050f, -92.541f, -14.999f));
  506. Commands->Create_Object ( "POW_GrenadeLauncher_Player", Vector3 (0.023f, -95.280f, -14.999f));
  507. }
  508. else if (param == completed_missile_room_objective)
  509. {
  510. missile_primary_active = false;
  511. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  512. Commands->Set_Objective_Status( 300, OBJECTIVE_STATUS_ACCOMPLISHED );
  513. Commands->Send_Custom_Event( obj, obj, 0, 2, 2 );//this sets a small delay before havoc responds
  514. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  515. if (objectiveReminder != NULL)
  516. {
  517. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 1, 0 );
  518. }
  519. }
  520. else if (param == completed_torpedo_room_objective)
  521. {
  522. torpedo_primary_active = false;
  523. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  524. Commands->Set_Objective_Status( 400, OBJECTIVE_STATUS_ACCOMPLISHED );
  525. Commands->Send_Custom_Event( obj, obj, 0, 2, 2 );//this sets a small delay before havoc responds
  526. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  527. if (objectiveReminder != NULL)
  528. {
  529. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 5, 0 );
  530. }
  531. }
  532. else if (param == completed_apache_objective)
  533. {
  534. Commands->Create_Sound ( "00-n050e", Vector3 (0,0,0), obj);
  535. Commands->Set_Objective_Status( 500, OBJECTIVE_STATUS_ACCOMPLISHED );
  536. }
  537. else if (param == completed_first_mate_objective)
  538. {
  539. first_mate_primary_triggered = true;
  540. first_mate_primary_active = false;
  541. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  542. Commands->Set_Objective_Status( 600, OBJECTIVE_STATUS_ACCOMPLISHED );
  543. Commands->Clear_Radar_Marker ( 601 );
  544. //Commands->Send_Custom_Event( obj, obj, 0, 2, 2 );//this sets a small delay before havoc responds
  545. GameObject * shipCaptain = Commands->Find_Object ( M04_SHIPS_CAPTAIN_JDG );
  546. if (shipCaptain != NULL)
  547. {
  548. Commands->Send_Custom_Event( obj, obj, 0, announce_captain_objective, 6 );
  549. }
  550. else if (shipCaptain == NULL)
  551. {
  552. //Commands->Send_Custom_Event( obj, obj, 0, announce_captain_objective, 6 );
  553. Commands->Send_Custom_Event( obj, obj, 0, completed_captain_objective, 6 );
  554. }
  555. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  556. if (objectiveReminder != NULL)
  557. {
  558. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 3, 0 );
  559. }
  560. }
  561. else if (param == completed_captain_objective)
  562. {
  563. captain_primary_active = false;
  564. //Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  565. Commands->Set_Objective_Status( 700, OBJECTIVE_STATUS_ACCOMPLISHED );
  566. Commands->Clear_Radar_Marker ( 701 );
  567. Commands->Send_Custom_Event( obj, obj, 0, 2, 2 );//this sets a small delay before havoc responds
  568. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  569. if (objectiveReminder != NULL)
  570. {
  571. Commands->Send_Custom_Event( obj, objectiveReminder, M01_REMOVE_OBJECTIVE_POG_JDG, 4, 0 );
  572. }
  573. if (prisoner_primary_active == false)
  574. {
  575. int reminderConv = Commands->Create_Conversation( "M04_Rally_Round_The_Sub_Boy_Conversation", 50, 1000, false);
  576. Commands->Join_Conversation( NULL, reminderConv, false, false );
  577. Commands->Start_Conversation( reminderConv, reminderConv );
  578. GameObject * objectiveReminder = Commands->Find_Object ( 105760 );
  579. if (objectiveReminder != NULL)
  580. {
  581. Commands->Send_Custom_Event( obj, objectiveReminder, M01_ADD_OBJECTIVE_POG_JDG, 6, 0 );
  582. }
  583. }
  584. else if (prisoner_primary_active == true)
  585. {
  586. int reminderConv = Commands->Create_Conversation( "M04_Mission_Start_Conversation", 50, 1000, false);
  587. Commands->Join_Conversation( NULL, reminderConv, false, false );
  588. Commands->Start_Conversation( reminderConv, reminderConv );
  589. }
  590. }
  591. else if (param == M01_END_MISSION_PASS_JDG)
  592. {
  593. Commands->Create_Sound ( "00-n048e", Vector3 (0,0,0), obj);
  594. Commands->Mission_Complete ( true );
  595. }
  596. else if (param == M01_DO_END_MISSION_CHECK_JDG)
  597. {
  598. if ((mission_started == true) && (captain_primary_active == false) && (first_mate_primary_active == false) && (torpedo_primary_active == false) && (missile_primary_active == false) && (prisoner_primary_active == false))
  599. {
  600. //Commands->Send_Custom_Event( obj, Commands->Find_Object (101194), 0, M01_START_ACTING_JDG, 0 );
  601. Commands->Send_Custom_Event( obj, obj, 0, M01_END_MISSION_PASS_JDG, 0 );
  602. }
  603. }
  604. /**********************************************************************************************************
  605. The following are params for when the individual missiles and whatnot get acted on or destroyed.
  606. ***********************************************************************************************************/
  607. else if (param == missile_01_sabotaged)//
  608. {
  609. //Commands->Clear_Radar_Marker ( 301 );
  610. number_missiles_sabotaged++;
  611. if (number_missiles_sabotaged == 1)
  612. {
  613. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_01_Sabotaged_Conversation", 100, 1000, true);
  614. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  615. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  616. }
  617. else if (number_missiles_sabotaged == 2)
  618. {
  619. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_02_Sabotaged_Conversation", 100, 1000, true);
  620. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  621. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  622. }
  623. else if (number_missiles_sabotaged == 3)
  624. {
  625. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_03_Sabotaged_Conversation", 100, 1000, true);
  626. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  627. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  628. }
  629. else if (number_missiles_sabotaged >= 4)
  630. {
  631. Commands->Send_Custom_Event( obj, obj, 0, completed_missile_room_objective, 0 );
  632. GameObject * bigSamZone = Commands->Find_Object ( 104942 );
  633. if (bigSamZone != NULL)
  634. {
  635. Commands->Send_Custom_Event( obj, bigSamZone, 0, M01_START_ACTING_JDG, 0 );
  636. }
  637. }
  638. }
  639. else if (param == missile_02_sabotaged)
  640. {
  641. //Commands->Clear_Radar_Marker ( 302 );
  642. number_missiles_sabotaged++;
  643. if (number_missiles_sabotaged == 1)
  644. {
  645. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_01_Sabotaged_Conversation", 100, 1000, true);
  646. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  647. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  648. }
  649. else if (number_missiles_sabotaged == 2)
  650. {
  651. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_02_Sabotaged_Conversation", 100, 1000, true);
  652. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  653. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  654. }
  655. else if (number_missiles_sabotaged == 3)
  656. {
  657. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_03_Sabotaged_Conversation", 100, 1000, true);
  658. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  659. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  660. }
  661. else if (number_missiles_sabotaged >= 4)
  662. {
  663. Commands->Send_Custom_Event( obj, obj, 0, completed_missile_room_objective, 0 );
  664. GameObject * bigSamZone = Commands->Find_Object ( 104942 );
  665. if (bigSamZone != NULL)
  666. {
  667. Commands->Send_Custom_Event( obj, bigSamZone, 0, M01_START_ACTING_JDG, 0 );
  668. }
  669. }
  670. }
  671. else if (param == missile_03_sabotaged)
  672. {
  673. //Commands->Clear_Radar_Marker ( 303 );
  674. number_missiles_sabotaged++;
  675. if (number_missiles_sabotaged == 1)
  676. {
  677. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_01_Sabotaged_Conversation", 100, 1000, true);
  678. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  679. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  680. }
  681. else if (number_missiles_sabotaged == 2)
  682. {
  683. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_02_Sabotaged_Conversation", 100, 1000, true);
  684. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  685. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  686. }
  687. else if (number_missiles_sabotaged == 3)
  688. {
  689. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_03_Sabotaged_Conversation", 100, 1000, true);
  690. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  691. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  692. }
  693. else if (number_missiles_sabotaged >= 4)
  694. {
  695. Commands->Send_Custom_Event( obj, obj, 0, completed_missile_room_objective, 0 );
  696. GameObject * bigSamZone = Commands->Find_Object ( 104942 );
  697. if (bigSamZone != NULL)
  698. {
  699. Commands->Send_Custom_Event( obj, bigSamZone, 0, M01_START_ACTING_JDG, 0 );
  700. }
  701. }
  702. }
  703. else if (param == missile_04_sabotaged)
  704. {
  705. //Commands->Clear_Radar_Marker ( 304 );
  706. number_missiles_sabotaged++;
  707. if (number_missiles_sabotaged == 1)
  708. {
  709. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_01_Sabotaged_Conversation", 100, 1000, true);
  710. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  711. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  712. }
  713. else if (number_missiles_sabotaged == 2)
  714. {
  715. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_02_Sabotaged_Conversation", 100, 1000, true);
  716. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  717. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  718. }
  719. else if (number_missiles_sabotaged == 3)
  720. {
  721. int missile_conv1 = Commands->Create_Conversation( "M04_MissileRack_03_Sabotaged_Conversation", 100, 1000, true);
  722. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  723. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  724. }
  725. else if (number_missiles_sabotaged >= 4)
  726. {
  727. Commands->Send_Custom_Event( obj, obj, 0, completed_missile_room_objective, 0 );
  728. GameObject * bigSamZone = Commands->Find_Object ( 104942 );
  729. if (bigSamZone != NULL)
  730. {
  731. Commands->Send_Custom_Event( obj, bigSamZone, 0, M01_START_ACTING_JDG, 0 );
  732. }
  733. }
  734. }
  735. else if (param == engine_room_01_sabotaged)
  736. {
  737. number_engines_sabotaged++;
  738. if (number_engines_sabotaged == 1)
  739. {
  740. Commands->Create_Sound ( "M04DSGN_DSGN0040I1EVAG_SND", Vector3 (0,0,0), obj);
  741. }
  742. else if (number_engines_sabotaged == 2)
  743. {
  744. Commands->Create_Sound ( "M04DSGN_DSGN0090I1EVAN_SND", Vector3 (0,0,0), obj);//intruder detected
  745. }
  746. else if (number_engines_sabotaged == 3)
  747. {
  748. Commands->Create_Sound ( "M04DSGN_DSGN0094I1EVAN_SND", Vector3 (0,0,0), obj);//engine failure emiment
  749. }
  750. else if (number_engines_sabotaged >= 4)
  751. {
  752. Commands->Create_Sound ( "M04DSGN_DSGN0095I1EVAN_SND", Vector3 (0,0,0), obj);//engine off line
  753. Commands->Send_Custom_Event( obj, obj, 0, completed_engine_room_objective, 0 );
  754. }
  755. }
  756. else if (param == engine_room_02_sabotaged)
  757. {
  758. number_engines_sabotaged++;
  759. if (number_engines_sabotaged == 1)
  760. {
  761. Commands->Create_Sound ( "M04DSGN_DSGN0040I1EVAG_SND", Vector3 (0,0,0), obj);
  762. }
  763. else if (number_engines_sabotaged == 2)
  764. {
  765. Commands->Create_Sound ( "M04DSGN_DSGN0090I1EVAN_SND", Vector3 (0,0,0), obj);//intruder detected
  766. }
  767. else if (number_engines_sabotaged == 3)
  768. {
  769. Commands->Create_Sound ( "M04DSGN_DSGN0094I1EVAN_SND", Vector3 (0,0,0), obj);//engine failure emiment
  770. }
  771. else if (number_engines_sabotaged >= 4)
  772. {
  773. Commands->Create_Sound ( "M04DSGN_DSGN0095I1EVAN_SND", Vector3 (0,0,0), obj);//engine off line
  774. Commands->Send_Custom_Event( obj, obj, 0, completed_engine_room_objective, 0 );
  775. }
  776. }
  777. else if (param == engine_room_03_sabotaged)
  778. {
  779. number_engines_sabotaged++;
  780. if (number_engines_sabotaged == 1)
  781. {
  782. Commands->Create_Sound ( "M04DSGN_DSGN0040I1EVAG_SND", Vector3 (0,0,0), obj);
  783. }
  784. else if (number_engines_sabotaged == 2)
  785. {
  786. Commands->Create_Sound ( "M04DSGN_DSGN0090I1EVAN_SND", Vector3 (0,0,0), obj);//intruder detected
  787. }
  788. else if (number_engines_sabotaged == 3)
  789. {
  790. Commands->Create_Sound ( "M04DSGN_DSGN0094I1EVAN_SND", Vector3 (0,0,0), obj);//engine failure emiment
  791. }
  792. else if (number_engines_sabotaged >= 4)
  793. {
  794. Commands->Create_Sound ( "M04DSGN_DSGN0095I1EVAN_SND", Vector3 (0,0,0), obj);//engine off line
  795. Commands->Send_Custom_Event( obj, obj, 0, completed_engine_room_objective, 0 );
  796. }
  797. }
  798. else if (param == engine_room_04_sabotaged)
  799. {
  800. number_engines_sabotaged++;
  801. if (number_engines_sabotaged == 1)
  802. {
  803. Commands->Create_Sound ( "M04DSGN_DSGN0040I1EVAG_SND", Vector3 (0,0,0), obj);
  804. }
  805. else if (number_engines_sabotaged == 2)
  806. {
  807. Commands->Create_Sound ( "M04DSGN_DSGN0090I1EVAN_SND", Vector3 (0,0,0), obj);//intruder detected
  808. }
  809. else if (number_engines_sabotaged == 3)
  810. {
  811. Commands->Create_Sound ( "M04DSGN_DSGN0094I1EVAN_SND", Vector3 (0,0,0), obj);//engine failure emiment
  812. }
  813. else if (number_engines_sabotaged >= 4)
  814. {
  815. Commands->Create_Sound ( "M04DSGN_DSGN0095I1EVAN_SND", Vector3 (0,0,0), obj);//engine off line
  816. Commands->Send_Custom_Event( obj, obj, 0, completed_engine_room_objective, 0 );
  817. }
  818. }
  819. else if (param == torpedo_01_sabotaged)
  820. {
  821. Commands->Clear_Radar_Marker ( 401 );
  822. number_torpedos_sabotaged++;
  823. if (number_torpedos_sabotaged < 2)
  824. {
  825. int missile_conv1 = Commands->Create_Conversation( "M04_Torpedo_Sabotaged_Conversation", 100, 1000, true);
  826. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  827. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  828. }
  829. else if (number_torpedos_sabotaged >= 2)
  830. {
  831. Commands->Send_Custom_Event( obj, obj, 0, completed_torpedo_room_objective, 0 );
  832. }
  833. }
  834. else if (param == torpedo_02_sabotaged)
  835. {
  836. Commands->Clear_Radar_Marker ( 402 );
  837. number_torpedos_sabotaged++;
  838. if (number_torpedos_sabotaged < 2)
  839. {
  840. int missile_conv1 = Commands->Create_Conversation( "M04_Torpedo_Sabotaged_Conversation", 100, 1000, true);
  841. Commands->Join_Conversation( NULL, missile_conv1, false, false, false);
  842. Commands->Start_Conversation( missile_conv1, missile_conv1 );
  843. }
  844. else if (number_torpedos_sabotaged >= 2)
  845. {
  846. Commands->Send_Custom_Event( obj, obj, 0, completed_torpedo_room_objective, 0 );
  847. }
  848. }
  849. }
  850. }
  851. };
  852. /*****************************************************************************************************************
  853. The following are the scripts for the dudes in the sub bay when the mission first starts.
  854. *****************************************************************************************************************/
  855. DECLARE_SCRIPT(M04_PointGuard_JDG, "")
  856. {
  857. void Created( GameObject * obj )
  858. {
  859. Commands->Set_Innate_Is_Stationary ( obj, true );
  860. }
  861. void Damaged( GameObject * obj, GameObject * damager, float amount )
  862. {
  863. if (obj)
  864. {
  865. Commands->Set_Innate_Is_Stationary ( obj, false );
  866. }
  867. }
  868. };
  869. DECLARE_SCRIPT(M04_A01_Sniper_JDG, "")
  870. {
  871. void Created( GameObject * obj )
  872. {
  873. ActionParamsStruct params;
  874. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  875. params.Set_Movement( Vector3(-0.238f, 0.743f, 5.034f), WALK, .25f );
  876. Commands->Action_Goto( obj, params );
  877. }
  878. void Damaged( GameObject * obj, GameObject * damager, float amount )
  879. {
  880. Commands->Action_Reset ( obj, 100 );
  881. }
  882. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  883. {
  884. ActionParamsStruct params;
  885. if (complete_reason == ACTION_COMPLETE_NORMAL)
  886. {
  887. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  888. {
  889. char *animationName = M01_Choose_Idle_Animation ( );
  890. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  891. params.Set_Animation (animationName, false);
  892. Commands->Action_Play_Animation (obj, params);
  893. }
  894. else if (action_id == M01_DOING_ANIMATION_01_JDG)
  895. {
  896. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  897. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  898. params.WaypathID = 100167;
  899. params.WaypointStartID = 100168;
  900. params.WaypointEndID = 100169;
  901. Commands->Action_Goto( obj, params );
  902. }
  903. else if (action_id == M01_WALKING_WAYPATH_02_JDG)
  904. {
  905. char *animationName = M01_Choose_Idle_Animation ( );
  906. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  907. params.Set_Animation (animationName, false);
  908. Commands->Action_Play_Animation (obj, params);
  909. }
  910. else if (action_id == M01_DOING_ANIMATION_02_JDG)
  911. {
  912. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_03_JDG );
  913. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  914. params.WaypathID = 100171;
  915. params.WaypointStartID = 100172;
  916. params.WaypointEndID = 100175;
  917. Commands->Action_Goto( obj, params );
  918. }
  919. else if (action_id == M01_WALKING_WAYPATH_03_JDG)
  920. {
  921. char *animationName = M01_Choose_Idle_Animation ( );
  922. params.Set_Basic( this, 45, M01_DOING_ANIMATION_03_JDG );
  923. params.Set_Animation (animationName, false);
  924. Commands->Action_Play_Animation (obj, params);
  925. }
  926. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  927. {
  928. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_04_JDG );
  929. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  930. params.WaypathID = 100177;
  931. params.WaypointStartID = 100178;
  932. params.WaypointEndID = 100179;
  933. Commands->Action_Goto( obj, params );
  934. }
  935. else if (action_id == M01_WALKING_WAYPATH_04_JDG)
  936. {
  937. char *animationName = M01_Choose_Idle_Animation ( );
  938. params.Set_Basic( this, 45, M01_DOING_ANIMATION_04_JDG );
  939. params.Set_Animation (animationName, false);
  940. Commands->Action_Play_Animation (obj, params);
  941. }
  942. else if (action_id == M01_DOING_ANIMATION_04_JDG)
  943. {
  944. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_05_JDG );
  945. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  946. params.WaypathID = 100181;
  947. params.WaypointStartID = 100182;
  948. params.WaypointEndID = 100183;
  949. Commands->Action_Goto( obj, params );
  950. }
  951. else if (action_id == M01_WALKING_WAYPATH_05_JDG)
  952. {
  953. char *animationName = M01_Choose_Idle_Animation ( );
  954. params.Set_Basic( this, 45, M01_DOING_ANIMATION_05_JDG );
  955. params.Set_Animation (animationName, false);
  956. Commands->Action_Play_Animation (obj, params);
  957. }
  958. else if (action_id == M01_DOING_ANIMATION_05_JDG)
  959. {
  960. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  961. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  962. params.WaypathID = 100167;
  963. params.WaypointStartID = 100168;
  964. params.WaypointEndID = 100169;
  965. Commands->Action_Goto( obj, params );
  966. }
  967. }
  968. }
  969. };
  970. DECLARE_SCRIPT(M04_A01_PatrolGuy_01_JDG, "")
  971. {
  972. void Created( GameObject * obj )
  973. {
  974. Vector3 myPosition = Commands->Get_Position ( obj );
  975. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 5 );
  976. }
  977. };
  978. /*********************************************************************************************************
  979. The following scripts all deal with the first time through the cargo and missile rooms.
  980. *************************************************************************************************************/
  981. DECLARE_SCRIPT(M04_MissileRoom_EnterZone_Left_JDG, "")
  982. {
  983. void Entered( GameObject * obj, GameObject * enterer )
  984. {
  985. if ( enterer == STAR )
  986. {
  987. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 600, 0 );//have leftside guard come in
  988. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 200, 0 );//put missile room guys to 50% priority
  989. GameObject * zone02 = Commands->Find_Object (100583);//stays
  990. if (zone02 != NULL)
  991. {
  992. Commands->Destroy_Object ( zone02 );
  993. }
  994. GameObject * zone04 = Commands->Find_Object (100585);
  995. if (zone04 != NULL)
  996. {
  997. Commands->Destroy_Object ( zone04 );
  998. }
  999. }
  1000. }
  1001. };
  1002. DECLARE_SCRIPT(M04_MissileRoom_EnterZone_Right_JDG, "")
  1003. {
  1004. void Entered( GameObject * obj, GameObject * enterer )
  1005. {
  1006. if ( enterer == STAR )
  1007. {
  1008. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 500, 0 );//have rightside guard come in
  1009. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 200, 0 );//put missile room guys to 50% priority
  1010. GameObject * zone02 = Commands->Find_Object (100583);//stays
  1011. if (zone02 != NULL)
  1012. {
  1013. Commands->Destroy_Object ( zone02 );
  1014. }
  1015. GameObject * zone04 = Commands->Find_Object (100585);//stays
  1016. if (zone04 != NULL)
  1017. {
  1018. Commands->Destroy_Object ( zone04 );
  1019. }
  1020. }
  1021. }
  1022. };
  1023. DECLARE_SCRIPT(M04_CargoMissileRooms_Dude_Controller_JDG, "")//this guys ID number is M04_CARGOHOLD_CONTROLLER_JDG 100558
  1024. {
  1025. int missileRoomguardOne_ID;
  1026. int missileRoomguardTwo_ID;
  1027. int guardFive_ID;
  1028. int upperGuard01_ID;
  1029. int upperGuard02_ID;
  1030. //int cargo_conv1;
  1031. REGISTER_VARIABLES()
  1032. {
  1033. SAVE_VARIABLE( missileRoomguardOne_ID, 1 );
  1034. SAVE_VARIABLE( missileRoomguardTwo_ID, 2 );
  1035. SAVE_VARIABLE( guardFive_ID, 3 );
  1036. SAVE_VARIABLE( upperGuard01_ID, 4 );
  1037. SAVE_VARIABLE( upperGuard02_ID, 5 );
  1038. //SAVE_VARIABLE( cargo_conv1, 6 );
  1039. }
  1040. void Created( GameObject * obj )
  1041. {
  1042. Commands->Enable_Hibernation( obj, false );
  1043. }
  1044. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1045. {
  1046. if (param == 100)
  1047. {
  1048. GameObject *guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1049. GameObject *guardTwo = Commands->Find_Object ( M04_CARGO_TALKGUY_02_JDG );
  1050. GameObject *guardThree = Commands->Find_Object ( M04_CARGO_TALKGUY_03_JDG );
  1051. if ((guardOne != NULL) && (guardTwo != NULL) && (guardThree != NULL))//
  1052. {
  1053. //cargo_conv1 = Commands->Create_Conversation( "M04_CargoHold_Conversation_01", 45, 1000, true);
  1054. //Commands->Join_Conversation( guardOne, cargo_conv1, false, false, false);
  1055. //Commands->Join_Conversation( guardTwo, cargo_conv1, false, false, false );
  1056. //Commands->Start_Conversation( cargo_conv1, cargo_conv1 );
  1057. //Commands->Monitor_Conversation( obj, cargo_conv1);
  1058. }
  1059. GameObject *guardSix = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-14.44f, -40.82f, -9.00f));
  1060. Commands->Attach_Script(guardSix, "M04_CargoHold_Blackhand_02_JDG", "");//M01_Hunt_The_Player_JDG
  1061. GameObject *missileRoomguardOne = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(-13.38f, -53.56f, -15.00f));
  1062. Commands->Attach_Script(missileRoomguardOne, "M04_MissileRoom_Guard_01_JDG", "");
  1063. GameObject *missileRoomguardTwo = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(13.37f, -61.28f, -15.00f));
  1064. Commands->Attach_Script(missileRoomguardTwo, "M04_MissileRoom_Guard_02_JDG", "");
  1065. GameObject *missileRoomUpperguardOne = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(9.485f, -66.975f, -9.00f));
  1066. Commands->Attach_Script(missileRoomUpperguardOne, "M04_MissileRoom_UpperGuard_01_JDG", "");
  1067. Commands->Set_Facing ( missileRoomUpperguardOne, 85 );
  1068. upperGuard01_ID = Commands->Get_ID ( missileRoomUpperguardOne );
  1069. GameObject *missileRoomUpperguardTwo = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(-9.456f, -61.862f, -9.00f));
  1070. Commands->Attach_Script(missileRoomUpperguardTwo, "M04_MissileRoom_UpperGuard_02_JDG", "");
  1071. Commands->Set_Facing ( missileRoomUpperguardTwo, 95 );
  1072. upperGuard02_ID = Commands->Get_ID ( missileRoomUpperguardTwo );
  1073. missileRoomguardOne_ID = Commands->Get_ID ( missileRoomguardOne );
  1074. missileRoomguardTwo_ID = Commands->Get_ID ( missileRoomguardTwo );
  1075. }
  1076. else if (param == 200)//this sets the missile guards priority to 50 probably from 100
  1077. {
  1078. GameObject *missileRoomguardOne = Commands->Find_Object ( missileRoomguardOne_ID );
  1079. GameObject *missileRoomguardTwo = Commands->Find_Object ( missileRoomguardTwo_ID );
  1080. if (missileRoomguardOne != NULL)
  1081. {
  1082. Commands->Send_Custom_Event( obj, missileRoomguardOne, 200, 50, 0 );
  1083. }
  1084. if (missileRoomguardTwo != NULL)
  1085. {
  1086. Commands->Send_Custom_Event( obj, missileRoomguardTwo, 200, 50, 0 );
  1087. }
  1088. }
  1089. else if (param == 300)//this is when one of the missile room guards dies
  1090. {
  1091. float reinforceka = Commands->Get_Random ( 0.5, 2.5 );
  1092. if ((reinforceka >= 0.5) && (reinforceka < 1.5))
  1093. {
  1094. Commands->Trigger_Spawner( 100579 );
  1095. Commands->Trigger_Spawner( 100581 );
  1096. }
  1097. else
  1098. {
  1099. Commands->Trigger_Spawner( 100581 );
  1100. }
  1101. }
  1102. else if (param == 500)//user is going through the right side door into missile room
  1103. {
  1104. GameObject *upperGuard01 = Commands->Find_Object ( upperGuard01_ID );
  1105. GameObject *upperGuard02 = Commands->Find_Object ( upperGuard02_ID );
  1106. if (upperGuard01 != NULL)
  1107. {
  1108. Commands->Send_Custom_Event( obj, upperGuard01, 0, M01_START_ATTACKING_01_JDG, 0 );
  1109. }
  1110. if (upperGuard02 != NULL)
  1111. {
  1112. Commands->Send_Custom_Event( obj, upperGuard02, 0, M01_START_ACTING_JDG, 0 );
  1113. }
  1114. }
  1115. else if (param == 600)//user is going through the left side door into missile room
  1116. {
  1117. GameObject *upperGuard01 = Commands->Find_Object ( upperGuard01_ID );
  1118. GameObject *upperGuard02 = Commands->Find_Object ( upperGuard02_ID );
  1119. if (upperGuard01 != NULL)
  1120. {
  1121. Commands->Send_Custom_Event( obj, upperGuard01, 0, M01_START_ACTING_JDG, 0 );
  1122. }
  1123. if (upperGuard02 != NULL)
  1124. {
  1125. Commands->Send_Custom_Event( obj, upperGuard02, 0, M01_START_ATTACKING_01_JDG, 0 );
  1126. }
  1127. }
  1128. else if (param == 800)//Officer has ragged on grunts--tell them to salute
  1129. {
  1130. GameObject * guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1131. if (guardOne != NULL)
  1132. {
  1133. float delayTimer = Commands->Get_Random ( 0, 1.5f );
  1134. Commands->Send_Custom_Event( obj, guardOne, 0, 100, delayTimer );
  1135. }
  1136. GameObject * guardTwo = Commands->Find_Object ( M04_CARGO_TALKGUY_02_JDG );
  1137. if (guardTwo != NULL)
  1138. {
  1139. float delayTimer = Commands->Get_Random ( 0, 1.5f );
  1140. Commands->Send_Custom_Event( obj, guardTwo, 0, 100, delayTimer );
  1141. }
  1142. GameObject * guardThree = Commands->Find_Object ( M04_CARGO_TALKGUY_03_JDG );
  1143. if (guardThree != NULL)
  1144. {
  1145. float delayTimer = Commands->Get_Random ( 0, 1.5f );
  1146. Commands->Send_Custom_Event( obj, guardThree, 0, 100, delayTimer );
  1147. }
  1148. }
  1149. }
  1150. /*void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1151. {
  1152. if (complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1153. {
  1154. if (action_id == cargo_conv1)
  1155. {
  1156. GameObject *blackHand01 = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1157. if (blackHand01 != NULL)
  1158. {
  1159. Commands->Debug_Message ( "**********************cargo conv 01 is over--sending custom to blackhand guy\n" );
  1160. Commands->Send_Custom_Event( obj, blackHand01, 0, M01_START_ACTING_JDG, 0 );
  1161. }
  1162. }
  1163. }
  1164. }*/
  1165. };
  1166. DECLARE_SCRIPT(M04_MissileRoom_UpperGuard_01_JDG, "")//left side
  1167. {
  1168. void Created( GameObject * obj )
  1169. {
  1170. Commands->Set_Innate_Is_Stationary ( obj, true );
  1171. //Commands->Innate_Soldier_Enable_Actions ( obj, false );
  1172. }
  1173. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1174. {
  1175. ActionParamsStruct params;
  1176. if (param == M01_START_ACTING_JDG)//player has entered area--back peddle towards the engine room
  1177. {
  1178. Vector3 gotoSpot (4.302f, -67.224f, -9);
  1179. ActionParamsStruct params;
  1180. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  1181. params.Set_Movement( gotoSpot, RUN, .25f );
  1182. params.MoveBackup = true;
  1183. Commands->Action_Goto( obj, params );
  1184. }
  1185. else if (param == M01_START_ATTACKING_01_JDG)//player has entered area--attack him
  1186. {
  1187. Commands->Set_Innate_Is_Stationary ( obj, false );
  1188. //Commands->Innate_Soldier_Enable_Actions ( obj, true );
  1189. }
  1190. }
  1191. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1192. {
  1193. if (action_id == M01_WALKING_WAYPATH_01_JDG)//you've reached your final guard spot--goto stationary
  1194. {
  1195. Commands->Attach_Script(obj, "M01_Hunt_The_Player_JDG", "");
  1196. //Commands->Set_Innate_Is_Stationary ( obj, true );
  1197. }
  1198. }
  1199. };
  1200. DECLARE_SCRIPT(M04_MissileRoom_UpperGuard_02_JDG, "")//right side
  1201. {
  1202. void Created( GameObject * obj )
  1203. {
  1204. Commands->Set_Innate_Is_Stationary ( obj, true );
  1205. //Commands->Innate_Soldier_Enable_Actions ( obj, false );
  1206. }
  1207. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1208. {
  1209. ActionParamsStruct params;
  1210. if (param == M01_START_ACTING_JDG)//player has entered area--back peddle towards the engine room
  1211. {
  1212. Vector3 gotoSpot (-4.336f, -66.975f, -9);
  1213. ActionParamsStruct params;
  1214. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  1215. params.Set_Movement( gotoSpot, RUN, .25f );
  1216. params.MoveBackup = true;
  1217. Commands->Action_Goto( obj, params );
  1218. }
  1219. else if (param == M01_START_ATTACKING_01_JDG)//player has entered area--attack him
  1220. {
  1221. Commands->Set_Innate_Is_Stationary ( obj, false );
  1222. //Commands->Innate_Soldier_Enable_Actions ( obj, true );
  1223. }
  1224. }
  1225. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1226. {
  1227. if (action_id == M01_WALKING_WAYPATH_01_JDG)//you've reached your final guard spot--goto stationary
  1228. {
  1229. Commands->Attach_Script(obj, "M01_Hunt_The_Player_JDG", "");
  1230. //Commands->Set_Innate_Is_Stationary ( obj, true );
  1231. }
  1232. }
  1233. };
  1234. DECLARE_SCRIPT(M04_CargoHold_TalkGuy01_JDG, "")//M04_CARGO_TALKGUY_01_JDG 101463
  1235. {
  1236. void Created( GameObject * obj )
  1237. {
  1238. Commands->Set_Innate_Is_Stationary ( obj, true );
  1239. }
  1240. void Killed( GameObject * obj, GameObject * killer )
  1241. {
  1242. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1243. if (blackhand != NULL)
  1244. {
  1245. Commands->Send_Custom_Event ( obj, blackhand, 0, M01_START_ATTACKING_01_JDG, 0.5f );
  1246. }
  1247. }
  1248. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1249. {
  1250. ActionParamsStruct params;
  1251. if (type == 0)
  1252. {
  1253. if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been ragged on--salute then carry on
  1254. {
  1255. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1256. if (blackhand != NULL)
  1257. {
  1258. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  1259. params.Set_Attack( blackhand, 0, 0, true );
  1260. Commands->Action_Attack ( obj, params );
  1261. float delayTimer = Commands->Get_Random ( 0, 1 );
  1262. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1263. }
  1264. }
  1265. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)
  1266. {
  1267. params.Set_Basic(this, 100, M01_DOING_ANIMATION_01_JDG);
  1268. params.Set_Animation("H_A_J19A", false );
  1269. Commands->Action_Play_Animation ( obj, params );
  1270. }
  1271. }
  1272. }
  1273. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  1274. {
  1275. ActionParamsStruct params;
  1276. Vector3 myGotoSpot (-9.192f, 15.344f, -8.998f);
  1277. if (complete_reason == ACTION_COMPLETE_NORMAL)
  1278. {
  1279. if (action_id == M01_DOING_ANIMATION_01_JDG)
  1280. {
  1281. params.Set_Basic(this, 100, M01_DOING_ANIMATION_02_JDG);
  1282. params.Set_Animation("H_A_J19S", false );
  1283. Commands->Action_Play_Animation ( obj, params );
  1284. }
  1285. else if (action_id == M01_DOING_ANIMATION_02_JDG)
  1286. {
  1287. params.Set_Basic(this, 100, M01_DOING_ANIMATION_03_JDG);
  1288. params.Set_Animation("H_A_J19C", false );
  1289. Commands->Action_Play_Animation ( obj, params );
  1290. }
  1291. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1292. {
  1293. Commands->Set_Innate_Is_Stationary ( obj, false );
  1294. params.Set_Basic(this, 80, M01_WALKING_WAYPATH_01_JDG);
  1295. params.Set_Movement( myGotoSpot, WALK, 3, false );
  1296. Commands->Action_Goto ( obj, params );
  1297. }
  1298. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1299. {
  1300. Commands->Set_Innate_Soldier_Home_Location ( obj, myGotoSpot, 10 );
  1301. }
  1302. }
  1303. }
  1304. };
  1305. DECLARE_SCRIPT(M04_CargoHold_TalkGuy02_JDG, "")//M04_CARGO_TALKGUY_02_JDG 101464
  1306. {
  1307. void Created( GameObject * obj )
  1308. {
  1309. Commands->Set_Innate_Is_Stationary ( obj, true );
  1310. }
  1311. void Killed( GameObject * obj, GameObject * killer )
  1312. {
  1313. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1314. if (blackhand != NULL)
  1315. {
  1316. Commands->Send_Custom_Event ( obj, blackhand, 0, M01_START_ATTACKING_01_JDG, 0.5f );
  1317. }
  1318. }
  1319. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1320. {
  1321. ActionParamsStruct params;
  1322. if (type == 0)
  1323. {
  1324. if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been ragged on--salute then carry on
  1325. {
  1326. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1327. if (blackhand != NULL)
  1328. {
  1329. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  1330. params.Set_Attack( blackhand, 0, 0, true );
  1331. Commands->Action_Attack ( obj, params );
  1332. float delayTimer = Commands->Get_Random ( 0, 1 );
  1333. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1334. }
  1335. }
  1336. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)
  1337. {
  1338. params.Set_Basic(this, 100, M01_DOING_ANIMATION_01_JDG);
  1339. params.Set_Animation("H_A_J19A", false );
  1340. Commands->Action_Play_Animation ( obj, params );
  1341. }
  1342. }
  1343. }
  1344. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  1345. {
  1346. ActionParamsStruct params;
  1347. Vector3 myGotoSpot (11.168f, 19.847f, -15);
  1348. if (complete_reason == ACTION_COMPLETE_NORMAL)
  1349. {
  1350. if (action_id == M01_DOING_ANIMATION_01_JDG)
  1351. {
  1352. params.Set_Basic(this, 100, M01_DOING_ANIMATION_02_JDG);
  1353. params.Set_Animation("H_A_J19S", false );
  1354. Commands->Action_Play_Animation ( obj, params );
  1355. }
  1356. else if (action_id == M01_DOING_ANIMATION_02_JDG)
  1357. {
  1358. params.Set_Basic(this, 100, M01_DOING_ANIMATION_03_JDG);
  1359. params.Set_Animation("H_A_J19C", false );
  1360. Commands->Action_Play_Animation ( obj, params );
  1361. }
  1362. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1363. {
  1364. Commands->Set_Innate_Is_Stationary ( obj, false );
  1365. params.Set_Basic(this, 80, M01_WALKING_WAYPATH_01_JDG);
  1366. params.Set_Movement( myGotoSpot, WALK, 3, false );
  1367. Commands->Action_Goto ( obj, params );
  1368. }
  1369. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1370. {
  1371. Commands->Set_Innate_Soldier_Home_Location ( obj, myGotoSpot, 10 );
  1372. }
  1373. }
  1374. }
  1375. };
  1376. DECLARE_SCRIPT(M04_CargoHold_TalkGuy03_JDG, "")//M04_CARGO_TALKGUY_03_JDG 101465
  1377. {
  1378. void Created( GameObject * obj )
  1379. {
  1380. Commands->Set_Innate_Is_Stationary ( obj, true );
  1381. GameObject *guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1382. if (guardOne != NULL)
  1383. {
  1384. ActionParamsStruct params;
  1385. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  1386. params.Set_Attack( guardOne, 0, 0, true );
  1387. Commands->Action_Attack ( obj, params );
  1388. }
  1389. }
  1390. void Killed( GameObject * obj, GameObject * killer )
  1391. {
  1392. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1393. if (blackhand != NULL)
  1394. {
  1395. Commands->Send_Custom_Event ( obj, blackhand, 0, M01_START_ATTACKING_01_JDG, 0.5f );
  1396. }
  1397. }
  1398. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1399. {
  1400. ActionParamsStruct params;
  1401. if (type == 0)
  1402. {
  1403. if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been ragged on--salute then carry on
  1404. {
  1405. GameObject *blackhand = Commands->Find_Object ( M04_CARGO_BLACKHAND_01_JDG );
  1406. if (blackhand != NULL)
  1407. {
  1408. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  1409. params.Set_Attack( blackhand, 0, 0, true );
  1410. Commands->Action_Attack ( obj, params );
  1411. float delayTimer = Commands->Get_Random ( 0, 1 );
  1412. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1413. }
  1414. }
  1415. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)
  1416. {
  1417. params.Set_Basic(this, 100, M01_DOING_ANIMATION_01_JDG);
  1418. params.Set_Animation("H_A_J19A", false );
  1419. Commands->Action_Play_Animation ( obj, params );
  1420. }
  1421. }
  1422. }
  1423. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  1424. {
  1425. ActionParamsStruct params;
  1426. Vector3 myGotoSpot (-0.099f, -71.767f, -15);
  1427. if (complete_reason == ACTION_COMPLETE_NORMAL)
  1428. {
  1429. if (action_id == M01_DOING_ANIMATION_01_JDG)
  1430. {
  1431. params.Set_Basic(this, 100, M01_DOING_ANIMATION_02_JDG);
  1432. params.Set_Animation("H_A_J19S", false );
  1433. Commands->Action_Play_Animation ( obj, params );
  1434. }
  1435. else if (action_id == M01_DOING_ANIMATION_02_JDG)
  1436. {
  1437. params.Set_Basic(this, 100, M01_DOING_ANIMATION_03_JDG);
  1438. params.Set_Animation("H_A_J19C", false );
  1439. Commands->Action_Play_Animation ( obj, params );
  1440. }
  1441. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1442. {
  1443. Commands->Set_Innate_Is_Stationary ( obj, false );
  1444. params.Set_Basic(this, 80, M01_WALKING_WAYPATH_01_JDG);
  1445. params.Set_Movement( myGotoSpot, WALK, 3, false );
  1446. Commands->Action_Goto ( obj, params );
  1447. }
  1448. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  1449. {
  1450. Commands->Set_Innate_Soldier_Home_Location ( obj, myGotoSpot, 10 );
  1451. }
  1452. }
  1453. }
  1454. };
  1455. DECLARE_SCRIPT(M04_MissileRoom_Guard_01_JDG, "")
  1456. {
  1457. int curr_action_id;
  1458. REGISTER_VARIABLES()
  1459. {
  1460. SAVE_VARIABLE( curr_action_id, 1 );
  1461. }
  1462. void Created( GameObject * obj )
  1463. {
  1464. ActionParamsStruct params;
  1465. curr_action_id = 100;
  1466. params.Set_Basic( this, 45, curr_action_id );
  1467. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1468. params.WaypathID = 100555;
  1469. params.WaypointStartID = 100556;
  1470. params.WaypointEndID = 100557;
  1471. Commands->Action_Goto( obj, params );
  1472. }
  1473. void Killed( GameObject * obj, GameObject * killer )
  1474. {
  1475. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 300, 0 );//tell controller youre dead
  1476. }
  1477. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1478. {
  1479. ActionParamsStruct params;
  1480. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  1481. {
  1482. char *animationName = M01_Choose_Idle_Animation ( );
  1483. curr_action_id++;
  1484. params.Set_Basic( this, 45, curr_action_id );
  1485. params.Set_Animation (animationName, false);
  1486. Commands->Action_Play_Animation (obj, params);
  1487. }
  1488. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  1489. {
  1490. curr_action_id++;
  1491. params.Set_Basic( this, 45, curr_action_id );
  1492. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1493. params.WaypathID = 100541;
  1494. params.WaypointStartID = 100542;
  1495. params.WaypointEndID = 100544;
  1496. Commands->Action_Goto( obj, params );
  1497. }
  1498. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  1499. {
  1500. char *animationName = M01_Choose_Idle_Animation ( );
  1501. curr_action_id++;
  1502. params.Set_Basic( this, 45, curr_action_id );
  1503. params.Set_Animation (animationName, false);
  1504. Commands->Action_Play_Animation (obj, params);
  1505. }
  1506. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  1507. {
  1508. curr_action_id++;
  1509. params.Set_Basic( this, 45, curr_action_id );
  1510. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1511. params.WaypathID = 100546;
  1512. params.WaypointStartID = 100547;
  1513. params.WaypointEndID = 100548;
  1514. Commands->Action_Goto( obj, params );
  1515. }
  1516. else if (action_id == 104 && complete_reason == ACTION_COMPLETE_NORMAL)
  1517. {
  1518. char *animationName = M01_Choose_Idle_Animation ( );
  1519. curr_action_id++;
  1520. params.Set_Basic( this, 45, curr_action_id );
  1521. params.Set_Animation (animationName, false);
  1522. Commands->Action_Play_Animation (obj, params);
  1523. }
  1524. else if (action_id == 105 && complete_reason == ACTION_COMPLETE_NORMAL)
  1525. {
  1526. curr_action_id++;
  1527. params.Set_Basic( this, 45, curr_action_id );
  1528. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1529. params.WaypathID = 100550;
  1530. params.WaypointStartID = 100551;
  1531. params.WaypointEndID = 100553;
  1532. Commands->Action_Goto( obj, params );
  1533. }
  1534. else if (action_id == 106 && complete_reason == ACTION_COMPLETE_NORMAL)
  1535. {
  1536. char *animationName = M01_Choose_Idle_Animation ( );
  1537. curr_action_id++;
  1538. params.Set_Basic( this, 45, curr_action_id );
  1539. params.Set_Animation (animationName, false);
  1540. Commands->Action_Play_Animation (obj, params);
  1541. }
  1542. else if (action_id == 107 && complete_reason == ACTION_COMPLETE_NORMAL)
  1543. {
  1544. curr_action_id = 100;
  1545. params.Set_Basic( this, 45, curr_action_id );
  1546. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1547. params.WaypathID = 100555;
  1548. params.WaypointStartID = 100556;
  1549. params.WaypointEndID = 100557;
  1550. Commands->Action_Goto( obj, params );
  1551. }
  1552. }
  1553. };
  1554. DECLARE_SCRIPT(M04_MissileRoom_Guard_02_JDG, "")
  1555. {
  1556. int curr_action_id;
  1557. REGISTER_VARIABLES()
  1558. {
  1559. SAVE_VARIABLE( curr_action_id, 1 );
  1560. }
  1561. void Created( GameObject * obj )
  1562. {
  1563. ActionParamsStruct params;
  1564. curr_action_id = 100;
  1565. params.Set_Basic( this, 45, curr_action_id );
  1566. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1567. params.WaypathID = 100546;
  1568. params.WaypointStartID = 100547;
  1569. params.WaypointEndID = 100548;
  1570. Commands->Action_Goto( obj, params );
  1571. }
  1572. void Killed( GameObject * obj, GameObject * killer )
  1573. {
  1574. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 300, 0 );//tell controller you're dead
  1575. }
  1576. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1577. {
  1578. ActionParamsStruct params;
  1579. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  1580. {
  1581. char *animationName = M01_Choose_Idle_Animation ( );
  1582. curr_action_id++;
  1583. params.Set_Basic( this, 45, curr_action_id );
  1584. params.Set_Animation (animationName, false);
  1585. Commands->Action_Play_Animation (obj, params);
  1586. }
  1587. if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  1588. {
  1589. curr_action_id++;
  1590. params.Set_Basic( this, 45, curr_action_id );
  1591. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1592. params.WaypathID = 100550;
  1593. params.WaypointStartID = 100551;
  1594. params.WaypointEndID = 100553;
  1595. Commands->Action_Goto( obj, params );
  1596. }
  1597. if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  1598. {
  1599. char *animationName = M01_Choose_Idle_Animation ( );
  1600. curr_action_id++;
  1601. params.Set_Basic( this, 50, curr_action_id );
  1602. params.Set_Animation (animationName, false);
  1603. Commands->Action_Play_Animation (obj, params);
  1604. }
  1605. if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  1606. {
  1607. curr_action_id++;
  1608. params.Set_Basic( this, 45, curr_action_id );
  1609. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1610. params.WaypathID = 100555;
  1611. params.WaypointStartID = 100556;
  1612. params.WaypointEndID = 100557;
  1613. Commands->Action_Goto( obj, params );
  1614. }
  1615. if (action_id == 104 && complete_reason == ACTION_COMPLETE_NORMAL)
  1616. {
  1617. char *animationName = M01_Choose_Idle_Animation ( );
  1618. curr_action_id++;
  1619. params.Set_Basic( this, 45, curr_action_id );
  1620. params.Set_Animation (animationName, false);
  1621. Commands->Action_Play_Animation (obj, params);
  1622. }
  1623. if (action_id == 105 && complete_reason == ACTION_COMPLETE_NORMAL)
  1624. {
  1625. curr_action_id++;
  1626. params.Set_Basic( this, 45, curr_action_id );
  1627. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1628. params.WaypathID = 100541;
  1629. params.WaypointStartID = 100542;
  1630. params.WaypointEndID = 100544;
  1631. Commands->Action_Goto( obj, params );
  1632. }
  1633. if (action_id == 106 && complete_reason == ACTION_COMPLETE_NORMAL)
  1634. {
  1635. char *animationName = M01_Choose_Idle_Animation ( );
  1636. curr_action_id++;
  1637. params.Set_Basic( this, 45, curr_action_id );
  1638. params.Set_Animation (animationName, false);
  1639. Commands->Action_Play_Animation (obj, params);
  1640. }
  1641. if (action_id == 107 && complete_reason == ACTION_COMPLETE_NORMAL)
  1642. {
  1643. curr_action_id = 100;
  1644. params.Set_Basic( this, 45, curr_action_id );
  1645. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1646. params.WaypathID = 100546;
  1647. params.WaypointStartID = 100547;
  1648. params.WaypointEndID = 100548;
  1649. Commands->Action_Goto( obj, params );
  1650. }
  1651. }
  1652. };
  1653. DECLARE_SCRIPT(M04_CargoHold_Blackhand_01_JDG, "")//M04_CARGO_BLACKHAND_01_JDG 101534
  1654. {
  1655. int cargo_conv2;
  1656. bool idle;
  1657. REGISTER_VARIABLES()
  1658. {
  1659. SAVE_VARIABLE( cargo_conv2, 1 );
  1660. SAVE_VARIABLE( idle, 2 );
  1661. }
  1662. void Created( GameObject * obj )
  1663. {
  1664. Commands->Set_Innate_Is_Stationary ( obj, true );
  1665. idle = true;
  1666. }
  1667. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1668. {
  1669. ActionParamsStruct params;
  1670. if (type == 0)
  1671. {
  1672. if (param == M01_START_ACTING_JDG)
  1673. {
  1674. idle = false;
  1675. Commands->Action_Reset ( obj, 100 );
  1676. Commands->Set_Innate_Is_Stationary ( obj, false );
  1677. GameObject *guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1678. if (guardOne != NULL)
  1679. {
  1680. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  1681. params.Set_Movement( guardOne, WALK, 3.0f );
  1682. Commands->Action_Goto( obj, params );
  1683. }
  1684. else
  1685. {
  1686. Vector3 myPosition = Commands->Get_Position ( obj );
  1687. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 20 );
  1688. }
  1689. }
  1690. else if (param == M01_START_ATTACKING_01_JDG && idle == true)
  1691. {
  1692. idle = false;
  1693. Commands->Action_Reset ( obj, 100 );
  1694. Commands->Set_Innate_Is_Stationary ( obj, false );
  1695. params.Set_Basic( this, 75, M01_WALKING_WAYPATH_03_JDG );
  1696. params.Set_Movement( STAR, RUN, 1 );
  1697. Commands->Action_Goto( obj, params );
  1698. }
  1699. }
  1700. }
  1701. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  1702. {
  1703. ActionParamsStruct params;
  1704. if (complete_reason == ACTION_COMPLETE_NORMAL)
  1705. {
  1706. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  1707. {
  1708. /*GameObject *guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1709. if (guardOne != NULL)
  1710. {
  1711. cargo_conv2 = Commands->Create_Conversation( "M04_CargoHold_Conversation_02", 50, 1000, true);
  1712. Commands->Join_Conversation( obj, cargo_conv2, false, false );
  1713. Commands->Join_Conversation( guardOne, cargo_conv2, false, false );
  1714. Commands->Start_Conversation( cargo_conv2, cargo_conv2 );
  1715. Commands->Monitor_Conversation( obj, cargo_conv2);
  1716. }*/
  1717. }
  1718. else if (action_id == M01_WALKING_WAYPATH_02_JDG)
  1719. {
  1720. Vector3 myPosition = Commands->Get_Position ( obj );
  1721. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 20 );
  1722. }
  1723. }
  1724. else if (complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  1725. {
  1726. if (action_id == cargo_conv2)
  1727. {
  1728. GameObject *guardOne = Commands->Find_Object ( M04_CARGO_TALKGUY_01_JDG );
  1729. GameObject *guardTwo = Commands->Find_Object ( M04_CARGO_TALKGUY_02_JDG );
  1730. GameObject *guardThree = Commands->Find_Object ( M04_CARGO_TALKGUY_03_JDG );
  1731. if (guardOne != NULL)
  1732. {
  1733. float delayTimer = Commands->Get_Random ( 0, 1 );
  1734. Commands->Send_Custom_Event ( obj, guardOne, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  1735. }
  1736. if (guardTwo != NULL)
  1737. {
  1738. float delayTimer = Commands->Get_Random ( 0, 1 );
  1739. Commands->Send_Custom_Event ( obj, guardTwo, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  1740. }
  1741. if (guardThree != NULL)
  1742. {
  1743. float delayTimer = Commands->Get_Random ( 0, 1 );
  1744. Commands->Send_Custom_Event ( obj, guardThree, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  1745. }
  1746. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  1747. params.Set_Movement( Vector3 (10.075f, -44.802f, -15), WALK, 1.5f );
  1748. Commands->Action_Goto( obj, params );
  1749. }
  1750. }
  1751. }
  1752. };
  1753. DECLARE_SCRIPT(M04_CargoHold_Blackhand_02_JDG, "")
  1754. {
  1755. int curr_action_id;
  1756. REGISTER_VARIABLES()
  1757. {
  1758. SAVE_VARIABLE( curr_action_id, 1 );
  1759. }
  1760. void Created( GameObject * obj )
  1761. {
  1762. ActionParamsStruct params;
  1763. curr_action_id = 100;
  1764. params.Set_Basic( this, 45, curr_action_id );
  1765. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1766. params.WaypathID = 101018;
  1767. params.WaypointStartID = 101019;
  1768. params.WaypointEndID = 101022;
  1769. Commands->Action_Goto( obj, params );
  1770. }
  1771. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1772. {
  1773. ActionParamsStruct params;
  1774. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  1775. {
  1776. char *animationName = M01_Choose_Idle_Animation ( );
  1777. curr_action_id++;
  1778. params.Set_Basic( this, 45, curr_action_id );
  1779. params.Set_Animation (animationName, false);
  1780. Commands->Action_Play_Animation (obj, params);
  1781. }
  1782. if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  1783. {
  1784. curr_action_id++;
  1785. params.Set_Basic( this, 45, curr_action_id );
  1786. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1787. params.WaypathID = 101024;
  1788. params.WaypointStartID = 101025;
  1789. params.WaypointEndID = 101028;
  1790. Commands->Action_Goto( obj, params );
  1791. }
  1792. if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  1793. {
  1794. char *animationName = M01_Choose_Idle_Animation ( );
  1795. curr_action_id++;
  1796. params.Set_Basic( this, 45, curr_action_id );
  1797. params.Set_Animation (animationName, false);
  1798. Commands->Action_Play_Animation (obj, params);
  1799. }
  1800. if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  1801. {
  1802. curr_action_id++;
  1803. params.Set_Basic( this, 45, curr_action_id );
  1804. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1805. params.WaypathID = 101024;
  1806. params.WaypointStartID = 101028;
  1807. params.WaypointEndID = 101025;
  1808. Commands->Action_Goto( obj, params );
  1809. }
  1810. if (action_id == 104 && complete_reason == ACTION_COMPLETE_NORMAL)
  1811. {
  1812. char *animationName = M01_Choose_Idle_Animation ( );
  1813. curr_action_id++;
  1814. params.Set_Basic( this, 45, curr_action_id );
  1815. params.Set_Animation (animationName, false);
  1816. Commands->Action_Play_Animation (obj, params);
  1817. }
  1818. if (action_id == 105 && complete_reason == ACTION_COMPLETE_NORMAL)
  1819. {
  1820. curr_action_id = 100;
  1821. params.Set_Basic( this, 45, curr_action_id );
  1822. params.Set_Movement( Vector3(0,0,0), .20f, 1.5f );
  1823. params.WaypathID = 101018;
  1824. params.WaypointStartID = 101022;
  1825. params.WaypointEndID = 101019;
  1826. Commands->Action_Goto( obj, params );
  1827. }
  1828. }
  1829. };
  1830. /****************************************************************************************************************
  1831. The following scripts deal with the engine room--first time through
  1832. ****************************************************************************************************************/
  1833. DECLARE_SCRIPT(M04_EngineRoom_EnterZone_JDG, "")
  1834. {
  1835. void Entered( GameObject * obj, GameObject * enterer )
  1836. {
  1837. if ( enterer == STAR )
  1838. {
  1839. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 430, 0 );//tell objective controller to announce objective
  1840. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 700, 0 );//tell cargo/missile contoller to turn off spawners
  1841. GameObject * zone01 = Commands->Find_Object (100425);//stays
  1842. if (zone01 != NULL)
  1843. {
  1844. Commands->Destroy_Object ( zone01 );
  1845. }
  1846. GameObject * zone04 = Commands->Find_Object (100428);//stays
  1847. if (zone04 != NULL)
  1848. {
  1849. Commands->Destroy_Object ( zone04 );
  1850. }
  1851. }
  1852. }
  1853. };
  1854. DECLARE_SCRIPT(M04_EngineRoom_BuildingController_JDG, "")//M04_ENGINEROOM_BUILDING_CONTROLLER_JDG 150001
  1855. {
  1856. int targetsDestroyed;
  1857. int engineroom_sound01;
  1858. int engineroom_sound02;
  1859. int engineroom_sound03;
  1860. int engineroom_sound04;
  1861. int engineroom_sound05;
  1862. int engineroom_sound06;
  1863. int engineroom_sound07;
  1864. int engineroom_sound08;
  1865. int engineroom_sound09;
  1866. int engineroom_sound10;
  1867. int engineroom_sound11;
  1868. int engineroom_sound12;
  1869. int engineroom_sound13;
  1870. int engineroom_sound14;
  1871. REGISTER_VARIABLES()
  1872. {
  1873. SAVE_VARIABLE( targetsDestroyed, 1 );
  1874. SAVE_VARIABLE( engineroom_sound01, 2 );
  1875. SAVE_VARIABLE( engineroom_sound02, 3 );
  1876. SAVE_VARIABLE( engineroom_sound03, 4 );
  1877. SAVE_VARIABLE( engineroom_sound04, 5 );
  1878. SAVE_VARIABLE( engineroom_sound05, 6 );
  1879. SAVE_VARIABLE( engineroom_sound06, 7 );
  1880. SAVE_VARIABLE( engineroom_sound07, 8 );
  1881. SAVE_VARIABLE( engineroom_sound08, 9 );
  1882. SAVE_VARIABLE( engineroom_sound09, 10 );
  1883. SAVE_VARIABLE( engineroom_sound10, 11 );
  1884. SAVE_VARIABLE( engineroom_sound11, 12 );
  1885. SAVE_VARIABLE( engineroom_sound12, 13 );
  1886. SAVE_VARIABLE( engineroom_sound13, 14 );
  1887. SAVE_VARIABLE( engineroom_sound14, 15 );
  1888. }
  1889. void Created( GameObject * obj )
  1890. {
  1891. targetsDestroyed = 0;
  1892. engineroom_sound01 = Commands->Create_Sound ( "SFX.Machine_Turbine_01", Vector3 (5.970f, -104.759f, -15.143f), obj );
  1893. engineroom_sound02 = Commands->Create_Sound ( "SFX.Machine_Turbine_01_offset2", Vector3 (-6.021f, -104.445f, -15.157f), obj );
  1894. engineroom_sound03 = Commands->Create_Sound ( "SFX.Ship_Amb_Engineroom", Vector3 (-0.942f, -74.017f, -11.840f), obj );
  1895. engineroom_sound04 = Commands->Create_Sound ( "SFX.Steam_Med_Pressure_01_offset1", Vector3 (-9.838f, -76.426f, -13.498f), obj );
  1896. engineroom_sound05 = Commands->Create_Sound ( "Ship_Engine_01", Vector3 (-10.846f, -94.205f, -13.432f), obj );
  1897. engineroom_sound06 = Commands->Create_Sound ( "Ship_Engine_01", Vector3 (0.359f, -131.034f, 2.580f), obj );
  1898. engineroom_sound07 = Commands->Create_Sound ( "Ship_Engine_01_offset1", Vector3 (9.045f, -96.538f, -13.366f), obj );
  1899. engineroom_sound08 = Commands->Create_Sound ( "Ship_Engine_02", Vector3 (9.192f, -89.680f, -12.902f), obj );
  1900. engineroom_sound09 = Commands->Create_Sound ( "Ship_Engine_02", Vector3 (3.033f, -92.739f, 16.208f), obj );
  1901. engineroom_sound10 = Commands->Create_Sound ( "Ship_Engine_03", Vector3 (-5.870f, -84.200f, -13.423f), obj );
  1902. engineroom_sound11 = Commands->Create_Sound ( "Ship_Engine_03", Vector3 (7.588f, -83.956f, -13.481f), obj );
  1903. engineroom_sound12 = Commands->Create_Sound ( "Steam_Med_Pressure_01", Vector3 (9.726f, -78.736f, -14.079f), obj );
  1904. engineroom_sound13 = Commands->Create_Sound ( "SFX.Machine_Turbine_01", Vector3 (-0.757f, -60.372f, -7.924f), obj );
  1905. engineroom_sound14 = Commands->Create_Sound ( "Roomtone_Industrial_04_verb", Vector3 (8.568f, -67.182f, -6.454f), obj );
  1906. }
  1907. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1908. {
  1909. if (type == 0)
  1910. {
  1911. if (param == M01_IVE_BEEN_KILLED_JDG)
  1912. {
  1913. targetsDestroyed++;
  1914. if (targetsDestroyed == 4)
  1915. {
  1916. Commands->Stop_Sound ( engineroom_sound01, true);
  1917. Commands->Stop_Sound ( engineroom_sound02, true);
  1918. Commands->Stop_Sound ( engineroom_sound03, true);
  1919. Commands->Stop_Sound ( engineroom_sound04, true);
  1920. Commands->Stop_Sound ( engineroom_sound05, true);
  1921. Commands->Stop_Sound ( engineroom_sound06, true);
  1922. Commands->Stop_Sound ( engineroom_sound07, true);
  1923. Commands->Stop_Sound ( engineroom_sound08, true);
  1924. Commands->Stop_Sound ( engineroom_sound09, true);
  1925. Commands->Stop_Sound ( engineroom_sound10, true);
  1926. Commands->Stop_Sound ( engineroom_sound11, true);
  1927. Commands->Stop_Sound ( engineroom_sound12, true);
  1928. Commands->Stop_Sound ( engineroom_sound13, true);
  1929. Commands->Stop_Sound ( engineroom_sound14, true);
  1930. engineroom_sound01 = Commands->Create_Sound ( "SFX.Klaxon_Alert_02", Vector3 (-2.309f, -94.553f, -11.050f), obj );
  1931. engineroom_sound02 = Commands->Create_Sound ( "SFX.Klaxon_Alert_04", Vector3 (-0.715f, -88.220f, -10.745f), obj );
  1932. engineroom_sound03 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_01", Vector3 (9.731f, -95.172f, -11.028f), obj );
  1933. engineroom_sound04 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_01", Vector3 (-2.976f, -91.511f, -12.275f), obj );
  1934. engineroom_sound05 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_02", Vector3 (3.918f, -84.200f, -11.625f), obj );
  1935. engineroom_sound06 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_02", Vector3 (-9.033f, -96.617f, -12.678f), obj );
  1936. engineroom_sound07 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_03", Vector3 (2.750f, -93.408f, -12.047f), obj );
  1937. engineroom_sound08 = Commands->Create_Sound ( "SFX.Ship_Engine_Broken_03", Vector3 (-7.275f, -83.744f, -12.941f), obj );
  1938. engineroom_sound09 = Commands->Create_Sound ( "Ship_Engine_01", Vector3 (6.854f, -75.227f, -14.270f), obj );
  1939. engineroom_sound10 = Commands->Create_Sound ( "Ship_Engine_02", Vector3 (-9.464f, -76.808f, -15.745f), obj );
  1940. Commands->Debug_Message ( "**********************all engine room targets destroyed--applying damage to engine room\n" );
  1941. //Commands->Set_Health ( obj, 1 );
  1942. Commands->Apply_Damage( obj, 1000, "BlamoKiller", STAR );
  1943. Commands->Create_2D_Sound ( "SFX.Ship_Engine_Stop" );
  1944. //Commands->Create_2D_Sound ( "M04_EngineRoom_Alarm" );
  1945. Commands->Enable_Spawner( M04_ENGINEROOM_SPAWNER_01_JDG, true );
  1946. Commands->Enable_Spawner( M04_ENGINEROOM_SPAWNER_02_JDG, true );
  1947. GameObject * engineer = Commands->Find_Object ( M04_ENGINEROOM_CHIEF_ENGINEER_JDG );
  1948. GameObject * jimmy = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  1949. GameObject * johnny = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  1950. GameObject * bobby = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  1951. GameObject * williams = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);//M01_MODIFY_YOUR_ACTION_02_JDG
  1952. if (engineer != NULL)
  1953. {
  1954. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  1955. Commands->Send_Custom_Event ( obj, engineer, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  1956. }
  1957. if (jimmy != NULL)
  1958. {
  1959. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  1960. Commands->Send_Custom_Event ( obj, jimmy, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1961. }
  1962. if (johnny != NULL)
  1963. {
  1964. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  1965. Commands->Send_Custom_Event ( obj, johnny, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1966. }
  1967. if (bobby != NULL)
  1968. {
  1969. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  1970. Commands->Send_Custom_Event ( obj, bobby, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1971. }
  1972. if (williams != NULL)
  1973. {
  1974. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  1975. Commands->Send_Custom_Event ( obj, williams, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  1976. }
  1977. GameObject* guard01 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_01_JDG );
  1978. if (guard01 != NULL)
  1979. {
  1980. Commands->Send_Custom_Event( obj, guard01, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  1981. }
  1982. GameObject* guard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  1983. if (guard02 != NULL)
  1984. {
  1985. Commands->Send_Custom_Event( obj, guard02, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  1986. }
  1987. GameObject* hunterController = Commands->Find_Object ( M04_ENGINEROOM_HUNTING_CONTROLLER_JDG );
  1988. if (hunterController != NULL)
  1989. {
  1990. Commands->Send_Custom_Event( obj, hunterController, 0, M01_START_ACTING_JDG, 0 );
  1991. }
  1992. }
  1993. }
  1994. }
  1995. }
  1996. };
  1997. DECLARE_SCRIPT(M04_EngineRoom_ChiefEngineer_JDG, "")// M04_ENGINEROOM_CHIEF_ENGINEER_JDG 101762
  1998. {
  1999. typedef enum {
  2000. IDLE,
  2001. GOING_TO_WILLIAMS_01,
  2002. GOING_TO_BOBBY_01,
  2003. GOING_TO_JIMMY_01,
  2004. GOING_TO_JOHNNY,
  2005. GOING_TO_BOBBY_02,
  2006. GOING_TO_JIMMY_02,
  2007. GOING_TO_WILLIAMS_02,
  2008. ALERTED,
  2009. FINISHED,
  2010. } M04EngineRoom_Location;
  2011. M04EngineRoom_Location chiefs_location;
  2012. bool williams_is_dead;
  2013. bool bobby_is_dead;
  2014. bool johnny_is_dead;
  2015. bool jimmy_is_dead;
  2016. REGISTER_VARIABLES()
  2017. {
  2018. SAVE_VARIABLE( williams_is_dead, 1 );
  2019. SAVE_VARIABLE( bobby_is_dead, 2 );
  2020. SAVE_VARIABLE( johnny_is_dead, 3 );
  2021. SAVE_VARIABLE( jimmy_is_dead, 4 );
  2022. SAVE_VARIABLE( chiefs_location, 5 );
  2023. }
  2024. void Created( GameObject * obj )
  2025. {
  2026. williams_is_dead = false;
  2027. bobby_is_dead = false;
  2028. johnny_is_dead = false;
  2029. jimmy_is_dead = false;
  2030. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  2031. chiefs_location = IDLE;
  2032. Commands->Send_Custom_Event( obj, obj, 0, M01_PICK_A_NEW_LOCATION_JDG, 1 );
  2033. }
  2034. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2035. {
  2036. ActionParamsStruct params;
  2037. if (type == 0)
  2038. {
  2039. if (param == M01_IVE_BEEN_KILLED_JDG)
  2040. {
  2041. GameObject * jimmy = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  2042. GameObject * johnny = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  2043. GameObject * bobby = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  2044. GameObject * williams = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);
  2045. if (sender == jimmy)
  2046. {
  2047. jimmy_is_dead = true;
  2048. }
  2049. else if (sender == johnny)
  2050. {
  2051. johnny_is_dead = true;
  2052. }
  2053. else if (sender == bobby)
  2054. {
  2055. bobby_is_dead = true;
  2056. }
  2057. else if (sender == williams)
  2058. {
  2059. williams_is_dead = true;
  2060. }
  2061. }
  2062. else if (param == M01_MODIFY_YOUR_ACTION_JDG)//someone's missing--look around then goto innate
  2063. {
  2064. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  2065. params.Set_Animation( "H_A_J21C", false );
  2066. Commands->Action_Play_Animation ( obj, params );
  2067. chiefs_location = ALERTED;
  2068. }
  2069. else if (param == M01_PICK_A_NEW_LOCATION_JDG)
  2070. {
  2071. Vector3 jimmys_location (7.6f, -107.2f, -15);
  2072. Vector3 johnnys_location (-2.5f, -102.8f, -15);
  2073. Vector3 bobbys_location (-0.6f, -74.4f, -18);
  2074. Vector3 williams_location (5.8f, -82, -18);
  2075. if (chiefs_location == IDLE)
  2076. {
  2077. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2078. params.Set_Movement( williams_location, WALK, 0.5f );
  2079. Commands->Action_Goto( obj, params );
  2080. chiefs_location = GOING_TO_WILLIAMS_01;
  2081. }
  2082. else if (chiefs_location == GOING_TO_WILLIAMS_01)
  2083. {
  2084. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2085. params.Set_Movement( bobbys_location, WALK, 0.5f );
  2086. Commands->Action_Goto( obj, params );
  2087. chiefs_location = GOING_TO_BOBBY_01;
  2088. }
  2089. else if (chiefs_location == GOING_TO_BOBBY_01)
  2090. {
  2091. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2092. params.Set_Movement( jimmys_location, WALK, 0.5f );
  2093. Commands->Action_Goto( obj, params );
  2094. chiefs_location = GOING_TO_JIMMY_01;
  2095. }
  2096. else if (chiefs_location == GOING_TO_JIMMY_01)
  2097. {
  2098. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2099. params.Set_Movement( johnnys_location, WALK, 0.5f );
  2100. Commands->Action_Goto( obj, params );
  2101. chiefs_location = GOING_TO_JOHNNY;
  2102. }
  2103. else if (chiefs_location == GOING_TO_JOHNNY)
  2104. {
  2105. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2106. params.Set_Movement( bobbys_location, WALK, 0.5f );
  2107. Commands->Action_Goto( obj, params );
  2108. chiefs_location = GOING_TO_BOBBY_02;
  2109. }
  2110. else if (chiefs_location == GOING_TO_BOBBY_02)
  2111. {
  2112. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_01_JDG );
  2113. params.Set_Movement( jimmys_location, WALK, 0.5f );
  2114. Commands->Action_Goto( obj, params );
  2115. chiefs_location = GOING_TO_JIMMY_02;
  2116. }
  2117. else if (chiefs_location == GOING_TO_JIMMY_02)
  2118. {
  2119. params.Set_Basic( this, 100, M01_WALKING_WAYPATH_01_JDG );
  2120. params.Set_Movement( williams_location, WALK, 0.5f );
  2121. Commands->Action_Goto( obj, params );
  2122. chiefs_location = GOING_TO_WILLIAMS_02;
  2123. }
  2124. else if (chiefs_location == GOING_TO_WILLIAMS_02)
  2125. {
  2126. Vector3 gotoPosition (-0.82f, -91.56f, -15);
  2127. params.Set_Basic( this, 50, M01_WALKING_WAYPATH_02_JDG );
  2128. params.Set_Movement( gotoPosition, WALK, 0.5f );
  2129. Commands->Action_Goto( obj, params );
  2130. chiefs_location = FINISHED;
  2131. }
  2132. }
  2133. }
  2134. }
  2135. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  2136. {
  2137. ActionParamsStruct params;
  2138. GameObject * jimmy = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  2139. GameObject * johnny = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  2140. GameObject * bobby = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  2141. GameObject * williams = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);
  2142. if (complete_reason == ACTION_COMPLETE_NORMAL)
  2143. {
  2144. if (action_id == M01_DOING_ANIMATION_01_JDG)
  2145. {
  2146. Vector3 gotoPosition (-0.82f, -91.56f, -15);
  2147. params.Set_Basic( this, 80, M01_WALKING_WAYPATH_02_JDG );
  2148. params.Set_Movement( gotoPosition, RUN, 0.5f );
  2149. Commands->Action_Goto( obj, params );
  2150. }
  2151. else if (action_id == M01_WALKING_WAYPATH_02_JDG)
  2152. {
  2153. Vector3 gotoPosition (-0.82f, -91.56f, -15);
  2154. Commands->Set_Innate_Soldier_Home_Location ( obj, gotoPosition, 10 );
  2155. Vector3 myPosition = Commands->Get_Position ( obj );
  2156. Commands->Create_Sound ( "TargetHasBeenEngaged_2", myPosition, obj );
  2157. GameObject * jimmy = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  2158. GameObject * johnny = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  2159. GameObject * bobby = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  2160. GameObject * williams = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);
  2161. if (jimmy != NULL)
  2162. {
  2163. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  2164. Commands->Send_Custom_Event ( obj, jimmy, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  2165. }
  2166. if (johnny != NULL)
  2167. {
  2168. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  2169. Commands->Send_Custom_Event ( obj, johnny, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  2170. }
  2171. if (bobby != NULL)
  2172. {
  2173. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  2174. Commands->Send_Custom_Event ( obj, bobby, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  2175. }
  2176. if (williams != NULL)
  2177. {
  2178. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  2179. Commands->Send_Custom_Event ( obj, williams, 0, M01_MODIFY_YOUR_ACTION_02_JDG, delayTimer );
  2180. }
  2181. }
  2182. else if (action_id == M01_WALKING_WAYPATH_01_JDG)
  2183. {
  2184. if (chiefs_location == GOING_TO_WILLIAMS_01)
  2185. {
  2186. if (williams != NULL && williams_is_dead == false)
  2187. {
  2188. //int williams01 = Commands->Create_Conversation( "M04_EngineRoom_Williams_01_Conversation", 50, 50, true);
  2189. //Commands->Join_Conversation( obj, williams01, false, true, true );
  2190. //Commands->Join_Conversation( williams, williams01, false, true, true );
  2191. //Commands->Start_Conversation( williams01, williams01 );
  2192. //Commands->Monitor_Conversation( obj, williams01 );
  2193. }
  2194. else
  2195. {
  2196. chiefs_location = ALERTED;
  2197. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2198. }
  2199. }
  2200. else if (chiefs_location == GOING_TO_BOBBY_01)
  2201. {
  2202. if (bobby != NULL && bobby_is_dead == false)
  2203. {
  2204. //int bobby01 = Commands->Create_Conversation( "M04_EngineRoom_Bobby_01_Conversation", 50, 50, true);
  2205. //Commands->Join_Conversation( obj, bobby01, false, true, true );
  2206. //Commands->Join_Conversation( bobby, bobby01, false, true, true );
  2207. //Commands->Start_Conversation( bobby01, bobby01 );
  2208. //Commands->Monitor_Conversation( obj, bobby01 );
  2209. }
  2210. else
  2211. {
  2212. chiefs_location = ALERTED;//
  2213. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2214. }
  2215. }
  2216. else if (chiefs_location == GOING_TO_JIMMY_01)
  2217. {
  2218. if (jimmy != NULL && jimmy_is_dead == false)
  2219. {
  2220. //int jimmy01 = Commands->Create_Conversation( "M04_EngineRoom_Jimmy_01_Conversation", 50, 50, true);
  2221. //Commands->Join_Conversation( obj, jimmy01, false, true, true );
  2222. //Commands->Join_Conversation( jimmy, jimmy01, false, true, true );
  2223. //Commands->Start_Conversation( jimmy01, jimmy01 );
  2224. //Commands->Monitor_Conversation( obj, jimmy01 );
  2225. }
  2226. else
  2227. {
  2228. chiefs_location = ALERTED;//GOING_TO_JIMMY_01
  2229. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2230. }
  2231. }
  2232. else if (chiefs_location == GOING_TO_JOHNNY)
  2233. {
  2234. if (johnny != NULL && johnny_is_dead == false)
  2235. {
  2236. //int johnny01 = Commands->Create_Conversation( "M04_EngineRoom_Tech04_01_Conversation", 50, 50, true);
  2237. //Commands->Join_Conversation( obj, johnny01, false, true, true );
  2238. //Commands->Join_Conversation( johnny, johnny01, false, true, true );
  2239. //Commands->Start_Conversation( johnny01, johnny01 );
  2240. //Commands->Monitor_Conversation( obj, johnny01 );
  2241. }
  2242. else
  2243. {
  2244. chiefs_location = ALERTED;//GOING_TO_JIMMY_01
  2245. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2246. }
  2247. }
  2248. else if (chiefs_location == GOING_TO_BOBBY_02)
  2249. {
  2250. if (bobby != NULL && bobby_is_dead == false)
  2251. {
  2252. //int bobby01 = Commands->Create_Conversation( "M04_EngineRoom_Bobby_02_Conversation", 50, 50, true);
  2253. //Commands->Join_Conversation( obj, bobby01, false, true, true );
  2254. //Commands->Join_Conversation( bobby, bobby01, false, true, true );
  2255. //Commands->Start_Conversation( bobby01, bobby01 );
  2256. //Commands->Monitor_Conversation( obj, bobby01 );
  2257. }
  2258. else
  2259. {
  2260. chiefs_location = ALERTED;//
  2261. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2262. }
  2263. }
  2264. else if (chiefs_location == GOING_TO_JIMMY_02)
  2265. {
  2266. if (jimmy != NULL && jimmy_is_dead == false)
  2267. {
  2268. //int jimmy01 = Commands->Create_Conversation( "M04_EngineRoom_Jimmy_02_Conversation", 50, 50, true);
  2269. //Commands->Join_Conversation( obj, jimmy01, false, true, true );
  2270. //Commands->Join_Conversation( jimmy, jimmy01, false, true, true );
  2271. //Commands->Start_Conversation( jimmy01, jimmy01 );
  2272. //Commands->Monitor_Conversation( obj, jimmy01 );
  2273. }
  2274. else
  2275. {
  2276. chiefs_location = ALERTED;//GOING_TO_JIMMY_01
  2277. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2278. }
  2279. }
  2280. else if (chiefs_location == GOING_TO_WILLIAMS_02)
  2281. {
  2282. if (williams != NULL && williams_is_dead == false)
  2283. {
  2284. //int williams01 = Commands->Create_Conversation( "M04_EngineRoom_Williams_02_Conversation", 50, 50, true);
  2285. //Commands->Join_Conversation( obj, williams01, false, true, true );
  2286. //Commands->Join_Conversation( williams, williams01, false, true, true );
  2287. //Commands->Start_Conversation( williams01, williams01 );
  2288. //Commands->Monitor_Conversation( obj, williams01 );
  2289. }
  2290. else
  2291. {
  2292. chiefs_location = ALERTED;
  2293. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  2294. }
  2295. }
  2296. }
  2297. }
  2298. else if (complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2299. {
  2300. Commands->Send_Custom_Event( obj, obj, 0, M01_PICK_A_NEW_LOCATION_JDG, 1 );
  2301. GameObject * jimmy = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  2302. GameObject * johnny = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  2303. GameObject * bobby = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  2304. GameObject * williams = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);
  2305. if (chiefs_location == GOING_TO_WILLIAMS_01)
  2306. {
  2307. if (williams != NULL && williams_is_dead == false)
  2308. {
  2309. Commands->Send_Custom_Event( obj, williams, 0, M01_START_ACTING_JDG, 0.25f );
  2310. }
  2311. }
  2312. else if (chiefs_location == GOING_TO_BOBBY_01)
  2313. {
  2314. if (bobby != NULL && bobby_is_dead == false)
  2315. {
  2316. Commands->Send_Custom_Event( obj, bobby, 0, M01_START_ACTING_JDG, 0.25f );
  2317. }
  2318. }
  2319. else if (chiefs_location == GOING_TO_JIMMY_01)
  2320. {
  2321. if (jimmy != NULL && jimmy_is_dead == false)
  2322. {
  2323. Commands->Send_Custom_Event( obj, jimmy, 0, M01_START_ACTING_JDG, 0.25f );
  2324. }
  2325. }
  2326. else if (chiefs_location == GOING_TO_JOHNNY)
  2327. {
  2328. if (johnny != NULL && johnny_is_dead == false)
  2329. {
  2330. Commands->Send_Custom_Event( obj, johnny, 0, M01_START_ACTING_JDG, 0.25f );
  2331. }
  2332. }
  2333. else if (chiefs_location == GOING_TO_BOBBY_02)
  2334. {
  2335. if (bobby != NULL && bobby_is_dead == false)
  2336. {
  2337. Commands->Send_Custom_Event( obj, bobby, 0, M01_START_ACTING_JDG, 0.25f );
  2338. }
  2339. }
  2340. else if (chiefs_location == GOING_TO_JIMMY_02)
  2341. {
  2342. if (jimmy != NULL && jimmy_is_dead == false)
  2343. {
  2344. Commands->Send_Custom_Event( obj, jimmy, 0, M01_START_ACTING_JDG, 0.25f );
  2345. }
  2346. }
  2347. else if (chiefs_location == GOING_TO_WILLIAMS_02)
  2348. {
  2349. if (williams != NULL && williams_is_dead == false)
  2350. {
  2351. Commands->Send_Custom_Event( obj, williams, 0, M01_START_ACTING_JDG, 0.25f );
  2352. }
  2353. }
  2354. }
  2355. }
  2356. };
  2357. DECLARE_SCRIPT(M04_EngineRoom_PrisonLift_EnterZone_JDG, "")
  2358. {
  2359. void Entered( GameObject * obj, GameObject * enterer )
  2360. {
  2361. if ( enterer == STAR )
  2362. {
  2363. Vector3 spawnSpot (-0.512f, -95.434f, 0);
  2364. GameObject * liftEngineer = Commands->Create_Object ( "Nod_Engineer_0", spawnSpot );
  2365. Commands->Attach_Script(liftEngineer, "M04_EngineRoom_LiftEngineer_JDG", "");
  2366. GameObject * zone01 = Commands->Find_Object (101121);
  2367. if (zone01 != NULL)
  2368. {
  2369. Commands->Destroy_Object ( zone01 );
  2370. }
  2371. GameObject * zone02 = Commands->Find_Object (101122);
  2372. if (zone02 != NULL)
  2373. {
  2374. Commands->Destroy_Object ( zone02 );
  2375. }
  2376. GameObject * zone03 = Commands->Find_Object (101123);
  2377. if (zone03 != NULL)
  2378. {
  2379. Commands->Destroy_Object ( zone03 );
  2380. }
  2381. }
  2382. }
  2383. };
  2384. DECLARE_SCRIPT(M04_EngineRoom_LiftEngineer_JDG, "")
  2385. {
  2386. void Created( GameObject * obj )
  2387. {
  2388. ActionParamsStruct params;
  2389. params.Set_Basic( this, 100, 101 );
  2390. params.Set_Movement( Vector3(-0.19f, -105.53f, -9), RUN, 1 );
  2391. Commands->Action_Goto( obj, params );
  2392. }
  2393. };
  2394. DECLARE_SCRIPT(M04_EngineRoom_Start_Guard_Conversation_Zone_JDG, "")
  2395. {
  2396. void Entered( GameObject * obj, GameObject * enterer )
  2397. {
  2398. if ( enterer == STAR )
  2399. {
  2400. GameObject * prisonGuard01 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_01_JDG );
  2401. GameObject * prisonGuard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  2402. if (prisonGuard01 != NULL)
  2403. {
  2404. Commands->Send_Custom_Event( obj, prisonGuard01, 0, M01_START_ACTING_JDG, 0 );
  2405. }
  2406. if (prisonGuard02 != NULL)
  2407. {
  2408. Commands->Send_Custom_Event( obj, prisonGuard02, 0, M01_START_ACTING_JDG, 0 );
  2409. }
  2410. Commands->Destroy_Object ( obj );
  2411. }
  2412. }
  2413. };
  2414. DECLARE_SCRIPT(M04_EngineRoom_Prison_Guard_01_JDG, "")//M04_ENGINEROOM_PRISONGUARD_01_JDG 101988
  2415. {
  2416. int haze_prisoner_conv;
  2417. int counter;
  2418. bool engineDestroyed;
  2419. REGISTER_VARIABLES()
  2420. {
  2421. SAVE_VARIABLE(engineDestroyed, 1);
  2422. SAVE_VARIABLE(haze_prisoner_conv, 2);
  2423. SAVE_VARIABLE(counter, 3);
  2424. }
  2425. void Created( GameObject * obj )
  2426. {
  2427. engineDestroyed = false;
  2428. Commands->Set_Innate_Is_Stationary ( obj, true );
  2429. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  2430. counter = 0;
  2431. GameObject * prisoner = Commands->Find_Object ( 100011 );
  2432. if (prisoner != NULL)
  2433. {
  2434. ActionParamsStruct params;
  2435. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2436. params.Set_Attack( prisoner, 0, 0, true );
  2437. Commands->Action_Attack ( obj, params );
  2438. }
  2439. }
  2440. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2441. {
  2442. if (obj && damager == STAR)
  2443. {
  2444. Commands->Set_Innate_Is_Stationary ( obj, false );
  2445. GameObject* guard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  2446. if (guard02 != NULL)
  2447. {
  2448. Commands->Send_Custom_Event( obj, guard02, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2449. }
  2450. }
  2451. }
  2452. void Killed( GameObject * obj, GameObject * killer )
  2453. {
  2454. GameObject* prisoner01 = Commands->Find_Object ( M04_PRISON_PRISONER_01_JDG );
  2455. if (prisoner01 != NULL)
  2456. {
  2457. Commands->Send_Custom_Event( obj, prisoner01, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2458. }
  2459. GameObject* guard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  2460. if (guard02 != NULL)
  2461. {
  2462. Commands->Send_Custom_Event( obj, guard02, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2463. }
  2464. }
  2465. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  2466. {
  2467. if (param == M01_START_ACTING_JDG && engineDestroyed == false)//controller is telling you to start acting
  2468. {
  2469. if (obj)
  2470. {
  2471. if (counter >= 3)
  2472. {
  2473. counter = 0;
  2474. }
  2475. GameObject* guard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  2476. if (obj && guard02 != NULL )
  2477. {
  2478. char *conversations[3] =
  2479. {
  2480. "M04_PrisonHazing_Conversation_01",
  2481. "M04_PrisonHazing_Conversation_02",
  2482. "M04_PrisonHazing_Conversation_03",
  2483. //"M04_PrisonHazing_Conversation_04",
  2484. };
  2485. haze_prisoner_conv = Commands->Create_Conversation( conversations[counter], 65, 100, true);
  2486. Commands->Join_Conversation( obj, haze_prisoner_conv, false, false );
  2487. Commands->Join_Conversation( guard02, haze_prisoner_conv, false, false );
  2488. Commands->Start_Conversation( haze_prisoner_conv, haze_prisoner_conv );
  2489. Commands->Monitor_Conversation( obj, haze_prisoner_conv );
  2490. counter++;
  2491. }
  2492. }
  2493. }
  2494. else if (param == M01_START_ACTING_JDG && engineDestroyed == true)//controller is telling you to start acting--engines destroyed
  2495. {
  2496. Commands->Action_Reset ( obj, 100 );
  2497. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, true );
  2498. Commands->Set_Innate_Is_Stationary ( obj, false );
  2499. }
  2500. else if (param == M01_IVE_BEEN_KILLED_JDG)//guard two has been killed/injured M01_MODIFY_YOUR_ACTION_JDG
  2501. {
  2502. if (obj)
  2503. {
  2504. Commands->Action_Reset ( obj, 100 );
  2505. Commands->Set_Innate_Is_Stationary ( obj, false );
  2506. ActionParamsStruct params;
  2507. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2508. params.Set_Attack( STAR, 10, 0, true );
  2509. Commands->Action_Attack ( obj, params );
  2510. }
  2511. }
  2512. else if (param == M01_MODIFY_YOUR_ACTION_JDG)//the engine has been destroyed--enable foostep hearing
  2513. {
  2514. engineDestroyed = true;
  2515. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, true );
  2516. }
  2517. }
  2518. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  2519. {
  2520. switch (complete_reason)
  2521. {
  2522. case ACTION_COMPLETE_CONVERSATION_ENDED:
  2523. {
  2524. if (action_id == haze_prisoner_conv)
  2525. {
  2526. if ( obj)
  2527. {
  2528. Commands->Send_Custom_Event( obj, obj, 0, M01_START_ACTING_JDG, 1 );//pick a new conversation
  2529. }
  2530. }
  2531. }
  2532. break;
  2533. }
  2534. }
  2535. };
  2536. DECLARE_SCRIPT(M04_EngineRoom_Prison_Guard_02_JDG, "")//M04_ENGINEROOM_PRISONGUARD_02_JDG 101989
  2537. {
  2538. bool engineDestroyed;
  2539. REGISTER_VARIABLES()
  2540. {
  2541. SAVE_VARIABLE(engineDestroyed, 1);
  2542. }
  2543. void Created( GameObject * obj )
  2544. {
  2545. engineDestroyed = false;
  2546. Commands->Set_Innate_Is_Stationary ( obj, true );
  2547. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  2548. GameObject * prisoner = Commands->Find_Object ( M04_PRISON_PRISONER_01_JDG );
  2549. if (prisoner != NULL)
  2550. {
  2551. ActionParamsStruct params;
  2552. params.Set_Basic( this, 100, 999);
  2553. params.Set_Attack( prisoner, 0, 0, true );
  2554. Commands->Action_Attack ( obj, params );
  2555. }
  2556. }
  2557. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2558. {
  2559. if (obj && damager == STAR)
  2560. {
  2561. Commands->Set_Innate_Is_Stationary ( obj, false );
  2562. GameObject* guard01 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_01_JDG );
  2563. if (guard01 != NULL)
  2564. {
  2565. Commands->Send_Custom_Event( obj, guard01, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2566. }
  2567. }
  2568. }
  2569. void Killed( GameObject * obj, GameObject * killer )
  2570. {
  2571. GameObject* prisoner01 = Commands->Find_Object ( M04_PRISON_PRISONER_01_JDG );
  2572. if (prisoner01 != NULL)
  2573. {
  2574. Commands->Send_Custom_Event( obj, prisoner01, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2575. }
  2576. GameObject* guard01 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_01_JDG );
  2577. if (guard01 != NULL)
  2578. {
  2579. Commands->Send_Custom_Event( obj, guard01, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  2580. }
  2581. }
  2582. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  2583. {
  2584. ActionParamsStruct params;
  2585. if (param == M01_START_ACTING_JDG && engineDestroyed == false)//controller is telling you to start acting
  2586. {
  2587. }
  2588. else if (param == M01_START_ACTING_JDG && engineDestroyed == true)//controller is telling you to start acting--engines destroyed
  2589. {
  2590. Commands->Action_Reset ( obj, 100 );
  2591. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, true );
  2592. Commands->Set_Innate_Is_Stationary ( obj, false );
  2593. }
  2594. else if (param == M01_IVE_BEEN_KILLED_JDG)//guard one has been killed/injured
  2595. {
  2596. if (obj)
  2597. {
  2598. Commands->Action_Reset ( obj, 100 );
  2599. Commands->Set_Innate_Is_Stationary ( obj, false );
  2600. ActionParamsStruct params;
  2601. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2602. params.Set_Attack( STAR, 10, 0, true );
  2603. Commands->Action_Attack ( obj, params );
  2604. }
  2605. }
  2606. else if (param == M01_MODIFY_YOUR_ACTION_JDG)//the engine has been destroyed--enable foostep hearing
  2607. {
  2608. engineDestroyed = true;
  2609. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, true );
  2610. }
  2611. }
  2612. };
  2613. DECLARE_SCRIPT(M04_EngineRoom_TalkToPrisoners_Zone_JDG, "")
  2614. {
  2615. void Entered( GameObject * obj, GameObject * enterer )
  2616. {
  2617. if ( enterer == STAR )
  2618. {
  2619. bool playerHasLev01Card = Commands->Has_Key( STAR, 1 );
  2620. if (playerHasLev01Card == false)
  2621. {
  2622. GameObject * prisoner01 = Commands->Find_Object (M04_PRISON_PRISONER_01_JDG);
  2623. if (prisoner01 != NULL)
  2624. {
  2625. Commands->Send_Custom_Event( obj, prisoner01, 0, M01_MODIFY_YOUR_ACTION_04_JDG, 0 );//tell prisoner 3 that Havoc is close by
  2626. }
  2627. Commands->Destroy_Object ( obj );
  2628. }
  2629. else
  2630. {
  2631. Commands->Destroy_Object ( obj );
  2632. }
  2633. }
  2634. }
  2635. };
  2636. DECLARE_SCRIPT(M04_EngineRoom_Prisoner_01_JDG, "")//this guys ID number is M04_PRISON_PRISONER_01_JDG 100011
  2637. {
  2638. bool prison_guard_01_dead;
  2639. bool prison_guard_02_dead;
  2640. bool firstTimeDamaged;
  2641. bool freedYet;
  2642. bool seenHavoc;
  2643. int its_gdi_conv;
  2644. int wave_counter;
  2645. int medlab_conv;
  2646. REGISTER_VARIABLES()
  2647. {
  2648. SAVE_VARIABLE(prison_guard_01_dead, 1);
  2649. SAVE_VARIABLE(prison_guard_02_dead, 2);
  2650. SAVE_VARIABLE(firstTimeDamaged, 3);
  2651. SAVE_VARIABLE(freedYet, 4);
  2652. SAVE_VARIABLE(seenHavoc, 5);
  2653. SAVE_VARIABLE(its_gdi_conv, 6);
  2654. SAVE_VARIABLE(wave_counter, 7);
  2655. SAVE_VARIABLE(medlab_conv, 8);
  2656. }
  2657. void Created( GameObject * obj )
  2658. {
  2659. wave_counter = 0;
  2660. seenHavoc = false;
  2661. firstTimeDamaged = true;
  2662. prison_guard_01_dead = false;
  2663. prison_guard_02_dead = false;
  2664. freedYet = false;
  2665. Commands->Set_Innate_Is_Stationary ( obj, true);
  2666. }
  2667. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2668. {
  2669. if (obj)
  2670. {
  2671. if (damager == STAR )
  2672. {
  2673. int myMaxHealth = Commands->Get_Max_Health ( obj );
  2674. Commands->Set_Health ( obj, myMaxHealth );
  2675. if (firstTimeDamaged == true)
  2676. {
  2677. Commands->Create_Sound ( "00-N066E", Vector3 (0,0,0), obj );//you are firing on a friendly unit
  2678. firstTimeDamaged = false;
  2679. ActionParamsStruct params;
  2680. params.Set_Basic( this, 100, M01_DOING_ANIMATION_02_JDG );
  2681. params.Set_Animation( "H_A_J21C", false );
  2682. Commands->Action_Play_Animation ( obj, params );
  2683. //Vector3 myPosition = Commands->Get_Position ( obj );
  2684. //Commands->Create_Sound ( "M04 PanicGuy 01 Twiddler", myPosition, obj );
  2685. }
  2686. }
  2687. }
  2688. }
  2689. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  2690. {
  2691. ActionParamsStruct params;
  2692. if (param == M01_IVE_BEEN_KILLED_JDG)//prison guard one is dead
  2693. {
  2694. GameObject * prisonGuard01 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_01_JDG );
  2695. GameObject * prisonGuard02 = Commands->Find_Object ( M04_ENGINEROOM_PRISONGUARD_02_JDG );
  2696. if (sender == prisonGuard01)
  2697. {
  2698. prison_guard_01_dead = true;
  2699. Commands->Send_Custom_Event( obj, obj, 0, M01_DO_DAMAGE_CHECK_JDG, 1 );
  2700. }
  2701. if (sender == prisonGuard02)
  2702. {
  2703. prison_guard_02_dead = true;
  2704. Commands->Send_Custom_Event( obj, obj, 0, M01_DO_DAMAGE_CHECK_JDG, 1 );
  2705. }
  2706. }
  2707. else if (param == M01_DO_DAMAGE_CHECK_JDG)//check if both are dead yet
  2708. {
  2709. if ((prison_guard_01_dead == true) && (prison_guard_02_dead == true) && freedYet == false && seenHavoc == false)
  2710. {
  2711. seenHavoc = true;
  2712. ActionParamsStruct params;
  2713. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2714. params.Set_Attack( STAR, 0, 0, true );
  2715. Commands->Action_Attack ( obj, params );
  2716. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 1 );
  2717. }
  2718. }
  2719. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)
  2720. {
  2721. its_gdi_conv = Commands->Create_Conversation( "M04_Is_That_a_GDI_Soldier", 100, 100, false);
  2722. Commands->Join_Conversation( obj, its_gdi_conv, false, true, true );
  2723. Commands->Join_Conversation( STAR, its_gdi_conv, false, true, true );
  2724. Commands->Start_Conversation( its_gdi_conv, its_gdi_conv );
  2725. Commands->Monitor_Conversation( obj, its_gdi_conv );
  2726. }
  2727. else if (param == M01_MODIFY_YOUR_ACTION_03_JDG && wave_counter <= 4)//
  2728. {
  2729. params.Set_Basic( this, 100, M01_MODIFY_YOUR_ACTION_03_JDG);
  2730. params.Set_Animation( "H_A_J01C", false );//this is animation for hanging head down
  2731. Commands->Action_Play_Animation (obj, params);
  2732. wave_counter++;
  2733. }
  2734. else if (param == M01_MODIFY_YOUR_ACTION_04_JDG && wave_counter < 100)//playre is in first talk zone--start conversation
  2735. {
  2736. Commands->Action_Reset ( obj, 100 );
  2737. wave_counter = 100;
  2738. medlab_conv = Commands->Create_Conversation( "M04_Prisoner_Guard_is_in_Medlab_Conversation", 100, 100, false);
  2739. Commands->Join_Conversation( obj, medlab_conv, false, true, true );
  2740. Commands->Join_Conversation( STAR, medlab_conv, false, true, true );
  2741. Commands->Start_Conversation( medlab_conv, medlab_conv );
  2742. Commands->Monitor_Conversation( obj, medlab_conv );
  2743. }
  2744. else if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been freed--cheer you ungrateful bastard
  2745. {
  2746. freedYet = true;
  2747. char *animationName = M01_Choose_Cheer_Animation ( );
  2748. Commands->Action_Reset ( obj, 100 );
  2749. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  2750. params.Set_Animation( animationName, false );
  2751. Commands->Action_Play_Animation ( obj, params );
  2752. Vector3 myPosition = Commands->Get_Position ( obj );
  2753. Commands->Create_Sound ( "M01_GDI_Thanks_Twiddler", myPosition, obj );
  2754. }
  2755. }
  2756. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  2757. {
  2758. ActionParamsStruct params;
  2759. if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)//prisoner one is at his hazing spot
  2760. {
  2761. params.Set_Basic( this, 100, 102);
  2762. params.Set_Animation( "H_A_J06C", false );//this is animation for hanging head down
  2763. Commands->Action_Play_Animation (obj, params);
  2764. }
  2765. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2766. {
  2767. Commands->Destroy_Object ( obj );
  2768. }
  2769. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2770. {
  2771. firstTimeDamaged = true;
  2772. }
  2773. else if (action_id == M01_MODIFY_YOUR_ACTION_03_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2774. {
  2775. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2776. params.Set_Attack( STAR, 0, 0, true );
  2777. Commands->Action_Attack ( obj, params );
  2778. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_03_JDG, 1 );
  2779. }
  2780. else if (action_id == its_gdi_conv && complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2781. {
  2782. params.Set_Basic( this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  2783. params.Set_Attack( STAR, 0, 0, true );
  2784. Commands->Action_Attack ( obj, params );
  2785. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_03_JDG, 1 );
  2786. }
  2787. else if (action_id == medlab_conv && complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  2788. {
  2789. GameObject * objectiveController = Commands->Find_Object ( M04_OBJECTIVE_CONTROLLER_JDG );
  2790. if (objectiveController != NULL)
  2791. {
  2792. Commands->Send_Custom_Event( obj, objectiveController, 0, 401, 1 );
  2793. }
  2794. }
  2795. }
  2796. };
  2797. DECLARE_SCRIPT(M04_EngineRoom_Prisoner_02_JDG, "")//this guys ID number is M04_PRISON_PRISONER_02_JDG 101196
  2798. {
  2799. bool firstTimeDamaged;
  2800. REGISTER_VARIABLES()
  2801. {
  2802. SAVE_VARIABLE(firstTimeDamaged, 1);
  2803. }
  2804. void Created( GameObject * obj )
  2805. {
  2806. Commands->Innate_Disable(obj);
  2807. Commands->Set_Loiters_Allowed( obj, false );
  2808. ActionParamsStruct params;
  2809. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  2810. params.Set_Animation( "H_A_7002", true );
  2811. Commands->Action_Play_Animation ( obj, params );
  2812. }
  2813. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2814. {
  2815. if (obj && damager == STAR)
  2816. {
  2817. int myMaxHealth = Commands->Get_Max_Health ( obj );
  2818. Commands->Set_Health ( obj, myMaxHealth );
  2819. if (firstTimeDamaged == true)
  2820. {
  2821. Commands->Create_Sound ( "00-N066E", Vector3 (0,0,0), obj );//you are firing on a friendly unit
  2822. firstTimeDamaged = false;
  2823. }
  2824. }
  2825. }
  2826. };
  2827. /*DECLARE_SCRIPT(M04_EngineRoom_Prisoner_02_JDG, "")//this guys ID number is M04_PRISON_PRISONER_02_JDG 101196
  2828. {
  2829. bool firstTimeDamaged;
  2830. REGISTER_VARIABLES()
  2831. {
  2832. SAVE_VARIABLE(firstTimeDamaged, 1);
  2833. }
  2834. void Created( GameObject * obj )
  2835. {
  2836. Commands->Set_Innate_Is_Stationary ( obj, true);
  2837. firstTimeDamaged = true;
  2838. }
  2839. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2840. {
  2841. if (obj && damager == STAR)
  2842. {
  2843. int myMaxHealth = Commands->Get_Max_Health ( obj );
  2844. Commands->Set_Health ( obj, myMaxHealth );
  2845. if (firstTimeDamaged == true)
  2846. {
  2847. Commands->Create_Sound ( "00-N066E", Vector3 (0,0,0), obj );//you are firing on a friendly unit
  2848. firstTimeDamaged = false;
  2849. ActionParamsStruct params;
  2850. params.Set_Basic( this, 100, M01_DOING_ANIMATION_02_JDG );
  2851. params.Set_Animation( "H_A_J21C", false );
  2852. Commands->Action_Play_Animation ( obj, params );
  2853. Vector3 myPosition = Commands->Get_Position ( obj );
  2854. Commands->Create_Sound ( "M04 PanicGuy 01 Twiddler", myPosition, obj );
  2855. }
  2856. }
  2857. }
  2858. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  2859. {
  2860. ActionParamsStruct params;
  2861. if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been freed--cheer you ungrateful bastard
  2862. {
  2863. char *animationName = M01_Choose_Cheer_Animation ( );
  2864. Commands->Action_Reset ( obj, 100 );
  2865. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  2866. params.Set_Animation( animationName, false );
  2867. Commands->Action_Play_Animation ( obj, params );
  2868. Vector3 myPosition = Commands->Get_Position ( obj );
  2869. Commands->Create_Sound ( "M01_GDI_Thanks_Twiddler", myPosition, obj );
  2870. }
  2871. }
  2872. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  2873. {
  2874. if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2875. {
  2876. Commands->Destroy_Object ( obj );
  2877. }
  2878. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2879. {
  2880. firstTimeDamaged = true;
  2881. }
  2882. }
  2883. };*/
  2884. DECLARE_SCRIPT(M04_EngineRoom_Prisoner_03_JDG, "")//this guys ID number is M04_PRISON_PRISONER_03_JDG 100013
  2885. {
  2886. bool firstTimeDamaged;
  2887. bool freedYet;
  2888. REGISTER_VARIABLES()
  2889. {
  2890. SAVE_VARIABLE(freedYet, 1);
  2891. SAVE_VARIABLE(firstTimeDamaged, 2);
  2892. }
  2893. void Created( GameObject * obj )
  2894. {
  2895. Commands->Set_Innate_Is_Stationary ( obj, true);
  2896. firstTimeDamaged = true;
  2897. freedYet = false;
  2898. ActionParamsStruct params;
  2899. params.Set_Basic( this, 100, 102);
  2900. params.Set_Animation( "H_A_J13B", true );//this is animation for looping pushups
  2901. Commands->Action_Play_Animation (obj, params);
  2902. }
  2903. void Damaged( GameObject * obj, GameObject * damager, float amount )
  2904. {
  2905. ActionParamsStruct params;
  2906. if (obj && damager == STAR)
  2907. {
  2908. int myMaxHealth = Commands->Get_Max_Health ( obj );
  2909. Commands->Set_Health ( obj, myMaxHealth );
  2910. if (firstTimeDamaged == true)
  2911. {
  2912. Commands->Create_Sound ( "00-N066E", Vector3 (0,0,0), obj );//you are firing on a friendly unit
  2913. firstTimeDamaged = false;
  2914. params.Set_Basic( this, 100, M01_DOING_ANIMATION_02_JDG );
  2915. params.Set_Animation( "H_A_J21C", false );
  2916. Commands->Action_Play_Animation ( obj, params );
  2917. //Vector3 myPosition = Commands->Get_Position ( obj );
  2918. //Commands->Create_Sound ( "M04 PanicGuy 01 Twiddler", myPosition, obj );
  2919. }
  2920. }
  2921. }
  2922. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  2923. {
  2924. ActionParamsStruct params;
  2925. if (param == 3000)
  2926. {
  2927. Commands->Action_Reset ( obj, 100 );
  2928. ActionParamsStruct params;
  2929. params.Set_Basic( this, 100, M01_START_ATTACKING_01_JDG );
  2930. params.Set_Attack( STAR, 0, 0, true);
  2931. Commands->Action_Attack(obj, params);
  2932. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 2 );
  2933. }
  2934. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)//ask havco if he has the key yet
  2935. {
  2936. if (freedYet == false)
  2937. {
  2938. int key_conv = Commands->Create_Conversation( "M04_DoYouHaveTheKey_Conversation", 100, 1000, false);
  2939. Commands->Join_Conversation( obj, key_conv, false, false, false);
  2940. Commands->Join_Conversation( STAR, key_conv, false, false, false);
  2941. Commands->Start_Conversation( key_conv, key_conv );
  2942. }
  2943. }
  2944. else if (param == M01_MODIFY_YOUR_ACTION_JDG)//you've been freed--cheer you ungrateful bastard
  2945. {
  2946. freedYet = true;
  2947. char *animationName = M01_Choose_Cheer_Animation ( );
  2948. Commands->Action_Reset ( obj, 100 );
  2949. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  2950. params.Set_Animation( animationName, false );
  2951. Commands->Action_Play_Animation ( obj, params );
  2952. //Vector3 myPosition = Commands->Get_Position ( obj );
  2953. //Commands->Create_Sound ( "M01_GDI_Thanks_Twiddler", myPosition, obj );
  2954. }
  2955. }
  2956. void Poked( GameObject * obj, GameObject * poker )
  2957. {
  2958. ActionParamsStruct params;
  2959. params.Set_Basic( this, 100, M01_START_ATTACKING_01_JDG );
  2960. params.Set_Attack( STAR, 0, 0, true);
  2961. Commands->Action_Attack(obj, params);
  2962. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 1 );
  2963. }
  2964. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  2965. {
  2966. ActionParamsStruct params;
  2967. if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2968. {
  2969. Commands->Destroy_Object ( obj );
  2970. }
  2971. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  2972. {
  2973. firstTimeDamaged = true;
  2974. }
  2975. }
  2976. };
  2977. DECLARE_SCRIPT(M04_Prison_CellDoor_Zone_JDG, "")
  2978. {
  2979. void Created( GameObject * obj )
  2980. {
  2981. Commands->Static_Anim_Phys_Goto_Frame ( M04_PRISON_DOOR_JDG, 0, "SHP_DOORP01.SHP_DOORP01" );//182085
  2982. }
  2983. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2984. {
  2985. if (type == 0)
  2986. {
  2987. if (param == M01_MODIFY_YOUR_ACTION_JDG)
  2988. {
  2989. }
  2990. }
  2991. }
  2992. void Entered( GameObject * obj, GameObject * enterer )
  2993. {
  2994. if ( enterer == STAR )
  2995. {
  2996. bool playerHasPrisonKey = Commands->Has_Key( STAR, 1 );
  2997. if (playerHasPrisonKey == true)
  2998. {
  2999. GameObject *prisoner01 = Commands->Find_Object (M04_PRISON_PRISONER_01_JDG);
  3000. GameObject *prisoner02 = Commands->Find_Object (M04_PRISON_PRISONER_02_JDG);
  3001. GameObject *prisoner03 = Commands->Find_Object (M04_PRISON_PRISONER_03_JDG);
  3002. if (prisoner01 != NULL)
  3003. {
  3004. Commands->Destroy_Object ( prisoner01 );
  3005. }
  3006. if (prisoner02 != NULL)
  3007. {
  3008. Commands->Destroy_Object ( prisoner02 );
  3009. }
  3010. if (prisoner03 != NULL)
  3011. {
  3012. Commands->Destroy_Object ( prisoner03 );
  3013. }
  3014. Commands->Set_Position ( STAR, Vector3(-7.478f, -80.231f, -0.000) );
  3015. Commands->Set_Facing ( STAR, -125 );
  3016. Commands->Control_Enable ( STAR, false );
  3017. Commands->Set_Is_Rendered( STAR, false );
  3018. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3019. Commands->Attach_Script(controller, "Test_Cinematic", "X4A_MIDTRO.txt");
  3020. Commands->Static_Anim_Phys_Goto_Frame ( M04_PRISON_DOOR_JDG, 6, "SHP_DOORP01.SHP_DOORP01" );
  3021. Commands->Destroy_Object ( obj );//cleaning up this zone
  3022. }
  3023. else
  3024. {
  3025. GameObject * prisoner03 = Commands->Find_Object (M04_PRISON_PRISONER_03_JDG);
  3026. if (prisoner03 != NULL)
  3027. {
  3028. Commands->Send_Custom_Event( obj, prisoner03, 0, 3000, 0 );//tell prisoner 3 that Havoc is close by
  3029. }
  3030. }
  3031. }
  3032. }
  3033. };
  3034. /**********************************************************************************************************
  3035. The following scripts all deal with the aft deck on the way to kill the first mate.
  3036. ***********************************************************************************************************/
  3037. DECLARE_SCRIPT(M04_AftDeck_InnerSanctum_Entry_Zone_JDG, "")
  3038. {
  3039. void Entered( GameObject * obj, GameObject * enterer )
  3040. {
  3041. if ( enterer == STAR)
  3042. {
  3043. Commands->Create_Sound ( "00-n060e", Commands->Get_Position ( obj ), obj );//updating radar flags
  3044. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 4000, 0 );//tell aft deck controller that player is moving forward
  3045. GameObject *zone02 = Commands->Find_Object ( 100648 );
  3046. if (zone02 != NULL)
  3047. {
  3048. Commands->Destroy_Object (zone02);
  3049. }
  3050. }
  3051. }
  3052. };
  3053. DECLARE_SCRIPT(M04_AftDeck_InnerSanctum_02_Entry_Zone_JDG, "")//player is almost to secondary bridge
  3054. {
  3055. void Entered( GameObject * obj, GameObject * enterer )
  3056. {
  3057. if ( enterer == STAR)
  3058. {
  3059. Commands->Create_Sound ( "00-n060e", Commands->Get_Position ( obj ), obj );//updating radar flags
  3060. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 5000, 0 );//tell aft deck controller that player is moving forward
  3061. Commands->Destroy_Object ( obj ); //clean up the zone
  3062. }
  3063. }
  3064. };
  3065. DECLARE_SCRIPT(M04_AftDeck_02_Controller_JDG, "")//this guys number is M04_AFT_DECK_CONTROLLER_JDG 100624
  3066. {
  3067. int number_of_guys_killed;
  3068. int prisoner_reinforcements;
  3069. int patrolGuy01_ID;
  3070. int patrolGuy02_ID ;
  3071. int pointGuard01_ID;
  3072. int pointGuard02_ID;
  3073. int BHpatrolGuy_ID;
  3074. int prisonGuard01_ID;
  3075. int prisonGuard02_ID;
  3076. int lockerRoompatrolGuy01_ID;
  3077. int lockerRoompatrolGuy02_ID;
  3078. int leftBarracksTalkGuy01_ID;
  3079. int leftBarracksTalkGuy02_ID;
  3080. int leftBarracksTalkGuy03_ID;
  3081. int rightBarrackspatrolGuy_ID;
  3082. int blackHandPointGuard01_ID;
  3083. int blackHandPointGuard02_ID;
  3084. int miniGunnerGuard01_ID;
  3085. int miniGunnerGuard02_ID;
  3086. int miniGunnerGuard03_ID;
  3087. int blackHandMateGuard01_ID;
  3088. int blackHandMateGuard02_ID;
  3089. int blackHandMateGuard03_ID;
  3090. int blackHandMateGuard04_ID;
  3091. REGISTER_VARIABLES()
  3092. {
  3093. SAVE_VARIABLE( number_of_guys_killed, 1 );
  3094. SAVE_VARIABLE( prisoner_reinforcements, 2 );
  3095. SAVE_VARIABLE( patrolGuy01_ID, 3 );
  3096. SAVE_VARIABLE( patrolGuy02_ID, 4 );
  3097. SAVE_VARIABLE( pointGuard01_ID, 5 );
  3098. SAVE_VARIABLE( pointGuard02_ID, 6 );
  3099. SAVE_VARIABLE( BHpatrolGuy_ID, 7 );
  3100. SAVE_VARIABLE( prisonGuard01_ID, 8 );
  3101. SAVE_VARIABLE( prisonGuard02_ID, 9 );
  3102. SAVE_VARIABLE( lockerRoompatrolGuy01_ID, 10 );
  3103. SAVE_VARIABLE( lockerRoompatrolGuy02_ID, 11 );
  3104. SAVE_VARIABLE( leftBarracksTalkGuy01_ID, 12 );
  3105. SAVE_VARIABLE( leftBarracksTalkGuy02_ID, 13 );
  3106. SAVE_VARIABLE( leftBarracksTalkGuy03_ID, 14 );
  3107. SAVE_VARIABLE( rightBarrackspatrolGuy_ID, 15 );
  3108. SAVE_VARIABLE( blackHandPointGuard01_ID, 16 );
  3109. SAVE_VARIABLE( blackHandPointGuard02_ID, 17 );
  3110. SAVE_VARIABLE( miniGunnerGuard01_ID, 18 );
  3111. SAVE_VARIABLE( miniGunnerGuard02_ID, 19 );
  3112. SAVE_VARIABLE( miniGunnerGuard03_ID, 20 );
  3113. SAVE_VARIABLE( blackHandMateGuard01_ID, 21 );
  3114. SAVE_VARIABLE( blackHandMateGuard02_ID, 22 );
  3115. SAVE_VARIABLE( blackHandMateGuard03_ID, 23 );
  3116. SAVE_VARIABLE( blackHandMateGuard04_ID, 24 );
  3117. }
  3118. void Created( GameObject * obj )
  3119. {
  3120. number_of_guys_killed = 0;
  3121. prisoner_reinforcements = 0;
  3122. }
  3123. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3124. {
  3125. if (param == 100)//recieved custom from enter zone to start scenario
  3126. {
  3127. GameObject *patrolGuy01 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(-.90f, -127.01f, 3.00f));
  3128. Commands->Attach_Script(patrolGuy01, "M04_AftDeck_02_PatrolGuy_01_JDG", "");
  3129. GameObject *patrolGuy02 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(6.64f, -116.10f, 3.00f));
  3130. Commands->Attach_Script(patrolGuy02, "M04_AftDeck_02_PatrolGuy_02_JDG", "");
  3131. GameObject *pointGuard01 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(-14.09f, -108.50f, 3.00f));
  3132. Commands->Attach_Script(pointGuard01, "M04_AftDeck_02_Pointguard_JDG", "");
  3133. GameObject *pointGuard02 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(13.83f, -108.00f, 3.00f));
  3134. Commands->Attach_Script(pointGuard02, "M04_AftDeck_02_Pointguard_JDG", "");
  3135. GameObject *BHpatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(8.51f, -108.05f, 6.00f));
  3136. Commands->Attach_Script(BHpatrolGuy, "M04_AftDeck_02_Blackhand_PatrolGuy_JDG", "");
  3137. GameObject *prisonGuard01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(9.80f, -72.88f, 0));
  3138. Commands->Attach_Script(prisonGuard01, "M04_PointGuard_JDG", "");
  3139. GameObject *prisonGuard02 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-9.39f, -72.49f, 0));
  3140. Commands->Attach_Script(prisonGuard02, "M04_PointGuard_JDG", "");
  3141. patrolGuy01_ID = Commands->Get_ID ( patrolGuy01 );;
  3142. patrolGuy02_ID = Commands->Get_ID ( patrolGuy02 );
  3143. pointGuard01_ID = Commands->Get_ID ( pointGuard01 );
  3144. pointGuard02_ID = Commands->Get_ID ( pointGuard02 );
  3145. BHpatrolGuy_ID = Commands->Get_ID ( BHpatrolGuy );
  3146. prisonGuard01_ID = Commands->Get_ID ( prisonGuard01 );
  3147. prisonGuard02_ID = Commands->Get_ID ( prisonGuard02 );
  3148. }
  3149. else if (param == 200)//someone's been killed
  3150. {
  3151. number_of_guys_killed++;
  3152. if ((number_of_guys_killed == 2) )
  3153. {
  3154. //Commands->Create_Sound ( "ThereHeIs", Vector3(8.51f, -108.05f, 6.00f), obj );
  3155. Commands->Send_Custom_Event( obj, obj, 0, 2000, 2 );//play second dialog line "call reinforcements"
  3156. }
  3157. if ((number_of_guys_killed >= 2) && (number_of_guys_killed <= 5) )
  3158. {
  3159. GameObject *reinforceGuy02 = Commands->Trigger_Spawner( 100630 );
  3160. Commands->Attach_Script(reinforceGuy02, "M04_AftDeck_Reinforcement_JDG", "");
  3161. float motto_reinforce_ka = Commands->Get_Random ( 0.5, 2.5 );
  3162. if ((motto_reinforce_ka >= 0.5) && (motto_reinforce_ka < 1.5) )
  3163. {
  3164. float delayTimer = Commands->Get_Random ( 2, 5 );
  3165. Commands->Send_Custom_Event( obj, obj, 0, 1000, delayTimer );//spawn 2 more guys
  3166. }
  3167. }
  3168. }
  3169. else if (param == 1000)//spawn 2 more guys after short delay
  3170. {
  3171. if ((number_of_guys_killed >= 2) && (number_of_guys_killed <= 5) )
  3172. {
  3173. GameObject *reinforceGuy01 = Commands->Trigger_Spawner( 100629 );
  3174. GameObject *reinforceGuy02 = Commands->Trigger_Spawner( 100630 );
  3175. Commands->Attach_Script(reinforceGuy01, "M04_AftDeck_Reinforcement_JDG", "");
  3176. Commands->Attach_Script(reinforceGuy02, "M04_AftDeck_Reinforcement_JDG", "");
  3177. }
  3178. }
  3179. else if (param == 2000)//play dialog line "call reinforcements"
  3180. {
  3181. //Commands->Create_Sound ( "CallReinforcements", Vector3(8.51f, -108.05f, 6.00f), obj );
  3182. }
  3183. else if ((param == 3000) && (prisoner_reinforcements <= 5) )//prisoners have been rescued--release the hounds
  3184. {
  3185. prisoner_reinforcements++;
  3186. GameObject *reinforceGuy01 = NULL;
  3187. GameObject *reinforceGuy02 = NULL;
  3188. reinforceGuy01 = Commands->Trigger_Spawner( 100629 );
  3189. reinforceGuy02 = Commands->Trigger_Spawner( 100630 );
  3190. Commands->Attach_Script(reinforceGuy01, "M04_AftDeck_Reinforcement_JDG", "");
  3191. Commands->Attach_Script(reinforceGuy02, "M04_AftDeck_Reinforcement_JDG", "");
  3192. }
  3193. else if (param == 4000) //player is moving up toward first mate
  3194. {
  3195. GameObject *lockerRoompatrolGuy01 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(2.53f, -76.81f, 6.00f));
  3196. Commands->Attach_Script(lockerRoompatrolGuy01, "M04_Aft_LockerRoom_PatrolGuy01_JDG", "");
  3197. GameObject *lockerRoompatrolGuy02 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(-1.65f, -76.81f, 6.00f));
  3198. Commands->Attach_Script(lockerRoompatrolGuy02, "M04_Aft_LockerRoom_PatrolGuy02_JDG", "");
  3199. GameObject *leftBarracksTalkGuy01 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(11.01f, -103.69f, 6.00f));
  3200. Commands->Attach_Script(leftBarracksTalkGuy01, "M04_Aft_LeftBarracks_TalkGuy_JDG", "");
  3201. Commands->Set_Facing ( leftBarracksTalkGuy01, 160);
  3202. GameObject *leftBarracksTalkGuy02 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(9.25f, -100.55f, 6.00f));
  3203. Commands->Attach_Script(leftBarracksTalkGuy02, "M04_Aft_LeftBarracks_TalkGuy_JDG", "");
  3204. Commands->Set_Facing ( leftBarracksTalkGuy02, -75);
  3205. GameObject *leftBarracksTalkGuy03 = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(9.33f, -103.77f, 6.00f));
  3206. Commands->Attach_Script(leftBarracksTalkGuy03, "M04_Aft_LeftBarracks_TalkGuy_JDG", "");
  3207. Commands->Set_Facing ( leftBarracksTalkGuy03, 60);
  3208. GameObject *rightBarrackspatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-9.33f, -102.35f, 6.00f));
  3209. Commands->Attach_Script(rightBarrackspatrolGuy, "M04_Aft_RightBarracks_PatrolGuy_JDG", "");
  3210. lockerRoompatrolGuy01_ID = Commands->Get_ID ( lockerRoompatrolGuy01 );
  3211. lockerRoompatrolGuy02_ID = Commands->Get_ID ( lockerRoompatrolGuy02 );
  3212. leftBarracksTalkGuy01_ID = Commands->Get_ID ( leftBarracksTalkGuy01 );
  3213. leftBarracksTalkGuy02_ID = Commands->Get_ID ( leftBarracksTalkGuy02 );
  3214. leftBarracksTalkGuy03_ID = Commands->Get_ID ( leftBarracksTalkGuy03 );
  3215. rightBarrackspatrolGuy_ID = Commands->Get_ID ( rightBarrackspatrolGuy );
  3216. }
  3217. else if (param == 5000) //player is almost at first mate
  3218. {
  3219. GameObject *blackHandPointGuard02 = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(9.13f, -86.51f, 9.00f));
  3220. Commands->Set_Facing ( blackHandPointGuard02, -90);
  3221. GameObject *miniGunnerGuard01 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(-9.25f, -76.39f, 9.00f));
  3222. GameObject *miniGunnerGuard02 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(0.46f, -75.99f, 9.00f));
  3223. GameObject *miniGunnerGuard03 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(11.11f, -76.49f, 9.00f));
  3224. GameObject *blackHandMateGuard01 = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(3.24f, -79.21f, 12.00f));
  3225. Commands->Attach_Script(blackHandMateGuard01, "M04_Aft_FirstMateBodyguard_JDG", "");
  3226. Commands->Set_Facing ( blackHandMateGuard01, 0);
  3227. GameObject *blackHandMateGuard02 = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(3.85f, -85.44f, 12.00f));
  3228. Commands->Attach_Script(blackHandMateGuard02, "M04_Aft_FirstMateBodyguard_JDG", "");
  3229. Commands->Set_Facing ( blackHandMateGuard02, 0);
  3230. GameObject *blackHandMateGuard03 = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(-4.25f, -85.21f, 12.00f));
  3231. Commands->Attach_Script(blackHandMateGuard03, "M04_Aft_FirstMateBodyguard_JDG", "");
  3232. Commands->Set_Facing ( blackHandMateGuard03, 175);
  3233. GameObject *blackHandMateGuard04 = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(-4.19f, -79.31f, 12.00f));
  3234. Commands->Attach_Script(blackHandMateGuard04, "M04_Aft_FirstMateBodyguard_JDG", "");
  3235. Commands->Set_Facing ( blackHandMateGuard04, 175);
  3236. blackHandPointGuard02_ID = Commands->Get_ID ( blackHandPointGuard02 );
  3237. miniGunnerGuard01_ID = Commands->Get_ID ( miniGunnerGuard01 );
  3238. miniGunnerGuard02_ID = Commands->Get_ID ( miniGunnerGuard02 );
  3239. miniGunnerGuard03_ID = Commands->Get_ID ( miniGunnerGuard03 );
  3240. blackHandMateGuard01_ID = Commands->Get_ID ( blackHandMateGuard01 );
  3241. blackHandMateGuard02_ID = Commands->Get_ID ( blackHandMateGuard02 );
  3242. blackHandMateGuard03_ID = Commands->Get_ID ( blackHandMateGuard03 );
  3243. blackHandMateGuard04_ID = Commands->Get_ID ( blackHandMateGuard04 );
  3244. }
  3245. else if (param == 5500) //tell body guards to goto innate
  3246. {
  3247. GameObject *blackHandMateGuard01 = Commands->Find_Object ( blackHandMateGuard01_ID );
  3248. if (blackHandMateGuard01 != NULL)
  3249. {
  3250. Commands->Send_Custom_Event( obj, blackHandMateGuard01, 0, 100, 0 );
  3251. }
  3252. GameObject *blackHandMateGuard02 = Commands->Find_Object ( blackHandMateGuard02_ID );
  3253. if (blackHandMateGuard02 != NULL)
  3254. {
  3255. Commands->Send_Custom_Event( obj, blackHandMateGuard02, 0, 100, 0 );
  3256. }
  3257. GameObject *blackHandMateGuard03 = Commands->Find_Object ( blackHandMateGuard03_ID );
  3258. if (blackHandMateGuard03 != NULL)
  3259. {
  3260. Commands->Send_Custom_Event( obj, blackHandMateGuard03, 0, 100, 0 );
  3261. }
  3262. GameObject *blackHandMateGuard04 = Commands->Find_Object ( blackHandMateGuard04_ID );
  3263. if (blackHandMateGuard04 != NULL)
  3264. {
  3265. Commands->Send_Custom_Event( obj, blackHandMateGuard04, 0, 100, 0 );
  3266. }
  3267. }
  3268. else if (param == 6000) //player is leaving the aft deck...clean up any remaing soldiers
  3269. {
  3270. GameObject *patrolGuy01 = Commands->Find_Object ( patrolGuy01_ID );
  3271. if (patrolGuy01 != NULL)
  3272. {
  3273. Commands->Destroy_Object ( patrolGuy01 );
  3274. }
  3275. GameObject *patrolGuy02 = Commands->Find_Object ( patrolGuy02_ID );
  3276. if (patrolGuy02 != NULL)
  3277. {
  3278. Commands->Destroy_Object ( patrolGuy02 );
  3279. }
  3280. GameObject *pointGuard01 = Commands->Find_Object ( pointGuard01_ID );
  3281. if (pointGuard01 != NULL)
  3282. {
  3283. Commands->Destroy_Object ( pointGuard01 );
  3284. }
  3285. GameObject *pointGuard02 = Commands->Find_Object ( pointGuard02_ID );
  3286. if (pointGuard02 != NULL)
  3287. {
  3288. Commands->Destroy_Object ( pointGuard02 );
  3289. }
  3290. GameObject *BHpatrolGuy = Commands->Find_Object ( BHpatrolGuy_ID );
  3291. if (BHpatrolGuy != NULL)
  3292. {
  3293. Commands->Destroy_Object ( BHpatrolGuy );
  3294. }
  3295. GameObject *prisonGuard01 = Commands->Find_Object ( prisonGuard01_ID );
  3296. if (prisonGuard01 != NULL)
  3297. {
  3298. Commands->Destroy_Object ( prisonGuard01 );
  3299. }
  3300. GameObject *prisonGuard02 = Commands->Find_Object ( prisonGuard02_ID );
  3301. if (prisonGuard02 != NULL)
  3302. {
  3303. Commands->Destroy_Object ( prisonGuard02 );
  3304. }
  3305. GameObject *lockerRoompatrolGuy01 = Commands->Find_Object ( lockerRoompatrolGuy01_ID );
  3306. if (lockerRoompatrolGuy01 != NULL)
  3307. {
  3308. Commands->Destroy_Object ( lockerRoompatrolGuy01 );
  3309. }
  3310. GameObject *lockerRoompatrolGuy02 = Commands->Find_Object ( lockerRoompatrolGuy02_ID );
  3311. if (lockerRoompatrolGuy02 != NULL)
  3312. {
  3313. Commands->Destroy_Object ( lockerRoompatrolGuy02 );
  3314. }
  3315. GameObject *leftBarracksTalkGuy01 = Commands->Find_Object ( leftBarracksTalkGuy01_ID );
  3316. if (leftBarracksTalkGuy01 != NULL)
  3317. {
  3318. Commands->Destroy_Object ( leftBarracksTalkGuy01 );
  3319. }
  3320. GameObject *leftBarracksTalkGuy02 = Commands->Find_Object ( leftBarracksTalkGuy02_ID );
  3321. if (leftBarracksTalkGuy02 != NULL)
  3322. {
  3323. Commands->Destroy_Object ( leftBarracksTalkGuy02 );
  3324. }
  3325. GameObject *leftBarracksTalkGuy03 = Commands->Find_Object ( leftBarracksTalkGuy03_ID );
  3326. if (leftBarracksTalkGuy03 != NULL)
  3327. {
  3328. Commands->Destroy_Object ( leftBarracksTalkGuy03 );
  3329. }
  3330. GameObject *rightBarrackspatrolGuy = Commands->Find_Object ( rightBarrackspatrolGuy_ID );
  3331. if (rightBarrackspatrolGuy != NULL)
  3332. {
  3333. Commands->Destroy_Object ( rightBarrackspatrolGuy );
  3334. }
  3335. GameObject *blackHandPointGuard01 = Commands->Find_Object ( blackHandPointGuard01_ID );
  3336. if (blackHandPointGuard01 != NULL)
  3337. {
  3338. Commands->Destroy_Object ( blackHandPointGuard01 );
  3339. }
  3340. GameObject *blackHandPointGuard02 = Commands->Find_Object ( blackHandPointGuard02_ID );
  3341. if (blackHandPointGuard02 != NULL)
  3342. {
  3343. Commands->Destroy_Object ( blackHandPointGuard02 );
  3344. }
  3345. GameObject *miniGunnerGuard01 = Commands->Find_Object ( miniGunnerGuard01_ID );
  3346. if (miniGunnerGuard01 != NULL)
  3347. {
  3348. Commands->Destroy_Object ( miniGunnerGuard01 );
  3349. }
  3350. GameObject *miniGunnerGuard02 = Commands->Find_Object ( miniGunnerGuard02_ID );
  3351. if (miniGunnerGuard02 != NULL)
  3352. {
  3353. Commands->Destroy_Object ( miniGunnerGuard02 );
  3354. }
  3355. GameObject *miniGunnerGuard03 = Commands->Find_Object ( miniGunnerGuard03_ID );
  3356. if (miniGunnerGuard03 != NULL)
  3357. {
  3358. Commands->Destroy_Object ( miniGunnerGuard03 );
  3359. }
  3360. GameObject *blackHandMateGuard01 = Commands->Find_Object ( blackHandMateGuard01_ID );
  3361. if (blackHandMateGuard01 != NULL)
  3362. {
  3363. Commands->Destroy_Object ( blackHandMateGuard01 );
  3364. }
  3365. GameObject *blackHandMateGuard02 = Commands->Find_Object ( blackHandMateGuard02_ID );
  3366. if (blackHandMateGuard02 != NULL)
  3367. {
  3368. Commands->Destroy_Object ( blackHandMateGuard02 );
  3369. }
  3370. GameObject *blackHandMateGuard03 = Commands->Find_Object ( blackHandMateGuard03_ID );
  3371. if (blackHandMateGuard03 != NULL)
  3372. {
  3373. Commands->Destroy_Object ( blackHandMateGuard03 );
  3374. }
  3375. GameObject *blackHandMateGuard04 = Commands->Find_Object ( blackHandMateGuard04_ID );
  3376. if (blackHandMateGuard04 != NULL)
  3377. {
  3378. Commands->Destroy_Object ( blackHandMateGuard04 );
  3379. }
  3380. GameObject *reinforceGuy01 = Commands->Trigger_Spawner( 100724 );
  3381. GameObject *reinforceGuy02 = Commands->Trigger_Spawner( 100725 );
  3382. GameObject *reinforceGuy03 = Commands->Trigger_Spawner( 100579 );
  3383. GameObject *reinforceGuy04 = Commands->Trigger_Spawner( 100581 );
  3384. Commands->Attach_Script(reinforceGuy01, "M04_AftDeck_Reinforcement_JDG", "");
  3385. Commands->Attach_Script(reinforceGuy02, "M04_AftDeck_Reinforcement_JDG", "");
  3386. Commands->Attach_Script(reinforceGuy03, "M04_AftDeck_Reinforcement_JDG", "");
  3387. Commands->Attach_Script(reinforceGuy04, "M04_AftDeck_Reinforcement_JDG", "");
  3388. }
  3389. }
  3390. };
  3391. DECLARE_SCRIPT(M04_Aft_FirstMateBodyguard_JDG, "")
  3392. {
  3393. void Created( GameObject * obj )
  3394. {
  3395. Commands->Innate_Disable( obj);
  3396. }
  3397. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3398. {
  3399. if (param == 100)//here comes the player--goto innate
  3400. {
  3401. if (obj)
  3402. {
  3403. Commands->Innate_Enable(obj);
  3404. Commands->Set_Innate_Aggressiveness ( obj, .50f );
  3405. Commands->Set_Innate_Take_Cover_Probability ( obj, 1.0f );
  3406. }
  3407. }
  3408. }
  3409. };
  3410. DECLARE_SCRIPT(M04_SecondaryBridge_Enter_Zone_JDG, "")
  3411. {
  3412. void Entered( GameObject * obj, GameObject * enterer )
  3413. {
  3414. if ( enterer == STAR )
  3415. {
  3416. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_SHIPS_FIRST_MATE_JDG), 0, 100, 0 );//tell first mate to start hearing stuff
  3417. //Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 1000, 0 );//tell objective controller to play battle music
  3418. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 5500, 0 );//tell bodyguards to goto innate
  3419. GameObject * zone01 = Commands->Find_Object ( 100684 );
  3420. if (zone01 != NULL)
  3421. {
  3422. Commands->Destroy_Object ( zone01 );//clean up the two zones
  3423. }
  3424. GameObject * zone02 = Commands->Find_Object ( 100686 );
  3425. if (zone02 != NULL)
  3426. {
  3427. Commands->Destroy_Object ( zone02 );//clean up the two zones
  3428. }
  3429. }
  3430. }
  3431. };
  3432. DECLARE_SCRIPT(M04_Player_Is_Leaving_Aft_Deck_JDG, "")
  3433. {
  3434. void Entered( GameObject * obj, GameObject * enterer )
  3435. {
  3436. if (enterer == STAR)
  3437. {
  3438. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 6000, 0 );//tell aft deck controller to clean up any remaining soldiers
  3439. GameObject * zone01 = Commands->Find_Object ( 100726 );
  3440. if (zone01 != NULL)
  3441. {
  3442. Commands->Destroy_Object ( zone01 );//clean up the two zones
  3443. }
  3444. GameObject * zone02 = Commands->Find_Object ( 100727 );
  3445. if (zone02 != NULL)
  3446. {
  3447. Commands->Destroy_Object ( zone02 );//clean up the two zones
  3448. }
  3449. }
  3450. }
  3451. };
  3452. DECLARE_SCRIPT(M04_Aft_RightBarracks_PatrolGuy_JDG, "")
  3453. {
  3454. int curr_action_id;
  3455. REGISTER_VARIABLES()
  3456. {
  3457. SAVE_VARIABLE( curr_action_id, 1 );
  3458. }
  3459. void Created( GameObject * obj )
  3460. {
  3461. ActionParamsStruct params;
  3462. curr_action_id = 100;
  3463. params.Set_Basic( this, 45, curr_action_id );
  3464. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3465. params.WaypathID = 100667;
  3466. params.WaypointStartID = 100668;
  3467. params.WaypointEndID = 100669;
  3468. Commands->Action_Goto( obj, params );
  3469. }
  3470. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3471. {
  3472. ActionParamsStruct params;
  3473. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3474. {
  3475. char *animationName = M01_Choose_Idle_Animation ( );
  3476. curr_action_id++;
  3477. params.Set_Basic( this, 45, curr_action_id );
  3478. params.Set_Animation (animationName, false);
  3479. Commands->Action_Play_Animation (obj, params);
  3480. }
  3481. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3482. {
  3483. curr_action_id++;
  3484. params.Set_Basic( this, 45, curr_action_id );
  3485. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3486. params.WaypathID = 100671;
  3487. params.WaypointStartID = 100672;
  3488. params.WaypointEndID = 100673;
  3489. Commands->Action_Goto( obj, params );
  3490. }
  3491. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  3492. {
  3493. char *animationName = M01_Choose_Idle_Animation ( );
  3494. curr_action_id++;
  3495. params.Set_Basic( this, 45, curr_action_id );
  3496. params.Set_Animation (animationName, false);
  3497. Commands->Action_Play_Animation (obj, params);
  3498. }
  3499. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  3500. {
  3501. curr_action_id = 100;
  3502. params.Set_Basic( this, 45, curr_action_id );
  3503. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3504. params.WaypathID = 100667;
  3505. params.WaypointStartID = 100668;
  3506. params.WaypointEndID = 100669;
  3507. Commands->Action_Goto( obj, params );;
  3508. }
  3509. }
  3510. };
  3511. DECLARE_SCRIPT(M04_Aft_LeftBarracks_TalkGuy_JDG, "")
  3512. {
  3513. void Created( GameObject * obj )
  3514. {
  3515. ActionParamsStruct params;
  3516. Vector3 goto_spot = Commands->Get_Position( obj );
  3517. params.Set_Basic(this, 45, 100);
  3518. params.Set_Movement( goto_spot, .750f, .25f );
  3519. Commands->Action_Goto( obj, params );
  3520. }
  3521. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3522. {
  3523. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3524. {
  3525. ActionParamsStruct params;
  3526. char *animationName = M01_Choose_Idle_Animation ( );
  3527. params.Set_Basic( this, 45, 100 );
  3528. params.Set_Animation (animationName, false);
  3529. Commands->Action_Play_Animation (obj, params);
  3530. }
  3531. }
  3532. };
  3533. DECLARE_SCRIPT(M04_Aft_LockerRoom_PatrolGuy01_JDG, "")
  3534. {
  3535. int curr_action_id;
  3536. REGISTER_VARIABLES()
  3537. {
  3538. SAVE_VARIABLE( curr_action_id, 1 );
  3539. }
  3540. void Created( GameObject * obj )
  3541. {
  3542. ActionParamsStruct params;
  3543. curr_action_id = 100;
  3544. params.Set_Basic( this, 45, curr_action_id );
  3545. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3546. params.WaypathID = 100649;
  3547. params.WaypointStartID = 100650;
  3548. params.WaypointEndID = 100651;
  3549. Commands->Action_Goto( obj, params );
  3550. }
  3551. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3552. {
  3553. ActionParamsStruct params;
  3554. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3555. {
  3556. char *animationName = M01_Choose_Idle_Animation ( );
  3557. curr_action_id++;
  3558. params.Set_Basic( this, 45, curr_action_id );
  3559. params.Set_Animation (animationName, false);
  3560. Commands->Action_Play_Animation (obj, params);
  3561. }
  3562. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3563. {
  3564. curr_action_id++;
  3565. params.Set_Basic( this, 45, curr_action_id );
  3566. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3567. params.WaypathID = 100653;
  3568. params.WaypointStartID = 100654;
  3569. params.WaypointEndID = 100655;
  3570. Commands->Action_Goto( obj, params );
  3571. }
  3572. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  3573. {
  3574. char *animationName = M01_Choose_Idle_Animation ( );
  3575. curr_action_id++;
  3576. params.Set_Basic( this, 45, curr_action_id );
  3577. params.Set_Animation (animationName, false);
  3578. Commands->Action_Play_Animation (obj, params);
  3579. }
  3580. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  3581. {
  3582. curr_action_id = 100;
  3583. params.Set_Basic( this, 45, curr_action_id );
  3584. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3585. params.WaypathID = 100657;
  3586. params.WaypointStartID = 100658;
  3587. params.WaypointEndID = 100659;
  3588. Commands->Action_Goto( obj, params );
  3589. }
  3590. }
  3591. };
  3592. DECLARE_SCRIPT(M04_Aft_LockerRoom_PatrolGuy02_JDG, "")
  3593. {
  3594. int curr_action_id;
  3595. REGISTER_VARIABLES()
  3596. {
  3597. SAVE_VARIABLE( curr_action_id, 1 );
  3598. }
  3599. void Created( GameObject * obj )
  3600. {
  3601. ActionParamsStruct params;
  3602. curr_action_id = 100;
  3603. params.Set_Basic( this, 45, curr_action_id );
  3604. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3605. params.WaypathID = 100661;
  3606. params.WaypointStartID = 100662;
  3607. params.WaypointEndID = 100663;
  3608. Commands->Action_Goto( obj, params );
  3609. }
  3610. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3611. {
  3612. ActionParamsStruct params;
  3613. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3614. {
  3615. char *animationName = M01_Choose_Idle_Animation ( );
  3616. curr_action_id++;
  3617. params.Set_Basic( this, 45, curr_action_id );
  3618. params.Set_Animation (animationName, false);
  3619. Commands->Action_Play_Animation (obj, params);
  3620. }
  3621. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3622. {
  3623. curr_action_id++;
  3624. params.Set_Basic( this, 45, curr_action_id );
  3625. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3626. params.WaypathID = 100657;
  3627. params.WaypointStartID = 100658;
  3628. params.WaypointEndID = 100659;
  3629. Commands->Action_Goto( obj, params );
  3630. }
  3631. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  3632. {
  3633. char *animationName = M01_Choose_Idle_Animation ( );
  3634. curr_action_id++;
  3635. params.Set_Basic( this, 45, curr_action_id );
  3636. params.Set_Animation (animationName, false);
  3637. Commands->Action_Play_Animation (obj, params);
  3638. }
  3639. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  3640. {
  3641. curr_action_id = 100;
  3642. params.Set_Basic( this, 45, curr_action_id );
  3643. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3644. params.WaypathID = 100653;
  3645. params.WaypointStartID = 100654;
  3646. params.WaypointEndID = 100655;
  3647. Commands->Action_Goto( obj, params );
  3648. }
  3649. }
  3650. };
  3651. DECLARE_SCRIPT(M04_AftDeck_Reinforcement_JDG, "")
  3652. {
  3653. void Created( GameObject * obj )
  3654. {
  3655. ActionParamsStruct params;
  3656. Vector3 player_location = Commands->Get_Position ( STAR );
  3657. params.Set_Basic( this, 45, 100 );
  3658. params.Set_Movement( player_location, 1.0f, 7.0f );
  3659. Commands->Action_Goto( obj, params );
  3660. Commands->Grant_Key( obj, 1, true );
  3661. Commands->Grant_Key( obj, 2, true );
  3662. }
  3663. void Killed( GameObject * obj, GameObject * killer )
  3664. {
  3665. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell aft deck controller that you've been killed
  3666. }
  3667. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3668. {
  3669. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3670. {
  3671. ActionParamsStruct params;
  3672. Vector3 player_location = Commands->Get_Position ( STAR );
  3673. params.Set_Basic( this, 50, 100 );
  3674. params.Set_Movement( player_location, 1.0f, 7.0f );
  3675. Commands->Action_Goto( obj, params );
  3676. }
  3677. }
  3678. };
  3679. DECLARE_SCRIPT(M04_AftDeck_02_PatrolGuy_01_JDG, "")
  3680. {
  3681. void Created( GameObject * obj )
  3682. {
  3683. ActionParamsStruct params;
  3684. params.Set_Basic( this, 45, 100 );
  3685. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3686. params.WaypathID = 100249;
  3687. params.WaypointStartID = 100250;
  3688. params.WaypointEndID = 100251;
  3689. Commands->Action_Goto( obj, params );
  3690. }
  3691. void Killed( GameObject * obj, GameObject * killer )
  3692. {
  3693. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell aft deck controller that you've been killed
  3694. }
  3695. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3696. {
  3697. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3698. {
  3699. ActionParamsStruct params;
  3700. params.Set_Basic( this, 45, 101 );
  3701. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3702. params.WaypathID = 100253;
  3703. params.WaypointStartID = 100254;
  3704. params.WaypointEndID = 100255;
  3705. Commands->Action_Goto( obj, params );
  3706. }
  3707. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3708. {
  3709. ActionParamsStruct params;
  3710. params.Set_Basic( this, 45, 100 );
  3711. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3712. params.WaypathID = 100249;
  3713. params.WaypointStartID = 100250;
  3714. params.WaypointEndID = 100251;
  3715. Commands->Action_Goto( obj, params );
  3716. }
  3717. }
  3718. };
  3719. DECLARE_SCRIPT(M04_AftDeck_02_PatrolGuy_02_JDG, "")
  3720. {
  3721. void Created( GameObject * obj )
  3722. {
  3723. ActionParamsStruct params;
  3724. params.Set_Basic( this, 45, 100 );
  3725. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3726. params.WaypathID = 100238;
  3727. params.WaypointStartID = 100239;
  3728. params.WaypointEndID = 100242;
  3729. Commands->Action_Goto( obj, params );
  3730. }
  3731. void Killed( GameObject * obj, GameObject * killer )
  3732. {
  3733. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell aft deck controller that you've been killed
  3734. }
  3735. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3736. {
  3737. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3738. {
  3739. ActionParamsStruct params;
  3740. params.Set_Basic( this, 45, 101 );
  3741. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3742. params.WaypathID = 100244;
  3743. params.WaypointStartID = 100245;
  3744. params.WaypointEndID = 100247;
  3745. Commands->Action_Goto( obj, params );
  3746. }
  3747. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3748. {
  3749. ActionParamsStruct params;
  3750. params.Set_Basic( this, 45, 100 );
  3751. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3752. params.WaypathID = 100238;
  3753. params.WaypointStartID = 100239;
  3754. params.WaypointEndID = 100242;
  3755. Commands->Action_Goto( obj, params );
  3756. }
  3757. }
  3758. };
  3759. DECLARE_SCRIPT(M04_AftDeck_02_Blackhand_PatrolGuy_JDG, "")
  3760. {
  3761. void Created( GameObject * obj )
  3762. {
  3763. float delayTimer = Commands->Get_Random ( 2, 5 );
  3764. Commands->Send_Custom_Event( obj, obj, 0, 100, delayTimer );
  3765. }
  3766. void Killed( GameObject * obj, GameObject * killer )
  3767. {
  3768. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell aft deck controller that you've been killed
  3769. }
  3770. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  3771. {
  3772. Vector3 look_to_spot(-0.69f, -128.52f, 4.05f);
  3773. Vector3 present_location = Commands->Get_Position ( obj );;
  3774. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  3775. {
  3776. ActionParamsStruct params;
  3777. params.Set_Basic( this, 45, 500 );
  3778. params.Set_Movement( present_location, .20f, .25f );
  3779. params.Set_Attack (look_to_spot, 0,0, true);
  3780. Commands->Action_Attack( obj, params);
  3781. float delayTimer = Commands->Get_Random ( 2, 5 );
  3782. Commands->Send_Custom_Event( obj, obj, 0, 101, delayTimer );
  3783. }
  3784. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  3785. {
  3786. ActionParamsStruct params;
  3787. params.Set_Basic( this, 45, 500 );
  3788. params.Set_Movement( present_location, .20f, .25f );
  3789. params.Set_Attack (look_to_spot, 0,0, true);
  3790. Commands->Action_Attack( obj, params);
  3791. float delayTimer = Commands->Get_Random ( 2, 5 );
  3792. Commands->Send_Custom_Event( obj, obj, 0, 102, delayTimer );
  3793. }
  3794. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  3795. {
  3796. ActionParamsStruct params;
  3797. params.Set_Basic( this, 45, 500 );
  3798. params.Set_Movement( present_location, .20f, .25f );
  3799. params.Set_Attack (look_to_spot, 0,0, true);
  3800. Commands->Action_Attack( obj, params);
  3801. float delayTimer = Commands->Get_Random ( 2, 5 );
  3802. Commands->Send_Custom_Event( obj, obj, 0, 103, delayTimer );
  3803. }
  3804. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  3805. {
  3806. ActionParamsStruct params;
  3807. params.Set_Basic( this, 45, 500 );
  3808. params.Set_Movement( present_location, .20f, .25f );
  3809. params.Set_Attack (look_to_spot, 0,0, true);
  3810. Commands->Action_Attack( obj, params);
  3811. float delayTimer = Commands->Get_Random ( 2, 5 );
  3812. Commands->Send_Custom_Event( obj, obj, 0, 100, delayTimer );
  3813. }
  3814. }
  3815. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3816. {
  3817. if (param == 100)//recieved custom to goto next waypath
  3818. {
  3819. ActionParamsStruct params;
  3820. params.Set_Basic( this, 45, 100 );
  3821. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3822. params.WaypathID = 100607;
  3823. params.WaypointStartID = 100608;
  3824. params.WaypointEndID = 100609;
  3825. Commands->Action_Goto( obj, params );
  3826. }
  3827. else if (param == 101)//recieved custom to goto next waypath
  3828. {
  3829. ActionParamsStruct params;
  3830. params.Set_Basic( this, 45, 101 );
  3831. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3832. params.WaypathID = 100611;
  3833. params.WaypointStartID = 100612;
  3834. params.WaypointEndID = 100613;
  3835. Commands->Action_Goto( obj, params );
  3836. }
  3837. else if (param == 102)//recieved custom to goto next waypath
  3838. {
  3839. ActionParamsStruct params;
  3840. params.Set_Basic( this, 45, 102 );
  3841. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3842. params.WaypathID = 100615;
  3843. params.WaypointStartID = 100616;
  3844. params.WaypointEndID = 100617;
  3845. Commands->Action_Goto( obj, params );
  3846. }
  3847. else if (param == 103)//recieved custom to goto next waypath
  3848. {
  3849. ActionParamsStruct params;
  3850. params.Set_Basic( this, 45, 103 );
  3851. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  3852. params.WaypathID = 100619;
  3853. params.WaypointStartID = 100620;
  3854. params.WaypointEndID = 100621;
  3855. Commands->Action_Goto( obj, params );
  3856. }
  3857. }
  3858. };
  3859. DECLARE_SCRIPT(M04_AftDeck_02_Pointguard_JDG, "")
  3860. {
  3861. void Created( GameObject * obj )
  3862. {
  3863. Commands->Set_Innate_Is_Stationary ( obj, true );
  3864. }
  3865. void Damaged( GameObject * obj, GameObject * damager, float amount )
  3866. {
  3867. if (obj)
  3868. {
  3869. Commands->Set_Innate_Is_Stationary ( obj, false );
  3870. }
  3871. }
  3872. void Killed( GameObject * obj, GameObject * killer )
  3873. {
  3874. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell aft deck controller that you've been killed
  3875. }
  3876. };
  3877. DECLARE_SCRIPT(M04_AftDeck_02_Entry_Zone_JDG, "")
  3878. {
  3879. void Entered( GameObject * obj, GameObject * enterer )
  3880. {
  3881. if ( enterer == STAR)
  3882. {
  3883. Commands->Create_Sound ( "00-n060e", Commands->Get_Position ( obj ), obj );//updating radar flags
  3884. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 100, 0 );//tell aft deck controller to start scenario
  3885. GameObject * sniperTarget01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-9.160f, -89.962f, 9.000f));
  3886. Commands->Attach_Script(sniperTarget01, "M04_Doorway_Enterer_JDG", "-0.091 -107.613 6");
  3887. GameObject * sniperTarget02 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(9.194f, -77.535f, 3));
  3888. Commands->Attach_Script(sniperTarget02, "M04_Doorway_Enterer_JDG", "14.657 -94.107 3");
  3889. GameObject * surpriseApache = Commands->Create_Object ( "Nod_Apache", Vector3(-50.075f, 8.732f, 5.534f));
  3890. Commands->Attach_Script(surpriseApache, "M04_Surprise_Apache_JDG", "");
  3891. Commands->Destroy_Object ( obj ); //clean up the zone
  3892. }
  3893. }
  3894. };
  3895. DECLARE_SCRIPT(M04_Surprise_Apache_JDG, "")
  3896. {
  3897. void Created( GameObject * obj )
  3898. {
  3899. Commands->Disable_Physical_Collisions ( obj );
  3900. ActionParamsStruct params;
  3901. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  3902. params.Set_Movement( Vector3(0,0,0), .15f, 10 );
  3903. params.WaypathID = 104437;
  3904. params.MovePathfind = false;
  3905. //params.WaypointStartID = 104439;
  3906. //params.WaypointEndID = 101276;
  3907. Commands->Action_Goto( obj, params );
  3908. }
  3909. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  3910. {
  3911. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  3912. {
  3913. Commands->Destroy_Object ( obj );
  3914. }
  3915. }
  3916. };
  3917. /*************************************************************************************************************
  3918. The following are all the temp scripts for the apache hanger
  3919. *************************************************************************************************************/
  3920. DECLARE_SCRIPT(M04_Apache_Enter_Zone_JDG, "")
  3921. {
  3922. void Entered( GameObject * obj, GameObject * enterer )
  3923. {
  3924. if ( enterer == STAR )
  3925. {
  3926. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_APACHE_CONTROLLER_JDG), 0, 100, 0 );//tell apache controller to place actors
  3927. GameObject * sniperTarget01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-10.057f, 81.803f, -15));
  3928. Commands->Attach_Script(sniperTarget01, "M04_Doorway_Enterer_JDG", "-12.689 69.327 -15");
  3929. GameObject * huntercontroller = Commands->Find_Object (M04_ENGINEROOM_HUNTING_CONTROLLER_JDG);
  3930. if (huntercontroller != NULL)
  3931. {
  3932. Commands->Send_Custom_Event( obj, huntercontroller, 0, M01_GOTO_IDLE_JDG, 0 );
  3933. }
  3934. GameObject * zone02 = Commands->Find_Object (200006);
  3935. if (zone02 != NULL)
  3936. {
  3937. Commands->Destroy_Object ( zone02 );//clean up these zones
  3938. }
  3939. GameObject * zone03 = Commands->Find_Object (200008);
  3940. if (zone03 != NULL)
  3941. {
  3942. Commands->Destroy_Object ( zone03 );//clean up these zones
  3943. }
  3944. }
  3945. }
  3946. };
  3947. DECLARE_SCRIPT(M04_ApacheRoom_Controller_JDG, "")//this guys ID number is M04_APACHE_CONTROLLER_JDG 200586
  3948. {
  3949. int m04apache_ID;
  3950. REGISTER_VARIABLES()
  3951. {
  3952. SAVE_VARIABLE(m04apache_ID, 1);
  3953. }
  3954. void Created( GameObject * obj )
  3955. {
  3956. m04apache_ID = 0;
  3957. }
  3958. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3959. {
  3960. if (param == 100)//recieved custom from enter zones--here comes the player(s)
  3961. {
  3962. GameObject *m04apache = Commands->Create_Object ( "NOD_Apache", Vector3(1.469f, 50.814f, -14.00f));
  3963. Commands->Attach_Script(m04apache, "M04_ApacheRoom_Apache_JDG", "");
  3964. Commands->Set_Facing ( m04apache, -125 );
  3965. GameObject *m04apacheSniper01 = Commands->Create_Object ( "Nod_MiniGunner_2SF", Vector3(-13.728f, 63.244f, -9.003f));
  3966. Commands->Attach_Script(m04apacheSniper01, "M04_ApacheRoom_Sniper01_JDG", "");
  3967. GameObject *m04apacheSniper02 = Commands->Create_Object ( "Nod_MiniGunner_2SF", Vector3(13.45f, 33.93f, -9.003f));
  3968. Commands->Attach_Script(m04apacheSniper02, "M04_ApacheRoom_Sniper02_JDG", "");
  3969. m04apache_ID = Commands->Get_ID ( m04apache );
  3970. GameObject * tailgun01 = Commands->Find_Object (M04_ROCKET_EMPLACEMENT_01_JDG);
  3971. GameObject * tailgun02 = Commands->Find_Object (M04_ROCKET_EMPLACEMENT_02_JDG);
  3972. if (tailgun01 != NULL)
  3973. {
  3974. Commands->Send_Custom_Event( obj, tailgun01, M01_MODIFY_YOUR_ACTION_JDG, m04apache_ID, 0 );
  3975. }
  3976. if (tailgun02 != NULL)
  3977. {
  3978. Commands->Send_Custom_Event( obj, tailgun02, M01_MODIFY_YOUR_ACTION_JDG, m04apache_ID, 0 );
  3979. }
  3980. }
  3981. else if (param == 200)//recieved custom from trigger zone--tell apache to take off and attack player
  3982. {
  3983. Commands->Send_Custom_Event( obj, Commands->Find_Object (m04apache_ID), 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  3984. }
  3985. }
  3986. };
  3987. DECLARE_SCRIPT(M04_ApacheRoom_Sniper01_JDG, "")
  3988. {
  3989. int curr_action_id;
  3990. REGISTER_VARIABLES()
  3991. {
  3992. SAVE_VARIABLE(curr_action_id, 1);
  3993. }
  3994. void Created( GameObject * obj )
  3995. {
  3996. ActionParamsStruct params;
  3997. curr_action_id = 100;
  3998. params.Set_Basic( this, 45, curr_action_id );
  3999. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4000. params.WaypathID = 200592;
  4001. params.WaypointStartID = 200593;
  4002. params.WaypointEndID = 200594;
  4003. Commands->Action_Goto( obj, params );
  4004. }
  4005. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4006. {
  4007. ActionParamsStruct params;
  4008. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4009. {
  4010. char *animationName = M01_Choose_Idle_Animation ( );
  4011. curr_action_id++;
  4012. params.Set_Basic( this, 45, curr_action_id );
  4013. params.Set_Animation (animationName, false);
  4014. Commands->Action_Play_Animation (obj, params);
  4015. }
  4016. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  4017. {
  4018. curr_action_id++;
  4019. params.Set_Basic( this, 45, curr_action_id );
  4020. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4021. params.WaypathID = 200596;
  4022. params.WaypointStartID = 200597;
  4023. params.WaypointEndID = 200598;
  4024. Commands->Action_Goto( obj, params );
  4025. }
  4026. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  4027. {
  4028. char *animationName = M01_Choose_Idle_Animation ( );
  4029. curr_action_id++;
  4030. params.Set_Basic( this, 45, curr_action_id );
  4031. params.Set_Animation (animationName, false);
  4032. Commands->Action_Play_Animation (obj, params);
  4033. }
  4034. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  4035. {
  4036. curr_action_id = 100;
  4037. params.Set_Basic( this, 45, curr_action_id );
  4038. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4039. params.WaypathID = 200592;
  4040. params.WaypointStartID = 200593;
  4041. params.WaypointEndID = 200594;
  4042. Commands->Action_Goto( obj, params );
  4043. }
  4044. }
  4045. };
  4046. DECLARE_SCRIPT(M04_ApacheRoom_Sniper02_JDG, "")
  4047. {
  4048. int curr_action_id;
  4049. REGISTER_VARIABLES()
  4050. {
  4051. SAVE_VARIABLE(curr_action_id, 1);
  4052. }
  4053. void Created( GameObject * obj )
  4054. {
  4055. ActionParamsStruct params;
  4056. curr_action_id = 100;
  4057. params.Set_Basic( this, 45, curr_action_id );
  4058. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4059. params.WaypathID = 200601;
  4060. params.WaypointStartID = 200602;
  4061. params.WaypointEndID = 200603;
  4062. Commands->Action_Goto( obj, params );
  4063. }
  4064. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4065. {
  4066. ActionParamsStruct params;
  4067. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4068. {
  4069. char *animationName = M01_Choose_Idle_Animation ( );
  4070. curr_action_id++;
  4071. params.Set_Basic( this, 45, curr_action_id );
  4072. params.Set_Animation (animationName, false);
  4073. Commands->Action_Play_Animation (obj, params);
  4074. }
  4075. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  4076. {
  4077. curr_action_id++;
  4078. params.Set_Basic( this, 45, curr_action_id );
  4079. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4080. params.WaypathID = 200605;
  4081. params.WaypointStartID = 200606;
  4082. params.WaypointEndID = 200607;
  4083. Commands->Action_Goto( obj, params );
  4084. }
  4085. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  4086. {
  4087. char *animationName = M01_Choose_Idle_Animation ( );
  4088. curr_action_id++;
  4089. params.Set_Basic( this, 45, curr_action_id );
  4090. params.Set_Animation (animationName, false);
  4091. Commands->Action_Play_Animation (obj, params);
  4092. }
  4093. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  4094. {
  4095. curr_action_id = 100;
  4096. params.Set_Basic( this, 45, curr_action_id );
  4097. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4098. params.WaypathID = 200601;
  4099. params.WaypointStartID = 200602;
  4100. params.WaypointEndID = 200603;
  4101. Commands->Action_Goto( obj, params );
  4102. }
  4103. }
  4104. };
  4105. /***********************************************************************************************************
  4106. The following are the initial scripts for the fore deck
  4107. ***********************************************************************************************************/
  4108. DECLARE_SCRIPT(M04_ForeDeck_RocketGuy_JDG, "")
  4109. {
  4110. void Created( GameObject * obj )
  4111. {
  4112. Commands->Set_Innate_Is_Stationary ( obj, true );
  4113. }
  4114. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4115. {
  4116. if (obj && damager == STAR)
  4117. {
  4118. Commands->Set_Innate_Is_Stationary ( obj, false );
  4119. }
  4120. }
  4121. };
  4122. DECLARE_SCRIPT(M04_ForeDeck_Initial_Enter_Zone_JDG, "")
  4123. {
  4124. void Entered( GameObject * obj, GameObject * enterer )
  4125. {
  4126. if ( enterer == STAR )
  4127. {
  4128. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 100, 0 );//tell ForeDeck controller that player(s) is approaching
  4129. GameObject * zone01 = Commands->Find_Object (100784);
  4130. if (zone01 != NULL)
  4131. {
  4132. Commands->Destroy_Object ( zone01 );//clean up these zones
  4133. }
  4134. GameObject * zone06 = Commands->Find_Object (100789);
  4135. if (zone06 != NULL)
  4136. {
  4137. Commands->Destroy_Object ( zone06 );//clean up these zones
  4138. }
  4139. }
  4140. }
  4141. };
  4142. DECLARE_SCRIPT(M04_MedLab_Enter_Zone_JDG, "")
  4143. {
  4144. void Entered( GameObject * obj, GameObject * enterer )
  4145. {
  4146. if ( enterer == STAR )
  4147. {
  4148. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_PRISON_WARDEN_JDG), 0, 100, 0 );//tell prison warden to start acting
  4149. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_MEDLAB_TECHNICIAN_JDG), 0, 100, 0 );//tell medlab tech to start acting
  4150. GameObject * zone01 = Commands->Find_Object (101054);
  4151. if (zone01 != NULL)
  4152. {
  4153. Commands->Destroy_Object ( zone01 );//clean up these zones
  4154. }
  4155. GameObject * zone02 = Commands->Find_Object (101055);
  4156. if (zone02 != NULL)
  4157. {
  4158. Commands->Destroy_Object ( zone02 );//clean up these zones
  4159. }
  4160. }
  4161. }
  4162. };
  4163. DECLARE_SCRIPT(M04_ForeDeck_Reinforcement_JDG, "")
  4164. {
  4165. void Created( GameObject * obj )
  4166. {
  4167. ActionParamsStruct params;
  4168. Vector3 players_position = Commands->Get_Position ( STAR );
  4169. params.Set_Basic( this, 50, 100 );
  4170. params.Set_Movement( players_position, 1.0f, .25f );
  4171. Commands->Action_Goto( obj, params );
  4172. }
  4173. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4174. {
  4175. ActionParamsStruct params;
  4176. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4177. {
  4178. Vector3 players_position = Commands->Get_Position ( STAR );
  4179. params.Set_Basic( this, 50, 100 );
  4180. params.Set_Movement( players_position, 1.0f, .25f );
  4181. Commands->Action_Goto( obj, params );
  4182. }
  4183. }
  4184. void Killed( GameObject * obj, GameObject * killer )
  4185. {
  4186. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell controller you've been killed
  4187. }
  4188. };
  4189. DECLARE_SCRIPT(M04_ForeDeck_MapRoom_Guard01_JDG, "")
  4190. {
  4191. void Created( GameObject * obj )
  4192. {
  4193. Vector3 myPosition = Commands->Get_Position ( obj );
  4194. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 5 );
  4195. }
  4196. void Killed( GameObject * obj, GameObject * killer )
  4197. {
  4198. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 200, 0 );//tell controller you've been killed
  4199. }
  4200. };
  4201. DECLARE_SCRIPT(M04_ForeDeck_MapRoom_Guard02_JDG, "")
  4202. {
  4203. int curr_action_id;
  4204. REGISTER_VARIABLES()
  4205. {
  4206. SAVE_VARIABLE(curr_action_id, 1);
  4207. }
  4208. void Created( GameObject * obj )
  4209. {
  4210. ActionParamsStruct params;
  4211. curr_action_id = 100;
  4212. params.Set_Basic( this, 45, curr_action_id );
  4213. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4214. params.WaypathID = 100842;
  4215. params.WaypointStartID = 100843;
  4216. params.WaypointEndID = 100845;
  4217. Commands->Action_Goto( obj, params );
  4218. }
  4219. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4220. {
  4221. ActionParamsStruct params;
  4222. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4223. {
  4224. char *animationName = M01_Choose_Idle_Animation ( );
  4225. curr_action_id++;
  4226. params.Set_Basic( this, 45, curr_action_id );
  4227. params.Set_Animation (animationName, false);
  4228. Commands->Action_Play_Animation (obj, params);
  4229. }
  4230. else if (action_id == 101 && complete_reason == ACTION_COMPLETE_NORMAL)
  4231. {
  4232. curr_action_id++;
  4233. params.Set_Basic( this, 45, curr_action_id );
  4234. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4235. params.WaypathID = 100842;
  4236. params.WaypointStartID = 100845;
  4237. params.WaypointEndID = 100843;
  4238. Commands->Action_Goto( obj, params );
  4239. }
  4240. else if (action_id == 102 && complete_reason == ACTION_COMPLETE_NORMAL)
  4241. {
  4242. char *animationName = M01_Choose_Idle_Animation ( );
  4243. curr_action_id++;
  4244. params.Set_Basic( this, 45, curr_action_id );
  4245. params.Set_Animation (animationName, false);
  4246. Commands->Action_Play_Animation (obj, params);
  4247. }
  4248. else if (action_id == 103 && complete_reason == ACTION_COMPLETE_NORMAL)
  4249. {
  4250. curr_action_id = 100;
  4251. params.Set_Basic( this, 45, curr_action_id );
  4252. params.Set_Movement( Vector3(0,0,0), .20f, .25f );
  4253. params.WaypathID = 100842;
  4254. params.WaypointStartID = 100843;
  4255. params.WaypointEndID = 100845;
  4256. Commands->Action_Goto( obj, params );
  4257. }
  4258. }
  4259. };
  4260. DECLARE_SCRIPT(M04_ForeDeck_TorpedoRoom_Guard_JDG, "")
  4261. {
  4262. void Created( GameObject * obj )
  4263. {
  4264. Vector3 myPosition = Commands->Get_Position ( obj );
  4265. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 15 );
  4266. }
  4267. };
  4268. /*************************************************************************************************************
  4269. The following scripts are for the foredeck. They include both the messhalls and the captain's encounter.
  4270. *************************************************************************************************************/
  4271. DECLARE_SCRIPT(M04_ForeDeck_Controller_JDG, "")//this guys ID number is M04_FORE_DECK_CONTROLLER_JDG 100790
  4272. {
  4273. int active_soldier_count;
  4274. int total_mess_reinforcements;
  4275. int total_BHmess_reinforcements;
  4276. int torpedoRoomGuard_ID;
  4277. int mapRoomGuard01_ID;
  4278. int mapRoomGuard02_ID;
  4279. int closetGuy01_ID;
  4280. int BH_messhall_guy01_ID;
  4281. int BH_messhall_guy02_ID;
  4282. int BH_messhall_guy03_ID;
  4283. int BH_messhall_guy04_ID;
  4284. int BH_messhall_guy05_ID;
  4285. REGISTER_VARIABLES()
  4286. {
  4287. SAVE_VARIABLE(active_soldier_count, 1);
  4288. SAVE_VARIABLE(total_mess_reinforcements, 2);
  4289. SAVE_VARIABLE(total_BHmess_reinforcements, 3);
  4290. SAVE_VARIABLE(torpedoRoomGuard_ID, 4);
  4291. SAVE_VARIABLE(mapRoomGuard01_ID, 5);
  4292. SAVE_VARIABLE(mapRoomGuard02_ID, 6);
  4293. SAVE_VARIABLE(closetGuy01_ID, 7);
  4294. SAVE_VARIABLE(BH_messhall_guy01_ID, 8);
  4295. SAVE_VARIABLE(BH_messhall_guy02_ID, 9);
  4296. SAVE_VARIABLE(BH_messhall_guy03_ID, 10);
  4297. SAVE_VARIABLE(BH_messhall_guy04_ID, 11);
  4298. SAVE_VARIABLE(BH_messhall_guy05_ID, 12);
  4299. }
  4300. void Created( GameObject * obj )
  4301. {
  4302. active_soldier_count = 0;
  4303. total_mess_reinforcements = 0;
  4304. total_BHmess_reinforcements = 0;
  4305. }
  4306. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4307. {
  4308. if (param == 100)//recieved custom from enter zones--here comes the player(s)
  4309. {
  4310. Commands->Create_Sound ( "00-n060e", Commands->Get_Position ( obj ), obj );
  4311. GameObject *torpedoRoomGuard = Commands->Create_Object ( "Nod_FlameThrower_0", Vector3(-.44f, 90.39f, -15.01f));
  4312. Commands->Attach_Script(torpedoRoomGuard, "M04_ForeDeck_TorpedoRoom_Guard_JDG", "");
  4313. GameObject *mapRoomGuard01 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(5.99f, 91.56f, -6.0f));
  4314. Commands->Attach_Script(mapRoomGuard01, "M04_ForeDeck_MapRoom_Guard01_JDG", "");
  4315. GameObject *mapRoomGuard02 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(-6.46f, 92.67f, -6.0f));
  4316. Commands->Attach_Script(mapRoomGuard02, "M04_ForeDeck_MapRoom_Guard02_JDG", "");
  4317. active_soldier_count = 3;
  4318. torpedoRoomGuard_ID = Commands->Get_ID ( torpedoRoomGuard );
  4319. mapRoomGuard01_ID = Commands->Get_ID ( mapRoomGuard01 );
  4320. mapRoomGuard02_ID = Commands->Get_ID ( mapRoomGuard02 );
  4321. }
  4322. else if (param == 200)//someone's been killed...spawn reinforcements if needed
  4323. {
  4324. active_soldier_count--;
  4325. total_BHmess_reinforcements++;
  4326. if (( active_soldier_count <= 6) && (total_BHmess_reinforcements < 4))
  4327. {
  4328. GameObject *foreDeckReinforcement01 = Commands->Trigger_Spawner(100853);
  4329. GameObject *foreDeckReinforcement02 = Commands->Trigger_Spawner(100854);
  4330. active_soldier_count++;
  4331. active_soldier_count++;
  4332. Commands->Attach_Script(foreDeckReinforcement01, "M04_ForeDeck_Reinforcement_JDG", "");
  4333. Commands->Attach_Script(foreDeckReinforcement02, "M04_ForeDeck_Reinforcement_JDG", "");
  4334. }
  4335. }
  4336. else if (param == 300)//player is going up to grunt's mess hall
  4337. {
  4338. active_soldier_count = active_soldier_count + 4;
  4339. Commands->Send_Custom_Event( obj, obj, 0, 301, 2 );
  4340. }
  4341. else if (param == 301)//play "proceed with caution" warning
  4342. {
  4343. Commands->Create_Sound ( "00-c164e", Commands->Get_Position ( obj ), obj );//proceed with caution
  4344. }
  4345. else if (param == 500)//player is moving toward captain from grunt mess hall
  4346. {
  4347. //find any guys from torpedo or map room and clean them up if needed
  4348. GameObject * torpedoGuy_01 = Commands->Find_Object (torpedoRoomGuard_ID);
  4349. if (torpedoGuy_01 != NULL)
  4350. {
  4351. Commands->Destroy_Object ( torpedoGuy_01 );
  4352. active_soldier_count--;
  4353. }
  4354. GameObject * mapGuy_01 = Commands->Find_Object (mapRoomGuard01_ID);
  4355. if (mapGuy_01 != NULL)
  4356. {
  4357. Commands->Destroy_Object ( mapGuy_01 );
  4358. active_soldier_count--;
  4359. }
  4360. GameObject * mapGuy_02 = Commands->Find_Object (mapRoomGuard02_ID);
  4361. if (mapGuy_02 != NULL)
  4362. {
  4363. Commands->Destroy_Object ( mapGuy_02 );
  4364. active_soldier_count--;
  4365. }
  4366. //put down the closet surprise guy
  4367. GameObject *closetGuy01 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(-3.361f, 79.633f, 3.0f));
  4368. Commands->Attach_Script(closetGuy01, "M04_ForeDeck_ClosetSurprise_Guy_JDG", "");
  4369. closetGuy01_ID = Commands->Get_ID ( closetGuy01 );
  4370. //put down the 5 BH mess hall guys
  4371. GameObject * BH_messhall_guy01 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(5.89f, 88.47f, 6.0f));
  4372. Commands->Attach_Script(BH_messhall_guy01, "M04_BH_MessHall_Guy_JDG", "");
  4373. Commands->Set_Facing ( BH_messhall_guy01, -135 );
  4374. GameObject * BH_messhall_guy02 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(5.30f, 87.52f, 6.0f));
  4375. Commands->Attach_Script(BH_messhall_guy02, "M04_BH_MessHall_Guy_JDG", "");
  4376. Commands->Set_Facing ( BH_messhall_guy02, -155 );
  4377. GameObject * BH_messhall_guy03 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(2.64f, 88.12f, 6.0f));
  4378. Commands->Attach_Script(BH_messhall_guy03, "M04_BH_MessHall_Guy_JDG", "");
  4379. Commands->Set_Facing ( BH_messhall_guy03, -135 );
  4380. GameObject * BH_messhall_guy04 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(2.08f, 87.44f, 6.0f));
  4381. Commands->Attach_Script(BH_messhall_guy04, "M04_BH_MessHall_Guy_JDG", "");
  4382. Commands->Set_Facing ( BH_messhall_guy04, -140 );
  4383. GameObject * BH_messhall_guy05 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(-0.38f, 87.29f, 6.0f));
  4384. Commands->Attach_Script(BH_messhall_guy05, "M04_BH_MessHall_Guy_JDG", "");
  4385. Commands->Set_Facing ( BH_messhall_guy05, -110 );
  4386. BH_messhall_guy01_ID = Commands->Get_ID ( BH_messhall_guy01 );
  4387. BH_messhall_guy02_ID = Commands->Get_ID ( BH_messhall_guy02 );
  4388. BH_messhall_guy03_ID = Commands->Get_ID ( BH_messhall_guy03 );
  4389. BH_messhall_guy04_ID = Commands->Get_ID ( BH_messhall_guy04 );
  4390. BH_messhall_guy05_ID = Commands->Get_ID ( BH_messhall_guy05 );
  4391. }
  4392. else if (param == 505)//time for homey to come out of the closet
  4393. {
  4394. Commands->Send_Custom_Event( obj, Commands->Find_Object (closetGuy01_ID), 0, 100, 0 );
  4395. }
  4396. else if (param == 650)//received param from BH messhall enter zone--tell BH guys its okay to react now
  4397. {
  4398. GameObject * BH_messhall_guy01 = Commands->Find_Object ( BH_messhall_guy01_ID);
  4399. GameObject * BH_messhall_guy02 = Commands->Find_Object ( BH_messhall_guy02_ID);
  4400. GameObject * BH_messhall_guy03 = Commands->Find_Object ( BH_messhall_guy03_ID);
  4401. GameObject * BH_messhall_guy04 = Commands->Find_Object ( BH_messhall_guy04_ID);
  4402. GameObject * BH_messhall_guy05 = Commands->Find_Object ( BH_messhall_guy05_ID);
  4403. if (BH_messhall_guy01 != NULL)
  4404. {
  4405. Commands->Send_Custom_Event( obj, BH_messhall_guy01, 0, 600, 0 );
  4406. }
  4407. if (BH_messhall_guy02 != NULL)
  4408. {
  4409. Commands->Send_Custom_Event( obj, BH_messhall_guy02, 0, 600, 0 );
  4410. }
  4411. if (BH_messhall_guy03 != NULL)
  4412. {
  4413. Commands->Send_Custom_Event( obj, BH_messhall_guy03, 0, 600, 0 );
  4414. }
  4415. if (BH_messhall_guy04 != NULL)
  4416. {
  4417. Commands->Send_Custom_Event( obj, BH_messhall_guy04, 0, 600, 0 );
  4418. }
  4419. if (BH_messhall_guy05 != NULL)
  4420. {
  4421. Commands->Send_Custom_Event( obj, BH_messhall_guy05, 0, 600, 0 );
  4422. }
  4423. }
  4424. else if (param == 700)//player is approaching main bridge--put down captain's bodyguards
  4425. {
  4426. GameObject *captains_bodyguard_01 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(-17.79f, 85.49f, 13.13f));
  4427. Commands->Attach_Script(captains_bodyguard_01, "M04_Captains_Bodyguard_JDG", "");
  4428. GameObject *captains_bodyguard_02 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(-15.26f, 79.5f, 13.13f));
  4429. Commands->Attach_Script(captains_bodyguard_02, "M04_Captains_Bodyguard_JDG", "");
  4430. GameObject *captains_bodyguard_03 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(17.79f, 85.49f, 13.13f));
  4431. Commands->Attach_Script(captains_bodyguard_03, "M04_Captains_Bodyguard_JDG", "");
  4432. GameObject *captains_bodyguard_04 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(15.26f, 79.5f, 13.13f));
  4433. Commands->Attach_Script(captains_bodyguard_04, "M04_Captains_Bodyguard_JDG", "");
  4434. GameObject *captains_bodyguard_05 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(-8.67f, 81.66f, 13.13f));
  4435. Commands->Attach_Script(captains_bodyguard_05, "M04_Captains_Bodyguard_JDG", "");
  4436. GameObject *captains_bodyguard_06 = Commands->Create_Object ( "Nod_FlameThrower_1Off", Vector3(8.67f, 81.66f, 13.13f));
  4437. Commands->Attach_Script(captains_bodyguard_06, "M04_Captains_Bodyguard_JDG", "");
  4438. }
  4439. }
  4440. };
  4441. DECLARE_SCRIPT(M04_Captains_Bodyguard_JDG, "")
  4442. {
  4443. void Created( GameObject * obj )
  4444. {
  4445. Vector3 myPosition = Commands->Get_Position ( obj );
  4446. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 2 );
  4447. }
  4448. void Killed( GameObject * obj, GameObject * killer )
  4449. {
  4450. float reinforce_ka = Commands->Get_Random ( 0.5f, 3.5f );
  4451. if ((reinforce_ka >= 0.5) && (reinforce_ka < 1.5))
  4452. {
  4453. GameObject * captains_bodyguard_reinforceguy = Commands->Trigger_Spawner( 100918 );
  4454. Commands->Attach_Script(captains_bodyguard_reinforceguy, "M04_Captains_Bodyguard_Reinforcement_JDG", "");
  4455. }
  4456. else if ((reinforce_ka >= 1.5) && (reinforce_ka < 2.0))
  4457. {
  4458. GameObject * captains_bodyguard_reinforceguy = Commands->Trigger_Spawner( 100918 );
  4459. GameObject * captains_bodyguard_reinforceguy02 = Commands->Trigger_Spawner( 100919 );
  4460. Commands->Attach_Script(captains_bodyguard_reinforceguy, "M04_Captains_Bodyguard_Reinforcement_JDG", "");
  4461. Commands->Attach_Script(captains_bodyguard_reinforceguy02, "M04_Captains_Bodyguard_Reinforcement02_JDG", "");
  4462. }
  4463. }
  4464. };
  4465. DECLARE_SCRIPT(M04_Captains_Bodyguard_Reinforcement_JDG, "")
  4466. {
  4467. bool engaged;
  4468. REGISTER_VARIABLES()
  4469. {
  4470. SAVE_VARIABLE(engaged, 1);
  4471. }
  4472. void Created( GameObject * obj )
  4473. {
  4474. engaged = false;
  4475. ActionParamsStruct params;
  4476. params.Set_Basic( this, 45, 100 );
  4477. params.Set_Movement( Vector3(0,0,0), 1.0f, .25f );
  4478. params.WaypathID = 100927;
  4479. params.WaypointStartID = 100928;
  4480. params.WaypointEndID = 100932;
  4481. Commands->Action_Goto( obj, params );
  4482. }
  4483. void Enemy_Seen( GameObject * obj, GameObject * enemy )
  4484. {
  4485. if (enemy == STAR)
  4486. {
  4487. if (engaged == false)
  4488. {
  4489. engaged = true;
  4490. Commands->Action_Reset ( obj, 100 );
  4491. }
  4492. }
  4493. }
  4494. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4495. {
  4496. ActionParamsStruct params;
  4497. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4498. {
  4499. Vector3 players_position = Commands->Get_Position ( STAR );
  4500. Commands->Action_Reset ( obj, 0 );
  4501. params.Set_Basic( this, 45, 100 );
  4502. params.Set_Movement( players_position, 1.0f, .25f );
  4503. Commands->Action_Goto( obj, params );
  4504. }
  4505. }
  4506. };
  4507. DECLARE_SCRIPT(M04_Captains_Bodyguard_Reinforcement02_JDG, "")
  4508. {
  4509. void Created( GameObject * obj )
  4510. {
  4511. ActionParamsStruct params;
  4512. params.Set_Basic( this, 45, 100 );
  4513. params.Set_Movement( Vector3(0,0,0), 1.0f, .25f );
  4514. params.WaypathID = 100920;
  4515. params.WaypointStartID = 100921;
  4516. params.WaypointEndID = 100925;
  4517. Commands->Action_Goto( obj, params );
  4518. }
  4519. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4520. {
  4521. ActionParamsStruct params;
  4522. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4523. {
  4524. Vector3 players_position = Commands->Get_Position ( STAR );
  4525. Commands->Action_Reset ( obj, 0 );
  4526. params.Set_Basic( this, 45, 100 );
  4527. params.Set_Movement( players_position, 1.0f, .25f );
  4528. Commands->Action_Goto( obj, params );
  4529. }
  4530. }
  4531. };
  4532. DECLARE_SCRIPT(M04_Captains_Bridge_Enter_Zone_JDG, "")
  4533. {
  4534. void Entered( GameObject * obj, GameObject * enterer )
  4535. {
  4536. if ( enterer == STAR)
  4537. {
  4538. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 700, 0 );//tell foredeck controller that player is approaching main bridge
  4539. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_SHIPS_CAPTAIN_JDG), 0, 100, 0 );//this tells captain to turn on hearing
  4540. Commands->Create_Sound ( "00-n060e", Commands->Get_Position ( obj ), obj );//updating radar flags
  4541. GameObject *zone01 = Commands->Find_Object (100876);
  4542. if (zone01 != NULL)
  4543. {
  4544. Commands->Destroy_Object ( zone01 );
  4545. }
  4546. }
  4547. }
  4548. };
  4549. DECLARE_SCRIPT(M04_BH_MessHall_Trigger_Zone_JDG, "")
  4550. {
  4551. void Entered( GameObject * obj, GameObject * enterer )
  4552. {
  4553. if ( enterer == STAR)
  4554. {
  4555. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 650, 0 );//tell foredeck controller that player is entering BH messhall
  4556. Commands->Create_Sound ( "00-c164e", Commands->Get_Position ( obj ), obj );//proceed with caution
  4557. //clean up this zone
  4558. GameObject *zone01 = Commands->Find_Object (100873);
  4559. if (zone01 != NULL)
  4560. {
  4561. Commands->Destroy_Object ( zone01 );
  4562. }
  4563. }
  4564. }
  4565. };
  4566. DECLARE_SCRIPT(M04_BH_MessHall_Guy_JDG, "")
  4567. {
  4568. bool ok_to_react;
  4569. REGISTER_VARIABLES()
  4570. {
  4571. SAVE_VARIABLE(ok_to_react, 1);
  4572. }
  4573. void Created( GameObject * obj )
  4574. {
  4575. Commands->Set_Innate_Is_Stationary ( obj, true );
  4576. ok_to_react = false;
  4577. ActionParamsStruct params;//M04 Nod Alert Twiddler
  4578. Vector3 look_position = Commands->Get_Position ( Commands->Find_Object ( 100455 ) );
  4579. params.Set_Basic(this, 89, 100);
  4580. params.Set_Attack(look_position, 0, 0, false);
  4581. Commands->Action_Attack(obj, params);
  4582. }
  4583. void Damaged( GameObject * obj, GameObject * damager, float amount )
  4584. {
  4585. if (damager == STAR)
  4586. {
  4587. if (obj)
  4588. {
  4589. Commands->Set_Innate_Is_Stationary ( obj, false );
  4590. }
  4591. }
  4592. }
  4593. void Killed( GameObject * obj, GameObject * killer )
  4594. {
  4595. float reinforce_ka = Commands->Get_Random ( 0.5f, 2.5f );
  4596. if ((reinforce_ka >= 0.5) && (reinforce_ka < 1.5))
  4597. {
  4598. GameObject * BH_messhall_reinforceguy = Commands->Trigger_Spawner( 100875 );
  4599. Commands->Attach_Script(BH_messhall_reinforceguy, "M04_ForeDeck_Reinforcement_03_JDG", "");
  4600. }
  4601. }
  4602. void Sound_Heard( GameObject * obj, const CombatSound & sound )
  4603. {
  4604. if (ok_to_react == true)
  4605. {
  4606. if (obj)
  4607. {
  4608. Commands->Set_Innate_Is_Stationary ( obj, false );
  4609. }
  4610. }
  4611. }
  4612. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4613. {
  4614. if (param == 600)//recieved custom from controller--you can react to gunshots now
  4615. {
  4616. ok_to_react = true;
  4617. }
  4618. }
  4619. };
  4620. DECLARE_SCRIPT(M04_ForeDeck_ClosetSurprise_Guy_JDG, "")
  4621. {
  4622. void Created( GameObject * obj )
  4623. {
  4624. Commands->Innate_Disable( obj );
  4625. }
  4626. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4627. {
  4628. if (param == 100)//recieved custom from enter zones--here comes the player(s)
  4629. {
  4630. if (obj)
  4631. {
  4632. Commands->Innate_Enable(obj);
  4633. ActionParamsStruct params;
  4634. params.Set_Basic( this, 100, 100 );
  4635. params.Set_Movement( Vector3(0,0,0), .750f, .25f );
  4636. params.WaypathID = 100864;
  4637. params.WaypointStartID = 100865;
  4638. params.WaypointEndID = 100867;
  4639. Commands->Action_Goto( obj, params );
  4640. }
  4641. }
  4642. }
  4643. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4644. {
  4645. ActionParamsStruct params;
  4646. if (action_id == 100 && complete_reason == ACTION_COMPLETE_NORMAL)
  4647. {
  4648. Vector3 players_position = Commands->Get_Position ( STAR );
  4649. params.Set_Basic( this, 45, 100 );
  4650. params.Set_Movement( players_position, 1.0f, .25f );
  4651. Commands->Action_Goto( obj, params );
  4652. }
  4653. }
  4654. };
  4655. DECLARE_SCRIPT(M04_ForeDeck_ClosetSurprise_Trigger_Zone_JDG, "")
  4656. {
  4657. void Entered( GameObject * obj, GameObject * enterer )
  4658. {
  4659. if (enterer == STAR)
  4660. {
  4661. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 505, 0 );//tell foredeck controller that player is leaving mess hall
  4662. GameObject * sniperTarget01 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", Vector3(8.937f, 83.264f, 6.000f));
  4663. Commands->Attach_Script(sniperTarget01, "M04_Doorway_Enterer_JDG", "8.149 76.787 3.000");
  4664. GameObject *zone01 = Commands->Find_Object (100869);
  4665. if (zone01 != NULL)
  4666. {
  4667. Commands->Destroy_Object ( zone01 );
  4668. }
  4669. GameObject *zone02 = Commands->Find_Object (100870);
  4670. if (zone02 != NULL)
  4671. {
  4672. Commands->Destroy_Object ( zone02 );
  4673. }
  4674. }
  4675. }
  4676. };
  4677. DECLARE_SCRIPT(M04_GruntMessHall_Exit_Zone_JDG, "")
  4678. {
  4679. void Entered( GameObject * obj, GameObject * enterer )
  4680. {
  4681. if ( enterer == STAR)
  4682. {
  4683. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 500, 0 );//tell foredeck controller that player is leaving mess hall
  4684. GameObject *zone01 = Commands->Find_Object (100857);
  4685. if (zone01 != NULL)
  4686. {
  4687. Commands->Destroy_Object ( zone01 );
  4688. }
  4689. }
  4690. }
  4691. };
  4692. DECLARE_SCRIPT(M04_GruntMessHall_Entry_Zone_JDG, "")
  4693. {
  4694. void Entered( GameObject * obj, GameObject * enterer )
  4695. {
  4696. if ( enterer == STAR)
  4697. {
  4698. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_FORE_DECK_CONTROLLER_JDG), 0, 300, 0 );//tell foredeck controller that player is entering mess hall
  4699. GameObject *zone01 = Commands->Find_Object (100459);
  4700. if (zone01 != NULL)
  4701. {
  4702. Commands->Destroy_Object ( zone01 );
  4703. }
  4704. GameObject *zone02 = Commands->Find_Object (100460);
  4705. if (zone02 != NULL)
  4706. {
  4707. Commands->Destroy_Object ( zone02 );
  4708. }
  4709. }
  4710. }
  4711. };
  4712. /**********************************************************************************************************
  4713. The following are the scripts and controller for the end fire fight.
  4714. **********************************************************************************************************/
  4715. DECLARE_SCRIPT(M04_Firefight_Start_Battle_Music_JDG, "")
  4716. {
  4717. bool playerHasLevel3Keycard;
  4718. REGISTER_VARIABLES()
  4719. {
  4720. SAVE_VARIABLE( playerHasLevel3Keycard, 1 );
  4721. }
  4722. void Created( GameObject * obj )
  4723. {
  4724. playerHasLevel3Keycard = false;
  4725. }
  4726. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  4727. {
  4728. if (param == 100)//level 3 keycard acquired
  4729. {
  4730. playerHasLevel3Keycard = true;
  4731. }
  4732. }
  4733. void Entered( GameObject * obj, GameObject * enterer )
  4734. {
  4735. if ( enterer == STAR && playerHasLevel3Keycard == true)
  4736. {
  4737. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_END_FIREFIGHT_CONTROLLER_JDG), 0, 100, 0 );
  4738. }
  4739. }
  4740. };
  4741. DECLARE_SCRIPT(M04_Firefight_NodGuys, "")
  4742. {
  4743. void Killed( GameObject * obj, GameObject * killer )
  4744. {
  4745. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_END_FIREFIGHT_CONTROLLER_JDG), 0, 666, 0 );//tell controller you've been killed
  4746. }
  4747. };
  4748. DECLARE_SCRIPT(M04_PostFirstMate_SamRoom_PatrolGuy_JDG, "")
  4749. {
  4750. void Created( GameObject * obj )
  4751. {
  4752. ActionParamsStruct params;
  4753. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4754. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4755. params.WaypathID = 101208;
  4756. params.WaypointStartID = 101209;
  4757. params.WaypointEndID = 101210;
  4758. Commands->Action_Goto( obj, params );
  4759. }
  4760. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4761. {
  4762. ActionParamsStruct params;
  4763. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4764. {
  4765. char *animationName = M01_Choose_Idle_Animation ( );
  4766. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  4767. params.Set_Animation (animationName, false);
  4768. Commands->Action_Play_Animation (obj, params);
  4769. }
  4770. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4771. {
  4772. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  4773. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4774. params.WaypathID = 101212;
  4775. params.WaypointStartID = 101213;
  4776. params.WaypointEndID = 101214;
  4777. Commands->Action_Goto( obj, params );
  4778. }
  4779. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4780. {
  4781. char *animationName = M01_Choose_Idle_Animation ( );
  4782. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  4783. params.Set_Animation (animationName, false);
  4784. Commands->Action_Play_Animation (obj, params);
  4785. }
  4786. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4787. {
  4788. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_03_JDG );
  4789. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4790. params.WaypathID = 101216;
  4791. params.WaypointStartID = 101217;
  4792. params.WaypointEndID = 101218;
  4793. Commands->Action_Goto( obj, params );
  4794. }
  4795. else if (action_id == M01_WALKING_WAYPATH_03_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4796. {
  4797. char *animationName = M01_Choose_Idle_Animation ( );
  4798. params.Set_Basic( this, 45, M01_DOING_ANIMATION_03_JDG );
  4799. params.Set_Animation (animationName, false);
  4800. Commands->Action_Play_Animation (obj, params);
  4801. }
  4802. else if (action_id == M01_DOING_ANIMATION_03_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4803. {
  4804. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_04_JDG );
  4805. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4806. params.WaypathID = 101220;
  4807. params.WaypointStartID = 101221;
  4808. params.WaypointEndID = 101222;
  4809. Commands->Action_Goto( obj, params );
  4810. }
  4811. else if (action_id == M01_WALKING_WAYPATH_04_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4812. {
  4813. char *animationName = M01_Choose_Idle_Animation ( );
  4814. params.Set_Basic( this, 45, M01_DOING_ANIMATION_04_JDG );
  4815. params.Set_Animation (animationName, false);
  4816. Commands->Action_Play_Animation (obj, params);
  4817. }
  4818. else if (action_id == M01_DOING_ANIMATION_04_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4819. {
  4820. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4821. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4822. params.WaypathID = 101208;
  4823. params.WaypointStartID = 101209;
  4824. params.WaypointEndID = 101210;
  4825. Commands->Action_Goto( obj, params );
  4826. }
  4827. }
  4828. };
  4829. DECLARE_SCRIPT(M04_PostFirstMate_MissileRoom_PatrolGuy_JDG, "")
  4830. {
  4831. void Created( GameObject * obj )
  4832. {
  4833. ActionParamsStruct params;
  4834. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4835. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4836. params.WaypathID = 100550;
  4837. params.WaypointStartID = 100551;
  4838. params.WaypointEndID = 100553;
  4839. Commands->Action_Goto( obj, params );
  4840. }
  4841. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4842. {
  4843. ActionParamsStruct params;
  4844. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4845. {
  4846. char *animationName = M01_Choose_Idle_Animation ( );
  4847. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  4848. params.Set_Animation (animationName, false);
  4849. Commands->Action_Play_Animation (obj, params);
  4850. }
  4851. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4852. {
  4853. params.Set_Basic( this, 60, M01_WALKING_WAYPATH_02_JDG );
  4854. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4855. params.WaypathID = 100555;
  4856. params.WaypointStartID = 100556;
  4857. params.WaypointEndID = 100557;
  4858. Commands->Action_Goto( obj, params );
  4859. }
  4860. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4861. {
  4862. char *animationName = M01_Choose_Idle_Animation ( );
  4863. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  4864. params.Set_Animation (animationName, false);
  4865. Commands->Action_Play_Animation (obj, params);
  4866. }
  4867. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4868. {
  4869. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_03_JDG );
  4870. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4871. params.WaypathID = 100541;
  4872. params.WaypointStartID = 100542;
  4873. params.WaypointEndID = 100544;
  4874. Commands->Action_Goto( obj, params );
  4875. }
  4876. else if (action_id == M01_WALKING_WAYPATH_03_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4877. {
  4878. char *animationName = M01_Choose_Idle_Animation ( );
  4879. params.Set_Basic( this, 45, M01_DOING_ANIMATION_03_JDG );
  4880. params.Set_Animation (animationName, false);
  4881. Commands->Action_Play_Animation (obj, params);
  4882. }
  4883. else if (action_id == M01_DOING_ANIMATION_03_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4884. {
  4885. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_04_JDG );
  4886. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4887. params.WaypathID = 100546;
  4888. params.WaypointStartID = 100547;
  4889. params.WaypointEndID = 100548;
  4890. Commands->Action_Goto( obj, params );
  4891. }
  4892. else if (action_id == M01_WALKING_WAYPATH_04_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4893. {
  4894. char *animationName = M01_Choose_Idle_Animation ( );
  4895. params.Set_Basic( this, 45, M01_DOING_ANIMATION_04_JDG );
  4896. params.Set_Animation (animationName, false);
  4897. Commands->Action_Play_Animation (obj, params);
  4898. }
  4899. else if (action_id == M01_DOING_ANIMATION_04_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4900. {
  4901. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4902. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4903. params.WaypathID = 100550;
  4904. params.WaypointStartID = 100551;
  4905. params.WaypointEndID = 100553;
  4906. Commands->Action_Goto( obj, params );
  4907. }
  4908. }
  4909. };
  4910. DECLARE_SCRIPT(M04_PostFirstMate_OfficerQuarters_PatrolGuy_JDG, "")
  4911. {
  4912. void Created( GameObject * obj )
  4913. {
  4914. ActionParamsStruct params;
  4915. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4916. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4917. params.WaypathID = 101237;
  4918. params.WaypointStartID = 101238;
  4919. params.WaypointEndID = 101241;
  4920. Commands->Action_Goto( obj, params );
  4921. }
  4922. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4923. {
  4924. ActionParamsStruct params;
  4925. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4926. {
  4927. char *animationName = M01_Choose_Idle_Animation ( );
  4928. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  4929. params.Set_Animation (animationName, false);
  4930. Commands->Action_Play_Animation (obj, params);
  4931. }
  4932. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4933. {
  4934. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  4935. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4936. params.WaypathID = 101243;
  4937. params.WaypointStartID = 101244;
  4938. params.WaypointEndID = 101247;
  4939. Commands->Action_Goto( obj, params );
  4940. }
  4941. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4942. {
  4943. char *animationName = M01_Choose_Idle_Animation ( );
  4944. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  4945. params.Set_Animation (animationName, false);
  4946. Commands->Action_Play_Animation (obj, params);
  4947. }
  4948. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4949. {
  4950. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4951. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4952. params.WaypathID = 101237;
  4953. params.WaypointStartID = 101238;
  4954. params.WaypointEndID = 101241;
  4955. Commands->Action_Goto( obj, params );
  4956. }
  4957. }
  4958. };
  4959. DECLARE_SCRIPT(M04_PostFirstMate_FrontDeck_PatrolGuy01_JDG, "")
  4960. {
  4961. void Created( GameObject * obj )
  4962. {
  4963. ActionParamsStruct params;
  4964. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  4965. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4966. params.WaypathID = 101250;
  4967. params.WaypointStartID = 101251;
  4968. params.WaypointEndID = 101255;
  4969. Commands->Action_Goto( obj, params );
  4970. }
  4971. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  4972. {
  4973. ActionParamsStruct params;
  4974. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4975. {
  4976. char *animationName = M01_Choose_Idle_Animation ( );
  4977. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  4978. params.Set_Animation (animationName, false);
  4979. Commands->Action_Play_Animation (obj, params);
  4980. }
  4981. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4982. {
  4983. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  4984. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  4985. params.WaypathID = 101250;
  4986. params.WaypointStartID = 101255;
  4987. params.WaypointEndID = 101251;
  4988. Commands->Action_Goto( obj, params );
  4989. }
  4990. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4991. {
  4992. char *animationName = M01_Choose_Idle_Animation ( );
  4993. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  4994. params.Set_Animation (animationName, false);
  4995. Commands->Action_Play_Animation (obj, params);
  4996. }
  4997. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  4998. {
  4999. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  5000. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  5001. params.WaypathID = 101250;
  5002. params.WaypointStartID = 101251;
  5003. params.WaypointEndID = 101255;
  5004. Commands->Action_Goto( obj, params );
  5005. }
  5006. }
  5007. };
  5008. DECLARE_SCRIPT(M04_PostFirstMate_FrontDeck_PatrolGuy02_JDG, "")
  5009. {
  5010. void Created( GameObject * obj )
  5011. {
  5012. ActionParamsStruct params;
  5013. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  5014. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  5015. params.WaypathID = 101258;
  5016. params.WaypointStartID = 101259;
  5017. params.WaypointEndID = 101263;
  5018. Commands->Action_Goto( obj, params );
  5019. }
  5020. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  5021. {
  5022. ActionParamsStruct params;
  5023. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  5024. {
  5025. char *animationName = M01_Choose_Idle_Animation ( );
  5026. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  5027. params.Set_Animation (animationName, false);
  5028. Commands->Action_Play_Animation (obj, params);
  5029. }
  5030. else if (action_id == M01_DOING_ANIMATION_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  5031. {
  5032. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  5033. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  5034. params.WaypathID = 101258;
  5035. params.WaypointStartID = 101263;
  5036. params.WaypointEndID = 101259;
  5037. Commands->Action_Goto( obj, params );
  5038. }
  5039. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  5040. {
  5041. char *animationName = M01_Choose_Idle_Animation ( );
  5042. params.Set_Basic( this, 45, M01_DOING_ANIMATION_02_JDG );
  5043. params.Set_Animation (animationName, false);
  5044. Commands->Action_Play_Animation (obj, params);
  5045. }
  5046. else if (action_id == M01_DOING_ANIMATION_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  5047. {
  5048. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  5049. params.Set_Movement( Vector3(0,0,0), WALK, .25f );
  5050. params.WaypathID = 101258;
  5051. params.WaypointStartID = 101259;
  5052. params.WaypointEndID = 101263;
  5053. Commands->Action_Goto( obj, params );
  5054. }
  5055. }
  5056. };
  5057. DECLARE_SCRIPT(M04_EnterCargoBay_BottomRight_Zone_JDG, "")
  5058. {
  5059. void Entered( GameObject * obj, GameObject * enterer )
  5060. {
  5061. if ( enterer == STAR )
  5062. {
  5063. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 100, 0 );
  5064. GameObject * zone01 = Commands->Find_Object (100497);
  5065. if (zone01 != NULL)
  5066. {
  5067. Commands->Destroy_Object ( zone01 );
  5068. }
  5069. GameObject * zone03 = Commands->Find_Object (100499);
  5070. if (zone03 != NULL)
  5071. {
  5072. Commands->Destroy_Object ( zone03 );
  5073. }
  5074. }
  5075. }
  5076. };
  5077. DECLARE_SCRIPT(M04_EnterCargoBay_TopLeft_Zone_JDG, "")
  5078. {
  5079. void Entered( GameObject * obj, GameObject * enterer )
  5080. {
  5081. if ( enterer == STAR )
  5082. {
  5083. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_CARGOHOLD_CONTROLLER_JDG), 0, 100, 0 );
  5084. GameObject * zone01 = Commands->Find_Object (100497);
  5085. if (zone01 != NULL)
  5086. {
  5087. Commands->Destroy_Object ( zone01 );
  5088. }
  5089. GameObject * zone03 = Commands->Find_Object (100499);
  5090. if (zone03 != NULL)
  5091. {
  5092. Commands->Destroy_Object ( zone03 );
  5093. }
  5094. }
  5095. }
  5096. };
  5097. DECLARE_SCRIPT(M04_RocketEmplacement_01_JDG, "")//103461
  5098. {
  5099. int apache_id;
  5100. bool secondary_apache_spawned;
  5101. REGISTER_VARIABLES()
  5102. {
  5103. SAVE_VARIABLE(apache_id, 1);
  5104. SAVE_VARIABLE(secondary_apache_spawned, 2);
  5105. }
  5106. void Created( GameObject * obj )
  5107. {
  5108. secondary_apache_spawned = false;
  5109. }
  5110. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5111. {
  5112. if (type == M01_MODIFY_YOUR_ACTION_JDG)
  5113. {
  5114. apache_id = param;
  5115. }
  5116. else if (type == CUSTOM_EVENT_VEHICLE_ENTERED)
  5117. {
  5118. Commands->Debug_Message ( "***************************player has entered tailgun 01--send custom to apache\n" );
  5119. GameObject * apache = Commands->Find_Object ( apache_id );
  5120. if (apache != NULL)
  5121. {
  5122. Commands->Send_Custom_Event ( obj, apache, 0, M01_MODIFY_YOUR_ACTION_05_JDG, 0 );
  5123. }
  5124. else if (secondary_apache_spawned == false)
  5125. {
  5126. secondary_apache_spawned = true;
  5127. Vector3 spawnSpot (-5.496f, -52.198f, 22.300f);
  5128. GameObject * secondaryapache = Commands->Create_Object ( "NOD_Apache", spawnSpot );
  5129. Commands->Attach_Script(secondaryapache, "M04_SecondaryApache01_JDG", "");
  5130. }
  5131. }
  5132. }
  5133. };
  5134. DECLARE_SCRIPT(M04_SecondaryApache01_JDG, "")
  5135. {
  5136. void Created( GameObject * obj )
  5137. {
  5138. ActionParamsStruct params;
  5139. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  5140. params.Set_Movement(Vector3 (0,0,0), 1.0f, 5);
  5141. params.WaypathID = 103531;
  5142. Commands->Action_Goto(obj, params);
  5143. }
  5144. void Killed( GameObject * obj, GameObject * killer )
  5145. {
  5146. Vector3 spawnSpot (-3.732f, -59.579f, 2.704f);
  5147. Commands->Create_Object ( "POW_Armor_100", spawnSpot );
  5148. }
  5149. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5150. {
  5151. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  5152. {
  5153. Commands->Destroy_Object ( obj );
  5154. }
  5155. }
  5156. };
  5157. DECLARE_SCRIPT(M04_SecondaryApache02_JDG, "")
  5158. {
  5159. void Created( GameObject * obj )
  5160. {
  5161. ActionParamsStruct params;
  5162. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  5163. params.Set_Movement(Vector3 (0,0,0), 1.0f, 1);
  5164. params.WaypathID = 103608;
  5165. Commands->Action_Goto(obj, params);
  5166. }
  5167. void Killed( GameObject * obj, GameObject * killer )
  5168. {
  5169. Vector3 spawnSpot (-3.701f, -55.248f, 2.704f);
  5170. Commands->Create_Object ( "POW_Health_100", spawnSpot );
  5171. }
  5172. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5173. {
  5174. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  5175. {
  5176. Commands->Destroy_Object ( obj );
  5177. }
  5178. }
  5179. };
  5180. DECLARE_SCRIPT(M04_RocketEmplacement_02_JDG, "")//103462
  5181. {
  5182. int apache_id;
  5183. bool secondary_apache_spawned;
  5184. REGISTER_VARIABLES()
  5185. {
  5186. SAVE_VARIABLE(apache_id, 1);
  5187. SAVE_VARIABLE(secondary_apache_spawned, 2);
  5188. }
  5189. void Created( GameObject * obj )
  5190. {
  5191. secondary_apache_spawned = false;
  5192. }
  5193. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5194. {
  5195. if (type == M01_MODIFY_YOUR_ACTION_JDG)
  5196. {
  5197. apache_id = param;
  5198. }
  5199. else if (type == CUSTOM_EVENT_VEHICLE_ENTERED)
  5200. {
  5201. Commands->Debug_Message ( "***************************player has entered tailgun 02--send custom to apache\n" );
  5202. GameObject * apache = Commands->Find_Object ( apache_id );
  5203. if (apache != NULL)
  5204. {
  5205. Commands->Send_Custom_Event ( obj, apache, 0, M01_MODIFY_YOUR_ACTION_04_JDG, 0 );
  5206. }
  5207. else if (secondary_apache_spawned == false)
  5208. {
  5209. secondary_apache_spawned = true;
  5210. Vector3 spawnSpot (13.267f, -52.984f, 22.650f);
  5211. GameObject * secondaryapache = Commands->Create_Object ( "NOD_Apache", spawnSpot );
  5212. Commands->Attach_Script(secondaryapache, "M04_SecondaryApache02_JDG", "");
  5213. }
  5214. }
  5215. }
  5216. };
  5217. DECLARE_SCRIPT(M04_EngineRoom_Stationary_Tech_JDG, "Console_ID :int")
  5218. {
  5219. int myConsole_id;
  5220. bool deadYet;
  5221. REGISTER_VARIABLES()
  5222. {
  5223. SAVE_VARIABLE( deadYet, 1 );
  5224. SAVE_VARIABLE( myConsole_id, 2 );
  5225. }
  5226. void Created( GameObject * obj )
  5227. {
  5228. deadYet = false;
  5229. myConsole_id = Get_Int_Parameter("Console_ID");
  5230. Commands->Set_Innate_Is_Stationary ( obj, true );
  5231. Commands->Set_Loiters_Allowed( obj, false );
  5232. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  5233. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, 1 );
  5234. }
  5235. void Killed( GameObject * obj, GameObject * killer )
  5236. {
  5237. deadYet = true;
  5238. GameObject * engineer = Commands->Find_Object ( M04_ENGINEROOM_CHIEF_ENGINEER_JDG );
  5239. if (engineer != NULL)
  5240. {
  5241. Commands->Send_Custom_Event ( obj, engineer, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  5242. }
  5243. }
  5244. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5245. {
  5246. ActionParamsStruct params;
  5247. if (type == 0 && deadYet == false)//
  5248. {
  5249. if (param == M01_START_ACTING_JDG)
  5250. {
  5251. GameObject * myConsole = Commands->Find_Object ( myConsole_id );
  5252. if (myConsole != NULL)
  5253. {
  5254. ActionParamsStruct params;
  5255. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  5256. params.Set_Attack( myConsole, 0, 0, true );
  5257. Commands->Action_Attack ( obj, params );
  5258. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  5259. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  5260. }
  5261. else
  5262. {
  5263. Commands->Debug_Message ( "**********************startionary tech cannot find his console\n" );
  5264. }
  5265. }
  5266. else if (param == M01_MODIFY_YOUR_ACTION_JDG)
  5267. {
  5268. Commands->Action_Reset ( obj, 100 );
  5269. params.Set_Basic(this, 50, M01_DOING_ANIMATION_01_JDG);
  5270. params.Set_Animation( "H_A_CON2", false );
  5271. Commands->Action_Play_Animation (obj, params);
  5272. }
  5273. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)
  5274. {
  5275. Commands->Action_Reset ( obj, 100 );
  5276. }
  5277. else if (param == M01_IVE_BEEN_KILLED_JDG)//M04 PanicGuy 01 Twiddler
  5278. {
  5279. Commands->Innate_Disable(obj);
  5280. Commands->Action_Reset ( obj, 100 );
  5281. params.Set_Basic(this, 100, M01_FACING_SPECIFIED_DIRECTION_01_JDG);
  5282. params.Set_Attack( STAR, 0, 0, true );
  5283. Commands->Action_Attack (obj, params);
  5284. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_03_JDG, 1 );
  5285. }
  5286. else if (param == M01_MODIFY_YOUR_ACTION_03_JDG)
  5287. {
  5288. //Vector3 myPosition = Commands->Get_Position ( obj );
  5289. //Commands->Create_Sound ( "M04 PanicGuy 01 Twiddler", myPosition, obj );
  5290. Commands->Action_Reset ( obj, 100 );
  5291. params.Set_Basic(this, 100, M01_DOING_ANIMATION_03_JDG);
  5292. params.Set_Animation ("H_A_HOST_L1A", false);
  5293. Commands->Action_Play_Animation (obj, params);
  5294. }
  5295. else if (param == M01_MODIFY_YOUR_ACTION_04_JDG)//stand back up then start hunting player
  5296. {
  5297. Commands->Action_Reset ( obj, 100 );
  5298. params.Set_Basic(this, 100, M01_DOING_ANIMATION_05_JDG);
  5299. params.Set_Animation ("H_A_HOST_L2C", false);
  5300. Commands->Action_Play_Animation (obj, params);
  5301. }
  5302. }
  5303. }
  5304. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5305. {
  5306. ActionParamsStruct params;
  5307. if (complete_reason == ACTION_COMPLETE_NORMAL)
  5308. {
  5309. if (action_id == M01_DOING_ANIMATION_01_JDG)
  5310. {
  5311. char *animationName = M01_Choose_Idle_Animation ( );
  5312. params.Set_Basic( this, 50, M01_DOING_ANIMATION_02_JDG );
  5313. params.Set_Animation (animationName, false);
  5314. Commands->Action_Play_Animation (obj, params);
  5315. }
  5316. else if (action_id == M01_DOING_ANIMATION_02_JDG)
  5317. {
  5318. GameObject * myConsole = Commands->Find_Object ( myConsole_id );
  5319. if (myConsole != NULL)
  5320. {
  5321. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  5322. params.Set_Attack( myConsole, 0, 0, true );
  5323. Commands->Action_Attack ( obj, params );
  5324. float delayTimer = Commands->Get_Random ( 0, 0.5f );
  5325. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  5326. }
  5327. }
  5328. else if (action_id == M01_DOING_ANIMATION_03_JDG)
  5329. {
  5330. params.Set_Basic(this, 100, M01_DOING_ANIMATION_04_JDG);
  5331. params.Set_Animation ("H_A_HOST_L2A", false);
  5332. Commands->Action_Play_Animation (obj, params);
  5333. }
  5334. else if (action_id == M01_DOING_ANIMATION_04_JDG)
  5335. {
  5336. params.Set_Basic(this, 100, M01_DOING_ANIMATION_04_JDG);
  5337. params.Set_Animation ("H_A_HOST_L2B", true);
  5338. Commands->Action_Play_Animation (obj, params);
  5339. float delayTimer = Commands->Get_Random ( 10, 30 );
  5340. Commands->Send_Custom_Event ( obj, obj, 0, M01_MODIFY_YOUR_ACTION_04_JDG, delayTimer );
  5341. }
  5342. else if (action_id == M01_DOING_ANIMATION_05_JDG)
  5343. {
  5344. params.Set_Basic(this, 100, M01_DOING_ANIMATION_06_JDG);
  5345. params.Set_Animation ("H_A_HOST_L1C", false);
  5346. Commands->Action_Play_Animation (obj, params);
  5347. }
  5348. else if (action_id == M01_DOING_ANIMATION_06_JDG)
  5349. {
  5350. if (obj)
  5351. {
  5352. Commands->Innate_Enable(obj);
  5353. Commands->Attach_Script(obj, "M01_Hunt_The_Player_JDG", "");
  5354. }
  5355. }
  5356. }
  5357. }
  5358. };
  5359. DECLARE_SCRIPT(M04_Catwalk_Enter_Zone_01_JDG, "")//this guy comes out level 2 door
  5360. {
  5361. void Entered( GameObject * obj, GameObject * enterer )
  5362. {
  5363. if (enterer == STAR)
  5364. {
  5365. GameObject * sniperTarget01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-14.594f, 27.717f, -9));
  5366. Commands->Attach_Script(sniperTarget01, "M04_Doorway_Enterer_JDG", "-9.3 8.9 -9");
  5367. Commands->Destroy_Object ( obj );
  5368. }
  5369. }
  5370. };
  5371. DECLARE_SCRIPT(M04_Catwalk_Enter_Zone_02_JDG, "")
  5372. {
  5373. void Entered( GameObject * obj, GameObject * enterer )
  5374. {
  5375. if (enterer == STAR)
  5376. {
  5377. GameObject * sniperTarget01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(12.913f, -27.628f, -9));
  5378. Commands->Attach_Script(sniperTarget01, "M04_Doorway_Enterer_JDG", "10.868 -6.359 -9");
  5379. Commands->Destroy_Object ( obj );
  5380. }
  5381. }
  5382. };
  5383. DECLARE_SCRIPT(M04_Doorway_Enterer_JDG, "first_location:vector3")
  5384. {
  5385. Vector3 runToPosition;
  5386. Vector3 leavePosition;
  5387. REGISTER_VARIABLES()
  5388. {
  5389. SAVE_VARIABLE(runToPosition, 1);
  5390. SAVE_VARIABLE(leavePosition, 2);
  5391. }
  5392. void Created( GameObject * obj )
  5393. {
  5394. runToPosition = Get_Vector3_Parameter("first_location");
  5395. leavePosition = Commands->Get_Position ( obj );
  5396. Commands->Enable_Hibernation( obj, false );
  5397. Commands->Grant_Key( obj, 1, true );
  5398. Commands->Grant_Key( obj, 2, true );
  5399. Commands->Grant_Key( obj, 3, true );
  5400. ActionParamsStruct params;
  5401. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  5402. params.Set_Movement( runToPosition, WALK, 1);
  5403. Commands->Action_Goto ( obj, params );
  5404. }
  5405. void Killed( GameObject * obj, GameObject * killer )
  5406. {
  5407. Vector3 powerupSpawnLocation = Commands->Get_Position (obj );
  5408. powerupSpawnLocation.Z += 0.75f;
  5409. char *powerups[2] =
  5410. {//this is a list of potential powerups to be dropped by sniper target guys
  5411. "POW_Health_100",
  5412. "POW_Armor_100",
  5413. };
  5414. int random = Commands->Get_Random_Int(0, 2);
  5415. //GameObject *spawn_effect = Commands->Create_Object( "Spawner Created Special Effect", powerupSpawnLocation );
  5416. //if (spawn_effect)
  5417. //{
  5418. // Commands->Attach_Script( spawn_effect, "M00_Create_Anim_Effect_DAY", "C4_EX1A.C4_EX1A");
  5419. //}
  5420. Commands->Create_Object ( powerups[random], powerupSpawnLocation );
  5421. }
  5422. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5423. {
  5424. ActionParamsStruct params;
  5425. switch (complete_reason)
  5426. {
  5427. case ACTION_COMPLETE_NORMAL:
  5428. {
  5429. switch (action_id)
  5430. {
  5431. case M01_WALKING_WAYPATH_01_JDG:
  5432. {
  5433. char *animationName = M01_Choose_Search_Animation ( );
  5434. params.Set_Basic( this, 45, M01_DOING_ANIMATION_01_JDG );
  5435. params.Set_Animation( animationName, false );
  5436. Commands->Action_Play_Animation ( obj, params );
  5437. }
  5438. break;
  5439. case M01_DOING_ANIMATION_01_JDG:
  5440. {
  5441. ActionParamsStruct params;
  5442. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_02_JDG );
  5443. params.Set_Movement( leavePosition, WALK, 1);
  5444. Commands->Action_Goto ( obj, params );
  5445. }
  5446. break;
  5447. case M01_WALKING_WAYPATH_02_JDG:
  5448. {
  5449. Commands->Enable_Hibernation( obj, true );
  5450. Vector3 myPosition = Commands->Get_Position ( obj );
  5451. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 5 );
  5452. }
  5453. break;
  5454. }
  5455. }
  5456. break;
  5457. }
  5458. }
  5459. };
  5460. DECLARE_SCRIPT(M04_Hunter_Controller_JDG, "")//M04_ENGINEROOM_HUNTING_CONTROLLER_JDG
  5461. {
  5462. int hunter_01_id;
  5463. int hunter_02_id;
  5464. int hunter_03_id;
  5465. bool messagePlayed;
  5466. REGISTER_VARIABLES()
  5467. {
  5468. SAVE_VARIABLE(hunter_01_id, 1);
  5469. SAVE_VARIABLE(hunter_02_id, 2);
  5470. SAVE_VARIABLE(hunter_03_id, 3);
  5471. SAVE_VARIABLE(messagePlayed, 4);
  5472. }
  5473. void Created( GameObject * obj )
  5474. {
  5475. hunter_01_id = NULL;
  5476. hunter_02_id = NULL;
  5477. hunter_03_id = NULL;
  5478. messagePlayed = false;
  5479. }
  5480. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5481. {
  5482. if (type == 0)
  5483. {
  5484. if (param == M01_START_ACTING_JDG)
  5485. {
  5486. GameObject *hunter_01 = Commands->Find_Object ( hunter_01_id );
  5487. if (hunter_01 == NULL)
  5488. {
  5489. messagePlayed = false;
  5490. Vector3 hunter01_spawnlocation (-13.523f, 48.665f, -9.003f);
  5491. GameObject *hunter_01 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", hunter01_spawnlocation );
  5492. hunter_01_id = Commands->Get_ID ( hunter_01 );
  5493. Commands->Attach_Script(hunter_01, "M04_Hunter_JDG", "");
  5494. }
  5495. GameObject *hunter_02 = Commands->Find_Object ( hunter_02_id );
  5496. if (hunter_02 == NULL)
  5497. {
  5498. Vector3 hunter02_spawnlocation (11.943f, 42.201f, -15.000f);
  5499. GameObject *hunter_02 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", hunter02_spawnlocation );
  5500. hunter_02_id = Commands->Get_ID ( hunter_02 );
  5501. Commands->Attach_Script(hunter_02, "M04_Hunter_JDG", "");
  5502. }
  5503. GameObject *hunter_03 = Commands->Find_Object ( hunter_03_id );
  5504. if (hunter_03 == NULL)
  5505. {
  5506. Vector3 hunter03_spawnlocation (3.834f, 60.196f, -15.000f);
  5507. GameObject *hunter_03 = Commands->Create_Object ( "Nod_Minigunner_2SF_AutoRifle", hunter03_spawnlocation );
  5508. hunter_03_id = Commands->Get_ID ( hunter_03 );
  5509. Commands->Attach_Script(hunter_03, "M04_Hunter_JDG", "");
  5510. }
  5511. }
  5512. else if (param == M01_MODIFY_YOUR_ACTION_JDG)
  5513. {
  5514. if (messagePlayed == false)
  5515. {
  5516. messagePlayed = true;
  5517. int conv = Commands->Create_Conversation( "M04_Eva_WarnsAboutHunters_Conversation", 30, 50, false);
  5518. Commands->Join_Conversation( NULL, conv, false, false, false );
  5519. Commands->Start_Conversation( conv, conv );
  5520. }
  5521. }
  5522. else if (param == M01_GOTO_IDLE_JDG)
  5523. {
  5524. Commands->Destroy_Object ( obj );
  5525. }
  5526. }
  5527. }
  5528. };
  5529. DECLARE_SCRIPT(M04_Hunter_JDG, "")
  5530. {
  5531. float myPriority;
  5532. REGISTER_VARIABLES()
  5533. {
  5534. SAVE_VARIABLE(myPriority, 1);
  5535. }
  5536. void Created( GameObject * obj )
  5537. {
  5538. if (STAR)
  5539. {
  5540. Commands->Grant_Key( obj, 1, true );
  5541. Commands->Grant_Key( obj, 2, true );
  5542. myPriority = 85;
  5543. Commands->Enable_Hibernation( obj, false );
  5544. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5545. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 5 );
  5546. }
  5547. }
  5548. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5549. {
  5550. if (type == 0)
  5551. {
  5552. if (param == M01_MODIFY_YOUR_ACTION_JDG)
  5553. {
  5554. ActionParamsStruct params;
  5555. params.Set_Basic( this, myPriority, M01_WALKING_WAYPATH_01_JDG );
  5556. params.Set_Movement( STAR, RUN, 5 );
  5557. Commands->Action_Goto( obj, params );
  5558. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 5 );
  5559. }
  5560. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)//monitor how close you are to player
  5561. {
  5562. Vector3 myPosition = Commands->Get_Position ( obj );
  5563. Vector3 playerPosition = Commands->Get_Position ( STAR );
  5564. float distanceFromStar = Commands->Get_Distance ( myPosition, playerPosition );
  5565. if (distanceFromStar <= 40)//******play eva warning conversation here*****
  5566. {
  5567. myPriority = 45;
  5568. GameObject * hunterController = Commands->Find_Object ( M04_ENGINEROOM_HUNTING_CONTROLLER_JDG );
  5569. if (hunterController != NULL)
  5570. {
  5571. Commands->Send_Custom_Event( obj, hunterController, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5572. }
  5573. }
  5574. else
  5575. {
  5576. myPriority = 100;
  5577. }
  5578. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 5 );
  5579. }
  5580. }
  5581. }
  5582. void Destroyed( GameObject * obj )
  5583. {
  5584. GameObject * myController = Commands->Find_Object ( M04_ENGINEROOM_HUNTING_CONTROLLER_JDG );
  5585. if (myController != NULL)
  5586. {
  5587. Commands->Send_Custom_Event( obj, myController, 0, M01_START_ACTING_JDG, 1 );
  5588. }
  5589. }
  5590. };
  5591. /*DECLARE_SCRIPT(M04_Hunter_JDG, "MyLeaders_ID :int")
  5592. {
  5593. void Created( GameObject * obj )
  5594. {
  5595. int leaders_id = Get_Int_Parameter("MyLeaders_ID");
  5596. if (leaders_id == 0)
  5597. {
  5598. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 5 );
  5599. }
  5600. GameObject * leader = Commands->Find_Object ( leaders_id );
  5601. Commands->Grant_Key( obj, 1, true );
  5602. Commands->Grant_Key( obj, 2, true );
  5603. Commands->Enable_Hibernation( obj, false );
  5604. if (leader != NULL)
  5605. {
  5606. ActionParamsStruct params;
  5607. params.Set_Basic( this, 100, M01_WALKING_WAYPATH_01_JDG );
  5608. params.Set_Movement( leader, RUN, 2 );
  5609. params.AttackActive = false;
  5610. params.MoveFollow= true;
  5611. Commands->Action_Attack( obj, params );
  5612. }
  5613. else
  5614. {
  5615. ActionParamsStruct params;
  5616. params.Set_Basic( this, 100, M01_WALKING_WAYPATH_01_JDG );
  5617. params.Set_Movement( STAR, RUN, 5 );
  5618. params.AttackActive = false;
  5619. Commands->Action_Attack( obj, params );
  5620. }
  5621. Commands->Start_Timer ( obj, this, 120, M01_GOTO_IDLE_JDG );
  5622. }
  5623. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5624. {
  5625. if (obj)
  5626. {
  5627. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5628. }
  5629. }
  5630. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5631. {
  5632. if (type == 0)
  5633. {
  5634. if (param == M01_MODIFY_YOUR_ACTION_JDG)
  5635. {
  5636. ActionParamsStruct params;
  5637. params.Set_Basic( this, 100, M01_WALKING_WAYPATH_01_JDG );
  5638. params.Set_Movement( STAR, RUN, 10 );
  5639. params.Set_Attack( STAR, 50, 0, true );
  5640. params.AttackActive = true;
  5641. Commands->Modify_Action ( obj, M01_WALKING_WAYPATH_01_JDG, params, true, true );
  5642. }
  5643. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)//monitor how close you are to player
  5644. {
  5645. Vector3 myPosition = Commands->Get_Position ( obj );
  5646. Vector3 playerPosition = Commands->Get_Position ( STAR );
  5647. float distanceFromStar = Commands->Get_Distance ( myPosition, playerPosition );
  5648. if (distanceFromStar <= 40)//******play eva warning conversation here*****
  5649. {
  5650. int conv = Commands->Create_Conversation( "M04_Eva_WarnsAboutHunters_Conversation", 100, 50, false);
  5651. Commands->Join_Conversation( NULL, conv, false, false, false );
  5652. Commands->Start_Conversation( conv, conv );
  5653. }
  5654. else
  5655. {
  5656. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 5 );
  5657. }
  5658. }
  5659. }
  5660. }
  5661. void Destroyed( GameObject * obj )
  5662. {
  5663. GameObject * myController = Commands->Find_Object ( M04_ENGINEROOM_HUNTING_CONTROLLER_JDG );
  5664. if (myController != NULL)
  5665. {
  5666. Commands->Send_Custom_Event( obj, myController, 0, M01_START_ACTING_JDG, 1 );
  5667. }
  5668. }
  5669. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5670. {
  5671. if (obj && damager == STAR)
  5672. {
  5673. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5674. }
  5675. }
  5676. void Enemy_Seen( GameObject * obj, GameObject * enemy )
  5677. {
  5678. if (enemy == STAR)
  5679. {
  5680. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5681. }
  5682. }
  5683. void Timer_Expired( GameObject * obj, int timer_id )
  5684. {
  5685. if (timer_id == M01_GOTO_IDLE_JDG)
  5686. {
  5687. //Commands->Enable_Hibernation( obj, true );
  5688. Vector3 myPosition = Commands->Get_Position ( obj );
  5689. Vector3 playerPosition = Commands->Get_Position ( STAR );
  5690. float distanceFromStar = Commands->Get_Distance ( myPosition, playerPosition );
  5691. if (distanceFromStar >= 150)
  5692. {
  5693. bool visible = Commands->Is_Object_Visible( obj, STAR );
  5694. if (visible != true)
  5695. {
  5696. Commands->Apply_Damage( obj, 100000, "BlamoKiller", NULL );
  5697. }
  5698. else
  5699. {
  5700. Commands->Start_Timer ( obj, this, 20, M01_GOTO_IDLE_JDG );
  5701. }
  5702. }
  5703. else
  5704. {
  5705. Commands->Start_Timer ( obj, this, 20, M01_GOTO_IDLE_JDG );
  5706. }
  5707. }
  5708. }
  5709. };*/
  5710. DECLARE_SCRIPT(M04_Front_ofThe_Boat_Population_JDG, "")
  5711. {
  5712. void Created( GameObject * obj )
  5713. {
  5714. Vector3 myPosition = Commands->Get_Position ( obj );
  5715. Commands->Set_Innate_Soldier_Home_Location ( obj, myPosition, 3 );
  5716. }
  5717. };
  5718. DECLARE_SCRIPT(M04_Cooks_Script_JDG, "")
  5719. {
  5720. void Created( GameObject * obj )
  5721. {
  5722. Commands->Set_Innate_Is_Stationary ( obj, true );
  5723. Commands->Set_Player_Type (obj, SCRIPT_PLAYERTYPE_NOD );
  5724. }
  5725. };
  5726. DECLARE_SCRIPT(M04_Prison_Keycard_CheckZone_JDG, "")
  5727. {
  5728. void Entered( GameObject * obj, GameObject * enterer )
  5729. {
  5730. if (enterer == STAR)
  5731. {
  5732. GameObject * prisonGuard01 = Commands->Find_Object (M04_ENGINEROOM_PRISONGUARD_01_JDG);
  5733. GameObject * prisonGuard02 = Commands->Find_Object (M04_ENGINEROOM_PRISONGUARD_02_JDG);
  5734. if (prisonGuard01 != NULL)
  5735. {
  5736. Commands->Destroy_Object ( prisonGuard01 );
  5737. }
  5738. if (prisonGuard02 != NULL)
  5739. {
  5740. Commands->Destroy_Object ( prisonGuard02 );
  5741. }
  5742. Commands->Destroy_Object ( obj );
  5743. }
  5744. }
  5745. };
  5746. DECLARE_SCRIPT(M04_TiberiumHold_EntryZone_and_Controller_JDG, "")//this guys ID number is M04_TIBERIUM_HOLD_CONTROLLER_JDG 100572
  5747. {
  5748. bool entered;
  5749. bool ok_to_clean_up;
  5750. int cargo_conv1;
  5751. REGISTER_VARIABLES()
  5752. {
  5753. SAVE_VARIABLE( entered, 1 );
  5754. SAVE_VARIABLE( ok_to_clean_up, 2 );
  5755. SAVE_VARIABLE( cargo_conv1, 3 );
  5756. }
  5757. void Created( GameObject * obj )
  5758. {
  5759. entered = false;
  5760. ok_to_clean_up = false;
  5761. }
  5762. void Entered( GameObject * obj, GameObject * enterer )
  5763. {
  5764. if ( enterer == STAR && (ok_to_clean_up == true))
  5765. {
  5766. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 6000, 0 );//tell aft deck controller to clean up any remaining soldiers
  5767. }
  5768. if ( enterer == STAR && (entered == false))
  5769. {
  5770. entered = true;
  5771. if (STAR != NULL)
  5772. {
  5773. cargo_conv1 = Commands->Create_Conversation( "M04_TiberiumHold_Entry_Conversation", 100, 1000, false);
  5774. Commands->Join_Conversation( NULL, cargo_conv1, false, false, false);
  5775. //Commands->Join_Conversation( STAR, cargo_conv1, false, false, false );
  5776. Commands->Start_Conversation( cargo_conv1, cargo_conv1 );
  5777. }
  5778. GameObject * cryochamber = Commands->Find_Object (M04_TIBERIUM_CRYOCHAMBER_JDG);
  5779. if (cryochamber != NULL)
  5780. {
  5781. Commands->Send_Custom_Event( obj, cryochamber, 0, M01_START_ACTING_JDG, 0 );
  5782. }
  5783. GameObject *visceroidGuy01 = Commands->Find_Object (M04_TIBERIUM_HOLD_TECH01_JDG);
  5784. if (visceroidGuy01 != NULL)
  5785. {
  5786. Commands->Send_Custom_Event( obj, visceroidGuy01, 0, M01_START_ACTING_JDG, 3 );
  5787. }
  5788. }
  5789. }
  5790. };
  5791. DECLARE_SCRIPT(M04_TibHold_MutantChamber_JDG, "")
  5792. {
  5793. int cryoShakeCounter;
  5794. bool released;
  5795. REGISTER_VARIABLES()
  5796. {
  5797. SAVE_VARIABLE( cryoShakeCounter, 1 );
  5798. SAVE_VARIABLE( released, 2 );
  5799. }
  5800. void Created( GameObject * obj )
  5801. {
  5802. Commands->Set_Animation_Frame ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", 0 );
  5803. cryoShakeCounter = 0;
  5804. released = false;
  5805. }
  5806. void Damaged( GameObject * obj, GameObject * damager, float amount )
  5807. {
  5808. float myHealth = Commands->Get_Health ( obj );
  5809. if (myHealth <= 10)
  5810. {
  5811. Commands->Set_Health ( obj, 0.25f );
  5812. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5813. }
  5814. }
  5815. void Animation_Complete( GameObject * obj, const char * animation_name )
  5816. {
  5817. if (cryoShakeCounter < 10)
  5818. {
  5819. Commands->Set_Animation ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", false, NULL, 0, 9 );
  5820. cryoShakeCounter++;
  5821. }
  5822. else
  5823. {
  5824. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  5825. }
  5826. }
  5827. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5828. {
  5829. if (type == 0)
  5830. {
  5831. if (param == M01_START_ACTING_JDG)
  5832. {
  5833. Commands->Set_Animation ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", false, NULL, 0, 9 );
  5834. }
  5835. else if (param == M01_MODIFY_YOUR_ACTION_JDG && released == false)
  5836. {
  5837. released = true;
  5838. Commands->Set_Animation ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", false, NULL, 0, 15 );
  5839. Vector3 myPosition = Commands->Get_Position ( obj );
  5840. Commands->Create_Explosion ( "Explosion_Barrel_Toxic", myPosition, NULL );
  5841. Vector3 spawnLocation (-14.4f, -112.2f, -9);
  5842. GameObject * realMutant = Commands->Create_Object ( "Mutant_0_Mutant", spawnLocation );
  5843. Commands->Attach_Script(realMutant, "M04_TibHold_RealMutant_JDG", "");
  5844. GameObject * simpleMutant = Commands->Find_Object (M04_TIBERIUM_SIMPLEMUTANT_JDG);
  5845. if (simpleMutant != NULL)
  5846. {
  5847. Commands->Destroy_Object ( simpleMutant );
  5848. }
  5849. float myFacing = Commands->Get_Facing ( obj );
  5850. GameObject *destroyedVersion = Commands->Create_Object ( "Simple_Large_CryoChamber_Destroyed", myPosition );
  5851. Commands->Set_Facing ( destroyedVersion, myFacing );
  5852. Commands->Destroy_Object ( obj );
  5853. }
  5854. }
  5855. }
  5856. };
  5857. DECLARE_SCRIPT(M04_TibHold_SimpleMutant_JDG, "")
  5858. {
  5859. void Created( GameObject * obj )
  5860. {
  5861. Commands->Set_Animation_Frame ( obj, "S_A_HUMAN.H_A_822A", 15 );
  5862. }
  5863. };
  5864. /*DECLARE_SCRIPT(M11_MutantCrypt_Spawner03_Guy_JDG, "")
  5865. {
  5866. typedef enum {
  5867. IDLE,
  5868. ATTACKING,
  5869. DEAD,
  5870. } M11_Mutant_State;
  5871. M11_Mutant_State myState;
  5872. REGISTER_VARIABLES()
  5873. {
  5874. SAVE_VARIABLE(myState, 1);
  5875. }
  5876. void Created( GameObject * obj )
  5877. {
  5878. myState = IDLE;
  5879. float delayTimer = Commands->Get_Random ( 10, 20 );
  5880. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, delayTimer );
  5881. Commands->Send_Custom_Event ( obj, obj, 0, M01_PICK_A_NEW_LOCATION_JDG, 0 );
  5882. }
  5883. void Killed( GameObject * obj, GameObject * killer )
  5884. {
  5885. myState = DEAD;
  5886. GameObject * mutantController = Commands->Find_Object ( M11_MUTANT_CRYPT_SPAWNER_CONTROLLER_JDG );
  5887. if (mutantController != NULL)
  5888. {
  5889. Commands->Send_Custom_Event ( obj, mutantController, 0, M01_SPAWNER_IS_DEAD_JDG, 0 );
  5890. }
  5891. }
  5892. void Enemy_Seen( GameObject * obj, GameObject * enemy )
  5893. {
  5894. if (obj && enemy == STAR && myState == IDLE)//
  5895. {
  5896. myState = ATTACKING;
  5897. char *soundName = M11_Choose_Mutant_Alerted_Sound ( );
  5898. Vector3 myPosition = Commands->Get_Position ( obj );
  5899. Commands->Create_Sound ( soundName, myPosition, obj );
  5900. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  5901. Commands->Create_Logical_Sound (obj, M11_MUTANT_IS_NEARBY_JDG, myPosition, 50 );
  5902. }
  5903. }
  5904. void Sound_Heard( GameObject * obj, const CombatSound & sound )
  5905. {
  5906. if ( sound.Type == M11_MUTANT_IS_NEARBY_JDG )
  5907. {
  5908. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  5909. }
  5910. }
  5911. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5912. {
  5913. if (param == M01_START_ACTING_JDG)
  5914. {
  5915. if (obj && myState == IDLE)
  5916. {
  5917. char *soundName = M11_Choose_Mutant_Idle_Sound ( );
  5918. Vector3 myPosition = Commands->Get_Position ( obj );
  5919. Commands->Create_Sound ( soundName, myPosition, obj );
  5920. float delayTimer = Commands->Get_Random ( 10, 20 );
  5921. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, delayTimer );
  5922. }
  5923. else if (obj && myState != DEAD)
  5924. {
  5925. char *soundName = M11_Choose_Mutant_Attack_Sound ( );
  5926. Vector3 myPosition = Commands->Get_Position ( obj );
  5927. Commands->Create_Sound ( soundName, myPosition, obj );
  5928. float delayTimer = Commands->Get_Random ( 0, 10 );
  5929. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, delayTimer );
  5930. }
  5931. }
  5932. else if (obj && param == M01_PICK_A_NEW_LOCATION_JDG)
  5933. {
  5934. ActionParamsStruct params;
  5935. params.Set_Basic(this, 80, M01_PICK_A_NEW_LOCATION_JDG);
  5936. params.Set_Movement( Vector3(-15.128f, 17.965f, -63.748f), .1f, 1 );
  5937. Commands->Action_Goto( obj, params );
  5938. }
  5939. else if (obj && param == M01_HUNT_THE_PLAYER_JDG)
  5940. {
  5941. if (STAR)
  5942. {
  5943. ActionParamsStruct params;
  5944. params.Set_Basic(this, 100, M01_HUNT_THE_PLAYER_JDG);
  5945. params.Set_Movement(STAR, 2, 1);
  5946. Commands->Action_Goto ( obj, params );
  5947. }
  5948. else
  5949. {
  5950. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  5951. }
  5952. }
  5953. }
  5954. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5955. {
  5956. ActionParamsStruct params;
  5957. if (complete_reason == ACTION_COMPLETE_NORMAL)
  5958. {
  5959. if (obj && action_id == M01_PICK_A_NEW_LOCATION_JDG)
  5960. {
  5961. ActionParamsStruct params;
  5962. params.Set_Basic(this, 80, M01_WALKING_WAYPATH_01_JDG);
  5963. params.Set_Movement( Vector3(0,0,0), .1f, 1 );
  5964. int random = Commands->Get_Random_Int(0, 4);
  5965. if (random == 0)
  5966. {
  5967. params.WaypathID = 100076;
  5968. params.WaypointStartID = 100077;
  5969. params.WaypointEndID = 100085;
  5970. }
  5971. else if (random == 1)
  5972. {
  5973. params.WaypathID = 100087;
  5974. params.WaypointStartID = 100088;
  5975. params.WaypointEndID = 100096;
  5976. }
  5977. else if (random == 3)
  5978. {
  5979. params.WaypathID = 100076;
  5980. params.WaypointStartID = 100085;
  5981. params.WaypointEndID = 100077;
  5982. }
  5983. else
  5984. {
  5985. params.WaypathID = 100087;
  5986. params.WaypointStartID = 100096;
  5987. params.WaypointEndID = 100088;
  5988. }
  5989. Commands->Action_Goto( obj, params );
  5990. }
  5991. else if (obj && action_id == M01_WALKING_WAYPATH_01_JDG)
  5992. {
  5993. char *animationName = M01_Choose_Idle_Animation ( );
  5994. params.Set_Basic( this, 60, M01_DOING_ANIMATION_01_JDG );
  5995. params.Set_Animation (animationName, false);
  5996. Commands->Action_Play_Animation (obj, params);
  5997. }
  5998. else if (obj && action_id == M01_DOING_ANIMATION_01_JDG)
  5999. {
  6000. ActionParamsStruct params;
  6001. params.Set_Basic(this, 80, M01_PICK_A_NEW_LOCATION_JDG);
  6002. params.Set_Movement( Vector3(-15.128f, 17.965f, -63.748f), .1f, 1 );
  6003. Commands->Action_Goto( obj, params );
  6004. }
  6005. else if (obj && action_id == M01_HUNT_THE_PLAYER_JDG)
  6006. {
  6007. if (STAR)
  6008. {
  6009. char *soundName = M11_Choose_Mutant_Attack_Sound ( );
  6010. Vector3 myPosition = Commands->Get_Position ( obj );
  6011. Commands->Create_Sound ( soundName, myPosition, obj );
  6012. char *animationName = M11_Choose_Mutant_Attack_Animation ( );
  6013. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  6014. params.Set_Animation (animationName, false);
  6015. Commands->Action_Play_Animation (obj, params);
  6016. Commands->Apply_Damage( STAR, 5, "TiberiumRaw", obj );
  6017. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  6018. }
  6019. }
  6020. }
  6021. }
  6022. };*/
  6023. DECLARE_SCRIPT(M04_TibHold_RealMutant_JDG, "")
  6024. {
  6025. void Created( GameObject * obj )
  6026. {
  6027. Commands->Enable_Hibernation(obj, false );
  6028. char *mutantAnimations[4] =
  6029. {
  6030. "S_A_HUMAN.H_A_A0A0_L02",
  6031. "S_A_HUMAN.H_A_A0A0_L04",
  6032. "S_A_HUMAN.H_A_J11C",
  6033. "S_A_HUMAN.H_A_J21C",
  6034. };
  6035. int random = Commands->Get_Random_Int(0, 4);
  6036. ActionParamsStruct params;
  6037. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  6038. params.Set_Animation( mutantAnimations[random], false );
  6039. Commands->Action_Play_Animation ( obj, params );
  6040. }
  6041. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6042. {
  6043. if (obj && param == M01_HUNT_THE_PLAYER_JDG)
  6044. {
  6045. if (STAR)
  6046. {
  6047. ActionParamsStruct params;
  6048. params.Set_Basic(this, 100, M01_GOING_TO_HAVOC_JDG);
  6049. params.Set_Movement(STAR, 1, 0.5f);
  6050. Commands->Action_Goto ( obj, params );
  6051. }
  6052. else
  6053. {
  6054. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  6055. }
  6056. }
  6057. }
  6058. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  6059. {
  6060. ActionParamsStruct params;
  6061. if (complete_reason == ACTION_COMPLETE_NORMAL)
  6062. {
  6063. if (action_id == M01_DOING_ANIMATION_01_JDG)
  6064. {
  6065. params.Set_Basic( this, 100, M01_GOING_TO_HAVOC_JDG );
  6066. params.Set_Movement( STAR, 1.0f, 0.5f );
  6067. Commands->Action_Goto (obj, params);
  6068. }
  6069. else if (action_id == M01_GOING_TO_HAVOC_JDG)
  6070. {
  6071. if (obj && STAR)
  6072. {
  6073. char *soundName = M11_Choose_Mutant_Attack_Sound ( );
  6074. Vector3 myPosition = Commands->Get_Position ( obj );
  6075. Commands->Create_Sound ( soundName, myPosition, obj );
  6076. char *animationName = M11_Choose_Mutant_Attack_Animation ( );
  6077. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  6078. params.Set_Animation (animationName, false);
  6079. Commands->Action_Play_Animation (obj, params);
  6080. Commands->Apply_Damage( STAR, 5, "TiberiumRaw", obj );
  6081. Commands->Send_Custom_Event( obj, obj, 0, M01_HUNT_THE_PLAYER_JDG, 1 );
  6082. }
  6083. }
  6084. }
  6085. }
  6086. };
  6087. DECLARE_SCRIPT(M04_TibHold_MutantChambers_Controller_JDG, "")//M04_TIBERIUM_CHAMBERCONTROLLER_JDG 104113
  6088. {
  6089. int mutantChamber01_id;
  6090. int mutantChamber02_id;
  6091. int mutantChamber03_id;
  6092. int mutantChamber04_id;
  6093. int mutant01_id;
  6094. int mutant02_id;
  6095. int mutant03_id;
  6096. int mutant04_id;
  6097. REGISTER_VARIABLES()
  6098. {
  6099. SAVE_VARIABLE( mutantChamber01_id, 1 );
  6100. SAVE_VARIABLE( mutantChamber02_id, 2 );
  6101. SAVE_VARIABLE( mutantChamber03_id, 3 );
  6102. SAVE_VARIABLE( mutantChamber04_id, 4 );
  6103. SAVE_VARIABLE( mutant01_id, 5 );
  6104. SAVE_VARIABLE( mutant02_id, 6 );
  6105. SAVE_VARIABLE( mutant03_id, 7 );
  6106. SAVE_VARIABLE( mutant04_id, 8 );
  6107. }
  6108. void Created( GameObject * obj )
  6109. {
  6110. Vector3 mutantChamber01_Position (12.322f, -113.537f, -9);
  6111. float mutantChamber01_Facing = 155;
  6112. Vector3 mutantChamber02_Position (5.007f, -111.035f, -9);
  6113. float mutantChamber02_Facing = -90;
  6114. Vector3 mutantChamber03_Position (-5.646f, -113.485f, -9);
  6115. float mutantChamber03_Facing = -90;
  6116. Vector3 mutantChamber04_Position (-11.817f, -111.029f, -9);
  6117. float mutantChamber04_Facing = -90;
  6118. Vector3 mutant01_Position (12.330f, -113.560f, -8.224f);
  6119. float mutant01_Facing = 65;
  6120. Vector3 mutant02_Position (4.999f, -111.061f, -8.254f);
  6121. float mutant02_Facing = -175;
  6122. Vector3 mutant03_Position (-5.614f, -113.500f, -8.263f);
  6123. float mutant03_Facing = 180;
  6124. Vector3 mutant04_Position (-11.767f, -111.026f, -8.257f);
  6125. float mutant04_Facing = 180;
  6126. GameObject * mutantChamber01 = Commands->Create_Object ( "Simple_Large_CryoChamber", mutantChamber01_Position );
  6127. Commands->Set_Facing ( mutantChamber01, mutantChamber01_Facing );
  6128. Commands->Attach_Script(mutantChamber01, "M04_TibHold_MutantChamber_NoThreat_JDG", "");
  6129. GameObject * mutantChamber02 = Commands->Create_Object ( "Simple_Large_CryoChamber", mutantChamber02_Position );
  6130. Commands->Set_Facing ( mutantChamber02, mutantChamber02_Facing );
  6131. Commands->Attach_Script(mutantChamber02, "M04_TibHold_MutantChamber_NoThreat_JDG", "");
  6132. GameObject * mutantChamber03 = Commands->Create_Object ( "Simple_Large_CryoChamber", mutantChamber03_Position );
  6133. Commands->Set_Facing ( mutantChamber03, mutantChamber03_Facing );
  6134. Commands->Attach_Script(mutantChamber03, "M04_TibHold_MutantChamber_NoThreat_JDG", "");
  6135. GameObject * mutantChamber04 = Commands->Create_Object ( "Simple_Large_CryoChamber", mutantChamber04_Position );
  6136. Commands->Set_Facing ( mutantChamber04, mutantChamber04_Facing );
  6137. Commands->Attach_Script(mutantChamber04, "M04_TibHold_MutantChamber_NoThreat_JDG", "");
  6138. GameObject * mutant01 = Commands->Create_Object ( "M11_Mutant_1_Simple", mutant01_Position );
  6139. Commands->Set_Facing ( mutant01, mutant01_Facing );
  6140. Commands->Attach_Script(mutant01, "M04_TibHold_Mutant_NoThreat_JDG", "");
  6141. GameObject * mutant02 = Commands->Create_Object ( "M11_Mutant_1_Simple", mutant02_Position );
  6142. Commands->Set_Facing ( mutant02, mutant02_Facing );
  6143. Commands->Attach_Script(mutant02, "M04_TibHold_Mutant_NoThreat_JDG", "");
  6144. GameObject * mutant03 = Commands->Create_Object ( "M11_Mutant_1_Simple", mutant03_Position );
  6145. Commands->Set_Facing ( mutant03, mutant03_Facing );
  6146. Commands->Attach_Script(mutant03, "M04_TibHold_Mutant_NoThreat_JDG", "");
  6147. GameObject * mutant04 = Commands->Create_Object ( "M11_Mutant_1_Simple", mutant04_Position );
  6148. Commands->Set_Facing ( mutant04, mutant04_Facing );
  6149. Commands->Attach_Script(mutant04, "M04_TibHold_Mutant_NoThreat_JDG", "");
  6150. mutantChamber01_id = Commands->Get_ID ( mutantChamber01 );
  6151. mutantChamber02_id = Commands->Get_ID ( mutantChamber02 );
  6152. mutantChamber03_id = Commands->Get_ID ( mutantChamber03 );
  6153. mutantChamber04_id = Commands->Get_ID ( mutantChamber04 );
  6154. mutant01_id = Commands->Get_ID ( mutant01 );
  6155. mutant02_id = Commands->Get_ID ( mutant02 );
  6156. mutant03_id = Commands->Get_ID ( mutant03 );
  6157. mutant04_id = Commands->Get_ID ( mutant04 );
  6158. }
  6159. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6160. {
  6161. if (type == 0)
  6162. {
  6163. if (param == M01_IVE_BEEN_KILLED_JDG)//a chamber's been destroyed--do swap and whatnot
  6164. {
  6165. Commands->Debug_Message ( "***************************Mutant chamber received custom that non-destroyed version has been killed\n" );
  6166. GameObject * mutantChamber01 = Commands->Find_Object ( mutantChamber01_id );
  6167. GameObject * mutantChamber02 = Commands->Find_Object ( mutantChamber02_id );
  6168. GameObject * mutantChamber03 = Commands->Find_Object ( mutantChamber03_id );
  6169. GameObject * mutantChamber04 = Commands->Find_Object ( mutantChamber04_id );
  6170. Vector3 chamberPosition = Commands->Get_Position ( sender );
  6171. float chamberFacing = Commands->Get_Facing ( sender );
  6172. GameObject *destroyedVersion = Commands->Create_Object ( "Simple_Large_CryoChamber_Destroyed", chamberPosition );
  6173. Commands->Set_Facing ( destroyedVersion, chamberFacing );
  6174. Commands->Destroy_Object ( sender );
  6175. GameObject * simpleMutant = NULL;
  6176. if (sender == mutantChamber01)
  6177. {
  6178. simpleMutant = Commands->Find_Object ( mutant01_id );
  6179. }
  6180. else if (sender == mutantChamber02)
  6181. {
  6182. simpleMutant = Commands->Find_Object ( mutant02_id );
  6183. }
  6184. else if (sender == mutantChamber03)
  6185. {
  6186. simpleMutant = Commands->Find_Object ( mutant03_id );
  6187. }
  6188. else if (sender == mutantChamber04)
  6189. {
  6190. simpleMutant = Commands->Find_Object ( mutant04_id );
  6191. }
  6192. if (simpleMutant != NULL)
  6193. {
  6194. Commands->Send_Custom_Event( obj, simpleMutant, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  6195. }
  6196. }
  6197. }
  6198. }
  6199. };
  6200. DECLARE_SCRIPT(M04_TibHold_MutantChamber_NoThreat_JDG, "")
  6201. {
  6202. bool switched;
  6203. REGISTER_VARIABLES()
  6204. {
  6205. SAVE_VARIABLE( switched, 1 );
  6206. }
  6207. void Created( GameObject * obj )
  6208. {
  6209. switched = false;
  6210. Commands->Set_Animation_Frame ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", 0 );
  6211. }
  6212. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6213. {
  6214. float myHealth = Commands->Get_Health ( obj );
  6215. if (obj && switched == true)
  6216. {
  6217. Commands->Set_Health ( obj, 0.25f );
  6218. }
  6219. else if (obj && myHealth <= 10 && switched == false)
  6220. {
  6221. switched = true;
  6222. Commands->Set_Animation ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", false, NULL, 0, 15 );
  6223. Vector3 myPosition = Commands->Get_Position ( obj );
  6224. Commands->Create_Explosion ( "Explosion_Barrel_Toxic", myPosition, NULL );
  6225. Commands->Set_Health ( obj, 0.25f );
  6226. GameObject * myController = Commands->Find_Object ( M04_TIBERIUM_CHAMBERCONTROLLER_JDG );
  6227. if (myController != NULL)
  6228. {
  6229. Commands->Debug_Message ( "***************************Mutant chamber sending custom that non-destroyed version has been killed\n" );
  6230. Commands->Send_Custom_Event( obj, myController, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  6231. }
  6232. }
  6233. else
  6234. {
  6235. Commands->Set_Animation ( obj, "DSP_CRYOBIG2.DSP_CRYOBIG2", false, NULL, 0, 9 );
  6236. }
  6237. }
  6238. };
  6239. DECLARE_SCRIPT(M04_TibHold_Mutant_NoThreat_JDG, "")
  6240. {
  6241. float myMaxHealth;
  6242. REGISTER_VARIABLES()
  6243. {
  6244. SAVE_VARIABLE( myMaxHealth, 1 );
  6245. }
  6246. void Created( GameObject * obj )
  6247. {
  6248. myMaxHealth = Commands->Get_Max_Health ( obj );
  6249. Commands->Set_Animation_Frame ( obj, "S_A_HUMAN.H_A_822A", 15 );
  6250. }
  6251. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6252. {
  6253. if (obj)
  6254. {
  6255. Commands->Set_Health ( obj, myMaxHealth );
  6256. }
  6257. }
  6258. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6259. {
  6260. if (type == 0)
  6261. {
  6262. if (param == M01_IVE_BEEN_KILLED_JDG)//your chamber's been destroyed--do swap and whatnot
  6263. {
  6264. Commands->Set_Animation ( obj, "S_C_Human.H_C_Tubedie", false, NULL, 0, 22 );
  6265. }
  6266. }
  6267. }
  6268. void Animation_Complete(GameObject * obj, const char *anim)
  6269. {
  6270. if (stricmp(anim, "S_C_Human.H_C_Tubedie") == 0)
  6271. {
  6272. Commands->Destroy_Object ( obj );
  6273. }
  6274. }
  6275. };
  6276. DECLARE_SCRIPT(M04_Visceroid_JDG, "")
  6277. {
  6278. void Created( GameObject * obj )
  6279. {
  6280. ActionParamsStruct params;
  6281. params.Set_Basic( this, 100, M01_GOING_TO_HAVOC_JDG );
  6282. params.Set_Movement( STAR, 1.0f, 1 );
  6283. Commands->Action_Goto (obj, params);
  6284. int cargo_conv1 = Commands->Create_Conversation( "M04_TiberiumHold_Visceroid_Conversation", 100, 1000, false);
  6285. Commands->Join_Conversation( NULL, cargo_conv1, false, false, false);
  6286. //Commands->Join_Conversation( STAR, cargo_conv1, false, false, false );
  6287. Commands->Start_Conversation( cargo_conv1, cargo_conv1 );
  6288. }
  6289. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6290. {
  6291. if (type == 0)
  6292. {
  6293. if (param == M01_MODIFY_YOUR_ACTION_JDG)
  6294. {
  6295. Vector3 myPosition = Commands->Get_Position ( obj );
  6296. GameObject * myTarget = Commands->Find_Closest_Soldier ( myPosition, 0, 10, true );
  6297. if (myTarget != NULL)
  6298. {
  6299. ActionParamsStruct params;
  6300. params.Set_Basic( this, 100, M01_GOING_TO_HAVOC_JDG );
  6301. params.Set_Movement( myTarget, 1.0f, 3 );
  6302. Commands->Action_Goto (obj, params);
  6303. }
  6304. }
  6305. }
  6306. }
  6307. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  6308. {
  6309. if (action_id == M01_GOING_TO_HAVOC_JDG)
  6310. {
  6311. Vector3 myPosition = Commands->Get_Position ( obj );
  6312. GameObject * myTarget = Commands->Find_Closest_Soldier ( myPosition, 0, 10, true );
  6313. if (myTarget != NULL)
  6314. {
  6315. ActionParamsStruct params;
  6316. params.Set_Basic( this, 100, M01_START_ATTACKING_01_JDG );
  6317. params.Set_Attack( myTarget, 5, 0, true );
  6318. Commands->Action_Attack (obj, params);
  6319. }
  6320. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 2 );
  6321. }
  6322. }
  6323. };
  6324. DECLARE_SCRIPT(M04_Visceroid_Dude_01_JDG, "")//M04_TIBERIUM_HOLD_TECH01_JDG 102147
  6325. {
  6326. int spill_conv1;
  6327. REGISTER_VARIABLES()
  6328. {
  6329. SAVE_VARIABLE( spill_conv1, 1 );
  6330. }
  6331. void Created( GameObject * obj )
  6332. {
  6333. Commands->Set_Innate_Is_Stationary ( obj, true );
  6334. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  6335. }
  6336. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6337. {
  6338. if (type == 0)
  6339. {
  6340. if (param == M01_START_ACTING_JDG)
  6341. {
  6342. GameObject *visceroidGuy02 = Commands->Find_Object (M04_TIBERIUM_HOLD_TECH02_JDG);
  6343. if (obj && visceroidGuy02 != NULL)
  6344. {
  6345. spill_conv1 = Commands->Create_Conversation( "M04_Tiberium_Tech_Conversation", 30, 20, true);
  6346. Commands->Join_Conversation( obj, spill_conv1, false, false, false);
  6347. Commands->Join_Conversation( visceroidGuy02, spill_conv1, false, false, false );
  6348. Commands->Start_Conversation( spill_conv1, spill_conv1 );
  6349. Commands->Monitor_Conversation( obj, spill_conv1);
  6350. }
  6351. }
  6352. }
  6353. }
  6354. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  6355. {
  6356. if (complete_reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  6357. {
  6358. if (action_id == spill_conv1)
  6359. {
  6360. GameObject *visceroidGuy02 = Commands->Find_Object (M04_TIBERIUM_HOLD_TECH02_JDG);
  6361. if (visceroidGuy02 != NULL)
  6362. {
  6363. Commands->Send_Custom_Event( obj, visceroidGuy02, 0, M01_START_ACTING_JDG, 2 );
  6364. }
  6365. Commands->Set_Innate_Is_Stationary ( obj, false );
  6366. ActionParamsStruct params;
  6367. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  6368. params.Set_Movement( Vector3 (-9.622f, -5.406f, -15), WALK, 5, false );
  6369. Commands->Action_Goto ( obj, params );
  6370. }
  6371. }
  6372. else if (complete_reason == ACTION_COMPLETE_NORMAL)
  6373. {
  6374. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  6375. {
  6376. Commands->Set_Innate_Soldier_Home_Location (obj, Vector3 (-9.622f, -5.406f, -15), 10 );
  6377. }
  6378. }
  6379. }
  6380. };
  6381. DECLARE_SCRIPT(M04_Visceroid_Dude_02_JDG, "")//M04_TIBERIUM_HOLD_TECH02_JDG 102148
  6382. {
  6383. bool first_time_damaged;
  6384. REGISTER_VARIABLES()
  6385. {
  6386. SAVE_VARIABLE( first_time_damaged, 1 );
  6387. }
  6388. void Created( GameObject * obj )
  6389. {
  6390. Commands->Set_Innate_Is_Stationary ( obj, true );
  6391. Commands->Innate_Soldier_Enable_Footsteps_Heard ( obj, false );
  6392. first_time_damaged = true;
  6393. }
  6394. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6395. {
  6396. if (type == 0)
  6397. {
  6398. if (param == M01_START_ACTING_JDG)
  6399. {
  6400. ActionParamsStruct params;
  6401. params.Set_Basic( this, 100, M01_DOING_ANIMATION_01_JDG );
  6402. params.Set_Animation( "H_A_A0A0_L28A", false );
  6403. Commands->Action_Play_Animation ( obj, params );
  6404. }
  6405. else if (param == M01_MODIFY_YOUR_ACTION_JDG)
  6406. {
  6407. Vector3 myPosition = Commands->Get_Position ( obj );
  6408. myPosition.Z += 0.25f;
  6409. Commands->Create_Explosion ( "Explosion_Barrel_Toxic", myPosition, NULL );//
  6410. GameObject * visceroid = Commands->Create_Object ( "Visceroid", myPosition );
  6411. Commands->Attach_Script(visceroid, "M04_Visceroid_JDG", "");
  6412. Commands->Destroy_Object ( obj );
  6413. }
  6414. }
  6415. }
  6416. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  6417. {
  6418. ActionParamsStruct params;
  6419. if (complete_reason == ACTION_COMPLETE_NORMAL)
  6420. {
  6421. if (action_id == M01_DOING_ANIMATION_01_JDG)
  6422. {
  6423. params.Set_Basic( this, 100, M01_DOING_ANIMATION_02_JDG );
  6424. params.Set_Animation( "H_A_A0A0_L28B", true );
  6425. Commands->Action_Play_Animation ( obj, params );
  6426. }
  6427. }
  6428. }
  6429. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6430. {
  6431. Commands->Set_Health (obj, 0.25f );
  6432. if (first_time_damaged == true)
  6433. {
  6434. first_time_damaged = false;
  6435. ActionParamsStruct params;
  6436. params.Set_Basic( this, 100, M01_DOING_ANIMATION_03_JDG );
  6437. params.Set_Animation( "H_A_601A", false );
  6438. Commands->Action_Play_Animation ( obj, params );
  6439. float delayTimer = Commands->Get_Random ( 1, 2 );
  6440. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, delayTimer );
  6441. }
  6442. }
  6443. };
  6444. DECLARE_SCRIPT(M04_Keycard_01_Script_JDG, "")
  6445. {
  6446. void Created( GameObject * obj )
  6447. {
  6448. Commands->Enable_Hibernation( obj, false );
  6449. }
  6450. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6451. {
  6452. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  6453. {
  6454. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 590, 2 );
  6455. }
  6456. }
  6457. };
  6458. DECLARE_SCRIPT(M04_Keycard_02_Script_JDG, "")
  6459. {
  6460. void Created( GameObject * obj )
  6461. {
  6462. Commands->Enable_Hibernation( obj, false );
  6463. }
  6464. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6465. {
  6466. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  6467. {
  6468. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 510, 4 );
  6469. //Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 1001, 2 );//tell objective controller to go back to regular background music
  6470. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_TIBERIUM_HOLD_CONTROLLER_JDG) , 0, 2000, 0);//this custom tells the tib zone that its okay clean up aft deck soldiers next time entered
  6471. GameObject *zone02 = Commands->Find_Object (100438);//stays--subbay door
  6472. if (zone02 != NULL)
  6473. {
  6474. Commands->Destroy_Object ( zone02 );
  6475. }
  6476. GameObject *zone04 = Commands->Find_Object (100440);//stays--subbay door
  6477. if (zone04 != NULL)
  6478. {
  6479. Commands->Destroy_Object ( zone04 );
  6480. }
  6481. GameObject *zone06 = Commands->Find_Object (100442);//stays--yellow door by prison
  6482. if (zone06 != NULL)
  6483. {
  6484. Commands->Destroy_Object ( zone06 );
  6485. }
  6486. GameObject *zone01 = Commands->Find_Object (104762);//stays-- yellow door by big sam
  6487. if (zone01 != NULL)
  6488. {
  6489. Commands->Destroy_Object ( zone01 );
  6490. }
  6491. }
  6492. }
  6493. };
  6494. DECLARE_SCRIPT(M04_Keycard_03_Script_JDG, "")
  6495. {
  6496. void Created( GameObject * obj )
  6497. {
  6498. Commands->Enable_Hibernation( obj, false );
  6499. }
  6500. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6501. {
  6502. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  6503. {
  6504. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 520, 4 );
  6505. //Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 470, 8 );
  6506. //Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 1001, 2 );//tell objective controller to go back to regular background music
  6507. //controller to start action
  6508. Commands->Send_Custom_Event( obj, Commands->Find_Object (101126), 0, 100, 0 );//tells subbay zones to okay battle music
  6509. Commands->Send_Custom_Event( obj, Commands->Find_Object (101127), 0, 100, 0 );//tells subbay zones to okay battle music
  6510. Commands->Send_Custom_Event( obj, Commands->Find_Object (101128), 0, 100, 0 );//tells subbay zones to okay battle music
  6511. Commands->Send_Custom_Event( obj, Commands->Find_Object (101129), 0, 100, 0 );//tells subbay zones to okay battle music
  6512. Commands->Send_Custom_Event( obj, Commands->Find_Object (101130), 0, 100, 0 );//tells subbay zones to okay battle music
  6513. Commands->Send_Custom_Event( obj, Commands->Find_Object (101131), 0, 100, 0 );//tells subbay zones to okay battle music
  6514. Commands->Send_Custom_Event( obj, Commands->Find_Object (101132), 0, 100, 0 );//tells subbay zones to okay battle music
  6515. Commands->Send_Custom_Event( obj, Commands->Find_Object (101133), 0, 100, 0 );//tells subbay zones to okay battle music
  6516. Commands->Send_Custom_Event( obj, Commands->Find_Object (101134), 0, 100, 0 );//tells subbay zones to okay battle music
  6517. Commands->Send_Custom_Event( obj, Commands->Find_Object (101135), 0, 100, 0 );//tells subbay zones to okay battle music
  6518. Commands->Send_Custom_Event( obj, Commands->Find_Object (101136), 0, 100, 0 );//tells subbay zones to okay battle music
  6519. Commands->Send_Custom_Event( obj, Commands->Find_Object (101137), 0, 100, 0 );//tells subbay zones to okay battle music
  6520. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(0.084f, 95.837f, 3) );
  6521. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(-1.983f, 72.772f, 0) );
  6522. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(9.840f, 89.533f, 0) );
  6523. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(11.822f, 39.659f, -15) );
  6524. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(-13.725f, 38.871f, -9) );
  6525. Commands->Create_Object ( "Nod_Minigunner_2SF_Shotgun", Vector3(-10.606f, 32.021f, 0) );
  6526. }
  6527. }
  6528. };
  6529. DECLARE_SCRIPT(M04_Ships_Captain_JDG, "")//this guys ID number is M04_SHIPS_CAPTAIN_JDG 100401
  6530. {
  6531. #define STATIONARY_DELAY_TIMER 0x1234553
  6532. void Created( GameObject * obj )
  6533. {
  6534. Commands->Start_Timer ( obj, this, 1, STATIONARY_DELAY_TIMER );
  6535. }
  6536. void Timer_Expired( GameObject * obj, int timer_id )
  6537. {
  6538. if (timer_id == STATIONARY_DELAY_TIMER)
  6539. {
  6540. Commands->Set_Innate_Is_Stationary ( obj, true );
  6541. }
  6542. }
  6543. void Killed( GameObject * obj, GameObject * killer )
  6544. {
  6545. Vector3 spawn_location = Commands->Get_Position ( obj );
  6546. spawn_location.Z = spawn_location.Z + 0.25f;
  6547. Commands->Create_Object ( "M04_L03_Keycard", spawn_location );
  6548. }
  6549. };
  6550. DECLARE_SCRIPT(M04_Ships_FirstMate_JDG, "")//this guys ID number is M04_SHIPS_FIRST_MATE_JDG 100400
  6551. {
  6552. void Created( GameObject * obj )
  6553. {
  6554. Commands->Set_Innate_Is_Stationary ( obj, true );
  6555. }
  6556. void Killed( GameObject * obj, GameObject * killer )
  6557. {
  6558. Vector3 spawn_location = Commands->Get_Position ( obj );
  6559. spawn_location.Z = spawn_location.Z + 0.25f;
  6560. Commands->Create_Object ( "M04_L02_Keycard", spawn_location );
  6561. //putting down patrol guys for trip back towards captain
  6562. GameObject * samRoomPatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(11.503f, -51.722f, 2.704f));
  6563. Commands->Attach_Script(samRoomPatrolGuy, "M04_PostFirstMate_SamRoom_PatrolGuy_JDG", "");
  6564. GameObject * missileRoomPatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(13.213f, -53.008f, -15.0f));
  6565. Commands->Attach_Script(missileRoomPatrolGuy, "M04_PostFirstMate_MissileRoom_PatrolGuy_JDG", "");
  6566. GameObject * subBayPatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_0", Vector3(12.527f, 19.447f, -15.0f));
  6567. Commands->Attach_Script(subBayPatrolGuy, "M04_Front_ofThe_Boat_Population_JDG", "");
  6568. GameObject * officerQuartersPatrolGuy = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(8.342f, 80.0f, 3.0f));
  6569. Commands->Attach_Script(officerQuartersPatrolGuy, "M04_PostFirstMate_OfficerQuarters_PatrolGuy_JDG", "");
  6570. GameObject * foreDeckPatrolGuy01 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(0.345f, 106.479f, 3.001f));
  6571. Commands->Attach_Script(foreDeckPatrolGuy01, "M04_PostFirstMate_FrontDeck_PatrolGuy01_JDG", "");
  6572. GameObject * foreDeckPatrolGuy02 = Commands->Create_Object ( "Nod_MiniGunner_1Off", Vector3(-13.320f, 71.885f, 0));
  6573. Commands->Attach_Script(foreDeckPatrolGuy02, "M04_PostFirstMate_FrontDeck_PatrolGuy02_JDG", "");
  6574. }
  6575. };
  6576. DECLARE_SCRIPT(M04_Prison_Warden_JDG, "")//this guys ID is M04_PRISON_WARDEN_JDG 100399
  6577. {
  6578. void Created( GameObject * obj )
  6579. {
  6580. Commands->Set_Innate_Is_Stationary ( obj, true );
  6581. GameObject * medTech = Commands->Find_Object ( M04_MEDLAB_TECHNICIAN_JDG);
  6582. if (medTech != NULL)
  6583. {
  6584. ActionParamsStruct params;
  6585. params.Set_Basic( this, 90, M01_START_ATTACKING_01_JDG );
  6586. params.Set_Attack( medTech, 0, 0, true);
  6587. Commands->Action_Attack(obj, params);
  6588. }
  6589. }
  6590. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6591. {
  6592. if (damager == STAR)
  6593. {
  6594. Commands->Set_Innate_Is_Stationary ( obj, false );
  6595. }
  6596. }
  6597. void Custom (GameObject* obj, int type, int param, GameObject* sender)
  6598. {
  6599. ActionParamsStruct params;
  6600. if (param == 100)//warden has received custom to start acting
  6601. {
  6602. GameObject *medTech = Commands->Find_Object ( M04_MEDLAB_TECHNICIAN_JDG);
  6603. if (obj && medTech != NULL)
  6604. {
  6605. int medlabConversation = Commands->Create_Conversation( "M04_MedLab_Conversation", 80, 50, true);
  6606. Commands->Join_Conversation( obj, medlabConversation, true, true, true );
  6607. Commands->Join_Conversation( medTech, medlabConversation, true, true, true );
  6608. Commands->Start_Conversation( medlabConversation, medlabConversation );
  6609. }
  6610. }
  6611. }
  6612. void Killed( GameObject * obj, GameObject * killer )
  6613. {
  6614. Vector3 spawn_location = Commands->Get_Position ( obj );
  6615. spawn_location.Z = spawn_location.Z + 0.25f;
  6616. Commands->Create_Object ( "M04_L01_Keycard", spawn_location );
  6617. }
  6618. };
  6619. DECLARE_SCRIPT(M04_MedLab_Tech_JDG, "")//this guys ID is M04_MEDLAB_TECHNICIAN_JDG 101202
  6620. {
  6621. void Created( GameObject * obj )
  6622. {
  6623. Commands->Set_Innate_Is_Stationary ( obj, true );
  6624. Commands->Set_Player_Type ( obj, SCRIPT_PLAYERTYPE_NOD );
  6625. GameObject * prisonGuard = Commands->Find_Object ( M04_PRISON_WARDEN_JDG );
  6626. if (prisonGuard != NULL)
  6627. {
  6628. ActionParamsStruct params;
  6629. params.Set_Basic( this, 90, M01_START_ATTACKING_01_JDG );
  6630. params.Set_Attack( prisonGuard, 0, 0, true);
  6631. Commands->Action_Attack(obj, params);
  6632. }
  6633. }
  6634. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6635. {
  6636. if (type == 0)
  6637. {
  6638. if (param == M01_START_ACTING_JDG)
  6639. {
  6640. //Commands->Action_Reset ( obj, 100 );
  6641. ActionParamsStruct params;
  6642. params.Set_Basic( this, 45, M01_WALKING_WAYPATH_01_JDG );
  6643. params.Set_Movement( Vector3 (5.3f, -83.6f, 3.000f), RUN, 1 );
  6644. Commands->Action_Goto( obj, params );
  6645. }
  6646. else if (param == 100)
  6647. {
  6648. GameObject * prisonGuard = Commands->Find_Object ( M04_PRISON_WARDEN_JDG );
  6649. if (prisonGuard != NULL)
  6650. {
  6651. Commands->Action_Reset ( obj, 100 );
  6652. Vector3 wardenLocation = Commands->Get_Position ( prisonGuard );
  6653. ActionParamsStruct params;
  6654. params.Set_Basic( this, 100, M01_START_ATTACKING_01_JDG );
  6655. params.Set_Face_Location( wardenLocation, 2 );
  6656. Commands->Action_Face_Location ( obj, params );
  6657. }
  6658. }
  6659. }
  6660. }
  6661. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  6662. {
  6663. if (action_id == M01_WALKING_WAYPATH_01_JDG)
  6664. {
  6665. ActionParamsStruct params;
  6666. params.Set_Basic(this, 100, M01_START_ACTING_JDG);
  6667. params.Set_Animation ("H_A_A0C0", true);
  6668. Commands->Action_Play_Animation (obj, params);
  6669. }
  6670. }
  6671. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6672. {
  6673. if (damager == STAR)
  6674. {
  6675. if (obj)
  6676. {
  6677. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, 0 );
  6678. }
  6679. }
  6680. }
  6681. void Enemy_Seen( GameObject * obj, GameObject * enemy )
  6682. {
  6683. if (obj && enemy == STAR)
  6684. {
  6685. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ACTING_JDG, 0 );
  6686. }
  6687. }
  6688. };
  6689. /****************************************************************************************************************
  6690. The Following are all the scripts associated with the objectives...including controller
  6691. ****************************************************************************************************************/
  6692. DECLARE_SCRIPT(M04_Prisoners_Rescued_Controller_JDG, "")
  6693. {
  6694. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6695. {
  6696. if (type == 0)
  6697. {
  6698. if (param == 1)
  6699. {
  6700. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_END_FIREFIGHT_CONTROLLER_JDG), 0, 1, 2 );//telling firefight controller to allow end firefight
  6701. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 500, 2 );
  6702. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_AFT_DECK_CONTROLLER_JDG), 0, 3000, 2 );//tell aft deck controller that prisoners have been rescued
  6703. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 410, 6 );
  6704. Commands->Set_Position ( STAR, Vector3(2.542f, -80.526f, 0) );
  6705. Commands->Set_Facing ( STAR, -125 );
  6706. Commands->Control_Enable ( STAR, true );
  6707. Commands->Set_Is_Rendered( STAR, true );
  6708. }
  6709. }
  6710. }
  6711. };
  6712. DECLARE_SCRIPT(M04_MissileRoom_ObjectiveZone_JDG, "")
  6713. {
  6714. void Entered( GameObject * obj, GameObject * enterer )
  6715. {
  6716. if ( enterer == STAR )
  6717. {
  6718. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 440, 0 );//tell objective controller to announce missile objective
  6719. GameObject *zone01 = Commands->Find_Object (100429);//stays
  6720. if (zone01 != NULL)
  6721. {
  6722. Commands->Destroy_Object ( zone01 );
  6723. }
  6724. GameObject *zone03 = Commands->Find_Object (100431);//stays
  6725. if (zone03 != NULL)
  6726. {
  6727. Commands->Destroy_Object ( zone03 );
  6728. }
  6729. }
  6730. }
  6731. };
  6732. DECLARE_SCRIPT(M04_Announce_Keycard_02_Objective_Zone_JDG, "")
  6733. {
  6734. void Entered( GameObject * obj, GameObject * enterer )
  6735. {
  6736. if ( enterer == STAR )
  6737. {
  6738. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 410, 5 );
  6739. GameObject *zone02 = Commands->Find_Object (100438);//stays
  6740. if (zone02 != NULL)
  6741. {
  6742. Commands->Destroy_Object ( zone02 );
  6743. }
  6744. GameObject *zone04 = Commands->Find_Object (100440);//stays
  6745. if (zone04 != NULL)
  6746. {
  6747. Commands->Destroy_Object ( zone04 );
  6748. }
  6749. GameObject *zone06 = Commands->Find_Object (100442);//stays also add 104762
  6750. if (zone06 != NULL)
  6751. {
  6752. Commands->Destroy_Object ( zone06 );
  6753. }
  6754. GameObject *zone01 = Commands->Find_Object (104762);//stays
  6755. if (zone01 != NULL)
  6756. {
  6757. Commands->Destroy_Object ( zone01 );
  6758. }
  6759. }
  6760. }
  6761. };
  6762. DECLARE_SCRIPT(M04_EngineRoom_SniperScript_JDG, "")
  6763. {
  6764. void Created( GameObject * obj )
  6765. {
  6766. int easy = 0;
  6767. int currentDifficulty = Commands->Get_Difficulty_Level( );
  6768. if (currentDifficulty == easy)
  6769. {
  6770. Commands->Destroy_Object ( obj );
  6771. }
  6772. }
  6773. };
  6774. DECLARE_SCRIPT(M04_MissileRoom_Target01_JDG, "")//100420
  6775. {
  6776. bool poked_yet;
  6777. Vector3 myPosition;
  6778. bool pokable;
  6779. int sabotageSound;
  6780. int timesSoundPlayed;
  6781. REGISTER_VARIABLES()
  6782. {
  6783. SAVE_VARIABLE( poked_yet, 1 );
  6784. SAVE_VARIABLE( myPosition, 2 );
  6785. SAVE_VARIABLE( pokable, 3 );
  6786. SAVE_VARIABLE( sabotageSound, 4 );
  6787. SAVE_VARIABLE( timesSoundPlayed, 5 );
  6788. }
  6789. void Created( GameObject * obj )
  6790. {
  6791. timesSoundPlayed = 0;
  6792. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  6793. pokable = false;
  6794. poked_yet = false;
  6795. myPosition = Commands->Get_Position ( obj );
  6796. Commands->Set_Animation_Frame ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", 1 );
  6797. }
  6798. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6799. {
  6800. if (type == CUSTOM_EVENT_SOUND_ENDED )
  6801. {
  6802. if (param == sabotageSound)
  6803. {
  6804. timesSoundPlayed++;
  6805. if (timesSoundPlayed >= 4)
  6806. {
  6807. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  6808. }
  6809. else
  6810. {
  6811. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6812. Commands->Monitor_Sound ( obj, sabotageSound );
  6813. }
  6814. }
  6815. }
  6816. else if (type == 0)
  6817. {
  6818. if (param == M01_START_ACTING_JDG)
  6819. {
  6820. if (poked_yet == false)
  6821. {
  6822. pokable = true;
  6823. Commands->Set_Obj_Radar_Blip_Shape ( obj, RADAR_BLIP_SHAPE_OBJECTIVE );
  6824. Commands->Set_Obj_Radar_Blip_Color ( obj, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  6825. }
  6826. }
  6827. }
  6828. }
  6829. void Poked( GameObject * obj, GameObject * poker )
  6830. {
  6831. if (poked_yet == false && pokable == true)
  6832. {
  6833. if (STAR != NULL)
  6834. {
  6835. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6836. Commands->Monitor_Sound ( obj, sabotageSound );
  6837. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  6838. poked_yet = true;
  6839. Commands->Set_Animation ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", false);
  6840. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 100, 0 );
  6841. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );//104693
  6842. Commands->Set_Obj_Radar_Blip_Shape ( obj, -1 );
  6843. Commands->Set_Obj_Radar_Blip_Color ( obj, -1 );
  6844. GameObject * pogController = Commands->Find_Object ( 104693 );
  6845. if (pogController != NULL)
  6846. {
  6847. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 300, 0 );
  6848. }
  6849. }
  6850. }
  6851. }
  6852. };
  6853. DECLARE_SCRIPT(M04_MissileRoom_Target02_JDG, "")//100421
  6854. {
  6855. bool poked_yet;
  6856. Vector3 myPosition;
  6857. bool pokable;
  6858. int sabotageSound;
  6859. int timesSoundPlayed;
  6860. REGISTER_VARIABLES()
  6861. {
  6862. SAVE_VARIABLE( poked_yet, 1 );
  6863. SAVE_VARIABLE( myPosition, 2 );
  6864. SAVE_VARIABLE( pokable, 3 );
  6865. SAVE_VARIABLE( sabotageSound, 4 );
  6866. SAVE_VARIABLE( timesSoundPlayed, 5 );
  6867. }
  6868. void Created( GameObject * obj )
  6869. {
  6870. timesSoundPlayed = 0;
  6871. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  6872. pokable = false;
  6873. poked_yet = false;
  6874. myPosition = Commands->Get_Position ( obj );
  6875. Commands->Set_Animation_Frame ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", 1 );
  6876. }
  6877. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6878. {
  6879. if (type == CUSTOM_EVENT_SOUND_ENDED )
  6880. {
  6881. if (param == sabotageSound)
  6882. {
  6883. timesSoundPlayed++;
  6884. if (timesSoundPlayed >= 4)
  6885. {
  6886. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  6887. }
  6888. else
  6889. {
  6890. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6891. Commands->Monitor_Sound ( obj, sabotageSound );
  6892. }
  6893. }
  6894. }
  6895. else if (type == 0)
  6896. {
  6897. if (param == M01_START_ACTING_JDG)
  6898. {
  6899. if (poked_yet == false)
  6900. {
  6901. pokable = true;
  6902. Commands->Set_Obj_Radar_Blip_Shape ( obj, RADAR_BLIP_SHAPE_OBJECTIVE );
  6903. Commands->Set_Obj_Radar_Blip_Color ( obj, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  6904. }
  6905. }
  6906. }
  6907. }
  6908. void Poked( GameObject * obj, GameObject * poker )
  6909. {
  6910. if (poked_yet == false && pokable == true)
  6911. {
  6912. if (STAR != NULL)
  6913. {
  6914. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6915. Commands->Monitor_Sound ( obj, sabotageSound );
  6916. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  6917. poked_yet = true;
  6918. Commands->Set_Animation ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", false);
  6919. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 110, 0 );
  6920. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  6921. Commands->Set_Obj_Radar_Blip_Shape ( obj, -1 );
  6922. Commands->Set_Obj_Radar_Blip_Color ( obj, -1 );
  6923. GameObject * pogController = Commands->Find_Object ( 104693 );
  6924. if (pogController != NULL)
  6925. {
  6926. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 300, 0 );
  6927. }
  6928. }
  6929. }
  6930. }
  6931. };
  6932. DECLARE_SCRIPT(M04_MissileRoom_Target03_JDG, "")//100422
  6933. {
  6934. bool poked_yet;
  6935. Vector3 myPosition;
  6936. bool pokable;
  6937. int sabotageSound;
  6938. int timesSoundPlayed;
  6939. REGISTER_VARIABLES()
  6940. {
  6941. SAVE_VARIABLE( poked_yet, 1 );
  6942. SAVE_VARIABLE( myPosition, 2 );
  6943. SAVE_VARIABLE( pokable, 3 );
  6944. SAVE_VARIABLE( sabotageSound, 4 );
  6945. SAVE_VARIABLE( timesSoundPlayed, 5 );
  6946. }
  6947. void Created( GameObject * obj )
  6948. {
  6949. timesSoundPlayed = 0;
  6950. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  6951. pokable = false;
  6952. poked_yet = false;
  6953. myPosition = Commands->Get_Position ( obj );
  6954. Commands->Set_Animation_Frame ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", 1 );
  6955. }
  6956. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6957. {
  6958. if (type == CUSTOM_EVENT_SOUND_ENDED )
  6959. {
  6960. if (param == sabotageSound)
  6961. {
  6962. timesSoundPlayed++;
  6963. if (timesSoundPlayed >= 4)
  6964. {
  6965. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  6966. }
  6967. else
  6968. {
  6969. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6970. Commands->Monitor_Sound ( obj, sabotageSound );
  6971. }
  6972. }
  6973. }
  6974. else if (type == 0)
  6975. {
  6976. if (param == M01_START_ACTING_JDG)
  6977. {
  6978. if (poked_yet == false)
  6979. {
  6980. pokable = true;
  6981. Commands->Set_Obj_Radar_Blip_Shape ( obj, RADAR_BLIP_SHAPE_OBJECTIVE );
  6982. Commands->Set_Obj_Radar_Blip_Color ( obj, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  6983. }
  6984. }
  6985. }
  6986. }
  6987. void Poked( GameObject * obj, GameObject * poker )
  6988. {
  6989. if (poked_yet == false && pokable == true)
  6990. {
  6991. if (STAR != NULL)
  6992. {
  6993. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  6994. Commands->Monitor_Sound ( obj, sabotageSound );
  6995. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  6996. poked_yet = true;
  6997. Commands->Set_Animation ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", false);
  6998. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 120, 0 );
  6999. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  7000. Commands->Set_Obj_Radar_Blip_Shape ( obj, -1 );
  7001. Commands->Set_Obj_Radar_Blip_Color ( obj, -1 );
  7002. GameObject * pogController = Commands->Find_Object ( 104693 );
  7003. if (pogController != NULL)
  7004. {
  7005. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 300, 0 );
  7006. }
  7007. }
  7008. }
  7009. }
  7010. };
  7011. DECLARE_SCRIPT(M04_MissileRoom_Target04_JDG, "")//100423
  7012. {
  7013. bool poked_yet;
  7014. Vector3 myPosition;
  7015. bool pokable;
  7016. int sabotageSound;
  7017. int timesSoundPlayed;
  7018. REGISTER_VARIABLES()
  7019. {
  7020. SAVE_VARIABLE( poked_yet, 1 );
  7021. SAVE_VARIABLE( myPosition, 2 );
  7022. SAVE_VARIABLE( pokable, 3 );
  7023. SAVE_VARIABLE( sabotageSound, 4 );
  7024. SAVE_VARIABLE( timesSoundPlayed, 5 );
  7025. }
  7026. void Created( GameObject * obj )
  7027. {
  7028. timesSoundPlayed = 0;
  7029. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  7030. pokable = false;
  7031. poked_yet = false;
  7032. myPosition = Commands->Get_Position ( obj );
  7033. Commands->Set_Animation_Frame ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", 1 );
  7034. }
  7035. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7036. {
  7037. if (type == CUSTOM_EVENT_SOUND_ENDED )
  7038. {
  7039. if (param == sabotageSound)
  7040. {
  7041. timesSoundPlayed++;
  7042. if (timesSoundPlayed >= 4)
  7043. {
  7044. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  7045. }
  7046. else
  7047. {
  7048. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  7049. Commands->Monitor_Sound ( obj, sabotageSound );
  7050. }
  7051. }
  7052. }
  7053. else if (type == 0)
  7054. {
  7055. if (param == M01_START_ACTING_JDG)
  7056. {
  7057. if (poked_yet == false)
  7058. {
  7059. pokable = true;
  7060. Commands->Set_Obj_Radar_Blip_Shape ( obj, RADAR_BLIP_SHAPE_OBJECTIVE );
  7061. Commands->Set_Obj_Radar_Blip_Color ( obj, RADAR_BLIP_COLOR_PRIMARY_OBJECTIVE );
  7062. }
  7063. }
  7064. }
  7065. }
  7066. void Poked( GameObject * obj, GameObject * poker )
  7067. {
  7068. if (poked_yet == false && pokable == true)
  7069. {
  7070. if (STAR != NULL)
  7071. {
  7072. sabotageSound = Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  7073. Commands->Monitor_Sound ( obj, sabotageSound );
  7074. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  7075. poked_yet = true;
  7076. Commands->Set_Animation ( obj, "DSP_L4MISSRACK.DSP_L4MISSRACK", false);
  7077. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 130, 0 );
  7078. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  7079. Commands->Set_Obj_Radar_Blip_Shape ( obj, -1 );
  7080. Commands->Set_Obj_Radar_Blip_Color ( obj, -1 );
  7081. GameObject * pogController = Commands->Find_Object ( 104693 );
  7082. if (pogController != NULL)
  7083. {
  7084. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 300, 0 );
  7085. }
  7086. }
  7087. }
  7088. }
  7089. };
  7090. DECLARE_SCRIPT(M04_EngineRoom_Target01_JDG, "")
  7091. {
  7092. void Killed( GameObject * obj, GameObject * killer )
  7093. {
  7094. Vector3 myPosition = Commands->Get_Position ( obj );
  7095. Commands->Create_Explosion ( "Explosion_Barrel_Fuel", myPosition, obj );
  7096. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 300, 0 );
  7097. GameObject * pogController = Commands->Find_Object ( 104693 );
  7098. if (pogController != NULL)
  7099. {
  7100. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 200, 0 );
  7101. }
  7102. GameObject * engineBuildingController = Commands->Find_Object (M04_ENGINEROOM_BUILDING_CONTROLLER_JDG);
  7103. if (engineBuildingController != NULL)
  7104. {
  7105. Commands->Send_Custom_Event( obj, engineBuildingController, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7106. }
  7107. GameObject * myOperator = Commands->Find_Object (M04_ENGINEROOM_TECH_04_JDG);
  7108. if (myOperator != NULL)
  7109. {
  7110. Commands->Send_Custom_Event( obj, myOperator, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7111. }
  7112. }
  7113. };
  7114. DECLARE_SCRIPT(M04_EngineRoom_Target02_JDG, "")
  7115. {
  7116. void Killed( GameObject * obj, GameObject * killer )
  7117. {
  7118. Vector3 myPosition = Commands->Get_Position ( obj );
  7119. Commands->Create_Explosion ( "Explosion_Barrel_Fuel", myPosition, obj );
  7120. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 310, 0 );
  7121. GameObject * pogController = Commands->Find_Object ( 104693 );
  7122. if (pogController != NULL)
  7123. {
  7124. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 200, 0 );
  7125. }
  7126. GameObject * engineBuildingController = Commands->Find_Object (M04_ENGINEROOM_BUILDING_CONTROLLER_JDG);
  7127. if (engineBuildingController != NULL)
  7128. {
  7129. Commands->Send_Custom_Event( obj, engineBuildingController, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7130. }
  7131. GameObject * myOperator = Commands->Find_Object (M04_ENGINEROOM_TECH_01_JDG);
  7132. if (myOperator != NULL)
  7133. {
  7134. Commands->Send_Custom_Event( obj, myOperator, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7135. }
  7136. }
  7137. };
  7138. DECLARE_SCRIPT(M04_EngineRoom_Target03_JDG, "")
  7139. {
  7140. void Killed( GameObject * obj, GameObject * killer )
  7141. {
  7142. Vector3 myPosition = Commands->Get_Position ( obj );
  7143. Commands->Create_Explosion ( "Explosion_Barrel_Fuel", myPosition, obj );
  7144. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 320, 0 );
  7145. GameObject * pogController = Commands->Find_Object ( 104693 );
  7146. if (pogController != NULL)
  7147. {
  7148. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 200, 0 );
  7149. }
  7150. GameObject * engineBuildingController = Commands->Find_Object (M04_ENGINEROOM_BUILDING_CONTROLLER_JDG);
  7151. if (engineBuildingController != NULL)
  7152. {
  7153. Commands->Send_Custom_Event( obj, engineBuildingController, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7154. }
  7155. GameObject * myOperator = Commands->Find_Object (M04_ENGINEROOM_TECH_02_JDG);
  7156. if (myOperator != NULL)
  7157. {
  7158. Commands->Send_Custom_Event( obj, myOperator, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7159. }
  7160. }
  7161. };
  7162. DECLARE_SCRIPT(M04_EngineRoom_Target04_JDG, "")
  7163. {
  7164. void Killed( GameObject * obj, GameObject * killer )
  7165. {
  7166. Vector3 myPosition = Commands->Get_Position ( obj );
  7167. Commands->Create_Explosion ( "Explosion_Barrel_Fuel", myPosition, obj );
  7168. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 330, 0 );
  7169. GameObject * pogController = Commands->Find_Object ( 104693 );
  7170. if (pogController != NULL)
  7171. {
  7172. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 200, 0 );
  7173. }
  7174. GameObject * engineBuildingController = Commands->Find_Object (M04_ENGINEROOM_BUILDING_CONTROLLER_JDG);
  7175. if (engineBuildingController != NULL)
  7176. {
  7177. Commands->Send_Custom_Event( obj, engineBuildingController, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7178. }
  7179. GameObject * myOperator = Commands->Find_Object (M04_ENGINEROOM_TECH_03_JDG);
  7180. if (myOperator != NULL)
  7181. {
  7182. Commands->Send_Custom_Event( obj, myOperator, 0, M01_IVE_BEEN_KILLED_JDG, 0 );
  7183. }
  7184. }
  7185. };
  7186. DECLARE_SCRIPT(M04_ApacheRoom_Second_EntryZone_TopFloor_JDG, "")//105011 105012
  7187. {
  7188. int apache_id;
  7189. bool commandClearance;
  7190. REGISTER_VARIABLES()
  7191. {
  7192. SAVE_VARIABLE( apache_id, 1 );
  7193. SAVE_VARIABLE( commandClearance, 2 );
  7194. }
  7195. void Created( GameObject * obj )
  7196. {
  7197. apache_id = NULL;
  7198. commandClearance = false;
  7199. }
  7200. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7201. {
  7202. if (type == 0)
  7203. {
  7204. if (param == M01_CHOPPER_IS_SENDING_ID_JDG)//apache is sending you his id
  7205. {
  7206. apache_id = Commands->Get_ID ( sender );
  7207. }
  7208. else if (param == M01_START_ACTING_JDG)
  7209. {
  7210. commandClearance = true;
  7211. }
  7212. }
  7213. }
  7214. void Entered( GameObject * obj, GameObject * enterer )
  7215. {
  7216. if (enterer == STAR)
  7217. {
  7218. if (commandClearance == true)
  7219. {
  7220. GameObject * apache = Commands->Find_Object ( apache_id );
  7221. if (apache != NULL)
  7222. {
  7223. Commands->Send_Custom_Event( obj, apache, 0, M01_MODIFY_YOUR_ACTION_07_JDG, 0 );
  7224. }
  7225. GameObject * zone01 = Commands->Find_Object ( 105011 );
  7226. GameObject * zone02 = Commands->Find_Object ( 105012 );
  7227. GameObject * zone03 = Commands->Find_Object ( 105081 );
  7228. GameObject * zone04 = Commands->Find_Object ( 105082 );
  7229. GameObject * zone05 = Commands->Find_Object ( 105083 );
  7230. GameObject * zone06 = Commands->Find_Object ( 105084 );
  7231. if (zone01 != NULL)
  7232. {
  7233. Commands->Destroy_Object ( zone01 );
  7234. }
  7235. if (zone02 != NULL)
  7236. {
  7237. Commands->Destroy_Object ( zone02 );
  7238. }
  7239. if (zone03 != NULL)
  7240. {
  7241. Commands->Destroy_Object ( zone03 );
  7242. }
  7243. if (zone04 != NULL)
  7244. {
  7245. Commands->Destroy_Object ( zone04 );
  7246. }
  7247. if (zone05 != NULL)
  7248. {
  7249. Commands->Destroy_Object ( zone05 );
  7250. }
  7251. if (zone06 != NULL)
  7252. {
  7253. Commands->Destroy_Object ( zone06 );
  7254. }
  7255. }
  7256. }
  7257. }
  7258. };
  7259. DECLARE_SCRIPT(M04_ApacheRoom_Second_EntryZone_MiddleFloor_JDG, "")//105081 105082
  7260. {
  7261. int apache_id;
  7262. bool commandClearance;
  7263. REGISTER_VARIABLES()
  7264. {
  7265. SAVE_VARIABLE( apache_id, 1 );
  7266. SAVE_VARIABLE( commandClearance, 2 );
  7267. }
  7268. void Created( GameObject * obj )
  7269. {
  7270. apache_id = NULL;
  7271. commandClearance = false;
  7272. }
  7273. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7274. {
  7275. if (type == 0)
  7276. {
  7277. if (param == M01_CHOPPER_IS_SENDING_ID_JDG)//apache is sending you his id
  7278. {
  7279. apache_id = Commands->Get_ID ( sender );
  7280. }
  7281. else if (param == M01_START_ACTING_JDG)
  7282. {
  7283. commandClearance = true;
  7284. }
  7285. }
  7286. }
  7287. void Entered( GameObject * obj, GameObject * enterer )
  7288. {
  7289. if (enterer == STAR)
  7290. {
  7291. if (commandClearance == true)
  7292. {
  7293. GameObject * apache = Commands->Find_Object ( apache_id );
  7294. if (apache != NULL)
  7295. {
  7296. Commands->Send_Custom_Event( obj, apache, 0, M01_MODIFY_YOUR_ACTION_08_JDG, 0 );
  7297. }
  7298. GameObject * zone01 = Commands->Find_Object ( 105011 );
  7299. GameObject * zone02 = Commands->Find_Object ( 105012 );
  7300. GameObject * zone03 = Commands->Find_Object ( 105081 );
  7301. GameObject * zone04 = Commands->Find_Object ( 105082 );
  7302. GameObject * zone05 = Commands->Find_Object ( 105083 );
  7303. GameObject * zone06 = Commands->Find_Object ( 105084 );
  7304. if (zone01 != NULL)
  7305. {
  7306. Commands->Destroy_Object ( zone01 );
  7307. }
  7308. if (zone02 != NULL)
  7309. {
  7310. Commands->Destroy_Object ( zone02 );
  7311. }
  7312. if (zone03 != NULL)
  7313. {
  7314. Commands->Destroy_Object ( zone03 );
  7315. }
  7316. if (zone04 != NULL)
  7317. {
  7318. Commands->Destroy_Object ( zone04 );
  7319. }
  7320. if (zone05 != NULL)
  7321. {
  7322. Commands->Destroy_Object ( zone05 );
  7323. }
  7324. if (zone06 != NULL)
  7325. {
  7326. Commands->Destroy_Object ( zone06 );
  7327. }
  7328. }
  7329. }
  7330. }
  7331. };
  7332. DECLARE_SCRIPT(M04_ApacheRoom_Second_EntryZone_BottomFloor_JDG, "")//105083 105084
  7333. {
  7334. int apache_id;
  7335. bool commandClearance;
  7336. REGISTER_VARIABLES()
  7337. {
  7338. SAVE_VARIABLE( apache_id, 1 );
  7339. SAVE_VARIABLE( commandClearance, 2 );
  7340. }
  7341. void Created( GameObject * obj )
  7342. {
  7343. apache_id = NULL;
  7344. commandClearance = false;
  7345. }
  7346. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7347. {
  7348. if (type == 0)
  7349. {
  7350. if (param == M01_CHOPPER_IS_SENDING_ID_JDG)//apache is sending you his id
  7351. {
  7352. apache_id = Commands->Get_ID ( sender );
  7353. }
  7354. else if (param == M01_START_ACTING_JDG)
  7355. {
  7356. commandClearance = true;
  7357. }
  7358. }
  7359. }
  7360. void Entered( GameObject * obj, GameObject * enterer )
  7361. {
  7362. if (enterer == STAR)
  7363. {
  7364. if (commandClearance == true)
  7365. {
  7366. GameObject * apache = Commands->Find_Object ( apache_id );
  7367. if (apache != NULL)
  7368. {
  7369. Commands->Send_Custom_Event( obj, apache, 0, M01_MODIFY_YOUR_ACTION_09_JDG, 0 );
  7370. }
  7371. GameObject * zone01 = Commands->Find_Object ( 105011 );
  7372. GameObject * zone02 = Commands->Find_Object ( 105012 );
  7373. GameObject * zone03 = Commands->Find_Object ( 105081 );
  7374. GameObject * zone04 = Commands->Find_Object ( 105082 );
  7375. GameObject * zone05 = Commands->Find_Object ( 105083 );
  7376. GameObject * zone06 = Commands->Find_Object ( 105084 );
  7377. if (zone01 != NULL)
  7378. {
  7379. Commands->Destroy_Object ( zone01 );
  7380. }
  7381. if (zone02 != NULL)
  7382. {
  7383. Commands->Destroy_Object ( zone02 );
  7384. }
  7385. if (zone03 != NULL)
  7386. {
  7387. Commands->Destroy_Object ( zone03 );
  7388. }
  7389. if (zone04 != NULL)
  7390. {
  7391. Commands->Destroy_Object ( zone04 );
  7392. }
  7393. if (zone05 != NULL)
  7394. {
  7395. Commands->Destroy_Object ( zone05 );
  7396. }
  7397. if (zone06 != NULL)
  7398. {
  7399. Commands->Destroy_Object ( zone06 );
  7400. }
  7401. }
  7402. }
  7403. }
  7404. };
  7405. DECLARE_SCRIPT(M04_Apache_GoBackToHangar_EntryZone_JDG, "")//105085
  7406. {
  7407. int apache_id;
  7408. bool commandClearance;
  7409. REGISTER_VARIABLES()
  7410. {
  7411. SAVE_VARIABLE( apache_id, 1 );
  7412. }
  7413. void Created( GameObject * obj )
  7414. {
  7415. apache_id = NULL;
  7416. }
  7417. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7418. {
  7419. if (type == 0)
  7420. {
  7421. if (param == M01_CHOPPER_IS_SENDING_ID_JDG)//apache is sending you his id
  7422. {
  7423. apache_id = Commands->Get_ID ( sender );
  7424. }
  7425. }
  7426. }
  7427. void Entered( GameObject * obj, GameObject * enterer )
  7428. {
  7429. if (enterer == STAR)
  7430. {
  7431. GameObject * apache = Commands->Find_Object ( apache_id );
  7432. if (apache != NULL)
  7433. {
  7434. Commands->Send_Custom_Event( obj, apache, 0, M01_MODIFY_YOUR_ACTION_06_JDG, 0 );//tell helicopter to go wait above hangar
  7435. }
  7436. }
  7437. }
  7438. };
  7439. DECLARE_SCRIPT(M04_ApacheRoom_Apache_JDG, "")
  7440. {
  7441. bool objective_active;
  7442. bool fighting_rocket_turrets;
  7443. bool waitingInAmbush;
  7444. bool fightingInHangar;
  7445. REGISTER_VARIABLES()
  7446. {
  7447. SAVE_VARIABLE(objective_active, 1);
  7448. SAVE_VARIABLE(fighting_rocket_turrets, 2);
  7449. SAVE_VARIABLE(waitingInAmbush, 3);
  7450. SAVE_VARIABLE(fightingInHangar, 4);
  7451. }
  7452. void Created( GameObject * obj )
  7453. {
  7454. fightingInHangar = false;
  7455. waitingInAmbush = false;
  7456. fighting_rocket_turrets = false;
  7457. Commands->Enable_Hibernation( obj, false );
  7458. objective_active = false;
  7459. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 2 );
  7460. GameObject * zone01 = Commands->Find_Object ( 105011 );
  7461. GameObject * zone02 = Commands->Find_Object ( 105012 );
  7462. GameObject * zone03 = Commands->Find_Object ( 105081 );
  7463. GameObject * zone04 = Commands->Find_Object ( 105082 );
  7464. GameObject * zone05 = Commands->Find_Object ( 105083 );
  7465. GameObject * zone06 = Commands->Find_Object ( 105084 );
  7466. GameObject * zone07 = Commands->Find_Object ( 105085 );
  7467. if (zone01 != NULL)
  7468. {
  7469. Commands->Send_Custom_Event( obj, zone01, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7470. }
  7471. if (zone02 != NULL)
  7472. {
  7473. Commands->Send_Custom_Event( obj, zone02, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7474. }
  7475. if (zone03 != NULL)
  7476. {
  7477. Commands->Send_Custom_Event( obj, zone03, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7478. }
  7479. if (zone04 != NULL)
  7480. {
  7481. Commands->Send_Custom_Event( obj, zone04, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7482. }
  7483. if (zone05 != NULL)
  7484. {
  7485. Commands->Send_Custom_Event( obj, zone05, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7486. }
  7487. if (zone06 != NULL)
  7488. {
  7489. Commands->Send_Custom_Event( obj, zone06, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7490. }
  7491. if (zone07 != NULL)
  7492. {
  7493. Commands->Send_Custom_Event( obj, zone07, 0, M01_CHOPPER_IS_SENDING_ID_JDG, 0 );
  7494. }
  7495. }
  7496. void Killed( GameObject * obj, GameObject * killer )
  7497. {
  7498. Vector3 spawnSpot_01;
  7499. Vector3 spawnSpot_02;
  7500. Vector3 spawnSpot_03;
  7501. Vector3 spawnSpot_04;
  7502. Vector3 spawnSpot_05;
  7503. Vector3 spawnSpot_06;
  7504. if (objective_active == true)
  7505. {
  7506. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 560, 0 );
  7507. }
  7508. if (fighting_rocket_turrets == true)
  7509. {
  7510. spawnSpot_01.Set (8.677f, -50.970f, 2.954f);
  7511. spawnSpot_02.Set (4.673f, -51.027f, 2.954f);
  7512. spawnSpot_03.Set (1.000f, -51.069f, 3.004f);
  7513. //spawnSpot_04.Set (-2.019f, -51.078f, 3.104f);
  7514. spawnSpot_05.Set (-4.850f, -51.075f, 3.104f);
  7515. spawnSpot_06.Set (-7.130f, -51.057f, 3.204f);
  7516. }
  7517. else
  7518. {
  7519. spawnSpot_01.Set (4.535f, 92.136f, 3.001f);
  7520. spawnSpot_02.Set (1.191f, 92.178f, 3.001f);
  7521. spawnSpot_03.Set (-1.902f, 92.156f, 3.001f);
  7522. //spawnSpot_04.Set (3.983f, 94.662f, 3.001f);
  7523. spawnSpot_05.Set (1.366f, 94.766f, 3.001f);
  7524. spawnSpot_06.Set (-1.817f, 94.600f, 3.001f);
  7525. }
  7526. Commands->Create_Object ( "POW_RocketLauncher_Player", spawnSpot_01 );
  7527. Commands->Create_Object ( "POW_GrenadeLauncher_Player", spawnSpot_02 );
  7528. Commands->Create_Object ( "POW_ChemSprayer_Player", spawnSpot_03 );
  7529. //Commands->Create_Object ( "POW_Shotgun_Player", spawnSpot_04 );
  7530. Commands->Create_Object ( "POW_AutoRifle_Player", spawnSpot_05 );
  7531. Commands->Create_Object ( "POW_Chaingun_Player", spawnSpot_06 );
  7532. }
  7533. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7534. {
  7535. ActionParamsStruct params;
  7536. if (param == M01_MODIFY_YOUR_ACTION_JDG)//recieved custom from controller--take off and attack player
  7537. {
  7538. objective_active = true;
  7539. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 460, 0 );
  7540. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_01_JDG);
  7541. params.Set_Movement(Vector3 (0,0,0), 1.0f, 0.25f);
  7542. params.WaypathID = 101264;
  7543. params.WaypointStartID = 101265;
  7544. params.WaypointEndID = 101266;
  7545. Commands->Action_Goto(obj, params);
  7546. }
  7547. else if (param == M01_MODIFY_YOUR_ACTION_02_JDG)//now please leave the hanger
  7548. {
  7549. Commands->Disable_Physical_Collisions ( obj );
  7550. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_02_JDG);
  7551. params.Set_Movement(Vector3 (0,0,0), 1.0f, 0.25f);
  7552. params.WaypathSplined = false;
  7553. params.WaypathID = 200611;
  7554. params.WaypointStartID = 200612;
  7555. params.WaypointEndID = 101324;
  7556. Commands->Action_Goto(obj, params);
  7557. }
  7558. else if (param == M01_MODIFY_YOUR_ACTION_03_JDG)//now please cirlce the ship
  7559. {
  7560. Commands->Enable_Collisions ( obj );
  7561. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_03_JDG);
  7562. params.Set_Attack( STAR, 1000, 0, true );
  7563. params.Set_Movement(Vector3 (0,0,0), 1.0f, 0.25f);
  7564. params.WaypathID = 101267;
  7565. params.WaypointStartID = 101268;
  7566. Commands->Modify_Action ( obj, M01_WALKING_WAYPATH_03_JDG, params, false, true );
  7567. }
  7568. else if (param == M01_MODIFY_YOUR_ACTION_04_JDG)//player is in tailun 02--go fight him
  7569. {
  7570. fighting_rocket_turrets = true;
  7571. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_03_JDG);
  7572. params.Set_Attack( STAR, 1000, 0, true );
  7573. params.Set_Movement(Vector3 (-50.839f, -58.626f, 6.053f), 1.0f, 5);
  7574. Commands->Action_Attack (obj, params);
  7575. }
  7576. else if (param == M01_MODIFY_YOUR_ACTION_05_JDG)//player is in tailun 01--go fight him
  7577. {
  7578. fighting_rocket_turrets = true;
  7579. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_03_JDG);
  7580. params.Set_Attack( STAR, 1000, 0, true );
  7581. params.Set_Movement(Vector3 (50.153f, -59.665f, 1.7f), 1.0f, 5);
  7582. Commands->Action_Attack (obj, params);
  7583. }
  7584. else if (param == M01_MODIFY_YOUR_ACTION_06_JDG)//player is in blackhand area--go wait at hangar
  7585. {
  7586. Commands->Debug_Message ( "***************************apache has received custom to go back to hangar\n" );
  7587. waitingInAmbush = true;
  7588. Commands->Action_Reset ( obj, 100 );
  7589. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_04_JDG);//going to above hangar
  7590. params.Set_Movement(Vector3 (2.310f, 50.897f, 56.500f), 1.0f, 5);
  7591. params.MovePathfind = false;
  7592. Commands->Action_Goto (obj, params);
  7593. }
  7594. else if (param == M01_MODIFY_YOUR_ACTION_07_JDG && waitingInAmbush == true && fightingInHangar == false)//player is on top floor hangar--spring the trap
  7595. {
  7596. Commands->Debug_Message ( "***************************apache has received custom that player is on top floor hangar\n" );
  7597. waitingInAmbush = false;
  7598. fightingInHangar = true;
  7599. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_05_JDG);
  7600. params.Set_Attack( STAR, 1000, 0, true );
  7601. params.MovePathfind = false;
  7602. params.Set_Movement(Vector3 (1.971f, 49.491f, 1.618f), 1.0f, 5);
  7603. Commands->Action_Attack (obj, params);
  7604. }
  7605. else if (param == M01_MODIFY_YOUR_ACTION_08_JDG && waitingInAmbush == true && fightingInHangar == false)//player is on middle floor hangar--spring the trap
  7606. {
  7607. Commands->Debug_Message ( "***************************apache has received custom that player is on middle floor hangar\n" );
  7608. waitingInAmbush = false;
  7609. fightingInHangar = true;
  7610. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_05_JDG);
  7611. params.Set_Attack( STAR, 1000, 0, true );
  7612. params.MovePathfind = false;
  7613. params.Set_Movement(Vector3 (1.971f, 49.491f, -7.482f), 1.0f, 5);
  7614. Commands->Action_Attack (obj, params);
  7615. }
  7616. else if (param == M01_MODIFY_YOUR_ACTION_09_JDG && waitingInAmbush == true && fightingInHangar == false)//player is on bottom floor hangar--spring the trap
  7617. {
  7618. Commands->Debug_Message ( "***************************apache has received custom that player is on bottom floor hangar\n" );
  7619. waitingInAmbush = false;
  7620. fightingInHangar = true;
  7621. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_05_JDG);
  7622. params.Set_Attack( STAR, 1000, 0, true );
  7623. params.MovePathfind = false;
  7624. params.Set_Movement(Vector3 (1.971f, 49.491f, -11.432f), 1.0f, 5);
  7625. Commands->Action_Attack (obj, params);
  7626. }
  7627. }
  7628. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  7629. {
  7630. ActionParamsStruct params;
  7631. if (action_id == M01_WALKING_WAYPATH_01_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  7632. {
  7633. params.Set_Basic(this, 100, M01_START_ATTACKING_01_JDG);
  7634. params.Set_Attack( STAR, 1000, 0, true );
  7635. Commands->Action_Attack(obj, params);
  7636. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_02_JDG, 3 );
  7637. }
  7638. else if (action_id == M01_WALKING_WAYPATH_02_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  7639. {
  7640. params.Set_Basic(this, 100, M01_WALKING_WAYPATH_03_JDG);
  7641. params.Set_Movement(Vector3 (0,0,0), 1.0f, 0.25f);
  7642. params.WaypathID = 101267;
  7643. params.WaypointStartID = 101268;
  7644. params.AttackActive = false;
  7645. Commands->Action_Attack(obj, params);
  7646. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_03_JDG, 0 );
  7647. }
  7648. else if (action_id == M01_WALKING_WAYPATH_04_JDG && complete_reason == ACTION_COMPLETE_NORMAL)
  7649. { //you are now waiting above the hangar
  7650. Commands->Debug_Message ( "***************************apache should now be waiting over hangar\n" );
  7651. GameObject * zone01 = Commands->Find_Object ( 105011 );//these are the enter zones for going back through the apache hangar
  7652. GameObject * zone02 = Commands->Find_Object ( 105012 );
  7653. GameObject * zone03 = Commands->Find_Object ( 105081 );
  7654. GameObject * zone04 = Commands->Find_Object ( 105082 );
  7655. GameObject * zone05 = Commands->Find_Object ( 105083 );
  7656. GameObject * zone06 = Commands->Find_Object ( 105084 );
  7657. if (zone01 != NULL)
  7658. {
  7659. Commands->Send_Custom_Event( obj, zone01, 0, M01_START_ACTING_JDG, 0 );
  7660. }
  7661. if (zone02 != NULL)
  7662. {
  7663. Commands->Send_Custom_Event( obj, zone02, 0, M01_START_ACTING_JDG, 0 );
  7664. }
  7665. if (zone03 != NULL)
  7666. {
  7667. Commands->Send_Custom_Event( obj, zone03, 0, M01_START_ACTING_JDG, 0 );
  7668. }
  7669. if (zone04 != NULL)
  7670. {
  7671. Commands->Send_Custom_Event( obj, zone04, 0, M01_START_ACTING_JDG, 0 );
  7672. }
  7673. if (zone05 != NULL)
  7674. {
  7675. Commands->Send_Custom_Event( obj, zone05, 0, M01_START_ACTING_JDG, 0 );
  7676. }
  7677. if (zone06 != NULL)
  7678. {
  7679. Commands->Send_Custom_Event( obj, zone06, 0, M01_START_ACTING_JDG, 0 );
  7680. }
  7681. }
  7682. }
  7683. };
  7684. DECLARE_SCRIPT(M04_CargoHold_Stationary_Officer_JDG, "")
  7685. {
  7686. void Created( GameObject * obj )
  7687. {
  7688. Commands->Set_Innate_Is_Stationary ( obj, true );
  7689. }
  7690. };
  7691. DECLARE_SCRIPT(M04_Firefight_Prisoner, "")
  7692. {
  7693. float last_health;
  7694. bool rallying;
  7695. bool pokable;
  7696. bool warningPlayed;
  7697. REGISTER_VARIABLES()
  7698. {
  7699. SAVE_VARIABLE(last_health, 1);
  7700. SAVE_VARIABLE(rallying, 2);
  7701. SAVE_VARIABLE(pokable, 3);
  7702. SAVE_VARIABLE(warningPlayed, 3);
  7703. }
  7704. void Created( GameObject * obj )
  7705. {
  7706. warningPlayed = false;
  7707. pokable = false;
  7708. rallying = false;
  7709. Vector3 home_spot = Commands->Get_Position ( obj);
  7710. Commands->Set_Innate_Soldier_Home_Location ( obj, home_spot, 2.0f );
  7711. last_health = Commands->Get_Health ( obj );
  7712. }
  7713. void Damaged( GameObject * obj, GameObject * damager, float amount )
  7714. {
  7715. float myCurrentHealth = Commands->Get_Health ( obj );
  7716. float myMaxHealth = Commands->Get_Max_Health ( obj );
  7717. if (((myCurrentHealth/myMaxHealth) * 100 ) <= 50)
  7718. {
  7719. if (warningPlayed == false)
  7720. {
  7721. Commands->Set_HUD_Help_Text ( IDS_M04DSGN_DSGN0204I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  7722. warningPlayed = true;
  7723. int medlabConversation = Commands->Create_Conversation( "M04_POW_Health_Warning_Conversation", 100, 50, false);
  7724. Commands->Join_Conversation( NULL, medlabConversation, false, true );
  7725. //Commands->Join_Conversation( medTech, medlabConversation, false, true );
  7726. Commands->Start_Conversation( medlabConversation, medlabConversation );
  7727. }
  7728. }
  7729. if (damager == STAR)
  7730. {
  7731. Commands->Set_Health ( obj, last_health );
  7732. }
  7733. else if (obj)
  7734. {
  7735. last_health = Commands->Get_Health ( obj );
  7736. }
  7737. }
  7738. void Poked( GameObject * obj, GameObject * poker )
  7739. {
  7740. if (rallying == false && pokable == true)
  7741. {
  7742. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  7743. int medlabConversation = Commands->Create_Conversation( "M04_Firefight_POW_Poke_Conversation", 100, 50, false);
  7744. Commands->Join_Conversation( STAR, medlabConversation, false, true );
  7745. //Commands->Join_Conversation( medTech, medlabConversation, false, true );
  7746. Commands->Start_Conversation( medlabConversation, medlabConversation );
  7747. Commands->Send_Custom_Event( obj, obj, 0, 667, 2 );
  7748. }
  7749. }
  7750. void Killed( GameObject * obj, GameObject * killer )
  7751. {
  7752. Commands->Set_HUD_Help_Text ( IDS_M04DSGN_DSGN0205I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  7753. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_END_FIREFIGHT_CONTROLLER_JDG), 0, 10, 0 );//tell controller you've been killed
  7754. }
  7755. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7756. {
  7757. if (type == 0)
  7758. {
  7759. if (param == 1)//you are prisoner #3--you are now pokable
  7760. {
  7761. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  7762. pokable = true;
  7763. }
  7764. else if (param == 666)//everybody rally in front of the sub
  7765. {
  7766. rallying = true;
  7767. ActionParamsStruct params;
  7768. Vector3 rally_spot (-8.57f,-0.72f,-9.00f);
  7769. params.Set_Basic(this, 50, 100);
  7770. params.Set_Movement(rally_spot, 0.75f, 1.0f);
  7771. Commands->Action_Goto (obj, params);
  7772. Commands->Set_Innate_Soldier_Home_Location ( obj, rally_spot, 1.0f );
  7773. Commands->Send_Custom_Event( obj, obj, 0, 666, 1 );
  7774. }
  7775. else if (param == 667)//everybody rally in front of the sub
  7776. {
  7777. rallying = true;
  7778. ActionParamsStruct params;
  7779. Vector3 rally_spot (-8.57f,-0.72f,-9.00f);
  7780. params.Set_Basic(this, 100, 100);
  7781. params.Set_Movement(rally_spot, RUN, 1.0f);
  7782. Commands->Action_Goto (obj, params);
  7783. Commands->Set_Innate_Soldier_Home_Location ( obj, rally_spot, 1.0f );
  7784. Commands->Send_Custom_Event( obj, obj, 0, 666, 1 );
  7785. }
  7786. }
  7787. }
  7788. };
  7789. DECLARE_SCRIPT(M04_Firefight_Controller_JDG, "")//this guys ID number is M04_END_FIREFIGHT_CONTROLLER_JDG 100948
  7790. {
  7791. int spawned_nod_guys;
  7792. int prisonerOne_ID;
  7793. int prisonerTwo_ID;
  7794. int prisonerThree_ID;
  7795. int missionIntroConv;
  7796. bool prisoners_rescued;
  7797. bool missionIntroConv_playing;
  7798. REGISTER_VARIABLES()
  7799. {
  7800. SAVE_VARIABLE(spawned_nod_guys, 1);
  7801. SAVE_VARIABLE(prisonerOne_ID, 2);
  7802. SAVE_VARIABLE(prisonerTwo_ID, 3);
  7803. SAVE_VARIABLE(prisonerThree_ID, 4);
  7804. SAVE_VARIABLE(prisoners_rescued, 5);
  7805. SAVE_VARIABLE(missionIntroConv, 6);
  7806. SAVE_VARIABLE(missionIntroConv_playing, 7);
  7807. }
  7808. void Created( GameObject * obj )
  7809. {
  7810. spawned_nod_guys = 0;
  7811. prisoners_rescued = false;
  7812. missionIntroConv_playing = false;
  7813. }
  7814. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  7815. {
  7816. switch (complete_reason)
  7817. {
  7818. case ACTION_COMPLETE_CONVERSATION_ENDED: //
  7819. {
  7820. if (action_id == missionIntroConv) //rescue prisoners here
  7821. {
  7822. missionIntroConv_playing = false;
  7823. }
  7824. }
  7825. break;
  7826. }
  7827. }
  7828. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  7829. {
  7830. if (param == 1)//player has freed prisoners--give clearance for end firefight
  7831. {
  7832. prisoners_rescued = true;
  7833. }
  7834. else if (param == 10)//one of the prisoners has been killed...give lose message
  7835. {
  7836. Commands->Create_Sound ( "00-n100e", Commands->Get_Position ( obj ), obj );//your mission is a failure
  7837. Commands->Send_Custom_Event( obj, obj, 0, 11, 3 );//send custom to fail mission
  7838. }
  7839. else if (param == 11)//a prisoner has been killed, fail the mission
  7840. {
  7841. Commands->Mission_Complete ( false );
  7842. }
  7843. else if (param == 20)//tell POWs to gather at sub
  7844. {
  7845. GameObject *prisonerOne = Commands->Find_Object (prisonerOne_ID);
  7846. if (prisonerOne != NULL)
  7847. {
  7848. Commands->Send_Custom_Event( obj, prisonerOne, 0, 666, 0 );
  7849. }
  7850. GameObject *prisonerTwo = Commands->Find_Object (prisonerTwo_ID);
  7851. if (prisonerTwo != NULL)
  7852. {
  7853. Commands->Send_Custom_Event( obj, prisonerTwo, 0, 666, 0 );
  7854. }
  7855. GameObject *prisonerThree = Commands->Find_Object (prisonerThree_ID);
  7856. if (prisonerThree != NULL)
  7857. {
  7858. Commands->Send_Custom_Event( obj, prisonerThree, 0, 666, 0 );//
  7859. }
  7860. int medlabConversation = Commands->Create_Conversation( "M04_Rally_Round_The_Sub_Boy_Conversation", 100, 50, false);
  7861. Commands->Join_Conversation( NULL, medlabConversation, false, true );
  7862. //Commands->Join_Conversation( medTech, medlabConversation, false, true );
  7863. Commands->Start_Conversation( medlabConversation, medlabConversation );
  7864. }
  7865. else if (param == 100 )//player has picked up the level 3 key card...place actors and give alert
  7866. {
  7867. if (prisoners_rescued == true)
  7868. {
  7869. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 470, 0 );
  7870. GameObject * zone01 = Commands->Find_Object (101126);//stays
  7871. if (zone01 != NULL)
  7872. {
  7873. Commands->Destroy_Object ( zone01 );
  7874. }
  7875. GameObject * zone04 = Commands->Find_Object (101129);//stays
  7876. if (zone04 != NULL)
  7877. {
  7878. Commands->Destroy_Object ( zone04 );
  7879. }
  7880. GameObject * zone06 = Commands->Find_Object (101131);//stays
  7881. if (zone06 != NULL)
  7882. {
  7883. Commands->Destroy_Object ( zone06 );
  7884. }
  7885. GameObject * zone10 = Commands->Find_Object (101135);//stays
  7886. if (zone10 != NULL)
  7887. {
  7888. Commands->Destroy_Object ( zone10 );
  7889. }
  7890. GameObject * zone12 = Commands->Find_Object (101137);//stays
  7891. if (zone12 != NULL)
  7892. {
  7893. Commands->Destroy_Object ( zone12 );
  7894. }
  7895. int currentDifficulty = Commands->Get_Difficulty_Level( );
  7896. int medium = 1;
  7897. int hard = 2;
  7898. float delayTimer;
  7899. if (currentDifficulty == hard)
  7900. {
  7901. delayTimer = 90;
  7902. //put down the 3 prisoners in their siege spots
  7903. GameObject *prisonerOne = Commands->Create_Object ( "GDI_Prisoner_v0b", Vector3(-8.58f, 0.06f,-9.0f));
  7904. Commands->Attach_Script(prisonerOne, "M04_Firefight_Prisoner", "");
  7905. GameObject *prisonerTwo = Commands->Create_Object ( "GDI_Prisoner_v1b", Vector3(-14.70f, -9.84f,-9.0f));
  7906. Commands->Attach_Script(prisonerTwo, "M04_Firefight_Prisoner", "");
  7907. GameObject *prisonerThree = Commands->Create_Object ( "GDI_Prisoner_v2b", Vector3(8.99f, -1.80f,-9.0f));
  7908. Commands->Attach_Script(prisonerThree, "M04_Firefight_Prisoner", "");
  7909. Commands->Send_Custom_Event( obj, prisonerThree, 0, 1, 0 );//tell this guy he is pokable
  7910. prisonerOne_ID = Commands->Get_ID ( prisonerOne );
  7911. prisonerTwo_ID = Commands->Get_ID ( prisonerTwo );
  7912. prisonerThree_ID = Commands->Get_ID ( prisonerThree );
  7913. }
  7914. else if (currentDifficulty == medium)
  7915. {
  7916. delayTimer = 45;
  7917. //put down the 3 prisoners in their siege spots
  7918. GameObject *prisonerOne = Commands->Create_Object ( "GDI_Prisoner_v0b", Vector3(-8.58f, 0.06f,-9.0f));
  7919. Commands->Attach_Script(prisonerOne, "M04_Firefight_Prisoner", "");
  7920. GameObject *prisonerTwo = Commands->Create_Object ( "GDI_Prisoner_v1b", Vector3(-14.70f, -9.84f,-9.0f));
  7921. Commands->Attach_Script(prisonerTwo, "M04_Firefight_Prisoner", "");
  7922. GameObject *prisonerThree = Commands->Create_Object ( "GDI_Prisoner_v2b", Vector3(8.99f, -1.80f,-9.0f));
  7923. Commands->Attach_Script(prisonerThree, "M04_Firefight_Prisoner", "");
  7924. Commands->Send_Custom_Event( obj, prisonerThree, 0, 1, 0 );//tell this guy he is pokable
  7925. prisonerOne_ID = Commands->Get_ID ( prisonerOne );
  7926. prisonerTwo_ID = Commands->Get_ID ( prisonerTwo );
  7927. prisonerThree_ID = Commands->Get_ID ( prisonerThree );
  7928. }
  7929. else
  7930. {
  7931. delayTimer = 5;
  7932. //put down the 3 prisoners in their siege spots
  7933. GameObject *prisonerOne = Commands->Create_Object ( "GDI_Prisoner_v0b", Vector3(-8.58f, 0.06f,-9.0f));
  7934. Commands->Attach_Script(prisonerOne, "M04_Firefight_Prisoner", "");
  7935. GameObject *prisonerTwo = Commands->Create_Object ( "GDI_Prisoner_v1b", Vector3(-14.70f, -9.84f,-9.0f));
  7936. Commands->Attach_Script(prisonerTwo, "M04_Firefight_Prisoner", "");
  7937. GameObject *prisonerThree = Commands->Create_Object ( "GDI_Prisoner_v2b", Vector3(-12.061f, -7.909f,-9.0f));
  7938. Commands->Attach_Script(prisonerThree, "M04_Firefight_Prisoner", "");
  7939. prisonerOne_ID = Commands->Get_ID ( prisonerOne );
  7940. prisonerTwo_ID = Commands->Get_ID ( prisonerTwo );
  7941. prisonerThree_ID = Commands->Get_ID ( prisonerThree );
  7942. }
  7943. Commands->Send_Custom_Event( obj, obj, 0, 20, delayTimer );//tell prisoners to gather at sub
  7944. Commands->Send_Custom_Event( obj, obj, 0, 110, 1 );//give verbal alert
  7945. //the following 3 customs tell the end-mission zone what the prisoner's ID numbers are
  7946. GameObject * rallyZone = Commands->Find_Object (101194);
  7947. if (rallyZone != NULL)
  7948. {
  7949. Commands->Send_Custom_Event( obj, rallyZone, 1, prisonerOne_ID, 0 );
  7950. Commands->Send_Custom_Event( obj, rallyZone, 2, prisonerTwo_ID, 0 );
  7951. Commands->Send_Custom_Event( obj, rallyZone, 3, prisonerThree_ID, 0 );
  7952. Commands->Send_Custom_Event( obj, rallyZone, 0, M01_START_ACTING_JDG, 0 );
  7953. }
  7954. else
  7955. {
  7956. Commands->Debug_Message ( "***************************firefight controller cannot find rally zone\n" );
  7957. }
  7958. //trigger the first three spawners
  7959. GameObject * nodGuy01 = Commands->Trigger_Spawner( 100938 );
  7960. Commands->Attach_Script(nodGuy01, "M04_Firefight_NodGuys", "");
  7961. Commands->Grant_Key( nodGuy01, 2, true );
  7962. Commands->Grant_Key( nodGuy01, 3, true );
  7963. GameObject * nodGuy02 = Commands->Trigger_Spawner( 100952 );
  7964. Commands->Attach_Script(nodGuy02, "M04_Firefight_NodGuys", "");
  7965. Commands->Grant_Key( nodGuy02, 2, true );
  7966. Commands->Grant_Key( nodGuy02, 3, true );
  7967. GameObject * nodGuy03 = Commands->Trigger_Spawner( 100951 );
  7968. Commands->Attach_Script(nodGuy03, "M04_Firefight_NodGuys", "");
  7969. Commands->Grant_Key( nodGuy03, 2, true );
  7970. Commands->Grant_Key( nodGuy03, 3, true );
  7971. spawned_nod_guys = 3;
  7972. }
  7973. else if (missionIntroConv_playing == false)//remind player to go rescue the prisoners
  7974. {
  7975. missionIntroConv_playing = true;
  7976. missionIntroConv = Commands->Create_Conversation( "M04_Mission_Start_Conversation", 100, 1000, false);
  7977. Commands->Join_Conversation( NULL, missionIntroConv, false, false );
  7978. ///Commands->Join_Conversation( STAR, missionIntroConv, false, false );
  7979. Commands->Start_Conversation( missionIntroConv, missionIntroConv );
  7980. Commands->Monitor_Conversation (obj, missionIntroConv);
  7981. }
  7982. }
  7983. else if (param == 110)//announce that our ally is under attack
  7984. {
  7985. //Commands->Create_Sound ( "00-d404e", Commands->Get_Position ( obj ), obj );//updating radar flags..temp placeholder
  7986. }
  7987. else if (param == 666)//a nod attacker has been killed
  7988. {
  7989. float doko_ni_reinforceka = Commands->Get_Random ( 0.5f, 3.5f );
  7990. if ((doko_ni_reinforceka >= 0.5) && (doko_ni_reinforceka < 1.5) && (spawned_nod_guys < 15))
  7991. {
  7992. GameObject * nodGuy01 = Commands->Trigger_Spawner( 100938 );
  7993. Commands->Attach_Script(nodGuy01, "M04_Firefight_NodGuys", "");
  7994. Commands->Grant_Key( nodGuy01, 2, true );
  7995. Commands->Grant_Key( nodGuy01, 3, true );
  7996. }
  7997. else if ((doko_ni_reinforceka >= 1.5) && (doko_ni_reinforceka < 2.5) && (spawned_nod_guys < 15))
  7998. {
  7999. GameObject * nodGuy02 = Commands->Trigger_Spawner( 100952 );
  8000. Commands->Attach_Script(nodGuy02, "M04_Firefight_NodGuys", "");
  8001. Commands->Grant_Key( nodGuy02, 2, true );
  8002. Commands->Grant_Key( nodGuy02, 3, true );
  8003. }
  8004. else if ((doko_ni_reinforceka >= 2.5) && (doko_ni_reinforceka < 3.5) && (spawned_nod_guys < 15))
  8005. {
  8006. GameObject * nodGuy03 = Commands->Trigger_Spawner( 100951 );
  8007. Commands->Attach_Script(nodGuy03, "M04_Firefight_NodGuys", "");
  8008. Commands->Grant_Key( nodGuy03, 2, true );
  8009. Commands->Grant_Key( nodGuy03, 3, true );
  8010. }
  8011. /*if (spawned_nod_guys == 8)
  8012. {
  8013. GameObject *prisonerOne = Commands->Find_Object (prisonerOne_ID);
  8014. if (prisonerOne != NULL)
  8015. {
  8016. Commands->Send_Custom_Event( obj, prisonerOne, 0, 666, 0 );
  8017. }
  8018. GameObject *prisonerTwo = Commands->Find_Object (prisonerTwo_ID);
  8019. if (prisonerTwo != NULL)
  8020. {
  8021. Commands->Send_Custom_Event( obj, prisonerTwo, 0, 666, 0 );
  8022. }
  8023. GameObject *prisonerThree = Commands->Find_Object (prisonerThree_ID);
  8024. if (prisonerThree != NULL)
  8025. {
  8026. Commands->Send_Custom_Event( obj, prisonerThree, 0, 666, 0 );
  8027. }
  8028. Commands->Create_Sound ( "00-d406e", Commands->Get_Position ( obj ), obj );
  8029. }*/
  8030. spawned_nod_guys++;
  8031. }
  8032. }
  8033. };
  8034. DECLARE_SCRIPT(M04_Firefight_RallyZone, "")//this guys ID number is 101194
  8035. {
  8036. bool ok_to_end;
  8037. int prisoner01_ID;
  8038. int prisoner02_ID;
  8039. int prisoner03_ID;
  8040. bool prisoner01_at_rallypoint;
  8041. bool prisoner02_at_rallypoint;
  8042. bool prisoner03_at_rallypoint;
  8043. bool player_at_rallypoint;
  8044. REGISTER_VARIABLES()
  8045. {
  8046. SAVE_VARIABLE(ok_to_end, 1);
  8047. SAVE_VARIABLE(prisoner01_ID, 2);
  8048. SAVE_VARIABLE(prisoner02_ID, 3);
  8049. SAVE_VARIABLE(prisoner03_ID, 4);
  8050. SAVE_VARIABLE(prisoner01_at_rallypoint, 5);
  8051. SAVE_VARIABLE(prisoner02_at_rallypoint, 6);
  8052. SAVE_VARIABLE(prisoner03_at_rallypoint, 7);
  8053. SAVE_VARIABLE(player_at_rallypoint, 8);
  8054. }
  8055. void Created( GameObject * obj )
  8056. {
  8057. ok_to_end = false;
  8058. player_at_rallypoint = false;
  8059. int currentDifficulty = Commands->Get_Difficulty_Level( );
  8060. int easy = 0;
  8061. if (currentDifficulty == easy)
  8062. {
  8063. prisoner01_at_rallypoint = true;
  8064. prisoner02_at_rallypoint = true;
  8065. prisoner03_at_rallypoint = true;
  8066. }
  8067. else
  8068. {
  8069. prisoner01_at_rallypoint = true;
  8070. prisoner02_at_rallypoint = true;
  8071. prisoner03_at_rallypoint = false;
  8072. }
  8073. }
  8074. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8075. {
  8076. if (type == 1)
  8077. {
  8078. prisoner01_ID = param;
  8079. }
  8080. else if (type == 2)
  8081. {
  8082. prisoner02_ID = param;
  8083. }
  8084. else if (type == 3)
  8085. {
  8086. prisoner03_ID = param;
  8087. }
  8088. else if (param == M01_START_ACTING_JDG)
  8089. {
  8090. ok_to_end = true;
  8091. }
  8092. }
  8093. void Entered( GameObject * obj, GameObject * enterer )
  8094. {
  8095. GameObject *prisoner01 = Commands->Find_Object ( prisoner01_ID );
  8096. GameObject *prisoner02 = Commands->Find_Object ( prisoner02_ID );
  8097. GameObject *prisoner03 = Commands->Find_Object ( prisoner03_ID );
  8098. if (enterer == STAR)
  8099. {
  8100. //if (ok_to_end == true)
  8101. //{
  8102. player_at_rallypoint = true;
  8103. //}
  8104. //else
  8105. //{
  8106. // Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, M01_DO_END_MISSION_CHECK_JDG, 0 );
  8107. //}
  8108. }
  8109. else if (enterer == prisoner01)
  8110. {
  8111. prisoner01_at_rallypoint = true;
  8112. }
  8113. else if (enterer == prisoner02)
  8114. {
  8115. prisoner02_at_rallypoint = true;
  8116. }
  8117. else if (enterer == prisoner03)
  8118. {
  8119. prisoner03_at_rallypoint = true;
  8120. }
  8121. if ((player_at_rallypoint == true) && (prisoner01_at_rallypoint == true) && (prisoner02_at_rallypoint == true) && (prisoner03_at_rallypoint == true))
  8122. {
  8123. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, M01_DO_END_MISSION_CHECK_JDG, 0 );
  8124. }
  8125. }
  8126. void Exited( GameObject * obj, GameObject * exiter )
  8127. {
  8128. GameObject *prisoner01 = Commands->Find_Object ( prisoner01_ID );
  8129. GameObject *prisoner02 = Commands->Find_Object ( prisoner01_ID );
  8130. GameObject *prisoner03 = Commands->Find_Object ( prisoner01_ID );
  8131. if (exiter == STAR)
  8132. {
  8133. player_at_rallypoint = false;
  8134. }
  8135. else if ( exiter == prisoner01)
  8136. {
  8137. prisoner01_at_rallypoint = false;
  8138. }
  8139. else if ( exiter == prisoner02)
  8140. {
  8141. prisoner02_at_rallypoint = false;
  8142. }
  8143. else if ( exiter == prisoner03)
  8144. {
  8145. prisoner03_at_rallypoint = false;
  8146. }
  8147. }
  8148. };
  8149. DECLARE_SCRIPT(M04_Mutant_UpdateDisc_JDG, "")
  8150. {
  8151. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8152. {
  8153. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  8154. {
  8155. Commands->Reveal_Encyclopedia_Character ( 27 );
  8156. Commands->Set_HUD_Help_Text ( IDS_M00EVAG_DSGN0104I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  8157. }
  8158. }
  8159. };
  8160. DECLARE_SCRIPT(M04_TorpedoRoom_Target01_JDG, "")//DSP_L4TORPEDO
  8161. {
  8162. bool poked_yet;
  8163. Vector3 myPosition;
  8164. int animationCount;
  8165. REGISTER_VARIABLES()
  8166. {
  8167. SAVE_VARIABLE( poked_yet, 1 );
  8168. SAVE_VARIABLE( myPosition, 2 );
  8169. SAVE_VARIABLE( animationCount, 3 );
  8170. }
  8171. void Created( GameObject * obj )
  8172. {
  8173. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  8174. poked_yet = false;
  8175. animationCount = 0;
  8176. myPosition = Commands->Get_Position ( obj );
  8177. Commands->Set_Animation_Frame ( obj, "DSP_L4TORPEDO.DSP_L4TORPEDO", 0 );
  8178. }
  8179. void Animation_Complete(GameObject * obj, const char *anim)
  8180. {
  8181. if (stricmp(anim, "DSP_L4TORPEDO.DSP_L4TORPEDO") == 0)
  8182. {
  8183. animationCount++;
  8184. if (animationCount >= 2)
  8185. {
  8186. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  8187. }
  8188. else
  8189. {
  8190. Commands->Set_Animation ( obj, "DSP_L4TORPEDO.DSP_L4TORPEDO", false);
  8191. }
  8192. }
  8193. }
  8194. void Poked( GameObject * obj, GameObject * poker )
  8195. {
  8196. if (poked_yet == false)
  8197. {
  8198. if (STAR != NULL)
  8199. {
  8200. Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  8201. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  8202. poked_yet = true;
  8203. Commands->Set_Animation ( obj, "DSP_L4TORPEDO.DSP_L4TORPEDO", false);
  8204. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 200, 0 );
  8205. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  8206. GameObject * pogController = Commands->Find_Object ( 104693 );
  8207. if (pogController != NULL)
  8208. {
  8209. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 400, 0 );
  8210. }
  8211. }
  8212. }
  8213. }
  8214. };
  8215. DECLARE_SCRIPT(M04_TorpedoRoom_Target02_JDG, "")//DSP_L4TORPEDOR
  8216. {
  8217. bool poked_yet;
  8218. Vector3 myPosition;
  8219. int animationCount;
  8220. REGISTER_VARIABLES()
  8221. {
  8222. SAVE_VARIABLE( poked_yet, 1 );
  8223. SAVE_VARIABLE( myPosition, 2 );
  8224. SAVE_VARIABLE( animationCount, 3 );
  8225. }
  8226. void Created( GameObject * obj )
  8227. {
  8228. Commands->Enable_HUD_Pokable_Indicator ( obj, true );
  8229. poked_yet = false;
  8230. animationCount = 0;
  8231. myPosition = Commands->Get_Position ( obj );
  8232. Commands->Set_Animation_Frame ( obj, "DSP_L4TORPEDOR.DSP_L4TORPEDOR", 0 );
  8233. }
  8234. void Animation_Complete(GameObject * obj, const char *anim)
  8235. {
  8236. if (stricmp(anim, "DSP_L4TORPEDOR.DSP_L4TORPEDOR") == 0)
  8237. {
  8238. animationCount++;
  8239. if (animationCount >= 2)
  8240. {
  8241. Commands->Create_Sound ("SFX.Electric_Fire_02", myPosition, obj );
  8242. }
  8243. else
  8244. {
  8245. Commands->Set_Animation ( obj, "DSP_L4TORPEDOR.DSP_L4TORPEDOR", false);
  8246. }
  8247. }
  8248. }
  8249. void Poked( GameObject * obj, GameObject * poker )
  8250. {
  8251. if (poked_yet == false)
  8252. {
  8253. if (STAR != NULL)
  8254. {
  8255. Commands->Create_Sound ("SFX.L04_Sabotage", myPosition, obj );
  8256. Commands->Enable_HUD_Pokable_Indicator ( obj, false );
  8257. poked_yet = true;
  8258. Commands->Set_Animation ( obj, "DSP_L4TORPEDOR.DSP_L4TORPEDOR", false);
  8259. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 210, 0 );
  8260. Commands->Send_Custom_Event( obj, obj, 0, M01_MODIFY_YOUR_ACTION_JDG, 0 );
  8261. GameObject * pogController = Commands->Find_Object ( 104693 );
  8262. if (pogController != NULL)
  8263. {
  8264. Commands->Send_Custom_Event( obj, pogController, M01_CHANGE_OBJECTIVE_POG_JDG, 400, 0 );
  8265. }
  8266. }
  8267. }
  8268. }
  8269. };
  8270. DECLARE_SCRIPT(M04_Pog_Controller_JDG, "")//104693
  8271. {
  8272. bool missile_target01_poked;
  8273. bool missile_target02_poked;
  8274. bool missile_target03_poked;
  8275. bool missile_target04_poked;
  8276. bool missile_target01_active;
  8277. bool missile_target02_active;
  8278. bool missile_target03_active;
  8279. bool missile_target04_active;
  8280. bool engineroom_target01_active;
  8281. bool engineroom_target02_active;
  8282. bool engineroom_target03_active;
  8283. bool engineroom_target04_active;
  8284. bool torpedo_target01_active;
  8285. bool torpedo_target02_active;
  8286. bool torpedo_target01_poked;
  8287. bool torpedo_target02_poked;
  8288. REGISTER_VARIABLES()
  8289. {
  8290. SAVE_VARIABLE( missile_target01_poked, 1 );
  8291. SAVE_VARIABLE( missile_target02_poked, 2 );
  8292. SAVE_VARIABLE( missile_target03_poked, 3 );
  8293. SAVE_VARIABLE( missile_target04_poked, 4 );
  8294. SAVE_VARIABLE( missile_target01_active, 5 );
  8295. SAVE_VARIABLE( missile_target02_active, 6 );
  8296. SAVE_VARIABLE( missile_target03_active, 7 );
  8297. SAVE_VARIABLE( missile_target04_active, 8 );
  8298. SAVE_VARIABLE( engineroom_target01_active, 9 );
  8299. SAVE_VARIABLE( engineroom_target02_active, 10 );
  8300. SAVE_VARIABLE( engineroom_target03_active, 11 );
  8301. SAVE_VARIABLE( engineroom_target04_active, 12 );
  8302. SAVE_VARIABLE( torpedo_target01_active, 13 );
  8303. SAVE_VARIABLE( torpedo_target02_active, 14 );
  8304. SAVE_VARIABLE( torpedo_target01_poked, 15 );
  8305. SAVE_VARIABLE( torpedo_target02_poked, 16 );
  8306. }
  8307. void Created( GameObject * obj )
  8308. {
  8309. missile_target01_poked = false;
  8310. missile_target02_poked = false;
  8311. missile_target03_poked = false;
  8312. missile_target04_poked = false;
  8313. missile_target01_active = false;
  8314. missile_target02_active = false;
  8315. missile_target03_active = false;
  8316. missile_target04_active = false;
  8317. engineroom_target01_active = false;
  8318. engineroom_target02_active = false;
  8319. engineroom_target03_active = false;
  8320. engineroom_target04_active = false;
  8321. torpedo_target01_active = false;
  8322. torpedo_target02_active = false;
  8323. torpedo_target01_poked = false;
  8324. torpedo_target02_poked = false;
  8325. }
  8326. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8327. {
  8328. if (type == M01_ADD_OBJECTIVE_POG_JDG)
  8329. {
  8330. if (param == 200)//add first pog for engine room
  8331. {
  8332. GameObject * engineroom_target01 = Commands->Find_Object ( 100419 );
  8333. GameObject * engineroom_target02 = Commands->Find_Object ( 100416 );
  8334. GameObject * engineroom_target03 = Commands->Find_Object ( 100418 );
  8335. GameObject * engineroom_target04 = Commands->Find_Object ( 100417 );
  8336. if (engineroom_target01 != NULL)
  8337. {
  8338. engineroom_target01_active = true;
  8339. Vector3 pogLocation = Commands->Get_Position ( engineroom_target01 );
  8340. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8341. }
  8342. else if (engineroom_target02 != NULL)
  8343. {
  8344. engineroom_target02_active = true;
  8345. Vector3 pogLocation = Commands->Get_Position ( engineroom_target02 );
  8346. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8347. }
  8348. else if (engineroom_target03 != NULL)
  8349. {
  8350. engineroom_target03_active = true;
  8351. Vector3 pogLocation = Commands->Get_Position ( engineroom_target03 );
  8352. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8353. }
  8354. else if (engineroom_target04 != NULL)
  8355. {
  8356. engineroom_target04_active = true;
  8357. Vector3 pogLocation = Commands->Get_Position ( engineroom_target04 );
  8358. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8359. }
  8360. }
  8361. else if (param == 300)//add first pog for missile room
  8362. {
  8363. if (missile_target01_poked == false)
  8364. {
  8365. GameObject * missile_target01 = Commands->Find_Object ( 100421 );
  8366. if (missile_target01 != NULL)
  8367. {
  8368. missile_target01_active = true;
  8369. Vector3 pogLocation = Commands->Get_Position ( missile_target01 );
  8370. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8371. }
  8372. }
  8373. else if (missile_target02_poked == false)
  8374. {
  8375. GameObject * missile_target02 = Commands->Find_Object ( 100422 );
  8376. if (missile_target02 != NULL)
  8377. {
  8378. missile_target02_active = true;
  8379. Vector3 pogLocation = Commands->Get_Position ( missile_target02 );
  8380. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8381. }
  8382. }
  8383. else if (missile_target03_poked == false)
  8384. {
  8385. GameObject * missile_target03 = Commands->Find_Object ( 100423 );
  8386. if (missile_target03 != NULL)
  8387. {
  8388. missile_target03_active = true;
  8389. Vector3 pogLocation = Commands->Get_Position ( missile_target03 );
  8390. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8391. }
  8392. }
  8393. else if (missile_target04_poked == false)
  8394. {
  8395. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  8396. if (missile_target04 != NULL)
  8397. {
  8398. missile_target04_active = true;
  8399. Vector3 pogLocation = Commands->Get_Position ( missile_target04 );
  8400. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8401. }
  8402. }
  8403. }
  8404. else if (param == 400)//add first pog for torpedo room
  8405. {
  8406. GameObject * torpedo_target01 = Commands->Find_Object ( 100410 );
  8407. if (torpedo_target01 != NULL)
  8408. {
  8409. torpedo_target01_active = true;
  8410. Vector3 pogLocation = Commands->Get_Position ( torpedo_target01 );
  8411. Commands->Set_Objective_HUD_Info_Position( 400, 91, "POG_M04_1_04.tga", IDS_POG_SABOTAGE, pogLocation );
  8412. }
  8413. }
  8414. }
  8415. else if (type == M01_CHANGE_OBJECTIVE_POG_JDG)
  8416. {
  8417. if (param == 200)//an engineroom target has been destroyed--change pog over
  8418. {
  8419. GameObject * engineroom_target01 = Commands->Find_Object ( 100419 );
  8420. GameObject * engineroom_target02 = Commands->Find_Object ( 100416 );
  8421. GameObject * engineroom_target03 = Commands->Find_Object ( 100418 );
  8422. GameObject * engineroom_target04 = Commands->Find_Object ( 100417 );
  8423. if (sender == engineroom_target01)
  8424. {
  8425. if (engineroom_target01_active == true)
  8426. {
  8427. engineroom_target01_active = false;
  8428. Commands->Set_Objective_HUD_Info( 200, -1, "POG_M04_2_01.tga", IDS_POG_DESTROY );
  8429. if (engineroom_target02 != NULL)
  8430. {
  8431. engineroom_target02_active = true;
  8432. Vector3 pogLocation = Commands->Get_Position ( engineroom_target02 );
  8433. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8434. }
  8435. else if (engineroom_target03 != NULL)
  8436. {
  8437. engineroom_target03_active = true;
  8438. Vector3 pogLocation = Commands->Get_Position ( engineroom_target03 );
  8439. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8440. }
  8441. else if (engineroom_target04 != NULL)
  8442. {
  8443. engineroom_target04_active = true;
  8444. Vector3 pogLocation = Commands->Get_Position ( engineroom_target04 );
  8445. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8446. }
  8447. }
  8448. }
  8449. else if (sender == engineroom_target02)
  8450. {
  8451. if (engineroom_target02_active == true)
  8452. {
  8453. engineroom_target02_active = false;
  8454. Commands->Set_Objective_HUD_Info( 200, -1, "POG_M04_2_01.tga", IDS_POG_DESTROY );
  8455. if (engineroom_target03 != NULL)
  8456. {
  8457. engineroom_target03_active = true;
  8458. Vector3 pogLocation = Commands->Get_Position ( engineroom_target03 );
  8459. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8460. }
  8461. else if (engineroom_target04 != NULL)
  8462. {
  8463. engineroom_target04_active = true;
  8464. Vector3 pogLocation = Commands->Get_Position ( engineroom_target04 );
  8465. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8466. }
  8467. }
  8468. }
  8469. else if (sender == engineroom_target03)
  8470. {
  8471. if (engineroom_target03_active == true)
  8472. {
  8473. engineroom_target03_active = false;
  8474. Commands->Set_Objective_HUD_Info( 200, -1, "POG_M04_2_01.tga", IDS_POG_DESTROY );
  8475. if (engineroom_target04 != NULL)
  8476. {
  8477. engineroom_target04_active = true;
  8478. Vector3 pogLocation = Commands->Get_Position ( engineroom_target04 );
  8479. Commands->Set_Objective_HUD_Info_Position( 200, 92, "POG_M04_2_01.tga", IDS_POG_DESTROY, pogLocation );
  8480. }
  8481. }
  8482. }
  8483. else if (sender == engineroom_target04)
  8484. {
  8485. if (engineroom_target04_active == true)
  8486. {
  8487. engineroom_target04_active = false;
  8488. Commands->Set_Objective_HUD_Info( 200, -1, "POG_M04_2_01.tga", IDS_POG_DESTROY );
  8489. }
  8490. }
  8491. }
  8492. else if (param == 300)//missile room target has been poked--see who it is and take action
  8493. {
  8494. GameObject * missile_target01 = Commands->Find_Object ( 100421 );
  8495. GameObject * missile_target02 = Commands->Find_Object ( 100422 );
  8496. GameObject * missile_target03 = Commands->Find_Object ( 100423 );
  8497. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  8498. if (sender == missile_target01)
  8499. {
  8500. missile_target01_poked = true;
  8501. }
  8502. else if (sender == missile_target02)
  8503. {
  8504. missile_target02_poked = true;
  8505. }
  8506. else if (sender == missile_target03)
  8507. {
  8508. missile_target03_poked = true;
  8509. }
  8510. else if (sender == missile_target04)
  8511. {
  8512. missile_target04_poked = true;
  8513. }
  8514. if (missile_target01_poked == true && missile_target01_active == true)//done with #1 light up next one
  8515. {
  8516. Commands->Set_Objective_HUD_Info( 300, -1, "POG_M04_1_03.tga", IDS_POG_SABOTAGE );
  8517. if (missile_target02_poked == false)
  8518. {
  8519. GameObject * missile_target02 = Commands->Find_Object ( 100422 );
  8520. if (missile_target02 != NULL)
  8521. {
  8522. missile_target02_active = true;
  8523. Vector3 pogLocation = Commands->Get_Position ( missile_target02 );
  8524. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8525. }
  8526. }
  8527. else if (missile_target03_poked == false)
  8528. {
  8529. GameObject * missile_target03 = Commands->Find_Object ( 100423 );
  8530. if (missile_target03 != NULL)
  8531. {
  8532. missile_target03_active = true;
  8533. Vector3 pogLocation = Commands->Get_Position ( missile_target03 );
  8534. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8535. }
  8536. }
  8537. else if (missile_target04_poked == false)
  8538. {
  8539. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  8540. if (missile_target04 != NULL)
  8541. {
  8542. missile_target04_active = true;
  8543. Vector3 pogLocation = Commands->Get_Position ( missile_target04 );
  8544. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8545. }
  8546. }
  8547. }
  8548. else if (missile_target02_poked == true && missile_target02_active == true)//done with #2 light up next one
  8549. {
  8550. Commands->Set_Objective_HUD_Info( 300, -1, "POG_M04_1_03.tga", IDS_POG_SABOTAGE );
  8551. if (missile_target03_poked == false)
  8552. {
  8553. GameObject * missile_target03 = Commands->Find_Object ( 100423 );
  8554. if (missile_target03 != NULL)
  8555. {
  8556. missile_target03_active = true;
  8557. Vector3 pogLocation = Commands->Get_Position ( missile_target03 );
  8558. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8559. }
  8560. }
  8561. else if (missile_target04_poked == false)
  8562. {
  8563. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  8564. if (missile_target04 != NULL)
  8565. {
  8566. missile_target04_active = true;
  8567. Vector3 pogLocation = Commands->Get_Position ( missile_target04 );
  8568. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8569. }
  8570. }
  8571. }
  8572. else if (missile_target03_poked == true && missile_target03_active == true)//done with #3 light up next one
  8573. {
  8574. Commands->Set_Objective_HUD_Info( 300, -1, "POG_M04_1_03.tga", IDS_POG_SABOTAGE );
  8575. if (missile_target04_poked == false)
  8576. {
  8577. GameObject * missile_target04 = Commands->Find_Object ( 100420 );
  8578. if (missile_target04 != NULL)
  8579. {
  8580. missile_target04_active = true;
  8581. Vector3 pogLocation = Commands->Get_Position ( missile_target04 );
  8582. Commands->Set_Objective_HUD_Info_Position( 300, 91, "POG_M04_1_03.tga", IDS_POG_SABOTAGE, pogLocation );
  8583. }
  8584. }
  8585. }
  8586. }
  8587. else if (param == 400)//torpedo target has been poked--see who it is and take action
  8588. {
  8589. GameObject * torpedo_target01 = Commands->Find_Object ( 100410 );
  8590. GameObject * torpedo_target02 = Commands->Find_Object ( 100409 );
  8591. if (sender == torpedo_target01)
  8592. {
  8593. torpedo_target01_poked = true;
  8594. }
  8595. if (sender == torpedo_target02)
  8596. {
  8597. torpedo_target02_poked = true;
  8598. }
  8599. if (torpedo_target01_poked == true )
  8600. {
  8601. GameObject * torpedo_target02 = Commands->Find_Object ( 100409 );
  8602. if (torpedo_target02 != NULL && torpedo_target02_poked == false)
  8603. {
  8604. torpedo_target02_active = true;
  8605. Vector3 pogLocation = Commands->Get_Position ( torpedo_target02 );
  8606. Commands->Set_Objective_HUD_Info_Position( 400, 91, "POG_M04_1_04.tga", IDS_POG_SABOTAGE, pogLocation );
  8607. }
  8608. else
  8609. {
  8610. Vector3 pogLocation = Commands->Get_Position ( torpedo_target02 );
  8611. Commands->Set_Objective_HUD_Info_Position( 400, -1, "POG_M04_1_04.tga", IDS_POG_SABOTAGE, pogLocation );
  8612. }
  8613. }
  8614. }
  8615. }
  8616. }
  8617. };
  8618. DECLARE_SCRIPT(M04_Start_TorpedoObjective_Zone_JDG, "")//105238 105239
  8619. {
  8620. bool conversationPlaying;
  8621. int missionIntroConv;
  8622. REGISTER_VARIABLES()
  8623. {
  8624. SAVE_VARIABLE( conversationPlaying, 1 );
  8625. SAVE_VARIABLE( missionIntroConv, 2 );
  8626. }
  8627. void Created( GameObject * obj )
  8628. {
  8629. conversationPlaying = false;
  8630. }
  8631. void Entered( GameObject * obj, GameObject * enterer )
  8632. {
  8633. if ( enterer == STAR && conversationPlaying == false)//M04_Add_Torpedo_Objective_Conversation
  8634. {
  8635. conversationPlaying = true;
  8636. missionIntroConv = Commands->Create_Conversation( "M04_Add_Torpedo_Objective_Conversation", 100, 1000, false);
  8637. Commands->Join_Conversation( NULL, missionIntroConv, false, false );
  8638. Commands->Start_Conversation( missionIntroConv, missionIntroConv );
  8639. Commands->Monitor_Conversation (obj, missionIntroConv);
  8640. }
  8641. }
  8642. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  8643. {
  8644. switch (complete_reason)
  8645. {
  8646. case ACTION_COMPLETE_CONVERSATION_ENDED:
  8647. {
  8648. if (action_id == missionIntroConv)//conversation is over, now add objective and pogs
  8649. {
  8650. Commands->Send_Custom_Event( obj, Commands->Find_Object (M04_OBJECTIVE_CONTROLLER_JDG), 0, 450, 0 );
  8651. GameObject * pogController = Commands->Find_Object ( 104693 );
  8652. if (pogController != NULL)
  8653. {
  8654. Commands->Send_Custom_Event( obj, pogController, M01_ADD_OBJECTIVE_POG_JDG, 400, 0 );
  8655. }
  8656. GameObject * zone01 = Commands->Find_Object ( 105238 );
  8657. if (zone01 != NULL)
  8658. {
  8659. Commands->Destroy_Object ( zone01 );
  8660. }
  8661. GameObject * zone02 = Commands->Find_Object ( 105239 );
  8662. if (zone02 != NULL)
  8663. {
  8664. Commands->Destroy_Object ( zone02 );
  8665. }
  8666. }
  8667. }
  8668. break;
  8669. }
  8670. }
  8671. };
  8672. DECLARE_SCRIPT(M04_TorpedoRoom_EnterZone_JDG, "")// 105240
  8673. {
  8674. void Entered( GameObject * obj, GameObject * enterer )
  8675. {
  8676. if ( enterer == STAR )
  8677. {
  8678. int missionIntroConv = Commands->Create_Conversation( "M04_Poke_The_Torpedos_Conversation", 100, 1000, false);
  8679. Commands->Join_Conversation( NULL, missionIntroConv, false, false );
  8680. Commands->Start_Conversation( missionIntroConv, missionIntroConv );
  8681. GameObject *zone02 = Commands->Find_Object (105240);
  8682. if (zone02 != NULL)
  8683. {
  8684. Commands->Destroy_Object ( zone02 );
  8685. }
  8686. }
  8687. }
  8688. };
  8689. DECLARE_SCRIPT(M04_BigSam_EntryZone_JDG, "")//104942
  8690. {
  8691. bool missilesSabotaged;
  8692. REGISTER_VARIABLES()
  8693. {
  8694. SAVE_VARIABLE(missilesSabotaged, 1);
  8695. }
  8696. void Created( GameObject * obj )
  8697. {
  8698. missilesSabotaged = false;
  8699. }
  8700. void Entered( GameObject * obj, GameObject * enterer )
  8701. {
  8702. if (enterer == STAR)
  8703. {
  8704. if (missilesSabotaged == true)
  8705. {
  8706. GameObject * bigSam = Commands->Find_Object ( 104873 );
  8707. if (bigSam != NULL)
  8708. {
  8709. Commands->Send_Custom_Event( obj, bigSam, 0, M01_START_ACTING_JDG, 1 );
  8710. Commands->Destroy_Object ( obj );//one time only zone--cleaning up
  8711. }
  8712. }
  8713. }
  8714. }
  8715. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8716. {
  8717. if (type == 0)
  8718. {
  8719. if (param == M01_START_ACTING_JDG)
  8720. {
  8721. missilesSabotaged = true;
  8722. }
  8723. }
  8724. }
  8725. };
  8726. DECLARE_SCRIPT(M04_BigSam_Script_JDG, "")//104873
  8727. {
  8728. int civWarning;
  8729. int missileStuckSound;
  8730. void Created( GameObject * obj )
  8731. {
  8732. Commands->Set_Animation_Frame ( obj, "DSP_L4GIANTGUN.DSP_L4GIANTGUN", 0 );
  8733. }
  8734. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8735. {
  8736. if (type == CUSTOM_EVENT_SOUND_ENDED )
  8737. {
  8738. if (param == civWarning)
  8739. {
  8740. Commands->Set_Animation ( obj, "DSP_L4GIANTGUN.DSP_L4GIANTGUN", false, NULL, 0, 119 );
  8741. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ATTACKING_01_JDG, 10 );
  8742. }
  8743. else if (param == missileStuckSound)
  8744. {
  8745. ActionParamsStruct params;
  8746. params.Set_Basic( this, 100, M01_START_ACTING_JDG );
  8747. params.AttackActive = false;
  8748. Commands->Action_Attack ( obj, params );
  8749. Vector3 explosion01_spot (0.122f, -57.477f, 13.000f);//
  8750. Commands->Create_Explosion ("Explosion_SAM_Site", explosion01_spot, NULL );
  8751. Commands->Set_Animation ( obj, "DSP_L4GIANTGUN.DSP_L4GIANTGUN", false, NULL, 120, 200 );
  8752. Commands->Set_Health ( obj, 0.25f );
  8753. }
  8754. }
  8755. else if (type == 0)
  8756. {
  8757. if (param == M01_START_ACTING_JDG )//missiles sabotaged/player entered room...start destruction sequence
  8758. {
  8759. civWarning = Commands->Create_2D_Sound ( "M04DSGN_DSGN0087I1EVAN_SND" );
  8760. Commands->Monitor_Sound ( obj, civWarning );
  8761. }
  8762. else if (param == M01_START_ATTACKING_01_JDG )
  8763. {
  8764. Vector3 myTarget = Commands->Get_Position ( obj );
  8765. myTarget.X += Commands->Get_Random(-30.0f, 30.0f);
  8766. myTarget.Y += Commands->Get_Random(-30.0f, 30.0f);
  8767. myTarget.Z += Commands->Get_Random(0, 30.0f);
  8768. ActionParamsStruct params;
  8769. params.Set_Basic( this, 100, M01_START_ACTING_JDG );
  8770. params.Set_Attack( myTarget, 1000, 0, true );
  8771. params.AttackCheckBlocked = false;
  8772. Commands->Action_Attack ( obj, params );
  8773. Commands->Send_Custom_Event ( obj, obj, 0, M01_START_ATTACKING_02_JDG, 3 );
  8774. }
  8775. else if (param == M01_START_ATTACKING_02_JDG )
  8776. {
  8777. missileStuckSound = Commands->Create_2D_Sound ( "Metal_Thunk_03" );
  8778. Commands->Monitor_Sound ( obj, missileStuckSound );
  8779. }
  8780. }
  8781. }
  8782. };
  8783. DECLARE_SCRIPT(M04_PlaySound_OnZoneEntry_OneTime_JDG, "SoundName:string")
  8784. {
  8785. void Entered( GameObject * obj, GameObject * enterer )
  8786. {
  8787. if (enterer == STAR)
  8788. {
  8789. const char * sound_name = Get_Parameter("SoundName");
  8790. Vector3 playersPosition = Commands->Get_Position ( obj );
  8791. Vector3 speaker01_Position = playersPosition;
  8792. Vector3 speaker02_Position = playersPosition;
  8793. Vector3 speaker03_Position = playersPosition;
  8794. speaker01_Position.X += Commands->Get_Random(-10,10);
  8795. speaker01_Position.Y += Commands->Get_Random(-10,10);
  8796. speaker01_Position.Z += Commands->Get_Random(-10,10);
  8797. speaker02_Position.X += Commands->Get_Random(-10,10);
  8798. speaker02_Position.Y += Commands->Get_Random(-10,10);
  8799. speaker02_Position.Z += Commands->Get_Random(-10,10);
  8800. speaker03_Position.X += Commands->Get_Random(-10,10);
  8801. speaker03_Position.Y += Commands->Get_Random(-10,10);
  8802. speaker03_Position.Z += Commands->Get_Random(-10,10);
  8803. Commands->Create_Sound ( sound_name, speaker01_Position, NULL );
  8804. Commands->Create_Sound ( sound_name, speaker02_Position, NULL );
  8805. Commands->Create_Sound ( sound_name, speaker03_Position, NULL );
  8806. Commands->Destroy_Object ( obj );
  8807. }
  8808. }
  8809. };
  8810. DECLARE_SCRIPT(M04_Objective_Reminder_Controller_JDG, "")//105760
  8811. {
  8812. bool prisoner_primaryActive;
  8813. bool missile_primaryActive;
  8814. bool l01keycard_primaryActive;
  8815. bool l02keycard_primaryActive;
  8816. bool l03keycard_primaryActive;
  8817. bool torpedo_primaryActive;
  8818. bool escape_primaryActive;
  8819. bool commandClearance;
  8820. REGISTER_VARIABLES()
  8821. {
  8822. SAVE_VARIABLE( prisoner_primaryActive, 1 );
  8823. SAVE_VARIABLE( missile_primaryActive, 2 );
  8824. SAVE_VARIABLE( l01keycard_primaryActive, 3 );
  8825. SAVE_VARIABLE( l02keycard_primaryActive, 4 );
  8826. SAVE_VARIABLE( l03keycard_primaryActive, 5 );
  8827. SAVE_VARIABLE( torpedo_primaryActive, 6 );
  8828. SAVE_VARIABLE( escape_primaryActive, 7 );
  8829. SAVE_VARIABLE( commandClearance, 8 );
  8830. }
  8831. void Created( GameObject * obj )
  8832. {
  8833. prisoner_primaryActive = false;
  8834. missile_primaryActive = false;
  8835. l01keycard_primaryActive = false;
  8836. l02keycard_primaryActive = false;
  8837. l03keycard_primaryActive = false;
  8838. torpedo_primaryActive = false;
  8839. escape_primaryActive = false;
  8840. commandClearance = true;
  8841. Commands->Send_Custom_Event( obj, obj, 1, 1, 90 );
  8842. }
  8843. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  8844. {
  8845. if (type == M01_ADD_OBJECTIVE_POG_JDG)
  8846. {
  8847. if (param == 0)//rescue the prisoner objective added
  8848. {
  8849. prisoner_primaryActive = true;
  8850. }
  8851. else if (param == 1)//sabotage the missile rack objective added
  8852. {
  8853. missile_primaryActive = true;
  8854. }
  8855. else if (param == 2)//get the level 01 keycard
  8856. {
  8857. l01keycard_primaryActive = true;
  8858. }
  8859. else if (param == 3)//get the level 02 keycard
  8860. {
  8861. l02keycard_primaryActive = true;
  8862. }
  8863. else if (param == 4)//get the level 03 keycard
  8864. {
  8865. l03keycard_primaryActive = true;
  8866. }
  8867. else if (param == 5)//sabotage the torpedo racks
  8868. {
  8869. torpedo_primaryActive = true;
  8870. }
  8871. else if (param == 6)//escape with the prisoners
  8872. {
  8873. escape_primaryActive = true;
  8874. }
  8875. commandClearance = false;
  8876. Commands->Send_Custom_Event( obj, obj, 1, 2, 15 );
  8877. }
  8878. else if (type == M01_REMOVE_OBJECTIVE_POG_JDG)
  8879. {
  8880. if (param == 0)//rescue the prisoner objective added
  8881. {
  8882. prisoner_primaryActive = false;
  8883. }
  8884. else if (param == 1)//sabotage the missile rack objective added
  8885. {
  8886. missile_primaryActive = false;
  8887. }
  8888. else if (param == 2)//get the level 01 keycard
  8889. {
  8890. l01keycard_primaryActive = false;
  8891. }
  8892. else if (param == 3)//get the level 02 keycard
  8893. {
  8894. l02keycard_primaryActive = false;
  8895. }
  8896. else if (param == 4)//get the level 03 keycard
  8897. {
  8898. l03keycard_primaryActive = false;
  8899. }
  8900. else if (param == 5)//sabotage the missile racks
  8901. {
  8902. torpedo_primaryActive = false;
  8903. }
  8904. else if (param == 6)//escape with the prisoners
  8905. {
  8906. escape_primaryActive = false;
  8907. }
  8908. }
  8909. else if (type == 1)
  8910. {
  8911. if (param == 1)//give reminder message
  8912. {
  8913. if (missile_primaryActive == true && commandClearance == true)
  8914. {//M04_Add_MissileRoom_Objective_Conversation
  8915. int reminderConv = Commands->Create_Conversation( "M04_Add_MissileRoom_Objective_Conversation", 10, 1000, false);
  8916. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8917. Commands->Start_Conversation( reminderConv, reminderConv );
  8918. }
  8919. else if (torpedo_primaryActive == true && commandClearance == true)
  8920. {//M04_Add_Torpedo_Objective_Conversation
  8921. int reminderConv = Commands->Create_Conversation( "M04_Add_Torpedo_Objective_Conversation", 10, 1000, false);
  8922. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8923. Commands->Start_Conversation( reminderConv, reminderConv );
  8924. }
  8925. else if (l01keycard_primaryActive == true && commandClearance == true)
  8926. {//M04_Add_PrisonKey_Objective
  8927. int reminderConv = Commands->Create_Conversation( "M04_Add_PrisonKey_Objective", 10, 1000, false);
  8928. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8929. Commands->Start_Conversation( reminderConv, reminderConv );
  8930. }
  8931. else if (prisoner_primaryActive == true && commandClearance == true)
  8932. {//M04_Mission_Start_Conversation
  8933. int reminderConv = Commands->Create_Conversation( "M04_Mission_Start_Conversation", 10, 1000, false);
  8934. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8935. Commands->Start_Conversation( reminderConv, reminderConv );
  8936. }
  8937. else if (l03keycard_primaryActive == true && commandClearance == true)
  8938. {//M04_Add_Captains_Key_Objective_Conversation
  8939. int reminderConv = Commands->Create_Conversation( "M04_Add_Captains_Key_Objective_Conversation", 10, 1000, false);
  8940. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8941. Commands->Start_Conversation( reminderConv, reminderConv );
  8942. }
  8943. else if (l02keycard_primaryActive == true && commandClearance == true)
  8944. {//M04_Add_FirstMate_Objective_JDG
  8945. int reminderConv = Commands->Create_Conversation( "M04_Add_FirstMate_Objective_JDG", 10, 1000, false);
  8946. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8947. Commands->Start_Conversation( reminderConv, reminderConv );
  8948. }
  8949. else if (escape_primaryActive == true && commandClearance == true)
  8950. {//M04_Rally_Round_The_Sub_Boy_Conversation
  8951. int reminderConv = Commands->Create_Conversation( "M04_Rally_Round_The_Sub_Boy_Conversation", 10, 1000, false);
  8952. Commands->Join_Conversation( NULL, reminderConv, false, false );
  8953. Commands->Start_Conversation( reminderConv, reminderConv );
  8954. }
  8955. Commands->Send_Custom_Event( obj, obj, 1, 1, 90 );
  8956. }
  8957. if (param == 2)//give reminder message
  8958. {
  8959. commandClearance = true;
  8960. }
  8961. }
  8962. }
  8963. };