PRDemo.cpp 137 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694
  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. * PRDemo.cpp
  22. *
  23. * DESCRIPTION
  24. * PR Demo Scripts
  25. *
  26. * PROGRAMMER
  27. * Design Team
  28. *
  29. * VERSION INFO
  30. * $Author: Ryan_v $
  31. * $Revision: 21 $
  32. * $Modtime: 7/17/00 10:13a $
  33. * $Archive: /Commando/Code/Scripts/PRDemo.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "prdemo.h"
  37. #if 0
  38. /*
  39. MPR_A01_TiberiumCloud
  40. This block controls the tiberium zones - animation and damage.
  41. DEBUG NAMING CONVENTION
  42. DEBUG INNATE?
  43. Parameters:
  44. Death_Rate = DEBUG
  45. Explode_Height = DEBUG
  46. */
  47. DECLARE_SCRIPT(MPR_A01_TiberiumCloud_PMP, "Death_Rate=5:int,Explode_Height=1.0:float")
  48. {
  49. int Death_Rate;
  50. float Explode_Height;
  51. Vector3 cloud_position;
  52. void Created(GameObject* obj)
  53. {
  54. Death_Rate = Get_Int_Parameter("Death_Rate");
  55. Explode_Height = Get_Float_Parameter("Explode_Height");
  56. Commands->_Start_Timer(obj, this, Commands->Get_Random( 1, Death_Rate ), MPR_TIMER_TIBERIUM_PMP);
  57. }
  58. void Timer_Expired(GameObject* obj, int timerID)
  59. {
  60. if (timerID == MPR_TIMER_TIBERIUM_PMP)
  61. {
  62. cloud_position = Commands->Get_Position(obj);
  63. cloud_position.Z += Explode_Height;
  64. Commands->Create_Explosion("TibCloud",cloud_position,obj);
  65. Commands->_Start_Timer(obj, this, Death_Rate, MPR_TIMER_TIBERIUM_PMP);
  66. }
  67. }
  68. };
  69. /*
  70. MPR_A01_CivLeader
  71. DEBUG DESCRIPTION
  72. DEBUG NAMING CONVENTION
  73. Parameters:
  74. Follower_ID = DEBUG
  75. */
  76. DECLARE_SCRIPT(MPR_A01_CivLeader_PMP, "Follower_ID:int")
  77. {
  78. int Follower_ID;
  79. bool shooting;
  80. Vector3 BarnPoint;
  81. void Created(GameObject* obj)
  82. {
  83. BarnPoint.X = -193;
  84. BarnPoint.Y = -133;
  85. BarnPoint.Z = 4;
  86. MPR_nod_dead_PMP = false;
  87. shooting = false;
  88. MPR_evacing_to_chinook_PMP = false;
  89. Follower_ID = Get_Int_Parameter("Follower_ID");
  90. GameObject* target = Commands->Find_Object(Follower_ID);
  91. if ((Commands->Find_Object(Follower_ID)) && (shooting==false))
  92. {
  93. Commands->Send_Custom_Event(obj, target,MPR_CUSTOM_FOLLOW_ME_DEL, 0);
  94. //Commands->Start_Timer(obj, 2, MPR_TIMER_DELAY_01_PMP);
  95. }
  96. }
  97. void Custom(GameObject* obj, int event, int param, GameObject* host)
  98. {
  99. if (event == MPR_CUSTOM_I_AM_DEAD_DEL)
  100. {
  101. //Commands->Display_Text("Got dead message\n");
  102. MPR_nod_dead_PMP = true;
  103. shooting = true;
  104. Commands->_Start_Timer(obj, this, Commands->Get_Random( 0, 5), MPR_TIMER_DELAY_01_04_PMP);
  105. }
  106. if (event == MPR_CUSTOM_ESCORT_ATTACKED_DEL)
  107. {
  108. //Commands->Display_Text("Got attacked message\n");
  109. Commands->_Start_Timer(obj, this, Commands->Get_Random( 0, 3), MPR_TIMER_DELAY_01_03_PMP);
  110. shooting = true;
  111. }
  112. }
  113. void Timer_Expired(GameObject* obj, int timerID)
  114. {
  115. Vector3 newPoint = RandomVector();
  116. if ((timerID == MPR_TIMER_DELAY_01_PMP) && (Commands->Find_Object(Follower_ID)) && (MPR_nod_dead_PMP == false) && (shooting == false))
  117. {
  118. //Commands->Display_Text("Sending the call\n");
  119. Commands->Send_Custom_Event(obj, Commands->Find_Object(Follower_ID),MPR_CUSTOM_FOLLOW_ME_DEL, 0);
  120. Commands->_Start_Timer(obj, this, 2, MPR_TIMER_DELAY_01_PMP);
  121. }
  122. if (timerID == MPR_TIMER_DELAY_01_03_PMP)
  123. {
  124. ActionParamsStruct params;
  125. params.Set_Animation("S_A_Human.H_A_J21C", false);
  126. Commands->Action_Play_Animation(obj, params);
  127. }
  128. if (timerID == MPR_TIMER_DELAY_01_04_PMP)
  129. {
  130. ActionParamsStruct params;
  131. params.Set_Basic
  132. Commands->Action_Movement_Set_Forward_Speed(obj,.33f);
  133. Commands->Action_Movement_Goto_Location(obj, newPoint,Commands->Get_Random( 0, 2.0 ));
  134. }
  135. }
  136. Vector3 RandomVector(void)
  137. {
  138. Vector3 wanderPoint;
  139. wanderPoint.X = Commands->Get_Random( 0, 3 );
  140. wanderPoint.Y = Commands->Get_Random( 0, 3 );
  141. wanderPoint.Z = 0;
  142. return (BarnPoint + wanderPoint);
  143. }
  144. };
  145. /*
  146. MPR_A01_CivFollower
  147. DEBUG DESCRIPTION
  148. DEBUG NAMING CONVENTION
  149. Parameters:
  150. Host_ID = DEBUG
  151. Host_distance = DEBUG
  152. */
  153. DECLARE_SCRIPT(MPR_A01_CivFollower_PMP, "Host_ID:int, Host_distance=1.5:float")
  154. {
  155. float Host_distance;
  156. int Host_ID;
  157. bool shooting;
  158. void Created(GameObject* obj)
  159. {
  160. shooting = false;
  161. Host_distance = Get_Float_Parameter("Host_distance");
  162. Host_ID = Get_Int_Parameter("Host_ID");
  163. }
  164. void Custom(GameObject* obj, int event, int param, GameObject* host)
  165. {
  166. if (event == MPR_CUSTOM_ESCORT_ATTACKED_DEL)
  167. {
  168. shooting = true;
  169. }
  170. if (( event == MPR_CUSTOM_FOLLOW_ME_DEL ) && ( shooting == false ))
  171. {
  172. //Commands->Display_Text("Heard the call\n");
  173. if (Commands->Find_Object(Host_ID))
  174. {
  175. Commands->Action_Movement_Set_Forward_Speed(obj,.25f);
  176. Commands->Action_Movement_Follow_Object(obj, host, Host_distance);
  177. }
  178. }
  179. }
  180. };
  181. /*
  182. MPR_A01_EscortDestination
  183. DEBUG DESCRIPTION
  184. DEBUG NAMING CONVENTION
  185. DEBUG FRAGMENTED?
  186. */
  187. DECLARE_SCRIPT(MPR_A01_EscortDestination_PMP,"")
  188. {
  189. void Created(GameObject* obj)
  190. {
  191. //Commands->Display_Text("Moving\n");
  192. Commands->Action_Movement_Set_Forward_Speed(obj, .25f);
  193. //Commands->Action_Movement_Goto_Location(obj,Vector3 (-248,-133,6),0.5f); //Inside Church
  194. Commands->Action_Movement_Goto_Location(obj, Vector3 (-264.0f,-73.0f,-0.67f),0.5f); //temp until pathfind fixed
  195. }
  196. };
  197. /*
  198. MPR_A01_EscortDestination
  199. DEBUG DESCRIPTION
  200. DEBUG NAMING CONVENTION
  201. DEBUG FRAGMENTED
  202. Parameters:
  203. CIV01_ID = DEBUG
  204. CIV02_ID = DEBUG
  205. CIV03_ID = DEBUG
  206. */
  207. DECLARE_SCRIPT(MPR_A01_EscortDies_PMP,"CIV01_ID:int, CIV02_ID:int, CIV03_ID:int")
  208. {
  209. int CIV01_ID;
  210. int CIV02_ID;
  211. int CIV03_ID;
  212. void Killed(GameObject*obj, GameObject* killer)
  213. {
  214. CIV01_ID = Get_Int_Parameter("CIV01_ID");
  215. CIV02_ID = Get_Int_Parameter("CIV02_ID");
  216. CIV03_ID = Get_Int_Parameter("CIV03_ID");
  217. //Commands->Display_Text("I am dead\n");
  218. MPR_nod_dead_PMP = true;
  219. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV01_ID),MPR_CUSTOM_I_AM_DEAD_DEL, 0);
  220. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV02_ID),MPR_CUSTOM_I_AM_DEAD_DEL, 0);
  221. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV03_ID),MPR_CUSTOM_I_AM_DEAD_DEL, 0);
  222. }
  223. };
  224. /*
  225. MPR_A01_SeeEnemy
  226. DEBUG DESCRIPTION
  227. DEBUG NAMING CONVENTION
  228. DEBUG FRAGMENTED?
  229. Parameters:
  230. CIV01_ID = DEBUG
  231. CIV02_ID = DEBUG
  232. CIV03_ID = DEBUG
  233. NOD01_ID = DEBUG
  234. */
  235. DECLARE_SCRIPT(MPR_A01_SeeEnemy_PMP,"CIV01_ID:int, CIV02_ID:int, CIV03_ID:int, NOD01_ID:int")
  236. {
  237. int CIV01_ID;
  238. int CIV02_ID;
  239. int CIV03_ID;
  240. int NOD01_ID;
  241. Vector3 start_position;
  242. Vector3 newPoint;
  243. bool shooting;
  244. void Created(GameObject* obj)
  245. {
  246. Commands->Enable_Enemy_Seen(obj, true);
  247. shooting = false;
  248. CIV01_ID = Get_Int_Parameter("CIV01_ID");
  249. CIV02_ID = Get_Int_Parameter("CIV02_ID");
  250. CIV03_ID = Get_Int_Parameter("CIV03_ID");
  251. NOD01_ID = Get_Int_Parameter("NOD01_ID");
  252. }
  253. void Enemy_Seen(GameObject* obj, GameObject* enemy)
  254. {
  255. Vector3 shoot_point;
  256. if ((enemy == (Commands->Get_The_Star())) && (shooting == false))
  257. {
  258. GameObject* civie = (Commands->Find_Object(CIV02_ID));
  259. shoot_point = Commands->Get_Position(civie);
  260. Commands->Action_Attack_Location(obj, shoot_point, 0.01f, .01f);
  261. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV01_ID),MPR_CUSTOM_ESCORT_ATTACKED_DEL, 0);
  262. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV02_ID),MPR_CUSTOM_ESCORT_ATTACKED_DEL, 0);
  263. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV03_ID),MPR_CUSTOM_ESCORT_ATTACKED_DEL, 0);
  264. Commands->Send_Custom_Event(obj, Commands->Find_Object(NOD01_ID),MPR_CUSTOM_ESCORT_ATTACKED_DEL, 0);
  265. Commands->Start_Timer(obj, 4, MPR_TIMER_DELAY_01_02_PMP);
  266. }
  267. if ((enemy == (Commands->Get_The_Star())) && (shooting == true))
  268. {
  269. GameObject* target = Commands->Get_The_Star();
  270. Commands->Action_Attack_Object(obj,target,0,5.0f);
  271. Commands->Innate_Enable(obj);
  272. }
  273. }
  274. void Timer_Expired(GameObject* obj, int timerID)
  275. {
  276. if (timerID == MPR_TIMER_DELAY_01_02_PMP)
  277. {
  278. GameObject* target = Commands->Get_The_Star();
  279. Commands->Action_Attack_Object(obj,target,0,5.0f);
  280. shooting = true;
  281. }
  282. }
  283. };
  284. /*
  285. MPR_A01_GET_BARN_ZONE_ID
  286. DEBUG DESCRIPTION
  287. DEBUG NAMING CONVENTION
  288. DEBUG OBSOLETED
  289. */
  290. DECLARE_SCRIPT(MPR_A01_Get_Barn_Zone_id_PMP,"")
  291. {
  292. void Created(GameObject* obj)
  293. {
  294. MPR_A01_BARNZONE_GOTHERE_ID_PMP = Commands->Get_ID (obj);
  295. }
  296. };
  297. /*
  298. MPR_A01_EVAC_CALL
  299. DEBUG DESCRIPTION
  300. DEBUG NAMING CONVENTION
  301. DEBUG OBSOLETED?
  302. */
  303. DECLARE_SCRIPT(MPR_A01_Evac_Call_PMP,"")
  304. {
  305. bool evac_entered;
  306. void Created(GameObject* obj)
  307. {
  308. evac_entered = false;
  309. }
  310. void Entered(GameObject* obj, GameObject* enterer)
  311. {
  312. if((enterer != Commands->Get_The_Star()) && (!evac_entered))
  313. {
  314. //Commands->Display_Text("Chinook Created\n");
  315. GameObject* Chinook_evac = Commands->Create_Object( "Chinook_E", Vector3 (0,0,0) );
  316. if (Chinook_evac)
  317. {
  318. //Commands->Display_Text("Anim Started\n");
  319. Commands->Attach_Script(Chinook_evac, "MPR_A01_Chinook_Evac_Civies", "");
  320. evac_entered = true;
  321. }
  322. }
  323. }
  324. };
  325. /*
  326. MPR_A01_Chinook_Evac_Civies
  327. DEBUG DESCRIPTION
  328. DEBUG NAMING CONVENTION
  329. */
  330. DECLARE_SCRIPT(MPR_A01_Chinook_Evac_Civies_PMP,"")
  331. {
  332. int CIV01_ID;
  333. int CIV02_ID;
  334. int CIV03_ID;
  335. void Created(GameObject* obj)
  336. {
  337. CIV01_ID = MPR_A01_CIV01_ID_PMP;
  338. CIV02_ID = MPR_A01_CIV02_ID_PMP;
  339. CIV03_ID = MPR_A01_CIV03_ID_PMP;
  340. Commands->Set_Animation( obj, "V_GDI_CHINOOKE3.m_ch_evacland", false);
  341. }
  342. void Animation_Complete(GameObject* obj, const char* name)
  343. {
  344. if (stricmp (name,"V_GDI_CHINOOKE3.m_ch_evacland") ==0 )
  345. {
  346. Commands->Set_Animation( obj, "V_GDI_CHINOOKE3.m_ch_evacloiter", true);
  347. Commands->Start_Timer(obj, 13, MPR_TIMER_EVAC_PMP );
  348. if (Commands->Find_Object(CIV01_ID))
  349. {
  350. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV01_ID),MPR_CUSTOM_EVAC_CALL_DEL, 0);
  351. }
  352. if (Commands->Find_Object(CIV02_ID))
  353. {
  354. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV02_ID),MPR_CUSTOM_EVAC_CALL_DEL, 0);
  355. }
  356. if (Commands->Find_Object(CIV03_ID))
  357. {
  358. Commands->Send_Custom_Event(obj, Commands->Find_Object(CIV03_ID),MPR_CUSTOM_EVAC_CALL_DEL, 0);
  359. }
  360. }
  361. }
  362. void Timer_Expired (GameObject* obj, int Timer_ID)
  363. {
  364. if (Timer_ID == MPR_TIMER_EVAC_PMP)
  365. {
  366. Commands->Set_Animation( obj, "V_GDI_CHINOOKE3.m_ch_evacoff", false);
  367. }
  368. }
  369. };
  370. /*
  371. MPR_A01_GET_TO_CHINOOK
  372. DEBUG DESCRIPTION
  373. DEBUG NAMING CONVENTION
  374. DEBUG FRAGMENTED
  375. */
  376. DECLARE_SCRIPT(MPR_A01_Get_To_Chinook_PMP,"")
  377. {
  378. void Custom(GameObject* obj, int event, int param, GameObject* host)
  379. {
  380. if (event == MPR_CUSTOM_EVAC_CALL_DEL)
  381. {
  382. //Commands->Display_Text("Going to Chinook\n");
  383. MPR_evacing_to_chinook_PMP = true;
  384. Commands->Action_Movement_Goto_Location(obj, Vector3 (-193,-153,2), 1.0f);
  385. }
  386. }
  387. void Movement_Complete(GameObject* obj, MovementCompleteReason reason)
  388. {
  389. if (MPR_evacing_to_chinook_PMP == true)
  390. {
  391. Commands->Destroy_Object(obj);
  392. }
  393. }
  394. };
  395. /*
  396. MPR_A01_GET_CIV01_ID
  397. DEBUG DESCRIPTION
  398. DEBUG NAMING CONVENTION
  399. DEBUG OBSOLETE
  400. */
  401. DECLARE_SCRIPT(MPR_A01_Get_Civ01_id_PMP,"")
  402. {
  403. void Created(GameObject* obj)
  404. {
  405. MPR_A01_CIV02_ID_PMP = Commands->Get_ID (obj);
  406. }
  407. };
  408. /*
  409. MPR_A01_GET_CIV02_ID
  410. DEBUG DESCRIPTION
  411. DEBUG NAMING CONVENTION
  412. DEBUG OBSOLETE
  413. */
  414. DECLARE_SCRIPT(MPR_A01_Get_Civ02_id_PMP,"")
  415. {
  416. void Created(GameObject* obj)
  417. {
  418. MPR_A01_CIV01_ID_PMP = Commands->Get_ID (obj);
  419. }
  420. };
  421. /*
  422. MPR_A01_GET_CIV03_ID
  423. DEBUG DESCRIPTION
  424. DEBUG NAMING CONVENTION
  425. DEBUG OBSOLETE
  426. */
  427. DECLARE_SCRIPT(MPR_A01_Get_Civ03_ID_PMP,"")
  428. {
  429. void Created(GameObject* obj)
  430. {
  431. MPR_A01_CIV03_ID_PMP = Commands->Get_ID (obj);
  432. }
  433. };
  434. /*
  435. M00_Generic_Wandering
  436. This block is a generic wandering around start point script.
  437. DEBUG NAMING CONVENTION
  438. DEBUG OBSOLETE
  439. DEBUG ToolKit script, M00
  440. Parameters:
  441. Wander_radius = DEBUG
  442. Seconds_to_wait = DEBUG
  443. */
  444. DECLARE_SCRIPT(M00_Generic_Wandering_PMP, "Wander_radius=:float,Seconds_to_wait=:float")
  445. {
  446. Vector3 start_position;
  447. float Seconds_to_wait;
  448. float Wander_radius;
  449. float randomNumber;
  450. float duration;
  451. void Created(GameObject* obj)
  452. {
  453. start_position = Commands->Get_Position(obj);
  454. Wander_radius = Get_Float_Parameter("Wander_radius");
  455. Seconds_to_wait = Get_Float_Parameter("Seconds_to_wait");
  456. Movement_Complete(obj, MOVEMENT_COMPLETE_ARRIVED);
  457. }
  458. void Movement_Complete(GameObject* obj, MovementCompleteReason reason)
  459. {
  460. duration = Commands->Get_Random(0, Seconds_to_wait);
  461. Commands->Display_Text("Setting new timer\n");
  462. Commands->Start_Timer(obj, duration, MPR_TIMER_WANDER_PMP);
  463. }
  464. void Timer_Expired(GameObject* obj, int timerID)
  465. {
  466. if (timerID == MPR_TIMER_WANDER_PMP)
  467. {
  468. Vector3 newPoint = RandomVector();
  469. Commands->Display_Text("Timer expired\n");
  470. Commands->Display_Text("Moving\n");
  471. Commands->Action_Movement_Set_Forward_Speed(obj, 0.30f);
  472. Commands->Action_Movement_Goto_Location(obj, newPoint,1.0f);
  473. }
  474. }
  475. Vector3 RandomVector(void)
  476. {
  477. Vector3 wanderPoint;
  478. wanderPoint.X = Commands->Get_Random( 0, Wander_radius );
  479. wanderPoint.Y = Commands->Get_Random( 0, Wander_radius );
  480. wanderPoint.Z = 0;
  481. return (start_position + wanderPoint);
  482. }
  483. };
  484. /*
  485. MPR_Looping_Path_JDG
  486. DEBUG DESCRIPTION
  487. DEBUG NAMING CONVENTION
  488. DEBUG UNUSED?
  489. Parameters:
  490. DestObjID1 = DEBUG
  491. DestObjID2 = DEBUG
  492. */
  493. DECLARE_SCRIPT(MPR_Looping_Path_JDG, "DestObjID1=:int, DestObjID2=:int")
  494. {
  495. int m_CurrentDest;
  496. void Created(GameObject* game_obj)
  497. {
  498. m_CurrentDest = 0;
  499. Goto_Dest(game_obj);
  500. }
  501. void Goto_Dest(GameObject* game_obj)
  502. {
  503. // Find the destination 'object'
  504. GameObject* dest_obj = Commands->Find_Object(Get_Int_Parameter(m_CurrentDest));
  505. if (dest_obj != NULL)
  506. {
  507. // Instruct our game object to goto the location of the destination object
  508. Vector3 pos = Commands->Get_Position(dest_obj);
  509. Commands->Action_Movement_Goto_Location(game_obj, pos, 3.0F);
  510. }
  511. else
  512. {
  513. DebugPrint("Error! Cannot find destination for MPR_Looping_Path_JDG.\n");
  514. }
  515. }
  516. void Movement_Complete(GameObject* game_obj, MovementCompleteReason)
  517. {
  518. m_CurrentDest = !m_CurrentDest;
  519. Goto_Dest(game_obj);
  520. }
  521. };
  522. /*
  523. MPR_A03_Bridge_Exploding_DEL
  524. DEBUG DESCRIPTION
  525. DEBUG NAMING CONVENTION
  526. DEBUG UNUSED
  527. Parameters:
  528. AnimationName = DEBUG
  529. */
  530. DECLARE_SCRIPT(MPR_A03_Bridge_Exploding_DEL, "AnimationName=:string")
  531. {
  532. void Created(GameObject* game_obj)
  533. {
  534. // Set the animation to the first frame
  535. const char* animName = Get_Parameter("AnimationName");
  536. Commands->Set_Animation_Frame(game_obj, animName, 0);
  537. }
  538. void Custom(GameObject* game_obj, int type, int, GameObject*)
  539. {
  540. // Is this the request to trigger the explosion?
  541. // If so, then kick off the animation
  542. if (type == MPR_CUSTOM_EXPLODE_BRIDGE_DEL) {
  543. const char* animName = Get_Parameter("AnimationName");
  544. Commands->Set_Animation(game_obj, animName, false);
  545. }
  546. }
  547. };
  548. /*
  549. MPR_A03_Bridge_Trigger_DEL
  550. DEBUG DESCRIPTION
  551. DEBUG NAMING CONVENTION
  552. DEBUG UNUSED
  553. Parameters:
  554. BridgeID = DEBUG
  555. */
  556. DECLARE_SCRIPT(MPR_A03_Bridge_Trigger_DEL, "BridgeID=:int")
  557. {
  558. void Entered(GameObject* obj, GameObject* enterer)
  559. {
  560. // Did the player enter the zone?
  561. if (enterer == Commands->Get_The_Star())
  562. {
  563. int bridgeID = Get_Int_Parameter("BridgeID");
  564. GameObject* dest_obj = Commands->Find_Object(bridgeID);
  565. if (dest_obj != NULL)
  566. {
  567. Commands->Send_Custom_Event(obj, dest_obj, MPR_CUSTOM_EXPLODE_BRIDGE_DEL, 0);
  568. }
  569. }
  570. }
  571. };
  572. /*
  573. Demo_Harvester
  574. DEBUG DESCRIPTION
  575. DEBUG NAMING CONVENTION
  576. DEBUG UNUSED
  577. Parameters:
  578. RefineryZoneID = DEBUG
  579. TiberiumZoneID = DEBUG
  580. */
  581. /*
  582. DEBUG - Harvester Behavior being moved to an innate system - DAY
  583. DECLARE_SCRIPT(Demo_Harvester, "RefineryZoneID:int,TiberiumZoneID:int")
  584. {
  585. #define MIN_HARVEST_TIME (30)
  586. #define MAX_HARVEST_TIME (60)
  587. #define MIN_MOVE_TIME (3)
  588. #define MAX_MOVE_TIME (5)
  589. #define MIN_UNLOAD_TIME (15)
  590. #define MAX_UNLOAD_TIME (30)
  591. enum States
  592. {
  593. IDLE,
  594. GOING_TO_TIBERIUM,
  595. HARVESTING,
  596. MOVING,
  597. RETURNING_TO_REFINERY,
  598. DOCKING,
  599. UNLOADING,
  600. };
  601. States mState;
  602. int mRefineryID;
  603. int mTiberiumID;
  604. void Created(GameObject*)
  605. {
  606. DebugPrint("Harvester %d: Behavior created\n", Commands->Get_ID(Owner()));
  607. mRefineryID = Get_Int_Parameter("RefineryZoneID");
  608. mTiberiumID = Get_Int_Parameter("TiberiumZoneID");
  609. DebugPrint("RefineryID = %d, TiberiumID = %d\n", mRefineryID, mTiberiumID);
  610. mState = IDLE;
  611. GotoTiberium();
  612. }
  613. Vector3 FindTiberium(void)
  614. {
  615. // Locate the tiberium zone and pick a random location within the
  616. // zone to go to.
  617. GameObject* tiberium = Commands->Find_Object(mTiberiumID);
  618. if (tiberium != NULL)
  619. {
  620. Vector3 location = Commands->Get_Position(tiberium);
  621. // Vector3 extent = Commands->Get_Extent(tiberium); // See Byon for a new way to do this, if needed
  622. DebugPrint("TiberiumZone Extent %f,%f,%f\n", extent.X, extent.Y, extent.Z);
  623. location += RandomVector3(extent.X, extent.Y, 0.0f);
  624. return location;
  625. }
  626. return Vector3(0.0f, 0.0f, 0.0f);
  627. }
  628. // Go to the tiberium field
  629. void GotoTiberium(void)
  630. {
  631. DebugPrint("Harvester %d: Going to tiberium\n", Commands->Get_ID(Owner()));
  632. Vector3 location = FindTiberium();
  633. Commands->Action_Movement_Goto_Location(Owner(), location, 1.0f);
  634. mState = GOING_TO_TIBERIUM;
  635. }
  636. // Harvest tiberium
  637. void Harvest(void)
  638. {
  639. DebugPrint("Harvester %d: Harvesting\n", Commands->Get_ID(Owner()));
  640. if (mState != HARVESTING)
  641. {
  642. Commands->Set_Animation(Owner(), "v_nod_harvester.m_harvesting", true);
  643. float harvestTime = Commands->Get_Random(MIN_HARVEST_TIME, MAX_HARVEST_TIME);
  644. DebugPrint("Harvest time %f seconds\n", harvestTime);
  645. Commands->Start_Timer(Owner(), harvestTime, MPR_TIMER_HARVESTER_DONE_DEL);
  646. }
  647. float moveTime = Commands->Get_Random(MIN_MOVE_TIME, MAX_MOVE_TIME);
  648. DebugPrint("Move time %f seconds\n", moveTime);
  649. Commands->Start_Timer(Owner(), moveTime, MPR_TIMER_HARVESTER_MOVE_DEL);
  650. mState = HARVESTING;
  651. }
  652. // Move to new location within tiberium field
  653. void MoveToNewSpot(void)
  654. {
  655. Vector3 location = FindTiberium();
  656. Commands->Action_Movement_Goto_Location(Owner(), location, 1.0f);
  657. mState = MOVING;
  658. }
  659. void ReturnToRefinery(void)
  660. {
  661. DebugPrint("Harvester %d: Returning to refinery\n", Commands->Get_ID(Owner()));
  662. // If there isn't a load and we are at the refinery then just sit idle.
  663. GameObject* refinery = Commands->Find_Object(mRefineryID);
  664. if (refinery != NULL)
  665. {
  666. Vector3 location = Commands->Get_Position(refinery);
  667. Commands->Action_Movement_Goto_Location(Owner(), location, 1.0f);
  668. }
  669. mState = RETURNING_TO_REFINERY;
  670. }
  671. void Dock(void)
  672. {
  673. DebugPrint("Harvester %d: Docking\n", Commands->Get_ID(Owner()));
  674. mState = DOCKING;
  675. Unload(); // Denzil - Temporary
  676. }
  677. void Unload(void)
  678. {
  679. DebugPrint("Harvester %d: Unloading\n", Commands->Get_ID(Owner()));
  680. Commands->Start_Timer(Owner(), 5.0f, MPR_TIMER_HARVESTER_DONE_DEL);
  681. mState = UNLOADING;
  682. }
  683. void Movement_Complete(GameObject* obj, MovementCompleteReason reason)
  684. {
  685. DebugPrint("Harvester %d: movement complete\n", Commands->Get_ID(Owner()));
  686. switch (mState)
  687. {
  688. // Upon reaching tiberium begin harvesting.
  689. case GOING_TO_TIBERIUM:
  690. case MOVING:
  691. Harvest();
  692. break;
  693. // Upon reaching refinery begin docking sequence.
  694. case RETURNING_TO_REFINERY:
  695. Dock();
  696. break;
  697. // When docking is complete being unloading.
  698. case DOCKING:
  699. Unload();
  700. break;
  701. default:
  702. break;
  703. }
  704. }
  705. void Timer_Expired(GameObject* obj, int timer)
  706. {
  707. if (timer == MPR_TIMER_HARVESTER_DONE_DEL)
  708. {
  709. DebugPrint("Harvester %d: Done timer expired\n", Commands->Get_ID(Owner()));
  710. switch (mState)
  711. {
  712. // When finished harvesting return to the refinery.
  713. case HARVESTING:
  714. ReturnToRefinery();
  715. break;
  716. // When finished unloading go back to the tiberium field to resume harvesting.
  717. case UNLOADING:
  718. GotoTiberium();
  719. break;
  720. default:
  721. break;
  722. }
  723. }
  724. else if (timer == MPR_TIMER_HARVESTER_MOVE_DEL)
  725. {
  726. DebugPrint("Harvester %d: Move timer expired\n", Commands->Get_ID(Owner()));
  727. if (mState == HARVESTING)
  728. {
  729. MoveToNewSpot();
  730. }
  731. }
  732. }
  733. };
  734. */
  735. /*
  736. MPR_ApacheTrigger
  737. DEBUG DESCRIPTION
  738. DEBUG NAMING CONVENTION
  739. Parameters:
  740. ApacheID = DEBUG
  741. Position = DEBUG
  742. */
  743. DECLARE_SCRIPT(MPR_ApacheTrigger, "ApacheID:int,Position:int")
  744. {
  745. void Entered(GameObject*, GameObject* enterer)
  746. {
  747. GameObject* star = Commands->Get_The_Star();
  748. // Only trigger if the commando entered the zone
  749. if (enterer == star)
  750. {
  751. DebugPrint("Apache attack triggered!\n");
  752. // Get apache object
  753. int apacheID = Get_Int_Parameter("ApacheID");
  754. GameObject* apache = Commands->Find_Object(apacheID);
  755. // Tell the apache were to move
  756. if (apache != NULL)
  757. {
  758. int position = Get_Int_Parameter("Position");
  759. Commands->Send_Custom_Event(Owner(), apache, MPR_CUSTOM_APACHE_GOTO_POSITION_DEL, position);
  760. }
  761. }
  762. }
  763. };
  764. /*
  765. MPR_ApacheShootAtPlayer
  766. DEBUG DESCRIPTION
  767. DEBUG NAMING CONVENTION
  768. Parameters:
  769. ApacheID = DEBUG
  770. */
  771. DECLARE_SCRIPT(MPR_ApacheShootAtPlayer, "ApacheID:int")
  772. {
  773. void Entered(GameObject*, GameObject* enterer)
  774. {
  775. GameObject* star = Commands->Get_The_Star();
  776. // Only trigger if the commando entered the zone
  777. if (enterer == star)
  778. {
  779. DebugPrint("Apache shoot at player enabled!\n");
  780. // Get apache object
  781. int apacheID = Get_Int_Parameter("ApacheID");
  782. GameObject* apache = Commands->Find_Object(apacheID);
  783. // Tell the apache were to move
  784. if (apache != NULL)
  785. {
  786. Commands->Send_Custom_Event(Owner(), apache, MPR_CUSTOM_APACHE_SHOOT_DEL, (int)true);
  787. }
  788. }
  789. }
  790. void Exited(GameObject*, GameObject* exiter)
  791. {
  792. GameObject* star = Commands->Get_The_Star();
  793. // Only trigger if the commando entered the zone
  794. if (exiter == star)
  795. {
  796. DebugPrint("Apache shoot at player disabled!\n");
  797. // Get apache object
  798. int apacheID = Get_Int_Parameter("ApacheID");
  799. GameObject* apache = Commands->Find_Object(apacheID);
  800. // Tell the apache were to move
  801. if (apache != NULL)
  802. {
  803. Commands->Send_Custom_Event(Owner(), apache, MPR_CUSTOM_APACHE_SHOOT_DEL, (int)false);
  804. }
  805. }
  806. }
  807. };
  808. /*
  809. MPR_ApacheController
  810. DEBUG DESCRIPTION
  811. DEBUG NAMING CONVENTION
  812. */
  813. DECLARE_SCRIPT(MPR_ApacheController, "")
  814. {
  815. typedef enum
  816. {
  817. APACHE_POSITION_FIRST = 0,
  818. APACHE_LANDED = APACHE_POSITION_FIRST,
  819. APACHE_POSITION_1,
  820. APACHE_POSITION_2,
  821. APACHE_POSITION_3,
  822. APACHE_POSITION_4,
  823. APACHE_POSITION_COUNT,
  824. } ApachePosition;
  825. typedef struct
  826. {
  827. const char* TransitionAnim;
  828. const char* HoverAnim;
  829. } Transition;
  830. static Transition _mTransitions[APACHE_POSITION_COUNT];
  831. ApachePosition mCurrentPosition;
  832. ApachePosition mDesiredPosition;
  833. bool mCanShoot;
  834. void Created(GameObject*)
  835. {
  836. DebugPrint("Apache attack script created.\n");
  837. //Denzil: I added this line for an idle animation. Change as you need.
  838. //David Y.
  839. //Commands->Set_Animation(Owner(), "V_APACHE-E3.M_AP_POSITION1", true);
  840. // Rotor anim fix
  841. Vector3 origin(0.0f, 0.0f, 0.0f);
  842. Commands->Set_Position(Owner(), origin);
  843. Commands->Set_Facing(Owner(), 0.0f);
  844. Commands->Set_Animation(Owner(), "M_AP_POSITION1", true);
  845. mCurrentPosition = APACHE_LANDED;
  846. mDesiredPosition = APACHE_LANDED;
  847. mCanShoot = false;
  848. }
  849. void Custom(GameObject* apache, int event, int param, GameObject*)
  850. {
  851. if (event == MPR_CUSTOM_APACHE_GOTO_POSITION_DEL)
  852. {
  853. Goto_Position((ApachePosition)param);
  854. }
  855. else if (event == MPR_CUSTOM_APACHE_SHOOT_DEL)
  856. {
  857. mCanShoot = ((param == 0) ? false : true);
  858. Shoot_At_Player();
  859. }
  860. }
  861. void Goto_Position(ApachePosition position)
  862. {
  863. assert(position >= APACHE_POSITION_FIRST);
  864. assert(position < APACHE_POSITION_COUNT);
  865. // If we are not already at the requested position or in the process of
  866. // going to the requested position.
  867. if ((position != mCurrentPosition) || (position != mDesiredPosition))
  868. {
  869. #if(0)
  870. // If currently in the landed position we must first move to 0.0.0
  871. // because the animations are relative to that.
  872. if (mCurrentPosition == APACHE_LANDED)
  873. {
  874. Vector3 origin(0.0f, 0.0f, 0.0f);
  875. Commands->Set_Position(Owner(), origin);
  876. Commands->Set_Facing(Owner(), 0.0f);
  877. }
  878. #endif
  879. mDesiredPosition = position;
  880. DebugPrint("Apache desired position = %d\n", mDesiredPosition);
  881. Transition& transition = _mTransitions[mDesiredPosition];
  882. Commands->Set_Animation(Owner(), transition.TransitionAnim, false);
  883. }
  884. }
  885. void Animation_Complete(GameObject* apache, const char* finishedAnim)
  886. {
  887. assert(finishedAnim != NULL);
  888. DebugPrint("Apache animation '%s' complete.\n", finishedAnim);
  889. Transition& transition = _mTransitions[mDesiredPosition];
  890. // Verify that the expected animation has completed.
  891. const char* animName = strrchr(finishedAnim, '.');
  892. animName++;
  893. if (stricmp(animName, transition.TransitionAnim) == 0)
  894. {
  895. // Arrived at desired position
  896. mCurrentPosition = mDesiredPosition;
  897. DebugPrint("Apache arrived at position = %d\n", mCurrentPosition);
  898. // Get transition for current position
  899. transition = _mTransitions[mCurrentPosition];
  900. Commands->Set_Animation(Owner(), transition.HoverAnim, true);
  901. }
  902. }
  903. void Timer_Expired(GameObject* obj, int timerID)
  904. {
  905. if (timerID == MPR_TIMER_APACHE_SHOOT_DEL)
  906. {
  907. Shoot_At_Player();
  908. }
  909. }
  910. void Shoot_At_Player(void)
  911. {
  912. // Begin shooting if we can
  913. if (mCanShoot == true)
  914. {
  915. // Only shoot if the apache is not transitioning.
  916. if (mCurrentPosition == mDesiredPosition)
  917. {
  918. GameObject* star = Commands->Get_The_Star();
  919. if (star != NULL)
  920. {
  921. Vector3 targetPosition = Commands->Get_Position(star);
  922. targetPosition.X += Commands->Get_Random(-1.0f, 1.0f);
  923. targetPosition.Y += Commands->Get_Random(-1.0f, 1.0f);
  924. targetPosition.Z += Commands->Get_Random(0.0f, 2.0f);
  925. DebugPrint("Apache shooting at location %.02f,%.02f,%.02f\n",targetPosition.X, targetPosition.Y, targetPosition.Z);
  926. Commands->Trigger_Weapon(Owner(), true, targetPosition, true);
  927. }
  928. }
  929. float fireAtInterval = Commands->Get_Random(0.33f, 1.5f);
  930. Commands->Start_Timer(Owner(), fireAtInterval, MPR_TIMER_APACHE_SHOOT_DEL);
  931. }
  932. else
  933. {
  934. Commands->Trigger_Weapon(Owner(), false, Vector3(0.0f, 0.0f, 0.0f), true);
  935. }
  936. }
  937. virtual void Killed(GameObject* obj, GameObject* killer)
  938. {
  939. DebugPrint("Apache killed.\n");
  940. Commands->Create_Explosion_At_Bone("Vehicle Explosion 01", Owner(), "ROOTTRANSFORM", Owner());
  941. }
  942. virtual void Damaged(GameObject* obj, GameObject* damager)
  943. {
  944. DebugPrint("Apache damaged.\n");
  945. }
  946. };
  947. /*
  948. MPR_ApacheController
  949. DEBUG DESCRIPTION
  950. DEBUG NAMING CONVENTION
  951. */
  952. MPR_ApacheController::Transition MPR_ApacheController::_mTransitions[APACHE_POSITION_COUNT] =
  953. {
  954. // Landed
  955. {NULL, NULL},
  956. // Position 1 - Hover above landing pad
  957. {"m_ap_loitr1", "m_ap_loitr1"},
  958. // Position 2 - Move into position on the right side and hover
  959. {"m_ap_move1-2", "m_ap_loitr2"},
  960. // Position 3 - Move into position on front side and hover.
  961. {"m_ap_move2-3", "m_ap_loitr3"},
  962. // Position 4 - Move into position on the left side and hover
  963. {"m_ap_move1-4", "m_ap_loitr4"},
  964. };
  965. /*
  966. MPR_A01_Orca_Strike_On_Turret
  967. This script handles the operations of the ORCA strike on the turret. When the animations that
  968. are pre-placed upon the map are given a custom to start, they play their own animations and
  969. handle firing operations. This code will change later to incorporate full firing routines for
  970. ORCAs, currently being implemented by programming.
  971. Parameters:
  972. Target_Number = What turret this ORCA should be attacking.
  973. Animation_Name = What animation to play upon this ORCA.
  974. Fire_01 = What frame the first fire should be at.
  975. Fire_02 = What frame the second fire should be at.
  976. Fire_03 = What frame the third fire should be at.
  977. Fire_04 = What frame the fourth fire should be at.
  978. Fire_05 = What frame the fifth fire should be at.
  979. Fire_06 = What frame the sixth fire should be at.
  980. DestructionBone = What bone the explosion animation should be played upon if shot down.
  981. ExplosionName = What explosion to play if shot down.
  982. */
  983. DECLARE_SCRIPT(MPR_A01_Orca_Strike_On_Turret_RAD, "Target_Number:int, AnimationName:string, Fire_01:int, Fire_02:int, Fire_03:int, Fire_04:int, Fire_05:int, Fire_06:int")
  984. {
  985. Vector3 v_target_loc;
  986. int n_target_number;
  987. int n_attack_number;
  988. void Created(GameObject* p_obj)
  989. {
  990. n_target_number = 0;
  991. n_attack_number = 1;
  992. }
  993. void Custom(GameObject* p_obj, int n_type, int n_param, GameObject* p_sender)
  994. {
  995. if (n_type == MPR_A01_CUSTOM_ORCA_TURRETSTRIKE_RAD)
  996. {
  997. // Set up the appropriate target number for the turret target.
  998. switch(Get_Int_Parameter("Target_Number"))
  999. {
  1000. case (1):
  1001. {
  1002. if (Commands->Find_Object(MPR_A01_orca_turret1_RAD))
  1003. {
  1004. n_target_number = MPR_A01_orca_turret1_RAD;
  1005. }
  1006. else
  1007. {
  1008. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_On_Turret - ORCA cannot find its turret 1 target!\n");
  1009. Commands->Destroy_Object(p_obj);
  1010. }
  1011. break;
  1012. }
  1013. case (2):
  1014. {
  1015. if (Commands->Find_Object(MPR_A01_orca_turret2_RAD))
  1016. {
  1017. n_target_number = MPR_A01_orca_turret2_RAD;
  1018. }
  1019. else
  1020. {
  1021. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_On_Turret - ORCA cannot find its turret 2 target!\n");
  1022. Commands->Destroy_Object(p_obj);
  1023. }
  1024. break;
  1025. }
  1026. default:
  1027. {
  1028. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_On_Turret - ORCA's Target_Number is inappropriate!\n");
  1029. Commands->Destroy_Object(p_obj);
  1030. }
  1031. }
  1032. // Find the location of the turret, and start the attack animation on the ORCA.
  1033. v_target_loc = Commands->Get_Position(Commands->Find_Object(n_target_number));
  1034. v_target_loc.Z += 0.5f;
  1035. Commands->Set_Animation(p_obj, Get_Parameter("AnimationName"), 0);
  1036. // Start the timer for the first attack. When this ends the attack happens.
  1037. Commands->Start_Timer(p_obj, (Get_Int_Parameter("Fire_01") / 30), MPR_A01_TIMER_ORCASTRIKE_RAD);
  1038. }
  1039. else
  1040. {
  1041. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_On_Turret - Orca strike received an improper custom!\n");
  1042. Commands->Destroy_Object(p_obj);
  1043. }
  1044. }
  1045. void Timer_Expired (GameObject* p_obj, int n_timer_id)
  1046. {
  1047. int n_newtimercount;
  1048. int n_timercount;
  1049. n_newtimercount = 0;
  1050. n_timercount = 0;
  1051. switch (n_timer_id)
  1052. {
  1053. case(MPR_A01_TIMER_ORCASTRIKE_RAD):
  1054. {
  1055. // Fire the weapon at the target.
  1056. Commands->Trigger_Weapon(p_obj, true, v_target_loc, true);
  1057. n_attack_number++;
  1058. // Start the timer for turning the attack off.
  1059. if (n_attack_number < 8)
  1060. {
  1061. Commands->Start_Timer(p_obj, MPR_A01_orca_attack_stoptime_RAD, MPR_A01_TIMER_ORCASTRIKE_OFF_RAD);
  1062. }
  1063. break;
  1064. }
  1065. case(MPR_A01_TIMER_ORCASTRIKE_OFF_RAD):
  1066. {
  1067. // Turn off the attack, set the timer for the next attack.
  1068. Commands->Trigger_Weapon(p_obj, false, v_target_loc, true);
  1069. switch (n_attack_number)
  1070. {
  1071. case (2):
  1072. {
  1073. n_newtimercount = Get_Int_Parameter("Fire_02");
  1074. n_timercount = Get_Int_Parameter("Fire_01");
  1075. n_newtimercount -= n_timercount;
  1076. break;
  1077. }
  1078. case (3):
  1079. {
  1080. n_newtimercount = Get_Int_Parameter("Fire_03");
  1081. n_timercount = Get_Int_Parameter("Fire_02");
  1082. n_newtimercount -= n_timercount;
  1083. break;
  1084. }
  1085. case (4):
  1086. {
  1087. n_newtimercount = Get_Int_Parameter("Fire_04");
  1088. n_timercount = Get_Int_Parameter("Fire_03");
  1089. n_newtimercount -= n_timercount;
  1090. break;
  1091. }
  1092. case (5):
  1093. {
  1094. n_newtimercount = Get_Int_Parameter("Fire_05");
  1095. n_timercount = Get_Int_Parameter("Fire_04");
  1096. n_newtimercount -= n_timercount;
  1097. break;
  1098. }
  1099. case (6):
  1100. {
  1101. n_newtimercount = Get_Int_Parameter("Fire_06");
  1102. n_timercount = Get_Int_Parameter("Fire_05");
  1103. n_newtimercount -= n_timercount;
  1104. break;
  1105. }
  1106. }
  1107. if (n_newtimercount)
  1108. {
  1109. Commands->Start_Timer(p_obj, (n_newtimercount / 30), MPR_A01_TIMER_ORCASTRIKE_RAD);
  1110. }
  1111. }
  1112. }
  1113. }
  1114. };
  1115. /*
  1116. MPR_A01_Orca_Turret
  1117. This script is for the turrets themselves. They simply assign their own ID numbers as per standard.
  1118. Parameters:
  1119. TurretNumber = Which turret this script is operating on.
  1120. */
  1121. DECLARE_SCRIPT(MPR_A01_Orca_Turret_RAD, "TurretNumber:int")
  1122. {
  1123. float f_health;
  1124. int n_turret_number;
  1125. void Created(GameObject* p_obj)
  1126. {
  1127. n_turret_number = Get_Int_Parameter("TurretNumber");
  1128. MPR_A01_startstrike_RAD = false;
  1129. Commands->Set_Health(p_obj, 350.0f);
  1130. f_health = Commands->Get_Health(p_obj);
  1131. switch (n_turret_number)
  1132. {
  1133. case (1):
  1134. {
  1135. MPR_A01_orca_turret1_RAD = Commands->Get_ID(p_obj);
  1136. break;
  1137. }
  1138. case (2):
  1139. {
  1140. MPR_A01_orca_turret2_RAD = Commands->Get_ID(p_obj);
  1141. break;
  1142. }
  1143. default:
  1144. {
  1145. DebugPrint("RAD-ERROR - MPR_A01_Orca_Turret - Turret has no indicated number!\n");
  1146. }
  1147. }
  1148. }
  1149. void Timer_Expired(GameObject* p_obj, int n_timer_id)
  1150. {
  1151. if (n_timer_id == 6543)
  1152. {
  1153. Commands->Create_Sound("TargetAcquired",Commands->Get_Position(Commands->Get_The_Star()),p_obj);
  1154. }
  1155. }
  1156. void Damaged(GameObject* p_obj, GameObject* p_damager)
  1157. {
  1158. if ((p_damager == Commands->Get_The_Star()) && (!MPR_A01_startstrike_RAD))
  1159. {
  1160. GameObject* p_orca1;
  1161. GameObject* p_orca2;
  1162. Vector3 v_zeroorg( 0,0,0 );
  1163. MPR_A01_startstrike_RAD = true;
  1164. p_orca1 = Commands->Create_Object("Orca airstrike", v_zeroorg);
  1165. if (p_orca1)
  1166. {
  1167. Commands->Attach_Script(p_orca1, "MPR_A01_Orca_Strike_On_Turret", "1,v_orcae3.m_orcastrike_a,195,255,310,348,419,459");
  1168. Commands->Send_Custom_Event(p_obj, p_orca1, MPR_A01_CUSTOM_ORCA_TURRETSTRIKE_RAD, 0);
  1169. }
  1170. else
  1171. {
  1172. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_Spawner - Cannot find proper animation for Orca Strike One!\n");
  1173. }
  1174. p_orca2 = Commands->Create_Object("Orca airstrike", v_zeroorg);
  1175. if (p_orca2)
  1176. {
  1177. Commands->Create_Sound("AirStrikeReady",Commands->Get_Position(Commands->Get_The_Star()),p_obj);
  1178. Commands->Start_Timer(p_obj, 1.5f, 6543);
  1179. Commands->Attach_Script(p_orca2, "MPR_A01_Orca_Strike_On_Turret", "2,v_orcae3.m_orcastrike_b,180,235,295,343,400,437");
  1180. Commands->Send_Custom_Event(p_obj, p_orca2, MPR_A01_CUSTOM_ORCA_TURRETSTRIKE_RAD, 0);
  1181. }
  1182. else
  1183. {
  1184. DebugPrint("RAD-ERROR - MPR_A01_Orca_Strike_Spawner - Cannot find proper animation for Orca Strike Two!\n");
  1185. }
  1186. }
  1187. }
  1188. };
  1189. /*
  1190. MPR_A01_Orca_Turret_Attack_Zone
  1191. This script is specifically for the turret attacks - if the commando enters this zone,
  1192. the turrets start shooting at him if they still exist.
  1193. */
  1194. DECLARE_SCRIPT(MPR_A01_Orca_Turret_Attack_Zone_RAD, "")
  1195. {
  1196. void Entered(GameObject* p_obj, GameObject* p_enterer)
  1197. {
  1198. if (p_enterer == Commands->Get_The_Star())
  1199. {
  1200. if (Commands->Find_Object(MPR_A01_orca_turret1_RAD))
  1201. {
  1202. Commands->Action_Attack_Object(Commands->Find_Object(MPR_A01_orca_turret1_RAD), p_enterer, 1.0f, 200.0f, true);
  1203. }
  1204. if (Commands->Find_Object(MPR_A01_orca_turret2_RAD))
  1205. {
  1206. Commands->Action_Attack_Object(Commands->Find_Object(MPR_A01_orca_turret2_RAD), p_enterer, 1.0f, 200.0f, true);
  1207. }
  1208. }
  1209. }
  1210. };
  1211. /*
  1212. MPR_A04_Obelisk_Weapon
  1213. This script handles the obelisk weapon firing. It is attached to a zone.
  1214. It handle the following process:
  1215. 0. When the object is created, it starts a firing timer for target switching.
  1216. 1. When an object enters the zone, check if it's the player.
  1217. 2. If it's not the player, add it to an empty slot in the list of targets.
  1218. 3. When the timer expires, check the list for target ids.
  1219. 4. If it finds a target ID, it verifies that the object exists.
  1220. 5. If it exists, the object is fired upon.
  1221. 6. If it does not exist, the object ID is removed from the list.
  1222. Parameters:
  1223. ObeliskWeaponID = The ID of the Obelisk weapon object.
  1224. NodLightTankID = The ID of Joe's Nod light tank nearby.
  1225. */
  1226. DECLARE_SCRIPT(MPR_A04_Obelisk_Weapon_RAD, "ObeliskWeaponID:int, NodLightTankID:int")
  1227. {
  1228. int a_obelisk_targets [6];
  1229. bool b_obelisk_firing;
  1230. int n_obelisk_id;
  1231. int n_nodtank_id;
  1232. void Created(GameObject* p_obj)
  1233. {
  1234. //Commands->Display_Text("RAD - Obelisk zone created, initializing.\n");
  1235. int n_counter;
  1236. b_obelisk_firing = true;
  1237. n_obelisk_id = Get_Int_Parameter("ObeliskWeaponID");
  1238. if (Commands->Find_Object(n_obelisk_id))
  1239. {
  1240. //Commands->Display_Text("RAD - Found the obelisk weapon itself.\n");
  1241. for (n_counter = 0;n_counter < 6;n_counter++)
  1242. {
  1243. a_obelisk_targets [n_counter] = 0;
  1244. }
  1245. Commands->Start_Timer(p_obj, MPR_A01_obelisk_firing_time_RAD, MPR_A04_TIMER_OBELISK_PREFIRING_RAD);
  1246. }
  1247. else
  1248. {
  1249. DebugPrint("RAD-ERROR - MPR_A04_Obelisk_Weapon - Obelisk weapon is missing!\n");
  1250. }
  1251. }
  1252. void Entered(GameObject* p_obj, GameObject* p_enterer)
  1253. {
  1254. //Commands->Display_Text("RAD - Obelisk firing zone entered.\n");
  1255. int n_counter;
  1256. bool b_tankfound;
  1257. b_tankfound = false;
  1258. // Special casing for Joe's Nod tank.
  1259. if (Commands->Find_Object(Get_Int_Parameter("NodLightTankID")))
  1260. {
  1261. GameObject* p_tank = Commands->Find_Object(Get_Int_Parameter("NodLightTankID"));
  1262. if (p_enterer == p_tank)
  1263. {
  1264. b_tankfound = true;
  1265. }
  1266. }
  1267. if (!b_tankfound)
  1268. {
  1269. //Commands->Display_Text("RAD - The proper target has entered the zone.\n");
  1270. for (n_counter = 0;n_counter < 6;n_counter++)
  1271. {
  1272. if (!a_obelisk_targets[n_counter])
  1273. {
  1274. //Commands->Display_Text("RAD - found a blank id slot, inserting.\n");
  1275. a_obelisk_targets[n_counter] = Commands->Get_ID(p_enterer);
  1276. n_counter = 6;
  1277. }
  1278. else
  1279. {
  1280. if (!Commands->Find_Object(a_obelisk_targets[n_counter]))
  1281. {
  1282. //Commands->Display_Text("RAD - found an obsolete id, replacing.\n");
  1283. a_obelisk_targets[n_counter] = Commands->Get_ID(p_enterer);
  1284. n_counter = 6;
  1285. }
  1286. }
  1287. }
  1288. }
  1289. }
  1290. void Timer_Expired(GameObject* p_obj, int n_timer_id)
  1291. {
  1292. int n_counter;
  1293. Vector3 v_obeliskloc;
  1294. Vector3 v_targetloc;
  1295. int n_nontargets;
  1296. n_nontargets = 0;
  1297. v_obeliskloc = Commands->Get_Position(Commands->Find_Object(n_obelisk_id));
  1298. if ((b_obelisk_firing) && (n_timer_id == MPR_A04_TIMER_OBELISK_PREFIRING_RAD))
  1299. {
  1300. //Commands->Display_Text("RAD - pre-firing timer expired. Creating explosion.\n");
  1301. //Commands->Create_Explosion("Obelisk Emitter", v_obeliskloc, p_obj);
  1302. Commands->Start_Timer(p_obj, 1.0f, MPR_A04_TIMER_OBELISK_FIRING_RAD);
  1303. }
  1304. if ((b_obelisk_firing) && (n_timer_id == MPR_A04_TIMER_OBELISK_FIRING_RAD))
  1305. {
  1306. //Commands->Display_Text("RAD - obelisk firing timer expired. Looking for a target.\n");
  1307. for (n_counter = 0;n_counter < 6;n_counter++)
  1308. {
  1309. if ((Commands->Find_Object(a_obelisk_targets[n_counter])) && (Commands->Find_Object(n_obelisk_id)))
  1310. {
  1311. v_targetloc = Commands->Get_Position(Commands->Find_Object(a_obelisk_targets[n_counter]));
  1312. //Commands->Display_Text("RAD - shooting at target.\n");
  1313. if (Commands->Find_Object(a_obelisk_targets[n_counter]) != Commands->Get_The_Star())
  1314. {
  1315. Commands->Set_Health(Commands->Find_Object(a_obelisk_targets[n_counter]), 1.0f);
  1316. }
  1317. Commands->Trigger_Weapon(Commands->Find_Object(n_obelisk_id), true, v_targetloc, true);
  1318. Commands->Create_Explosion("Obelisk Explosion", v_targetloc, p_obj);
  1319. a_obelisk_targets[n_counter] = 0;
  1320. n_counter = 6;
  1321. }
  1322. else
  1323. {
  1324. n_nontargets++;
  1325. }
  1326. }
  1327. if (n_nontargets == 6)
  1328. {
  1329. Commands->Trigger_Weapon(Commands->Find_Object(n_obelisk_id), false, v_obeliskloc, true);
  1330. }
  1331. Commands->Start_Timer(p_obj, 2.0f, MPR_A04_TIMER_OBELISK_STOPFIRING_RAD);
  1332. }
  1333. if (n_timer_id == MPR_A04_TIMER_OBELISK_STOPFIRING_RAD)
  1334. {
  1335. //Commands->Display_Text("RAD - obelisk stop firing timer expired. Stopping firing.\n");
  1336. v_obeliskloc = Commands->Get_Position(p_obj);
  1337. Commands->Trigger_Weapon(Commands->Find_Object(n_obelisk_id), false, v_obeliskloc, true);
  1338. Commands->Start_Timer(p_obj, MPR_A01_obelisk_firing_time_RAD, MPR_A04_TIMER_OBELISK_PREFIRING_RAD);
  1339. }
  1340. }
  1341. void Custom(GameObject* p_obj, int n_type, int n_param, GameObject* p_sender)
  1342. {
  1343. if (n_type == MPR_A04_CUSTOM_OBELISK_FIRING_RAD)
  1344. {
  1345. //Commands->Display_Text("RAD - obelisk firing being turned off.\n");
  1346. b_obelisk_firing = false;
  1347. }
  1348. }
  1349. };
  1350. /*
  1351. MPR_A04_Main_Control_Terminal
  1352. This script handles the deactivation of the Obelisk. It handles the following process:
  1353. 1. When either the Obelisk Main Control Terminal or the Power Plant Main Control Terminal
  1354. are destroyed, the Obelisk receives a custom to disable the firing action.
  1355. ObeliskControllerID = The ID of the obelisk controller zone, to tell it to stop firing.
  1356. BuildingID = The ID of the building that this console is in, for proper sounds and function.
  1357. 0 = Hand of Nod
  1358. 1 = Tiberium Refinery
  1359. 2 = Obelisk
  1360. 3 = Power Plant
  1361. 4 = Airfield
  1362. Parameters:
  1363. ObeliskControllerID = The ID number of the Obelisk controller object.
  1364. BuildingID = Which building this script is operating on.
  1365. */
  1366. DECLARE_SCRIPT(MPR_A04_Main_Control_Terminal_RAD, "ObeliskControllerID:int, BuildingID:int")
  1367. {
  1368. void Killed(GameObject* p_obj, GameObject* p_killer)
  1369. {
  1370. Vector3 v_consoleloc;
  1371. GameObject* p_created;
  1372. int n_building_id;
  1373. float f_rightbuilding;
  1374. n_building_id = Get_Int_Parameter("BuildingID");
  1375. if ((n_building_id == 2) || (n_building_id == 3))
  1376. {
  1377. f_rightbuilding = true;
  1378. }
  1379. else
  1380. {
  1381. f_rightbuilding = false;
  1382. }
  1383. if ((Commands->Find_Object(Get_Int_Parameter("ObeliskControllerID"))) && (f_rightbuilding))
  1384. {
  1385. Commands->Send_Custom_Event(p_obj, Commands->Find_Object(Get_Int_Parameter("ObeliskControllerID")), MPR_A04_CUSTOM_OBELISK_FIRING_RAD, 0);
  1386. }
  1387. else
  1388. {
  1389. DebugPrint("RAD-ERROR - MPR_A04_Main_Control_Terminal - Cannot find Obelisk Controller object!\n");
  1390. }
  1391. v_consoleloc = Commands->Get_Position(p_obj);
  1392. Commands->Create_Explosion("Generic Ground 01", v_consoleloc, p_killer);
  1393. p_created = Commands->Create_Object_At_Bone(p_obj, "NOD Console Off", "TM[0]");
  1394. if (n_building_id != 2)
  1395. {
  1396. if (p_created)
  1397. {
  1398. Vector3 v_created = Commands->Get_Position(p_created);
  1399. Commands->Create_Sound(MPR_control_klaxons_RAD[n_building_id], v_created, p_created);
  1400. }
  1401. }
  1402. }
  1403. };
  1404. /*
  1405. MPR_A05_Tank_Controller
  1406. This script handles the operation of the Mammoth Tank and Flame Tanks in areas 5 and 6. It performs the following
  1407. processes:
  1408. 1. If enemies are seen, fire upon the enemies.
  1409. 2. If taking damage, move to a new location among preset coordinates.
  1410. 3. If the commmando crosses the temple area entry zone, move to the temple area.
  1411. 4. If I am a temple guarding tank, I will remain motionless until the zone is entered.
  1412. My_Number = The number of this particular tank for reference purposes.
  1413. 1 = Mammoth Tank
  1414. 2 = Air dropped Flame Tank
  1415. 3 = Temple Guard Flame Tank
  1416. 4 = Temple Guard Flame Tank
  1417. Four coordintates are needed:
  1418. Coordinate 1, 2, and 3 = Primary move locations.
  1419. Coordinate 4 = Temple movement coordinate for #1 and #2.
  1420. Parameters:
  1421. My_Number = What tank number this script is attached to.
  1422. MammothTank = The ID number of the Mammoth Tank.
  1423. */
  1424. DECLARE_SCRIPT(MPR_A05_Tank_Controller_RAD, "My_Number:int, MammothTank:int")
  1425. {
  1426. int n_mynumber;
  1427. GameObject* p_target;
  1428. int n_flametank;
  1429. void Created(GameObject* p_obj)
  1430. {
  1431. n_flametank = 0;
  1432. int n_mammoth;
  1433. n_mammoth = 8649;
  1434. MPR_A05_mammoth_tank_id_RAD = n_mammoth;
  1435. n_mynumber = Get_Int_Parameter("My_Number");
  1436. if (n_mynumber == 2)
  1437. {
  1438. Commands->Action_Movement_Goto_Location(p_obj, MPR_A05_tank_move_locations_RAD[1], 2.0f);
  1439. if (Commands->Find_Object(n_mammoth))
  1440. {
  1441. Commands->Send_Custom_Event(p_obj, Commands->Find_Object(n_mammoth), MPR_A05_CUSTOM_MAMMOTH_RAD, Commands->Get_ID(p_obj));
  1442. }
  1443. }
  1444. }
  1445. void Custom(GameObject* p_obj, int n_type, int n_param, GameObject* p_sender)
  1446. {
  1447. if (n_type == MPR_A05_CUSTOM_TEMPLE_ZONE_ENTERED_RAD)
  1448. {
  1449. switch (n_mynumber)
  1450. {
  1451. case (1):
  1452. {
  1453. Commands->Action_Movement_Goto_Location(p_obj, MPR_A05_tank_move_locations_RAD[(n_mynumber - 1)], 2.0f);
  1454. break;
  1455. }
  1456. case (3):
  1457. {
  1458. Commands->Action_Movement_Goto_Location(p_obj, MPR_A05_tank_move_locations_RAD[(n_mynumber - 1)], 2.0f);
  1459. break;
  1460. }
  1461. case (4):
  1462. {
  1463. Commands->Action_Movement_Goto_Location(p_obj, MPR_A05_tank_move_locations_RAD[(n_mynumber - 1)], 2.0f);
  1464. break;
  1465. }
  1466. default:
  1467. {
  1468. DebugPrint("RAD-ERROR - MPR_A05_Tank_Controller - Received an improper custom!\n");
  1469. }
  1470. }
  1471. }
  1472. else if (n_type == MPR_A05_CUSTOM_MAMMOTH_RAD)
  1473. {
  1474. n_flametank = n_param;
  1475. }
  1476. else
  1477. {
  1478. p_target = p_sender;
  1479. Commands->Start_Timer(p_obj, 2.0f, MPR_A05_TIMER_MAMMOTH_RAD);
  1480. }
  1481. }
  1482. void Timer_Expired(GameObject* p_obj, int n_timer_id)
  1483. {
  1484. Vector3 c130_location;
  1485. if (n_timer_id == MPR_A05_TIMER_MAMMOTH_RAD)
  1486. {
  1487. if (p_target)
  1488. {
  1489. c130_location = Commands->Get_Bone_Position(p_target, "BODYMAIN");
  1490. Commands->Action_Attack_Location(p_obj,c130_location, 0.0f, 200.0f, true);
  1491. }
  1492. Commands->Start_Timer(p_obj, 1.0f, MPR_A05_TIMER_MAMMOTH_2_RAD);
  1493. }
  1494. if (n_timer_id == MPR_A05_TIMER_MAMMOTH_2_RAD)
  1495. {
  1496. Commands->Action_Attack_Stop(p_obj);
  1497. Commands->Start_Timer(p_obj, 2.0f, MPR_A05_TIMER_MAMMOTH_3_RAD);
  1498. }
  1499. if (n_timer_id == MPR_A05_TIMER_MAMMOTH_3_RAD)
  1500. {
  1501. if (Commands->Find_Object(n_flametank))
  1502. {
  1503. Commands->Action_Attack_Object(p_obj, Commands->Find_Object(n_flametank), 1.0f, 100.0f, true);
  1504. }
  1505. }
  1506. }
  1507. };
  1508. /*
  1509. MPR_A06_RMV_Final_Zone_Trigger
  1510. DEBUG DESCRIPTION
  1511. DEBUG NAMING CONVENTION
  1512. */
  1513. DECLARE_SCRIPT(MPR_A06_Final_Zone_Trigger_RMV, "")
  1514. {
  1515. enum
  1516. {
  1517. apache1_die,
  1518. apache2_die,
  1519. end_of_demo,
  1520. pause_animation,
  1521. end_of_whole_thing
  1522. };
  1523. int apache1_id, apache2_id, end_id;
  1524. int havoc_has_entered;
  1525. void Created( GameObject * obj )
  1526. {
  1527. havoc_has_entered = 0;
  1528. }
  1529. void Entered( GameObject * obj, GameObject * enterer )
  1530. {
  1531. float apache1_die_frame = 146;
  1532. float fadeout_frame = 155;
  1533. if ( enterer == Commands->Get_The_Star() && havoc_has_entered == 0 )
  1534. {
  1535. havoc_has_entered = 1;
  1536. GameObject *clouds = Commands->Find_Object(9876);
  1537. if (clouds != NULL)
  1538. {
  1539. Commands->Destroy_Object(clouds);
  1540. }
  1541. Commands->Create_Sound( "Ion Cannon ready", Commands->Get_Position(Commands->Get_The_Star()), obj );
  1542. Commands->Start_Timer( obj, fadeout_frame/30, end_of_demo );
  1543. Commands->Create_Object( "Outro Aggregate", Vector3(0,0,0) );
  1544. Commands->Create_Sound( "Ion Cannon03", Vector3(-170.0f, 448.0f, 20.0f), obj );
  1545. GameObject *apache1 = Commands->Create_Object( "Apache Outro 1", Vector3(0,0,0) );
  1546. GameObject *apache2 = Commands->Create_Object( "Apache Outro 2", Vector3(0,0,0) );
  1547. Commands->Start_Timer( obj, apache1_die_frame/30, apache1_die );
  1548. apache1_id = Commands->Get_ID( apache1 );
  1549. apache2_id = Commands->Get_ID( apache2 );
  1550. }
  1551. }
  1552. void Timer_Expired( GameObject * obj, int timer_id )
  1553. {
  1554. if ( timer_id == apache1_die )
  1555. {
  1556. GameObject *apache1 = Commands->Find_Object( apache1_id );
  1557. GameObject *apache2 = Commands->Find_Object( apache2_id );
  1558. if (apache1 != NULL)
  1559. {
  1560. Vector3 explosion1 = Commands->Get_Bone_Position( apache1, "SEAT" );
  1561. Commands->Create_Explosion( "Generic Air 02", explosion1 );
  1562. }
  1563. if (apache2 != NULL)
  1564. {
  1565. Vector3 explosion2 = Commands->Get_Bone_Position( apache2, "SEAT" );
  1566. Commands->Create_Explosion( "Generic Air 02", explosion2 );
  1567. }
  1568. }
  1569. if (timer_id == end_of_demo)
  1570. {
  1571. GameObject *fadeout = Commands->Create_Object("outro fadeout", Vector3(0,0,0));
  1572. Commands->Create_Sound( "Outro Sound", Vector3(-170.0f, 448.0f, 20.0f), obj );
  1573. end_id = Commands->Get_ID(fadeout);
  1574. Commands->Enable_HUD(0);
  1575. Commands->Control_Enable(Commands->Get_The_Star(), false);
  1576. Commands->Start_Timer( obj, 2.0f, pause_animation);
  1577. }
  1578. if (timer_id == pause_animation)
  1579. {
  1580. GameObject *fadeout = Commands->Find_Object(end_id);
  1581. if (fadeout != NULL)
  1582. {
  1583. Commands->Set_Animation_Frame(fadeout, "fadeout.fadeout", 61);
  1584. }
  1585. Commands->Start_Timer( obj, 4.0f, end_of_whole_thing );
  1586. }
  1587. if (timer_id == end_of_whole_thing)
  1588. {
  1589. Commands->Mission_Complete(true);
  1590. }
  1591. }
  1592. };
  1593. /*
  1594. MPR_A05_RMV_C130_Zone_Trigger
  1595. DEBUG DESCRIPTION
  1596. DEBUG NAMING CONVENTION
  1597. */
  1598. DECLARE_SCRIPT(MPR_A05_C130_Zone_Trigger_RMV, "")
  1599. {
  1600. void Entered( GameObject * obj, GameObject * enterer )
  1601. {
  1602. GameObject *aircraft;
  1603. if ( enterer == Commands->Get_The_Star() )
  1604. {
  1605. aircraft = Commands->Create_Object( "C-130 airdrop", Vector3(160.66f,623.06f,0.00f) );
  1606. Commands->Set_Facing( aircraft, 149.54f );
  1607. Commands->Destroy_Object( obj );
  1608. }
  1609. }
  1610. };
  1611. /*
  1612. MPR_A05_RMV_A10_Trigger_When_SAM_Destroyed
  1613. DEBUG DESCRIPTION
  1614. DEBUG NAMING CONVENTION
  1615. */
  1616. DECLARE_SCRIPT(MPR_A05_A10_Trigger_When_SAM_Destroyed_RMV, "")
  1617. {
  1618. void Killed( GameObject * obj, GameObject * killer )
  1619. {
  1620. Commands->Create_Object( "A-10 with bomb dropper", Vector3(0,0,0) );
  1621. Commands->Create_Sound("AirStrikeReady",Commands->Get_Position(Commands->Get_The_Star()),obj);
  1622. Commands->Start_Timer(obj, 1.5f, 6543);
  1623. }
  1624. void Timer_Expired(GameObject* obj, int n_timer_id)
  1625. {
  1626. if (n_timer_id == 6543)
  1627. {
  1628. Commands->Create_Sound("TargetAcquired",Commands->Get_Position(Commands->Get_The_Star()),obj);
  1629. }
  1630. }
  1631. };
  1632. /*
  1633. MPR_A02_RMV_Zone_Trigger_For_Dogfight
  1634. DEBUG DESCRIPTION
  1635. DEBUG NAMING CONVENTION
  1636. */
  1637. DECLARE_SCRIPT(MPR_A02_Zone_Trigger_For_Dogfight_RMV, "")
  1638. {
  1639. void Entered(GameObject * obj, GameObject * enterer)
  1640. {
  1641. if (enterer == Commands->Get_The_Star())
  1642. {
  1643. Commands->Create_Object( "Apache Dogfight", Vector3(0,0,0) );
  1644. Commands->Create_Object( "Orca Dogfight", Vector3(0,0,0) );
  1645. Commands->Destroy_Object( obj );
  1646. }
  1647. }
  1648. };
  1649. /*
  1650. MPR_A05_RMV_C130_Dropoff_Animation
  1651. DEBUG DESCRIPTION
  1652. DEBUG NAMING CONVENTION
  1653. Parameters:
  1654. Cinematic = DEBUG
  1655. ObjToCreate = DEBUG
  1656. DropFrame = DEBUG
  1657. BoneName = DEBUG
  1658. */
  1659. DECLARE_SCRIPT(MPR_A05_C130_Dropoff_Animation_RMV, "Cinematic=:string,ObjToCreate=:string,DropFrame=:int,BoneName=:string")
  1660. {
  1661. int debris_1_id, debris_2_id, debris_3_id;
  1662. void Created( GameObject * obj )
  1663. {
  1664. Commands->Set_Animation ( obj, Get_Parameter( "Cinematic" ), 0 );
  1665. int drop_frame = Get_Int_Parameter( "DropFrame" );
  1666. float drop_time = ( float )drop_frame / 30.0;
  1667. Commands->Start_Timer( obj, drop_time, MPR_A05_TIMER_DROP_OBJECT_RMV );
  1668. }
  1669. void Timer_Expired ( GameObject* obj, int Timer_ID )
  1670. {
  1671. if ( Timer_ID == MPR_A05_TIMER_DROP_OBJECT_RMV )
  1672. {
  1673. GameObject* flametank = Commands->Create_Object_At_Bone( obj, Get_Parameter( "ObjToCreate" ), Get_Parameter( "BoneName" ) );
  1674. if (flametank)
  1675. {
  1676. Commands->Attach_Script( flametank,"MPR_A05_Tank_Controller","2" );
  1677. }
  1678. Commands->Send_Custom_Event( obj, Commands->Find_Object( 8649 ), 0, 0 );
  1679. Commands->Start_Timer( obj, 2.0f, MPR_A05_TIMER_DIE_RMV );
  1680. }
  1681. if (Timer_ID == MPR_A05_TIMER_DIE_RMV)
  1682. {
  1683. if ( obj != NULL )
  1684. {
  1685. Commands->Create_Explosion_At_Bone("C-130 Explosion 01", obj, "BODYMAIN", obj);
  1686. }
  1687. }
  1688. }
  1689. };
  1690. /*
  1691. MPR_A05_RMV_A10_Air_Strike
  1692. DEBUG DESCRIPTION
  1693. DEBUG NAMING CONVENTION
  1694. */
  1695. DECLARE_SCRIPT(MPR_A05_A10_Air_Strike_RMV, "")
  1696. {
  1697. enum
  1698. {
  1699. GO,
  1700. SHOOT,
  1701. STOP,
  1702. STRAFE,
  1703. NO_STRAFE
  1704. };
  1705. void Created( GameObject * obj )
  1706. {
  1707. float go_time = 3.0;
  1708. float shoot_frame = 160; //Frame 70
  1709. float shoot_time = shoot_frame / 30;
  1710. float stop_frame = 240; //Frame 150
  1711. float stop_time = stop_frame / 30;
  1712. float begin_strafe_frame = 420;
  1713. float begin_strafe_time = begin_strafe_frame / 30;
  1714. float stop_strafe_frame = 450;
  1715. float stop_strafe_time = stop_strafe_frame / 30;
  1716. Commands->Start_Timer( obj, go_time, GO);
  1717. Commands->Start_Timer( obj, shoot_time, SHOOT );
  1718. Commands->Start_Timer( obj, stop_time, STOP );
  1719. Commands->Start_Timer( obj, begin_strafe_time, STRAFE );
  1720. Commands->Start_Timer( obj, stop_strafe_time, NO_STRAFE );
  1721. }
  1722. void Timer_Expired ( GameObject* obj, int timer_id )
  1723. {
  1724. if ( timer_id == GO )
  1725. {
  1726. Commands->Set_Animation( obj, "v_gdi-a10e3.m_a10strike_a", 0 );
  1727. }
  1728. if ( timer_id == SHOOT )
  1729. {
  1730. Commands->Trigger_Weapon( obj, true, Vector3(85,665,0), true );
  1731. }
  1732. if ( timer_id == STOP )
  1733. {
  1734. Commands->Trigger_Weapon( obj, false, Vector3(85,665,0), true );
  1735. }
  1736. if ( timer_id == STRAFE )
  1737. {
  1738. Commands->Trigger_Weapon( obj, true, Vector3(-37,679,10), false );
  1739. Commands->Create_Explosion( "Generic Ground 01", Vector3(-37,679,10), obj );
  1740. }
  1741. if ( timer_id == NO_STRAFE )
  1742. {
  1743. Commands->Trigger_Weapon( obj, false, Vector3(-37,679,10), false );
  1744. }
  1745. }
  1746. void Animation_Complete( GameObject * obj, const char * name )
  1747. {
  1748. Commands->Destroy_Object( obj );
  1749. }
  1750. };
  1751. /*
  1752. MPR_A02_RMV_Apache_Dogfight
  1753. DEBUG DESCRIPTION
  1754. DEBUG NAMING CONVENTION
  1755. */
  1756. DECLARE_SCRIPT(MPR_A02_Apache_Dogfight_RMV, "")
  1757. {
  1758. void Animation_Complete( GameObject * obj, const char * name )
  1759. {
  1760. Commands->Destroy_Object( obj );
  1761. Commands->Create_Object( "Apache Destroyed", Vector3(0,0,0) );
  1762. }
  1763. };
  1764. /*
  1765. MPR_A02_RMV_Orca_Dogfight
  1766. DEBUG DESCRIPTION
  1767. DEBUG NAMING CONVENTION
  1768. */
  1769. DECLARE_SCRIPT(MPR_A02_Orca_Dogfight_RMV, "")
  1770. {
  1771. enum
  1772. {
  1773. FIRE_1,
  1774. FIRE_2,
  1775. FIRE_3,
  1776. FIRE_4,
  1777. STOP_FIRE,
  1778. };
  1779. void Created( GameObject * obj )
  1780. {
  1781. float fire_1_frame = 80;
  1782. float fire_2_frame = 175;
  1783. float fire_3_frame = 246;
  1784. float fire_4_frame = 285;
  1785. Commands->Start_Timer( obj, fire_1_frame / 30, FIRE_1 );
  1786. Commands->Start_Timer( obj, fire_2_frame / 30, FIRE_2 );
  1787. Commands->Start_Timer( obj, fire_3_frame / 30, FIRE_3 );
  1788. Commands->Start_Timer( obj, fire_4_frame / 30, FIRE_4 );
  1789. }
  1790. void Timer_Expired( GameObject * obj, int timer_id )
  1791. {
  1792. if ( timer_id == FIRE_1 )
  1793. {
  1794. Commands->Trigger_Weapon( obj, true, Vector3(-6.195326f,-117.866371f,20.833399f), true );
  1795. Commands->Start_Timer(obj, 0.2f, STOP_FIRE);
  1796. }
  1797. if ( timer_id == FIRE_2 )
  1798. {
  1799. Commands->Trigger_Weapon( obj, true, Vector3(107.822525f,76.754219f,23.240044f), true );
  1800. Commands->Start_Timer( obj, 0.2f, STOP_FIRE );
  1801. }
  1802. if ( timer_id == FIRE_3 )
  1803. {
  1804. Commands->Trigger_Weapon( obj, true, Vector3(240.367477f,28.173233f,27.428972f), true );
  1805. Commands->Start_Timer( obj, 0.2f, STOP_FIRE );
  1806. }
  1807. if ( timer_id == FIRE_4 )
  1808. {
  1809. Commands->Trigger_Weapon( obj, true, Vector3(183.254105f,58.453369f,59.090523f), true );
  1810. Commands->Start_Timer( obj, 0.2f, STOP_FIRE );
  1811. }
  1812. if ( timer_id == STOP_FIRE )
  1813. {
  1814. Commands->Trigger_Weapon( obj, false, Vector3(240.367477f,28.173233f,27.428972f), true );
  1815. }
  1816. }
  1817. };
  1818. /*
  1819. MPR_A01_RMV_Intro_Cinematic
  1820. DEBUG DESCRIPTION
  1821. DEBUG NAMING CONVENTION
  1822. */
  1823. DECLARE_SCRIPT(MPR_A01_Intro_Cinematic_RMV, "")
  1824. {
  1825. enum
  1826. {
  1827. CAMERA_B_START,
  1828. CAMERA_C_START,
  1829. A10_START,
  1830. BIKEA_START,
  1831. BIKEA_DIE,
  1832. BIKEB_START,
  1833. BIKEB_DIE,
  1834. HAVOC_START,
  1835. ROPE_START,
  1836. EFFECT_START,
  1837. INTRO,
  1838. REMOVE,
  1839. HAVOC_BLEND
  1840. };
  1841. Vector3 start_location;
  1842. void Created(GameObject * obj)
  1843. {
  1844. float camera_end_frame = 251;
  1845. GameObject *camera;
  1846. Commands->Start_Timer( obj, 0.5f, REMOVE );
  1847. camera = Commands->Create_Object("Intro Camera 2", Vector3(0,0,0));
  1848. Commands->Set_Camera_Host(camera);
  1849. Commands->Create_Object("Chinook Intro 2", Vector3(0,0,0));
  1850. Commands->Create_Object("Havoc Intro", Vector3(0,0,0));
  1851. Commands->Create_Object("Rope Intro", Vector3(0,0,0));
  1852. Commands->Start_Timer(obj, camera_end_frame/30, INTRO);
  1853. }
  1854. void Timer_Expired(GameObject * obj, int timer_id)
  1855. {
  1856. if ( timer_id == REMOVE )
  1857. {
  1858. Commands->Control_Enable( Commands->Get_The_Star(), false );
  1859. Commands->Enable_HUD(0);
  1860. }
  1861. if ( timer_id == INTRO )
  1862. {
  1863. start_location.X = -118.69f;
  1864. start_location.Y = -190.68f;
  1865. start_location.Z = 3.80f;
  1866. Commands->Set_Position( Commands->Get_The_Star(), start_location );
  1867. Commands->Set_Facing( Commands->Get_The_Star(), 180.0f );
  1868. Commands->Set_Animation( Commands->Get_The_Star(), "s_a_human.m_havok_e3pose", 0 );
  1869. Commands->Set_Camera_Host( NULL );
  1870. Commands->Control_Enable( Commands->Get_The_Star(), true );
  1871. Commands->Enable_HUD(1);
  1872. Commands->Destroy_Object(obj);
  1873. }
  1874. }
  1875. };
  1876. /*
  1877. MPR_A02_DRILL_INSTRUCTOR
  1878. The following are the scripts involved with the drill seargent routine.
  1879. It is broken up into 6 scripts, 2 zones, the drill seargent, and the three
  1880. cadet guys. The following is the script for the Drill Instructor.
  1881. DEBUG NAMING CONVENTION
  1882. */
  1883. //insert new drill scripts here
  1884. DECLARE_SCRIPT(MPR_A02_Drill_Instructor_JDG, "")
  1885. {
  1886. //state is used to keep track of what DI is doing
  1887. typedef enum
  1888. {
  1889. MPR_A02_drill_instructor_idle = 0,
  1890. DI_MOVING,
  1891. DI_INNATE,
  1892. } DIState;
  1893. DIState state;
  1894. void Created(GameObject* obj)
  1895. {
  1896. //DebugPrint("JDG. Demo, Drill Instructor, Created and disallowing innate\n" );
  1897. MPR_A02_drill_instructor_id_JDG = Commands->Get_ID (obj);
  1898. }
  1899. void Killed (GameObject* obj, GameObject* Killer)
  1900. {
  1901. if (Killer == (Commands->Get_The_Star()))
  1902. {
  1903. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  1904. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  1905. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  1906. }
  1907. }
  1908. void Custom (GameObject* obj, int Type, int Param, GameObject* Sender)
  1909. {
  1910. if ((Param == MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG) && (Type == MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG))
  1911. {
  1912. //DebugPrint("JDG. Demo, Drill Instructor, Recieved Innate Custom\n");
  1913. state = DI_INNATE;
  1914. float timeDelay = Commands->Get_Random (1.5f,2.5f);
  1915. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), timeDelay, MPR_A02_TIMER_DRILL_INSTRUCTOR_ATTACK_DELAY_JDG);
  1916. }
  1917. //When Havoc enters zone come to attention
  1918. if ((Param == MPR_A02_PARAM_CADETS_TEN_HUT_JDG) && (Type == MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG))
  1919. {
  1920. //DebugPrint("JDG. Demo, Drill Instructor, Received custom from zone, about to do Ten_Hut\n" );
  1921. Ten_Hut (obj);
  1922. }
  1923. //when cadet 1 is at attention start with pushups
  1924. if ((Type == MPR_A02_CUSTOM_CADET_1_JDG) && (Param == MPR_A02_PARAM_CADETS_AT_ATTENTION_JDG))
  1925. {
  1926. //DebugPrint("JDG. Demo, Drill Instructor, About to start first pushups\n");
  1927. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J04C", 0);
  1928. //S_A_HUMAN.H_A_J04C is animation for give order
  1929. Commands->Create_Sound ("KeepYourHeadDown02", (Commands->Get_Position (obj)), obj);
  1930. //insert "Lets start with pushups" for this dialog line
  1931. exercise = PUSHUPS;
  1932. Cadet_Mistake ();
  1933. }
  1934. if ((Type == MPR_A02_CUSTOM_CADET_1_JDG) && (Param == MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG))
  1935. {
  1936. //DebugPrint("JDG. Demo, Drill Instructor, About to Rag on Cadet #1\n");
  1937. Rag_On_Cadet (1);
  1938. }
  1939. if ((Type == MPR_A02_CUSTOM_CADET_2_JDG) && (Param == MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG))
  1940. {
  1941. //DebugPrint("JDG. Demo, Drill Instructor, About to Rag on Cadet #2\n");
  1942. Rag_On_Cadet (2);
  1943. }
  1944. if ((Type == MPR_A02_CUSTOM_CADET_3_JDG) && (Param == MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG))
  1945. {
  1946. //DebugPrint("JDG. Demo, Drill Instructor, About to Rag on Cadet #3\n");
  1947. Rag_On_Cadet (3);
  1948. }
  1949. }
  1950. void Ten_Hut (GameObject* obj)
  1951. {
  1952. //DebugPrint("JDG. Demo, Drill Instructor, Starting Ten_Hut\n");
  1953. //check if cadet_2 exists
  1954. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  1955. {
  1956. //DebugPrint("JDG. Demo, Drill Instructor, Ten_Hut, DI gives order\n");
  1957. //instructor faces cadet 2...
  1958. Commands->Action_Attack_Object (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), 1, 0);
  1959. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J18C",0);
  1960. //S_A_HUMAN.H_A_J18C is animation for ten-hut
  1961. Commands->Create_Sound ("LookAlive02", (Commands->Get_Position (obj)), obj);
  1962. //insert "Ten Hut" sound here when ready
  1963. //Start reaction delay timers on the Cadets
  1964. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  1965. {
  1966. //DebugPrint("JDG. Demo, Drill Instructor, Ten_Hut, Start C1 delay timer\n");
  1967. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  1968. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_TEN_HUT_DELAY_JDG);
  1969. }
  1970. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  1971. {
  1972. //DebugPrint("JDG. Demo, Drill Instructor, Ten_Hut, Start C2 delay timer\n");
  1973. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  1974. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_TEN_HUT_DELAY_JDG);
  1975. }
  1976. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  1977. {
  1978. //DebugPrint("JDG. Demo, Drill Instructor, Ten_Hut, Start C3 delay timer\n");
  1979. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  1980. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_TEN_HUT_DELAY_JDG);
  1981. }
  1982. }
  1983. }
  1984. void Cadet_Mistake (void)
  1985. {
  1986. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, Start\n");
  1987. //declare and define local variables here
  1988. float mistake;
  1989. mistake = Commands->Get_Random(0,100);
  1990. //there is a 25% chance of mistake
  1991. if (mistake > 220)
  1992. {
  1993. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, About to goto Choose_Cadet\n");
  1994. Choose_Cadet ();
  1995. }
  1996. //if no mistake tell all cadets to do specific exercise
  1997. else
  1998. {
  1999. if (exercise == PUSHUPS)
  2000. {
  2001. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2002. {
  2003. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #1 do pushups\n");
  2004. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2005. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_PUSHUPS_DELAY_JDG);
  2006. }
  2007. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2008. {
  2009. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #2 do pushups\n");
  2010. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2011. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_PUSHUPS_DELAY_JDG);
  2012. }
  2013. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2014. {
  2015. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #3 do pushups\n");
  2016. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2017. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_PUSHUPS_DELAY_JDG);
  2018. }
  2019. DI_Goes_To_New_Position ();
  2020. }
  2021. else if (exercise == SITUPS)
  2022. {
  2023. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2024. {
  2025. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #1 do situps\n");
  2026. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2027. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_SITUPS_DELAY_JDG);
  2028. }
  2029. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2030. {
  2031. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #2 do situps\n");
  2032. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2033. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_SITUPS_DELAY_JDG);
  2034. }
  2035. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2036. {
  2037. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #3 do situps\n");
  2038. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2039. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_SITUPS_DELAY_JDG);
  2040. }
  2041. DI_Goes_To_New_Position ();
  2042. }
  2043. else
  2044. {
  2045. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2046. {
  2047. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #1 do j-jacks\n");
  2048. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2049. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_JUMPING_JACKS_DELAY_JDG);
  2050. }
  2051. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2052. {
  2053. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #2 do j-jacks\n");
  2054. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2055. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_JUMPING_JACKS_DELAY_JDG);
  2056. }
  2057. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2058. {
  2059. //DebugPrint("JDG. Demo, Drill Instructor, Cadet_Mistake, No mistake, #3 do j-jacks\n");
  2060. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2061. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_JUMPING_JACKS_DELAY_JDG);
  2062. }
  2063. DI_Goes_To_New_Position ();
  2064. }
  2065. }
  2066. }
  2067. void Choose_Cadet (void)
  2068. {
  2069. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, Start\n");
  2070. float cadet;
  2071. cadet = Commands->Get_Random(0,100);
  2072. //define cadet as a number between 0 and 100
  2073. //choose cadet 1 for mistake
  2074. if ((cadet > 0) && (cadet <= 33))
  2075. {
  2076. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2077. {
  2078. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake\n");
  2079. Commands->Create_Sound ("GonnaDieHere02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))), (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)));
  2080. //insert "Doh!" sound when ready
  2081. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J09C", 0);
  2082. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2083. }
  2084. //tell cadet 2-3 to do proper animation
  2085. if (exercise == PUSHUPS)
  2086. {
  2087. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2088. {
  2089. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #2 pushups\n");
  2090. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2091. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_PUSHUPS_DELAY_JDG);
  2092. }
  2093. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2094. {
  2095. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #3 pushups\n");
  2096. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2097. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_PUSHUPS_DELAY_JDG);
  2098. }
  2099. }
  2100. else if (exercise == SITUPS)
  2101. {
  2102. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2103. {
  2104. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #2 situps\n");
  2105. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2106. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_SITUPS_DELAY_JDG);
  2107. }
  2108. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2109. {
  2110. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #3 situps\n");
  2111. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2112. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_SITUPS_DELAY_JDG);
  2113. }
  2114. }
  2115. // jumping jacks
  2116. else
  2117. {
  2118. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2119. {
  2120. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #2 j-jacks\n");
  2121. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2122. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_JUMPING_JACKS_DELAY_JDG);
  2123. }
  2124. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2125. {
  2126. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C1 makes mistake, #3 j-jacks\n");
  2127. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2128. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_JUMPING_JACKS_DELAY_JDG);
  2129. }
  2130. }
  2131. }
  2132. //choose cadet 2 for mistake
  2133. else if ((cadet > 33) && (cadet <= 66))
  2134. {
  2135. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2136. {
  2137. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake\n");
  2138. Commands->Create_Sound ("GonnaDieHere02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))), (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)));
  2139. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J09C", 0);
  2140. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2141. }
  2142. //tell cadet 1 and 3 to do proper animation
  2143. if (exercise == PUSHUPS)
  2144. {
  2145. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2146. {
  2147. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #1 pushups\n");
  2148. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2149. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_PUSHUPS_DELAY_JDG);
  2150. }
  2151. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2152. {
  2153. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #3 pushups\n");
  2154. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2155. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_PUSHUPS_DELAY_JDG);
  2156. }
  2157. }
  2158. else if (exercise == SITUPS)
  2159. {
  2160. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2161. {
  2162. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #1 situps\n");
  2163. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2164. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_SITUPS_DELAY_JDG);
  2165. }
  2166. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2167. {
  2168. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #3 situps\n");
  2169. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2170. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_SITUPS_DELAY_JDG);
  2171. }
  2172. }
  2173. // jumping jacks
  2174. else
  2175. {
  2176. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2177. {
  2178. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #1 j-jacks\n");
  2179. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2180. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_JUMPING_JACKS_DELAY_JDG);
  2181. }
  2182. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2183. {
  2184. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C2 makes mistake, #3 j-jacks\n");
  2185. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2186. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_JUMPING_JACKS_DELAY_JDG);
  2187. }
  2188. }
  2189. }
  2190. //choose cadet 3 for mistake
  2191. else
  2192. {
  2193. if (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))
  2194. {
  2195. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake\n");
  2196. Commands->Create_Sound ("GonnaDieHere02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_cadet_3_id_JDG))), (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)));
  2197. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J09C", 0);
  2198. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2199. }
  2200. //tell cadet 1,2 to do proper animation
  2201. if (exercise == PUSHUPS)
  2202. {
  2203. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2204. {
  2205. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #2 pushups\n");
  2206. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2207. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_PUSHUPS_DELAY_JDG);
  2208. }
  2209. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2210. {
  2211. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #1 pushups\n");
  2212. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2213. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_PUSHUPS_DELAY_JDG);
  2214. }
  2215. }
  2216. else if (exercise == SITUPS)
  2217. {
  2218. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2219. {
  2220. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #2 situps\n");
  2221. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2222. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_SITUPS_DELAY_JDG);
  2223. }
  2224. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2225. {
  2226. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #1 situps\n");
  2227. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2228. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_SITUPS_DELAY_JDG);
  2229. }
  2230. }
  2231. // jumping jacks
  2232. else
  2233. {
  2234. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2235. {
  2236. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #2 j-jacks\n");
  2237. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2238. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_JUMPING_JACKS_DELAY_JDG);
  2239. }
  2240. if (Commands->Find_Object(MPR_A02_cadet_1_id_JDG))
  2241. {
  2242. //DebugPrint("JDG. Demo, Drill Instructor, Choose_Cadet, C3 makes mistake, #1 j-jacks\n");
  2243. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2244. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_JUMPING_JACKS_DELAY_JDG);
  2245. }
  2246. }
  2247. }
  2248. }
  2249. void Rag_On_Cadet (int Cadet_Number)
  2250. {
  2251. //DebugPrint("JDG. Demo, Drill Instructor, Rag_On_Cadet, start\n");
  2252. if ((Cadet_Number == 1) && (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)))
  2253. {
  2254. //DebugPrint("JDG. Demo, Drill Instructor, Rag_On_Cadet, DI rags on C1\n");
  2255. //make drill instructor face cadet 1
  2256. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)),(Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), 1, 0);
  2257. Vector3 C1_position (MPR_A02_CADET_1_X_JDG, MPR_A02_CADET_1_Y_JDG, MPR_A02_CADET_1_Z_JDG);
  2258. //Drill instructor goes to cadet 1's position
  2259. Commands->Action_Movement_Goto_Location ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), C1_position, 0.5f);
  2260. }
  2261. if ((Cadet_Number == 2) && (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)))
  2262. {
  2263. //DebugPrint("JDG. Demo, Drill Instructor, Rag_On_Cadet, DI rags on C2\n");
  2264. //make drill instructor face cadet 2
  2265. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)),(Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), 1, 0);
  2266. Vector3 C2_position (MPR_A02_CADET_2_X_JDG, MPR_A02_CADET_2_Y_JDG, MPR_A02_CADET_2_Z_JDG);
  2267. //Drill instructor goes to cadet 2's position
  2268. Commands->Action_Movement_Goto_Location ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), C2_position, 0.5f);
  2269. }
  2270. if ((Cadet_Number == 3) && (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)))
  2271. {
  2272. //DebugPrint("JDG. Demo, Drill Instructor, Rag_On_Cadet, DI rags on C3\n");
  2273. //make drill instructor face cadet 3
  2274. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)),(Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), 1, 0);
  2275. Vector3 C3_position (MPR_A02_CADET_3_X_JDG, MPR_A02_CADET_3_Y_JDG, MPR_A02_CADET_3_Z_JDG);
  2276. //Drill instructor goes to cadet 3's position
  2277. Commands->Action_Movement_Goto_Location ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), C3_position, 0.5f);
  2278. }
  2279. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), "S_A_HUMAN.H_A_J07C", 0);
  2280. //S_A_HUMAN.H_A_J07C is animation for rag on cadet
  2281. Yell_At_Cadet ();
  2282. //sets up random things to yell at cadet guy
  2283. }
  2284. void Yell_At_Cadet (void)
  2285. {
  2286. //DebugPrint("JDG. Demo, Drill Instructor, Yell_At_Cadet, start\n");
  2287. float n = Commands->Get_Random(0, 100);
  2288. if ((n > 0) && (n <= 25) && (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)))
  2289. {
  2290. Commands->Create_Sound ("KillHim02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2291. }
  2292. else if ((n > 25) && (n <= 50) && (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)))
  2293. {
  2294. Commands->Create_Sound ("KeepYourHeadDown02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2295. }
  2296. else if ((n < 50) && (n <= 75) && (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)))
  2297. {
  2298. Commands->Create_Sound ("SoundAlarm02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2299. }
  2300. else
  2301. {
  2302. Commands->Create_Sound ("FireAtWill02", (Commands->Get_Position (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2303. }
  2304. }
  2305. void Animation_Complete (GameObject* obj, const char* name)
  2306. {
  2307. //S_A_HUMAN.H_A_J07C is animation for rag on cadet
  2308. if ((stricmp("S_A_HUMAN.H_A_J07C", name) == 0) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))
  2309. {
  2310. //DebugPrint("JDG. Demo, Drill Instructor, Animation_Complete\n");
  2311. DI_Goes_To_New_Position ();
  2312. }
  2313. if ((stricmp("S_A_HUMAN.H_A_DIV1", name) == 0) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)) && (state == DI_INNATE))
  2314. {
  2315. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 1.0f, 50.0f);
  2316. //Commands->Set_Animation (obj, "S_A_HUMAN.H_A_C2C0", 1);
  2317. }
  2318. }
  2319. void DI_Goes_To_New_Position (void)
  2320. {
  2321. if (state != DI_INNATE)
  2322. {
  2323. //DebugPrint("JDG. Demo, Drill Instructor, DI_Goes_To_New_Position, start\n");
  2324. float xnot, ynot, znot;
  2325. float random_number = Commands->Get_Random (0,100);
  2326. if ((random_number > 0) && (random_number <= 25))
  2327. {
  2328. xnot = -56.94f;
  2329. ynot = -11.48f;
  2330. znot = 2.42f;
  2331. }
  2332. else if ((random_number > 25) && (random_number <= 50))
  2333. {
  2334. xnot = -56.13f;
  2335. ynot = -10.00f;
  2336. znot = 2.42f;
  2337. }
  2338. else if ((random_number > 50) && (random_number <= 75))
  2339. {
  2340. xnot = -54.70f;
  2341. ynot = -8.86f;
  2342. znot = 2.42f;
  2343. }
  2344. else
  2345. {
  2346. xnot = -53.21f;
  2347. ynot = -8.00f;
  2348. znot = 2.42f;
  2349. }
  2350. Vector3 New_Position(xnot, ynot, znot);
  2351. if (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG))
  2352. {
  2353. Commands->Action_Movement_Set_Forward_Speed ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), .15f);
  2354. Commands->Action_Movement_Goto_Location ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), New_Position, 0.2f);
  2355. float delayTimer = Commands->Get_Random(10,15);
  2356. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), delayTimer, MPR_A02_TIMER_DI_PRE_GIVE_ORDER_JDG);
  2357. //make DI wait for 10-15 secs
  2358. state = DI_MOVING;
  2359. }
  2360. }
  2361. }
  2362. void Movement_Complete (GameObject* obj, MovementCompleteReason)
  2363. {
  2364. if ((state == DI_MOVING) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))
  2365. {
  2366. //when DI reaches new spot, face cadets and start new timer
  2367. if (Commands->Find_Object(MPR_A02_cadet_2_id_JDG))
  2368. {
  2369. // DebugPrint("JDG. Demo, Drill Instructor, Movement_Complete, start\n");
  2370. //first, make instructor face cadets...
  2371. Commands->Action_Attack_Object (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), 1, 0);
  2372. state = MPR_A02_drill_instructor_idle;
  2373. }
  2374. }
  2375. }
  2376. void Timer_Expired (GameObject* obj, int Timer_ID)
  2377. {
  2378. if ((Timer_ID == MPR_A02_TIMER_DI_PRE_GIVE_ORDER_JDG) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)) && (state != DI_INNATE))
  2379. {
  2380. //DebugPrint("JDG. Demo, Drill Instructor, Timer_Expired, start\n");
  2381. Next_Exercise ();
  2382. }
  2383. if ((Timer_ID == MPR_A02_TIMER_DRILL_INSTRUCTOR_ATTACK_DELAY_JDG) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)) && (state == DI_INNATE))
  2384. {
  2385. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 0, 0);
  2386. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_DIV1", 0);
  2387. //forward roll
  2388. }
  2389. }
  2390. void Next_Exercise (void)
  2391. {
  2392. //DebugPrint("JDG. Demo, Drill Instructor, Next_Exercise, start\n");
  2393. exercise = (Exercise)(exercise + 1);
  2394. if (exercise >= JUMPING_JACKS)
  2395. {
  2396. exercise = PUSHUPS;
  2397. }
  2398. if ((exercise == PUSHUPS) && (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))
  2399. {
  2400. //Omega = 1 is pushups
  2401. //have DI do a command animation
  2402. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), "S_A_HUMAN.H_A_J04C", 0);
  2403. //S_A_HUMAN.H_A_J04C is animation for give order
  2404. //have DI tell cadets to start with pushups
  2405. Commands->Create_Sound ("LookAlive02", (Commands->Get_Position ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2406. Cadet_Mistake ();
  2407. }
  2408. else if (exercise == SITUPS)
  2409. {
  2410. //Omega = 2 is situps
  2411. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), "S_A_HUMAN.H_A_J04C", 0);
  2412. //S_A_HUMAN.H_A_J04C is animation for give order
  2413. //have DI tell cadets to start with pushups
  2414. Commands->Create_Sound ("HoldYourPositions02", (Commands->Get_Position ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2415. Cadet_Mistake ();
  2416. }
  2417. else
  2418. {
  2419. //Omega = 3 is situps
  2420. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), "S_A_HUMAN.H_A_J04C", 0);
  2421. //S_A_HUMAN.H_A_J04C is animation for give order
  2422. //have DI tell cadets to start with pushups
  2423. Commands->Create_Sound ("KeepYourHeadDown02", (Commands->Get_Position ((Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)))), (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)));
  2424. Cadet_Mistake ();
  2425. }
  2426. }
  2427. };
  2428. /*
  2429. MPR_A02_DRILL_Zone
  2430. The following is the script for the kill zone
  2431. DEBUG NAMING CONVENTION
  2432. */
  2433. DECLARE_SCRIPT(MPR_A02_Drill_Start_Zone_JDG, "")
  2434. {
  2435. //declare variables here
  2436. int count;
  2437. void Created(GameObject* obj)
  2438. {
  2439. MPR_A02_drill_zone_id_JDG = Commands->Get_ID (obj);
  2440. count = 0;
  2441. }
  2442. void Entered (GameObject* obj, GameObject* Enterer)
  2443. {
  2444. if (Enterer == (Commands->Get_The_Star()) && (count == 0))
  2445. {
  2446. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG, MPR_A02_PARAM_CADETS_TEN_HUT_JDG);
  2447. //DebugPrint("JDG. Demo, Zone sending custom to Drill instructor\n");
  2448. count++;
  2449. }
  2450. }
  2451. };
  2452. /*
  2453. MPR_A02_DRILL_CADET_1
  2454. The following is the script for cadet number 1
  2455. DEBUG NAMING CONVENTION
  2456. */
  2457. DECLARE_SCRIPT(MPR_A02_Drill_Cadet_1_JDG, "")
  2458. {
  2459. typedef enum
  2460. {
  2461. MPR_A02_cadet_1_id_JDGLE = 0,
  2462. CADET_1_INNATE,
  2463. } C1State;
  2464. C1State state;
  2465. //declare variables here
  2466. void Created(GameObject* obj)
  2467. {
  2468. //DebugPrint("JDG. Demo, Cadet 1, Created and turning off innate\n");
  2469. MPR_A02_cadet_1_id_JDG = Commands->Get_ID (obj);
  2470. Vector3 C1_Start_Spot(MPR_A02_CADET_1_X_JDG, MPR_A02_CADET_1_Y_JDG, MPR_A02_CADET_1_Z_JDG);
  2471. Commands->Action_Movement_Goto_Location (obj, C1_Start_Spot, .02f);
  2472. Vector3 Cadet_Face_Spot(-56.02f, -9.09f, 2.42f);
  2473. Commands->Action_Attack_Location(obj, Cadet_Face_Spot, 0, 0);
  2474. }
  2475. void Killed (GameObject* obj, GameObject* Killer)
  2476. {
  2477. if (Killer == (Commands->Get_The_Star()))
  2478. {
  2479. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2480. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2481. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2482. }
  2483. }
  2484. void Custom (GameObject* obj, int Type, int Param, GameObject* Sender)
  2485. {
  2486. if ((Param == MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG) && (Type == MPR_A02_CUSTOM_CADET_1_JDG))
  2487. {
  2488. //DebugPrint("JDG. Demo, Cadet 1, Recieved Innate Custom\n");
  2489. state = CADET_1_INNATE;
  2490. float timeDelay = Commands->Get_Random (1.5f,2.5f);
  2491. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_ATTACK_DELAY_JDG);
  2492. }
  2493. }
  2494. void Timer_Expired (GameObject* obj, int Timer_ID)
  2495. {
  2496. if ((Timer_ID == MPR_A02_TIMER_CADET_1_ATTACK_DELAY_JDG) && (state == CADET_1_INNATE))
  2497. {
  2498. //DebugPrint("JDG. Demo, Cadet 1, Attack Havoc Timer_Expired, start\n");
  2499. Commands->Action_Movement_Set_Forward_Speed(obj, 0.55f);
  2500. Vector3 C1_Attack_Spot(-51.25f, -6.41f, 2.42f);
  2501. Commands->Action_Movement_Goto_Location (obj, C1_Attack_Spot, .02f);
  2502. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_D2A3", 0);
  2503. //"S_A_HUMAN.H_A_D2A3" is animation for running to left
  2504. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 150.0f, 50);
  2505. }
  2506. if ((Timer_ID == MPR_A02_TIMER_CADET_1_TEN_HUT_DELAY_JDG) && (state != CADET_1_INNATE))
  2507. {
  2508. //DebugPrint("JDG. Demo, Cadet 1, Timer_Expired, start\n");
  2509. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_A0A0", 0);
  2510. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2511. }
  2512. if ((Timer_ID == MPR_A02_TIMER_CADET_1_PUSHUPS_DELAY_JDG) && (state != CADET_1_INNATE))
  2513. {
  2514. //DebugPrint("JDG. Demo, Cadet 1, Pushups_Timer_Expired, start\n");
  2515. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2516. //S_A_HUMAN.H_A_J13B is animation for pushups
  2517. }
  2518. if ((Timer_ID == MPR_A02_TIMER_CADET_1_SITUPS_DELAY_JDG) && (state != CADET_1_INNATE))
  2519. {
  2520. //DebugPrint("JDG. Demo, Cadet 1, Situps_Timer_Expired, start\n");
  2521. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J13C", 0);
  2522. //S_A_HUMAN.H_A_J14C is animation for situps
  2523. }
  2524. if ((Timer_ID == MPR_A02_TIMER_CADET_1_JUMPING_JACKS_DELAY_JDG) && (state != CADET_1_INNATE))
  2525. {
  2526. //DebugPrint("JDG. Demo, Cadet 1, JJacks_Timer_Expired, start\n");
  2527. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2528. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2529. }
  2530. if ((Timer_ID == MPR_A02_TIMER_CADET_1_MISTAKE_DELAY_JDG) && (state != CADET_1_INNATE))
  2531. {
  2532. //DebugPrint("JDG. Demo, Cadet 1, Mistake_Timer_Expired, start\n");
  2533. if (exercise == PUSHUPS)
  2534. {
  2535. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2536. //S_A_HUMAN.H_A_J13B is animation for pushups
  2537. }
  2538. else if (exercise == SITUPS)
  2539. {
  2540. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2541. //S_A_HUMAN.H_A_J14C is animation for situps
  2542. }
  2543. else
  2544. {
  2545. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2546. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2547. }
  2548. }
  2549. }
  2550. void Animation_Complete (GameObject* obj, const char* name)
  2551. {
  2552. if ((stricmp(name, "S_A_HUMAN.H_A_J43C") == 0) && (state != CADET_1_INNATE))
  2553. {
  2554. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2555. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J13A", 0);
  2556. }
  2557. if ((stricmp(name, "S_A_HUMAN.H_A_J43A") == 0) && (state != CADET_1_INNATE))
  2558. {
  2559. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2560. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J43B", 1);
  2561. }
  2562. if ((stricmp(name, "S_A_HUMAN.H_A_J13C") == 0) && (state != CADET_1_INNATE))
  2563. {
  2564. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2565. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2566. }
  2567. if ((stricmp(name, "S_A_HUMAN.H_A_J13A") == 0) && (state != CADET_1_INNATE))
  2568. {
  2569. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2570. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), "S_A_HUMAN.H_A_J13B", 1);
  2571. }
  2572. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2573. if ((stricmp (name,"S_A_HUMAN.H_A_A0A0") ==0 ) && (state != CADET_1_INNATE))
  2574. {
  2575. //DebugPrint("JDG. Demo, Cadet 1, Animation_Complete, Come to Attention\n");
  2576. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_AT_ATTENTION_JDG);
  2577. }
  2578. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2579. if ((stricmp (name, "S_A_HUMAN.H_A_J09C") == 0 ) && (state != CADET_1_INNATE))
  2580. {
  2581. //DebugPrint("JDG. Demo, Cadet 1, Animation_Complete, Make Mistake\n");
  2582. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG);
  2583. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2584. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_1_MISTAKE_DELAY_JDG);
  2585. }
  2586. }
  2587. };
  2588. /*
  2589. MPR_A02_DRILL_CADET_2
  2590. The following is the script for cadet number 2
  2591. DEBUG NAMING CONVENTION
  2592. */
  2593. DECLARE_SCRIPT(MPR_A02_Drill_Cadet_2_JDG, "")
  2594. {
  2595. typedef enum
  2596. {
  2597. MPR_A02_cadet_2_id_JDGLE = 0,
  2598. CADET_2_INNATE,
  2599. } C2State;
  2600. C2State state;
  2601. //declare variables here
  2602. void Created(GameObject* obj)
  2603. {
  2604. //DebugPrint("JDG. Demo, Cadet 2, Created and turning off innate\n");
  2605. MPR_A02_cadet_2_id_JDG = Commands->Get_ID (obj);
  2606. Vector3 C2_Start_Spot(MPR_A02_CADET_2_X_JDG, MPR_A02_CADET_2_Y_JDG, MPR_A02_CADET_2_Z_JDG);
  2607. Commands->Action_Movement_Goto_Location (obj, C2_Start_Spot, .02f);
  2608. Vector3 Cadet_Face_Spot(-56.02f, -9.09f, 2.42f);
  2609. Commands->Action_Attack_Location(obj, Cadet_Face_Spot, 0, 0);
  2610. }
  2611. void Killed (GameObject* obj, GameObject* Killer)
  2612. {
  2613. if (Killer == (Commands->Get_The_Star()))
  2614. {
  2615. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2616. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2617. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2618. }
  2619. }
  2620. void Custom (GameObject* obj, int Type, int Param, GameObject* Sender)
  2621. {
  2622. if ((Param == MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG) && (Type == MPR_A02_CUSTOM_CADET_2_JDG))
  2623. {
  2624. //DebugPrint("JDG. Demo, Cadet 2, Recieved Innate Custom\n");
  2625. state = CADET_2_INNATE;
  2626. float timeDelay = Commands->Get_Random (1.5f,2.5f);
  2627. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_ATTACK_DELAY_JDG);
  2628. }
  2629. }
  2630. void Timer_Expired (GameObject* obj, int Timer_ID)
  2631. {
  2632. if ((Timer_ID == MPR_A02_TIMER_CADET_2_ATTACK_DELAY_JDG) && (state == CADET_2_INNATE))
  2633. {
  2634. //DebugPrint("JDG. Demo, Cadet 2, Attack Havoc Timer_Expired, start\n");
  2635. Commands->Action_Movement_Set_Forward_Speed(obj, 0.25f);
  2636. Vector3 C2_Attack_Spot(-50.03f, -13.23f, 2.42f);
  2637. Commands->Action_Movement_Goto_Location (obj, C2_Attack_Spot, .02f);
  2638. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_D2B2", 0);
  2639. //"S_A_HUMAN.H_A_D2B2" is animation for walking backwards
  2640. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 150.0f, 50);
  2641. }
  2642. if ((Timer_ID == MPR_A02_TIMER_CADET_2_TEN_HUT_DELAY_JDG) && (state != CADET_2_INNATE))
  2643. {
  2644. //DebugPrint("JDG. Demo, Cadet 2, Timer_Expired, start\n");
  2645. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_A0A0", 0);
  2646. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2647. }
  2648. if ((Timer_ID == MPR_A02_TIMER_CADET_2_PUSHUPS_DELAY_JDG) && (state != CADET_2_INNATE))
  2649. {
  2650. //DebugPrint("JDG. Demo, Cadet 2, Pushups_Timer_Expired, start\n");
  2651. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2652. //S_A_HUMAN.H_A_J13B is animation for pushups
  2653. }
  2654. if ((Timer_ID == MPR_A02_TIMER_CADET_2_SITUPS_DELAY_JDG) && (state != CADET_2_INNATE))
  2655. {
  2656. //DebugPrint("JDG. Demo, Cadet 2, Situps_Timer_Expired, start\n");
  2657. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J13C", 0);
  2658. //S_A_HUMAN.H_A_J14C is animation for situps
  2659. }
  2660. if ((Timer_ID == MPR_A02_TIMER_CADET_2_JUMPING_JACKS_DELAY_JDG) && (state != CADET_2_INNATE))
  2661. {
  2662. //DebugPrint("JDG. Demo, Cadet 2, JJacks_Timer_Expired, start\n");
  2663. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2664. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2665. }
  2666. if ((Timer_ID == MPR_A02_TIMER_CADET_2_MISTAKE_DELAY_JDG) && (state != CADET_2_INNATE))
  2667. {
  2668. //DebugPrint("JDG. Demo, Cadet 2, Mistake_Timer_Expired, start\n");
  2669. if (exercise == PUSHUPS)
  2670. {
  2671. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2672. //S_A_HUMAN.H_A_J13B is animation for pushups
  2673. }
  2674. else if (exercise == SITUPS)
  2675. {
  2676. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2677. //S_A_HUMAN.H_A_J14C is animation for situps
  2678. }
  2679. else
  2680. {
  2681. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2682. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2683. }
  2684. }
  2685. }
  2686. void Animation_Complete (GameObject* obj, const char* name)
  2687. {
  2688. if ((stricmp(name, "S_A_HUMAN.H_A_J43C") == 0) && (state != CADET_2_INNATE))
  2689. {
  2690. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2691. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J13A", 0);
  2692. }
  2693. if ((stricmp(name, "S_A_HUMAN.H_A_J43A") == 0) && (state != CADET_2_INNATE))
  2694. {
  2695. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2696. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J43B", 1);
  2697. }
  2698. if ((stricmp(name, "S_A_HUMAN.H_A_J13C") == 0) && (state != CADET_2_INNATE))
  2699. {
  2700. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2701. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2702. }
  2703. if ((stricmp(name, "S_A_HUMAN.H_A_J13A") == 0) && (state != CADET_2_INNATE))
  2704. {
  2705. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2706. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), "S_A_HUMAN.H_A_J13B", 1);
  2707. }
  2708. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2709. if ((stricmp(name, "S_A_HUMAN.H_A_A0A0") == 0) && (state != CADET_2_INNATE))
  2710. {
  2711. //DebugPrint("JDG. Demo, Cadet 2, Animation_Complete, Come to Attention\n");
  2712. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_AT_ATTENTION_JDG);
  2713. }
  2714. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2715. if ((stricmp(name, "S_A_HUMAN.H_A_J09C") == 0) && (state != CADET_2_INNATE))
  2716. {
  2717. //DebugPrint("JDG. Demo, Cadet 2, Animation_Complete, Make Mistake\n");
  2718. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG);
  2719. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2720. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_2_MISTAKE_DELAY_JDG);
  2721. }
  2722. }
  2723. };
  2724. /*
  2725. MPR_A02_DRILL_CADET_3
  2726. The following is the script for cadet number 3
  2727. DEBUG NAMING CONVENTION
  2728. */
  2729. DECLARE_SCRIPT(MPR_A02_Drill_Cadet_3_JDG, "")
  2730. {
  2731. typedef enum
  2732. {
  2733. MPR_A02_cadet_3_id_JDGLE = 0,
  2734. CADET_3_INNATE,
  2735. } C3State;
  2736. C3State state;
  2737. //declare variables here
  2738. void Created(GameObject* obj)
  2739. {
  2740. //DebugPrint("JDG. Demo, Cadet 3, Created and turning off innate\n");
  2741. MPR_A02_cadet_3_id_JDG = Commands->Get_ID (obj);
  2742. Vector3 C3_Start_Spot(MPR_A02_CADET_3_X_JDG, MPR_A02_CADET_3_Y_JDG, MPR_A02_CADET_3_Z_JDG);
  2743. Commands->Action_Movement_Goto_Location (obj, C3_Start_Spot, .02f);
  2744. Vector3 Cadet_Face_Spot(-56.02f, -9.09f, 2.42f);
  2745. Commands->Action_Attack_Location(obj, Cadet_Face_Spot, 0, 0);
  2746. }
  2747. void Killed (GameObject* obj, GameObject* Killer)
  2748. {
  2749. if (Killer == (Commands->Get_The_Star()))
  2750. {
  2751. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2752. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2753. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2754. }
  2755. }
  2756. void Custom (GameObject* obj, int Type, int Param, GameObject* Sender)
  2757. {
  2758. if ((Param == MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG) && (Type == MPR_A02_CUSTOM_CADET_3_JDG))
  2759. {
  2760. //DebugPrint("JDG. Demo, Cadet 3, Recieved Innate Custom\n");
  2761. state = CADET_3_INNATE;
  2762. float timeDelay = Commands->Get_Random (1.5f,2.5f);
  2763. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_ATTACK_DELAY_JDG);
  2764. }
  2765. }
  2766. void Timer_Expired (GameObject* obj, int Timer_ID)
  2767. {
  2768. if ((Timer_ID == MPR_A02_TIMER_CADET_3_ATTACK_DELAY_JDG) && (state == CADET_3_INNATE))
  2769. {
  2770. //DebugPrint("JDG. Demo, Cadet 3, Attack Havoc Timer_Expired, start\n");
  2771. Commands->Action_Movement_Set_Forward_Speed(obj, 0.55f);
  2772. Vector3 C3_Attack_Spot(-55.32f, -16.55f, 2.42f);
  2773. Commands->Action_Movement_Goto_Location (obj, C3_Attack_Spot, .02f);
  2774. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_D2A4", 0);
  2775. //"S_A_HUMAN.H_A_D2A4" is animation for running to right
  2776. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 150.0f, 50);
  2777. }
  2778. if ((Timer_ID == MPR_A02_TIMER_CADET_3_TEN_HUT_DELAY_JDG) && (state != CADET_3_INNATE))
  2779. {
  2780. //DebugPrint("JDG. Demo, Cadet 3, Timer_Expired, start\n");
  2781. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_A0A0", 0);
  2782. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2783. }
  2784. if ((Timer_ID == MPR_A02_TIMER_CADET_3_PUSHUPS_DELAY_JDG) && (state != CADET_3_INNATE))
  2785. {
  2786. //DebugPrint("JDG. Demo, Cadet 1, Pushups_Timer_Expired, start\n");
  2787. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2788. //S_A_HUMAN.H_A_J13A is animation for transition into pushups
  2789. }
  2790. if ((Timer_ID == MPR_A02_TIMER_CADET_3_SITUPS_DELAY_JDG) && (state != CADET_3_INNATE))
  2791. {
  2792. //DebugPrint("JDG. Demo, Cadet 3, Situps_Timer_Expired, start\n");
  2793. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J13C", 0);
  2794. //S_A_HUMAN.H_A_J14C is animation for situps
  2795. }
  2796. if ((Timer_ID == MPR_A02_TIMER_CADET_3_JUMPING_JACKS_DELAY_JDG) && (state != CADET_3_INNATE))
  2797. {
  2798. //DebugPrint("JDG. Demo, Cadet 3, JJacks_Timer_Expired, start\n");
  2799. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2800. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2801. }
  2802. if ((Timer_ID == MPR_A02_TIMER_CADET_3_MISTAKE_DELAY_JDG) && (state != CADET_3_INNATE))
  2803. {
  2804. //DebugPrint("JDG. Demo, Cadet 3, Mistake_Timer_Expired, start\n");
  2805. if (exercise == PUSHUPS)
  2806. {
  2807. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J43C", 0);
  2808. //S_A_HUMAN.H_A_J13B is animation for pushups
  2809. }
  2810. else if (exercise == SITUPS)
  2811. {
  2812. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2813. //S_A_HUMAN.H_A_J13C is animation for transition outof pushups
  2814. }
  2815. else
  2816. {
  2817. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J43A" , 0);
  2818. //S_A_HUMAN.H_A_J43B is animation for j-jacks
  2819. }
  2820. }
  2821. }
  2822. void Animation_Complete (GameObject* obj, const char* name)
  2823. {
  2824. if ((stricmp(name, "S_A_HUMAN.H_A_J43C") == 0) && (state != CADET_3_INNATE))
  2825. {
  2826. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2827. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J13A", 0);
  2828. }
  2829. if ((stricmp(name, "S_A_HUMAN.H_A_J43A") == 0) && (state != CADET_3_INNATE))
  2830. {
  2831. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2832. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J43B", 1);
  2833. }
  2834. if ((stricmp(name, "S_A_HUMAN.H_A_J13C") == 0) && (state != CADET_3_INNATE))
  2835. {
  2836. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2837. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J14C", 1);
  2838. }
  2839. if ((stricmp(name, "S_A_HUMAN.H_A_J13A") == 0) && (state != CADET_3_INNATE))
  2840. {
  2841. //DebugPrint("JDG. Demo, Cadet 3, Pushup transition Complete, Start pushups\n");
  2842. Commands->Set_Animation ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), "S_A_HUMAN.H_A_J13B", 1);
  2843. }
  2844. //S_A_HUMAN.H_A_A0A0 is animation for come to attention
  2845. if ((stricmp(name, "S_A_HUMAN.H_A_A0A0") == 0) && (state != CADET_3_INNATE))
  2846. {
  2847. //DebugPrint("JDG. Demo, Cadet 3, Animation_Complete, Come to Attention\n");
  2848. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_AT_ATTENTION_JDG);
  2849. }
  2850. //S_A_HUMAN.H_A_J09C is animation for make mistake
  2851. if ((stricmp(name, "S_A_HUMAN.H_A_J09C") == 0) && (state != CADET_3_INNATE))
  2852. {
  2853. //DebugPrint("JDG. Demo, Cadet 2, Animation_Complete, Make Mistake\n");
  2854. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_MADE_MISTAKE_JDG);
  2855. float timeDelay = Commands->Get_Random (0.5f,1.5f);
  2856. Commands->Start_Timer ((Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), timeDelay, MPR_A02_TIMER_CADET_3_MISTAKE_DELAY_JDG);
  2857. }
  2858. }
  2859. };
  2860. /*
  2861. MPR_A02_Drill_Kill_Havoc_Zone
  2862. The following script is for two zones next to the exercise routine that lets the exercise guys know when
  2863. */
  2864. DECLARE_SCRIPT(MPR_A02_Drill_Kill_Havoc_Zone_JDG, "")
  2865. {
  2866. int Havoc_in_this_Zone;
  2867. void Created(GameObject* obj)
  2868. {
  2869. //DebugPrint("JDG, PRDemo, Drill Instructor, Kill Havoc Zone, Created okay\n");
  2870. Havoc_in_this_Zone = 0;
  2871. }
  2872. void Entered (GameObject* obj, GameObject* Enterer)
  2873. {
  2874. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  2875. {
  2876. //DebugPrint("JDG, PRDemo, Drill Instructor, Havoc has penetrated Kill Havoc Zone, Sending Innate Customs\n");
  2877. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_drill_instructor_id_JDG)), MPR_A02_CUSTOM_DRILL_INSTRUCTOR_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2878. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_1_id_JDG)), MPR_A02_CUSTOM_CADET_1_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2879. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_2_id_JDG)), MPR_A02_CUSTOM_CADET_2_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2880. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_cadet_3_id_JDG)), MPR_A02_CUSTOM_CADET_3_JDG, MPR_A02_PARAM_CADETS_GOTO_INNATE_JDG);
  2881. }
  2882. }
  2883. };
  2884. /*
  2885. MPR_A04_SuicideRun_StartZone
  2886. The following are the scripts involved with the Obelisk suicide run.
  2887. It is broken up into 7 scripts, start zone, GDI minigunner 1, GDI minigunner 2,
  2888. GDI medium tank, NOD minigunner, NOD light tank, and the control console.
  2889. */
  2890. DECLARE_SCRIPT(MPR_A04_SuicideRun_StartZone_JDG, "")
  2891. {
  2892. int Havoc_in_this_Zone;
  2893. void Created(GameObject* obj)
  2894. {
  2895. //DebugPrint("JDG, PRDemo, SuicideRun, StartZone, Created okay\n");
  2896. Havoc_in_this_Zone = 0;
  2897. MPR_A04_suiciderun_enterzone_id_JDG = Commands->Get_ID (obj);
  2898. }
  2899. void Entered (GameObject* obj, GameObject* Enterer)
  2900. {
  2901. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  2902. {
  2903. //DebugPrint("JDG, PRDemo, SuicideRun, Havoc has penetrated StartZone, Start GDI Suicide Team Initial Motion\n");
  2904. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.20f);
  2905. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.20f);
  2906. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.35f);
  2907. Vector3 NewPosition(203.40f, 364.33f, 1.04f);
  2908. Commands->Action_Movement_Goto_Location((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), NewPosition, 0.01f);
  2909. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 6.0f);
  2910. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 6.0f);
  2911. float timeDelay_1 = Commands->Get_Random (8.5f,12.5f);
  2912. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_NOD_MINIGUNNER_HAVOC_IN_ZONE_DELAY_JDG);
  2913. Havoc_in_this_Zone++;
  2914. }
  2915. }
  2916. };
  2917. /*
  2918. MPR_A04_SuicideRun_GDI_Minigunner_1
  2919. The following is the script for the GDI minigunner by the obelisk. Its pretty tightly scripted and fragile.
  2920. */
  2921. DECLARE_SCRIPT(MPR_A04_SuicideRun_GDI_Minigunner_1_JDG, "")
  2922. {
  2923. typedef enum
  2924. {
  2925. MPR_A04_MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_IDLE_JDG = 0,
  2926. MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_MOVING_TO_OBELISK,
  2927. } GDIM1State;
  2928. GDIM1State M1state;
  2929. void Created(GameObject* obj)
  2930. {
  2931. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 1, Created okay\n");
  2932. MPR_A04_suiciderun_gdi_minigunner_1_id_JDG = Commands->Get_ID (obj);
  2933. M1state = MPR_A04_MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_IDLE_JDG;
  2934. }
  2935. void Timer_Expired (GameObject* obj, int Timer_ID)
  2936. {
  2937. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_CHASE_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)))
  2938. {
  2939. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 1 ChaseDelay Timer Expired\n");
  2940. if (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG))
  2941. {
  2942. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.75f);
  2943. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), 10.0f);
  2944. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), 0.0f, 50);
  2945. }
  2946. }
  2947. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_FOLLOW_TANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)))
  2948. {
  2949. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 1 Follow Tank Timer Expired\n");
  2950. if (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG))
  2951. {
  2952. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.5f);
  2953. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 6.0f);
  2954. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.0f, 0);
  2955. }
  2956. }
  2957. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_ATTACK_LIGHTTANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)))
  2958. {
  2959. Vector3 Escort_1_go_to_Spot(153.19f, 406.50f, 0.65f);
  2960. Commands->Action_Movement_Goto_Location (obj, Escort_1_go_to_Spot, 5.5f);
  2961. Commands->Action_Attack_Object(obj, (Commands->Find_Object(MPR_A04_suiciderun_nod_light_tank_id_JDG)), 0.0f, 20.f);
  2962. }
  2963. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_ATTACK_OBELISK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)))
  2964. {
  2965. if ( status == MPR_A04_SUICIDERUN_CONSOLE_ALIVE)
  2966. {
  2967. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.35f);
  2968. float Xnot = Commands->Get_Random (90.69f, 110.69f);
  2969. float Ynot = Commands->Get_Random (396.69f, 416.69f);
  2970. Vector3 Obelisk_Move_to_Location(Xnot, Ynot, 3.37f);
  2971. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  2972. Vector3 Obelisk_Attack_Location(81.60f, 403.71f, 8.77f);
  2973. Commands->Action_Attack_Location(obj, Obelisk_Attack_Location,10.0f, 50.0f);
  2974. }
  2975. else
  2976. {
  2977. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.25f);
  2978. Vector3 Obelisk_Move_to_Location(108.19f, 405.22f, 1.35f);
  2979. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  2980. M1state = MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_MOVING_TO_OBELISK;
  2981. }
  2982. }
  2983. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_OBELISK_IS_DEAD_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)) && (state == MPR_A04_SUICIDERUN_LIGHTTANK_DEAD))
  2984. {
  2985. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), 0.25f);
  2986. Vector3 Obelisk_Move_to_Location(108.19f, 405.22f, 1.35f);
  2987. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  2988. M1state = MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_MOVING_TO_OBELISK;
  2989. }
  2990. }
  2991. void Movement_Complete (GameObject* obj, MovementCompleteReason)
  2992. {
  2993. if ((M1state == MPR_A04_SUICIDERUN_GDI_MINIGUNNER_1_MOVING_TO_OBELISK) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)))
  2994. {
  2995. Commands->Set_Animation(obj, "S_A_HUMAN.H_A_J33C", 0);
  2996. }
  2997. }
  2998. void Animation_Complete (GameObject* obj, const char* name)
  2999. {
  3000. if ((stricmp(name, "S_A_HUMAN.H_A_J33C") == 0))
  3001. {
  3002. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J15C", 0);
  3003. }
  3004. if ((stricmp(name, "S_A_HUMAN.H_A_J15C") == 0))
  3005. {
  3006. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J03C", 0);
  3007. }
  3008. if ((stricmp(name, "S_A_HUMAN.H_A_J03C") == 0))
  3009. {
  3010. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J33C", 0);
  3011. }
  3012. }
  3013. };
  3014. /*
  3015. MPR_A04_SuicideRun_GDI_Minigunner_2
  3016. The following is the script for the GDI minigunner by the obelisk. Its pretty tightly scripted and fragile.
  3017. */
  3018. DECLARE_SCRIPT(MPR_A04_SuicideRun_GDI_Minigunner_2_JDG, "")
  3019. {
  3020. typedef enum
  3021. {
  3022. MPR_A04_SUICIDERUN_GDI_MINIGUNNER_2_MOVING_TO_OBELISK = 0,
  3023. } GDIM2State;
  3024. GDIM2State M2state;
  3025. void Created(GameObject* obj)
  3026. {
  3027. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 2, Created okay\n");
  3028. MPR_A04_suiciderun_gdi_minigunner_2_id_JDG = Commands->Get_ID (obj);
  3029. }
  3030. void Timer_Expired (GameObject* obj, int Timer_ID)
  3031. {
  3032. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_CHASE_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)))
  3033. {
  3034. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 2 ChaseDelay Timer Expired\n");
  3035. if (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG))
  3036. {
  3037. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.75f);
  3038. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), 10.0f);
  3039. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), 0.0f, 50);
  3040. }
  3041. }
  3042. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_FOLLOW_TANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)))
  3043. {
  3044. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Minigunner 2 Follow Tank Timer Expired\n");
  3045. if (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG))
  3046. {
  3047. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.5f);
  3048. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 6.0f);
  3049. Commands->Action_Attack_Object((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.0f, 0);
  3050. }
  3051. }
  3052. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_ATTACK_LIGHTTANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)))
  3053. {
  3054. Vector3 Escort_2_go_to_Spot(163.07f, 403.31f, 1.40f);
  3055. Commands->Action_Movement_Goto_Location (obj, Escort_2_go_to_Spot, 5.5f);
  3056. Commands->Action_Attack_Object(obj, (Commands->Find_Object(MPR_A04_suiciderun_nod_light_tank_id_JDG)), 0.0f, 20.f);
  3057. }
  3058. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_ATTACK_OBELISK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)))
  3059. {
  3060. if ( status == MPR_A04_SUICIDERUN_CONSOLE_ALIVE)
  3061. {
  3062. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.35f);
  3063. float Xnot = Commands->Get_Random (90.69f, 110.69f);
  3064. float Ynot = Commands->Get_Random (396.69f, 416.69f);
  3065. Vector3 Obelisk_Move_to_Location(Xnot, Ynot, 3.37f);
  3066. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3067. Vector3 Obelisk_Attack_Location(81.60f, 403.71f, 8.77f);
  3068. Commands->Action_Attack_Location(obj, Obelisk_Attack_Location,10.0f, 50.0f);
  3069. }
  3070. else
  3071. {
  3072. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.25f);
  3073. Vector3 Obelisk_Move_to_Location(97.86f, 411.18f, 2.97f);
  3074. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3075. M2state = MPR_A04_SUICIDERUN_GDI_MINIGUNNER_2_MOVING_TO_OBELISK;
  3076. }
  3077. }
  3078. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_OBELISK_IS_DEAD_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)) && (state == MPR_A04_SUICIDERUN_LIGHTTANK_DEAD))
  3079. {
  3080. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), 0.25f);
  3081. Vector3 Obelisk_Move_to_Location(97.86f, 411.18f, 2.97f);
  3082. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3083. M2state = MPR_A04_SUICIDERUN_GDI_MINIGUNNER_2_MOVING_TO_OBELISK;
  3084. }
  3085. }
  3086. void Movement_Complete (GameObject* obj, MovementCompleteReason)
  3087. {
  3088. if ((M2state == MPR_A04_SUICIDERUN_GDI_MINIGUNNER_2_MOVING_TO_OBELISK) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)))
  3089. {
  3090. Commands->Set_Animation(obj, "S_A_HUMAN.H_A_J09C", 0);
  3091. }
  3092. }
  3093. void Animation_Complete (GameObject* obj, const char* name)
  3094. {
  3095. if ((stricmp(name, "S_A_HUMAN.H_A_J09C") == 0))
  3096. {
  3097. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J10C", 0);
  3098. }
  3099. if ((stricmp(name, "S_A_HUMAN.H_A_J10C") == 0))
  3100. {
  3101. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J11C", 0);
  3102. }
  3103. if ((stricmp(name, "S_A_HUMAN.H_A_J11C") == 0))
  3104. {
  3105. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J09C", 0);
  3106. }
  3107. }
  3108. };
  3109. /*
  3110. MPR_A04_SuicideRun_GDI_Medium_Tank
  3111. The following is the script for the GDI medium tank by the obelisk. Its pretty tightly scripted and fragile.
  3112. */
  3113. DECLARE_SCRIPT(MPR_A04_SuicideRun_GDI_Medium_Tank_JDG, "")
  3114. {
  3115. void Created(GameObject* obj)
  3116. {
  3117. //DebugPrint("JDG, PRDemo, SuicideRun, GDI Medium Tank, Created okay\n");
  3118. MPR_A04_suiciderun_gdi_medium_tank_id_JDG = Commands->Get_ID (obj);
  3119. }
  3120. void Timer_Expired (GameObject* obj, int Timer_ID)
  3121. {
  3122. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_ATTACK_LIGHTTANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)))
  3123. {
  3124. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.45f);
  3125. Vector3 Tank_go_to_Spot(201.56f, 374.40f, 1.92f);
  3126. Commands->Action_Movement_Goto_Location (obj, Tank_go_to_Spot, 0.5f);
  3127. Commands->Action_Attack_Object(obj, (Commands->Find_Object(MPR_A04_suiciderun_nod_light_tank_id_JDG)), 0.0f, 100.f);
  3128. }
  3129. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_ATTACK_OBELISK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)))
  3130. {
  3131. if ( status == MPR_A04_SUICIDERUN_CONSOLE_ALIVE)
  3132. {
  3133. float Xnot = Commands->Get_Random (90.69f, 110.69f);
  3134. float Ynot = Commands->Get_Random (396.69f, 416.69f);
  3135. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.25f);
  3136. Vector3 Obelisk_Move_to_Location(Xnot, Ynot, 3.37f);
  3137. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3138. Vector3 Obelisk_Attack_Location(81.60f, 403.71f, 8.77f);
  3139. Commands->Action_Attack_Location(obj, Obelisk_Attack_Location,10.0f, 50.0f);
  3140. }
  3141. else
  3142. {
  3143. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.25f);
  3144. Vector3 Obelisk_Move_to_Location(95.20f, 405.23f, 4.3f);
  3145. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3146. }
  3147. }
  3148. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_OBELISK_IS_DEAD_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)) && (state == MPR_A04_SUICIDERUN_LIGHTTANK_DEAD))
  3149. {
  3150. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 0.25f);
  3151. Vector3 Obelisk_Move_to_Location(95.20f, 405.23f, 4.3f);
  3152. Commands->Action_Movement_Goto_Location (obj, Obelisk_Move_to_Location, 0.5f);
  3153. Vector3 Obelisk_Attack_Location(180.13f, 410.65f, 2.90f);
  3154. Commands->Action_Attack_Location(obj, Obelisk_Attack_Location,0, 0);
  3155. }
  3156. }
  3157. };
  3158. /*
  3159. MPR_A04_SuicideRun_NOD_Minigunner
  3160. The following is the script for the NOD minigunner tank by the obelisk. Its pretty tightly scripted and fragile.
  3161. */
  3162. DECLARE_SCRIPT(MPR_A04_SuicideRun_NOD_Minigunner_JDG, "")
  3163. {
  3164. void Created(GameObject* obj)
  3165. {
  3166. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, Created okay\n");
  3167. MPR_A04_suiciderun_nod_minigunner_id_JDG = Commands->Get_ID (obj);
  3168. }
  3169. void Timer_Expired (GameObject* obj, int Timer_ID)
  3170. {
  3171. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_NOD_MINIGUNNER_HAVOC_IN_ZONE_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)))
  3172. {
  3173. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, Recieved Custom from EnterZone, Starting GDI Minigunner Timers\n");
  3174. float timeDelay_1 = Commands->Get_Random (1.5f,2.5f);
  3175. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_CHASE_DELAY_JDG);
  3176. float timeDelay_2 = Commands->Get_Random (1.5f,2.5f);
  3177. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), timeDelay_2, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_CHASE_DELAY_JDG);
  3178. NOD_MINIGUNNER_ATTACKS_HAVOC ();
  3179. }
  3180. }
  3181. void NOD_MINIGUNNER_ATTACKS_HAVOC (void)
  3182. {
  3183. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, NOD_MINIGUNNER_ATTACKS_HAVOC start\n");
  3184. Commands->Action_Movement_Set_Forward_Speed((Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), 0.6f);
  3185. Commands->Action_Movement_Follow_Object((Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG)), (Commands->Get_The_Star()), 10.0f);
  3186. }
  3187. void Damaged (GameObject* obj, GameObject* Damager)
  3188. {
  3189. if ((Damager == (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG))) || (Damager == (Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG))))
  3190. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, Has been damaged\n");
  3191. {
  3192. GameObject* nodGunner = Commands->Find_Object(MPR_A04_suiciderun_nod_minigunner_id_JDG);
  3193. if (nodGunner != NULL)
  3194. {
  3195. Commands->Action_Movement_Stop(nodGunner);
  3196. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, Has stopped\n");
  3197. }
  3198. }
  3199. }
  3200. void Killed(GameObject* obj, GameObject* Killer)
  3201. {
  3202. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Minigunner, NOD_MINIGUNNER Killed, Start new GDI timers\n");
  3203. float timeDelay_1 = Commands->Get_Random (1.5f,2.5f);
  3204. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_FOLLOW_TANK_DELAY_JDG);
  3205. float timeDelay_2 = Commands->Get_Random (1.5f,2.5f);
  3206. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), timeDelay_2, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_FOLLOW_TANK_DELAY_JDG);
  3207. float timeDelay_4 = Commands->Get_Random (3.5f,6.5f);
  3208. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_nod_light_tank_id_JDG)), timeDelay_4, MPR_A04_TIMER_SUICIDERUN_NOD_LIGHTTANK_ATTACK_MEDIUMTANK_DELAY_JDG);
  3209. }
  3210. };
  3211. /*
  3212. MPR_A04_SuicideRun_NOD_Light_Tank
  3213. The following is the script for the NOD light tank by the obelisk. Its pretty tightly scripted and fragile.
  3214. */
  3215. DECLARE_SCRIPT(MPR_A04_SuicideRun_NOD_Light_Tank_JDG, "")
  3216. {
  3217. void Created(GameObject* obj)
  3218. {
  3219. //DebugPrint("JDG, PRDemo, SuicideRun, NOD Light Tank, Created okay\n");
  3220. MPR_A04_suiciderun_nod_light_tank_id_JDG = Commands->Get_ID (obj);
  3221. Commands->Set_Health(obj, 400.0f);
  3222. state = MPR_A04_SUICIDERUN_LIGHTTANK_ALIVE;
  3223. }
  3224. void Timer_Expired (GameObject* obj, int Timer_ID)
  3225. {
  3226. if ((Timer_ID == MPR_A04_TIMER_SUICIDERUN_NOD_LIGHTTANK_ATTACK_MEDIUMTANK_DELAY_JDG) && (Commands->Find_Object(MPR_A04_suiciderun_nod_light_tank_id_JDG)))
  3227. {
  3228. Commands->Action_Attack_Object(obj, (Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), 10.0f, 100.0f);
  3229. float timeDelay_1 = Commands->Get_Random (1.5f,2.5f);
  3230. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_ATTACK_LIGHTTANK_DELAY_JDG);
  3231. float timeDelay_2 = Commands->Get_Random (1.5f,2.5f);
  3232. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), timeDelay_2, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_ATTACK_LIGHTTANK_DELAY_JDG);
  3233. float timeDelay_4 = Commands->Get_Random (1.5f,2.5f);
  3234. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), timeDelay_4, MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_ATTACK_LIGHTTANK_DELAY_JDG);
  3235. }
  3236. }
  3237. void Killed(GameObject* obj, GameObject* Killer)
  3238. {
  3239. float timeDelay_1 = Commands->Get_Random (1.5f,2.5f);
  3240. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_ATTACK_OBELISK_DELAY_JDG);
  3241. float timeDelay_2 = Commands->Get_Random (1.5f,2.5f);
  3242. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), timeDelay_2, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_ATTACK_OBELISK_DELAY_JDG);
  3243. float timeDelay_4 = Commands->Get_Random (1.5f,2.5f);
  3244. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), timeDelay_4, MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_ATTACK_OBELISK_DELAY_JDG);
  3245. state = MPR_A04_SUICIDERUN_LIGHTTANK_DEAD;
  3246. }
  3247. };
  3248. /*
  3249. MPR_A04_SuicideRun_Console
  3250. The following is a script for the suicide run. It goes on both the obelisk and power plant consoles and lets
  3251. the gdi guys know if/when the console gets destroyed.
  3252. */
  3253. DECLARE_SCRIPT(MPR_A04_SuicideRun_Console_JDG, "")
  3254. {
  3255. void Created(GameObject* obj)
  3256. {
  3257. status = MPR_A04_SUICIDERUN_CONSOLE_ALIVE;
  3258. }
  3259. void Killed(GameObject* obj, GameObject* Killer)
  3260. {
  3261. float timeDelay_1 = Commands->Get_Random (0.5f,1.5f);
  3262. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_1_id_JDG)), timeDelay_1, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_1_OBELISK_IS_DEAD_DELAY_JDG);
  3263. float timeDelay_2 = Commands->Get_Random (0.5f,1.5f);
  3264. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_minigunner_2_id_JDG)), timeDelay_2, MPR_A04_TIMER_SUICIDERUN_GDI_MINIGUNNER_2_OBELISK_IS_DEAD_DELAY_JDG);
  3265. float timeDelay_4 = Commands->Get_Random (0.5f,1.5f);
  3266. Commands->Start_Timer ((Commands->Find_Object(MPR_A04_suiciderun_gdi_medium_tank_id_JDG)), timeDelay_4, MPR_A04_TIMER_SUICIDERUN_GDI_MEDIUMTANK_OBELISK_IS_DEAD_DELAY_JDG);
  3267. status = MPR_A04_SUICIDERUN_CONSOLE_DEAD;
  3268. }
  3269. };
  3270. /*
  3271. MPR_A02_DriveBy_EnterZone
  3272. The following are the scripts involved in the harvester escort routine.
  3273. There are 2 scripts, one for a zone and the other for the Harvester
  3274. */
  3275. DECLARE_SCRIPT(MPR_A02_DriveBy_EnterZone_JDG, "")
  3276. {
  3277. int Havoc_in_this_Zone;
  3278. void Created(GameObject* obj)
  3279. {
  3280. //DebugPrint("JDG, MPR_A02_HarvesterDriveBy_EnterZone, Created Okay\n");
  3281. Havoc_in_this_Zone = 0;
  3282. }
  3283. void Entered (GameObject* obj, GameObject* Enterer)
  3284. {
  3285. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  3286. {
  3287. //Commands->DebugPrint("JDG, MPRA02, Havoc has Entered the DriveBy start zone, Sending customs to harvester patrol group\n");
  3288. //Commands->Display_Text_Colored(Vector3(1.0f,0.0f,0.7f),"JDG, MPRA02, Havoc has Entered the DriveBy start zone, Sending customs to harvester patrol group\n" );
  3289. Commands->Send_Custom_Event (obj, (Commands->Find_Object(MPR_A02_driveby_harvester_id_JDG)), MPR_A02_CUSTOM_DRIVEBY_HARVESTER_JDG, MPR_A00_PARAM_HAVOC_IN_ENTER_ZONE_JDG);
  3290. Havoc_in_this_Zone++;
  3291. }
  3292. }
  3293. };
  3294. /*
  3295. MPR_A02_DriveBy_Harvester
  3296. The following is the script for the harvester that comes from the refinery. It basicly just follows
  3297. a waypath to the tiberium field and then does nothing.
  3298. */
  3299. DECLARE_SCRIPT(MPR_A02_DriveBy_Harvester_JDG, "")
  3300. {
  3301. void Created(GameObject* obj)
  3302. {
  3303. //DebugPrint("JDG, MPRA02, DriveBy, Harvester Created Okay\n");
  3304. MPR_A02_driveby_harvester_id_JDG = Commands->Get_ID (obj);
  3305. Commands->Set_Health(obj, 400.0f);
  3306. }
  3307. void Custom (GameObject* obj, int Type, int Param, GameObject* Sender)
  3308. {
  3309. if ((Type == MPR_A02_CUSTOM_DRIVEBY_HARVESTER_JDG) && (Param == MPR_A00_PARAM_HAVOC_IN_ENTER_ZONE_JDG))
  3310. {
  3311. //DebugPrint("JDG, MPRA02, Harvester, Recieved Custom from EnterZone, Starting Scenario\n");
  3312. Commands->Action_Movement_Set_Forward_Speed(obj, 0.25f);
  3313. Commands->Action_Movement_Follow_Waypath ( obj, MPR_A02_HARVESTER_WAYPATH_JDG, MPR_A02_HARVESTER_WAYPATH_START_JDG, MPR_A02_HARVESTER_WAYPATH_STOP_JDG, true );
  3314. }
  3315. }
  3316. };
  3317. /*
  3318. MPR_A03_Helicopter_EnterZone
  3319. The following are the scripts involved with the injured pilot at
  3320. the crashed Apache. There are two scripts, the first is for a zone
  3321. that acts as a controller for the random explosions, and the second
  3322. is for the pilot himself.
  3323. */
  3324. DECLARE_SCRIPT(MPR_A03_Helicopter_EnterZone_JDG, "")
  3325. {
  3326. int Havoc_in_this_Zone;
  3327. int Explosion_Count;
  3328. int count;
  3329. int MPR_A03_HELI_EXLOSION_ZONE_ID;
  3330. typedef enum
  3331. {
  3332. MPR_A03_JDG_EXPLOSION_TIMER_1,
  3333. MPR_A03_JDG_EXPLOSION_TIMER_2,
  3334. MPR_A03_JDG_EXPLOSION_TIMER_3,
  3335. MPR_A03_JDG_EXPLOSION_TIMER_4,
  3336. } PRTIMER_TIMERS;
  3337. void Created(GameObject* obj)
  3338. {
  3339. //DebugPrint("JDG, MPRA03, Heli_Explosion EnterZone created okay\n");
  3340. Havoc_in_this_Zone = 0;
  3341. MPR_A03_HELI_EXLOSION_ZONE_ID = Commands->Get_ID (obj);
  3342. }
  3343. void Entered (GameObject* obj, GameObject* Enterer)
  3344. {
  3345. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  3346. {
  3347. //DebugPrint("JDG, MPRA03, Havoc has Entered the Heli_Explosion EnterZone, Starting Explosions\n");
  3348. //Havoc_in_this_Zone++;
  3349. Explosion_Count = (int)Commands->Get_Random (10, 15);
  3350. count = 0;
  3351. Commands->Start_Timer((Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)), .71f, MPR_A03_TIMER_INJURED_PILOT_CRAWL_1_JDG);
  3352. Havoc_in_this_Zone++;
  3353. Make_Explosions ();
  3354. }
  3355. }
  3356. void Make_Explosions ()
  3357. {
  3358. //DebugPrint("JDG, MPRA03, Make Explosions start\n");
  3359. int Explosion_Number = (int)Commands->Get_Random(1, 5);
  3360. if ((Explosion_Number == 1) && (count <= Explosion_Count))
  3361. {
  3362. //DebugPrint("JDG, MPRA03, Make Explosions Starting Timer 1\n");
  3363. count++;
  3364. float timeDelay = Commands->Get_Random(3.0f, 5.0f);
  3365. Commands->Start_Timer((Commands->Find_Object(MPR_A03_HELI_EXLOSION_ZONE_ID)), timeDelay, MPR_A03_JDG_EXPLOSION_TIMER_1);
  3366. }
  3367. else if ((Explosion_Number == 2) && (count <= Explosion_Count))
  3368. {
  3369. //DebugPrint("JDG, MPRA03, Make Explosions Starting Timer 2\n");
  3370. count++;
  3371. float timeDelay = Commands->Get_Random(3.0f, 5.0f);
  3372. Commands->Start_Timer((Commands->Find_Object(MPR_A03_HELI_EXLOSION_ZONE_ID)), timeDelay, MPR_A03_JDG_EXPLOSION_TIMER_2);
  3373. }
  3374. else if ((Explosion_Number == 3) && (count <= Explosion_Count))
  3375. {
  3376. //DebugPrint("JDG, MPRA03, Make Explosions Starting Timer 3\n");
  3377. count++;
  3378. float timeDelay = Commands->Get_Random(3.0f, 5.0f);
  3379. Commands->Start_Timer((Commands->Find_Object(MPR_A03_HELI_EXLOSION_ZONE_ID)), timeDelay, MPR_A03_JDG_EXPLOSION_TIMER_3);
  3380. }
  3381. else if (count <= Explosion_Count)
  3382. {
  3383. //DebugPrint("JDG, MPRA03, Make Explosions Starting Timer 4\n");
  3384. count++;
  3385. float timeDelay = Commands->Get_Random(3.0f, 5.0f);
  3386. Commands->Start_Timer((Commands->Find_Object(MPR_A03_HELI_EXLOSION_ZONE_ID)), timeDelay, MPR_A03_JDG_EXPLOSION_TIMER_4);
  3387. }
  3388. }
  3389. void Timer_Expired (GameObject*obj, int Timer_ID)
  3390. {
  3391. if (Timer_ID == MPR_A03_JDG_EXPLOSION_TIMER_1)
  3392. {
  3393. float Xnot = Commands->Get_Random (186.20f, 190.21f);
  3394. float Ynot = Commands->Get_Random (31.0f, 35.0f);
  3395. float Znot = Commands->Get_Random (2.59f, 4.69f);
  3396. Vector3 Explosion_Location(Xnot, Ynot, Znot);
  3397. //DebugPrint("JDG, MPRA03, Timer Expired Explosion 1\n");
  3398. Commands->Create_Explosion ("Rocket Explosion", Explosion_Location, obj);
  3399. Make_Explosions ();
  3400. }
  3401. if (Timer_ID == MPR_A03_JDG_EXPLOSION_TIMER_2)
  3402. {
  3403. float Xnot = Commands->Get_Random (178.21f, 180.21f);
  3404. float Ynot = Commands->Get_Random (38.0f, 40.0f);
  3405. float Znot = Commands->Get_Random (2.69f, 4.69f);
  3406. Vector3 Explosion_Location(Xnot, Ynot, Znot);
  3407. //DebugPrint("JDG, MPRA03, Timer Expired Explosion 2\n");
  3408. Commands->Create_Explosion ("Rocket Explosion", Explosion_Location, obj);
  3409. Make_Explosions ();
  3410. }
  3411. if (Timer_ID == MPR_A03_JDG_EXPLOSION_TIMER_3)
  3412. {
  3413. float Xnot = Commands->Get_Random (183.21f, 185.21f);
  3414. float Ynot = Commands->Get_Random (46.0f, 49.0f);
  3415. float Znot = Commands->Get_Random (6.15f, 7.69f);
  3416. Vector3 Explosion_Location(Xnot, Ynot, Znot);
  3417. //DebugPrint("JDG, MPRA03, Timer Expired Explosion 3\n");
  3418. Commands->Create_Explosion ("Rocket Explosion", Explosion_Location, obj);
  3419. Make_Explosions ();
  3420. }
  3421. if (Timer_ID == MPR_A03_JDG_EXPLOSION_TIMER_4)
  3422. {
  3423. float Xnot = Commands->Get_Random (188.21f, 190.21f);
  3424. float Ynot = Commands->Get_Random (47.0f, 49.0f);
  3425. float Znot = Commands->Get_Random (8.06f, 10.69f);
  3426. Vector3 Explosion_Location(Xnot, Ynot, Znot);
  3427. //DebugPrint("JDG, MPRA03, Timer Expired Explosion 4\n");
  3428. Commands->Create_Explosion ("Rocket Explosion", Explosion_Location, obj);
  3429. Make_Explosions ();
  3430. }
  3431. }
  3432. };
  3433. /*
  3434. MPR_A03_Helicopter_Injured_NOD_Pilot
  3435. The following is the script for the injured pilot by the downed Apache.
  3436. */
  3437. DECLARE_SCRIPT(MPR_A03_Helicopter_Injured_NOD_Pilot_JDG, "")
  3438. {
  3439. typedef enum
  3440. {
  3441. MPR_A03_PILOT_IDLE = 0,
  3442. MPR_A03_PILOT_STANDING_UP,
  3443. MPR_A03_PILOT_STAMMERING,
  3444. MPR_A03_PILOT_LOOKING_BACK,
  3445. MPR_A03_PILOT_ADJUSTING_KEVLAR,
  3446. MPR_A03_PILOT_ATTACKING,
  3447. } PILOTState;
  3448. PILOTState state;
  3449. void Created(GameObject* obj)
  3450. {
  3451. //DebugPrint("JDG, MPRA03, Injured Pilot Created Okay\n");
  3452. MPR_A03_helicopter_injured_nod_pilot_id_JDG = Commands->Get_ID (obj);
  3453. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_601A", 1);
  3454. state = MPR_A03_PILOT_IDLE;
  3455. }
  3456. void Timer_Expired (GameObject*obj, int Timer_ID)
  3457. {
  3458. if ((Timer_ID == MPR_A03_TIMER_INJURED_PILOT_CRAWL_1_JDG) && (Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)))
  3459. {
  3460. //DebugPrint("JDG, MPRA03, Injured Pilot Timer Expired, Start Crawling\n");
  3461. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_H11C", 0);
  3462. //"S_A_HUMAN.H_A_H11C" is animation for standing up
  3463. state = MPR_A03_PILOT_STANDING_UP;
  3464. }
  3465. }
  3466. void Animation_Complete (GameObject* obj, const char* name)
  3467. {
  3468. if ((stricmp("S_A_HUMAN.H_A_H11C", name) == 0) && (Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)) && (state == MPR_A03_PILOT_STANDING_UP))
  3469. {
  3470. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_611A", 0);
  3471. state = MPR_A03_PILOT_STAMMERING;
  3472. }
  3473. if ((stricmp("S_A_HUMAN.H_A_611A", name) == 0) && (Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)) && (state == MPR_A03_PILOT_STAMMERING))
  3474. {
  3475. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J11C", 0);
  3476. state = MPR_A03_PILOT_LOOKING_BACK;
  3477. }
  3478. if ((stricmp("S_A_HUMAN.H_A_J11C", name) == 0) && (Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)) && (state == MPR_A03_PILOT_LOOKING_BACK))
  3479. {
  3480. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J22C", 0);
  3481. state = MPR_A03_PILOT_ADJUSTING_KEVLAR;
  3482. }
  3483. if ((stricmp("S_A_HUMAN.H_A_J22C", name) == 0) && (Commands->Find_Object(MPR_A03_helicopter_injured_nod_pilot_id_JDG)) && (state == MPR_A03_PILOT_ADJUSTING_KEVLAR))
  3484. {
  3485. Commands->Action_Movement_Set_Forward_Speed (obj, 0.5f);
  3486. Commands->Action_Movement_Goto_Object (obj, (Commands->Get_The_Star()), 6.0f);
  3487. Commands->Action_Attack_Object (obj, (Commands->Get_The_Star()), 1.0f, 20.0f);
  3488. }
  3489. }
  3490. };
  3491. /*
  3492. MPR_A03_BridgeScene_EnterZone
  3493. The following are the scripts involved in the bridge blow up scenario.
  3494. There are presently 3 scripts, 2 zones and 1 engineer.
  3495. */
  3496. DECLARE_SCRIPT(MPR_A03_BridgeScene_EnterZone_JDG, "")
  3497. {
  3498. int Havoc_in_this_Zone;
  3499. void Created(GameObject* obj)
  3500. {
  3501. //DebugPrint("JDG, MPRA03, BridgeScene, EnterZone, Created Okay\n");
  3502. Havoc_in_this_Zone = 0;
  3503. MPR_A03_bridgescene_enterzone_id_JDG = Commands->Get_ID (obj);
  3504. Commands->Static_Anim_Phys_Goto_Frame ( MPR_A03_BRIDGESCENE_BRIDGE_ID_JDG, 0.0f, "BRIDGE_EXPLDA02.BRIDGE_EXPLDA02");
  3505. }
  3506. void Entered (GameObject* obj, GameObject* Enterer)
  3507. {
  3508. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  3509. {
  3510. //DebugPrint("JDG, MPRA03, BridgeScene, EnterZone, Havoc has entered Zone. Starting Delay timers on Bridge Team\n");
  3511. float timeDelay_3 = Commands->Get_Random (0.0f, 0.5f);
  3512. Commands->Start_Timer ((Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)), timeDelay_3, MPR_A03_TIMER_BRIDGESCENE_ENGINEER_HAVOC_IN_ZONE_DELAY_JDG);
  3513. float timeDelay_4 = 8.0f;
  3514. Commands->Start_Timer (obj, timeDelay_4, MPR_A03_TIMER_BRIDGESCENE_ENTER_ZONE_EXPLOSION_DELAY_JDG);
  3515. Havoc_in_this_Zone++;
  3516. }
  3517. }
  3518. void Timer_Expired (GameObject* obj, int Timer_ID)
  3519. {
  3520. if (Timer_ID == MPR_A03_TIMER_BRIDGESCENE_ENTER_ZONE_EXPLOSION_DELAY_JDG)
  3521. {
  3522. Commands->Static_Anim_Phys_Goto_Last_Frame (MPR_A03_BRIDGESCENE_BRIDGE_ID_JDG, "BRIDGE_EXPLDA02.BRIDGE_EXPLDA02" );
  3523. }
  3524. }
  3525. };
  3526. /*
  3527. MPR_A03_BridgeScene_BlowUpZone
  3528. The following script is for a zone right next to the bridge that immediately blows the
  3529. bridge when entered. This is to prevent the player from reaching the other side before
  3530. the bridge blows.
  3531. */
  3532. DECLARE_SCRIPT(MPR_A03_BridgeScene_BlowUpZone_JDG, "")
  3533. {
  3534. int Havoc_in_this_Zone;
  3535. void Created(GameObject* obj)
  3536. {
  3537. //DebugPrint("JDG, MPRA03, BridgeScene, EnterZone, Created Okay\n");
  3538. Havoc_in_this_Zone = 0;
  3539. MPR_A03_bridgescene_blowupzone_id_JDG = Commands->Get_ID (obj);
  3540. }
  3541. void Entered (GameObject* obj, GameObject* Enterer)
  3542. {
  3543. if (Enterer == (Commands->Get_The_Star()) && (Havoc_in_this_Zone == 0))
  3544. {
  3545. //DebugPrint("JDG, MPRA03, BridgeScene, EnterZone, Havoc has entered Zone. Starting Delay timers on Bridge Team\n");
  3546. Commands->Static_Anim_Phys_Goto_Last_Frame (MPR_A03_BRIDGESCENE_BRIDGE_ID_JDG, "BRIDGE_EXPLDA02.BRIDGE_EXPLDA02" );
  3547. }
  3548. }
  3549. };
  3550. /*
  3551. MPR_A03_BridgeScene_Engineer
  3552. The following is for the engineer next to the bridge. He does a few animations then runs through the
  3553. tunnel and is deleted.
  3554. */
  3555. DECLARE_SCRIPT(MPR_A03_BridgeScene_Engineer_JDG, "")
  3556. {
  3557. typedef enum
  3558. {
  3559. MPR_A03_BRIDGESCENE_ENGINEER_IDLE = 0,
  3560. MPR_A03_BRIDGESCENE_ENGINEER_PLACING_BOMB,
  3561. MPR_A03_BRIDGESCENE_ENGINEER_WAVING,
  3562. MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_INT_SPOT,
  3563. MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_TUNNEL,
  3564. MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_FINAL_POSITION,
  3565. } ENGINEERState;
  3566. ENGINEERState state;
  3567. void Created(GameObject* obj)
  3568. {
  3569. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Created Okay\n");
  3570. MPR_A03_bridgescene_engineer_id_JDG = Commands->Get_ID (obj);
  3571. Commands->Action_Attack_Object( obj, (Commands->Get_The_Star()), 0, 0);
  3572. state = MPR_A03_BRIDGESCENE_ENGINEER_IDLE;
  3573. }
  3574. void Timer_Expired (GameObject* obj, int Timer_ID)
  3575. {
  3576. if ((Timer_ID == MPR_A03_TIMER_BRIDGESCENE_ENGINEER_HAVOC_IN_ZONE_DELAY_JDG) && (Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)))
  3577. {
  3578. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Havoc/EnterZone Timer Expired\n");
  3579. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J12C", 0);
  3580. //"S_A_HUMAN.H_A_J12C" is animation for tying your shoe
  3581. state = MPR_A03_BRIDGESCENE_ENGINEER_PLACING_BOMB;
  3582. }
  3583. }
  3584. void Animation_Complete (GameObject* obj, const char* name)
  3585. {
  3586. if ((stricmp("S_A_HUMAN.H_A_J12C", name) == 0) && (Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)) && (state == MPR_A03_BRIDGESCENE_ENGINEER_PLACING_BOMB))
  3587. {
  3588. Commands->Set_Animation (obj, "S_A_HUMAN.H_A_J18C", 0);
  3589. //"S_A_HUMAN.H_A_J18C" is animation for waving
  3590. state = MPR_A03_BRIDGESCENE_ENGINEER_WAVING;
  3591. }
  3592. if ((stricmp("S_A_HUMAN.H_A_J18C", name) == 0) && (Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)) && (state == MPR_A03_BRIDGESCENE_ENGINEER_WAVING))
  3593. {
  3594. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Finished waving\n");
  3595. Vector3 Engineers_Int_Position (234.26f, 202.66f, 3.92f);
  3596. Commands->Action_Attack_Location(obj, Engineers_Int_Position, 0, 0);
  3597. Commands->Action_Movement_Set_Forward_Speed(obj, 0.7f);
  3598. Commands->Action_Movement_Goto_Location(obj, Engineers_Int_Position, 0.05f);
  3599. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, start moving away\n");
  3600. state = MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_INT_SPOT;
  3601. }
  3602. }
  3603. void Movement_Complete(GameObject* obj, MovementCompleteReason reason)
  3604. {
  3605. static const char* _reasons[] =
  3606. {
  3607. "Arrived",
  3608. "Bad Start",
  3609. "Bad Dest",
  3610. "No progress"
  3611. };
  3612. //DebugPrint("Movement_Complete Reason = %s\n", _reasons[reason]);
  3613. if ((Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)) && (state == MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_INT_SPOT))
  3614. {
  3615. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Reached intermediate spot\n");
  3616. Vector3 Engineers_Tunnel_Position (154.90f, 242.68f, 0.39f);
  3617. Commands->Action_Attack_Location(obj, Engineers_Tunnel_Position, 0, 0);
  3618. Commands->Action_Movement_Goto_Location(obj, Engineers_Tunnel_Position, 0.05f);
  3619. state = MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_TUNNEL;
  3620. }
  3621. if ((Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)) && (state == MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_TUNNEL))
  3622. {
  3623. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Reached bridge location\n");
  3624. Vector3 Engineers_Final_Position (141.95f, 297.41f, 0.86f);
  3625. Commands->Action_Attack_Location(obj, Engineers_Final_Position, 0, 0);
  3626. Commands->Action_Movement_Goto_Location(obj, Engineers_Final_Position, 0.05f);
  3627. state = MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_FINAL_POSITION;
  3628. }
  3629. if ((Commands->Find_Object(MPR_A03_bridgescene_engineer_id_JDG)) && (state == MPR_A03_BRIDGESCENE_ENGINEER_MOVING_TO_FINAL_POSITION))
  3630. {
  3631. //DebugPrint("JDG, MPRA03, BridgeScene, Engineer, Destroying\n");
  3632. Commands->Destroy_Object( obj );
  3633. }
  3634. }
  3635. };
  3636. #endif