Mission03.cpp 183 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144
  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. * Mission3.cpp
  22. *
  23. * DESCRIPTION
  24. * Mission 3 script
  25. *
  26. * PROGRAMMER
  27. * Design Team
  28. *
  29. * VERSION INFO
  30. * $Author: Dan_e $
  31. * $Revision: 72 $
  32. * $Modtime: 2/11/02 10:38a $
  33. * $Archive: /Commando/Code/Scripts/Mission03.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "scripts.h"
  37. #include "toolkit.h"
  38. #include <string.h>
  39. #include <stdio.h>
  40. #include "Mission3.h"
  41. DECLARE_SCRIPT(M03_Objective_Controller, "") //1100004
  42. {
  43. enum {WEATHER_TIMER};
  44. int sam_count_1, sam_count_2;
  45. bool gunboat_triggered, rain;
  46. bool gunboat1, gunboat2, gunboat3;
  47. int background_song;
  48. int battle_song;
  49. int sender1;
  50. REGISTER_VARIABLES()
  51. {
  52. SAVE_VARIABLE(sam_count_1, 1);
  53. SAVE_VARIABLE(sam_count_2, 2);
  54. SAVE_VARIABLE(gunboat_triggered, 3);
  55. SAVE_VARIABLE(rain, 4);
  56. SAVE_VARIABLE(sender1, 5);
  57. SAVE_VARIABLE(gunboat1, 6);
  58. SAVE_VARIABLE(gunboat2, 7);
  59. SAVE_VARIABLE(gunboat3, 8);
  60. }
  61. void Created(GameObject * obj)
  62. {
  63. Commands->Set_Num_Tertiary_Objectives ( 4 );
  64. Commands->Set_Wind(90.0f, 5.0f, 2.0f, 0.0f);
  65. Commands->Start_Timer(obj, this, Commands->Get_Random(20.0f, 40.0f), WEATHER_TIMER);
  66. sam_count_1 = sam_count_2 = 0;
  67. gunboat_triggered = gunboat1 = gunboat2 = gunboat3 = false;
  68. rain = true;
  69. // Commands->Add_Objective(1006, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, 1008, IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  70. // Commands->Add_Objective(1007, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_HIDDEN, 1009);
  71. // Commands->Add_Objective(1008, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_HIDDEN, 1010);
  72. // Commands->Add_Objective(1009, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, 1011,IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  73. // Commands->Add_Objective(1010, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_HIDDEN, 1019);
  74. // Commands->Add_Objective(1011, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, 1020, IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  75. // Commands->Add_Objective(1012, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_HIDDEN, 1021, IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  76. //Commands->Create_Sound ( "03_AmmoClip", Vector3(0,0,0), obj );
  77. }
  78. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  79. {
  80. GameObject *object;
  81. if (reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  82. {
  83. if (action_id == 1)
  84. {
  85. Commands->Add_Objective(1002, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M03_02, NULL, IDS_Enc_Obj_Secondary_M03_02);
  86. object = Commands->Find_Object(300056);
  87. if(object)
  88. {
  89. Commands->Set_Objective_Radar_Blip_Object(1002, object);
  90. Commands->Set_Objective_HUD_Info( 1002, 94, "POG_M03_2_02.tga", IDS_POG_DESTROY/*, Commands->Get_Position (object)*/);
  91. }
  92. }
  93. if (action_id == 2)
  94. {
  95. Commands->Add_Objective(1004, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M03_03, NULL, IDS_Enc_Obj_Secondary_M03_03);
  96. object = Commands->Find_Object(1205777);
  97. if(object)
  98. {
  99. Commands->Set_Objective_Radar_Blip_Object(1004, Commands->Find_Object (1205777));
  100. Commands->Set_Objective_HUD_Info( 1004, 97, "POG_M03_2_02.tga", IDS_POG_DESTROY/*, Commands->Get_Position (object)*/);
  101. Commands->Send_Custom_Event( obj, obj, REMOVE_SECONDARY_POG, 1004, SECONDARY_POG_DELAY );
  102. }
  103. //int id = Commands->Create_Conversation("M03CON064", 99, 2000, false);
  104. //Commands->Join_Conversation(NULL, id);
  105. //Commands->Start_Conversation(id, 100064);
  106. //Commands->Monitor_Conversation(obj, id);
  107. }
  108. if (action_id == 100020)
  109. {
  110. //int id = Commands->Create_Conversation("M03CON066", 99, 2000, false);
  111. //Commands->Join_Conversation(NULL, id);
  112. //Commands->Start_Conversation(id, 100066);
  113. //Commands->Monitor_Conversation(obj, id);
  114. Commands->Set_Objective_Status(1002, OBJECTIVE_STATUS_ACCOMPLISHED);
  115. }
  116. if (action_id == 100028)
  117. {
  118. //int id = Commands->Create_Conversation("M03CON066", 99, 2000, false);
  119. //Commands->Join_Conversation(NULL, id);
  120. //Commands->Start_Conversation(id, 100066);
  121. //Commands->Monitor_Conversation(obj, id);
  122. }
  123. if (action_id == 100033 || action_id == 100035 || action_id == 100037)
  124. {
  125. //int id = Commands->Create_Conversation("M03CON067", 99, 2000, false);
  126. //Commands->Join_Conversation(NULL, id);
  127. //Commands->Start_Conversation(id, 100067);
  128. //Commands->Monitor_Conversation(obj, id);
  129. }
  130. }
  131. }
  132. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  133. {
  134. if (type == GUNBOAT_KILLED)
  135. {
  136. if (!gunboat1)
  137. {
  138. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), 301, 2);
  139. }
  140. if (!gunboat2)
  141. {
  142. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), 302, 2);
  143. }
  144. if (!gunboat3)
  145. {
  146. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), 304, 2);
  147. }
  148. }
  149. if ((type == 302 || type == 304) && Commands->Find_Object(1100003) == NULL)
  150. {
  151. return;
  152. }
  153. if (type == 301)
  154. {
  155. sender1 = Commands->Get_ID ( sender );
  156. }
  157. if (type >= 300 && type <= 312)
  158. {
  159. switch(param)
  160. {
  161. case 1: Complete_Mission_Objective(type + 700);
  162. break;
  163. case 2: Fail_Mission_Objective(type + 700);
  164. break;
  165. case 3: Add_Mission_Objective(type + 700);
  166. break;
  167. case 4: Unhide_Mission_Objective(type + 700);
  168. break;
  169. }
  170. }
  171. if (type == 5000 && param == 5000)
  172. {
  173. gunboat_triggered = true;
  174. }
  175. if (type == SAKURA_DOGFIGHT)
  176. {
  177. //Commands->Stop_Sound ( background_song, true );
  178. //Commands->Create_Sound ( "Sakura_Dogfight", Vector3(0,0,0), obj );
  179. Commands->Set_Background_Music ( "Sakura_Dogfight.mp3" );
  180. }
  181. if (type == DOGFIGHT_ENDED)
  182. {
  183. //Commands->Stop_Sound ( battle_song, true );
  184. Commands->Set_Background_Music ( "03-ammoclip.mp3" );
  185. }
  186. /*if (type == REMOVE_SECONDARY_POG)
  187. {
  188. Remove_Pog(param);
  189. }*/
  190. if (type == 100063)
  191. {
  192. Commands->Send_Custom_Event(Commands->Find_Object (1100004), Commands->Find_Object (1100012), 999, 0, 0);
  193. }
  194. }
  195. void Remove_Pog(int id)
  196. {
  197. switch (id)
  198. {
  199. // Locate Nod Communications Center
  200. case 1000:
  201. {
  202. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_1_01.tga", IDS_POG_RESCUE);
  203. }
  204. break;
  205. // Help GDI forces secure beachhead
  206. case 1001:
  207. {
  208. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_2_01.tga", IDS_POG_RESCUE);
  209. }
  210. break;
  211. // Destroy village SAM sites
  212. case 1002:
  213. {
  214. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_2_02.tga", IDS_POG_RESCUE);
  215. }
  216. break;
  217. // Destroy SAMs near shore defense cannon
  218. case 1004:
  219. {
  220. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_2_02.tga", IDS_POG_RENDEZVOUS);
  221. }
  222. break;
  223. // Acquire security card from Nod officer
  224. case 1007:
  225. {
  226. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_1_02.tga", IDS_POG_RENDEZVOUS);
  227. }
  228. break;
  229. // Access Communications center Mainframe
  230. case 1008:
  231. {
  232. Commands->Set_Objective_HUD_Info(id, -1, "POG_M03_1_03.tga", IDS_POG_ASSIST);
  233. }
  234. break;
  235. }
  236. }
  237. void Timer_Expired(GameObject * obj, int timer_id)
  238. {
  239. /*if (timer_id == WEATHER_TIMER)
  240. {
  241. if (!rain)
  242. {
  243. return;
  244. }
  245. if (Commands->Get_Random(0, 1) < 0.5f)
  246. {
  247. Commands->Set_Rain(Commands->Get_Random(1.0f, 2.0f), 0.0f, false);
  248. }
  249. else
  250. {
  251. Commands->Set_Rain(0.0f, 0.0f, false);
  252. }
  253. Commands->Start_Timer(obj, this, Commands->Get_Random(20.0f, 40.0f), WEATHER_TIMER);
  254. }*/
  255. if (timer_id == 1002)
  256. {
  257. Sam_Sites_1_Dialogue();
  258. }
  259. if (timer_id == 1004)
  260. {
  261. //Commands->Create_Object("Level_3_Objective_Powerup_Temp", Vector3(48.3f, 79.2f, 21.0f));
  262. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(47.70f, 78.07f, 20.26f));
  263. Commands->Set_Facing(chinook_obj, 0.0f);
  264. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X3I_GDI_Drop_PowerUp.txt");
  265. Commands->Set_Objective_Status(1004, OBJECTIVE_STATUS_ACCOMPLISHED);
  266. Sam_Sites_2_Complete_Dialog();
  267. }
  268. if (timer_id == 2004)
  269. {
  270. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(47.70f, 78.07f, 20.26f));
  271. Commands->Set_Facing(chinook_obj, 0.0f);
  272. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X3I_GDI_Drop_PowerUp.txt");
  273. }
  274. if (timer_id == 1007)
  275. {
  276. Commands->Set_Objective_Status(1007, OBJECTIVE_STATUS_PENDING);
  277. }
  278. if (timer_id == 911)
  279. {
  280. int id = Commands->Create_Conversation("M03CON024", 99, 2000, true);
  281. Commands->Join_Conversation(NULL, id);
  282. Commands->Join_Conversation(STAR, id);
  283. Commands->Start_Conversation(id, 100024);
  284. Commands->Monitor_Conversation(obj, id);
  285. }
  286. if (timer_id == 912)
  287. {
  288. if (Commands->Find_Object (1100003))
  289. {
  290. int id = Commands->Create_Conversation("M03CON032", 99, 2000, true);
  291. Commands->Join_Conversation(NULL, id);
  292. Commands->Join_Conversation(STAR, id);
  293. Commands->Start_Conversation(id, 100032);
  294. Commands->Monitor_Conversation(obj, id);
  295. }
  296. }
  297. }
  298. void Add_Mission_Objective(int id)
  299. {
  300. GameObject *object;
  301. GameObject *controller = Commands->Find_Object (1100004);
  302. switch (id)
  303. {
  304. case 1000:
  305. {
  306. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M03_01, NULL, IDS_Enc_Obj_Primary_M03_01);
  307. object = Commands->Find_Object(1100009);
  308. if(object)
  309. {
  310. Commands->Set_Objective_Radar_Blip_Object(id, object);
  311. Commands->Set_Objective_HUD_Info_Position( 1000, 96, "POG_M03_1_01.tga", IDS_POG_LOCATE, Commands->Get_Position (object));
  312. }
  313. Commands->Send_Custom_Event( controller, controller, 100063, 0, 0.0f );
  314. /*int id = Commands->Create_Conversation("M03CON063", 99, 2000, false);
  315. Commands->Join_Conversation(NULL, id);
  316. Commands->Start_Conversation(id, 100063);
  317. Commands->Monitor_Conversation(controller, id);*/
  318. }
  319. break;
  320. case 1001:
  321. {
  322. Commands->Add_Objective(id, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M03_01, NULL, IDS_Enc_Obj_Secondary_M03_01);
  323. object = Commands->Find_Object(1212283);
  324. if(object)
  325. {
  326. Commands->Debug_Message ("object found");
  327. Commands->Set_Objective_Radar_Blip_Object(id, object);
  328. Commands->Set_Objective_HUD_Info_Position( 1001, 99, "POG_M03_2_01.tga", IDS_POG_DEFEAT, Commands->Get_Position (object));
  329. Commands->Send_Custom_Event( controller, controller, REMOVE_SECONDARY_POG, id, SECONDARY_POG_DELAY );
  330. }
  331. //int id = Commands->Create_Conversation("M03CON064", 99, 2000, false);
  332. //Commands->Join_Conversation(NULL, id);
  333. //Commands->Start_Conversation(id, 100064);
  334. //Commands->Monitor_Conversation(controller, id);
  335. }
  336. break;
  337. case 1002:
  338. {
  339. Commands->Add_Objective(1002, OBJECTIVE_TYPE_SECONDARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Secondary_M03_02, NULL, IDS_Enc_Obj_Secondary_M03_02);
  340. object = Commands->Find_Object(300056);
  341. if(object)
  342. {
  343. Commands->Set_Objective_Radar_Blip_Object(1002, object);
  344. Commands->Set_Objective_HUD_Info_Position( 1002, 98, "POG_M03_2_02.tga", IDS_POG_DESTROY, Commands->Get_Position (object));
  345. Commands->Send_Custom_Event( controller, controller, REMOVE_SECONDARY_POG, id, SECONDARY_POG_DELAY );
  346. }
  347. //int id = Commands->Create_Conversation("M03CON064", 99, 2000, false);
  348. //Commands->Join_Conversation(NULL, id);
  349. //Commands->Start_Conversation(id, 100064);
  350. //Commands->Monitor_Conversation(controller, id);
  351. Commands->Start_Timer(controller, this, 15.0f, 911);
  352. }
  353. break;
  354. case 1004: Sam_Sites_2_Dialogue();
  355. break;
  356. case 1006:
  357. {
  358. Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_01, NULL, IDS_Enc_Obj_Hidden_M03_01);
  359. Commands->Start_Timer(controller, this, 4.0f, 912);
  360. }
  361. break;
  362. case 1007:
  363. {
  364. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M03_02, NULL, IDS_Enc_Obj_Primary_M03_02);
  365. object = Commands->Find_Object(1215546);
  366. if(object)
  367. {
  368. Commands->Set_Objective_Radar_Blip_Object(1007, object);
  369. Commands->Set_Objective_HUD_Info_Position( 1007, 95, "POG_M03_1_02.tga", IDS_POG_LOCATE, Commands->Get_Position (object));
  370. }
  371. /*int id = Commands->Create_Conversation("M03CON063", 99, 2000, false);
  372. Commands->Join_Conversation(NULL, id);
  373. Commands->Start_Conversation(id, 100063);
  374. Commands->Monitor_Conversation(controller, id);*/
  375. }
  376. break;
  377. case 1008:
  378. {
  379. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M03_03, NULL, IDS_Enc_Obj_Primary_M03_03);
  380. object = Commands->Find_Object(1100009);
  381. if(object)
  382. {
  383. Commands->Set_Objective_Radar_Blip_Object(1008, object);
  384. Commands->Set_Objective_HUD_Info_Position( 1008, 94, "POG_M03_1_03.tga", IDS_POG_ACCESS, Commands->Get_Position (object));
  385. }
  386. //int id = Commands->Create_Conversation("M03CON063", 99, 2000, false);
  387. //Commands->Join_Conversation(NULL, id);
  388. //Commands->Start_Conversation(id, 100063);
  389. //Commands->Monitor_Conversation(controller, id);
  390. }
  391. break;
  392. case 1009: Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  393. break;
  394. case 1010:
  395. {
  396. Commands->Add_Objective(id, OBJECTIVE_TYPE_PRIMARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Primary_M03_04, NULL, IDS_Enc_Obj_Primary_M03_04);
  397. object = Commands->Find_Object(1213908);
  398. if(object)
  399. {
  400. Commands->Set_Objective_Radar_Blip_Object(1010, object);
  401. Commands->Set_Objective_HUD_Info_Position( 1010, 93, "POG_M03_1_04.tga", IDS_POG_ESCAPE, Commands->Get_Position (object));
  402. }
  403. //int id = Commands->Create_Conversation("M03CON063", 99, 2000, false);
  404. //Commands->Join_Conversation(NULL, id);
  405. //Commands->Start_Conversation(id, 100063);
  406. //Commands->Monitor_Conversation(controller, id);
  407. }
  408. break;
  409. case 1011: Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_03, NULL, IDS_Enc_Obj_Hidden_M03_03);
  410. break;
  411. case 1012: Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_04, NULL, IDS_Enc_Obj_Hidden_M03_04);
  412. break;
  413. }
  414. }
  415. void Sam_Sites_1_Dialogue(void)
  416. {
  417. /*GameObject * star = Commands->Get_A_Star(Commands->Get_Position(Owner()));
  418. int id = Commands->Create_Conversation("SAM_Objective_1", 0, 2000, false);
  419. Commands->Join_Conversation(NULL, id);
  420. Commands->Join_Conversation(star, id);
  421. Commands->Start_Conversation(id, 1);
  422. Commands->Monitor_Conversation(Owner(), id);*/
  423. }
  424. void Sam_Sites_2_Dialogue(void)
  425. {
  426. if (Commands->Find_Object (1100003) && Commands->Find_Object (1100002))
  427. {
  428. int id = Commands->Create_Conversation("M03CON026", 0, 2000, false);
  429. Commands->Join_Conversation(NULL, id);
  430. Commands->Join_Conversation(STAR, id);
  431. Commands->Start_Conversation(id, 2);
  432. Commands->Monitor_Conversation(Owner(), id);
  433. }
  434. }
  435. void Sam_Sites_1_Complete_Dialog(void)
  436. {
  437. /*GameObject * star = Commands->Get_A_Star(Commands->Get_Position(Owner()));
  438. int id = Commands->Create_Conversation("SAM_Objective_1_Complete", 0, 2000, false);
  439. Commands->Join_Conversation(NULL, id);
  440. Commands->Join_Conversation(star, id);
  441. Commands->Start_Conversation(id);*/
  442. }
  443. void Sam_Sites_2_Complete_Dialog(void)
  444. {
  445. /*GameObject * star = Commands->Get_A_Star(Commands->Get_Position(Owner()));
  446. int id = Commands->Create_Conversation("SAM_Objective_2_Complete", 0, 2000, false);
  447. Commands->Join_Conversation(NULL, id);
  448. Commands->Join_Conversation(star, id);
  449. Commands->Start_Conversation(id);*/
  450. }
  451. void Complete_Mission_Objective(int id)
  452. {
  453. GameObject *controller = Commands->Find_Object (1100004);
  454. if (id == 1000 || id == 1007 || id == 1008 || id == 1010)
  455. {
  456. //int id = Commands->Create_Conversation("M03CON065", 99, 2000, false);
  457. //Commands->Join_Conversation(NULL, id);
  458. //Commands->Start_Conversation(id, 100065);
  459. //Commands->Monitor_Conversation(controller, id);
  460. }
  461. if (id == 1000)
  462. {
  463. GameObject * com_center = Commands->Find_Object (1150002);
  464. Commands->Send_Custom_Event(controller, com_center, BASE_ENTERED, 0);
  465. }
  466. if (id == 1006 || id == 1009 || id == 1011 || id == 1012)
  467. {
  468. if (id == 1009)
  469. {
  470. Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_02, NULL, IDS_Enc_Obj_Hidden_M03_02);
  471. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_ACCOMPLISHED);
  472. int id = Commands->Create_Conversation("M03CON033", 99, 2000, false);
  473. Commands->Join_Conversation(NULL, id);
  474. Commands->Join_Conversation(STAR, id);
  475. Commands->Start_Conversation(id, 100033);
  476. Commands->Monitor_Conversation(controller, id);
  477. }
  478. if (id == 1011)
  479. {
  480. Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_03, NULL, IDS_Enc_Obj_Hidden_M03_03);
  481. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_ACCOMPLISHED);
  482. int id = Commands->Create_Conversation("M03CON035", 99, 2000, false);
  483. Commands->Join_Conversation(NULL, id);
  484. Commands->Join_Conversation(STAR, id);
  485. Commands->Start_Conversation(id, 100035);
  486. Commands->Monitor_Conversation(controller, id);
  487. }
  488. if (id == 1012)
  489. {
  490. Commands->Add_Objective(id, OBJECTIVE_TYPE_TERTIARY, OBJECTIVE_STATUS_PENDING, IDS_Enc_ObjTitle_Hidden_M03_04, NULL, IDS_Enc_Obj_Hidden_M03_04);
  491. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_ACCOMPLISHED);
  492. int id = Commands->Create_Conversation("M03CON037", 99, 2000, false);
  493. Commands->Join_Conversation(NULL, id);
  494. Commands->Join_Conversation(STAR, id);
  495. Commands->Start_Conversation(id, 100037);
  496. Commands->Monitor_Conversation(controller, id);
  497. }
  498. }
  499. if (id == 1001)
  500. {
  501. gunboat1 = true;
  502. }
  503. if (id == 1002)
  504. {
  505. sam_count_1++;
  506. if (sam_count_1 >= 2)
  507. {
  508. gunboat2 = true;
  509. /*Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_ACCOMPLISHED);
  510. GameObject *tailgun_zone = Commands->Find_Object(1141168);
  511. if (tailgun_zone)
  512. {
  513. Commands->Send_Custom_Event(Owner(), tailgun_zone, 200, 200);
  514. }
  515. Sam_Sites_1_Complete_Dialog();*/
  516. int id = Commands->Create_Conversation("M03CON020", 99, 2000, false);
  517. Commands->Join_Conversation(NULL, id);
  518. Commands->Join_Conversation(STAR, id);
  519. Commands->Start_Conversation(id, 100020);
  520. Commands->Monitor_Conversation(controller, id);
  521. //Commands->Create_Object("Level_3_Objective_Powerup_Temp", Vector3(73.624f, -78.110f, 0.7f));
  522. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(73.0f, -80.04f, 0.2f));
  523. Commands->Set_Facing(chinook_obj, 0.0f);
  524. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X3I_GDI_Drop_PowerUp.txt");
  525. Commands->Send_Custom_Event(controller, Commands->Find_Object (1100001), ENTERED, 0);
  526. }
  527. }
  528. if (id == 1004)
  529. {
  530. sam_count_2++;
  531. if (sam_count_2 >= 2)
  532. {
  533. gunboat3 = true;
  534. Commands->Set_Objective_Status(1004, OBJECTIVE_STATUS_ACCOMPLISHED);
  535. if (Commands->Find_Object (1100002) && Commands->Find_Object (1100003))
  536. {
  537. int id = Commands->Create_Conversation("M03CON027", 99, 2000, false);
  538. Commands->Join_Conversation(NULL, id);
  539. Commands->Start_Conversation(id, 100027);
  540. Commands->Monitor_Conversation(controller, id);
  541. Commands->Start_Timer(Owner(), this, 4.0f, 1004);
  542. }
  543. if (!(Commands->Find_Object (1100002)) && Commands->Find_Object (1100003))
  544. {
  545. int id = Commands->Create_Conversation("M03CON028", 99, 2000, true);
  546. Commands->Join_Conversation(NULL, id);
  547. Commands->Start_Conversation(id, 100028);
  548. Commands->Monitor_Conversation(controller, id);
  549. //Commands->Set_Objective_Status(1004, OBJECTIVE_STATUS_ACCOMPLISHED);
  550. Commands->Start_Timer(Owner(), this, 4.0f, 2004);
  551. }
  552. }
  553. }
  554. if (id == 1001)
  555. {
  556. //Commands->Create_Object("Level_3_Objective_Powerup_Temp", Vector3(-94.945f, -66.073f, 2.0f));
  557. GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Vector3(-96.2f, -75.8f, 1.4f));
  558. Commands->Set_Facing(chinook_obj, 0.0f);
  559. Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X3I_GDI_Drop_PowerUp.txt");
  560. GameObject * gunboat = Commands->Find_Object(1100003);
  561. if (gunboat && !gunboat_triggered)
  562. {
  563. Commands->Send_Custom_Event(Owner(), gunboat, 2000, 1);
  564. GameObject *zone = Commands->Find_Object(1100000);
  565. Commands->Destroy_Object(zone);
  566. }
  567. }
  568. if (id != 1002 && id != 1004 && id != 1009 && id != 1011 && id != 1012)
  569. {
  570. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_ACCOMPLISHED);
  571. }
  572. }
  573. void Fail_Mission_Objective(int id)
  574. {
  575. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_FAILED);
  576. }
  577. void Unhide_Mission_Objective(int id)
  578. {
  579. if (id == 1007)
  580. {
  581. Commands->Start_Timer(Owner(), this, 3.0f, 1007);
  582. }
  583. else if (id == 1010)
  584. {
  585. rain = false;
  586. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_PENDING);
  587. }
  588. else
  589. {
  590. Commands->Set_Objective_Status(id, OBJECTIVE_STATUS_PENDING);
  591. }
  592. }
  593. };
  594. DECLARE_SCRIPT(RMV_Test_Big_Gun_Turning, "")
  595. {
  596. int count;
  597. bool gunboat_warned;
  598. bool cine;
  599. REGISTER_VARIABLES()
  600. {
  601. SAVE_VARIABLE( count, 1 );
  602. SAVE_VARIABLE( gunboat_warned, 2);
  603. SAVE_VARIABLE( cine, 3 );
  604. }
  605. void Created(GameObject * obj)
  606. {
  607. cine = false;
  608. count = 0;
  609. gunboat_warned = false;
  610. }
  611. void Killed(GameObject * obj, GameObject * killer)
  612. {
  613. GameObject *temp;
  614. //Commands->Create_Sound("00-n036e", Vector3(0,0,0), obj);
  615. temp = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  616. Commands->Attach_Script(temp, "Test_Cinematic", "X3C_Bigguns2.txt");
  617. Commands->Send_Custom_Event (obj, Commands->Find_Object(1100004), 306, 3, 0.0f);
  618. Commands->Send_Custom_Event (obj, Commands->Find_Object(1100004), 306, 1, 0.0f);
  619. Commands->Send_Custom_Event (obj, Commands->Find_Object(1100003), CANNON_KILLED, 0, 0.0f);
  620. /*int id = Commands->Create_Conversation("IDS_M03_D01");
  621. Commands->Join_Conversation(NULL, id);
  622. Commands->Join_Conversation(STAR, id);
  623. Commands->Start_Conversation(id);*/
  624. }
  625. void Sound_Heard(GameObject * obj, const CombatSound & sound)
  626. {
  627. if (sound.Type == SOUND_TYPE_DESIGNER04)
  628. {
  629. Commands->Shake_Camera(sound.Position, 40, 0.3f, 1.0f);
  630. //Commands->Apply_Damage ( Commands->Find_Object(1100003), 20.0f, "EXPLOSIVE", Commands->Find_Object(1100002));
  631. if (!gunboat_warned)
  632. {
  633. float random = Commands->Get_Random(1, 5);
  634. if (random < 2)
  635. {
  636. gunboat_warned = true;
  637. /*int id = Commands->Create_Conversation("Gunboat_Warn_Big_Gun");
  638. Commands->Join_Conversation(NULL, id);
  639. Commands->Join_Conversation(STAR, id);
  640. Commands->Start_Conversation(id);*/
  641. }
  642. }
  643. }
  644. }
  645. void Damaged( GameObject * obj, GameObject * damager, float amount )
  646. {
  647. if (cine)
  648. {
  649. if (Commands->Get_Health (obj) < 1)
  650. {
  651. Commands->Set_Health (obj, Commands->Get_Health (obj) + 1.0f);
  652. }
  653. }
  654. }
  655. void Timer_Expired(GameObject * obj, int timer_id)
  656. {
  657. if (timer_id == ORCA_TIMER)
  658. {
  659. if (Commands->Find_Object (1100002))
  660. {
  661. GameObject *temp;
  662. //Commands->Create_Sound("00-n036e", Vector3(0,0,0), obj);
  663. temp = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  664. Commands->Attach_Script(temp, "Test_Cinematic", "X3C_Bigguns.txt");
  665. cine = true;
  666. }
  667. }
  668. }
  669. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  670. {
  671. if (type == GUNBOAT_KILLED)
  672. {
  673. Commands->Action_Reset (obj, 100);
  674. Commands->Enable_Enemy_Seen (obj, false);
  675. }
  676. if ((type == 1000) && (param == 1000))
  677. {
  678. /*Vector3 target, pos;
  679. pos = Commands->Get_Position(obj);
  680. target.X = pos.X + 49.31;
  681. target.Y = pos.Y + 8.25;
  682. target.Z = pos.Z + 1.0f;
  683. ActionParamsStruct params;
  684. params.Set_Basic(this, 90, 0);
  685. if (Commands->Find_Object(1100003) == NULL)
  686. {
  687. params.Set_Attack(target, 0.0f, 3.0f, true);
  688. }
  689. else
  690. {
  691. params.Set_Attack(target, 100.0f, 0.0f, true);
  692. }*/
  693. ActionParamsStruct params;
  694. params.Set_Basic(this, 99, 2);
  695. params.Set_Attack(Commands->Find_Object (1100003), 1000.0f, 2.0f, true);
  696. params.AttackCheckBlocked = false;
  697. Commands->Action_Attack(obj, params);
  698. }
  699. if ((type == 2000) && (param == 2000))
  700. {
  701. count++;
  702. if (count == 2 && Commands->Find_Object(1100003) != NULL)
  703. {
  704. Commands->Start_Timer(obj, this, 2.0f, ORCA_TIMER);
  705. }
  706. }
  707. if (type == 2450 && param == 2450)
  708. {
  709. GameObject * gunboat = Commands->Find_Object(1100003);
  710. if (gunboat)
  711. {
  712. Commands->Send_Custom_Event(obj, gunboat, 8000, 8000);
  713. }
  714. Commands->Destroy_Object(obj);
  715. }
  716. }
  717. };
  718. DECLARE_SCRIPT(M03_Gunboat_Controller_RMV, "Receive_Type:int, Receive_Param_For_Village:int, Receive_Param_For_Cannon:int, Beach_Destination:vector3, Village_Start:vector3, Village_Destination:vector3, Cannon_Start:vector3, Cannon_Destination:Vector3, Receive_Param_Destroy:int")
  719. {
  720. typedef enum {
  721. STATE_AT_BEACH,
  722. STATE_AT_VILLAGE,
  723. STATE_AT_CANNON,
  724. STATE_IN_TRANSIT,
  725. STATE_AFTER_CANNON
  726. } Gunboat_State;
  727. enum {
  728. GUNBOAT_ACTION,
  729. GUNBOAT_TIMER
  730. };
  731. Gunboat_State state, last_state;
  732. Vector3 beach_dest, village_start, village_dest, cannon_start, cannon_dest;
  733. Vector3 beach_targets[3], village_targets[3], cannon_targets[3];
  734. float beach_error, village_error, cannon_error;
  735. float random;
  736. bool been_shot, warning_1_given, warning_2_given, had_conv, inlet_fire, cannon_killed;
  737. float last_health;
  738. int inlet_count, dam_count;
  739. REGISTER_VARIABLES()
  740. {
  741. SAVE_VARIABLE( state, 1 );
  742. SAVE_VARIABLE( last_state, 2 );
  743. SAVE_VARIABLE( beach_dest, 3 );
  744. SAVE_VARIABLE( village_start, 4 );
  745. SAVE_VARIABLE( village_dest, 5 );
  746. SAVE_VARIABLE( cannon_start, 6 );
  747. SAVE_VARIABLE( cannon_dest, 7 );
  748. SAVE_VARIABLE( beach_targets, 8 );
  749. SAVE_VARIABLE( village_targets, 9 );
  750. SAVE_VARIABLE( cannon_targets, 10 );
  751. SAVE_VARIABLE( beach_error, 11 );
  752. SAVE_VARIABLE( village_error, 12 );
  753. SAVE_VARIABLE( cannon_error, 13 );
  754. SAVE_VARIABLE( random, 14 );
  755. SAVE_VARIABLE( been_shot, 15 );
  756. SAVE_VARIABLE( last_health, 16 );
  757. SAVE_VARIABLE( warning_1_given, 17);
  758. SAVE_VARIABLE( warning_2_given, 18);
  759. SAVE_VARIABLE( had_conv, 19 );
  760. SAVE_VARIABLE( inlet_count, 20 );
  761. SAVE_VARIABLE( inlet_fire, 21 );
  762. SAVE_VARIABLE( dam_count, 22 );
  763. SAVE_VARIABLE( cannon_killed, 23 );
  764. }
  765. void Created(GameObject * obj)
  766. {
  767. Commands->Enable_Hibernation(obj, false);
  768. //Commands->Disable_Physical_Collisions(obj);
  769. //Commands->Disable_All_Collisions(obj);
  770. Commands->Enable_Engine(obj, true);
  771. warning_1_given = warning_2_given = been_shot = had_conv = false;
  772. last_health = Commands->Get_Max_Health(obj);
  773. beach_dest = Get_Vector3_Parameter("Beach_Destination");
  774. village_start = Get_Vector3_Parameter("Village_Start");
  775. village_dest = Get_Vector3_Parameter("Village_Destination");
  776. cannon_start = Get_Vector3_Parameter("Cannon_Start");
  777. cannon_dest = Get_Vector3_Parameter("Cannon_Destination");
  778. beach_error = 3.0f;
  779. village_error = 3.0f;
  780. cannon_error = 3.0f;
  781. beach_targets[0] = Vector3(-116,-44,25);
  782. beach_targets[1] = Vector3(-96,-36,25);
  783. beach_targets[2] = Vector3(-74,-35,29);
  784. village_targets[0] = Vector3(24,-25,16);
  785. village_targets[1] = Vector3(45,-30,16);
  786. village_targets[2] = Vector3(80,-12,16);
  787. cannon_targets[0] = Vector3(91,42,27);
  788. cannon_targets[1] = Vector3(66,71,17);
  789. cannon_targets[2] = Vector3(52.558f, 51.739f, 28.880f);
  790. inlet_count = 0;
  791. inlet_fire = true;
  792. state = STATE_AT_BEACH;
  793. ActionParamsStruct params;
  794. params.Set_Basic(this, 90, GUNBOAT_ACTION);
  795. params.Set_Movement(beach_dest, 0.25f, 3);
  796. random = Commands->Get_Random(0, 3);
  797. random = WWMath::Clamp(random, 0, 2);
  798. params.Set_Attack(beach_targets[(int)random], 500.0f, beach_error, true);
  799. params.AttackCheckBlocked = false;
  800. params.MovePathfind = false;
  801. params.AttackFaceTarget = false;
  802. Commands->Action_Attack(obj, params);
  803. Commands->Start_Timer(obj, this, 3.5f, GUNBOAT_TIMER);
  804. cannon_killed = false;
  805. dam_count = 0;
  806. }
  807. void Timer_Expired(GameObject * obj, int timer_id)
  808. {
  809. if (timer_id == GUNBOAT_TIMER && !cannon_killed)
  810. {
  811. ActionParamsStruct params;
  812. params.Set_Basic(this, 90, GUNBOAT_ACTION);
  813. params.AttackCheckBlocked = false;
  814. params.MovePathfind = false;
  815. params.AttackFaceTarget = false;
  816. switch (state)
  817. {
  818. case STATE_AT_BEACH: random = Commands->Get_Random(0, 3);
  819. random = WWMath::Clamp(random, 0, 2);
  820. params.Set_Movement(beach_dest, 0.25f, 3);
  821. params.Set_Attack(beach_targets[(int)random], 500.0f, beach_error, true);
  822. Commands->Action_Attack(obj, params);
  823. break;
  824. case STATE_AT_VILLAGE: random = Commands->Get_Random(0, 3);
  825. random = WWMath::Clamp(random, 0, 2);
  826. params.Set_Movement(village_dest, 0.25f, 3);
  827. params.Set_Attack(village_targets[(int)random], 500.0f, village_error, true);
  828. if (!inlet_fire)
  829. {
  830. params.AttackActive = false;
  831. }
  832. Commands->Action_Attack(obj, params);
  833. break;
  834. case STATE_AT_CANNON: random = Commands->Get_Random(0, 3);
  835. random = WWMath::Clamp(random, 0, 2);
  836. params.Set_Movement(cannon_dest, 0.25f, 3);
  837. params.Set_Attack(cannon_targets[(int)random], 500.0f, cannon_error, true);
  838. Commands->Action_Attack(obj, params);
  839. break;
  840. case STATE_AFTER_CANNON:
  841. {
  842. Commands->Action_Reset (obj, 100);
  843. }
  844. case STATE_IN_TRANSIT:
  845. switch (last_state)
  846. {
  847. case STATE_AT_BEACH:
  848. {
  849. params.Set_Movement(village_start, 0.5f, 3);
  850. if (!had_conv)
  851. {
  852. had_conv = true;
  853. /*int id = Commands->Create_Conversation("Gunboat_To_Inlet");
  854. Commands->Join_Conversation(NULL, id);
  855. Commands->Join_Conversation(STAR, id);
  856. Commands->Start_Conversation(id);*/
  857. }
  858. break;
  859. }
  860. case STATE_AT_VILLAGE: params.Set_Movement(cannon_start, 0.5f, 3);
  861. break;
  862. }
  863. Commands->Action_Goto(obj, params);
  864. break;
  865. }
  866. Commands->Start_Timer(obj, this, 1.5f, GUNBOAT_TIMER);
  867. }
  868. }
  869. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  870. {
  871. if (type == CANNON_KILLED)
  872. {
  873. cannon_killed = true;
  874. Commands->Action_Reset (obj, 100);
  875. }
  876. if (type == 8000 && param == 8000)
  877. {
  878. ActionParamsStruct params;
  879. params.Set_Basic(this, 100, 40);
  880. params.Set_Movement(Vector3(-58.0f, 222.0f, -1.120f), 0.5f, 5.0f);
  881. Commands->Action_Goto(obj, params);
  882. return;
  883. }
  884. if (type == 7000 && param == 7000)
  885. {
  886. if (++inlet_count >= 4)
  887. {
  888. inlet_fire = false;
  889. }
  890. }
  891. ActionParamsStruct params;
  892. params.Set_Basic(this, 90, GUNBOAT_ACTION);
  893. if ((type == Get_Int_Parameter("Receive_Type")) && (param == Get_Int_Parameter("Receive_Param_Destroy")))
  894. {
  895. Commands->Destroy_Object(obj);
  896. return;
  897. }
  898. if ((type == Get_Int_Parameter("Receive_Type")) && (param == Get_Int_Parameter("Receive_Param_For_Village")))
  899. {
  900. /* // Turn off beach bunkers
  901. if (Commands->Find_Object(1000001)) {
  902. Commands->Send_Custom_Event(obj, Commands->Find_Object(1000001), 3000, 3000);
  903. }
  904. if (Commands->Find_Object(1000002)) {
  905. Commands->Send_Custom_Event(obj, Commands->Find_Object(1000002), 3000, 3000);
  906. }
  907. if (Commands->Find_Object(1000003)) {
  908. Commands->Send_Custom_Event(obj, Commands->Find_Object(1000003), 3000, 3000);
  909. } */
  910. params.Set_Movement(village_start, 1.0f, 3);
  911. last_state = STATE_AT_BEACH;
  912. }
  913. if ((type == Get_Int_Parameter("Receive_Type")) && (param == Get_Int_Parameter("Receive_Param_For_Cannon")))
  914. {
  915. params.Set_Movement(cannon_start, 1.0f, 3);
  916. last_state = STATE_AT_VILLAGE;
  917. }
  918. state = STATE_IN_TRANSIT;
  919. Commands->Action_Goto(obj, params);
  920. }
  921. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  922. {
  923. if (action_id == 40)
  924. {
  925. return;
  926. }
  927. if (reason != ACTION_COMPLETE_NORMAL)
  928. return;
  929. if (action_id == GUNBOAT_ACTION)
  930. {
  931. ActionParamsStruct params;
  932. params.Set_Basic(this, 90, GUNBOAT_ACTION);
  933. if (state == STATE_IN_TRANSIT)
  934. {
  935. if (last_state == STATE_AT_BEACH)
  936. {
  937. params.Set_Movement(village_dest, 0.25f, 3);
  938. state = STATE_AT_VILLAGE;
  939. }
  940. if (last_state == STATE_AT_VILLAGE)
  941. {
  942. params.Set_Movement(cannon_dest, 0.25f, 3);
  943. state = STATE_AT_CANNON;
  944. }
  945. Commands->Action_Goto(obj, params);
  946. }
  947. else if
  948. (state == STATE_AT_CANNON)
  949. Commands->Action_Reset(obj, 90);
  950. }
  951. }
  952. void Check_Health(void)
  953. {
  954. if (!warning_2_given && last_health <= 0.25f * Commands->Get_Max_Health(Owner()))
  955. {
  956. warning_2_given = true;
  957. /*int id = Commands->Create_Conversation("Gunboat_Near_Death");
  958. Commands->Join_Conversation(NULL, id);
  959. Commands->Join_Conversation(STAR, id);
  960. Commands->Start_Conversation(id);*/
  961. return;
  962. }
  963. if (!warning_1_given && last_health <= 0.5f * Commands->Get_Max_Health(Owner()))
  964. {
  965. warning_1_given = true;
  966. /*int id = Commands->Create_Conversation("Gunboat_Damaged");
  967. Commands->Join_Conversation(NULL, id);
  968. Commands->Join_Conversation(STAR, id);
  969. Commands->Start_Conversation(id);*/
  970. }
  971. }
  972. void Damaged(GameObject * obj, GameObject * damager, float amount)
  973. {
  974. if (damager && Commands->Is_A_Star(damager) && !been_shot)
  975. {
  976. been_shot = true;
  977. Commands->Create_2D_Sound("00-N062E");
  978. }
  979. if (Commands->Get_Health(obj) <= 0)
  980. {
  981. return;
  982. }
  983. float damage = last_health - Commands->Get_Health(obj);
  984. damage *= ((DIFFICULTY + 1));
  985. Commands->Set_Health(obj, last_health - damage);
  986. last_health = Commands->Get_Health(obj);
  987. Check_Health();
  988. if (damager == Commands->Find_Object (1100002))
  989. {
  990. if (++dam_count > 1 && dam_count <= 3)
  991. {
  992. if (Commands->Get_Health (Commands->Find_Object (300058)) > 0 || Commands->Get_Health (Commands->Find_Object (300058)) > 0)
  993. {
  994. int id = Commands->Create_Conversation("M03CON029", 99, 2000, true);
  995. Commands->Join_Conversation(NULL, id);
  996. Commands->Start_Conversation(id, 100029);
  997. Commands->Monitor_Conversation(obj, id);
  998. return;
  999. }
  1000. }
  1001. if (++dam_count > 3 && dam_count <= 5)
  1002. {
  1003. int id = Commands->Create_Conversation("M03CON030", 99, 2000, true);
  1004. Commands->Join_Conversation(NULL, id);
  1005. Commands->Start_Conversation(id, 100030);
  1006. Commands->Monitor_Conversation(obj, id);
  1007. }
  1008. }
  1009. }
  1010. void Killed(GameObject * obj, GameObject * killer)
  1011. {
  1012. Commands->Create_Explosion_At_Bone("Ground Explosions Twiddler", obj, "TURRET");
  1013. if (killer == Commands->Find_Object (1100002))
  1014. {
  1015. int id = Commands->Create_Conversation("M03CON031");
  1016. Commands->Join_Conversation(NULL, id);
  1017. Commands->Start_Conversation(id, 100031);
  1018. Commands->Monitor_Conversation(obj, id);
  1019. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), GUNBOAT_KILLED, 0);
  1020. Commands->Send_Custom_Event(obj, Commands->Find_Object (1100003), GUNBOAT_KILLED, 0);
  1021. //Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), 304, 2);
  1022. }
  1023. if (killer != Commands->Find_Object (1100002))
  1024. {
  1025. int id = Commands->Create_Conversation("M03CON018");
  1026. Commands->Join_Conversation(NULL, id);
  1027. Commands->Join_Conversation(NULL, id);
  1028. Commands->Join_Conversation(STAR, id);
  1029. Commands->Start_Conversation(id, 100018);
  1030. Commands->Monitor_Conversation(obj, id);
  1031. //Commands->Send_Custom_Event(obj, Commands->Find_Object (1100004), 302, 2);
  1032. }
  1033. }
  1034. };
  1035. /*DECLARE_SCRIPT(RMV_Temp_EVA_Dialogue, "")
  1036. {
  1037. int last;
  1038. REGISTER_VARIABLES()
  1039. {
  1040. SAVE_VARIABLE( last, 1 );
  1041. }
  1042. void Created(GameObject * obj)
  1043. {
  1044. last = 0;
  1045. }
  1046. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1047. {
  1048. char *list[11];
  1049. list[0] = "00-N184E"; //Locate Comm Center
  1050. list[1] = "00-N186E"; //Secure Beachhead
  1051. list[2] = NULL;//"00-N188E"; //Destroy SAM #1
  1052. list[3] = "00-N188E"; //Destroy SAM #2
  1053. list[4] = NULL;//"00-N188E"; //Destroy SAM #3
  1054. list[5] = "00-N188E"; //Destroy SAM #4
  1055. list[6] = "00-N154E"; //Destroy Big Gun
  1056. list[7] = "00-N200E"; //Acquire Keycard
  1057. list[8] = "00-N210E"; //Access Comm Center Terminal
  1058. list[9] = "00-N204E"; //Destroy Power Plant Terminal
  1059. list[10] = "00-N150E"; //Escape via the sub
  1060. if (param == 1)
  1061. {
  1062. Commands->Start_Timer(obj, this, 2.0f, 0);
  1063. }
  1064. if (type == last) return;
  1065. if ((param == 3) || (param == 4))
  1066. {
  1067. int num = type - 300;
  1068. if (num <= 10)
  1069. {
  1070. if (list[num] != NULL)
  1071. {
  1072. // Commands->Create_Sound(list[num], Vector3(0,0,0), obj);
  1073. }
  1074. }
  1075. }
  1076. last = type;
  1077. }
  1078. void Timer_Expired(GameObject * obj, int timer_id)
  1079. {
  1080. char *taunts[4];
  1081. taunts[0] = "laugh1";
  1082. taunts[1] = "lefty1";
  1083. taunts[2] = "bombit1";
  1084. taunts[3] = "keepem1";
  1085. float random = Commands->Get_Random(0, 11);
  1086. if (random < 8.0f)
  1087. {
  1088. random /= 2.0f;
  1089. random = WWMath::Clamp(random, 0, 3);
  1090. int d_random = (int)random;
  1091. Commands->Create_Sound(taunts[d_random], Vector3(0,0,0), obj);
  1092. }
  1093. }
  1094. };*/
  1095. DECLARE_SCRIPT(Sakura_Killed, "")
  1096. {
  1097. int music_id;
  1098. REGISTER_VARIABLES()
  1099. {
  1100. SAVE_VARIABLE(music_id, 1);
  1101. }
  1102. void Created(GameObject * obj)
  1103. {
  1104. if (Commands->Find_Object(1144518)) {
  1105. Commands->Send_Custom_Event(obj, Commands->Find_Object(1144518), 622, 622);
  1106. }
  1107. }
  1108. void Damaged( GameObject * obj, GameObject * damager, float amount )
  1109. {
  1110. if (damager != STAR)
  1111. {
  1112. if (Commands->Get_Health (obj) < 5)
  1113. {
  1114. Commands->Set_Health (obj, Commands->Get_Health (obj) + 1);
  1115. }
  1116. }
  1117. }
  1118. void Killed(GameObject * obj, GameObject * killer)
  1119. {
  1120. GameObject *temp;
  1121. temp = Commands->Create_Object("Sakura Crash Controller", Vector3(0,0,0));
  1122. if (Commands->Find_Object(1300001)) {
  1123. Commands->Send_Custom_Event(obj, Commands->Find_Object(1300001), 6000, 6600);
  1124. }
  1125. Commands->Grant_Key(STAR, 6, true);
  1126. }
  1127. };
  1128. DECLARE_SCRIPT(M03_Outro_Cinematic, "")
  1129. {
  1130. int star_id;
  1131. REGISTER_VARIABLES()
  1132. {
  1133. SAVE_VARIABLE( star_id, 1 );
  1134. }
  1135. void Entered(GameObject * obj, GameObject * enterer)
  1136. {
  1137. {
  1138. star_id = Commands->Get_ID(enterer);
  1139. GameObject *controller;
  1140. controller = Commands->Find_Object(1100004);
  1141. if (controller) {
  1142. Commands->Send_Custom_Event(obj, controller, 8000, 8000);
  1143. }
  1144. }
  1145. }
  1146. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1147. {
  1148. if ((type == 8000) && (param >= 3))
  1149. {
  1150. GameObject *temp;
  1151. GameObject *star = Commands->Find_Object(star_id);
  1152. Vector3 pos;
  1153. pos.Set(-324.49f, 71.60f, 4.26f);
  1154. Commands->Set_Position(star, pos);
  1155. temp = Commands->Create_Object("Finale Controller", Vector3(0,0,0));
  1156. Commands->Start_Timer(obj, this, 625.0f/30.0f, 0);
  1157. }
  1158. }
  1159. void Timer_Expired(GameObject * obj, int timer_id)
  1160. {
  1161. GameObject *controller;
  1162. controller = Commands->Find_Object(1100004);
  1163. if (controller)
  1164. {
  1165. Commands->Send_Custom_Event(obj, controller, 310, 1);
  1166. }
  1167. }
  1168. };
  1169. DECLARE_SCRIPT(RMV_M03_Comm_Center_Terminal, "")
  1170. {
  1171. bool has_been_poked;
  1172. REGISTER_VARIABLES()
  1173. {
  1174. SAVE_VARIABLE( has_been_poked, 1 );
  1175. }
  1176. void Created(GameObject * obj)
  1177. {
  1178. has_been_poked = false;
  1179. }
  1180. void Poked(GameObject * obj, GameObject * poker)
  1181. {
  1182. if (!has_been_poked && Commands->Is_A_Star(poker))
  1183. {
  1184. has_been_poked = true;
  1185. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 308, 1, 0);
  1186. int id = Commands->Create_Conversation("M03CON008", 99, 2000, true);
  1187. Commands->Join_Conversation(NULL, id);
  1188. Commands->Join_Conversation(NULL, id);
  1189. Commands->Start_Conversation(id, 100008);
  1190. Commands->Monitor_Conversation(obj, id);
  1191. }
  1192. }
  1193. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  1194. {
  1195. if (action_id == 100008)
  1196. {
  1197. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), SAKURA_DOGFIGHT, 0);
  1198. /*int id = Commands->Create_Conversation("M03CON010", 99, 2000, true);
  1199. Commands->Join_Conversation(NULL, id);
  1200. Commands->Start_Conversation(id, 100010);
  1201. Commands->Monitor_Conversation(obj, id);*/
  1202. //Commands->Grant_Key(STAR, 2, true);
  1203. //Commands->Grant_Key(STAR, 3, true);
  1204. Commands->Grant_Key(STAR, 5, false);
  1205. Vector3 sakura_pos;
  1206. sakura_pos.Set(-160.690f, 76.470f, 16.270f);
  1207. Commands->Create_Object("Boss", sakura_pos);
  1208. }
  1209. if (action_id == 100010)
  1210. {
  1211. //Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 308, 1, 0);
  1212. }
  1213. }
  1214. void Damaged(GameObject * obj, GameObject * damager, float amount)
  1215. {
  1216. Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
  1217. }
  1218. };
  1219. DECLARE_SCRIPT(RMV_Volcano_And_Lava_Ball_Creator, "")
  1220. {
  1221. int last;
  1222. REGISTER_VARIABLES()
  1223. {
  1224. SAVE_VARIABLE(last, 1);
  1225. }
  1226. void Created(GameObject * obj)
  1227. {
  1228. last = -1;
  1229. Commands->Enable_Cinematic_Freeze( obj, false );
  1230. }
  1231. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  1232. {
  1233. if ((type == 500) && (param == 500))
  1234. {
  1235. Commands->Reveal_Encyclopedia_Character ( 39 );//sakura
  1236. Commands->Reveal_Encyclopedia_Vehicle ( 31 );//sakura's comanche
  1237. Commands->Enable_Cinematic_Freeze( obj, false );
  1238. int id = Commands->Create_Conversation("M03CON010", 99, 2000, true);
  1239. Commands->Join_Conversation(NULL, id);
  1240. Commands->Start_Conversation(id, 100010);
  1241. Commands->Monitor_Conversation(obj, id);
  1242. Commands->Set_Ash(0.15f, 3.0f, false);
  1243. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), DOGFIGHT_ENDED, 0);
  1244. Commands->Set_Clouds (1.0f, 1.0f, 20);
  1245. /*int id = Commands->Create_Conversation("M03CON010", 99, 2000, true);
  1246. Commands->Join_Conversation(NULL, id);
  1247. Commands->Join_Conversation(STAR, id);
  1248. Commands->Start_Conversation(id, 100010);
  1249. Commands->Monitor_Conversation(obj, id);*/
  1250. Commands->Start_Timer(obj, this, 55.0, MESSAGE_DELAY);
  1251. Commands->Start_Timer(obj, this, 10.0, ANNOUNCEMENT_DELAY);
  1252. Commands->Start_Timer (obj, this, 0.1f, 1001);
  1253. GameObject *temp = Commands->Find_Object(1144977);
  1254. if (temp)
  1255. {
  1256. Commands->Send_Custom_Event(obj, temp, 100, 100);
  1257. }
  1258. Commands->Create_Object("Volcano Controller", Vector3(0,0,0));
  1259. }
  1260. }
  1261. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason complete_reason)
  1262. {
  1263. if (action_id == 100010)
  1264. {
  1265. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 310, 3, 0);
  1266. }
  1267. }
  1268. void Timer_Expired (GameObject * obj, int timer_id)
  1269. {
  1270. if (timer_id == 1001)
  1271. {
  1272. float rnd_val;
  1273. int rnd_int_val;
  1274. rnd_val = Commands->Get_Random(0.0f,1.0f) * 20;
  1275. rnd_int_val = int(rnd_val);
  1276. if (rnd_int_val == last)
  1277. {
  1278. ++rnd_int_val %= 20;
  1279. }
  1280. if (rnd_int_val > 19) {
  1281. rnd_int_val = 19;
  1282. }
  1283. switch (rnd_int_val)
  1284. {
  1285. case (0):
  1286. {
  1287. Commands->Create_Object ("LavaBall01", Vector3(0,0,0));
  1288. break;
  1289. }
  1290. case (1):
  1291. {
  1292. Commands->Create_Object ("LavaBall02", Vector3(0,0,0));
  1293. break;
  1294. }
  1295. case (2):
  1296. {
  1297. Commands->Create_Object ("LavaBall03", Vector3(0,0,0));
  1298. break;
  1299. }
  1300. case (3):
  1301. {
  1302. Commands->Create_Object ("LavaBall04", Vector3(0,0,0));
  1303. break;
  1304. }
  1305. case (4):
  1306. {
  1307. Commands->Create_Object ("LavaBall05", Vector3(0,0,0));
  1308. break;
  1309. }
  1310. case (5):
  1311. {
  1312. Commands->Create_Object ("LavaBall06", Vector3(0,0,0));
  1313. break;
  1314. }
  1315. case (6):
  1316. {
  1317. Commands->Create_Object ("LavaBall07", Vector3(0,0,0));
  1318. break;
  1319. }
  1320. case (7):
  1321. {
  1322. Commands->Create_Object ("LavaBall08", Vector3(0,0,0));
  1323. break;
  1324. }
  1325. case (8):
  1326. {
  1327. Commands->Create_Object ("LavaBall09", Vector3(0,0,0));
  1328. break;
  1329. }
  1330. case (9):
  1331. {
  1332. Commands->Create_Object ("LavaBall10", Vector3(0,0,0));
  1333. break;
  1334. }
  1335. case (10):
  1336. {
  1337. Commands->Create_Object ("LavaBall11", Vector3(0,0,0));
  1338. break;
  1339. }
  1340. case (11):
  1341. {
  1342. Commands->Create_Object ("LavaBall12", Vector3(0,0,0));
  1343. break;
  1344. }
  1345. case (12):
  1346. {
  1347. Commands->Create_Object ("LavaBall13", Vector3(0,0,0));
  1348. break;
  1349. }
  1350. case (13):
  1351. {
  1352. Commands->Create_Object ("LavaBall14", Vector3(0,0,0));
  1353. break;
  1354. }
  1355. case (14):
  1356. {
  1357. Commands->Create_Object ("LavaBall15", Vector3(0,0,0));
  1358. break;
  1359. }
  1360. case (15):
  1361. {
  1362. Commands->Create_Object ("LavaBall16", Vector3(0,0,0));
  1363. break;
  1364. }
  1365. case (16):
  1366. {
  1367. Commands->Create_Object ("LavaBall17", Vector3(0,0,0));
  1368. break;
  1369. }
  1370. case (17):
  1371. {
  1372. Commands->Create_Object ("LavaBall18", Vector3(0,0,0));
  1373. break;
  1374. }
  1375. case (18):
  1376. {
  1377. Commands->Create_Object ("LavaBall19", Vector3(0,0,0));
  1378. break;
  1379. }
  1380. case (19):
  1381. {
  1382. Commands->Create_Object ("LavaBall20", Vector3(0,0,0));
  1383. break;
  1384. }
  1385. }
  1386. last = rnd_int_val;
  1387. rnd_val = Commands->Get_Random(3.0f,5.0f) + 2.0f;
  1388. Commands->Start_Timer (obj, this, rnd_val, 1001);
  1389. }
  1390. }
  1391. };
  1392. DECLARE_SCRIPT(M03_CommCenter_SateliteDish_Controller_JDG, "")
  1393. {
  1394. int start_sounds;
  1395. int stop_sounds;
  1396. int play_sounds;
  1397. REGISTER_VARIABLES()
  1398. {
  1399. SAVE_VARIABLE( start_sounds, 1 );
  1400. SAVE_VARIABLE( stop_sounds, 2 );
  1401. SAVE_VARIABLE( play_sounds, 3 );
  1402. }
  1403. void Created( GameObject * obj )
  1404. {
  1405. start_sounds = 100;
  1406. stop_sounds = 101;
  1407. play_sounds = 102;
  1408. if (obj) {
  1409. Commands->Send_Custom_Event( obj, obj, 0, start_sounds, 0 );
  1410. }
  1411. }
  1412. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1413. {
  1414. if (param == stop_sounds)
  1415. {
  1416. }
  1417. if (param == start_sounds)
  1418. {
  1419. if (obj) {
  1420. Commands->Send_Custom_Event( obj, obj, 0, play_sounds, 0 );
  1421. }
  1422. }
  1423. if (param == play_sounds)
  1424. {
  1425. char *soundName = "Satelite Dish Moving Twiddler";
  1426. Vector3 soundPosition (-110.26f, 41.30f, 19.37f);
  1427. Commands->Create_Sound ( soundName, soundPosition, obj );
  1428. float delayTimer = Commands->Get_Random ( 0, 3 );
  1429. if (obj) {
  1430. Commands->Send_Custom_Event( obj, obj, 0, play_sounds, delayTimer );
  1431. }
  1432. }
  1433. }
  1434. };
  1435. /*DECLARE_SCRIPT(M03_Refinery_Crusher_Controller_JDG, "")
  1436. {
  1437. int start_sounds;
  1438. int stop_sounds;
  1439. int play_sounds;
  1440. REGISTER_VARIABLES()
  1441. {
  1442. SAVE_VARIABLE( start_sounds, 1 );
  1443. SAVE_VARIABLE( stop_sounds, 2 );
  1444. SAVE_VARIABLE( play_sounds, 3 );
  1445. }
  1446. void Created( GameObject * obj )
  1447. {
  1448. start_sounds = 100;
  1449. stop_sounds = 101;
  1450. play_sounds = 102;
  1451. if (obj) {
  1452. Commands->Send_Custom_Event( obj, obj, 0, start_sounds, 0 );
  1453. }
  1454. }
  1455. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1456. {
  1457. if (param == stop_sounds)
  1458. {
  1459. }
  1460. if (param == start_sounds)
  1461. {
  1462. if (obj) {
  1463. Commands->Send_Custom_Event( obj, obj, 0, play_sounds, 0 );
  1464. }
  1465. }
  1466. if (param == play_sounds)
  1467. {
  1468. char *soundName = "Refinery Crusher Twiddler";
  1469. Vector3 soundPosition (-179.60f, -2.03f, 3.42f);
  1470. Commands->Create_Sound ( soundName, soundPosition, obj );
  1471. float delayTimer = Commands->Get_Random ( 0, 5 );
  1472. if (obj) {
  1473. Commands->Send_Custom_Event( obj, obj, 0, play_sounds, delayTimer );
  1474. }
  1475. }
  1476. }
  1477. };*/
  1478. DECLARE_SCRIPT(M03_Ambient_Birdcall_Controller_JDG, "")
  1479. {
  1480. int start_birdcalls;
  1481. int stop_birdcalls;
  1482. int pick_birdcall;
  1483. int play_birdcall;
  1484. REGISTER_VARIABLES()
  1485. {
  1486. SAVE_VARIABLE( start_birdcalls, 1 );
  1487. SAVE_VARIABLE( stop_birdcalls, 2 );
  1488. SAVE_VARIABLE( pick_birdcall, 3 );
  1489. SAVE_VARIABLE( play_birdcall, 4 );
  1490. }
  1491. void Created( GameObject * obj )
  1492. {
  1493. start_birdcalls = 100;
  1494. stop_birdcalls = 101;
  1495. play_birdcall = 102;
  1496. if (obj) {
  1497. Commands->Send_Custom_Event( obj, obj, 0, start_birdcalls, 0 );
  1498. }
  1499. }
  1500. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1501. {
  1502. if (param == stop_birdcalls)
  1503. {
  1504. }
  1505. if (param == start_birdcalls)
  1506. {
  1507. if (obj) {
  1508. Commands->Send_Custom_Event( obj, obj, 0, play_birdcall, 0 );
  1509. }
  1510. }
  1511. if (param == play_birdcall)
  1512. {
  1513. char *soundName = "Birdcall Twiddler";
  1514. Vector3 soundPosition;
  1515. GameObject * star = Commands->Get_A_Star (Vector3(0.0f,0.0f,0.0f));
  1516. if ( star != NULL )
  1517. {
  1518. Vector3 playerPosition = Commands->Get_Position ( star );
  1519. float x_factor = Commands->Get_Random(-15,15);
  1520. float y_factor = Commands->Get_Random(-15,15);
  1521. float z_factor = Commands->Get_Random(5,15);
  1522. soundPosition.X = playerPosition.X + x_factor;
  1523. soundPosition.Y = playerPosition.Y + y_factor;
  1524. soundPosition.Z = playerPosition.Z + z_factor;
  1525. Commands->Create_Sound ( soundName, soundPosition, obj );
  1526. }
  1527. float delayTimer = Commands->Get_Random ( 0, 15 );
  1528. if (obj) {
  1529. Commands->Send_Custom_Event( obj, obj, 0, play_birdcall, delayTimer );
  1530. }
  1531. }
  1532. }
  1533. void Entered( GameObject * obj, GameObject * enterer )
  1534. {
  1535. if ( Commands->Is_A_Star( enterer ))
  1536. {
  1537. Commands->Destroy_Object ( obj );
  1538. }
  1539. }
  1540. };
  1541. /*
  1542. 01-I000E "Core temperture fluctuating."
  1543. 01-I002E "Extended exposure to core environment is hazardous."
  1544. 01-I004E "Power output exceeding optimal levels."
  1545. 01-I006E "Radiation levels fluctuating."
  1546. 01-I008E "Radiation hazard. Proper safety equipment is required."
  1547. 01-I010E "If the decontamination shower does not function, contact a technician immediately."
  1548. 01-I012E "Tertiary coolant system malfunctioning. Dispatch technician immediately."
  1549. 01-I014E "Comm Center power demands have fallen. Diverting power to secondary grid."
  1550. 01-I016E "Power production levels wavering."
  1551. 01-I018E "Critical failure potential increasing. Reallocate available engineers."
  1552. 01-I020E "Tertiary grid demands increasing; diverting surplus power."
  1553. 01-I022E "Proper Identification must be worn at all times."
  1554. 01-I024E "Secondary power grid has been taken offline. Tertiary grid surplus being redirected."
  1555. 01-I026E "Power core radiation levels vacillating."
  1556. 01-I050E "Do you know someone who would make a positive addition to the Brotherhood? Now they can enlist online at 'WWW dot BrotherhoodRecruitment dot Nod' "
  1557. 01-I062E "Immediately report the presence of visceroids to your supervisor."
  1558. 01-I066E "Workers found loitering in this area will be terminated."
  1559. 01-I076E "Hazmat suits are required for your safety."
  1560. 01-I078E "Please do not inhale decontamination agents."
  1561. */
  1562. DECLARE_SCRIPT(M03_Announce_PowerPlant_Controller_JDG, "")
  1563. {
  1564. int total_number_of_sounds;
  1565. float announce_delay_min;
  1566. float announce_delay_max;
  1567. int start_announcements;
  1568. int stop_announcements;
  1569. int pick_sound;
  1570. int play_sound;
  1571. int play_klaxon;
  1572. int sound;
  1573. int klaxon;
  1574. Vector3 spkr_1_spot;
  1575. Vector3 spkr_2_spot;
  1576. Vector3 spkr_3_spot;
  1577. Vector3 spkr_4_spot;
  1578. Vector3 spkr_5_spot;
  1579. Vector3 spkr_6_spot;
  1580. Vector3 spkr_7_spot;
  1581. REGISTER_VARIABLES()
  1582. {
  1583. SAVE_VARIABLE( total_number_of_sounds, 1 );
  1584. SAVE_VARIABLE( announce_delay_min, 2 );
  1585. SAVE_VARIABLE( announce_delay_max, 3 );
  1586. SAVE_VARIABLE( start_announcements, 4 );
  1587. SAVE_VARIABLE( stop_announcements, 5 );
  1588. SAVE_VARIABLE( pick_sound, 6 );
  1589. SAVE_VARIABLE( play_sound, 7 );
  1590. SAVE_VARIABLE( play_klaxon, 8 );
  1591. SAVE_VARIABLE( sound, 9 );
  1592. SAVE_VARIABLE( klaxon, 10 );
  1593. SAVE_VARIABLE( spkr_1_spot, 11 );
  1594. SAVE_VARIABLE( spkr_2_spot, 12 );
  1595. SAVE_VARIABLE( spkr_3_spot, 13 );
  1596. SAVE_VARIABLE( spkr_4_spot, 14 );
  1597. SAVE_VARIABLE( spkr_5_spot, 15 );
  1598. SAVE_VARIABLE( spkr_6_spot, 16 );
  1599. SAVE_VARIABLE( spkr_7_spot, 17 );
  1600. }
  1601. void Created( GameObject * obj )
  1602. {
  1603. total_number_of_sounds = 15;
  1604. announce_delay_min = 20.0;
  1605. announce_delay_max = 30.0;
  1606. start_announcements = 20;
  1607. stop_announcements = 21;
  1608. pick_sound = 22;
  1609. play_sound = 23;
  1610. play_klaxon = 24;
  1611. spkr_1_spot.Set(-60.55f,13.55f,-9.69f);
  1612. spkr_2_spot.Set(-65.74f,15.17f,-8.71f);
  1613. spkr_3_spot.Set(-63.75f,22.49f,-7.81f);
  1614. spkr_4_spot.Set(-63.00f,22.05f,-.70f);
  1615. spkr_5_spot.Set(-75.75f,28.92f,-14.77f);
  1616. spkr_6_spot.Set(-64.98f,20.41f,-13.62f);
  1617. spkr_7_spot.Set(-58.05f,7.45f,-14.20f);
  1618. if (obj) {
  1619. Commands->Send_Custom_Event( obj, obj, 0, start_announcements, 0 );
  1620. }
  1621. }
  1622. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1623. {
  1624. if (param == stop_announcements)
  1625. {
  1626. }
  1627. else if (param == start_announcements)
  1628. {
  1629. if (obj) {
  1630. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, 0 );
  1631. }
  1632. }
  1633. else if (param == play_klaxon)
  1634. {
  1635. char *klaxonNames[2] = {
  1636. "Klaxon Warning",
  1637. "Klaxon Info"
  1638. };
  1639. char *klaxonName = klaxonNames[klaxon];
  1640. Commands->Create_Sound ( klaxonName, spkr_1_spot, obj );
  1641. Commands->Create_Sound ( klaxonName, spkr_2_spot, obj );
  1642. Commands->Create_Sound ( klaxonName, spkr_3_spot, obj );
  1643. Commands->Create_Sound ( klaxonName, spkr_4_spot, obj );
  1644. Commands->Create_Sound ( klaxonName, spkr_5_spot, obj );
  1645. Commands->Create_Sound ( klaxonName, spkr_6_spot, obj );
  1646. Commands->Create_Sound ( klaxonName, spkr_7_spot, obj );
  1647. if (obj) {
  1648. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 1.25 );
  1649. }
  1650. }
  1651. else if (param == play_sound)
  1652. {
  1653. char *sounds[19] = {
  1654. "01-i000e",
  1655. "01-i002e",
  1656. "01-i004e",
  1657. "01-i006e",
  1658. "01-i008e",
  1659. "01-i010e",
  1660. "01-i012e",
  1661. "01-i014e",
  1662. "01-i016e",
  1663. "01-i018e",
  1664. "01-i020e",
  1665. "01-i024e",
  1666. "01-i026e",
  1667. "01-i050e",
  1668. "01-i062e",
  1669. "01-i066e",
  1670. "01-i076e",
  1671. "01-i078e",
  1672. "01-i022e"
  1673. };
  1674. char *soundName;
  1675. soundName = sounds[sound];
  1676. Commands->Create_Sound ( soundName, spkr_1_spot, obj );
  1677. Commands->Create_Sound ( soundName, spkr_2_spot, obj );
  1678. Commands->Create_Sound ( soundName, spkr_3_spot, obj );
  1679. Commands->Create_Sound ( soundName, spkr_4_spot, obj );
  1680. Commands->Create_Sound ( soundName, spkr_5_spot, obj );
  1681. Commands->Create_Sound ( soundName, spkr_6_spot, obj );
  1682. Commands->Create_Sound ( soundName, spkr_7_spot, obj );
  1683. float delayTimer = Commands->Get_Random ( announce_delay_min, announce_delay_max );
  1684. if (obj) {
  1685. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, delayTimer );
  1686. }
  1687. }
  1688. else if (param == pick_sound)
  1689. {
  1690. float lineNumber = Commands->Get_Random ( 0.5f, total_number_of_sounds+0.5);
  1691. if ((lineNumber >= 0.5) && (lineNumber < 1.5))
  1692. {
  1693. //klaxonName = "Klaxon Warning";
  1694. klaxon = 0;
  1695. //soundName = "01-i000e";
  1696. sound = 0;
  1697. //01-I000E "Core temperture fluctuating."
  1698. if (obj) {
  1699. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1700. }
  1701. }
  1702. else if ((lineNumber >= 1.5) && (lineNumber < 2.5))
  1703. {
  1704. //soundName = "01-i002e";
  1705. sound = 1;
  1706. if (obj) {
  1707. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1708. }
  1709. }
  1710. else if ((lineNumber >= 2.5) && (lineNumber < 3.5))
  1711. {
  1712. //klaxonName = "Klaxon Warning";
  1713. klaxon = 0;
  1714. //soundName = "01-i004e";
  1715. sound = 2;
  1716. //01-I004E "Power output exceeding optimal levels."
  1717. if (obj) {
  1718. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1719. }
  1720. }
  1721. else if ((lineNumber >= 3.5) && (lineNumber < 4.5))
  1722. {
  1723. //klaxonName = "Klaxon Warning";
  1724. klaxon = 0;
  1725. //soundName = "01-i006e";
  1726. sound = 3;
  1727. //01-I006E "Radiation levels fluctuating."
  1728. if (obj) {
  1729. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1730. }
  1731. }
  1732. else if ((lineNumber >= 4.5) && (lineNumber < 5.5))
  1733. {
  1734. //soundName = "01-i008e";
  1735. sound = 4;
  1736. if (obj) {
  1737. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1738. }
  1739. }
  1740. else if ((lineNumber >= 5.5) && (lineNumber < 6.5))
  1741. {
  1742. //soundName = "01-i010e";
  1743. sound = 5;
  1744. if (obj) {
  1745. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1746. }
  1747. }
  1748. else if ((lineNumber >= 6.5) && (lineNumber < 7.5))
  1749. {
  1750. //klaxonName = "Klaxon Warning";
  1751. klaxon = 0;
  1752. //soundName = "01-i012e";
  1753. sound = 6;
  1754. //01-I012E "Tertiary coolant system malfunctioning. Dispatch technician immediately."
  1755. if (obj) {
  1756. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1757. }
  1758. }
  1759. else if ((lineNumber >= 7.5) && (lineNumber < 8.5))
  1760. {
  1761. //klaxonName = "Klaxon Info";
  1762. klaxon = 1;
  1763. //soundName = "01-i014e";
  1764. sound = 7;
  1765. //01-I014E "Comm Center power demands have fallen. Diverting power to secondary grid."
  1766. if (obj) {
  1767. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1768. }
  1769. }
  1770. else if ((lineNumber >= 8.5) && (lineNumber < 9.5))
  1771. {
  1772. //klaxonName = "Klaxon Warning";
  1773. klaxon = 0;
  1774. //soundName = "01-i016e";
  1775. sound = 8;
  1776. //01-I016E "Power production levels wavering."
  1777. if (obj) {
  1778. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1779. }
  1780. }
  1781. else if ((lineNumber >= 9.5) && (lineNumber < 10.5))
  1782. {
  1783. //klaxonName = "Klaxon Warning";
  1784. klaxon = 0;
  1785. //soundName = "01-i018e";
  1786. sound = 9;
  1787. //01-I018E "Critical failure potential increasing. Reallocate available engineers."
  1788. if (obj) {
  1789. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1790. }
  1791. }
  1792. else if ((lineNumber >= 10.5) && (lineNumber < 11.5))
  1793. {
  1794. //soundName = "01-i020e";
  1795. sound = 10;
  1796. if (obj) {
  1797. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1798. }
  1799. }
  1800. else if ((lineNumber >= 11.5) && (lineNumber < 12.5))
  1801. {
  1802. //soundName = "01-i024e";
  1803. sound = 11;
  1804. if (obj) {
  1805. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1806. }
  1807. }
  1808. else if ((lineNumber >= 12.5) && (lineNumber < 13.5))
  1809. {
  1810. //klaxonName = "Klaxon Warning";
  1811. klaxon = 0;
  1812. //soundName = "01-i026e";
  1813. sound = 12;
  1814. //01-I026E "Power core radiation levels vacillating."
  1815. if (obj) {
  1816. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  1817. }
  1818. }
  1819. else if ((lineNumber >= 13.5) && (lineNumber < 14.5))
  1820. {
  1821. //soundName = "01-i050e";
  1822. sound = 13;
  1823. if (obj) {
  1824. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1825. }
  1826. }
  1827. else if ((lineNumber >= 14.5) && (lineNumber < 15.5))
  1828. {
  1829. //soundName = "01-i062e";
  1830. sound = 14;
  1831. if (obj) {
  1832. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1833. }
  1834. }
  1835. else if ((lineNumber >= 15.5) && (lineNumber < 16.5))
  1836. {
  1837. //soundName = "01-i066e";
  1838. sound = 15;
  1839. if (obj) {
  1840. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1841. }
  1842. }
  1843. else if ((lineNumber >= 16.5) && (lineNumber < 17.5))
  1844. {
  1845. //soundName = "01-i076e";
  1846. sound = 16;
  1847. if (obj) {
  1848. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1849. }
  1850. }
  1851. else if ((lineNumber >= 17.5) && (lineNumber < 18.5))
  1852. {
  1853. //soundName = "01-i078e";
  1854. sound = 17;
  1855. if (obj) {
  1856. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1857. }
  1858. }
  1859. else
  1860. {
  1861. //soundName = "01-i022e";
  1862. sound = 18;
  1863. if (obj) {
  1864. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1865. }
  1866. }
  1867. }
  1868. }
  1869. void Killed( GameObject * obj, GameObject * killer )
  1870. {
  1871. //soundName = "Klaxon Loop";
  1872. //Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  1873. }
  1874. };
  1875. /*
  1876. The following is a list of all level 3 refinery related dialogs
  1877. Line # Dialog
  1878. 01-i010E "If the decontamination shower does not function, contact a technician immediately."
  1879. 01-i022E "Proper Identification must be worn at all times."
  1880. 01-i032E "A visceroid has been spotted in Tiberium Field iota. Containment team en route."
  1881. 01-i034E "Tiberium value is increasing Worldwide."
  1882. 01-i052E "The yellow zone is for harvester unloading only. There is no parking in the yellow zone."
  1883. 01-i054E "Harvester approaching. Please clear docking bay at once." Only plays when harvester is approaching.
  1884. 01-i056E "Harvester now unloading"
  1885. 01-i058E "Smoking is not permitted within the refinery."
  1886. 01-i060E "Leaking barrels are a health hazard. Report any faulty containment vessels to your supervisor immediately."
  1887. 01-i062E "Immediately report the presence of visceroids to your supervisor."
  1888. 01-i064E "Do not discharge weapons near containment barrels."
  1889. 01-i066E "Workers found loitering in this area will be terminated."
  1890. 01-i068E "For your safety, avoid all moving parts."
  1891. 01-i070E "Supply trucks have the right of way."
  1892. 01-i072E "Tiberium field omega has decreased in size. Changing harvester target to facilitate growth."
  1893. 01-i074E "Additional tests are required for current Tiberium batch. Highest priority."
  1894. 01-i076E "Hazmat suits are required for your safety."
  1895. 01-i078E "Please do not inhale decontamination agents."
  1896. 01-i080E "Quarternary gas vacuum has malfunctioned. Backup compressors are now on line."
  1897. 01-i082E "Blockage in left ventricle of secondary crushing unit."
  1898. 01-i084E "Refinery reagents are a biohazard. Report all leaks immediately."
  1899. 01-i086E "Hydroxyl levels at supersaturation. Venting protocols initiated."
  1900. 01-i088E "Uranium fuel levels nominal."
  1901. 01-i090E "Smelting furnace fully operational."
  1902. 01-i092E "SPF 128 required while working under the Ultra Violet lights."
  1903. 01-i094E "Polarized safety goggles are mandatory while working under the Ultra Violet lights."
  1904. 01-i096E "Distiller fumes are toxic. Avoid inhaling any gasses in this area."
  1905. 01-i098E "Tiberium only to be distilled in this area."
  1906. */
  1907. DECLARE_SCRIPT(M03_Announce_Refinery_Controller_JDG, "")
  1908. {
  1909. int total_number_of_sounds;
  1910. float announce_delay_min;
  1911. float announce_delay_max;
  1912. int start_announcements;
  1913. int stop_announcements;
  1914. int pick_sound;
  1915. int play_sound;
  1916. int play_klaxon;
  1917. int sound;
  1918. int klaxon;
  1919. Vector3 spkr_1_spot;
  1920. Vector3 spkr_2_spot;
  1921. Vector3 spkr_3_spot;
  1922. Vector3 spkr_4_spot;
  1923. Vector3 spkr_5_spot;
  1924. Vector3 spkr_6_spot;
  1925. Vector3 spkr_7_spot;
  1926. Vector3 spkr_8_spot;
  1927. Vector3 spkr_9_spot;
  1928. Vector3 spkr_10_spot;
  1929. Vector3 spkr_11_spot;
  1930. Vector3 spkr_12_spot;
  1931. Vector3 spkr_13_spot;
  1932. Vector3 spkr_14_spot;
  1933. Vector3 spkr_15_spot;
  1934. Vector3 spkr_16_spot;
  1935. Vector3 spkr_17_spot;
  1936. REGISTER_VARIABLES()
  1937. {
  1938. SAVE_VARIABLE( total_number_of_sounds, 1 );
  1939. SAVE_VARIABLE( announce_delay_min, 2 );
  1940. SAVE_VARIABLE( announce_delay_max, 3 );
  1941. SAVE_VARIABLE( start_announcements, 4 );
  1942. SAVE_VARIABLE( stop_announcements, 5 );
  1943. SAVE_VARIABLE( pick_sound, 6 );
  1944. SAVE_VARIABLE( play_sound, 7 );
  1945. SAVE_VARIABLE( play_klaxon, 8 );
  1946. SAVE_VARIABLE( sound, 9 );
  1947. SAVE_VARIABLE( klaxon, 10 );
  1948. SAVE_VARIABLE( spkr_1_spot, 11 );
  1949. SAVE_VARIABLE( spkr_2_spot, 12 );
  1950. SAVE_VARIABLE( spkr_3_spot, 13 );
  1951. SAVE_VARIABLE( spkr_4_spot, 14 );
  1952. SAVE_VARIABLE( spkr_5_spot, 15 );
  1953. SAVE_VARIABLE( spkr_6_spot, 16 );
  1954. SAVE_VARIABLE( spkr_7_spot, 17 );
  1955. SAVE_VARIABLE( spkr_8_spot, 18 );
  1956. SAVE_VARIABLE( spkr_8_spot, 19 );
  1957. SAVE_VARIABLE( spkr_10_spot, 20 );
  1958. SAVE_VARIABLE( spkr_11_spot, 21 );
  1959. SAVE_VARIABLE( spkr_12_spot, 22 );
  1960. SAVE_VARIABLE( spkr_13_spot, 23 );
  1961. SAVE_VARIABLE( spkr_14_spot, 24 );
  1962. SAVE_VARIABLE( spkr_15_spot, 25 );
  1963. SAVE_VARIABLE( spkr_16_spot, 26 );
  1964. SAVE_VARIABLE( spkr_17_spot, 27 );
  1965. }
  1966. void Created( GameObject * obj )
  1967. {
  1968. total_number_of_sounds = 28;
  1969. announce_delay_min = 20.0;
  1970. announce_delay_max = 30.0;
  1971. start_announcements = 20;
  1972. stop_announcements = 21;
  1973. pick_sound = 22;
  1974. play_sound = 23;
  1975. play_klaxon = 24;
  1976. spkr_1_spot.Set(-156.3f,28.40f,-10.07f);
  1977. spkr_2_spot.Set(-172.19f,28.91f,-10.08f);
  1978. spkr_3_spot.Set(-144.46f,17.18f,-10.0f);
  1979. spkr_4_spot.Set(-136.33f,1.47f,-10.63f);
  1980. spkr_5_spot.Set(-139.38f,-14.86f,-10.79f);
  1981. spkr_6_spot.Set(-146.76f,-27.75f,-10.24f);
  1982. spkr_7_spot.Set(-134.95f,-33.21f,-10.70f);
  1983. spkr_8_spot.Set(-181.62f,16.33f,-10.65f);
  1984. spkr_9_spot.Set(-180.04f,3.15f,-10.16f);
  1985. spkr_10_spot.Set(-178.31f,-13.79f,-10.84f);
  1986. spkr_11_spot.Set(-177.85f,-30.11f,-10.99f);
  1987. spkr_12_spot.Set(-168.09f,-33.71f,-10.01f);
  1988. spkr_13_spot.Set(-156.28f,-39.59f,-10.43f);
  1989. spkr_14_spot.Set(-160.06f,-18.86f,-10.99f);
  1990. spkr_15_spot.Set(-143.87f,-1.17f,-10.99f);
  1991. spkr_16_spot.Set(-159.78f,-1.17f,-10.99f);
  1992. spkr_17_spot.Set(-166.61f,11.61f,-10.99f);
  1993. if (obj) {
  1994. Commands->Send_Custom_Event( obj, obj, 0, start_announcements, 0 );
  1995. }
  1996. }
  1997. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  1998. {
  1999. if (param == stop_announcements)
  2000. {
  2001. }
  2002. else if (param == start_announcements)
  2003. {
  2004. if (obj) {
  2005. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, 0 );
  2006. }
  2007. }
  2008. else if (param == play_klaxon)
  2009. {
  2010. char *klaxonNames[2] = {
  2011. "Klaxon Warning",
  2012. "Klaxon Info"
  2013. };
  2014. char *klaxonName = klaxonNames[klaxon];
  2015. Commands->Create_Sound ( klaxonName, spkr_1_spot, obj );
  2016. Commands->Create_Sound ( klaxonName, spkr_2_spot, obj );
  2017. Commands->Create_Sound ( klaxonName, spkr_3_spot, obj );
  2018. Commands->Create_Sound ( klaxonName, spkr_4_spot, obj );
  2019. Commands->Create_Sound ( klaxonName, spkr_5_spot, obj );
  2020. Commands->Create_Sound ( klaxonName, spkr_6_spot, obj );
  2021. Commands->Create_Sound ( klaxonName, spkr_7_spot, obj );
  2022. Commands->Create_Sound ( klaxonName, spkr_8_spot, obj );
  2023. Commands->Create_Sound ( klaxonName, spkr_9_spot, obj );
  2024. Commands->Create_Sound ( klaxonName, spkr_10_spot, obj );
  2025. Commands->Create_Sound ( klaxonName, spkr_11_spot, obj );
  2026. Commands->Create_Sound ( klaxonName, spkr_12_spot, obj );
  2027. Commands->Create_Sound ( klaxonName, spkr_13_spot, obj );
  2028. Commands->Create_Sound ( klaxonName, spkr_14_spot, obj );
  2029. Commands->Create_Sound ( klaxonName, spkr_15_spot, obj );
  2030. Commands->Create_Sound ( klaxonName, spkr_16_spot, obj );
  2031. Commands->Create_Sound ( klaxonName, spkr_17_spot, obj );
  2032. if (obj) {
  2033. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 1.5 );
  2034. }
  2035. }
  2036. else if (param == play_sound)
  2037. {
  2038. char *sounds[28] = {
  2039. "01-i010E",
  2040. "01-i022E",
  2041. "01-i032E",
  2042. "01-i034E",
  2043. "01-i052E",
  2044. "01-i054E",
  2045. "01-i056E",
  2046. "01-i058E",
  2047. "01-i060E",
  2048. "01-i062E",
  2049. "01-i064E",
  2050. "01-i066E",
  2051. "01-i068E",
  2052. "01-i070E",
  2053. "01-i072E",
  2054. "01-i074E",
  2055. "01-i076E",
  2056. "01-i078E",
  2057. "01-i080E",
  2058. "01-i082E",
  2059. "01-i084E",
  2060. "01-i086E",
  2061. "01-i088E",
  2062. "01-i090E",
  2063. "01-i092E",
  2064. "01-i094E",
  2065. "01-i096E",
  2066. "01-i098E"
  2067. };
  2068. char *soundName = sounds[sound];
  2069. Commands->Create_Sound ( soundName, spkr_1_spot, obj );
  2070. Commands->Create_Sound ( soundName, spkr_2_spot, obj );
  2071. Commands->Create_Sound ( soundName, spkr_3_spot, obj );
  2072. Commands->Create_Sound ( soundName, spkr_4_spot, obj );
  2073. Commands->Create_Sound ( soundName, spkr_5_spot, obj );
  2074. Commands->Create_Sound ( soundName, spkr_6_spot, obj );
  2075. Commands->Create_Sound ( soundName, spkr_7_spot, obj );
  2076. Commands->Create_Sound ( soundName, spkr_8_spot, obj );
  2077. Commands->Create_Sound ( soundName, spkr_9_spot, obj );
  2078. Commands->Create_Sound ( soundName, spkr_10_spot, obj );
  2079. Commands->Create_Sound ( soundName, spkr_11_spot, obj );
  2080. Commands->Create_Sound ( soundName, spkr_12_spot, obj );
  2081. Commands->Create_Sound ( soundName, spkr_13_spot, obj );
  2082. Commands->Create_Sound ( soundName, spkr_14_spot, obj );
  2083. Commands->Create_Sound ( soundName, spkr_15_spot, obj );
  2084. Commands->Create_Sound ( soundName, spkr_16_spot, obj );
  2085. Commands->Create_Sound ( soundName, spkr_17_spot, obj );
  2086. float delayTimer = Commands->Get_Random ( announce_delay_min, announce_delay_max );
  2087. if (obj) {
  2088. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, delayTimer );
  2089. }
  2090. }
  2091. else if (param == pick_sound)
  2092. {
  2093. float lineNumber = Commands->Get_Random ( 0.5f, total_number_of_sounds+0.5);
  2094. if ((lineNumber >= 0.5) && (lineNumber < 1.5))
  2095. {
  2096. //soundName = "01-i074e";
  2097. sound = 0;
  2098. if (obj) {
  2099. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2100. }
  2101. }
  2102. else if ((lineNumber >= 1.5) && (lineNumber < 2.5))
  2103. {
  2104. //klaxonName = "Klaxon Info";
  2105. klaxon = 1;
  2106. //soundName = "01-i032e";
  2107. sound = 1;
  2108. //01-i032E "A visceroid has been spotted in Tiberium Field iota. Containment team en route."
  2109. if (obj) {
  2110. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2111. }
  2112. }
  2113. else if ((lineNumber >= 2.5) && (lineNumber < 3.5))
  2114. {
  2115. //soundName = "01-i034e";
  2116. sound = 2;
  2117. if (obj) {
  2118. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2119. }
  2120. }
  2121. else if ((lineNumber >= 3.5) && (lineNumber < 4.5))
  2122. {
  2123. //soundName = "01-i052e";
  2124. sound = 3;
  2125. if (obj) {
  2126. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2127. }
  2128. }
  2129. else if ((lineNumber >= 4.5) && (lineNumber < 5.5))
  2130. {
  2131. //klaxonName = "Klaxon Warning";
  2132. klaxon = 0;
  2133. //soundName = "01-i054e";
  2134. sound = 4;
  2135. //01-i054E "Harvester approaching. Please clear docking bay at once." Only plays when harvester is approaching.
  2136. if (obj) {
  2137. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2138. }
  2139. }
  2140. else if ((lineNumber >= 5.5) && (lineNumber < 6.5))
  2141. {
  2142. //soundName = "01-i056e";
  2143. sound = 5;
  2144. if (obj) {
  2145. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2146. }
  2147. }
  2148. else if ((lineNumber >= 6.5) && (lineNumber < 7.5))
  2149. {
  2150. //soundName = "01-i058e";
  2151. sound = 6;
  2152. if (obj) {
  2153. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2154. }
  2155. }
  2156. else if ((lineNumber >= 7.5) && (lineNumber < 8.5))
  2157. {
  2158. //soundName = "01-i060e";
  2159. sound = 7;
  2160. if (obj) {
  2161. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2162. }
  2163. }
  2164. else if ((lineNumber >= 8.5) && (lineNumber < 9.5))
  2165. {
  2166. //soundName = "01-i062e";
  2167. sound = 8;
  2168. if (obj) {
  2169. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2170. }
  2171. }
  2172. else if ((lineNumber >= 9.5) && (lineNumber < 10.5))
  2173. {
  2174. //soundName = "01-i064e";
  2175. sound = 9;
  2176. if (obj) {
  2177. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2178. }
  2179. }
  2180. else if ((lineNumber >= 10.5) && (lineNumber < 11.5))
  2181. {
  2182. //soundName = "01-i066e";
  2183. sound = 10;
  2184. if (obj) {
  2185. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2186. }
  2187. }
  2188. else if ((lineNumber >= 11.5) && (lineNumber < 12.5))
  2189. {
  2190. //soundName = "01-i068e";
  2191. sound = 11;
  2192. if (obj) {
  2193. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2194. }
  2195. }
  2196. else if ((lineNumber >= 12.5) && (lineNumber < 13.5))
  2197. {
  2198. //soundName = "01-i070e";
  2199. sound = 12;
  2200. if (obj) {
  2201. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2202. }
  2203. }
  2204. else if ((lineNumber >= 13.5) && (lineNumber < 14.5))
  2205. {
  2206. //klaxonName = "Klaxon Info";
  2207. klaxon = 1;
  2208. //soundName = "01-i072e";
  2209. sound = 13;
  2210. //01-i072E "Tiberium field omega has decreased in size. Changing harvester target to facilitate growth."
  2211. if (obj) {
  2212. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2213. }
  2214. }
  2215. else if ((lineNumber >= 14.5) && (lineNumber < 15.5))
  2216. {
  2217. //klaxonName = "Klaxon Warning";
  2218. klaxon = 0;
  2219. //soundName = "01-i074e";
  2220. sound = 14;
  2221. //01-i074E "Additional tests are required for current Tiberium batch. Highest priority."
  2222. if (obj) {
  2223. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2224. }
  2225. }
  2226. else if ((lineNumber >= 15.5) && (lineNumber < 16.5))
  2227. {
  2228. //soundName = "01-i076e";
  2229. sound = 15;
  2230. if (obj) {
  2231. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2232. }
  2233. }
  2234. else if ((lineNumber >= 16.5) && (lineNumber < 17.5))
  2235. {
  2236. //soundName = "01-i078e";
  2237. sound = 16;
  2238. if (obj) {
  2239. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2240. }
  2241. }
  2242. else if ((lineNumber >= 17.5) && (lineNumber < 18.5))
  2243. {
  2244. //klaxonName = "Klaxon Info";
  2245. klaxon = 1;
  2246. //soundName = "01-i080e";
  2247. sound = 17;
  2248. //01-i080E "Quarternary gas vacuum has malfunctioned. Backup compressors are now on line."
  2249. if (obj) {
  2250. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2251. }
  2252. }
  2253. else if ((lineNumber >= 18.5) && (lineNumber < 19.5))
  2254. {
  2255. //klaxonName = "Klaxon Warning";
  2256. klaxon = 0;
  2257. //soundName = "01-i082e";
  2258. sound = 18;
  2259. //01-i082E "Blockage in left ventricle of secondary crushing unit."
  2260. if (obj) {
  2261. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2262. }
  2263. }
  2264. else if ((lineNumber >= 19.5) && (lineNumber < 20.5))
  2265. {
  2266. //soundName = "01-i084e";
  2267. sound = 19;
  2268. if (obj) {
  2269. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2270. };
  2271. }
  2272. else if ((lineNumber >= 20.5) && (lineNumber < 21.5))
  2273. {
  2274. //klaxonName = "Klaxon Info";
  2275. klaxon = 1;
  2276. //soundName = "01-i086e";
  2277. sound = 20;
  2278. //01-i086E "Hydroxyl levels at supersaturation. Venting protocols initiated."
  2279. if (obj) {
  2280. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2281. }
  2282. }
  2283. else if ((lineNumber >= 21.5) && (lineNumber < 22.5))
  2284. {
  2285. //soundName = "01-i088e";
  2286. sound = 21;
  2287. if (obj) {
  2288. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2289. }
  2290. }
  2291. else if ((lineNumber >= 22.5) && (lineNumber < 23.5))
  2292. {
  2293. //soundName = "01-i090e";
  2294. sound = 22;
  2295. if (obj) {
  2296. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2297. }
  2298. }
  2299. else if ((lineNumber >= 23.5) && (lineNumber < 24.5))
  2300. {
  2301. //soundName = "01-i092e";
  2302. sound = 23;
  2303. if (obj) {
  2304. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2305. }
  2306. }
  2307. else if ((lineNumber >= 24.5) && (lineNumber < 25.5))
  2308. {
  2309. //soundName = "01-i094e";
  2310. sound = 24;
  2311. if (obj) {
  2312. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2313. }
  2314. }
  2315. else if ((lineNumber >= 25.5) && (lineNumber < 26.5))
  2316. {
  2317. //soundName = "01-i096e";
  2318. sound = 25;
  2319. if (obj) {
  2320. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2321. }
  2322. }
  2323. else if ((lineNumber >= 26.5) && (lineNumber < 27.5))
  2324. {
  2325. //soundName = "01-i098e";
  2326. sound = 26;
  2327. if (obj) {
  2328. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2329. }
  2330. }
  2331. else
  2332. {
  2333. //soundName = "01-i022e";
  2334. sound = 27;
  2335. if (obj) {
  2336. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2337. }
  2338. }
  2339. }
  2340. }
  2341. void Killed( GameObject * obj, GameObject * killer )
  2342. {
  2343. //soundName = "Klaxon Loop";
  2344. //Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2345. Commands->Destroy_Object( Commands->Find_Object ( 600067 ) );
  2346. Commands->Destroy_Object( Commands->Find_Object ( 600068 ) );
  2347. Commands->Destroy_Object( Commands->Find_Object ( 600069 ) );
  2348. Commands->Destroy_Object( Commands->Find_Object ( 600070 ) );
  2349. Commands->Destroy_Object( Commands->Find_Object ( 600071 ) );
  2350. }
  2351. };
  2352. /*
  2353. 01-I022E "Proper Identification must be worn at all times."
  2354. 01-I028E "All coded messages must be sent on designated security channel alpha."
  2355. 01-I030E "In accordance with Brotherhood directive AC-MBM, all messages are monitored."
  2356. 01-I032E "A visceroid has been spotted in Tiberium Field iota. Containment team en route."
  2357. 01-I034E "Tiberium value is increasing Worldwide."
  2358. 01-I036E "Project 'Ezekiel's Cape' has passed initial tests. Prototypes are now in production."
  2359. 01-I038E "Colonel Shepard's personal aide has been located in Washington D.C. Aquisition team en route."
  2360. 01-I040E "Anamolous EVA signal detected. Reconnaissance force is being dispatched."
  2361. 01-I042E "World wide public opinion of the Brotherhood is on the rise."
  2362. 01-I044E "Refinery technicians have failed to report in. Investigation team en route."
  2363. 01-I046E "Possible EVA intrusion in message squirt Alpha. Switching to Beta channels."
  2364. 01-I048E "Incoming transmission for Captain Jones. Captain Jones please report to a secured terminal."
  2365. 01-I050E "Do you know someone who would make a positive addition to the Brotherhood? Now they can enlist online at 'WWW dot BrotherhoodRecruitment dot Nod' "
  2366. 01-I062E "Immediately report the presence of visceroids to your supervisor."
  2367. 01-I066E "Workers found loitering in this area will be terminated."
  2368. */
  2369. DECLARE_SCRIPT(M03_Announce_CommCenter_Controller_JDG, "")
  2370. {
  2371. int total_number_of_sounds;
  2372. float announce_delay_min;
  2373. float announce_delay_max;
  2374. int start_announcements;
  2375. int stop_announcements;
  2376. int pick_sound;
  2377. int play_sound;
  2378. int play_klaxon;
  2379. int sound;
  2380. int klaxon;
  2381. Vector3 spkr_1_spot;
  2382. Vector3 spkr_2_spot;
  2383. Vector3 spkr_3_spot;
  2384. Vector3 spkr_4_spot;
  2385. Vector3 spkr_5_spot;
  2386. Vector3 spkr_6_spot;
  2387. Vector3 spkr_7_spot;
  2388. REGISTER_VARIABLES()
  2389. {
  2390. SAVE_VARIABLE( total_number_of_sounds, 1 );
  2391. SAVE_VARIABLE( announce_delay_min, 2 );
  2392. SAVE_VARIABLE( announce_delay_max, 3 );
  2393. SAVE_VARIABLE( start_announcements, 4 );
  2394. SAVE_VARIABLE( stop_announcements, 5 );
  2395. SAVE_VARIABLE( pick_sound, 6 );
  2396. SAVE_VARIABLE( play_sound, 7 );
  2397. SAVE_VARIABLE( play_klaxon, 8 );
  2398. SAVE_VARIABLE( sound, 9 );
  2399. SAVE_VARIABLE( klaxon, 10 );
  2400. SAVE_VARIABLE( spkr_1_spot, 11 );
  2401. SAVE_VARIABLE( spkr_2_spot, 12 );
  2402. SAVE_VARIABLE( spkr_3_spot, 13 );
  2403. SAVE_VARIABLE( spkr_4_spot, 14 );
  2404. SAVE_VARIABLE( spkr_5_spot, 15 );
  2405. SAVE_VARIABLE( spkr_6_spot, 16 );
  2406. SAVE_VARIABLE( spkr_7_spot, 17 );
  2407. }
  2408. void Created( GameObject * obj )
  2409. {
  2410. total_number_of_sounds = 15;
  2411. announce_delay_min = 20.0;
  2412. announce_delay_max = 30.0;
  2413. start_announcements = 20;
  2414. stop_announcements = 21;
  2415. pick_sound = 22;
  2416. play_sound = 23;
  2417. play_klaxon = 24;
  2418. spkr_1_spot.Set(-104.35f,47.83f,-3.54f);
  2419. spkr_2_spot.Set(116.1f,46.42f,-3.15f);
  2420. spkr_3_spot.Set(-117.04f,41.42f,-5.37f);
  2421. spkr_4_spot.Set(-127.57f,65.42f,-5.75f);
  2422. spkr_5_spot.Set(-121.95f,59.32f,-4.91f);
  2423. spkr_6_spot.Set(-117.48f,45.83f,-3.87f);
  2424. spkr_7_spot.Set(-111.25f,43.69f,-2.27f);
  2425. if (obj) {
  2426. Commands->Send_Custom_Event( obj, obj, 0, start_announcements, 0 );
  2427. }
  2428. }
  2429. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  2430. {
  2431. if (param == stop_announcements)
  2432. {
  2433. }
  2434. else if (param == start_announcements)
  2435. {
  2436. if (obj) {
  2437. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, 0 );
  2438. }
  2439. }
  2440. else if (param == play_klaxon)
  2441. {
  2442. char *klaxonNames[2] = {
  2443. "Klaxon Warning",
  2444. "Klaxon Info"
  2445. };
  2446. char *klaxonName = klaxonNames[klaxon];
  2447. Commands->Create_Sound ( klaxonName, spkr_1_spot, obj );
  2448. Commands->Create_Sound ( klaxonName, spkr_2_spot, obj );
  2449. Commands->Create_Sound ( klaxonName, spkr_3_spot, obj );
  2450. Commands->Create_Sound ( klaxonName, spkr_4_spot, obj );
  2451. Commands->Create_Sound ( klaxonName, spkr_5_spot, obj );
  2452. Commands->Create_Sound ( klaxonName, spkr_6_spot, obj );
  2453. Commands->Create_Sound ( klaxonName, spkr_7_spot, obj );
  2454. if (obj) {
  2455. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 1.25 );
  2456. }
  2457. }
  2458. else if (param == play_sound)
  2459. {
  2460. char *sounds[15] = {
  2461. "01-I022E",
  2462. "01-I028E",
  2463. "01-I030E",
  2464. "01-I032E",
  2465. "01-I034E",
  2466. "01-I036E",
  2467. "01-I038E",
  2468. "01-I040E",
  2469. "01-I042E",
  2470. "01-I044E",
  2471. "01-I046E",
  2472. "01-I048E",
  2473. "01-I050E",
  2474. "01-I062E",
  2475. "01-I066E"
  2476. };
  2477. char *soundName = sounds[sound];
  2478. Commands->Create_Sound ( soundName, spkr_1_spot, obj );
  2479. Commands->Create_Sound ( soundName, spkr_2_spot, obj );
  2480. Commands->Create_Sound ( soundName, spkr_3_spot, obj );
  2481. Commands->Create_Sound ( soundName, spkr_4_spot, obj );
  2482. Commands->Create_Sound ( soundName, spkr_5_spot, obj );
  2483. Commands->Create_Sound ( soundName, spkr_6_spot, obj );
  2484. Commands->Create_Sound ( soundName, spkr_7_spot, obj );
  2485. float delayTimer = Commands->Get_Random ( announce_delay_min, announce_delay_max );
  2486. if (obj) {
  2487. Commands->Send_Custom_Event( obj, obj, 0, pick_sound, delayTimer );
  2488. }
  2489. }
  2490. else if (param == pick_sound)
  2491. {
  2492. float lineNumber = Commands->Get_Random ( 0.5f, total_number_of_sounds+0.5);
  2493. if ((lineNumber >= 0.5) && (lineNumber < 1.5))
  2494. {
  2495. //soundName = "01-i066e";
  2496. sound = 0;
  2497. if (obj) {
  2498. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2499. }
  2500. }
  2501. else if ((lineNumber >= 1.5) && (lineNumber < 2.5))
  2502. {
  2503. //soundName = "01-i028e";
  2504. sound = 1;
  2505. if (obj) {
  2506. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2507. }
  2508. }
  2509. else if ((lineNumber >= 2.5) && (lineNumber < 3.5))
  2510. {
  2511. //soundName = "01-i030e";
  2512. sound = 2;
  2513. if (obj) {
  2514. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2515. }
  2516. }
  2517. else if ((lineNumber >= 3.5) && (lineNumber < 4.5))
  2518. {
  2519. //klaxonName = "Klaxon Info";
  2520. klaxon = 1;
  2521. //soundName = "01-i032e";
  2522. sound = 3;
  2523. //01-I032E "A visceroid has been spotted in Tiberium Field iota. Containment team en route."
  2524. if (obj) {
  2525. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2526. }
  2527. }
  2528. else if ((lineNumber >= 4.5) && (lineNumber < 5.5))
  2529. {
  2530. //soundName = "01-i034e";
  2531. sound = 4;
  2532. if (obj) {
  2533. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2534. }
  2535. }
  2536. else if ((lineNumber >= 5.5) && (lineNumber < 6.5))
  2537. {
  2538. //klaxonName = "Klaxon Info";
  2539. klaxon = 1;
  2540. //soundName = "01-i036e";
  2541. sound = 5;
  2542. //01-I036E "Project 'Ezekiel's Cape' has passed initial tests. Prototypes are now in production."
  2543. if (obj) {
  2544. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2545. }
  2546. }
  2547. else if ((lineNumber >= 6.5) && (lineNumber < 7.5))
  2548. {
  2549. //klaxonName = "Klaxon Info";
  2550. klaxon = 1;
  2551. //soundName = "01-i038e";
  2552. sound = 6;
  2553. //01-I038E "Colonel Shepard's personal aide has been located in Washington D.C. Aquisition team en route."
  2554. if (obj) {
  2555. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2556. }
  2557. }
  2558. else if ((lineNumber >= 7.5) && (lineNumber < 8.5))
  2559. {
  2560. //klaxonName = "Klaxon Warning";
  2561. klaxon = 0;
  2562. //soundName = "01-i040e";
  2563. sound = 7;
  2564. //01-I040E "Anamolous EVA signal detected. Reconnaissance force is being dispatched."
  2565. if (obj) {
  2566. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2567. }
  2568. }
  2569. else if ((lineNumber >= 8.5) && (lineNumber < 9.5))
  2570. {
  2571. //soundName = "01-i042e";
  2572. sound = 8;
  2573. if (obj) {
  2574. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2575. }
  2576. }
  2577. else if ((lineNumber >= 9.5) && (lineNumber < 10.5))
  2578. {
  2579. //klaxonName = "Klaxon Warning";
  2580. klaxon = 0;
  2581. //soundName = "01-i044e";
  2582. sound = 9;
  2583. //01-I044E "Refinery technicians have failed to report in. Investigation team en route."
  2584. if (obj) {
  2585. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2586. }
  2587. }
  2588. else if ((lineNumber >= 10.5) && (lineNumber < 11.5))
  2589. {
  2590. //klaxonName = "Klaxon Warning";
  2591. klaxon = 0;
  2592. //soundName = "01-i046e";
  2593. sound = 10;
  2594. //01-I046E "Possible EVA intrusion in message squirt Alpha. Switching to Beta channels."
  2595. if (obj) {
  2596. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2597. }
  2598. }
  2599. else if ((lineNumber >= 11.5) && (lineNumber < 12.5))
  2600. {
  2601. //klaxonName = "Klaxon Info";
  2602. klaxon = 1;
  2603. //soundName = "01-i048e";
  2604. sound = 11;
  2605. //01-I048E "Incoming transmission for Captain Jones. Captain Jones please report to a secured terminal."
  2606. if (obj) {
  2607. Commands->Send_Custom_Event( obj, obj, 0, play_klaxon, 0 );
  2608. }
  2609. }
  2610. else if ((lineNumber >= 12.5) && (lineNumber < 13.5))
  2611. {
  2612. //soundName = "01-i050e";
  2613. sound = 12;
  2614. if (obj) {
  2615. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2616. }
  2617. }
  2618. else if ((lineNumber >= 13.5) && (lineNumber < 14.5))
  2619. {
  2620. //soundName = "01-i062e";
  2621. sound = 13;
  2622. if (obj) {
  2623. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2624. }
  2625. }
  2626. else
  2627. {
  2628. //soundName = "01-i022e";
  2629. sound = 14;
  2630. if (obj) {
  2631. Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2632. }
  2633. }
  2634. }
  2635. }
  2636. void Killed( GameObject * obj, GameObject * killer )
  2637. {
  2638. //soundName = "Klaxon Loop";
  2639. //Commands->Send_Custom_Event( obj, obj, 0, play_sound, 0 );
  2640. Commands->Destroy_Object( Commands->Find_Object ( 600042 ) );
  2641. Commands->Destroy_Object( Commands->Find_Object ( 600056 ) );
  2642. Commands->Destroy_Object( Commands->Find_Object ( 600057 ) );
  2643. Commands->Destroy_Object( Commands->Find_Object ( 600058 ) );
  2644. Commands->Destroy_Object( Commands->Find_Object ( 600059 ) );
  2645. Commands->Destroy_Object( Commands->Find_Object ( 600060 ) );
  2646. Commands->Destroy_Object( Commands->Find_Object ( 600061 ) );
  2647. Commands->Destroy_Object( Commands->Find_Object ( 600062 ) );
  2648. Commands->Destroy_Object( Commands->Find_Object ( 600063 ) );
  2649. Commands->Destroy_Object( Commands->Find_Object ( 600064 ) );
  2650. Commands->Destroy_Object( Commands->Find_Object ( 600065 ) );
  2651. }
  2652. };
  2653. //Grants initial weapons and key needed for Level 3
  2654. DECLARE_SCRIPT(M03_Initial_Powerups, "")
  2655. {
  2656. enum
  2657. {
  2658. POWERUP_TIMER,
  2659. };
  2660. void Created(GameObject * obj)
  2661. {
  2662. Commands->Start_Timer(obj, this, 0.5f, POWERUP_TIMER);
  2663. }
  2664. void Timer_Expired(GameObject * obj, int timer_id)
  2665. {
  2666. if (timer_id == POWERUP_TIMER)
  2667. {
  2668. GameObject *star = Commands->Get_A_Star(Commands->Get_Position(obj));
  2669. if (star)
  2670. {
  2671. Commands->Give_PowerUp(star, "Shotgun Weapon 1 Clip PU");
  2672. Commands->Give_PowerUp(star, "Sniper Weapon 1 Clip PU");
  2673. Commands->Give_PowerUp(star, "Remote Mine Weapon 1 Clip PU");
  2674. Commands->Grant_Key(star, 5, true);
  2675. //Commands->Grant_Key(star, 1, true);
  2676. char params[20];
  2677. sprintf(params, "%d", Commands->Get_ID(obj));
  2678. Commands->Attach_Script(star, "M03_Commando_Script", params);
  2679. }
  2680. else
  2681. {
  2682. Commands->Start_Timer(obj, this, 1.0f, POWERUP_TIMER);
  2683. }
  2684. }
  2685. }
  2686. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2687. {
  2688. if ((type == 12176) && (param == 12176))
  2689. {
  2690. Commands->Start_Timer(obj, this, 2.0f, POWERUP_TIMER);
  2691. }
  2692. }
  2693. };
  2694. DECLARE_SCRIPT(M03_Commando_Script, "Controller_ID:int")
  2695. {
  2696. bool has_escort;
  2697. int follower_id;
  2698. REGISTER_VARIABLES()
  2699. {
  2700. SAVE_VARIABLE(has_escort, 1);
  2701. SAVE_VARIABLE(follower_id, 2);
  2702. }
  2703. void Created(GameObject * obj)
  2704. {
  2705. has_escort = false;
  2706. follower_id = 0;
  2707. }
  2708. void Sound_Heard(GameObject * obj, const CombatSound & sound)
  2709. {
  2710. if (sound.Type >= 991)
  2711. {
  2712. //Commands->Shake_Camera(sound.Position, 25, 0.2f, 1.5f);
  2713. }
  2714. }
  2715. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2716. {
  2717. if (type == 3000)
  2718. {
  2719. int *occupied = (int *)param;
  2720. if (occupied != NULL)
  2721. {
  2722. (*occupied) = has_escort ? 1 : 0;
  2723. }
  2724. if (has_escort && (Commands->Get_ID(sender) == follower_id))
  2725. {
  2726. has_escort = false;
  2727. follower_id = 0;
  2728. if (occupied != NULL)
  2729. {
  2730. (*occupied) = -1;
  2731. }
  2732. }
  2733. else if (!has_escort)
  2734. {
  2735. has_escort = true;
  2736. follower_id = Commands->Get_ID(sender);
  2737. }
  2738. }
  2739. if (type == 3100 && param == 3100)
  2740. {
  2741. if (Commands->Get_ID(sender) == follower_id)
  2742. {
  2743. has_escort = false;
  2744. follower_id = 0;
  2745. }
  2746. }
  2747. }
  2748. void Destroyed(GameObject * obj)
  2749. {
  2750. GameObject *con = Commands->Find_Object(Get_Int_Parameter("Controller_ID"));
  2751. if (con)
  2752. {
  2753. Commands->Send_Custom_Event(obj, con, 12176, 12176);
  2754. }
  2755. }
  2756. void Killed(GameObject * obj, GameObject * killer)
  2757. {
  2758. if (has_escort)
  2759. {
  2760. GameObject *escort = Commands->Find_Object(follower_id);
  2761. if (escort)
  2762. {
  2763. Commands->Send_Custom_Event(obj, escort, 1001, 1001);
  2764. }
  2765. }
  2766. // HACK
  2767. GameObject *tailgun_zone = Commands->Find_Object(1141168);
  2768. if (tailgun_zone)
  2769. {
  2770. Commands->Send_Custom_Event(obj, tailgun_zone, 300, 300);
  2771. }
  2772. }
  2773. };
  2774. //Moves the real Commando into position after intro cinematic
  2775. DECLARE_SCRIPT(M03_Move_Commando_To_Start, "")
  2776. {
  2777. enum {M03_COMMANDO_MOVE_TIMER};
  2778. void Created(GameObject * obj)
  2779. {
  2780. Commands->Start_Timer(obj, this, 1.0f, M03_COMMANDO_MOVE_TIMER);
  2781. }
  2782. void Timer_Expired(GameObject * obj, int timer_id)
  2783. {
  2784. if (timer_id == M03_COMMANDO_MOVE_TIMER)
  2785. {
  2786. GameObject *star = Commands->Get_A_Star(Commands->Get_Position(obj));
  2787. Vector3 pos = Vector3(-328.09f, 75.65f, 4.25f);
  2788. Commands->Set_Position(star, pos);
  2789. }
  2790. }
  2791. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2792. {
  2793. if ((type == 100) && (param == 100))
  2794. {
  2795. GameObject *star = Commands->Get_A_Star(Commands->Get_Position(obj));
  2796. Vector3 pos = Vector3(-118.12f,-120.12f,-0.72f);
  2797. Commands->Set_Position(star, pos);
  2798. }
  2799. }
  2800. };
  2801. //Actually creates the GDI soldiers on the Chinook's SPAWNER bone, and attaches them to a slot
  2802. DECLARE_SCRIPT(M03_Chinook_Drop_Soldiers_GDI, "Controller_ID:int")
  2803. {
  2804. int con_id;
  2805. int count, count2;
  2806. REGISTER_VARIABLES()
  2807. {
  2808. SAVE_VARIABLE( con_id, 1 );
  2809. SAVE_VARIABLE( count, 2);
  2810. SAVE_VARIABLE( count2, 2);
  2811. }
  2812. void Created(GameObject * obj)
  2813. {
  2814. con_id = Get_Int_Parameter("Controller_ID");
  2815. count = count2 = 0;
  2816. }
  2817. int Find_Location(int type)
  2818. {
  2819. return type - 4001;
  2820. }
  2821. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2822. {
  2823. GameObject *soldier;
  2824. soldier = Commands->Find_Object(param);
  2825. if (type > 4000)
  2826. {
  2827. if (soldier)
  2828. {
  2829. char params[80];
  2830. sprintf(params, "%d,2000,%d", Find_Location(type), con_id);
  2831. Commands->Attach_Script(soldier, "M03_Chinook_Spawned_Soldier_GDI", params);
  2832. if (Find_Location(type) == 1)
  2833. {
  2834. char params2[80];
  2835. sprintf(params2, "%d", count);
  2836. (++count) %= 3;
  2837. Commands->Attach_Script(soldier, "M03_Inlet_Soldier_GDI", params2);
  2838. }
  2839. if (Find_Location(type) == 0)
  2840. {
  2841. char params3[80];
  2842. sprintf(params3, "%d", count2);
  2843. (++count2) %= 3;
  2844. Commands->Attach_Script(soldier, "M03_Beach_Soldier_GDI", params3);
  2845. }
  2846. }
  2847. }
  2848. }
  2849. };
  2850. DECLARE_SCRIPT(M03_Inlet_Soldier_GDI, "Number:int")
  2851. {
  2852. void Created(GameObject * obj)
  2853. {
  2854. int num = Get_Int_Parameter("Number");
  2855. switch (num)
  2856. {
  2857. case 0: Commands->Set_Innate_Soldier_Home_Location(obj, Vector3(75.0f,-28.0f,2.001f), 5.0f);
  2858. break;
  2859. case 1: Commands->Set_Innate_Soldier_Home_Location(obj, Vector3(29.0f,-60.0f,2.634f), 5.0f);
  2860. break;
  2861. case 2: Commands->Start_Timer(obj, this, 10.0f, 0);
  2862. break;
  2863. }
  2864. }
  2865. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2866. {
  2867. if (action_id == 50)
  2868. {
  2869. Commands->Start_Timer(obj, this, 10.0f, 0);
  2870. }
  2871. }
  2872. void Timer_Expired(GameObject * obj, int timer_id)
  2873. {
  2874. ActionParamsStruct params;
  2875. params.Set_Basic(this, 40, 50);
  2876. params.Set_Movement(Vector3(0,0,0), WALK, 1.0f);
  2877. params.WaypathID = 1144691;
  2878. Commands->Action_Goto(obj, params);
  2879. }
  2880. };
  2881. DECLARE_SCRIPT(M03_Beach_Soldier_GDI, "Number:int")
  2882. {
  2883. void Created(GameObject * obj)
  2884. {
  2885. int num = Get_Int_Parameter("Number");
  2886. switch (num)
  2887. {
  2888. case 0: Commands->Set_Innate_Soldier_Home_Location(obj, Vector3(-112.132f, -54.312f, 7.297f), 2.0f);
  2889. break;
  2890. case 1: Commands->Set_Innate_Soldier_Home_Location(obj, Vector3(-91.731f, -54.618f, 7.129f), 2.0f);
  2891. break;
  2892. case 2: Commands->Start_Timer(obj, this, 10.0f, 0);
  2893. break;
  2894. }
  2895. }
  2896. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  2897. {
  2898. if (action_id == 50)
  2899. {
  2900. // Commands->Start_Timer(obj, this, 10.0f, 0);
  2901. }
  2902. }
  2903. void Timer_Expired(GameObject * obj, int timer_id)
  2904. {
  2905. ActionParamsStruct params;
  2906. params.Set_Basic(this, 40, 50);
  2907. params.Set_Movement(Vector3(0,0,0), WALK, 1.0f);
  2908. params.WaypathID = 1145037;
  2909. Commands->Action_Goto(obj, params);
  2910. }
  2911. };
  2912. //Keeps track of current GDI soldiers and brings in area-specific reinforcements when they
  2913. //are gone. Also tracks "Fortify Beachhead" objective status
  2914. DECLARE_SCRIPT(M03_Chinook_Reinforcements, "Beach_Preset:string, Inlet_Preset:string, Base_Preset:string, Trigger_Count:int")
  2915. {
  2916. int current[3];
  2917. bool active[3];
  2918. int count;
  2919. int beach_count;
  2920. bool objective_completed;
  2921. int base_count;
  2922. REGISTER_VARIABLES()
  2923. {
  2924. SAVE_VARIABLE( current, 1 );
  2925. SAVE_VARIABLE( active, 2 );
  2926. SAVE_VARIABLE( count, 3 );
  2927. SAVE_VARIABLE( beach_count, 4 );
  2928. SAVE_VARIABLE( objective_completed, 5);
  2929. SAVE_VARIABLE(base_count, 6);
  2930. }
  2931. void Created(GameObject * obj)
  2932. { count = Get_Int_Parameter("Trigger_Count");
  2933. beach_count = 0;
  2934. base_count = 0;
  2935. objective_completed = false;
  2936. for (int x = 0; x <3; x++)
  2937. {
  2938. current[x] = 0;
  2939. active[x] = true;
  2940. }
  2941. }
  2942. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  2943. {
  2944. if (type == 2000)
  2945. {
  2946. if ((param < 0) || (param > 2))
  2947. {
  2948. return;
  2949. }
  2950. current[param]++;
  2951. if ((param == 0) && (current[0] < 3))
  2952. {
  2953. if (beach_count >= (3 - current[0]))
  2954. {
  2955. GameObject *objective_controller;
  2956. objective_controller = Commands->Find_Object(1100004);
  2957. if (objective_controller && !objective_completed)
  2958. {
  2959. //Commands->Send_Custom_Event(obj, objective_controller, 301, 1);
  2960. //objective_completed = true;
  2961. }
  2962. }
  2963. }
  2964. if ((current[param] >= count) && (active[param]) && Commands->Find_Object(1100003))
  2965. {
  2966. current[param] = 0;
  2967. GameObject *con;
  2968. Commands->Create_Sound("00-N180E", Vector3(0,0,0), obj);
  2969. switch (param)
  2970. {
  2971. case 0:
  2972. {/*const char *beach;
  2973. beach = Get_Parameter("Beach_Preset");
  2974. con = Commands->Create_Object(beach, Vector3(-84.609f, -91.188f, 1.0f));
  2975. Commands->Set_Facing(con, 100.0f);*/
  2976. GameObject *new_obj = Commands->Create_Object("Invisible_Object", Vector3(-84.609f, -91.188f, 1.0f));
  2977. Commands->Set_Facing(new_obj, 190.0f);
  2978. Commands->Attach_Script(new_obj, "Test_Cinematic", "X3I_TroopDrop1.txt");
  2979. }
  2980. break;
  2981. case 1: const char *inlet;
  2982. inlet = Get_Parameter("Inlet_Preset");
  2983. con = Commands->Create_Object(inlet, Vector3(84.398f, -45.703f, 1.0f));
  2984. Commands->Set_Facing(con, 100.0f);
  2985. break;
  2986. case 2: const char *base;
  2987. base = Get_Parameter("Base_Preset");
  2988. con = Commands->Create_Object(base, Vector3(-94.822f, 15.727f, 10.0f));
  2989. Commands->Set_Facing(con, -155.0f);
  2990. break;
  2991. }
  2992. }
  2993. }
  2994. if (type == 3000)
  2995. {
  2996. if ((param < 0) || (param > 2))
  2997. return;
  2998. active[param] = false;
  2999. }
  3000. if (type == 4000 && param == 4000)
  3001. {
  3002. base_count++;
  3003. if (base_count >= 3)
  3004. {
  3005. base_count = 0;
  3006. current[2] = 2;
  3007. Commands->Send_Custom_Event(obj, obj, 2000, 2);
  3008. }
  3009. }
  3010. if ((type == 12000) && (param == 12000))
  3011. {
  3012. beach_count++;
  3013. if ((beach_count >= (3 - current[0])) && (!objective_completed))
  3014. {
  3015. GameObject *objective_controller;
  3016. objective_controller = Commands->Find_Object(1100004);
  3017. if (objective_controller && !objective_completed)
  3018. {
  3019. //Commands->Send_Custom_Event(obj, objective_controller, 301, 1);
  3020. //objective_completed = true;
  3021. }
  3022. }
  3023. }
  3024. }
  3025. };
  3026. //Script attached to the GDI soldiers once they are spawned from the Chinook. This script
  3027. //makes sure they try to attack, listens for beachhead bunker openings, and tells the controller
  3028. //when the soldier dies.
  3029. DECLARE_SCRIPT(M03_Chinook_Spawned_Soldier_GDI, "Area:int, Send_Type_When_Killed:int, Target_ID:int")
  3030. {
  3031. int area, send_type, target_id, null_count;
  3032. bool in_place, en_route, escorting, diverted;
  3033. enum
  3034. {
  3035. BUNKER_OCCUPY = 50
  3036. };
  3037. REGISTER_VARIABLES()
  3038. {
  3039. SAVE_VARIABLE( area, 1 );
  3040. SAVE_VARIABLE( send_type, 2 );
  3041. SAVE_VARIABLE( target_id, 3 );
  3042. SAVE_VARIABLE( in_place, 4 );
  3043. SAVE_VARIABLE( en_route, 5 );
  3044. SAVE_VARIABLE( null_count, 6 );
  3045. SAVE_VARIABLE( escorting, 7 );
  3046. SAVE_VARIABLE( diverted, 8);
  3047. }
  3048. void Created(GameObject * obj)
  3049. {
  3050. escorting = false;
  3051. area = Get_Int_Parameter("Area");
  3052. send_type = Get_Int_Parameter("Send_Type_When_Killed");
  3053. target_id = Get_Int_Parameter("Target_ID");
  3054. in_place = false;
  3055. en_route = false;
  3056. null_count = 0;
  3057. Commands->Set_Innate_Aggressiveness(obj, 0.0f);
  3058. Commands->Start_Timer(obj, this, 10.0f, 0);
  3059. Commands->Start_Timer(obj, this, 3.0f, 9);
  3060. }
  3061. void Timer_Expired(GameObject * obj, int timer_id)
  3062. {
  3063. if (timer_id == 3)
  3064. {
  3065. if (escorting && diverted)
  3066. {
  3067. diverted = false;
  3068. ActionParamsStruct params;
  3069. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN - 1, 5);
  3070. params.Set_Movement(STAR, 1.0f, 3.0f);
  3071. params.MoveFollow = true;
  3072. Commands->Action_Goto(obj, params);
  3073. }
  3074. return;
  3075. }
  3076. if (timer_id == 9)
  3077. {
  3078. float distance = Commands->Get_Random(-12.0f, 12.0f);
  3079. //distance *= 3;
  3080. Vector3 pos = Commands->Get_Position(obj);
  3081. float facing = Commands->Get_Facing(obj);
  3082. float a = cos(DEG_TO_RADF(facing)) * distance;
  3083. float b = sin(DEG_TO_RADF(facing)) * distance;
  3084. Vector3 goto_loc = pos + Vector3(a, b, 0.0f);
  3085. ActionParamsStruct params;
  3086. params.Set_Basic(this, 100, 40);
  3087. params.Set_Movement(goto_loc, RUN, 1.0f);
  3088. Commands->Action_Goto(obj, params);
  3089. return;
  3090. }
  3091. GameObject *target = NULL;
  3092. if (null_count < 3)
  3093. {
  3094. //target = Commands->Find_Closest_Soldier(Commands->Get_Position(obj), 0.0f, 50.0f, true);
  3095. }
  3096. if ((target == NULL) && (null_count < 3)) {
  3097. null_count++;
  3098. }
  3099. if (!in_place) {
  3100. en_route = false;
  3101. }
  3102. if ((null_count < 3) && (target) && (!in_place))
  3103. {
  3104. ActionParamsStruct params;
  3105. params.Set_Basic(this, INNATE_PRIORITY_IDLE + 1, 0);
  3106. params.Set_Attack(target, 100.0f, 2.0f, true);
  3107. Commands->Action_Attack(obj, params);
  3108. }
  3109. if (!in_place) {
  3110. Commands->Start_Timer(obj, this, 10.0f, 0);
  3111. }
  3112. }
  3113. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3114. {
  3115. if (action_id == 0)
  3116. {
  3117. en_route = false;
  3118. }
  3119. if (action_id == 5 && reason == ACTION_COMPLETE_LOW_PRIORITY && escorting)
  3120. {
  3121. diverted = true;
  3122. Commands->Start_Timer(obj, this, 5.0f, 3);
  3123. }
  3124. if (reason != ACTION_COMPLETE_NORMAL)
  3125. {
  3126. return;
  3127. }
  3128. else if (action_id != 0)
  3129. {
  3130. GameObject *bunker;
  3131. bunker = Commands->Find_Object(action_id);
  3132. if (bunker)
  3133. {
  3134. Commands->Send_Custom_Event(obj, bunker, 3000, 3000);
  3135. }
  3136. GameObject *target = Commands->Find_Object(target_id);
  3137. if (target)
  3138. {
  3139. Commands->Send_Custom_Event(obj, target, 12000, 12000);
  3140. }
  3141. in_place = true;
  3142. }
  3143. }
  3144. void Killed(GameObject * obj, GameObject * killer)
  3145. {
  3146. GameObject *target = Commands->Find_Object(target_id);
  3147. if (target)
  3148. {
  3149. Commands->Send_Custom_Event(obj, target, send_type, area);
  3150. }
  3151. if (escorting)
  3152. {
  3153. Commands->Send_Custom_Event(obj, STAR, 3100, 3100);
  3154. }
  3155. }
  3156. void Poked(GameObject * obj, GameObject * poker)
  3157. {
  3158. int has_escort = 1;
  3159. Commands->Send_Custom_Event(obj, poker, 3000, (int)&has_escort);
  3160. if (has_escort == 1)
  3161. {
  3162. /*if (DIFFICULTY == 2)
  3163. {
  3164. return;
  3165. }*/
  3166. // Commando already has someone
  3167. int id = Commands->Create_Conversation("M03CON041", 99, 200, false);
  3168. Commands->Join_Conversation(obj, id);
  3169. Commands->Start_Conversation(id, 100041);
  3170. Commands->Monitor_Conversation(obj, id);
  3171. }
  3172. else if (has_escort == 0)
  3173. {
  3174. // Escort the commando unless we're playing on DIFFICULT
  3175. /*if (DIFFICULTY == 2)
  3176. {
  3177. return;
  3178. }*/
  3179. if (area == 1)
  3180. {
  3181. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2000.0f);
  3182. }
  3183. int id = Commands->Create_Conversation("M03CON040",99, 200, false);
  3184. Commands->Join_Conversation(obj, id);
  3185. Commands->Start_Conversation(id, 100040);
  3186. Commands->Monitor_Conversation(obj, id);
  3187. escorting = true;
  3188. ActionParamsStruct params;
  3189. params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN - 1, 5);
  3190. params.Set_Movement(STAR, 1.0f, 3.0f);
  3191. params.MoveFollow = true;
  3192. Commands->Action_Goto(obj, params);
  3193. }
  3194. else if (has_escort == -1)
  3195. {
  3196. if (DIFFICULTY == 2)
  3197. {
  3198. return;
  3199. }
  3200. // I was following the Commando... no more
  3201. int id = Commands->Create_Conversation("M03CON041",99, 200, false);
  3202. Commands->Join_Conversation(obj, id);
  3203. Commands->Start_Conversation(id, 100041);
  3204. Commands->Monitor_Conversation(obj, id);
  3205. escorting = false;
  3206. Commands->Action_Reset(obj, 100);
  3207. }
  3208. }
  3209. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3210. {
  3211. if (type == 999 && param == 999)
  3212. {
  3213. Vector3 dest = Vector3(0,0,0);
  3214. Commands->Action_Reset(obj, 100);
  3215. switch (area)
  3216. {
  3217. case 0: dest.Set(-100, -50, 5.986f);
  3218. break;
  3219. case 1: dest.Set(87, -58, 1.662f);
  3220. break;
  3221. case 2: dest.Set(-125, 13, 9.362f);
  3222. break;
  3223. }
  3224. if (escorting)
  3225. {
  3226. escorting = false;
  3227. Commands->Send_Custom_Event(obj, STAR, 3100, 3100);
  3228. int id = Commands->Create_Conversation("M03CON042", 99, 200, false);
  3229. Commands->Join_Conversation(obj, id);
  3230. Commands->Start_Conversation(id, 100042);
  3231. Commands->Monitor_Conversation(obj, id);
  3232. }
  3233. ActionParamsStruct params;
  3234. params.Set_Basic(this, 90, 0);
  3235. params.Set_Movement(dest, RUN, 1.0f);
  3236. Commands->Action_Goto(obj, params);
  3237. }
  3238. if (type == 1001 && param == 1001 && escorting)
  3239. {
  3240. escorting = false;
  3241. Vector3 dest = Vector3(0,0,0);
  3242. Commands->Action_Reset(obj, 100);
  3243. switch (area)
  3244. {
  3245. case 0: dest.Set(-100, -50, 5.986f);
  3246. break;
  3247. case 1: dest.Set(87, -58, 1.662f);
  3248. break;
  3249. case 2: dest.Set(-125, 13, 9.362f);
  3250. break;
  3251. }
  3252. ActionParamsStruct params;
  3253. params.Set_Basic(this, 90, 0);
  3254. params.Set_Movement(dest, RUN, 1.0f);
  3255. Commands->Action_Goto(obj, params);
  3256. }
  3257. }
  3258. };
  3259. //Keeps track of the overall objective status for the mission. The outro cinematic will not
  3260. //trigger until the primary objectives have all been completed
  3261. DECLARE_SCRIPT(M03_Objective_Tracker, "")
  3262. {
  3263. int number_completed;
  3264. REGISTER_VARIABLES()
  3265. {
  3266. SAVE_VARIABLE( number_completed, 1 );
  3267. }
  3268. void Created(GameObject * obj)
  3269. {
  3270. number_completed = 0;
  3271. }
  3272. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3273. {
  3274. if ((type == 300) || (type == 308) || (type == 309))
  3275. {
  3276. if (param == 1)
  3277. number_completed++;
  3278. }
  3279. if ((type == 8000) && (param == 8000))
  3280. {
  3281. if (sender)
  3282. {
  3283. Commands->Send_Custom_Event(obj, sender, 8000, number_completed);
  3284. }
  3285. }
  3286. }
  3287. };
  3288. DECLARE_SCRIPT(M03_Intro_Substitute, "")
  3289. {
  3290. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  3291. {
  3292. if (type == 999)
  3293. {
  3294. Commands->Start_Timer(obj, this, 3.0f, 9998);
  3295. }
  3296. }
  3297. void Created(GameObject * obj)
  3298. {
  3299. GameObject *target;
  3300. target = Commands->Find_Object(1111000);
  3301. if (target) {
  3302. Commands->Send_Custom_Event(obj, target, 100, 100, 0.0f);
  3303. Commands->Send_Custom_Event(obj, target, 200, 200, 420.0f/30.0f);
  3304. Commands->Start_Timer(obj, this, 420.0f/30.0f, 0);
  3305. }
  3306. target = Commands->Find_Object(1100004);
  3307. if (target) {
  3308. Commands->Start_Timer(obj, this, 8.5f, 9997);
  3309. }
  3310. }
  3311. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  3312. {
  3313. GameObject *target;
  3314. target = Commands->Find_Object(1100004);
  3315. /*if (action_id == 100001)
  3316. {
  3317. Commands->Send_Custom_Event(obj, target, 300, 3, 0);
  3318. int id = Commands->Create_Conversation("M03CON063", 99, 2000, false);
  3319. Commands->Join_Conversation(NULL, id);
  3320. Commands->Start_Conversation(id, 100063);
  3321. Commands->Monitor_Conversation(obj, id);
  3322. }*/
  3323. if (action_id == 100001)
  3324. {
  3325. Commands->Send_Custom_Event(obj, target, 300, 3, 0);
  3326. }
  3327. if (action_id == 100001)
  3328. {
  3329. int id = Commands->Create_Conversation("M03CON012", 99, 2000, false);
  3330. Commands->Join_Conversation(NULL, id);
  3331. Commands->Join_Conversation(STAR, id);
  3332. Commands->Start_Conversation(id, 100012);
  3333. Commands->Monitor_Conversation(obj, id);
  3334. //Commands->Start_Timer(obj, this, 20.0f, 9999);
  3335. }
  3336. if (action_id == 100039)
  3337. {
  3338. int id = Commands->Create_Conversation("M03CON001", 99, 2000, false);
  3339. Commands->Join_Conversation(NULL, id);
  3340. Commands->Join_Conversation(STAR, id);
  3341. Commands->Start_Conversation(id, 100001);
  3342. Commands->Monitor_Conversation(obj, id);
  3343. }
  3344. if (action_id == 100012)
  3345. {
  3346. //int id = Commands->Create_Conversation("M03CON064", 99, 2000, false);
  3347. //Commands->Join_Conversation(NULL, id);
  3348. //Commands->Start_Conversation(id, 100064);
  3349. //Commands->Monitor_Conversation(obj, id);
  3350. Commands->Send_Custom_Event(obj, target, 301, 3, 0);
  3351. }
  3352. }
  3353. void Timer_Expired(GameObject * obj, int timer_id)
  3354. {
  3355. if (timer_id == 9997)
  3356. {
  3357. int id = Commands->Create_Conversation("M03CON039", 99, 2000, false);
  3358. Commands->Join_Conversation(NULL, id);
  3359. Commands->Join_Conversation(STAR, id);
  3360. Commands->Start_Conversation(id, 100039);
  3361. Commands->Monitor_Conversation(obj, id);
  3362. }
  3363. }
  3364. };
  3365. DECLARE_SCRIPT(M03_Alternate_Sam_Site, "Chinook_Controller_ID:int")
  3366. {
  3367. bool spoke;
  3368. REGISTER_VARIABLES()
  3369. {
  3370. SAVE_VARIABLE(spoke, 1);
  3371. }
  3372. void Created(GameObject * obj)
  3373. {
  3374. spoke = false;
  3375. }
  3376. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3377. {
  3378. if (Commands->Find_Object(1100003) == NULL)
  3379. {
  3380. return;
  3381. }
  3382. GameObject *chinook = Commands->Find_Object(param);
  3383. GameObject *target = Commands->Create_Object("Invisible_Object", Vector3(5,5,5));
  3384. if (chinook) {
  3385. char parameters[40];
  3386. int con_id = Get_Int_Parameter("Chinook_Controller_ID");
  3387. sprintf(parameters, "%d,%d", con_id, Commands->Get_ID(target));
  3388. Commands->Attach_Script(chinook, "M03_Destroyed_Chinook", parameters);
  3389. }
  3390. Commands->Attach_To_Object_Bone(target, chinook, "ROTOR00");
  3391. ActionParamsStruct params;
  3392. params.Set_Basic(this, 99, 0);
  3393. params.Set_Attack(target, 0.0f, 0.0f, true);
  3394. params.AttackCheckBlocked = false;
  3395. Commands->Action_Attack(obj, params);
  3396. Commands->Start_Timer(obj, this, 1.0f, Commands->Get_ID(target));
  3397. }
  3398. void Timer_Expired(GameObject * obj, int timer_id)
  3399. {
  3400. GameObject *target = Commands->Find_Object(timer_id);
  3401. Vector3 obj_pos = Commands->Get_Position(obj);
  3402. Vector3 target_pos;
  3403. if (target) {
  3404. target_pos = Commands->Get_Position(target);
  3405. }
  3406. if (target)
  3407. {
  3408. float range = Commands->Get_Distance(obj_pos, target_pos);
  3409. if (range <= 60.0f)
  3410. {
  3411. /*if (!spoke)
  3412. {
  3413. spoke = true;
  3414. int id = Commands->Create_Conversation("Chinook_Fodder_Dead");
  3415. Commands->Join_Conversation(NULL, id);
  3416. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0,0,0)), id);
  3417. Commands->Start_Conversation(id);
  3418. }*/
  3419. ActionParamsStruct params;
  3420. params.Set_Basic(this, 99, 0);
  3421. params.Set_Attack(target, 200.0f, 0.0f, true);
  3422. params.AttackCheckBlocked = false;
  3423. Commands->Action_Attack(obj, params);
  3424. }
  3425. Commands->Start_Timer(obj, this, 1.0f, timer_id);
  3426. }
  3427. }
  3428. };
  3429. DECLARE_SCRIPT(M03_Flyover_Controller, "")
  3430. {
  3431. int last;
  3432. bool comanches;
  3433. REGISTER_VARIABLES()
  3434. {
  3435. SAVE_VARIABLE(last, 1);
  3436. SAVE_VARIABLE(comanches, 2);
  3437. }
  3438. void Created(GameObject * obj)
  3439. {
  3440. Commands->Start_Timer(obj, this, 25.0f, 0);
  3441. last = 21;
  3442. comanches = true;
  3443. }
  3444. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3445. {
  3446. if (type == 511 && param == 511)
  3447. {
  3448. comanches = false;
  3449. }
  3450. if (type == 512 && param == 512)
  3451. {
  3452. comanches = true;
  3453. }
  3454. }
  3455. void Timer_Expired(GameObject * obj, int timer_id)
  3456. {
  3457. char *flyovers[17] =
  3458. {
  3459. "A-10_1.txt",
  3460. "A-10_2.txt",
  3461. "A-10_3.txt",
  3462. "A-10_4.txt",
  3463. "A-10_5.txt",
  3464. "A-10_6.txt",
  3465. "Orca_1.txt",
  3466. "Orca_2.txt",
  3467. "Orca_3.txt",
  3468. "Orca_4.txt",
  3469. "Orca_5.txt",
  3470. "Orca_1.txt",
  3471. "Orca_2.txt",
  3472. "Orca_3.txt",
  3473. "Orca_4.txt",
  3474. "Orca_5.txt",
  3475. "Orca_6.txt"
  3476. };
  3477. int random = int(Commands->Get_Random(0, 17-WWMATH_EPSILON));
  3478. if (!comanches && random > 5 && random < 11)
  3479. {
  3480. Commands->Start_Timer(obj, this, 25.0f, 0);
  3481. return;
  3482. }
  3483. while (random == last)
  3484. {
  3485. random = int(Commands->Get_Random(0, 17-WWMATH_EPSILON));
  3486. }
  3487. GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0,0,0));
  3488. Commands->Attach_Script(controller, "Test_Cinematic", flyovers[random]);
  3489. Commands->Start_Timer(obj, this, 25.0f, 0);
  3490. last = random;
  3491. }
  3492. };
  3493. DECLARE_SCRIPT(M03_Destroyed_Chinook, "Controller_ID:int, Simple_ID:int")
  3494. {
  3495. void Killed(GameObject * obj, GameObject * killer)
  3496. {
  3497. /*int id = Commands->Create_Conversation("Chinook_Fodder_Scream", 100);
  3498. Commands->Join_Conversation(NULL, id);
  3499. Commands->Join_Conversation(STAR, id);
  3500. Commands->Start_Conversation(id);*/
  3501. GameObject *con = Commands->Find_Object(Get_Int_Parameter("Controller_ID"));
  3502. GameObject *sim = Commands->Find_Object(Get_Int_Parameter("Simple_ID"));
  3503. if (con) {
  3504. Commands->Destroy_Object(con);
  3505. }
  3506. if (sim) {
  3507. Commands->Destroy_Object(sim);
  3508. }
  3509. Commands->Create_Explosion_At_Bone("Air Explosions Twiddler", obj, "SEAT1", killer);
  3510. Commands->Create_Explosion_At_Bone("Air Explosions Twiddler", obj, "ROTOR01", killer);
  3511. /*GameObject *obj_con = Commands->Find_Object(1100004);
  3512. if (obj_con) {
  3513. Commands->Send_Custom_Event(obj, obj_con, 302, 3);
  3514. }*/
  3515. }
  3516. };
  3517. DECLARE_SCRIPT(M03_Chinook_Fodder_Creator, "")
  3518. {
  3519. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3520. {
  3521. if (Commands->Find_Object(1100003) == NULL)
  3522. {
  3523. return;
  3524. }
  3525. if ((type == 3000) && (param == 3000))
  3526. {
  3527. GameObject *obj_con = Commands->Find_Object(1100004);
  3528. if (obj_con)
  3529. {
  3530. Commands->Send_Custom_Event(obj, obj_con, 302, 3);
  3531. }
  3532. //Commands->Attach_Script(obj, "Test_Cinematic", "ChinookTest.txt");
  3533. //Commands->Start_Timer(obj, this, 9.5f, 9998);
  3534. }
  3535. }
  3536. void Timer_Expired (GameObject *obj, int timer_id)
  3537. {
  3538. if (timer_id == 9998)
  3539. {
  3540. //Commands->Create_Sound("00-N180E", Vector3(0,0,0), obj);
  3541. int id = Commands->Create_Conversation("M03CON043", 99, 2000, false);
  3542. Commands->Join_Conversation(NULL, id);
  3543. Commands->Start_Conversation(id, 100043);
  3544. Commands->Monitor_Conversation(obj, id);
  3545. //Commands->Attach_Script(obj, "M03_Chinook_Troop_Drop", "ChinookTest.txt, 78.08 -36.88 1.20, 130.00");
  3546. }
  3547. }
  3548. void Action_Complete (GameObject *obj, int action_id, ActionCompleteReason reason)
  3549. {
  3550. if (action_id == 100043)
  3551. {
  3552. GameObject *obj_con = Commands->Find_Object(1100004);
  3553. if (obj_con)
  3554. {
  3555. Commands->Send_Custom_Event(obj, obj_con, 302, 3);
  3556. }
  3557. }
  3558. }
  3559. };
  3560. DECLARE_SCRIPT(M03_Tailgun, "Controller_ID:int")
  3561. {
  3562. void Killed(GameObject * obj, GameObject * killer)
  3563. {
  3564. GameObject *con = Commands->Find_Object(Get_Int_Parameter("Controller_ID"));
  3565. if (con) {
  3566. Commands->Send_Custom_Event(obj, con, 200, 200);
  3567. }
  3568. }
  3569. };
  3570. DECLARE_SCRIPT(M03_Tailgun_Fodder_Zone, "Spawner_ID_1:int, Spawner_ID_2:int, Spawner_ID_3:int")
  3571. {
  3572. bool active;
  3573. REGISTER_VARIABLES()
  3574. {
  3575. SAVE_VARIABLE(active, 1);
  3576. }
  3577. void Created(GameObject * obj)
  3578. {
  3579. active = true;
  3580. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_1"), false);
  3581. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_2"), false);
  3582. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_3"), false);
  3583. }
  3584. void Entered(GameObject * obj, GameObject * enterer)
  3585. {
  3586. {
  3587. if (!active)
  3588. {
  3589. return;
  3590. }
  3591. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_1"), true);
  3592. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_2"), true);
  3593. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_3"), true);
  3594. }
  3595. }
  3596. void Exited(GameObject * obj, GameObject * exiter)
  3597. {
  3598. {
  3599. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_1"), false);
  3600. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_2"), false);
  3601. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_ID_3"), false);
  3602. }
  3603. }
  3604. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3605. {
  3606. if (type == 5000)
  3607. {
  3608. if (param == 1)
  3609. {
  3610. active = true;
  3611. }
  3612. else if (param == 2)
  3613. {
  3614. active = false;
  3615. Exited(obj, STAR);
  3616. }
  3617. }
  3618. if ((type == 200) && (param == 200))
  3619. {
  3620. Commands->Destroy_Object(obj);
  3621. }
  3622. if (type == 300 && param == 300)
  3623. {
  3624. Exited(obj, sender);
  3625. }
  3626. }
  3627. };
  3628. DECLARE_SCRIPT(M03_Tailgun_Fodder, "")
  3629. {
  3630. void Created(GameObject * obj)
  3631. {
  3632. Commands->Action_Reset(obj, 99);
  3633. GameObject *star = Commands->Get_A_Star(Commands->Get_Position(obj));
  3634. if (star)
  3635. {
  3636. ActionParamsStruct params;
  3637. params.Set_Basic(this, 99, 0);
  3638. params.Set_Attack(star, 200.0f, 2.0f - (float)DIFFICULTY, true);
  3639. params.Set_Movement(star, RUN, 5.0f);
  3640. Commands->Action_Attack(obj, params);
  3641. }
  3642. }
  3643. };
  3644. DECLARE_SCRIPT(M03_Tiberium_Cave_Stay_Put ,"")
  3645. {
  3646. void Created(GameObject * obj)
  3647. {
  3648. Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 10.0f);
  3649. }
  3650. };
  3651. DECLARE_SCRIPT(M03_Big_Gun_Explosion, "")
  3652. {
  3653. void Created(GameObject * obj)
  3654. {
  3655. Commands->Create_3D_Sound_At_Bone("Explosion_Large_07", obj, "O_WREAKAGE");
  3656. }
  3657. };
  3658. DECLARE_SCRIPT(M03_Inlet_Nod_Reinforcements, "")
  3659. {
  3660. #define SPOT1 (Vector3(51.0f, -91.0f, 2.0f))
  3661. #define SPOT2 (Vector3(97.0f, -46.0f, 2.0f))
  3662. #define SPOT3 (Vector3(64.0f, -32.0f, 2.0f))
  3663. #define FACE1 75.0f
  3664. #define FACE2 170.0f
  3665. #define FACE3 70.0f
  3666. int count;
  3667. REGISTER_VARIABLES()
  3668. {
  3669. SAVE_VARIABLE( count, 1 );
  3670. }
  3671. void Created(GameObject * obj)
  3672. {
  3673. count = 0;
  3674. }
  3675. void Timer_Expired(GameObject * obj, int timer_id)
  3676. {
  3677. if (timer_id == 0)
  3678. {
  3679. GameObject * con = Commands->Create_Object("Invisible_Object", SPOT1);
  3680. Commands->Set_Facing(con, FACE1);
  3681. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  3682. }
  3683. if (timer_id == 1)
  3684. {
  3685. GameObject * con = Commands->Create_Object("Invisible_Object", SPOT2);
  3686. Commands->Set_Facing(con, FACE2);
  3687. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  3688. }
  3689. if (timer_id == 2)
  3690. {
  3691. GameObject * con = Commands->Create_Object("Invisible_Object", SPOT3);
  3692. Commands->Set_Facing(con, FACE3);
  3693. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  3694. }
  3695. }
  3696. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3697. {
  3698. if ((type == 300) && (param == 300))
  3699. {
  3700. count++;
  3701. }
  3702. if (count >= 2)
  3703. {
  3704. Commands->Start_Timer(obj, this, 1.0f, 0);
  3705. Commands->Start_Timer(obj, this, 4.3f, 1);
  3706. Commands->Start_Timer(obj, this, 8.1f, 2);
  3707. }
  3708. }
  3709. };
  3710. DECLARE_SCRIPT(M03_Base_Patrol, "WaypathID:int")
  3711. {
  3712. void Created(GameObject * obj)
  3713. {
  3714. ActionParamsStruct params;
  3715. //params.Set_Basic(this, INNATE_PRIORITY_BULLET_HEARD - 1, 0);
  3716. params.Set_Basic(this, 49, 0);
  3717. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  3718. params.Set_Movement(Vector3(0,0,0), WALK, 1.0f);
  3719. params.WaypathID = Get_Int_Parameter("WaypathID");
  3720. Commands->Action_Goto(obj, params);
  3721. }
  3722. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3723. {
  3724. if (action_id == 0 && reason == ACTION_COMPLETE_LOW_PRIORITY)
  3725. {
  3726. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  3727. }
  3728. }
  3729. };
  3730. DECLARE_SCRIPT(M03_Base_Harvester, "Tiberium_Loc:vector3, Dock_Location:vector3, Dock_Entrance:vector3, Sakura_Dest:vector3")
  3731. {
  3732. enum
  3733. {
  3734. HARVESTER_GOTO_TIBERIUM,
  3735. HARVESTER_HARVEST_MOVE,
  3736. HARVESTER_DOCK,
  3737. HARVESTER_BEAT_IT,
  3738. HARVESTER_CHASE_PLAYER,
  3739. DOCK_TIMER
  3740. };
  3741. int harvest_count, anim_count;
  3742. bool docked, playing_anim, power_off;
  3743. REGISTER_VARIABLES()
  3744. {
  3745. SAVE_VARIABLE(harvest_count, 1);
  3746. SAVE_VARIABLE(docked, 2);
  3747. SAVE_VARIABLE(playing_anim, 3);
  3748. SAVE_VARIABLE(anim_count, 4);
  3749. SAVE_VARIABLE(power_off, 5);
  3750. }
  3751. void Created(GameObject * obj)
  3752. {
  3753. harvest_count = 0;
  3754. docked = false;
  3755. playing_anim = false;
  3756. anim_count = 0;
  3757. power_off = false;
  3758. ActionParamsStruct params;
  3759. params.Set_Basic(this, 99, HARVESTER_GOTO_TIBERIUM);
  3760. params.Set_Movement(Get_Vector3_Parameter("Tiberium_Loc"), 1.0f, 1.0f);
  3761. Commands->Action_Goto(obj, params);
  3762. }
  3763. void Animation_Complete(GameObject * obj, const char *anim)
  3764. {
  3765. if (playing_anim)
  3766. {
  3767. anim_count++;
  3768. if (anim_count >= 3)
  3769. {
  3770. playing_anim = false;
  3771. anim_count = 0;
  3772. }
  3773. else
  3774. {
  3775. Commands->Set_Animation(obj, "V_NOD_HRVSTR.V_NOD_HRVSTR", false);
  3776. return;
  3777. }
  3778. }
  3779. if (harvest_count >= 4)
  3780. {
  3781. harvest_count = 0;
  3782. ActionParamsStruct params;
  3783. params.Set_Basic(this, 99, HARVESTER_DOCK);
  3784. params.Set_Movement(Vector3(0,0,0), 1.0f, 1.0f);
  3785. params.Dock_Vehicle(Get_Vector3_Parameter("Dock_Location"), Get_Vector3_Parameter("Dock_Entrance"));
  3786. Commands->Action_Dock(obj, params);
  3787. }
  3788. else
  3789. {
  3790. harvest_count++;
  3791. Gather_Tiberium();
  3792. }
  3793. }
  3794. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  3795. {
  3796. if (reason != ACTION_COMPLETE_NORMAL)
  3797. {
  3798. return;
  3799. }
  3800. if (action_id == HARVESTER_GOTO_TIBERIUM)
  3801. {
  3802. Gather_Tiberium();
  3803. }
  3804. if (action_id == HARVESTER_DOCK)
  3805. {
  3806. Commands->Start_Timer(obj, this, power_off ? 55.0f : 35.0f, DOCK_TIMER);
  3807. }
  3808. if (action_id == HARVESTER_HARVEST_MOVE)
  3809. {
  3810. Commands->Set_Animation(obj, "V_NOD_HRVSTR.V_NOD_HRVSTR", false);
  3811. playing_anim = true;
  3812. }
  3813. if (action_id == HARVESTER_BEAT_IT)
  3814. {
  3815. docked = true;
  3816. }
  3817. }
  3818. void Timer_Expired(GameObject * obj, int timer_id)
  3819. {
  3820. ActionParamsStruct params;
  3821. params.Set_Basic(this, 99, HARVESTER_GOTO_TIBERIUM);
  3822. params.Set_Movement(Get_Vector3_Parameter("Tiberium_Loc"), 1.0f, 1.0f);
  3823. Commands->Action_Goto(obj, params);
  3824. }
  3825. void Gather_Tiberium(void)
  3826. {
  3827. ActionParamsStruct params;
  3828. params.Set_Basic(this, 99, HARVESTER_HARVEST_MOVE);
  3829. Vector3 loc = Commands->Get_Position(Owner());
  3830. loc.X += Commands->Get_Random(-3.0f, 3.0f);
  3831. loc.Y += Commands->Get_Random(-3.0f, 3.0f);
  3832. params.Set_Movement(loc, 1.0f, 1.0f);
  3833. Commands->Action_Goto(Owner(), params);
  3834. }
  3835. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3836. {
  3837. if (type == 622 && param == 622)
  3838. {
  3839. Commands->Set_Animation(obj, NULL, false);
  3840. ActionParamsStruct params;
  3841. params.Set_Basic(this, 100, HARVESTER_BEAT_IT);
  3842. params.Set_Movement(Vector3(0,0,0), 1.0f, 1.0f);
  3843. params.Dock_Vehicle(Get_Vector3_Parameter("Dock_Location"), Get_Vector3_Parameter("Dock_Entrance"));
  3844. Commands->Action_Dock(obj, params);
  3845. }
  3846. if (type == 722 && param == 722 && !docked)
  3847. {
  3848. Commands->Set_Animation(obj, "V_NOD_HRVSTR.V_NOD_HRVSTR", true);
  3849. ActionParamsStruct params;
  3850. params.Set_Basic(this, 100, HARVESTER_CHASE_PLAYER);
  3851. params.Set_Movement(STAR, ((float)DIFFICULTY / 10.0f) + 0.8f, 0.0f);
  3852. Commands->Action_Goto(obj, params);
  3853. }
  3854. if (type ==7800 && param == 7800)
  3855. {
  3856. power_off = true;
  3857. }
  3858. }
  3859. };
  3860. DECLARE_SCRIPT(M03_Wheres_The_Star, "Controller_ID:int, Type:int, Param:int")
  3861. {
  3862. void Entered(GameObject * obj, GameObject * enterer)
  3863. {
  3864. GameObject * controller = Commands->Find_Object(Get_Int_Parameter("Controller_ID"));
  3865. Commands->Send_Custom_Event(obj, controller, Get_Int_Parameter("Type"), Get_Int_Parameter("Param"));
  3866. }
  3867. };
  3868. DECLARE_SCRIPT(M03_Reinforce_Area, "")
  3869. {
  3870. #define INLET_POSITION1 Vector3(99.85f, -49.51f, 2.0f)
  3871. #define BASE_POSITION1 Vector3(-138.0f, 50.0f, 9.5f)
  3872. #define INLET_FACING1 170.0f
  3873. #define BASE_FACING1 -30.0f
  3874. #define INLET_POSITION2 Vector3(51.0f, -91.0f, 2.0f)
  3875. #define BASE_POSITION2 Vector3(-79.0f, 59.0f, 9.5f)
  3876. #define INLET_FACING2 75.0f
  3877. #define BASE_FACING2 -120.0f
  3878. #define BEACH_POSITION Vector3(-95.656f, -68.236f, 1.433f)
  3879. #define BEACH_FACING -180.0f
  3880. bool inlet_active, base_active, beach_active;
  3881. bool switcher, forced;
  3882. int count;
  3883. int target_killed[3];
  3884. int custom_count[3];
  3885. int max_reinforcements[3];
  3886. REGISTER_VARIABLES()
  3887. {
  3888. SAVE_VARIABLE(inlet_active, 1);
  3889. SAVE_VARIABLE(base_active, 2);
  3890. SAVE_VARIABLE(count, 3);
  3891. SAVE_VARIABLE(switcher, 4);
  3892. SAVE_VARIABLE(beach_active, 5);
  3893. SAVE_VARIABLE(target_killed, 6);
  3894. SAVE_VARIABLE(custom_count, 7);
  3895. SAVE_VARIABLE(forced, 8);
  3896. SAVE_VARIABLE(max_reinforcements, 9);
  3897. }
  3898. void Created(GameObject * obj)
  3899. {
  3900. inlet_active = base_active = switcher = false;
  3901. beach_active = true;
  3902. count = 0;
  3903. target_killed[0] = target_killed[1] = target_killed[2] = 3;
  3904. custom_count[0] = custom_count[1] = 1;
  3905. custom_count[2] = 0;
  3906. max_reinforcements[0] = max_reinforcements[1] = max_reinforcements[2] = 2;
  3907. forced = false;
  3908. }
  3909. /*void Reinforce(void)
  3910. {
  3911. GameObject * officer1 = Commands->Find_Object (300009);
  3912. GameObject * officer2 = Commands->Find_Object (300010);
  3913. /*if (inlet_active)
  3914. {
  3915. if (officer1 || officer2)
  3916. {
  3917. Commands->Start_Timer(Commands->Find_Object (1144444), this, 3.0f, INLET_REINFORCE);
  3918. }
  3919. }*/
  3920. /*else if (base_active)
  3921. {
  3922. if (max_reinforcements[2]-- <= 0)
  3923. {
  3924. return;
  3925. }
  3926. GameObject * con = Commands->Create_Object("Invisible_Object", (switcher) ? BASE_POSITION1 : BASE_POSITION2);
  3927. Commands->Set_Facing(con, (switcher) ? BASE_FACING1 : BASE_FACING2);
  3928. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  3929. if (!forced)
  3930. {
  3931. Commands->Send_Custom_Event(Owner(), Owner(), 7000, 2);
  3932. }
  3933. }*/
  3934. /*else if (beach_active)
  3935. {
  3936. if (max_reinforcements[0]-- <= 0)
  3937. {
  3938. return;
  3939. }
  3940. if (officer3 || officer4 || officer5)
  3941. {
  3942. GameObject * con = Commands->Create_Object("Invisible_Object", BEACH_POSITION);
  3943. Commands->Set_Facing(con, BEACH_FACING);
  3944. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  3945. if (!forced)
  3946. {
  3947. Commands->Send_Custom_Event(Owner(), Owner(), 7000, 0);
  3948. }
  3949. }
  3950. }
  3951. }*/
  3952. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  3953. {
  3954. if (type == 5000)
  3955. {
  3956. int *area = (int *)param;
  3957. if (beach_active)
  3958. {
  3959. *area = 0;
  3960. }
  3961. else if (inlet_active)
  3962. {
  3963. *area = 1;
  3964. }
  3965. else if (base_active)
  3966. {
  3967. *area = 2;
  3968. }
  3969. else
  3970. {
  3971. *area = -1;
  3972. }
  3973. }
  3974. if (type == 6300)
  3975. {
  3976. int *target_count = (int *)param;
  3977. if (beach_active)
  3978. {
  3979. *target_count = target_killed[0];
  3980. }
  3981. else if (inlet_active)
  3982. {
  3983. *target_count = target_killed[1];
  3984. }
  3985. else if (base_active)
  3986. {
  3987. *target_count = target_killed[2];
  3988. }
  3989. }
  3990. if (type == 6000 && param == 6000)
  3991. {
  3992. if ((beach_active && target_killed[0] != 1000) || (inlet_active && target_killed[1] != 1000) || (base_active && target_killed[2] != 1000))
  3993. {
  3994. forced = true;
  3995. /*int id = Commands->Create_Conversation("Nod_Reinforcements", 100);
  3996. Commands->Join_Conversation(NULL, id);
  3997. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0,0,0)), id);
  3998. Commands->Start_Conversation(id);*/
  3999. Commands->Start_Timer(obj, this, 3.0f, 0);
  4000. }
  4001. }
  4002. if (type == 8000)
  4003. {
  4004. custom_count[param]++;
  4005. if (custom_count[param] >= 2)
  4006. {
  4007. custom_count[param] = 1;
  4008. if (param == 2)
  4009. {
  4010. custom_count[param] = 0;
  4011. }
  4012. target_killed[param]++;
  4013. if (target_killed[param] >= 6)
  4014. {
  4015. target_killed[param] = 1000;
  4016. }
  4017. }
  4018. }
  4019. if (type == 0 && param == 2)
  4020. {
  4021. beach_active = false;
  4022. }
  4023. if (type == 1 && param == 1)
  4024. {
  4025. inlet_active = true;
  4026. }
  4027. if (type == 1 && param == 2)
  4028. {
  4029. inlet_active = false;
  4030. }
  4031. if (type == 2 && param == 1)
  4032. {
  4033. base_active = true;
  4034. }
  4035. if (type == 2 && param == 2)
  4036. {
  4037. base_active = false;
  4038. }
  4039. if (type == 1000 && param == 1000 && (inlet_active || base_active || beach_active))
  4040. {
  4041. count++;
  4042. if ((beach_active && count >= target_killed[0]) || (inlet_active && count >= target_killed[1]) || (base_active && count >= target_killed[2]))
  4043. {
  4044. forced = false;
  4045. /*int id = Commands->Create_Conversation("Nod_Reinforcements", 100);
  4046. Commands->Join_Conversation(NULL, id);
  4047. Commands->Join_Conversation(Commands->Get_A_Star(Vector3(0,0,0)), id);
  4048. Commands->Start_Conversation(id);*/
  4049. Commands->Start_Timer(obj, this, 3.0f, 0);
  4050. count = 0;
  4051. }
  4052. }
  4053. if (type == UPDATE)
  4054. {
  4055. Commands->Send_Custom_Event(obj, sender, BASE, base_active);
  4056. Commands->Send_Custom_Event(obj, sender, INLET, inlet_active);
  4057. Commands->Send_Custom_Event(obj, sender, BEACH, beach_active);
  4058. }
  4059. }
  4060. void Timer_Expired(GameObject * obj, int timer_id)
  4061. {
  4062. if (timer_id == 0)
  4063. {
  4064. switcher = !switcher;
  4065. //Reinforce();
  4066. }
  4067. if (timer_id == INLET_REINFORCE)
  4068. {
  4069. if (max_reinforcements[1]-- <= 0)
  4070. {
  4071. return;
  4072. }
  4073. GameObject * con = Commands->Create_Object("Invisible_Object", (switcher) ? INLET_POSITION1 : INLET_POSITION2);
  4074. Commands->Set_Facing(con, (switcher) ? INLET_FACING1 : INLET_FACING2);
  4075. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  4076. if (!forced)
  4077. {
  4078. Commands->Send_Custom_Event(Owner(), Owner(), 7000, 1);
  4079. }
  4080. }
  4081. }
  4082. };
  4083. DECLARE_SCRIPT(M03_Officer_With_Key_Card, "")
  4084. {
  4085. void Killed(GameObject * obj, GameObject * killer)
  4086. {
  4087. if (!Commands->Has_Key(killer, 1))
  4088. {
  4089. Vector3 pos = Commands->Get_Position(obj) + Vector3(0,0,0.5);
  4090. GameObject * key = Commands->Create_Object("Level_01_Keycard", pos);
  4091. Commands->Attach_Script(key, "M03_Key_Card", "");
  4092. int id = Commands->Create_Conversation("M03CON005", 99, 2000, true);
  4093. Commands->Join_Conversation(NULL, id);
  4094. Commands->Join_Conversation(STAR, id);
  4095. Commands->Start_Conversation(id, 100005);
  4096. Commands->Monitor_Conversation(obj, id);
  4097. }
  4098. }
  4099. };
  4100. DECLARE_SCRIPT(M03_Officer_With_Key_Card2, "")
  4101. {
  4102. void Killed(GameObject * obj, GameObject * killer)
  4103. {
  4104. if (!Commands->Has_Key(killer, 2))
  4105. {
  4106. Vector3 pos = Commands->Get_Position(obj) + Vector3(0,0,0.5);
  4107. Commands->Create_Object("Level_02_Keycard", pos);
  4108. }
  4109. }
  4110. };
  4111. DECLARE_SCRIPT(M03_Key_Card, "")
  4112. {
  4113. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4114. {
  4115. GameObject * con = Commands->Find_Object(1100004);
  4116. if (con)
  4117. {
  4118. //Commands->Send_Custom_Event(obj, con, 307, 3);
  4119. Commands->Send_Custom_Event(obj, con, 307, 1);
  4120. }
  4121. }
  4122. };
  4123. DECLARE_SCRIPT(M03_Chinook_ParaDrop, "Preset:string")
  4124. {
  4125. int chinook_id;
  4126. bool dead;
  4127. int out;
  4128. REGISTER_VARIABLES()
  4129. {
  4130. SAVE_VARIABLE(chinook_id, 1);
  4131. SAVE_VARIABLE(dead, 2);
  4132. SAVE_VARIABLE(out, 3);
  4133. }
  4134. void Created(GameObject * obj)
  4135. {
  4136. Vector3 loc = Commands->Get_Position(obj);
  4137. float facing = Commands->Get_Facing(obj);
  4138. GameObject *chinook_rail = Commands->Create_Object("Generic_Cinematic", loc);
  4139. Commands->Set_Model(chinook_rail, "X5D_Chinookfly");
  4140. Commands->Set_Facing(chinook_rail, facing);
  4141. Commands->Set_Animation(chinook_rail, "X5D_Chinookfly.X5D_Chinookfly", false);
  4142. GameObject *chinook = Commands->Create_Object("Nod_Transport_Helicopter", loc);
  4143. Commands->Set_Facing(chinook, facing);
  4144. Commands->Set_Animation(chinook, "v_Nod_trnspt.XG_RTN_TrnsptA", true);
  4145. Commands->Attach_To_Object_Bone(chinook, chinook_rail, "BN_Chinook_1");
  4146. dead = false;
  4147. out = 0;
  4148. char params[10];
  4149. sprintf(params, "%d", Commands->Get_ID(obj));
  4150. Commands->Attach_Script(chinook, "M03_Reinforcement_Chinook", params);
  4151. chinook_id = Commands->Get_ID(chinook);
  4152. // Destroy Chinook
  4153. Commands->Start_Timer(obj, this, 280.0f/30.0f, 0);
  4154. // Parachutes
  4155. Commands->Start_Timer(obj, this, 169.0f/30.0f, 1);
  4156. Commands->Start_Timer(obj, this, 179.0f/30.0f, 2);
  4157. Commands->Start_Timer(obj, this, 198.0f/30.0f, 3);
  4158. // Soldiers
  4159. Commands->Start_Timer(obj, this, 145.0f/30.0f, 4);
  4160. Commands->Start_Timer(obj, this, 155.0f/30.0f, 5);
  4161. Commands->Start_Timer(obj, this, 165.0f/30.0f, 6);
  4162. }
  4163. void Timer_Expired(GameObject * obj, int timer_id)
  4164. {
  4165. Vector3 loc = Commands->Get_Position(obj);
  4166. const char * preset = Get_Parameter("Preset");
  4167. float facing = Commands->Get_Facing(obj);
  4168. switch (timer_id)
  4169. {
  4170. case 0:
  4171. GameObject *chinook;
  4172. chinook = Commands->Find_Object(chinook_id);
  4173. Commands->Destroy_Object(chinook);
  4174. break;
  4175. case 1:
  4176. if (out >= 1)
  4177. {
  4178. GameObject *para1;
  4179. para1 = Commands->Create_Object("Generic_Cinematic", loc);
  4180. Commands->Set_Facing(para1, facing);
  4181. Commands->Set_Model(para1, "X5D_Parachute");
  4182. Commands->Set_Animation(para1, "X5D_Parachute.X5D_ParaC_1", false);
  4183. Commands->Create_3D_Sound_At_Bone("parachute_open", para1, "ROOTTRANSFORM");
  4184. Commands->Attach_Script(para1, "M03_No_More_Parachute", "");
  4185. }
  4186. break;
  4187. case 2:
  4188. if (out >= 2)
  4189. {
  4190. GameObject *para2;
  4191. para2 = Commands->Create_Object("Generic_Cinematic", loc);
  4192. Commands->Set_Facing(para2, facing);
  4193. Commands->Set_Model(para2, "X5D_Parachute");
  4194. Commands->Set_Animation(para2, "X5D_Parachute.X5D_ParaC_2", false);
  4195. Commands->Create_3D_Sound_At_Bone("parachute_open", para2, "ROOTTRANSFORM");
  4196. Commands->Attach_Script(para2, "M03_No_More_Parachute", "");
  4197. }
  4198. break;
  4199. case 3:
  4200. if (out == 3)
  4201. {
  4202. GameObject *para3;
  4203. para3 = Commands->Create_Object("Generic_Cinematic", loc);
  4204. Commands->Set_Facing(para3, facing);
  4205. Commands->Set_Model(para3, "X5D_Parachute");
  4206. Commands->Set_Animation(para3, "X5D_Parachute.X5D_ParaC_3", false);
  4207. Commands->Create_3D_Sound_At_Bone("parachute_open", para3, "ROOTTRANSFORM");
  4208. Commands->Attach_Script(para3, "M03_No_More_Parachute", "");
  4209. }
  4210. break;
  4211. case 4:
  4212. if (!dead)
  4213. {
  4214. GameObject *box1 = Commands->Create_Object("Generic_Cinematic", loc);
  4215. Commands->Set_Model(box1, "X5D_Box01");
  4216. Commands->Set_Facing(box1, facing);
  4217. Commands->Set_Animation(box1, "X5D_Box01.X5D_Box01", false);
  4218. GameObject *soldier1;
  4219. soldier1 = Commands->Create_Object_At_Bone(box1, preset, "Box01");
  4220. Commands->Set_Facing(soldier1, facing);
  4221. Commands->Attach_Script(soldier1, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  4222. Commands->Attach_Script(soldier1, "M03_Killed_Sound", "");
  4223. Commands->Attach_Script(soldier1, "M03_Paratrooper_Run", "");
  4224. Commands->Attach_Script(soldier1, "DLS_Volcano_Stumble", "");
  4225. Commands->Attach_To_Object_Bone( soldier1, box1, "Box01" );
  4226. Commands->Set_Animation(soldier1, "s_a_human.H_A_X5D_ParaT_1", false);
  4227. out++;
  4228. /*if ((out - 1) == DIFFICULTY)
  4229. {
  4230. dead = true;
  4231. }*/
  4232. }
  4233. break;
  4234. case 5:
  4235. if (!dead)
  4236. {
  4237. GameObject *box2 = Commands->Create_Object("Generic_Cinematic", loc);
  4238. Commands->Set_Model(box2, "X5D_Box02");
  4239. Commands->Set_Facing(box2, facing);
  4240. Commands->Set_Animation(box2, "X5D_Box02.X5D_Box02", false);
  4241. GameObject *soldier2;
  4242. soldier2 = Commands->Create_Object_At_Bone(box2, preset, "Box02");
  4243. Commands->Set_Facing(soldier2, facing);
  4244. Commands->Attach_Script(soldier2, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  4245. Commands->Attach_Script(soldier2, "M03_Killed_Sound", "");
  4246. Commands->Attach_Script(soldier2, "M03_Paratrooper_Run", "");
  4247. Commands->Attach_Script(soldier2, "DLS_Volcano_Stumble", "");
  4248. Commands->Set_Animation(soldier2, "s_a_human.H_A_X5D_ParaT_2", false);
  4249. Commands->Attach_To_Object_Bone( soldier2, box2, "Box02" );
  4250. out++;
  4251. /*if ((out - 1) == DIFFICULTY)
  4252. {
  4253. dead = true;
  4254. }*/
  4255. }
  4256. break;
  4257. case 6:
  4258. if (!dead)
  4259. {
  4260. GameObject *box3 = Commands->Create_Object("Generic_Cinematic", loc);
  4261. Commands->Set_Model(box3, "X5D_Box03");
  4262. Commands->Set_Facing(box3, facing);
  4263. Commands->Set_Animation(box3, "X5D_Box03.X5D_Box03", false);
  4264. GameObject *soldier3;
  4265. soldier3 = Commands->Create_Object_At_Bone(box3, preset, "Box03");
  4266. Commands->Set_Facing(soldier3, facing);
  4267. Commands->Attach_Script(soldier3, "RMV_Trigger_Killed", "1144444, 1000, 1000");
  4268. Commands->Attach_Script(soldier3, "M03_Killed_Sound", "");
  4269. Commands->Attach_Script(soldier3, "M03_Paratrooper_Run", "");
  4270. Commands->Attach_Script(soldier3, "DLS_Volcano_Stumble", "");
  4271. Commands->Set_Animation(soldier3, "s_a_human.H_A_X5D_ParaT_3", false);
  4272. Commands->Attach_To_Object_Bone( soldier3, box3, "Box03" );
  4273. out++;
  4274. /*if ((out - 1) == DIFFICULTY)
  4275. {
  4276. dead = true;
  4277. }*/
  4278. }
  4279. break;
  4280. }
  4281. }
  4282. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4283. {
  4284. if (type == 23000 && param == 23000)
  4285. {
  4286. dead = true;
  4287. }
  4288. }
  4289. };
  4290. DECLARE_SCRIPT(M03_No_More_Parachute, "")
  4291. {
  4292. void Destroyed(GameObject * obj)
  4293. {
  4294. Commands->Create_3D_Sound_At_Bone("parachute_away", obj, "ROOTTRANSFORM");
  4295. }
  4296. };
  4297. DECLARE_SCRIPT(M03_Reinforcement_Chinook, "Controller_ID:int")
  4298. {
  4299. int sound_id;
  4300. REGISTER_VARIABLES()
  4301. {
  4302. SAVE_VARIABLE(sound_id, 1);
  4303. }
  4304. void Created(GameObject * obj)
  4305. {
  4306. sound_id = Commands->Create_3D_Sound_At_Bone("Chinook_Idle_01", obj, "V_FUSELAGE");
  4307. }
  4308. void Killed(GameObject * obj, GameObject * killer)
  4309. {
  4310. GameObject * con = Commands->Find_Object(Get_Int_Parameter(0));
  4311. Commands->Send_Custom_Event(obj, con, 23000, 23000);
  4312. }
  4313. void Destroyed(GameObject * obj)
  4314. {
  4315. Commands->Stop_Sound(sound_id, true);
  4316. }
  4317. };
  4318. DECLARE_SCRIPT(M03_Staged_Conversation_1, "Soldier_1_ID:int, Soldier_2_ID:int")
  4319. {
  4320. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4321. {
  4322. if (type == 1000 && param == 1000)
  4323. {
  4324. GameObject * soldier1 = Commands->Find_Object(Get_Int_Parameter(0));
  4325. GameObject * soldier2 = Commands->Find_Object(Get_Int_Parameter(1));
  4326. if (soldier1 && soldier2)
  4327. {
  4328. /*int id = Commands->Create_Conversation("Volcano", INNATE_PRIORITY_ENEMY_SEEN - 1, 20.0f, true);
  4329. Commands->Join_Conversation(soldier1, id);
  4330. Commands->Join_Conversation(soldier2, id);
  4331. Commands->Start_Conversation(id);
  4332. Commands->Monitor_Conversation(obj, id);*/
  4333. }
  4334. }
  4335. }
  4336. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4337. {
  4338. if (reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  4339. {
  4340. GameObject * soldier1 = Commands->Find_Object(Get_Int_Parameter(0));
  4341. GameObject * soldier2 = Commands->Find_Object(Get_Int_Parameter(1));
  4342. if (soldier1)
  4343. {
  4344. Commands->Send_Custom_Event(obj, soldier1, 100, 100);
  4345. }
  4346. if (soldier2)
  4347. {
  4348. Commands->Send_Custom_Event(obj, soldier2, 100, 100);
  4349. }
  4350. }
  4351. }
  4352. };
  4353. DECLARE_SCRIPT(M03_Staged_Conversation_Soldier, "")
  4354. {
  4355. void Created(GameObject * obj)
  4356. {
  4357. Commands->Start_Timer(obj, this, 0.5f, 0);
  4358. }
  4359. void Timer_Expired(GameObject * obj, int timer_id)
  4360. {
  4361. Commands->Set_Innate_Is_Stationary(obj, true);
  4362. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, false);
  4363. Commands->Innate_Soldier_Enable_Gunshot_Heard(obj, false);
  4364. Commands->Innate_Soldier_Enable_Bullet_Heard(obj, false);
  4365. }
  4366. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  4367. {
  4368. Commands->Set_Innate_Is_Stationary(obj, false);
  4369. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  4370. Commands->Innate_Soldier_Enable_Gunshot_Heard(obj, true);
  4371. Commands->Innate_Soldier_Enable_Bullet_Heard(obj, true);
  4372. }
  4373. void Damaged(GameObject * obj, GameObject * damager, float amount)
  4374. {
  4375. Commands->Set_Innate_Is_Stationary(obj, false);
  4376. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  4377. Commands->Innate_Soldier_Enable_Gunshot_Heard(obj, true);
  4378. Commands->Innate_Soldier_Enable_Bullet_Heard(obj, true);
  4379. }
  4380. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4381. {
  4382. Commands->Set_Innate_Is_Stationary(obj, false);
  4383. Commands->Innate_Soldier_Enable_Footsteps_Heard(obj, true);
  4384. Commands->Innate_Soldier_Enable_Gunshot_Heard(obj, true);
  4385. Commands->Innate_Soldier_Enable_Bullet_Heard(obj, true);
  4386. }
  4387. };
  4388. DECLARE_SCRIPT(M03_Beach_Turret, "")
  4389. {
  4390. void Created(GameObject * obj)
  4391. {
  4392. Commands->Start_Timer(obj, this, 1.0f, 0);
  4393. }
  4394. void Timer_Expired(GameObject * obj, int timer_id)
  4395. {
  4396. GameObject * gunboat = Commands->Find_Object(1100003);
  4397. ActionParamsStruct params;
  4398. params.Set_Basic(this, 90, 0);
  4399. params.Set_Attack(gunboat, 300.0f, 6.0f - (float)DIFFICULTY, true);
  4400. Commands->Action_Attack(obj, params);
  4401. }
  4402. void Killed(GameObject * obj, GameObject * killer)
  4403. {
  4404. Vector3 my_pos = Commands->Get_Position(obj);
  4405. float facing = Commands->Get_Facing(obj);
  4406. GameObject * destroyed_turret = Commands->Create_Object("Nod_Turret_Destroyed", my_pos);
  4407. Commands->Set_Facing(destroyed_turret, facing);
  4408. Commands->Attach_Script(destroyed_turret, "M03_Destroyed_Turret", "");
  4409. }
  4410. };
  4411. DECLARE_SCRIPT(M03_SAM_Site_Logic, "")
  4412. {
  4413. bool target_acquired;
  4414. int current, ignore_ids[10];
  4415. REGISTER_VARIABLES()
  4416. {
  4417. SAVE_VARIABLE(target_acquired, 1);
  4418. SAVE_VARIABLE(ignore_ids, 2);
  4419. SAVE_VARIABLE(current, 3);
  4420. }
  4421. void Created(GameObject * obj)
  4422. {
  4423. Commands->Enable_Enemy_Seen(obj, true);
  4424. target_acquired = false;
  4425. current = 0;
  4426. for (int x = 0; x < 10; x++)
  4427. {
  4428. ignore_ids[x] = 0;
  4429. }
  4430. Commands->Start_Timer(obj, this, Commands->Get_Random(2, 3), 1);
  4431. }
  4432. bool Is_Ignore_Target(int id)
  4433. {
  4434. bool retval = false;
  4435. for (int x = 0; x < current; x++)
  4436. {
  4437. if (ignore_ids[x] == id)
  4438. {
  4439. retval = true;
  4440. break;
  4441. }
  4442. }
  4443. return retval;
  4444. }
  4445. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  4446. {
  4447. if (target_acquired)
  4448. {
  4449. return;
  4450. }
  4451. if (Commands->Is_A_Star(enemy) || Is_Ignore_Target(Commands->Get_ID(enemy)))
  4452. {
  4453. return;
  4454. }
  4455. Vector3 target_pos = Commands->Get_Position(enemy);
  4456. Vector3 my_pos = Commands->Get_Position(obj);
  4457. if (target_pos.Z - my_pos.Z >= 5.0f)
  4458. {
  4459. target_acquired = true;
  4460. ActionParamsStruct params;
  4461. params.Set_Basic(this, 90, 0);
  4462. params.Set_Attack(enemy, 500.0f, 0.0f, true);
  4463. params.AttackCheckBlocked = false;
  4464. Commands->Action_Attack(obj, params);
  4465. Commands->Start_Timer(obj, this, 2.0f, 0);
  4466. }
  4467. }
  4468. void Timer_Expired(GameObject * obj, int timer_id)
  4469. {
  4470. if (timer_id == 0)
  4471. {
  4472. target_acquired = false;
  4473. Commands->Action_Reset(obj, 95);
  4474. }
  4475. if (timer_id == 1)
  4476. {
  4477. Vector3 my_target = Commands->Get_Position(obj);
  4478. my_target.X += Commands->Get_Random( -10.0f , 10.0f);
  4479. my_target.Y += Commands->Get_Random( -10.0f , 10.0f);
  4480. my_target.Z += Commands->Get_Random( 2.0f, 6.0f);
  4481. ActionParamsStruct params;
  4482. params.Set_Basic( this, 80, 20 );
  4483. params.Set_Attack( my_target, 0, 0, true );
  4484. params.AttackCheckBlocked = true;
  4485. Commands->Action_Attack (obj, params);
  4486. Commands->Start_Timer(obj, this, Commands->Get_Random(2, 3), 1);
  4487. }
  4488. }
  4489. void Killed(GameObject * obj, GameObject * killer)
  4490. {
  4491. Vector3 my_position = Commands->Get_Position ( obj );
  4492. float my_facing = Commands->Get_Facing ( obj );
  4493. GameObject * destroyedSam = Commands->Create_Object ( "M01_Destroyed_SAM", my_position);
  4494. Commands->Set_Facing ( destroyedSam, my_facing );
  4495. Commands->Attach_Script(destroyedSam, "M01_Destroyed_SAMSITE_JDG", "");
  4496. Commands->Attach_Script(destroyedSam, "M03_Destroyed_SAM_Site", "");
  4497. }
  4498. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4499. {
  4500. if (type == M00_CUSTOM_SAM_SITE_IGNORE && current < 10 && current >= 0)
  4501. {
  4502. ignore_ids[current++] = param;
  4503. }
  4504. }
  4505. };
  4506. DECLARE_SCRIPT(M03_Destroyed_SAM_Site, "")
  4507. {
  4508. void Created(GameObject * obj)
  4509. {
  4510. Commands->Start_Timer(obj, this, 1.0f, 0);
  4511. }
  4512. void Timer_Expired(GameObject * obj, int timer_id)
  4513. {
  4514. Commands->Create_2D_Sound("00-N170E");
  4515. }
  4516. };
  4517. DECLARE_SCRIPT(M03_Destroyed_Turret, "")
  4518. {
  4519. void Created(GameObject * obj)
  4520. {
  4521. Commands->Start_Timer(obj, this, 1.0f, 0);
  4522. Commands->Start_Timer(obj, this, 4.0f, 1);
  4523. }
  4524. void Timer_Expired(GameObject * obj, int timer_id)
  4525. {
  4526. if (timer_id == 0)
  4527. {
  4528. Commands->Create_2D_Sound("EVA_Enemy_Structure_Destroyed");
  4529. }
  4530. else if (timer_id == 1)
  4531. {
  4532. /*int id = Commands->Create_Conversation("Turret_Destroyed");
  4533. Commands->Join_Conversation(NULL, id);
  4534. Commands->Join_Conversation(STAR, id);
  4535. Commands->Start_Conversation(id);*/
  4536. }
  4537. }
  4538. };
  4539. DECLARE_SCRIPT(M03_Structure_Powerup_Drop, "Powerup:string")
  4540. {
  4541. void Killed(GameObject * obj, GameObject * killed)
  4542. {
  4543. Vector3 pos = Commands->Get_Position(obj);
  4544. float facing = Commands->Get_Facing(obj);
  4545. facing = facing + 180.0f;
  4546. pos.X += cos(DEG_TO_RADF(facing)) * 2.5f;
  4547. pos.Y += sin(DEG_TO_RADF(facing)) * 2.5f;
  4548. pos.Z += 0.5f;
  4549. const char *powerup = Get_Parameter("Powerup");
  4550. Commands->Create_Object(powerup, pos);
  4551. }
  4552. };
  4553. DECLARE_SCRIPT(M03_Beach_Scenario_Controller, "")
  4554. {
  4555. int count;
  4556. REGISTER_VARIABLES()
  4557. {
  4558. SAVE_VARIABLE(count, 1);
  4559. }
  4560. void Created(GameObject * obj)
  4561. {
  4562. count = 0;
  4563. }
  4564. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4565. {
  4566. count++;
  4567. if (count >= 4)
  4568. {
  4569. count = 0;
  4570. GameObject * obj_con = Commands->Find_Object(1100004);
  4571. if (obj_con && Commands->Find_Object (1100003))
  4572. {
  4573. GameObject * obj_con = Commands->Find_Object(1100004);
  4574. Commands->Send_Custom_Event(obj, obj_con, 301, 3);
  4575. Commands->Send_Custom_Event(obj, obj_con, 301, 1);
  4576. int id = Commands->Create_Conversation("M03CON013", 99, 2000, true);
  4577. Commands->Join_Conversation(NULL, id);
  4578. Commands->Start_Conversation(id, 100013);
  4579. Commands->Monitor_Conversation(obj, id);
  4580. Commands->Grant_Key(STAR, 20, true);
  4581. }
  4582. }
  4583. }
  4584. };
  4585. /*DECLARE_SCRIPT(M03_Evacuation_Controller, "Preset:string")
  4586. {
  4587. bool active;
  4588. REGISTER_VARIABLES()
  4589. {
  4590. SAVE_VARIABLE(active, 1);
  4591. }
  4592. void Created(GameObject * obj)
  4593. {
  4594. active = false;
  4595. }
  4596. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4597. {
  4598. if (type == 100 && param == 100)
  4599. {
  4600. active = true;
  4601. Commands->Start_Timer(obj, this, 1.0f, 0);
  4602. }
  4603. else if (type == 200 && param == 200)
  4604. {
  4605. active = false;
  4606. }
  4607. }
  4608. void Timer_Expired(GameObject * obj, int timer_id)
  4609. {
  4610. int building = Get_Int_Random(0, 2);
  4611. const char * preset = Get_Parameter("Preset");
  4612. GameObject * runner = Commands->Create_Object(preset, Get_Spawn_Loc(building));
  4613. if (runner)
  4614. {
  4615. char params[20];
  4616. sprintf(params, "%d", building);
  4617. Commands->Attach_Script(runner, "M03_Evacuator", params);
  4618. }
  4619. if (active)
  4620. {
  4621. Commands->Start_Timer(obj, this, 20.0f, 0);
  4622. }
  4623. }
  4624. Vector3 Get_Spawn_Loc(int building)
  4625. {
  4626. Vector3 retval(0,0,0);
  4627. switch (building)
  4628. {
  4629. case 0: retval.Set(-157.0f, -28.0f, 1.214f); //Refinery
  4630. break;
  4631. case 1: retval.Set(-105.0f, 49.0f, -1.948f); //Comm center
  4632. break;
  4633. case 2: retval.Set(-72.0f, 19.0f, 4.718f); //Power plant
  4634. break;
  4635. }
  4636. return retval;
  4637. }
  4638. };*/
  4639. /*DECLARE_SCRIPT(M03_Evacuator, "Building:int")
  4640. {
  4641. void Created(GameObject * obj)
  4642. {
  4643. Commands->Grant_Key(obj, 6, true);
  4644. Commands->Grant_Key(obj, 2, true);
  4645. ActionParamsStruct params;
  4646. params.Set_Basic(this, 99, 0);
  4647. params.Set_Movement(Vector3(0,0,0), RUN, 1.0f);
  4648. params.WaypathID = Get_Waypath(Get_Int_Parameter("Building"));
  4649. params.WaypathSplined = true;
  4650. Commands->Action_Goto(obj, params);
  4651. }
  4652. int Get_Waypath(int building)
  4653. {
  4654. int waypaths[3][4] = {{1144741, 1144741, 1144767, 1144767},
  4655. {1144800, 1144785, 1144816, 1144835},
  4656. {1144920, 1144851, 1144898, 1144873}};
  4657. return waypaths[building][Get_Int_Random(0, 3)];
  4658. }
  4659. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4660. {
  4661. if (reason != ACTION_COMPLETE_NORMAL)
  4662. {
  4663. return;
  4664. }
  4665. if (action_id == 0)
  4666. {
  4667. ActionParamsStruct params;
  4668. params.Set_Basic(this, 99, 1);
  4669. params.Set_Movement(Vector3(0,0,0), RUN, 1.0f);
  4670. params.WaypathID = 1144950;
  4671. params.WaypathSplined = true;
  4672. Commands->Action_Goto(obj, params);
  4673. }
  4674. if (action_id == 1)
  4675. {
  4676. Commands->Destroy_Object(obj);
  4677. }
  4678. }
  4679. };*/
  4680. /*DECLARE_SCRIPT(M03_Dock_Evacuation_Controller, "")
  4681. {
  4682. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  4683. {
  4684. if (type == 100 && param == 100)
  4685. {
  4686. Commands->Start_Timer(obj, this, 1.0f, 0);
  4687. }
  4688. }
  4689. void Timer_Expired(GameObject * obj, int timer_id)
  4690. {
  4691. int building = Get_Int_Random(0, 2);
  4692. GameObject * runner = Commands->Create_Object("M03_Evacuator", Get_Spawn_Loc(building));
  4693. if (runner)
  4694. {
  4695. char params[20];
  4696. sprintf(params, "%d", building);
  4697. Commands->Attach_Script(runner, "M03_Dock_Evacuator", params);
  4698. }
  4699. Commands->Start_Timer(obj, this, 30.0f, 0);
  4700. }
  4701. Vector3 Get_Spawn_Loc(int building)
  4702. {
  4703. Vector3 retval(0,0,0);
  4704. switch (building)
  4705. {
  4706. case 0: retval.Set(-214.0f, 52.0f, 4.785f); //Q-hut one
  4707. break;
  4708. case 1: retval.Set(-237.0f, 79.0f, 4.758f); //Q-hut two
  4709. break;
  4710. case 2: retval.Set(-235.0f, 100.0f, 4.758f); //Q-hut three
  4711. break;
  4712. }
  4713. return retval;
  4714. }
  4715. };*/
  4716. /*DECLARE_SCRIPT(M03_Dock_Evacuator, "Building:int")
  4717. {
  4718. void Created(GameObject * obj)
  4719. {
  4720. Commands->Grant_Key(obj, 6, true);
  4721. Commands->Grant_Key(obj, 2, true);
  4722. ActionParamsStruct params;
  4723. params.Set_Basic(this, 99, 0);
  4724. params.Set_Movement(Vector3(0,0,0), RUN, 1.0f);
  4725. params.WaypathID = Get_Waypath(Get_Int_Parameter("Building"));
  4726. params.WaypathSplined = true;
  4727. Commands->Action_Goto(obj, params);
  4728. }
  4729. int Get_Waypath(int building)
  4730. {
  4731. int waypaths[3] = {1144983, 1145002, 1145011};
  4732. return waypaths[building];
  4733. }
  4734. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4735. {
  4736. if (reason != ACTION_COMPLETE_NORMAL)
  4737. {
  4738. return;
  4739. }
  4740. if (action_id == 0)
  4741. {
  4742. ActionParamsStruct params;
  4743. params.Set_Basic(this, 99, 1);
  4744. params.Set_Movement(Vector3(0,0,0), RUN, 1.0f);
  4745. params.WaypathID = 1145021;
  4746. params.WaypathSplined = true;
  4747. Commands->Action_Goto(obj, params);
  4748. }
  4749. if (action_id == 1)
  4750. {
  4751. Commands->Destroy_Object(obj);
  4752. }
  4753. }
  4754. };*/
  4755. DECLARE_SCRIPT(DLS_Volcano_Active, "Receive_Type=0:int, Receive_Param=0:int, Volcano_Timer_Id=0:int, Volcano_Delay=0.0:float, Explosion_Delay_Min=0.0:float, Explosion_Delay_Max=0.0:float, Rumble_Delay_Min=0.0:float, Rumble_Delay_Max=0.0:float, Debug_Mode=0:int")
  4756. {
  4757. int receive_type;
  4758. int receive_param;
  4759. int volcano_timer_id;
  4760. float volcano_delay;
  4761. float explosion_delay_min;
  4762. float explosion_delay_max;
  4763. float rumble_delay_min;
  4764. float rumble_delay_max;
  4765. bool volcano_active;
  4766. bool debug_mode;
  4767. float explosion_delay;
  4768. float rumble_delay;
  4769. Vector3 exploc[16];
  4770. REGISTER_VARIABLES()
  4771. {
  4772. SAVE_VARIABLE(receive_type, 1);
  4773. SAVE_VARIABLE(receive_param, 2);
  4774. SAVE_VARIABLE(volcano_timer_id, 3);
  4775. SAVE_VARIABLE(volcano_delay, 4);
  4776. SAVE_VARIABLE(explosion_delay_min, 5);
  4777. SAVE_VARIABLE(explosion_delay_max, 6);
  4778. SAVE_VARIABLE(rumble_delay_min, 7);
  4779. SAVE_VARIABLE(rumble_delay_max, 8);
  4780. SAVE_VARIABLE(volcano_active, 9);
  4781. SAVE_VARIABLE(debug_mode, 10);
  4782. SAVE_VARIABLE(explosion_delay, 11);
  4783. SAVE_VARIABLE(rumble_delay, 12);
  4784. SAVE_VARIABLE(exploc, 13);
  4785. }
  4786. void Created(GameObject * obj)
  4787. {
  4788. // SCRIPT_DEBUG_MESSAGE (("Volcano Script Created.\n"));
  4789. receive_type = Get_Int_Parameter("Receive_Type");
  4790. receive_param = Get_Int_Parameter("Receive_Param");
  4791. volcano_timer_id = Get_Int_Parameter("Volcano_Timer_Id");
  4792. volcano_delay = Get_Int_Parameter("Volcano_Delay");
  4793. explosion_delay_min = Get_Float_Parameter("Explosion_Delay_Min");
  4794. explosion_delay_max = Get_Float_Parameter("Explosion_Delay_Max");
  4795. rumble_delay_min = Get_Float_Parameter("Rumble_Delay_Min");
  4796. rumble_delay_max = Get_Float_Parameter("Rumble_Delay_Max");
  4797. volcano_active = false;
  4798. exploc[0].Set(11.53f,20.95f,50.73f);
  4799. exploc[1].Set(9.8f,11.69f,53.99f);
  4800. exploc[2].Set(4.24f,8.67f,40.85f);
  4801. exploc[3].Set(-15.75f,14.05f,30.02f);
  4802. exploc[4].Set(9.05f,-2.1f,45.83f);
  4803. exploc[5].Set(-57.34f,22.78f,16.88f);
  4804. exploc[6].Set(-151.27f,18.56f,17.59f);
  4805. exploc[7].Set(-98.43f,-7.34f,8.65f);
  4806. exploc[8].Set(-103.61f,17.34f,9.21f);
  4807. exploc[9].Set(-117.75f,0.22f,8.95f);
  4808. exploc[10].Set(-171.99f,71.87f,14.4f);
  4809. exploc[11].Set(-196.42f,87.29f,11.5f);
  4810. exploc[12].Set(-269.45f,40.87f,4.93f);
  4811. exploc[13].Set(-260.96f,132.15f,8.45f);
  4812. exploc[14].Set(-144.31f,44.4f,9.33f);
  4813. exploc[15].Set(-68.42f,22.18f,20.73f);
  4814. }
  4815. void Custom(GameObject* obj, int type, int param, GameObject* sender)
  4816. {
  4817. if((type == receive_type) && (param == receive_param))
  4818. {
  4819. Commands->Start_Timer(obj, this, 5.0, CLOUD_DELAY);
  4820. volcano_active = true;
  4821. explosion_delay = Commands->Get_Random(explosion_delay_min, explosion_delay_max);
  4822. Commands->Start_Timer(obj, this, explosion_delay, 6701);
  4823. rumble_delay = Commands->Get_Random(rumble_delay_min, rumble_delay_max);
  4824. Commands->Start_Timer(obj, this, rumble_delay, 6702);
  4825. if(volcano_timer_id != 0)
  4826. {
  4827. Commands->Start_Timer(obj, this, volcano_delay, volcano_timer_id);
  4828. }
  4829. }
  4830. }
  4831. void Timer_Expired(GameObject* obj, int timer_id)
  4832. {
  4833. if (timer_id == CLOUD_DELAY)
  4834. {
  4835. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), DOGFIGHT_ENDED, 0);
  4836. Commands->Set_Clouds (1.0f, 1.0f, 20);
  4837. /*int id = Commands->Create_Conversation("M03CON010", 99, 2000, true);
  4838. Commands->Join_Conversation(NULL, id);
  4839. Commands->Join_Conversation(STAR, id);
  4840. Commands->Start_Conversation(id, 100010);
  4841. Commands->Monitor_Conversation(obj, id);*/
  4842. Commands->Start_Timer(obj, this, 55.0, MESSAGE_DELAY);
  4843. Commands->Start_Timer(obj, this, 10.0, ANNOUNCEMENT_DELAY);
  4844. }
  4845. if (timer_id == MESSAGE_DELAY)
  4846. {
  4847. int id = Commands->Create_Conversation("M03CON011", 99, 2000, true);
  4848. Commands->Join_Conversation(NULL, id);
  4849. Commands->Join_Conversation(STAR, id);
  4850. Commands->Start_Conversation(id, 100011);
  4851. Commands->Monitor_Conversation(obj, id);
  4852. }
  4853. if (timer_id == ANNOUNCEMENT_DELAY)
  4854. {
  4855. int id = Commands->Create_Conversation("M03CON048", 99, 2000, true);
  4856. Commands->Join_Conversation(NULL, id);
  4857. Commands->Start_Conversation(id, 100048);
  4858. Commands->Monitor_Conversation(obj, id);
  4859. Commands->Start_Timer(obj, this, 30.0, ANNOUNCEMENT_DELAY);
  4860. }
  4861. if((timer_id == 6701) && (volcano_active == true))
  4862. {
  4863. int i = Get_Int_Random(0,15);
  4864. Commands->Create_Explosion("Ground Explosions - Harmless", exploc[i], obj);
  4865. Commands->Start_Timer(obj, this, explosion_delay, 6701);
  4866. }
  4867. if((timer_id == 6702) && (volcano_active == true))
  4868. {
  4869. Vector3 volcano;
  4870. volcano.X = 0.0;
  4871. volcano.Y = 0.0;
  4872. volcano.Z = 0.0;
  4873. float camera_intensity = Commands->Get_Random(.05f,.1f);
  4874. float camera_duration = Commands->Get_Random(4.0f,8.0f);
  4875. Commands->Shake_Camera(volcano, 5000.0f, camera_intensity, camera_duration);
  4876. Commands->Start_Timer(obj, this, rumble_delay, 6702);
  4877. Commands->Create_Logical_Sound(obj, M03_SOUND_VOLCANO, volcano, 5000.0f);
  4878. Commands->Create_Sound("earthquake_large_01", Vector3(0,0,0), obj);
  4879. }
  4880. if((timer_id == volcano_timer_id) && (volcano_active == true))
  4881. {
  4882. volcano_active = false;
  4883. }
  4884. }
  4885. void Entered(GameObject* obj, GameObject* enterer)
  4886. {
  4887. volcano_active = false;
  4888. }
  4889. };
  4890. DECLARE_SCRIPT(M03_Sakura_Explosion, "")
  4891. {
  4892. void Destroyed(GameObject * obj)
  4893. {
  4894. Commands->Create_Explosion_At_Bone( "Air Explosions Twiddler", obj, "ROTOR00");
  4895. Commands->Create_Explosion_At_Bone( "Air Explosions Twiddler", obj, "TURRET");
  4896. Commands->Create_Explosion_At_Bone( "Air Explosions Twiddler", obj, "ROTOR01");
  4897. }
  4898. };
  4899. DECLARE_SCRIPT(DLS_Volcano_Stumble, "Debug_Mode=0:int")
  4900. {
  4901. enum {FALL_FORWARD, FALL_BACK, RISE_FORWARD, RISE_BACK,
  4902. FLEE_VOLCANO, STUMBLE};
  4903. bool animating;
  4904. REGISTER_VARIABLES()
  4905. {
  4906. SAVE_VARIABLE(animating, 1);
  4907. }
  4908. void Created (GameObject *obj)
  4909. {
  4910. animating = false;
  4911. Commands->Set_Innate_Take_Cover_Probability ( obj, 100.0f );
  4912. Commands->Set_Innate_Aggressiveness ( obj, 100.0f );
  4913. }
  4914. /*void Timer_Expired(GameObject* obj, int timer_id)
  4915. {
  4916. if(timer_id == 4455)
  4917. {
  4918. // Commands->Action_Reset(obj, 97.0f);
  4919. int i = Commands->Get_Random(0,3);
  4920. if(i == 0)
  4921. {
  4922. ActionParamsStruct params;
  4923. params.Set_Basic(this, 98.0f, FALL_FORWARD);
  4924. params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4925. params.Set_Animation("S_A_HUMAN.H_A_622A", false);
  4926. Commands->Action_Play_Animation(obj, params);
  4927. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4928. }
  4929. if(i == 1)
  4930. {
  4931. ActionParamsStruct params;
  4932. params.Set_Basic(this, 98.0f, STUMBLE);
  4933. params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4934. params.Set_Animation("S_A_HUMAN.H_A_611A", false);
  4935. Commands->Action_Play_Animation(obj, params);
  4936. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4937. }
  4938. if(i == 2)
  4939. {
  4940. ActionParamsStruct params;
  4941. params.Set_Basic(this, 98.0f, FALL_BACK);
  4942. params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4943. params.Set_Animation("S_A_HUMAN.H_A_632A", false);
  4944. Commands->Action_Play_Animation(obj, params);
  4945. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4946. }
  4947. }
  4948. }*/
  4949. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  4950. {
  4951. if((sound.Type == M03_SOUND_VOLCANO) && (!animating))
  4952. {
  4953. animating = true;
  4954. Commands->Action_Reset(obj, 97.0f);
  4955. int i = Commands->Get_Random_Int(0,2);
  4956. if(i == 0)
  4957. {
  4958. ActionParamsStruct params;
  4959. params.Set_Basic(this, 98.0f, FALL_FORWARD);
  4960. //params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4961. params.Set_Animation("S_A_HUMAN.H_A_622A", false);
  4962. Commands->Action_Play_Animation(obj, params);
  4963. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4964. }
  4965. if(i == 1)
  4966. {
  4967. ActionParamsStruct params;
  4968. params.Set_Basic(this, 98.0f, STUMBLE);
  4969. //params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4970. params.Set_Animation("S_A_HUMAN.H_A_611A", false);
  4971. Commands->Action_Play_Animation(obj, params);
  4972. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4973. }
  4974. if(i == 2)
  4975. {
  4976. ActionParamsStruct params;
  4977. params.Set_Basic(this, 98.0f, FALL_BACK);
  4978. //params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4979. params.Set_Animation("S_A_HUMAN.H_A_632A", false);
  4980. Commands->Action_Play_Animation(obj, params);
  4981. //Commands->Start_Timer(obj, this, 6.0f, 4455);
  4982. }
  4983. }
  4984. }
  4985. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  4986. {
  4987. switch (action_id)
  4988. {
  4989. // Animation to return units that have fallen to ground back up
  4990. case FALL_FORWARD:
  4991. {
  4992. ActionParamsStruct params;
  4993. params.Set_Basic(this, 99.0f, RISE_FORWARD);
  4994. //params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  4995. params.Set_Animation("S_A_HUMAN.H_A_H11C", false);
  4996. Commands->Action_Play_Animation(obj, params);
  4997. break;
  4998. }
  4999. case FALL_BACK:
  5000. {
  5001. ActionParamsStruct params;
  5002. params.Set_Basic(this, 99.0f, RISE_BACK);
  5003. //params.Set_Movement(Commands->Get_Position(obj), 1.0f, 2.0f);
  5004. params.Set_Animation("S_A_HUMAN.H_A_H13C", false);
  5005. Commands->Action_Play_Animation(obj, params);
  5006. break;
  5007. }
  5008. // Flee units to dock
  5009. case RISE_BACK:
  5010. {
  5011. animating = false;
  5012. ActionParamsStruct params;
  5013. params.Set_Basic(this, 70.0f, FLEE_VOLCANO);
  5014. params.Set_Movement(Vector3(-288.02f, 78.11f, 9.51f), 1.0f, 15.0f);
  5015. Commands->Action_Goto(obj, params);
  5016. break;
  5017. }
  5018. case RISE_FORWARD:
  5019. {
  5020. animating = false;
  5021. ActionParamsStruct params;
  5022. params.Set_Basic(this, 70.0f, FLEE_VOLCANO);
  5023. params.Set_Movement(Vector3(-288.02f, 78.11f, 9.51f), 1.0f, 15.0f);
  5024. Commands->Action_Goto(obj, params);
  5025. break;
  5026. }
  5027. case STUMBLE:
  5028. {
  5029. animating = false;
  5030. ActionParamsStruct params;
  5031. params.Set_Basic(this, 70.0f, FLEE_VOLCANO);
  5032. params.Set_Movement(Vector3(-288.02f, 78.11f, 9.51f), 1.0f, 15.0f);
  5033. Commands->Action_Goto(obj, params);
  5034. break;
  5035. }
  5036. }
  5037. }
  5038. };
  5039. DECLARE_SCRIPT(M03_Beach_Radio, "")
  5040. {
  5041. int conv_count;
  5042. bool conv_active;
  5043. int conv_id;
  5044. REGISTER_VARIABLES()
  5045. {
  5046. SAVE_VARIABLE(conv_count, 1);
  5047. SAVE_VARIABLE(conv_active, 2);
  5048. SAVE_VARIABLE(conv_id, 3);
  5049. }
  5050. void Created(GameObject * obj)
  5051. {
  5052. conv_count = 0;
  5053. conv_active = false;
  5054. conv_id = 0;
  5055. }
  5056. void Poked(GameObject * obj, GameObject * poker)
  5057. {
  5058. if (conv_count > 2 || conv_active)
  5059. {
  5060. return;
  5061. }
  5062. else
  5063. {
  5064. char* conv[3];
  5065. conv[0] = "M03CON044";
  5066. conv[1] = "M03CON045";
  5067. conv[2] = "M03CON046";
  5068. conv_id = Commands->Create_Conversation(conv[conv_count++]);
  5069. Commands->Join_Conversation(NULL, conv_id);
  5070. Commands->Join_Conversation(poker, conv_id);
  5071. Commands->Start_Conversation(conv_id);
  5072. Commands->Monitor_Conversation(obj, conv_id);
  5073. conv_active = true;
  5074. }
  5075. }
  5076. void Killed (GameObject *obj, GameObject *killer)
  5077. {
  5078. Commands->Stop_Conversation ( conv_id );
  5079. }
  5080. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5081. {
  5082. if (reason == ACTION_COMPLETE_CONVERSATION_ENDED)
  5083. {
  5084. conv_active = false;
  5085. }
  5086. }
  5087. };
  5088. DECLARE_SCRIPT(M03_Protect_The_MCT, "Building:int")
  5089. {
  5090. bool completed;
  5091. REGISTER_VARIABLES()
  5092. {
  5093. SAVE_VARIABLE(completed, 1);
  5094. }
  5095. void Created(GameObject * obj)
  5096. {
  5097. completed = false;
  5098. }
  5099. void Enemy_Seen(GameObject * obj, GameObject * enemy)
  5100. {
  5101. if (!completed && Commands->Is_A_Star(enemy))
  5102. {
  5103. Vector3 mct_pos;
  5104. /*int id = Commands->Create_Conversation("Protect_The_MCT");
  5105. Commands->Join_Conversation(obj, id);
  5106. Commands->Start_Conversation(id);*/
  5107. switch (Get_Int_Parameter("Building"))
  5108. {
  5109. case 0: // Refinery
  5110. mct_pos.Set(-154.921f, 15.227f, 2.382f);
  5111. Commands->Set_Innate_Soldier_Home_Location(obj, mct_pos, 10.0f);
  5112. break;
  5113. case 1: // Comm center
  5114. mct_pos.Set(-124.763f, 41.308f, -1.948f);
  5115. Commands->Set_Innate_Soldier_Home_Location(obj, mct_pos, 10.0f);
  5116. break;
  5117. case 2: // Power plant
  5118. mct_pos.Set(-84.583f, 11.975f, -7.074f);
  5119. Commands->Set_Innate_Soldier_Home_Location(obj, mct_pos, 10.0f);
  5120. break;
  5121. }
  5122. completed = true;
  5123. }
  5124. }
  5125. };
  5126. DECLARE_SCRIPT(M03_Power_Plant, "")
  5127. {
  5128. void Killed(GameObject * obj, GameObject * killer)
  5129. {
  5130. GameObject * comm_center = Commands->Find_Object(1150002);
  5131. GameObject * refinery = Commands->Find_Object(1150001);
  5132. Commands->Set_Building_Power(comm_center, false);
  5133. Commands->Set_Building_Power(refinery, false);
  5134. GameObject * harvester = Commands->Find_Object(1144518);
  5135. Commands->Send_Custom_Event(obj, harvester, 7800, 7800);
  5136. Commands->Enable_Radar ( true );
  5137. Commands->Send_Custom_Event( obj, Commands->Find_Object (2009818), POWER_KILLED, 0 );
  5138. }
  5139. };
  5140. DECLARE_SCRIPT(M03_Refinery, "")
  5141. {
  5142. void Killed(GameObject * obj, GameObject * killer)
  5143. {
  5144. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 311, 3 );
  5145. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 311, 1 );
  5146. }
  5147. };
  5148. DECLARE_SCRIPT(M03_Area_Troop_Counter, "")
  5149. {
  5150. int area_count[3];
  5151. int killed_count[3];
  5152. REGISTER_VARIABLES()
  5153. {
  5154. SAVE_VARIABLE(area_count, 1);
  5155. SAVE_VARIABLE(killed_count, 2);
  5156. }
  5157. void Created(GameObject * obj)
  5158. {
  5159. area_count[0] = 2;
  5160. area_count[1] = 4;
  5161. area_count[2] = 6;
  5162. killed_count[0] = killed_count[1] = killed_count[2] = 0;
  5163. }
  5164. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5165. {
  5166. if (type == 1000 && param == 1000)
  5167. {
  5168. int area = -1;
  5169. int target_count = -1;
  5170. Commands->Send_Custom_Event(obj, obj, 5000, (int)&area);
  5171. Commands->Send_Custom_Event(obj, obj, 6300, (int)&target_count);
  5172. if (area >= 0 && area <= 2)
  5173. {
  5174. area_count[area]--;
  5175. if ((++killed_count[area] % target_count != 0) && area_count[area] <= 0)
  5176. {
  5177. if (area_count[area] < 0)
  5178. {
  5179. area_count[area] = 0;
  5180. }
  5181. Commands->Send_Custom_Event(obj, obj, 6000, 6000);
  5182. area_count[area] += (DIFFICULTY);
  5183. }
  5184. }
  5185. }
  5186. if (type == 7000)
  5187. {
  5188. area_count[param] += (DIFFICULTY + 1);
  5189. killed_count[param] = 0;
  5190. }
  5191. }
  5192. };
  5193. ////////////////////////////////////////////////////////////////////////////////////
  5194. /////////////////////////////////////DME////////////////////////////////////////////
  5195. ////////////////////////////////////////////////////////////////////////////////////
  5196. DECLARE_SCRIPT(M03_Mission_Complete_Zone, "")
  5197. {
  5198. bool already_entered;
  5199. // Register variables to be Auto-Saved
  5200. // All variables must have a unique ID, less than 256, that never changes
  5201. REGISTER_VARIABLES()
  5202. {
  5203. SAVE_VARIABLE( already_entered, 1 );
  5204. }
  5205. void Created (GameObject * obj)
  5206. {
  5207. already_entered = false;
  5208. }
  5209. void Entered (GameObject * obj, GameObject * enterer)
  5210. {
  5211. if (!already_entered)
  5212. {
  5213. already_entered = true;
  5214. Commands->Mission_Complete ( true );
  5215. }
  5216. }
  5217. };
  5218. DECLARE_SCRIPT (M03_Zone_Enabled_Spawner, "Spawner_num:int, Control_num:int")
  5219. {
  5220. void Entered(GameObject * obj, GameObject * enterer)
  5221. {
  5222. int control = Get_Int_Parameter("Control_num");
  5223. GameObject * officer = Commands->Find_Object (control);
  5224. if (enterer == STAR)
  5225. {
  5226. if ((officer) || (Get_Int_Parameter("Control_num") == 0))
  5227. {
  5228. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_num"), true);
  5229. }
  5230. }
  5231. }
  5232. };
  5233. DECLARE_SCRIPT (M03_Killed_Disabled_Spawner, "Spawner_num:int")
  5234. {
  5235. void Killed(GameObject * obj, GameObject * killer)
  5236. {
  5237. if (killer == STAR)
  5238. {
  5239. Commands->Enable_Spawner(Get_Int_Parameter("Spawner_num"), false);
  5240. }
  5241. }
  5242. };
  5243. DECLARE_SCRIPT (M03_Goto_Star, "")
  5244. {
  5245. void Created(GameObject * obj)
  5246. {
  5247. Commands->Start_Timer(obj, this, 3.5f, GOTO_STAR);
  5248. }
  5249. void Timer_Expired (GameObject *obj, int timer_id)
  5250. {
  5251. if (timer_id == GOTO_STAR)
  5252. {
  5253. ActionParamsStruct params;
  5254. params.Set_Basic(this, 100, GOTO_STAR);
  5255. params.Set_Movement(STAR, RUN, 2.5f);
  5256. params.Set_Attack( STAR, 50, 1, true );
  5257. Commands->Action_Attack (obj, params);
  5258. Commands->Start_Timer(obj, this, 3.0f, GOTO_STAR);
  5259. }
  5260. }
  5261. };
  5262. DECLARE_SCRIPT (M03_CommCenter_Warning, "")
  5263. {
  5264. bool mct_accessed, already_entered;
  5265. REGISTER_VARIABLES()
  5266. {
  5267. SAVE_VARIABLE( mct_accessed, 1 );
  5268. SAVE_VARIABLE( already_entered, 2 );
  5269. }
  5270. void Created (GameObject *obj)
  5271. {
  5272. mct_accessed = false;
  5273. already_entered = false;
  5274. }
  5275. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5276. {
  5277. if (type == MCT_ACCESSED)
  5278. {
  5279. mct_accessed = true;
  5280. }
  5281. }
  5282. void Entered (GameObject *obj, GameObject *enterer)
  5283. {
  5284. if (!mct_accessed && !already_entered)
  5285. {
  5286. already_entered = true;
  5287. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208215), MCT_ACCESSED, 0 );
  5288. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208216), MCT_ACCESSED, 0 );
  5289. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208217), MCT_ACCESSED, 0 );
  5290. Commands->Set_HUD_Help_Text ( IDS_M03DSGN_DSGN0207I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5291. }
  5292. }
  5293. };
  5294. DECLARE_SCRIPT (M03_PowerPlant_Warning, "")
  5295. {
  5296. bool mct_accessed, already_entered;
  5297. REGISTER_VARIABLES()
  5298. {
  5299. SAVE_VARIABLE( mct_accessed, 1 );
  5300. SAVE_VARIABLE( already_entered, 2 );
  5301. }
  5302. void Created (GameObject *obj)
  5303. {
  5304. mct_accessed = false;
  5305. already_entered = false;
  5306. }
  5307. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5308. {
  5309. if (type == MCT_ACCESSED)
  5310. {
  5311. mct_accessed = true;
  5312. }
  5313. }
  5314. void Entered (GameObject *obj, GameObject *enterer)
  5315. {
  5316. if (!mct_accessed && !already_entered)
  5317. {
  5318. already_entered = true;
  5319. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208218), MCT_ACCESSED, 0 );
  5320. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208219), MCT_ACCESSED, 0 );
  5321. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208220), MCT_ACCESSED, 0 );
  5322. Commands->Set_HUD_Help_Text ( IDS_M03DSGN_DSGN0205I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5323. }
  5324. }
  5325. };
  5326. DECLARE_SCRIPT (M03_CommCenter_Arrow, "")
  5327. {
  5328. bool commcenter_alive, mct_accessed;
  5329. REGISTER_VARIABLES()
  5330. {
  5331. SAVE_VARIABLE( commcenter_alive, 1 );
  5332. SAVE_VARIABLE( mct_accessed, 2 );
  5333. }
  5334. void Created (GameObject *obj)
  5335. {
  5336. commcenter_alive = true;
  5337. mct_accessed = false;
  5338. }
  5339. void Timer_Expired (GameObject *obj, int timer_id)
  5340. {
  5341. if (timer_id == MISSION_FAIL)
  5342. {
  5343. Commands->Mission_Complete(false);
  5344. }
  5345. }
  5346. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  5347. {
  5348. if (type == MCT_ACCESSED)
  5349. {
  5350. mct_accessed = true;
  5351. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208215), MCT_ACCESSED, 0 );
  5352. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208216), MCT_ACCESSED, 0 );
  5353. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208217), MCT_ACCESSED, 0 );
  5354. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208218), MCT_ACCESSED, 0 );
  5355. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208219), MCT_ACCESSED, 0 );
  5356. Commands->Send_Custom_Event( obj, Commands->Find_Object (1208220), MCT_ACCESSED, 0 );
  5357. }
  5358. if (type == COMM_KILLED)
  5359. {
  5360. if (mct_accessed)
  5361. {
  5362. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 312, 1 );
  5363. }
  5364. if (!mct_accessed)
  5365. {
  5366. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 308, 2 );
  5367. Commands->Set_HUD_Help_Text ( IDS_M03DSGN_DSGN0208I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5368. Commands->Start_Timer(obj, this, 4.0f, MISSION_FAIL);
  5369. }
  5370. }
  5371. if (type == POWER_KILLED)
  5372. {
  5373. if (mct_accessed)
  5374. {
  5375. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 309, 1 );
  5376. }
  5377. if (!mct_accessed)
  5378. {
  5379. Commands->Send_Custom_Event( obj, Commands->Find_Object (1100004), 308, 2 );
  5380. Commands->Set_HUD_Help_Text ( IDS_M03DSGN_DSGN0206I1DSGN_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  5381. Commands->Start_Timer(obj, this, 4.0f, MISSION_FAIL);
  5382. }
  5383. }
  5384. }
  5385. };
  5386. DECLARE_SCRIPT (M03_Mct_Poke, "")
  5387. {
  5388. bool already_poked;
  5389. REGISTER_VARIABLES()
  5390. {
  5391. SAVE_VARIABLE( already_poked, 1 );
  5392. }
  5393. void Created (GameObject * obj)
  5394. {
  5395. already_poked = false;
  5396. }
  5397. void Poked(GameObject * obj, GameObject * poker)
  5398. {
  5399. if (!already_poked)
  5400. {
  5401. already_poked = true;
  5402. Commands->Send_Custom_Event( obj, Commands->Find_Object (2009818), MCT_ACCESSED, 0 );
  5403. }
  5404. }
  5405. };
  5406. DECLARE_SCRIPT (M03_Comm_Killed, "")
  5407. {
  5408. bool base_entered;
  5409. float max_health;
  5410. REGISTER_VARIABLES()
  5411. {
  5412. SAVE_VARIABLE( base_entered, 1 );
  5413. SAVE_VARIABLE( max_health, 2 );
  5414. }
  5415. void Created (GameObject * obj)
  5416. {
  5417. base_entered = false;
  5418. max_health = Commands->Get_Health (obj);
  5419. }
  5420. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  5421. {
  5422. if (type == BASE_ENTERED)
  5423. {
  5424. base_entered = true;
  5425. }
  5426. }
  5427. void Damaged (GameObject *obj, GameObject *damager, float amount)
  5428. {
  5429. if (!base_entered)
  5430. {
  5431. Commands->Set_Health (obj, max_health);
  5432. }
  5433. }
  5434. void Killed (GameObject * obj, GameObject * killer)
  5435. {
  5436. Commands->Send_Custom_Event( obj, Commands->Find_Object (2009818), COMM_KILLED, 0 );
  5437. Commands->Enable_Radar (true);
  5438. }
  5439. };
  5440. DECLARE_SCRIPT (M03_Conversation_Zone, "Conv_Num:int")
  5441. {
  5442. bool already_entered;
  5443. bool first_conv_played;
  5444. REGISTER_VARIABLES()
  5445. {
  5446. SAVE_VARIABLE( already_entered, 1 );
  5447. SAVE_VARIABLE( first_conv_played, 2 );
  5448. }
  5449. void Created (GameObject * obj)
  5450. {
  5451. already_entered = false;
  5452. first_conv_played = false;
  5453. }
  5454. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  5455. {
  5456. if (type == ENTERED)
  5457. {
  5458. already_entered = true;
  5459. }
  5460. }
  5461. void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
  5462. {
  5463. if (action_id == 100002)
  5464. {
  5465. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 300, 1, 0);
  5466. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 308, 3, 0);
  5467. }
  5468. if (action_id == 100003)
  5469. {
  5470. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 300, 1, 0);
  5471. Commands->Start_Timer (obj, this, 3.0f, 100000);
  5472. }
  5473. if (action_id == 100004)
  5474. {
  5475. GameObject *objective_controller;
  5476. objective_controller = Commands->Find_Object(1100004);
  5477. if (objective_controller)
  5478. {
  5479. Commands->Send_Custom_Event(obj, objective_controller, 307, 3);
  5480. }
  5481. }
  5482. }
  5483. void Timer_Expired(GameObject * obj, int timer_id)
  5484. {
  5485. if (timer_id == 100000)
  5486. {
  5487. int id = Commands->Create_Conversation("M03CON002", 99, 2000, true);
  5488. Commands->Join_Conversation(NULL, id);
  5489. Commands->Start_Conversation(id, 100002);
  5490. Commands->Monitor_Conversation(obj, id);
  5491. }
  5492. }
  5493. void Entered (GameObject * obj, GameObject * enterer)
  5494. {
  5495. if (Get_Int_Parameter("Conv_Num") == 4 && already_entered && !Commands->Has_Key(STAR, 1) && !first_conv_played)
  5496. {
  5497. first_conv_played = true;
  5498. int id = Commands->Create_Conversation("M03CON006", 99, 2000, true);
  5499. Commands->Join_Conversation(STAR, id);
  5500. Commands->Join_Conversation(NULL, id);
  5501. Commands->Start_Conversation(id, 100006);
  5502. Commands->Monitor_Conversation(obj, id);
  5503. }
  5504. if (!already_entered)
  5505. {
  5506. switch(Get_Int_Parameter("Conv_Num"))
  5507. {
  5508. case 2:
  5509. {
  5510. already_entered = true;
  5511. Commands->Send_Custom_Event(obj, Commands->Find_Object(1144502), ENTERED, 0, 0);
  5512. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 300, 1, 0);
  5513. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 308, 3, 0);
  5514. Commands->Start_Timer (obj, this, 2.0f, 100000);
  5515. }
  5516. break;
  5517. case 3:
  5518. {
  5519. already_entered = true;
  5520. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100005), ENTERED, 0, 0);
  5521. int id = Commands->Create_Conversation("M03CON003", 99, 2000, true);
  5522. Commands->Join_Conversation(NULL, id);
  5523. Commands->Join_Conversation(STAR, id);
  5524. Commands->Start_Conversation(id, 100003);
  5525. Commands->Monitor_Conversation(obj, id);
  5526. }
  5527. break;
  5528. case 4:
  5529. {
  5530. if (!Commands->Has_Key(STAR, 1))
  5531. {
  5532. already_entered = true;
  5533. Commands->Send_Custom_Event(obj, Commands->Find_Object (2013086), ENTERED, 0);
  5534. Commands->Send_Custom_Event(obj, Commands->Find_Object (2013087), ENTERED, 0);
  5535. int id = Commands->Create_Conversation("M03CON004", 99, 2000, true);
  5536. Commands->Join_Conversation(NULL, id);
  5537. Commands->Join_Conversation(STAR, id);
  5538. Commands->Start_Conversation(id, 100004);
  5539. Commands->Monitor_Conversation(obj, id);
  5540. }
  5541. }
  5542. break;
  5543. case 7:
  5544. {
  5545. if (Commands->Has_Key(STAR, 1))
  5546. {
  5547. already_entered = true;
  5548. Commands->Send_Custom_Event(obj, Commands->Find_Object (2013901), ENTERED, 0);
  5549. Commands->Send_Custom_Event(obj, Commands->Find_Object (2013900), ENTERED, 0);
  5550. Commands->Send_Custom_Event(obj, Commands->Find_Object (2013899), ENTERED, 0);
  5551. int id = Commands->Create_Conversation("M03CON007", 99, 2000, true);
  5552. Commands->Join_Conversation(NULL, id);
  5553. Commands->Start_Conversation(id, 100007);
  5554. Commands->Monitor_Conversation(obj, id);
  5555. }
  5556. }
  5557. break;
  5558. case 9:
  5559. {
  5560. if (Commands->Has_Key(STAR, 1))
  5561. {
  5562. already_entered = true;
  5563. int id = Commands->Create_Conversation("M03CON009", 99, 2000, true);
  5564. Commands->Join_Conversation(NULL, id);
  5565. Commands->Start_Conversation(id, 100009);
  5566. Commands->Monitor_Conversation(obj, id);
  5567. }
  5568. }
  5569. break;
  5570. case 16:
  5571. {
  5572. if (!Commands->Has_Key(STAR, 20))
  5573. {
  5574. already_entered = true;
  5575. int id = Commands->Create_Conversation("M03CON016", 99, 2000, true);
  5576. Commands->Join_Conversation(NULL, id);
  5577. Commands->Start_Conversation(id, 100016);
  5578. Commands->Monitor_Conversation(obj, id);
  5579. }
  5580. }
  5581. break;
  5582. case 22:
  5583. {
  5584. already_entered = true;
  5585. int id = Commands->Create_Conversation("M03CON022", 99, 2000, true);
  5586. Commands->Join_Conversation(NULL, id);
  5587. Commands->Join_Conversation(STAR, id);
  5588. Commands->Start_Conversation(id, 100022);
  5589. Commands->Monitor_Conversation(obj, id);
  5590. }
  5591. break;
  5592. case 61:
  5593. {
  5594. already_entered = true;
  5595. int id = Commands->Create_Conversation("M03CON061", 99, 2000, true);
  5596. Commands->Join_Conversation(Commands->Find_Object (2016365), id);
  5597. Commands->Join_Conversation(STAR, id);
  5598. Commands->Start_Conversation(id, 100061);
  5599. Commands->Monitor_Conversation(obj, id);
  5600. }
  5601. break;
  5602. }
  5603. }
  5604. }
  5605. };
  5606. DECLARE_SCRIPT(M03_Holograph_EntryZone_JDG, "")
  5607. {
  5608. bool entered;
  5609. REGISTER_VARIABLES()
  5610. {
  5611. SAVE_VARIABLE(entered, 1);
  5612. }
  5613. void Created( GameObject * obj )
  5614. {
  5615. entered = false;
  5616. }
  5617. void Entered( GameObject * obj, GameObject * enterer )
  5618. {
  5619. if (enterer == STAR && entered == false)
  5620. {
  5621. entered = true;
  5622. float delayTimer = Commands->Get_Random ( 0.25f, 1.0f );
  5623. Commands->Send_Custom_Event( obj, obj, 0, 8000, delayTimer );
  5624. }
  5625. }
  5626. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5627. {
  5628. if (param == 8000)
  5629. {
  5630. GameObject * holograph = Commands->Find_Object ( 2017192 );
  5631. if (holograph)
  5632. {
  5633. GameObject * kane = Commands->Create_Object_At_Bone ( holograph, "Nod_Kane_HologramHead", "O_ARROW" );
  5634. Commands->Attach_To_Object_Bone( kane, holograph, "O_ARROW" );
  5635. Commands->Disable_All_Collisions ( kane );
  5636. Commands->Set_Facing (kane, Commands->Get_Facing (holograph));
  5637. Commands->Set_Loiters_Allowed( kane, false );
  5638. Commands->Attach_Script(kane, "M03_KaneHead_JDG", "");
  5639. //kane_ID = Commands->Get_ID ( kane );
  5640. }
  5641. //Commands->Destroy_Object ( obj );//one time only zone--cleaning up
  5642. }
  5643. }
  5644. };
  5645. DECLARE_SCRIPT(M03_KaneHead_JDG, "") //2017221
  5646. {
  5647. int kane_conversation02;
  5648. REGISTER_VARIABLES()
  5649. {
  5650. SAVE_VARIABLE(kane_conversation02, 1);
  5651. }
  5652. void Created( GameObject * obj )
  5653. {
  5654. if (STAR)
  5655. {
  5656. int id = Commands->Create_Conversation("M03CON061", 99, 30, true);
  5657. Commands->Join_Conversation(obj, id);
  5658. Commands->Join_Conversation(STAR, id);
  5659. Commands->Start_Conversation(id, 100061);
  5660. Commands->Monitor_Conversation(obj, id);
  5661. }
  5662. }
  5663. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5664. {
  5665. switch (complete_reason)
  5666. {
  5667. case ACTION_COMPLETE_CONVERSATION_ENDED:
  5668. {
  5669. if (action_id == 100061)
  5670. {
  5671. Commands->Debug_Message ( "***************************kane conversation 02 is over--sending delete custom\n" );
  5672. Commands->Send_Custom_Event ( obj, obj, 0, 8000, 2 );
  5673. }
  5674. }
  5675. break;
  5676. }
  5677. }
  5678. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5679. {
  5680. if (param == 8000)//conversation is over--go away
  5681. {
  5682. Commands->Debug_Message ( "***************************delete custom received--kane should now vanish\n" );
  5683. Commands->Destroy_Object ( obj );
  5684. }
  5685. }
  5686. };
  5687. DECLARE_SCRIPT(M03_Killed_Sound, "Officer=0:int, Location=0:int")
  5688. {
  5689. void Killed( GameObject * obj, GameObject * killer )
  5690. {
  5691. Commands->Send_Custom_Event (obj, Commands->Find_Object (2018061), LOCATION, Get_Int_Parameter("Location") );
  5692. Commands->Send_Custom_Event (obj, Commands->Find_Object (2018061), TROOP_KILLED, Get_Int_Parameter("Officer") );
  5693. }
  5694. };
  5695. DECLARE_SCRIPT(M03_Beach_Reinforce, "")
  5696. {
  5697. #define BEACH_POSITION Vector3(-95.656f, -68.236f, 1.433f)
  5698. #define BEACH_FACING -180.0f
  5699. #define INLET_POSITION1 Vector3(99.85f, -49.51f, 2.0f)
  5700. #define INLET_FACING1 170.0f
  5701. #define INLET_POSITION2 Vector3(51.0f, -91.0f, 2.0f)
  5702. #define INLET_FACING2 75.0f
  5703. #define BASE_POSITION1 Vector3(-138.0f, 50.0f, 9.5f)
  5704. #define BASE_FACING1 -30.0f
  5705. #define BASE_POSITION2 Vector3(-79.0f, 59.0f, 9.5f)
  5706. #define BASE_FACING2 -120.0f
  5707. int current_loc;
  5708. int counter;
  5709. int switcher;
  5710. int officers_killed_beach;
  5711. int officers_killed_inlet;
  5712. int officers_killed_base;
  5713. int area_count_beach;
  5714. int area_count_inlet;
  5715. int area_count_base;
  5716. REGISTER_VARIABLES()
  5717. {
  5718. SAVE_VARIABLE(counter, 1);
  5719. SAVE_VARIABLE(switcher, 2);
  5720. SAVE_VARIABLE(officers_killed_beach, 3);
  5721. SAVE_VARIABLE(officers_killed_inlet, 4);
  5722. SAVE_VARIABLE(officers_killed_base, 5);
  5723. SAVE_VARIABLE(area_count_beach, 6);
  5724. SAVE_VARIABLE(area_count_inlet, 7);
  5725. SAVE_VARIABLE(area_count_base, 8);
  5726. SAVE_VARIABLE(current_loc, 9);
  5727. }
  5728. void Created (GameObject *obj)
  5729. {
  5730. current_loc = 0;
  5731. counter = 2;
  5732. switcher = 0;
  5733. officers_killed_beach = 0;
  5734. officers_killed_inlet = 0;
  5735. officers_killed_base = 0;
  5736. area_count_beach = (DIFFICULTY + 2);
  5737. area_count_inlet = (DIFFICULTY + 3);
  5738. area_count_base = (DIFFICULTY + 4);
  5739. }
  5740. void Reinforce_Beach (void)
  5741. {
  5742. if (officers_killed_beach < 3 && area_count_beach > 0)
  5743. {
  5744. area_count_beach--;
  5745. if (switcher < 1)
  5746. {
  5747. switcher++;
  5748. GameObject * con = Commands->Create_Object("Invisible_Object", BEACH_POSITION);
  5749. Commands->Set_Facing(con, BEACH_FACING);
  5750. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  5751. }
  5752. if (switcher == 1)
  5753. {
  5754. switcher = 0;
  5755. Commands->Trigger_Spawner( 2018881 );
  5756. Commands->Trigger_Spawner( 2018880 );
  5757. }
  5758. if (switcher > 1)
  5759. {
  5760. GameObject * con = Commands->Create_Object("Invisible_Object", BEACH_POSITION);
  5761. Commands->Set_Facing(con, BEACH_FACING);
  5762. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  5763. }
  5764. }
  5765. }
  5766. void Reinforce_Inlet (void)
  5767. {
  5768. if (officers_killed_inlet < 3 && area_count_inlet > 0)
  5769. {
  5770. area_count_inlet--;
  5771. if (switcher >= 1)
  5772. {
  5773. switcher--;
  5774. GameObject * con = Commands->Create_Object("Invisible_Object", INLET_POSITION1);
  5775. Commands->Set_Facing(con, INLET_FACING1);
  5776. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper2");
  5777. }
  5778. if (switcher < 1)
  5779. {
  5780. switcher = 1;
  5781. GameObject * con = Commands->Create_Object("Invisible_Object", INLET_POSITION2);
  5782. Commands->Set_Facing(con, INLET_FACING2);
  5783. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper2");
  5784. }
  5785. }
  5786. }
  5787. void Reinforce_Base (void)
  5788. {
  5789. if (officers_killed_base < 3 && area_count_base > 0)
  5790. {
  5791. area_count_base--;
  5792. if (switcher < 1)
  5793. {
  5794. switcher++;
  5795. GameObject * con = Commands->Create_Object("Invisible_Object", BASE_POSITION1);
  5796. Commands->Set_Facing(con, BASE_FACING1);
  5797. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  5798. }
  5799. if (switcher >= 1)
  5800. {
  5801. switcher = 0;
  5802. GameObject * con = Commands->Create_Object("Invisible_Object", BASE_POSITION2);
  5803. Commands->Set_Facing(con, BASE_FACING2);
  5804. Commands->Attach_Script(con, "M03_Chinook_ParaDrop", "M03_Paratrooper");
  5805. }
  5806. }
  5807. }
  5808. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  5809. {
  5810. if (type == LOCATION)
  5811. {
  5812. current_loc = param;
  5813. }
  5814. if (type == BASE)
  5815. {
  5816. if (param == 1)
  5817. {
  5818. Reinforce_Base ();
  5819. //counter = 4;
  5820. }
  5821. }
  5822. if (type == BEACH)
  5823. {
  5824. if (param == 1)
  5825. {
  5826. Reinforce_Beach ();
  5827. //counter = 4;
  5828. }
  5829. }
  5830. if (type == INLET)
  5831. {
  5832. if (param == 1)
  5833. {
  5834. Reinforce_Inlet ();
  5835. //counter = 3;
  5836. }
  5837. }
  5838. if (type == TROOP_KILLED)
  5839. {
  5840. if (param == 1)
  5841. {
  5842. if (current_loc == 0)
  5843. {
  5844. officers_killed_beach++;
  5845. }
  5846. if (current_loc == 1)
  5847. {
  5848. officers_killed_inlet++;
  5849. }
  5850. if (current_loc == 2)
  5851. {
  5852. officers_killed_base++;
  5853. }
  5854. }
  5855. if (--counter <= 0)
  5856. {
  5857. counter = (5 - DIFFICULTY);
  5858. Commands->Send_Custom_Event (obj, Commands->Find_Object (1144444), UPDATE, 0);
  5859. //Reinforce_Beach ();
  5860. //counter = 2;
  5861. }
  5862. }
  5863. if (type == PAST_PILLBOX)
  5864. {
  5865. switcher = 10;
  5866. }
  5867. }
  5868. };
  5869. DECLARE_SCRIPT(M03_Past_Pillbox, "")
  5870. {
  5871. void Entered( GameObject * obj, GameObject * enterer )
  5872. {
  5873. Commands->Send_Custom_Event (obj, Commands->Find_Object (2018061), PAST_PILLBOX, 0);
  5874. }
  5875. };
  5876. DECLARE_SCRIPT(M03_Engineer_Target, "")
  5877. {
  5878. float full_health;
  5879. int engineer;
  5880. REGISTER_VARIABLES()
  5881. {
  5882. SAVE_VARIABLE(engineer, 1);
  5883. SAVE_VARIABLE(full_health, 2);
  5884. }
  5885. void Created (GameObject *obj)
  5886. {
  5887. full_health = Commands->Get_Health (obj);
  5888. }
  5889. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  5890. {
  5891. if (type == ENGINEER)
  5892. {
  5893. engineer = param;
  5894. }
  5895. };
  5896. void Damaged (GameObject *obj, GameObject *damager, float amount)
  5897. {
  5898. Commands->Create_Logical_Sound(obj, HEAL_ME, Commands->Get_Position (obj), 150.0f);
  5899. Commands->Start_Timer (obj, this, 3.0f, HEALTH_CHECK);
  5900. }
  5901. void Destroyed(GameObject * obj)
  5902. {
  5903. Commands->Create_Logical_Sound(obj, STOP_REPAIR, Commands->Get_Position (obj), 150.0f);
  5904. }
  5905. void Timer_Expired(GameObject * obj, int timer_id )
  5906. {
  5907. if (timer_id == HEALTH_CHECK)
  5908. {
  5909. float current = Commands->Get_Health (obj);
  5910. if (current == full_health)
  5911. {
  5912. Commands->Create_Logical_Sound(obj, STOP_REPAIR, Commands->Get_Position (obj), 150.0f);
  5913. }
  5914. if (current != full_health)
  5915. {
  5916. Commands->Create_Logical_Sound(obj, HEAL_ME, Commands->Get_Position (obj), 150.0f);
  5917. Commands->Start_Timer (obj, this, 3.0f, HEALTH_CHECK);
  5918. }
  5919. }
  5920. }
  5921. };
  5922. DECLARE_SCRIPT(M03_Engineer_Repair, "Repair_Priority=96:int")
  5923. {
  5924. int my_id, target_id;
  5925. bool repairing;
  5926. int repair_priority;
  5927. REGISTER_VARIABLES()
  5928. {
  5929. SAVE_VARIABLE(repairing, 1);
  5930. SAVE_VARIABLE(my_id, 2);
  5931. SAVE_VARIABLE(target_id, 3);
  5932. SAVE_VARIABLE(repair_priority, 4);
  5933. }
  5934. void Created (GameObject *obj)
  5935. {
  5936. repairing = false;
  5937. repair_priority = Get_Int_Parameter("Repair_Priority");
  5938. }
  5939. void Sound_Heard(GameObject* obj, const CombatSound & sound)
  5940. {
  5941. if (sound.Type == HEAL_ME && !repairing)
  5942. {
  5943. if (Commands->Get_Player_Type (sound.Creator) == Commands->Get_Player_Type (obj))
  5944. {
  5945. my_id = Commands->Get_ID ( obj );
  5946. repairing = true;
  5947. Commands->Send_Custom_Event( obj, sound.Creator, ENGINEER, my_id );
  5948. target_id = Commands->Get_ID ( sound.Creator );
  5949. ActionParamsStruct params;
  5950. params.Set_Basic( this, repair_priority, MOVE_TO_HEAL );
  5951. params.Set_Movement( Commands->Get_Position (sound.Creator), RUN, 5.0f );
  5952. Commands->Action_Goto (obj, params);
  5953. }
  5954. }
  5955. if (sound.Type == STOP_REPAIR)
  5956. {
  5957. if (Commands->Get_ID (sound.Creator) == target_id)
  5958. {
  5959. Commands->Action_Reset ( obj, 100 );
  5960. repairing = false;
  5961. }
  5962. }
  5963. }
  5964. void Action_Complete( GameObject * obj, int action_id, ActionCompleteReason complete_reason )
  5965. {
  5966. if (action_id == MOVE_TO_HEAL)
  5967. {
  5968. ActionParamsStruct params;
  5969. params.Set_Basic( this, repair_priority, REPAIRING );
  5970. params.Set_Attack (Commands->Find_Object (target_id), 50.0f, 0.0f, 0);
  5971. params.AttackCheckBlocked = false;
  5972. Commands->Action_Attack( obj, params );
  5973. }
  5974. }
  5975. };
  5976. DECLARE_SCRIPT(M03_Radar_Scramble, "")
  5977. {
  5978. bool already_entered;
  5979. REGISTER_VARIABLES()
  5980. {
  5981. SAVE_VARIABLE( already_entered, 1 );
  5982. }
  5983. void Created (GameObject * obj)
  5984. {
  5985. already_entered = false;
  5986. }
  5987. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  5988. {
  5989. if (type == ENTERED)
  5990. {
  5991. already_entered = true;
  5992. }
  5993. }
  5994. void Entered (GameObject *obj, GameObject *enterer)
  5995. {
  5996. if (Commands->Get_Health (Commands->Find_Object (1150002)) > 0)
  5997. {
  5998. if (!already_entered)
  5999. {
  6000. Commands->Send_Custom_Event (obj, Commands->Find_Object (1147513), ENTERED, 0);
  6001. Commands->Send_Custom_Event (obj, Commands->Find_Object (1144628), ENTERED, 0);
  6002. already_entered = true;
  6003. int id = Commands->Create_Conversation("M03CON068", 99, 2000, false);
  6004. Commands->Join_Conversation(NULL, id);
  6005. Commands->Start_Conversation(id, 100068);
  6006. Commands->Monitor_Conversation(obj, id);
  6007. }
  6008. Commands->Enable_Radar ( false );
  6009. }
  6010. }
  6011. };
  6012. DECLARE_SCRIPT(M03_Radar_UnScramble, "")
  6013. {
  6014. void Entered (GameObject *obj, GameObject *enterer)
  6015. {
  6016. Commands->Enable_Radar ( true );
  6017. }
  6018. };
  6019. DECLARE_SCRIPT (M10_Elevator_All_Zone, "Controller_num:int")
  6020. {
  6021. bool star_in_zone;
  6022. REGISTER_VARIABLES()
  6023. {
  6024. SAVE_VARIABLE( star_in_zone, 1 );
  6025. }
  6026. void Created (GameObject *obj)
  6027. {
  6028. star_in_zone = false;
  6029. }
  6030. void Entered (GameObject * obj, GameObject * enterer)
  6031. {
  6032. if (enterer == STAR)
  6033. {
  6034. star_in_zone = true;
  6035. Commands->Send_Custom_Event(obj, Commands->Find_Object(Get_Int_Parameter("Controller_num")), ACTIVATE, 0);
  6036. }
  6037. }
  6038. };
  6039. DECLARE_SCRIPT (M10_Elevator_All_Controller, "")
  6040. {
  6041. bool star_in_zone;
  6042. bool mobius_in_zone;
  6043. bool transition;
  6044. int block1, block2, block3, block4;
  6045. int block5, block6, block7, block8;
  6046. GameObject *mobius;
  6047. REGISTER_VARIABLES()
  6048. {
  6049. SAVE_VARIABLE( star_in_zone, 1 );
  6050. SAVE_VARIABLE( mobius_in_zone, 2 );
  6051. SAVE_VARIABLE( transition, 3 );
  6052. SAVE_VARIABLE( block1, 4 );
  6053. SAVE_VARIABLE( block2, 5 );
  6054. SAVE_VARIABLE( block3, 6 );
  6055. SAVE_VARIABLE( block4, 7 );
  6056. SAVE_VARIABLE( block5, 8 );
  6057. SAVE_VARIABLE( block6, 9 );
  6058. SAVE_VARIABLE( block7, 10 );
  6059. SAVE_VARIABLE( block8, 11 );
  6060. }
  6061. void Created (GameObject *obj)
  6062. {
  6063. star_in_zone = false;
  6064. mobius_in_zone = false;
  6065. block1 = block2 = block3 = block4 = 0;
  6066. block5 = block6 = block7 = block8 = 0;
  6067. Commands->Static_Anim_Phys_Goto_Last_Frame ( 1300881, "cave_lift.cave_lift" );
  6068. }
  6069. void Timer_Expired(GameObject * obj, int timer_id)
  6070. {
  6071. if (timer_id == 333)
  6072. {
  6073. Commands->Destroy_Object (Commands->Find_Object (1148346));
  6074. Commands->Destroy_Object (Commands->Find_Object (block1));
  6075. Commands->Destroy_Object (Commands->Find_Object (block2));
  6076. Commands->Destroy_Object (Commands->Find_Object (block3));
  6077. Commands->Destroy_Object (Commands->Find_Object (block4));
  6078. Commands->Destroy_Object (Commands->Find_Object (block5));
  6079. Commands->Destroy_Object (Commands->Find_Object (block6));
  6080. Commands->Destroy_Object (Commands->Find_Object (block7));
  6081. Commands->Destroy_Object (Commands->Find_Object (block8));
  6082. }
  6083. }
  6084. void Custom (GameObject * obj, int type, int param, GameObject * sender)
  6085. {
  6086. if (type == ACTIVATE)
  6087. {
  6088. Commands->Start_Timer (obj, this, 5.0f, 333);
  6089. GameObject *rub1 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-117.320f, 83.098f, 0.656f));
  6090. block1 = Commands->Get_ID (rub1);
  6091. Commands->Set_Facing (rub1, 90.0);
  6092. Commands->Set_Is_Rendered( rub1, false );
  6093. GameObject *rub2 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-113.706f, 78.884f, 0.656f));
  6094. block2 = Commands->Get_ID (rub2);
  6095. Commands->Set_Is_Rendered( rub2, false );
  6096. GameObject *rub3 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-117.624f, 73.787f, 0.656f));
  6097. block3 = Commands->Get_ID (rub3);
  6098. Commands->Set_Is_Rendered( rub3, false );
  6099. Commands->Set_Facing (rub3, -90.0);
  6100. GameObject *rub4 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-122.458f, 78.303f, 0.656f));
  6101. block4 = Commands->Get_ID (rub4);
  6102. Commands->Set_Is_Rendered( rub4, false );
  6103. GameObject *rub5 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-117.320f, 83.098f, 3.906f));
  6104. block5 = Commands->Get_ID (rub5);
  6105. Commands->Set_Facing (rub5, 90.0);
  6106. Commands->Set_Is_Rendered( rub5, false );
  6107. GameObject *rub6 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-113.706f, 78.884f, 3.906f));
  6108. block6 = Commands->Get_ID (rub6);
  6109. Commands->Set_Is_Rendered( rub6, false );
  6110. GameObject *rub7 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-117.624f, 73.787f, 3.906f));
  6111. block7 = Commands->Get_ID (rub7);
  6112. Commands->Set_Is_Rendered( rub7, false );
  6113. Commands->Set_Facing (rub7, -90.0);
  6114. GameObject *rub8 = Commands->Create_Object ("M08_Rubble_Stub", Vector3 (-122.458f, 78.303f, 3.906f));
  6115. block8 = Commands->Get_ID (rub8);
  6116. Commands->Set_Is_Rendered( rub8, false );
  6117. Commands->Static_Anim_Phys_Goto_Frame ( 1300881, 0, "cave_lift.cave_lift" );
  6118. }
  6119. }
  6120. };
  6121. DECLARE_SCRIPT(M03_AggAndCover, "")
  6122. {
  6123. void Created (GameObject *obj)
  6124. {
  6125. Commands->Set_Innate_Aggressiveness ( obj, 50.0f );
  6126. Commands->Set_Innate_Take_Cover_Probability ( obj, 100.0f );
  6127. }
  6128. };
  6129. DECLARE_SCRIPT(M03_Technician_Work, "")
  6130. {
  6131. void Created (GameObject *obj)
  6132. {
  6133. ActionParamsStruct params;
  6134. params.Set_Basic( this, INNATE_PRIORITY_BULLET_HEARD - 5, 1);
  6135. params.Set_Animation( "H_A_a0f0", true );
  6136. Commands->Action_Play_Animation (obj, params);
  6137. }
  6138. };
  6139. DECLARE_SCRIPT(M03_Paratrooper_Run, "")
  6140. {
  6141. bool initial_damage;
  6142. float initial_health;
  6143. // Register variables to be Auto-Saved
  6144. // All variables must have a unique ID, less than 256, that never changes
  6145. REGISTER_VARIABLES()
  6146. {
  6147. SAVE_VARIABLE( initial_damage, 1 );
  6148. SAVE_VARIABLE( initial_health, 2 );
  6149. }
  6150. void Created( GameObject * obj )
  6151. {
  6152. initial_damage = false;
  6153. }
  6154. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  6155. {
  6156. if (!initial_damage)
  6157. {
  6158. if (type == CUSTOM_EVENT_FALLING_DAMAGE)
  6159. {
  6160. initial_health = Commands->Get_Health(obj);
  6161. }
  6162. }
  6163. }
  6164. void Damaged( GameObject * obj, GameObject *damager, float amount)
  6165. {
  6166. if (!initial_damage && damager == NULL)
  6167. {
  6168. initial_damage = true;
  6169. Commands->Set_Health(obj, initial_health);
  6170. float distance = Commands->Get_Random(-12.0f, 12.0f);
  6171. //distance *= 3;
  6172. Vector3 pos = Commands->Get_Position(obj);
  6173. float facing = Commands->Get_Facing(obj);
  6174. float a = cos(DEG_TO_RADF(facing)) * distance;
  6175. float b = sin(DEG_TO_RADF(facing)) * distance;
  6176. Vector3 goto_loc = pos + Vector3(a, b, 0.0f);
  6177. ActionParamsStruct params;
  6178. params.Set_Basic(this, 100, 40);
  6179. params.Set_Movement(goto_loc, RUN, 1.0f);
  6180. Commands->Action_Goto(obj, params);
  6181. }
  6182. }
  6183. };
  6184. DECLARE_SCRIPT (M03_Damage_Modifier_All, "Damage_multiplier:float")
  6185. {
  6186. float current_health, last_health, damage_tally;
  6187. REGISTER_VARIABLES()
  6188. {
  6189. SAVE_VARIABLE( current_health, 1 );
  6190. SAVE_VARIABLE( last_health, 2 );
  6191. SAVE_VARIABLE( damage_tally, 3 );
  6192. }
  6193. void Created (GameObject *obj)
  6194. {
  6195. last_health = Commands->Get_Health (obj);
  6196. damage_tally = 0;
  6197. }
  6198. void Damaged( GameObject * obj, GameObject * damager, float amount )
  6199. {
  6200. float damage;
  6201. current_health = Commands->Get_Health (obj);
  6202. if (current_health == 0)
  6203. {
  6204. damage = ((last_health - current_health) + damage_tally);
  6205. damage_tally = 0;
  6206. }
  6207. else
  6208. {
  6209. damage = (last_health - current_health);
  6210. damage_tally = 0;
  6211. }
  6212. float mod_damage = (damage * (Get_Float_Parameter("Damage_multiplier")));
  6213. damage_tally += mod_damage;
  6214. Commands->Set_Health (obj, (last_health - mod_damage));
  6215. last_health = Commands->Get_Health (obj);
  6216. current_health = Commands->Get_Health (obj);
  6217. }
  6218. };
  6219. DECLARE_SCRIPT(M03_Cine_Explosion, "")
  6220. {
  6221. void Custom (GameObject *obj, int type, int param, GameObject *sender)
  6222. {
  6223. if (type == 600)
  6224. {
  6225. Commands->Create_Explosion( "M03_Cine_Explosion", Commands->Get_Position (obj), obj );
  6226. }
  6227. }
  6228. };
  6229. DECLARE_SCRIPT(M03_ConYardSeen, "")
  6230. {
  6231. bool already_entered;
  6232. REGISTER_VARIABLES()
  6233. {
  6234. SAVE_VARIABLE( already_entered, 1 );
  6235. }
  6236. void Created (GameObject * obj)
  6237. {
  6238. already_entered = false;
  6239. }
  6240. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6241. {
  6242. if (type == 900)
  6243. {
  6244. already_entered = true;
  6245. }
  6246. }
  6247. void Entered (GameObject *obj, GameObject *enterer)
  6248. {
  6249. if (!already_entered)
  6250. {
  6251. already_entered = true;
  6252. Commands->Send_Custom_Event(obj, Commands->Find_Object(1100004), 300, 1, 0);
  6253. }
  6254. }
  6255. };
  6256. DECLARE_SCRIPT(M03_DataDiscMessage, "")
  6257. {
  6258. void Custom( GameObject * obj, int type, int param, GameObject * sender )
  6259. {
  6260. if ( type == CUSTOM_EVENT_POWERUP_GRANTED )
  6261. {
  6262. Commands->Set_HUD_Help_Text ( IDS_M00EVAG_DSGN0104I1EVAG_TXT, TEXT_COLOR_OBJECTIVE_PRIMARY );
  6263. }
  6264. }
  6265. };