| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296 |
- /*
- ** Command & Conquer Renegade(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "scripts.h"
- #include "toolkit.h"
- #include "Mission7.h"
- #include "Mission5.h"
- #include <stdio.h>
- #include <time.h>
- DECLARE_SCRIPT (DLS_SpawnTest, "")
- {
- bool already_entered;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( already_entered, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Enable_Spawner(100002, false);
- already_entered = false;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- // Commands->Trigger_Spawner(100002);
- Commands->Enable_Spawner(100002, true);
- }
- }
- };
- DECLARE_SCRIPT (DLS_Spawner, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- }
- void Created (GameObject * obj)
- {
- Commands->Enable_Spawner(Commands->Get_ID(obj), false);
- }
-
- };
- DECLARE_SCRIPT (DLS_Two_Way, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD + 5, 10 );
- params.Set_Movement( Commands->Find_Object(100001), WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if((action_id == 10) && (reason == ACTION_COMPLETE_NORMAL))
- {
- int id = 100000;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD + 5, 11 );
- params.Set_Movement( Commands->Find_Object(id), WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- if((action_id == 11) && (reason == ACTION_COMPLETE_NORMAL))
- {
- int id = 100001;
- params.Set_Basic( this, INNATE_PRIORITY_FOOTSTEPS_HEARD + 5, 10 );
- params.Set_Movement( Commands->Find_Object(id), WALK, 1.5f );
- Commands->Action_Goto( obj, params );
- }
- }
-
- };
- DECLARE_SCRIPT(DLS_Invulnerable_Test, "")
- {
-
- bool debug_mode;
- int poke_id;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Health( obj, 2);
- Commands->Apply_Damage( obj, 50000.0f, "STEEL");
-
- }
-
- };
- DECLARE_SCRIPT(DLS_InnateIsStationary_Test, "")
- {
-
- bool debug_mode;
- int poke_id;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
-
- }
-
- void Poked(GameObject * obj, GameObject * poker)
- {
- ActionParamsStruct params;
- params.Set_Basic (this, (INNATE_PRIORITY_ENEMY_SEEN + 5), 100755);
- params.Set_Movement (STAR, RUN, 2.0f);
- params.MoveFollow = true;
- Commands->Action_Goto (obj, params);
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Camera_Test, "Pan_Loc1_ID=0:int, Pan_Loc2_ID=0:int, Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
- int pan_loc1_id;
- int pan_loc2_id;
- int enemy_id;
- int seen_cnt;
- int time;
-
-
- enum {CAMERA_LOC1 = 15, CAMERA_LOC2 = 16, STAR_VISIBLE = 17};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- Commands->Enable_Enemy_Seen( obj, true );
-
- pan_loc1_id = Get_Int_Parameter("Pan_Loc1_ID");
- pan_loc2_id = Get_Int_Parameter("Pan_Loc2_ID");
-
- enemy_id = 0;
- seen_cnt = 0;
- time = 0;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, CAMERA_LOC1 );
- params.Set_Attack (Commands->Find_Object(pan_loc1_id), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if((action_id == CAMERA_LOC1) && (reason == ACTION_COMPLETE_NORMAL))
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, CAMERA_LOC2 );
- params.Set_Attack (Commands->Find_Object(pan_loc2_id), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- if((action_id == CAMERA_LOC1) && (reason == ACTION_COMPLETE_LOW_PRIORITY))
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, CAMERA_LOC2 );
- params.Set_Attack (Commands->Find_Object(pan_loc2_id), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- Commands->Start_Timer (obj, this, 2.0f, STAR_VISIBLE);
- }
- if((action_id == CAMERA_LOC2) && (reason == ACTION_COMPLETE_NORMAL))
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, CAMERA_LOC1 );
- params.Set_Attack (Commands->Find_Object(pan_loc2_id), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == STAR_VISIBLE)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN - 5, CAMERA_LOC1 );
- params.Set_Attack (Commands->Find_Object(pan_loc2_id), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
-
- }
-
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- ActionParamsStruct params;
- enemy_id = Commands->Get_ID(enemy);
- SCRIPT_DEBUG_MESSAGE (("Enemy Seen: %d Seen Time: %d.\n", Commands->Get_ID(enemy), time));
-
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN, 1 );
- params.Set_Attack (enemy, 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- if(seen_cnt < 5)
- {
- seen_cnt++;
- Commands->Create_Sound ("Klaxon Warning", Commands->Get_Position (obj), obj);
- Commands->Start_Timer (obj, this, 2.0f, STAR_VISIBLE);
- }
- else
- {
- Commands->Create_Sound ("Klaxon", Commands->Get_Position (obj), obj);
- }
-
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Gun_Test, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
- enum {GUN_LOC1, GUN_LOC2};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( debug_mode, 2 );
- }
-
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if(action_id == 666)
- {
- SCRIPT_DEBUG_MESSAGE (("Action ID: %d ActionCompleteReason: %d.\n", action_id, reason));
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if (type == 666 && param == 666)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
- params.Set_Attack (STAR, 250.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- }
- };
- DECLARE_SCRIPT(DLS_Test_NULL, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
-
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created(GameObject * obj)
- {
-
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- const char *conv_name = ("IDS_M06_D05");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- Commands->Monitor_Conversation (obj, conv_id);
- }
-
-
-
- };
- DECLARE_SCRIPT(DLS_Rappelling_Activate, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
- bool already_entered;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
- SAVE_VARIABLE( already_entered, 2 );
- }
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X5C_Wintroops3.txt");
- }
-
- };
- DECLARE_SCRIPT(DLS_Tank_Path_Test, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
- enum {STAR_VISIBLE};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
-
- }
- void Created (GameObject * obj)
- {
-
- Commands->Start_Timer (obj, this, 2.0f, STAR_VISIBLE);
-
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- ActionParamsStruct params;
-
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
- params.Set_Attack (STAR, 200.0f, 5.0f, 0);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack (obj, params);
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == STAR_VISIBLE)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
- params.Set_Attack (STAR, 200.0f, 5.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack (obj, params);
-
- }
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Vehicle_Follow, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
- enum {STAR_VISIBLE};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
-
- }
- void Created (GameObject * obj)
- {
-
- Commands->Start_Timer (obj, this, 2.0f, STAR_VISIBLE);
- }
-
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == STAR_VISIBLE)
- {
- Commands->Apply_Damage( obj, 100000, "STEEL", NULL );
-
- }
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Filing_Cabinet, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
- bool destroyed_state;
-
- enum {FRAME0, FRAME1, FRAME2, FRAME3, FRAME5, FRAME6, FRAME7, FRAME8, FRAME9};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
-
- }
- void Created (GameObject * obj)
- {
- destroyed_state = false;
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 0);
- }
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- if(!destroyed_state)
- {
- if(Commands->Get_Health(obj) < (Commands->Get_Max_Health(obj) * 3.0f))
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 4);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME5);
- destroyed_state = true;
- }
- else
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 1);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME2);
- }
- }
- }
-
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == FRAME0)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 0);
-
- }
- if(timer_id == FRAME2)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 2);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME3);
-
- }
- if(timer_id == FRAME3)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 3);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME0);
-
- }
- if(timer_id == FRAME5)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 5);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME6);
-
- }
- if(timer_id == FRAME6)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 6);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME7);
-
- }
- if(timer_id == FRAME7)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 7);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME8);
-
- }
- if(timer_id == FRAME8)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 8);
- Commands->Start_Timer (obj, this, (1.0f / 30.0f), FRAME9);
-
- }
- if(timer_id == FRAME9)
- {
- Commands->Set_Animation_Frame(obj, "dsp_lockers.dsp_lockers", 9);
-
- }
-
-
-
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- Commands->Create_Explosion("Small Crate Explosion", Commands->Get_Position(obj), obj);
- }
-
-
- };
- DECLARE_SCRIPT(DLS_Waypath_Test, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
-
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
-
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 16 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
- params.WaypathID = 100001;
- params.WaypointStartID = 100002;
- params.WaypointEndID = 100009;
- params.Set_Attack (Commands->Find_Object(100021), 250.0f, 10.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if((action_id == 15) && (reason == ACTION_COMPLETE_NORMAL))
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 16 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
- params.WaypathID = 100001;
- params.WaypointStartID = 100002;
- params.WaypointEndID = 100009;
- params.Set_Attack (Commands->Find_Object(100021), 250.0f, 10.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- if((action_id == 16) && (reason == ACTION_COMPLETE_NORMAL))
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 15 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
- params.WaypathID = 100011;
- params.WaypointStartID = 100012;
- params.WaypointEndID = 100019;
- params.Set_Attack (Commands->Find_Object(100021), 250.0f, 10.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- }
-
-
- };
- DECLARE_SCRIPT(M06_Camera_Behavior, "Angle:float")
- {
- int switcher, enemy_id;
- bool enemy_seen, timer_expired, alert;
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE(switcher, 1);
- SAVE_VARIABLE(enemy_seen, 2);
- SAVE_VARIABLE(enemy_id, 3);
- SAVE_VARIABLE(timer_expired, 4);
- SAVE_VARIABLE(alert, 5);
- }
- Vector3 Get_Target(void)
- {
- float facing = Commands->Get_Facing(Owner());
- Vector3 target = Commands->Get_Position(Owner());
- target.X += cos(DEG_TO_RADF(facing)) * 10.0f;
- target.Y += sin(DEG_TO_RADF(facing)) * 10.0f;
- target.Z -= 0.9f;
- float angle = Get_Float_Parameter(0);
- angle = WWMath::Clamp(angle, 0.0f, 360.0f);
- switch (switcher)
- {
- case 0: angle /= 2.0f;
- break;
- case 1: angle /= 4.0f;
- break;
- case 2: angle = 0.0f;
- break;
- case 3: angle /= -4.0f;
- break;
- case 4: angle /= -2.0f;
- break;
- case 5: angle /= -4.0f;
- break;
- case 6: angle = 0.0f;
- break;
- case 7: angle /= 4.0f;
- break;
- }
- target -= Commands->Get_Position(Owner());
- target.Rotate_Z(DEG_TO_RADF(angle));
- target += Commands->Get_Position(Owner());
-
- return target;
- }
- Vector3 Get_First_Target(void)
- {
- float angle = Get_Float_Parameter(0);
- float facing = Commands->Get_Facing(Owner());
- angle = angle / 2;
- Vector3 target = Commands->Get_Position(Owner());
- target.X += cos(DEG_TO_RADF(facing)) * 10.0f;
- target.Y += sin(DEG_TO_RADF(facing)) * 10.0f;
- target.Z -= 1.0f;
- target -= Commands->Get_Position(Owner());
- target.Rotate_Z(DEG_TO_RADF(angle));
- target += Commands->Get_Position(Owner());
- return target;
- }
-
- void Created(GameObject * obj)
- {
- switcher = enemy_id = 0;
- enemy_seen = timer_expired = alert = false;
- Commands->Enable_Enemy_Seen(obj);
- ActionParamsStruct params;
- params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN - 5, 0);
- params.Set_Attack(Get_First_Target(), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- Commands->Start_Timer(obj, this, Get_Int_Parameter(0) / 20.0f, 0);
- }
- void Resume(void)
- {
- Commands->Debug_Message("**** Enemy lost... resuming.\n");
-
- Commands->Action_Reset(Owner(), INNATE_PRIORITY_ENEMY_SEEN - 5);
- enemy_id = 0;
- enemy_seen = timer_expired = alert = false;
- }
- void Alarm(void)
- {
- // React with lots of violence
- Commands->Debug_Message("**** Alarm activated!\n");
- enemy_id = 0;
- enemy_seen = timer_expired = alert = false;
- }
- void Timer_Expired(GameObject * obj, int timer_id)
- {
- if (timer_id == 1)
- {
- timer_expired = true;
- Commands->Start_Timer(obj, this, 2.0f, 2);
- }
- else if (timer_id == 2)
- {
- if (!alert)
- {
- Resume();
- }
- else
- {
- Alarm();
- }
- }
- else
- {
- ++switcher %= 8;
-
- ActionParamsStruct params;
- params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN - 5, 0);
- params.Set_Attack(Get_Target(), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- Commands->Start_Timer(obj, this, Get_Float_Parameter(0) / 40.0f, 0);
- }
- }
- void Enemy_Seen(GameObject * obj, GameObject * enemy)
- {
- if (!enemy_seen)
- {
- Commands->Debug_Message("**** Enemy acquired.\n");
-
- enemy_id = Commands->Get_ID(enemy);
- enemy_seen = true;
-
- ActionParamsStruct params;
- params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN, 0);
- params.Set_Attack(enemy, 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- Commands->Start_Timer(obj, this, 2.0f, 1);
- }
- if (enemy_seen && timer_expired && (enemy_id == Commands->Get_ID(enemy)))
- {
- Commands->Debug_Message("**** Enemy still seen.\n");
- alert = true;
- }
- }
- };
- DECLARE_SCRIPT(DLS_Test_Pickup, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
- bool already_entered;
-
- enum {TROOP_PICKUP1, TROOP_PICKUP2, M06_STOP_PICKUP};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( debug_mode, 1 );
-
- }
-
- void Created (GameObject * obj)
- {
- Commands->Start_Timer (obj, this, 0.0f, TROOP_PICKUP1);
- already_entered = false;
- }
-
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == TROOP_PICKUP1 && (!already_entered))
- {
- float random = Commands->Get_Random(10.0f, 35.0f);
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(1.548f, -3.497f, 3.595f));
- Commands->Set_Facing(controller, 45.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X6I_TroopPickup.txt");
- Commands->Start_Timer (obj, this, random, TROOP_PICKUP2);
- Commands->Start_Timer (obj, this, random, TROOP_PICKUP1);
-
- }
- if(timer_id == TROOP_PICKUP2 && (!already_entered))
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(-58.759f, 29.089f, -6.875f));
- Commands->Set_Facing(controller, -90.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X6I_TroopPickup.txt");
- }
-
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if ((Commands->Is_A_Star(enterer)) && (!already_entered))
- {
- already_entered = true;
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if (type == M06_STOP_PICKUP)
- {
- already_entered = true;
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STOP_PICKUP, 1, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(100018), M06_STOP_PICKUP, 1, 0.0f);
- }
- }
-
- };
- DECLARE_SCRIPT (DLS_Flame_Tank_Test, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
- params.Set_Movement( Commands->Get_Position(obj), WALK, 1.5f );
- params.Set_Attack (Commands->Find_Object(100001), 250.0f, 0.0f, true);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
-
- };
- DECLARE_SCRIPT (DLS_Innate_Force_State, "")
- {
- enum {BULLET_HEARD, FOOTSTEPS_HEARD, GUNSHOTS_HEARD, ENEMY_SEEN};
- void Created (GameObject * obj)
- {
- Commands->Start_Timer (obj, this, 8.0f, FOOTSTEPS_HEARD);
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- Vector3 pos = Commands->Get_Position(obj);
- if(timer_id == FOOTSTEPS_HEARD)
- {
- Commands->Action_Reset(obj, 100.0f);
- Commands->Innate_Force_State_Footsteps_Heard(obj, pos);
- Commands->Start_Timer (obj, this, 5.0f, BULLET_HEARD);
- Commands->Debug_Message("**** Innate_Force_State_Footsteps_Heard.\n");
- }
- if(timer_id == BULLET_HEARD)
- {
-
- Commands->Innate_Force_State_Bullet_Heard(obj, pos);
- Commands->Start_Timer (obj, this, 5.0f, GUNSHOTS_HEARD);
- Commands->Debug_Message("**** Innate_Force_State_Bullet_Heard.\n");
- }
-
- if(timer_id == GUNSHOTS_HEARD)
- {
- Commands->Innate_Force_State_Gunshots_Heard(obj, pos);
- Commands->Start_Timer (obj, this, 5.0f, ENEMY_SEEN);
- Commands->Debug_Message("**** Innate_Force_State_Gunshots_Heard.\n");
- }
- if(timer_id == ENEMY_SEEN)
- {
- Commands->Innate_Force_State_Enemy_Seen(obj, STAR);
- Commands->Start_Timer (obj, this, 5.0f, FOOTSTEPS_HEARD);
- Commands->Debug_Message("**** Innate_Force_State_Enemy_Seen.\n");
- }
- }
-
- };
- DECLARE_SCRIPT (DLS_Cargo_Plane_Test, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- }
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- GameObject * chinook_obj = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(obj));
- Commands->Set_Facing(chinook_obj, 0.0f);
- // Commands->Attach_Script(chinook_obj, "Test_Cinematic", "X5D_C130Troopdrop.txt");
- Commands->Attach_Script(chinook_obj, "M00_C130_ParaDrop", "Nod_MiniGunner_0");
- }
-
- };
- DECLARE_SCRIPT(M00_C130_ParaDrop, "Preset:string")
- {
- int chinook_id;
- bool dead;
- int out;
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE(chinook_id, 1);
- SAVE_VARIABLE(dead, 2);
- SAVE_VARIABLE(out, 3);
- }
-
- void Created(GameObject * obj)
- {
- Vector3 loc = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
-
- GameObject *chinook_rail = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Model(chinook_rail, "X5D_Chinookfly");
- Commands->Set_Facing(chinook_rail, facing);
- Commands->Set_Animation(chinook_rail, "X5D_Chinookfly.X5D_Chinookfly", false);
- GameObject *chinook = Commands->Create_Object("Nod_Cargo_Plane", loc);
- Commands->Set_Facing(chinook, facing);
- Commands->Set_Animation(chinook, "vf_nod c-130.vf_nod c130", true);
- Commands->Attach_To_Object_Bone(chinook, chinook_rail, "BN_Chinook_1");
- dead = false;
- out = 0;
- char params[10];
- sprintf(params, "%d", Commands->Get_ID(obj));
- Commands->Attach_Script(chinook, "M00_Reinforcement_C130", params);
- chinook_id = Commands->Get_ID(chinook);
-
- // Destroy Chinook
- Commands->Start_Timer(obj, this, 280.0f/30.0f, 0);
- // Parachutes
- Commands->Start_Timer(obj, this, 169.0f/30.0f, 1);
- Commands->Start_Timer(obj, this, 179.0f/30.0f, 2);
- Commands->Start_Timer(obj, this, 198.0f/30.0f, 3);
- // Soldiers
- Commands->Start_Timer(obj, this, 145.0f/30.0f, 4);
- Commands->Start_Timer(obj, this, 155.0f/30.0f, 5);
- Commands->Start_Timer(obj, this, 165.0f/30.0f, 6);
-
- }
- void Timer_Expired(GameObject * obj, int timer_id)
- {
- Vector3 loc = Commands->Get_Position(obj);
- const char * preset = Get_Parameter("Preset");
- float facing = Commands->Get_Facing(obj);
- switch (timer_id)
- {
- case 0:
- GameObject *chinook;
- chinook = Commands->Find_Object(chinook_id);
- Commands->Destroy_Object(chinook);
- break;
- case 1:
- if (out >= 1)
- {
- GameObject *para1;
- para1 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Facing(para1, facing);
- Commands->Set_Model(para1, "X5D_Parachute");
- Commands->Set_Animation(para1, "X5D_Parachute.X5D_ParaC_1", false);
- Commands->Create_3D_Sound_At_Bone("parachute_open", para1, "ROOTTRANSFORM");
- Commands->Attach_Script(para1, "M03_No_More_Parachute", "");
- }
- break;
- case 2:
- if (out >= 2)
- {
- GameObject *para2;
- para2 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Facing(para2, facing);
- Commands->Set_Model(para2, "X5D_Parachute");
- Commands->Set_Animation(para2, "X5D_Parachute.X5D_ParaC_2", false);
- Commands->Create_3D_Sound_At_Bone("parachute_open", para2, "ROOTTRANSFORM");
- Commands->Attach_Script(para2, "M03_No_More_Parachute", "");
- }
- break;
- case 3:
- if (out == 3)
- {
- GameObject *para3;
- para3 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Facing(para3, facing);
- Commands->Set_Model(para3, "X5D_Parachute");
- Commands->Set_Animation(para3, "X5D_Parachute.X5D_ParaC_3", false);
- Commands->Create_3D_Sound_At_Bone("parachute_open", para3, "ROOTTRANSFORM");
- Commands->Attach_Script(para3, "M03_No_More_Parachute", "");
- }
- break;
- case 4:
- if (!dead)
- {
-
- GameObject *box1 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Model(box1, "X5D_Box01");
- Commands->Set_Facing(box1, facing);
- Commands->Set_Animation(box1, "X5D_Box01.X5D_Box01", false);
- GameObject *soldier1;
- soldier1 = Commands->Create_Object_At_Bone(box1, preset, "Box01");
- Commands->Set_Facing(soldier1, facing);
- Commands->Attach_To_Object_Bone( soldier1, box1, "Box01" );
- Commands->Set_Animation(soldier1, "s_a_human.H_A_X5D_ParaT_1", false);
- out++;
- if ((out - 1) == DIFFICULTY)
- {
- dead = true;
- }
-
- }
- break;
- case 5:
- if (!dead)
- {
- GameObject *box2 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Model(box2, "X5D_Box02");
- Commands->Set_Facing(box2, facing);
- Commands->Set_Animation(box2, "X5D_Box02.X5D_Box02", false);
- GameObject *soldier2;
- soldier2 = Commands->Create_Object_At_Bone(box2, preset, "Box02");
- Commands->Set_Facing(soldier2, facing);
- Commands->Set_Animation(soldier2, "s_a_human.H_A_X5D_ParaT_2", false);
- Commands->Attach_To_Object_Bone( soldier2, box2, "Box02" );
- out++;
- if ((out - 1) == DIFFICULTY)
- {
- dead = true;
- }
-
- }
- break;
- case 6:
- if (!dead)
- {
- GameObject *box3 = Commands->Create_Object("Generic_Cinematic", loc);
- Commands->Set_Model(box3, "X5D_Box03");
- Commands->Set_Facing(box3, facing);
- Commands->Set_Animation(box3, "X5D_Box03.X5D_Box03", false);
- GameObject *soldier3;
- soldier3 = Commands->Create_Object_At_Bone(box3, preset, "Box03");
- Commands->Set_Facing(soldier3, facing);
- Commands->Set_Animation(soldier3, "s_a_human.H_A_X5D_ParaT_3", false);
- Commands->Attach_To_Object_Bone( soldier3, box3, "Box03" );
- out++;
- if ((out - 1) == DIFFICULTY)
- {
- dead = true;
- }
-
- }
- break;
-
- }
- }
- void Custom(GameObject * obj, int type, int param, GameObject * sender)
- {
- if (type == 23000 && param == 23000)
- {
- dead = true;
- }
- }
- };
- DECLARE_SCRIPT(M00_Reinforcement_C130, "Controller_ID:int")
- {
- int sound_id;
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE(sound_id, 1);
- }
-
- void Created(GameObject * obj)
- {
- sound_id = Commands->Create_3D_Sound_At_Bone("C130_Idle_01", obj, "BODYMAIN");
- }
-
- void Killed(GameObject * obj, GameObject * killer)
- {
- GameObject * con = Commands->Find_Object(Get_Int_Parameter(0));
- Commands->Send_Custom_Event(obj, con, 23000, 23000);
- Commands->Stop_Sound(sound_id, true);
- }
- };
- DECLARE_SCRIPT(DLS_Test_Conversation, "Debug_Mode=0:int")
- {
- bool debug_mode;
-
- void Created(GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
-
- void Poked(GameObject * obj, GameObject * poker)
- {
-
- const char *conv_name = ("IDS_M00_Test");
- int conv_id = Commands->Create_Conversation (conv_name);
- Commands->Join_Conversation(Commands->Get_A_Star(Commands->Get_Position(obj)), conv_id, false, true);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 300001);
- Commands->Monitor_Conversation (obj, conv_id);
-
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- SCRIPT_DEBUG_MESSAGE (("Action_Complete action_id %d reason %d.\n", action_id, reason));
-
- }
- };
- DECLARE_SCRIPT(DLS_Test_Zone_Timer, "Debug_Mode=0:int")
- {
-
- bool debug_mode;
-
-
-
- void Created (GameObject * obj)
- {
- SCRIPT_DEBUG_MESSAGE (("DLS_Test_Zone_Timer Created.\n"));
- Commands->Enable_Hibernation(obj, false);
- Commands->Start_Timer(obj, this, 1.0f, 666);
- }
-
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- SCRIPT_DEBUG_MESSAGE (("Timer_Expired on DLS_Test_Zone_Timer timer_id: %d.\n", timer_id));
- Commands->Start_Timer(obj, this, 1.0f, 666);
-
- }
- };
- DECLARE_SCRIPT(DLS_Drop_Unit, "Box_ID:int")
- {
-
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- int box_id = Get_Int_Parameter("Box_ID");
- switch(box_id)
- {
- case 1:
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "No_Definition.txt");
- }
- break;
- case 2:
- {
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "No_Definition2.txt");
- }
- break;
- }
- }
- };
- DECLARE_SCRIPT(DLS_CNC_Sound, "Box_ID:int")
- {
-
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- Commands->Create_Sound ( "CnC_Healer_Sound", Commands->Get_Position(obj), obj );
- }
- };
- DECLARE_SCRIPT(DLS_Spawn_Engineer, "")
- {
-
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
- Commands->Enable_Spawner(100001, true);
- }
- };
- DECLARE_SCRIPT(DLS_Spawn_Engineer2, "")
- {
-
-
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- Commands->Set_Health(obj, Commands->Get_Max_Health(obj));
- Commands->Enable_Spawner(100001, false);
- }
- };
- DECLARE_SCRIPT(DLS_Test_Homepoint, "")
- {
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Soldier_Home_Location(obj, Commands->Get_Position(obj), 2.0f);
- }
- };
-
- DECLARE_SCRIPT (DLS_Test_Apache, "")
- {
-
- void Created (GameObject *obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, 100, 10 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
- params.WaypathID = 2000222;
- params.WaypathSplined = true;
- Commands->Action_Goto( obj, params );
- }
- };
- DECLARE_SCRIPT (DLS_Test_Tank, "")
- {
-
- void Created (GameObject *obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, 100, 10 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 2.0f );
- params.WaypathID = 100002;
- params.WaypathSplined = true;
- Commands->Action_Goto( obj, params );
- }
- };
- DECLARE_SCRIPT (DLS_Goto_Unit, "")
- {
- enum{GO_STAR};
- void Created (GameObject *obj)
- {
- ActionParamsStruct params;
- Commands->Start_Timer (obj, this, 5.0f, GO_STAR);
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == GO_STAR)
- {
- params.Set_Basic( this, 100, 10 );
- params.Set_Movement( STAR, 1.0f, 2.0f );
- Commands->Action_Goto( obj, params );
- }
-
- }
- };
- DECLARE_SCRIPT (DLS_Playertype, "")
- {
- void Created (GameObject *obj)
- {
-
- }
- void Poked(GameObject * obj, GameObject * poker)
- {
- Commands->Set_Player_Type(obj, SCRIPT_PLAYERTYPE_GDI );
- Commands->Give_PowerUp(obj, "MG Weapon 1 Clip PowerUp");
- Commands->Give_PowerUp(obj, "MiniGun 2 Clips PU");
-
- }
- };
- DECLARE_SCRIPT (DLS_No_Innate, "")
- {
- void Created (GameObject *obj)
- {
- Commands->Innate_Disable(obj);
- }
-
- };
-
- DECLARE_SCRIPT(DLS_ActionComplete_Test, "")
- {
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
-
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 16 );
- params.Set_Movement( Vector3(0,0,0), 1.0f, 1.5f );
- params.WaypathID = 100001;
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- Commands->Debug_Message("Action_Complete %d %d. \n", action_id, reason);
- }
- };
- DECLARE_SCRIPT(DLS_Artillery_Test, "")
- {
- int artillery_loc[2];
- enum{ARTILLERY_DROP};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( poke_id, 1 );
- }
- void Created (GameObject *game_obj)
- {
- artillery_loc[0] = 100600;
- artillery_loc[1] = 100601;
- Commands->Start_Timer(game_obj, this, 10.0F, ARTILLERY_DROP);
- }
- void Timer_Expired (GameObject *game_obj, int timer_id)
- {
- if (timer_id == ARTILLERY_DROP)
- {
-
- }
- return ;
- }
- };
- DECLARE_SCRIPT(DLS_Cinematic_Test, "")
- {
- void Created (GameObject * obj)
- {
- /* Commands->Enable_Hibernation(obj, false);
- Commands->Set_Player_Type(obj, PLAYERTYPE_NEUTRAL );
- Commands->Create_Object ( "XG_TransprtBone", Vector3(0.0f, 0.0f, 0.0f));*/
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- /* GameObject * chinook_obj0 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj0, 0.0f);
- Commands->Attach_Script(chinook_obj0, "Test_Cinematic", "X7A_TrnsptCt_00.txt");
- GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj1, 0.0f);
- Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7A_TrnsptCt_01.txt");*/
- GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj2, 0.0f);
- Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "XG_EV5.txt");
- /* GameObject * nukebits = Commands->Create_Object("M07_Nukebits", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing( nukebits, -10.000f );*/
- // GameObject * napc = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- // Commands->Set_Model(napc, "e_chopperdust1");
- /* Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), M07_EVAC_INN, 1, 0.0f);
- Commands->Enable_Spawner(100002, true);
- Commands->Enable_Spawner(100004, true);
- Commands->Enable_Spawner(100005, true);
- Commands->Enable_Spawner(100006, true);
- Commands->Enable_Spawner(100007, true);*/
- }
- };
- DECLARE_SCRIPT(DLS_SSM_Test, "")
- {
- int ssm_missile_id;
- void Created (GameObject * obj)
- {
- GameObject * ssm_missile = Commands->Create_Object_At_Bone(obj, "Invisible_Object", "V_LAUNCHER");
- Commands->Set_Model(ssm_missile, "V_AG_NOD_SSM_MS");
- Commands->Attach_To_Object_Bone(ssm_missile, obj, "V_LAUNCHER");
- ssm_missile_id = Commands->Get_ID(ssm_missile);
- }
- void Damaged( GameObject * obj, GameObject * damager )
- {
- Commands->Set_Animation(obj, "V_NOD_SSM.V_NOD_SSM", 0);
- Commands->Set_Animation(Commands->Find_Object(ssm_missile_id), "v_nod_ssm_Missl.v_nod_ssm_Missl", 0);
- }
- };
- DECLARE_SCRIPT(DLS_Cinematic_Test2, "")
- {
- void Created (GameObject * obj)
- {
- /* Commands->Enable_Hibernation(obj, false);
- Commands->Set_Player_Type(obj, PLAYERTYPE_NEUTRAL );
- Commands->Create_Object ( "XG_TransprtBone", Vector3(0.0f, 0.0f, 0.0f));*/
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- /* GameObject * chinook_obj0 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj0, 0.0f);
- Commands->Attach_Script(chinook_obj0, "Test_Cinematic", "X7A_TrnsptCt_00.txt");
- GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj1, 0.0f);
- Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7A_TrnsptCt_01.txt");*/
- GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj2, 0.0f);
- Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X6C_MIDTRO.txt");
- /* Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), M07_EVAC_INN, 1, 0.0f);
- Commands->Enable_Spawner(100002, true);
- Commands->Enable_Spawner(100004, true);
- Commands->Enable_Spawner(100005, true);
- Commands->Enable_Spawner(100006, true);
- Commands->Enable_Spawner(100007, true);*/
- }
- };
- DECLARE_SCRIPT(DLS_Where_Am_I, "")
- {
- enum{WHERE_AM_I};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- // SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created (GameObject * obj)
- {
- Vector3 pos = Commands->Get_Position(obj);
- const char * preset_name = Commands->Get_Preset_Name( obj );
- Commands->Debug_Message("%s at: X:%f Y:%f Z:%f \n", preset_name, pos.X, pos.Y, pos.Z);
- Commands->Start_Timer (obj, this, 3.0f, WHERE_AM_I);
-
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == WHERE_AM_I)
- {
- Vector3 pos = Commands->Get_Position(obj);
- const char * preset_name = Commands->Get_Preset_Name( obj );
- Commands->Debug_Message("%s at: X:%f Y:%f Z:%f \n", preset_name, pos.X, pos.Y, pos.Z);
- Commands->Start_Timer (obj, this, 3.0f, WHERE_AM_I);
-
- }
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Test_Flyovers, "")
- {
- enum{WHERE_AM_I};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
-
- // SAVE_VARIABLE( debug_mode, 2 );
- }
- void Created (GameObject * obj)
- {
-
- Commands->Start_Timer (obj, this, 17.0f, WHERE_AM_I);
-
-
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == WHERE_AM_I)
- {
-
- GameObject * chinook_obj1 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj1, 0.0f);
- Commands->Attach_Script(chinook_obj1, "Test_Cinematic", "X7A_Apache_00.txt");
- GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj2, 0.0f);
- Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "X7A_CPlane_00.txt");
- GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj3, 0.0f);
- Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "X7A_TrnsptCt_00.txt");
- Commands->Start_Timer (obj, this, 17.0f, WHERE_AM_I);
-
- }
-
- }
-
- };
- DECLARE_SCRIPT(DLS_Test_Hand_Over_Head, "")
- {
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( poked, 1 );
- }
- void Created(GameObject * obj)
- {
- ActionParamsStruct params;
- Commands->Innate_Disable(obj);
- params.Set_Basic(this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10);
- params.Set_Animation("S_A_HUMAN.H_A_Host_L2b", true);
- Commands->Action_Play_Animation(obj, params);
- }
- };
- DECLARE_SCRIPT(DLS_Created_Too_Early, "")
- {
- void Created (GameObject * obj)
- {
- // Commands->Enable_Hibernation(obj, false);
- // Commands->Set_Player_Type(obj, PLAYERTYPE_NEUTRAL );
- // Commands->Create_Object ( "XG_TransprtBone", Vector3(0.0f, 0.0f, 0.0f));
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj3, 0.0f);
- Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "Created_Too_Early.txt");
- }
- };
- DECLARE_SCRIPT(DLS_Blink, "")
- {
- void Created (GameObject * obj)
- {
- // Commands->Enable_Hibernation(obj, false);
- // Commands->Set_Player_Type(obj, PLAYERTYPE_NEUTRAL );
- // Commands->Create_Object ( "XG_TransprtBone", Vector3(0.0f, 0.0f, 0.0f));
- }
- void Damaged( GameObject * obj, GameObject * damager, float amount )
- {
- GameObject * chinook_obj3 = Commands->Create_Object ( "Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(chinook_obj3, 0.0f);
- Commands->Attach_Script(chinook_obj3, "Test_Cinematic", "Blink.txt");
- }
- };
- DECLARE_SCRIPT(DLS_Math, "")
- {
- void Created (GameObject * obj)
- {
- Vector3 pos = Commands->Get_Position(obj);
- float facing = Commands->Get_Facing(obj);
- float a = cos(DEG_TO_RADF(facing));
- float b = sin(DEG_TO_RADF(facing));
- Commands->Debug_Message("", a);
- Commands->Debug_Message("", b);
- }
- };
- DECLARE_SCRIPT(DLS_Test_Evac, "") // Deadeye2
- {
- enum{WAYPATH};
-
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( nuke_blast, 1 );
- }
- void Created(GameObject * obj)
- {
- Commands->Set_Animation ( obj, "S_A_Human.XG_EV5_troop", true );
- Commands->Enable_Hibernation(obj, false);
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, WAYPATH );
- params.Set_Movement( Vector3(0,0,0), RUN, 1.5f );
- params.WaypathID = 100008;
- Commands->Action_Goto( obj, params );
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if (action_id == WAYPATH)
- {
- int dead6_id = Commands->Get_ID(obj);
- Commands->Send_Custom_Event(obj, Commands->Find_Object(100001), M07_DEAD6_EVAC, dead6_id, 0.0f);
- }
-
- }
- };
- DECLARE_SCRIPT(DLS_Innate_Disable, "") // Deadeye2
- {
- void Created(GameObject * obj)
- {
- Commands->Innate_Disable(obj);
- }
- };
- /**********************************************************************************************
- /*
- /*
- /*
- /* MX0
- /*
- /*
- /*
- /**********************************************************************************************/
- // MX0 Custom Enumerations
- enum
- {
- MX0_STAR_AREA = 445000, // 0
- MX0_VEHICLE_MOVE, // 1
- MX0_SPECIFIC_ACTION, // 2
- MX0_OBELISK_HUMVEE, // 3
- MX0_OBELISK_DRIVER, // 4
- MX0_OBELISK_MEDIUM_TANK, // 5
- MX0_SOLDIER_MOVE, // 6
- MX0_FIRE_SAM, // 7 Hardcoded into X0E_Obelisk.txt
- MX0_A10_STRIKE, // 8
- MX0_MISSION_SUCCESS, // 9 Hardcoded into X0Z_Finale.txt
- MX0_DISCOVERS_NOD_BASE, // 10
- MX0_HUMVEE_DRIVER_COWER, // 11
- MX0_ROCKETTROOPER_SEES_OBELISK, // 12
- MX0_ROCKETTROOPER_HOT_OBELISK, // 13
- MX0_ROCKETTROOPER_OBELISK_DOWN, // 14
- MX0_ROCKETTROOPER_TAKE_SAMS, // 15
- MX0_ROCKETTROOPER_SAMS_HISTORY, // 16
- MX0_TROOPER_UP_ON_WALL, // 17
- MX0_DESTROY_OBELISK, // 18 Hardcoded into X0E_Obelisk.txt
- MX0_GDI_REINFORCEMENT_KILLED, // 19
- MX0_NEED_YOU_HERE, // 20
- MX0_ROCKETTROOPER_CANT_TURN_BACK, // 21
-
- };
- #define WRONG_WAY_CONV_TABLE_SIZE ( sizeof(Wrong_Way_Conv_Table) / sizeof (Wrong_Way_Conv_Table[0]) )
- const char * Wrong_Way_Conv_Table[] =
- {
- "MX0_A04_CON015", // You’re going the wrong way, Havoc!
- "MX0_A04_CON016", // Stay with the Mission, Havoc!
- "MX0_A04_CON017", // This area is already secure.
- "MX0_A04_CON018", // Havoc, Did I say retreat? Now Turn Around!
- };
- DECLARE_SCRIPT (MX0_Area4_Controller_DLS, "")
- {
- int star_area;
- bool area4_activated;
- int humvee_id;
- int medium_tank_blasted_id;
- int medium_tank_escort_id;
- int light_tank_a_id;
- int light_tank_b_id;
- int nod_base_rocketsoldier_a_id;
- int nod_base_rocketsoldier_b_id;
- int player_tank_id;
- int gdi_trooper1_id;
- int gdi_trooper2_id;
- int gdi_trooper3_id;
- int obelisk_id;
- int obelisk_weapon_id;
- int obelisk_orca_id;
- int mobile_artillery_id;
- bool orca_strike;
- int basewall_id;
- bool say_take_out_sams;
- int mx0_gdi_reinforcement_killed;
- int gdi_reinforcement1_id;
- int gdi_reinforcement2_id;
- int conv_num;
- int say_need_here;
-
- enum
- {
- AREA4_ACTIVATED = 0,
- HUMMVEE_DESTRUCTION,
- MEDIUM_TANK_DESTRUCTION,
- OBELISK_DESTRUCTION,
- SAMS_DESTRUCTION,
- A10_STRIKE,
- ION_CANNON_STRIKE,
- ORCA_STRIKE1,
- ORCA_STRIKE2,
- FINALE,
- CONVERSATION_HAVOC_TAKE_OUT_SAMS,
- A10_HIT,
- DESTROY_SAM1,
- DESTROY_SAM2,
- FLASH_TO_WHITE,
- };
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( star_area, 1 );
- SAVE_VARIABLE( area4_activated, 2 );
- SAVE_VARIABLE( humvee_id, 3 );
- SAVE_VARIABLE( medium_tank_blasted_id, 4 );
- SAVE_VARIABLE( medium_tank_escort_id, 5 );
- SAVE_VARIABLE( light_tank_a_id, 6 );
- SAVE_VARIABLE( light_tank_b_id, 7 );
- SAVE_VARIABLE( nod_base_rocketsoldier_a_id, 8 );
- SAVE_VARIABLE( nod_base_rocketsoldier_b_id, 9 );
- SAVE_VARIABLE( player_tank_id, 10 );
- SAVE_VARIABLE( gdi_trooper1_id, 11 );
- SAVE_VARIABLE( gdi_trooper2_id, 12 );
- SAVE_VARIABLE( gdi_trooper3_id, 13 );
- SAVE_VARIABLE( obelisk_id, 14 );
- SAVE_VARIABLE( obelisk_weapon_id, 15 );
- SAVE_VARIABLE( obelisk_orca_id, 16 );
- SAVE_VARIABLE( mobile_artillery_id, 17 );
- SAVE_VARIABLE( orca_strike, 18 );
- SAVE_VARIABLE( basewall_id, 19 );
- SAVE_VARIABLE( say_take_out_sams, 20 );
- SAVE_VARIABLE( mx0_gdi_reinforcement_killed, 21 );
- SAVE_VARIABLE( gdi_reinforcement1_id, 22 );
- SAVE_VARIABLE( gdi_reinforcement2_id, 23 );
- SAVE_VARIABLE( conv_num, 24 );
- SAVE_VARIABLE( say_need_here, 25 );
- }
- void Created( GameObject * obj )
- {
- star_area = 0;
- area4_activated = false;
- // Scale up the sight range of all units in game
- Commands->Scale_AI_Awareness(3.0f, 1.0f);
- say_take_out_sams = false;
- orca_strike = false;
- // Reinforcement counter
- mx0_gdi_reinforcement_killed = 0;
- // Wrong Way conversation
- conv_num = 0;
- // Rocket Trooper telling Havoc need up here
- say_need_here = false;
- }
- void Custom( GameObject * obj, int type, int param, GameObject * sender )
- {
- if(type == MX0_DESTROY_OBELISK)
- {
- // Remove old Obelisk
- Commands->Destroy_Object(Commands->Find_Object(obelisk_id));
- }
- // What zone is the star in?
- if(type == MX0_STAR_AREA)
- {
- star_area = param;
- if(star_area == 1 && !area4_activated)
- {
- area4_activated = true;
- Commands->Start_Timer (obj, this, 3.0f, AREA4_ACTIVATED);
- // Start area4 actors
- // Additional GDI troop drop
- // GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(Commands->Find_Object(1500051)));
- // Commands->Set_Facing(chinook_obj2, 0.0f);
- // Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "MX0_GDI_TroopDrop_Area4.txt");
- // Humvee
- GameObject * humvee = Commands->Find_Object(humvee_id);
- Commands->Attach_Script(humvee, "MX0_Vehicle_DLS", "1500018, 1500019, 0, 0, 0.5f");
- Commands->Attach_Script(humvee, "MX0_GDI_Killed_DLS", "1");
-
- // Medium Tank Blasted *** Ajdusted 12/12/01 No longer gets destroyed
- GameObject * medium_tank_blasted = Commands->Find_Object(medium_tank_blasted_id);
- Commands->Attach_Script(medium_tank_blasted, "MX0_Vehicle_DLS", "1500022, 1500023, 0, 0, 1.0f");
- Commands->Attach_Script(medium_tank_blasted, "MX0_GDI_Killed_DLS", "2");
- Commands->Attach_Script(medium_tank_blasted, "M00_Damage_Modifier_DME", ".10f,1,1,1,1");
- // Medium Tank Escort
- GameObject * medium_tank_escort = Commands->Find_Object(medium_tank_escort_id);
- Commands->Attach_Script(medium_tank_escort, "MX0_Vehicle_DLS", "1500027, 1500028, 1500029, 0, 1.0f");
-
- // GDI Trooper 1
- GameObject * gdi_trooper1 = Commands->Find_Object(gdi_trooper1_id);
- Commands->Attach_Script(gdi_trooper1, "MX0_GDI_Soldier_DLS", "1500049, 1500050, 0, 0, 0.8f");
- // GDI RocketTrooper
- GameObject * gdi_trooper2 = Commands->Create_Object("GDI_RocketSoldier_0", Vector3(51.644f, 27.306f, 4.850f));
- Commands->Attach_Script(gdi_trooper2, "M00_Send_Object_ID", "1500017, 12, 0.0f");
- Commands->Attach_Script(gdi_trooper2, "MX0_GDI_Soldier_DLS", "1500053, 1500070, 0, 0, 0.8f");
- // Humvee announces discovery of Nod Base
- Commands->Send_Custom_Event( obj, Commands->Find_Object(humvee_id), MX0_SPECIFIC_ACTION, MX0_DISCOVERS_NOD_BASE, 0.0f);
- }
- }
- // Actor IDs
- if(type == M00_SEND_OBJECT_ID)
- {
- if(param == 1)
- {
- humvee_id = Commands->Get_ID(sender);
- }
- if(param == 3)
- {
- medium_tank_blasted_id = Commands->Get_ID(sender);
- }
- if(param == 4)
- {
- medium_tank_escort_id = Commands->Get_ID(sender);
- }
- if(param == 5)
- {
- light_tank_a_id = Commands->Get_ID(sender);
- }
- if(param == 6)
- {
- light_tank_b_id = Commands->Get_ID(sender);
- }
- if(param == 8)
- {
- nod_base_rocketsoldier_a_id = Commands->Get_ID(sender);
- }
- if(param == 9)
- {
- nod_base_rocketsoldier_b_id = Commands->Get_ID(sender);
- }
- if(param == 10)
- {
- player_tank_id = Commands->Get_ID(sender);
- }
- if(param == 11)
- {
- gdi_trooper1_id = Commands->Get_ID(sender);
- }
- if(param == 12)
- {
- gdi_trooper2_id = Commands->Get_ID(sender);
- }
- if(param == 13)
- {
- gdi_trooper3_id = Commands->Get_ID(sender);
- }
- if(param == 14)
- {
- obelisk_id = Commands->Get_ID(sender);
- }
- if(param == 15)
- {
- obelisk_weapon_id = Commands->Get_ID(sender);
- }
- if(param == 16)
- {
- obelisk_orca_id = Commands->Get_ID(sender);
- }
- if(param == 17)
- {
- mobile_artillery_id = Commands->Get_ID(sender);
- }
- if(param == 18)
- {
- basewall_id = Commands->Get_ID(sender);
- }
- if(param == 19)
- {
- gdi_reinforcement1_id = Commands->Get_ID(sender);
- }
- if(param == 20)
- {
- gdi_reinforcement2_id = Commands->Get_ID(sender);
- }
-
- }
- // Commands for SAMs to fire on incoming Orca
- if (type == MX0_FIRE_SAM)
- {
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500015), MX0_FIRE_SAM, obelisk_orca_id, 0.0f);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500016), MX0_FIRE_SAM, obelisk_orca_id, 0.0f);
- }
- // Commands to destroy Mobile Artillery in front of base
- if (type == MX0_A10_STRIKE)
- {
- Commands->Apply_Damage( Commands->Find_Object(mobile_artillery_id), 50000.0f, "STEEL");
- }
- // Finale concludes, mission success
- if(type == MX0_MISSION_SUCCESS)
- {
- Commands->Mission_Complete(true);
- }
- if(type == MX0_GDI_REINFORCEMENT_KILLED)
- {
- mx0_gdi_reinforcement_killed++;
- if(mx0_gdi_reinforcement_killed == 2)
- {
- mx0_gdi_reinforcement_killed = 0;
- // Additional GDI troop drop
- GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(Commands->Find_Object(1500102)));
- Commands->Set_Facing(chinook_obj2, Commands->Get_Facing(Commands->Find_Object(1500102)));
- Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "MX0_GDI_Reinforce_Area4.txt");
- }
- }
- }
- // Simple Function to move reinforcement troops
- void Relocate_Soldiers (GameObject * obj)
- {
- // Initial Chinook Drops
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SOLDIER_MOVE, 1, 0.0f);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper3_id), MX0_SOLDIER_MOVE, 1, 0.0f);
- // GDI Reinforcements
- int rand = Commands->Get_Random_Int(0, 3);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_reinforcement1_id), MX0_SOLDIER_MOVE, rand, 0.0f);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_reinforcement2_id), MX0_SOLDIER_MOVE, rand, 0.0f);
- }
- void Wrong_Way(GameObject * obj)
- {
-
- if(conv_num == WRONG_WAY_CONV_TABLE_SIZE)
- {
- conv_num = 0;
- }
-
- const char *conv_name = Wrong_Way_Conv_Table[conv_num];
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- conv_num++;
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == AREA4_ACTIVATED)
- {
- if(star_area > 0) // Area 2 or Area 3
- {
- // Start moving convoy forward with all GDI troops
- // Humvee
- Commands->Send_Custom_Event( obj, Commands->Find_Object(humvee_id), MX0_VEHICLE_MOVE, 1, 0.0f);
- // Medium Tank Blasted
- Commands->Send_Custom_Event( obj, Commands->Find_Object(medium_tank_blasted_id), MX0_VEHICLE_MOVE, 1, 0.0f);
- // Medium Tank Escort
- Commands->Send_Custom_Event( obj, Commands->Find_Object(medium_tank_escort_id), MX0_VEHICLE_MOVE, 1, 0.0f);
- // GDI Trooper 1
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper1_id), MX0_SOLDIER_MOVE, 1, 0.0f);
- // Relocate GDI Trooper2 & GDI Trooper3
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SOLDIER_MOVE, 1, 0.0f);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper3_id), MX0_SOLDIER_MOVE, 1, 0.0f);
-
- // Light Tank A
- GameObject * light_tank_a = Commands->Find_Object(light_tank_a_id);
- Commands->Attach_Script(light_tank_a, "MX0_Vehicle_DLS", "1500033, 1500034, 0, 0, 0.4f");
- // Light Tank B
- GameObject * light_tank_b = Commands->Find_Object(light_tank_b_id);
- Commands->Attach_Script(light_tank_b, "MX0_Vehicle_DLS", "0, 0, 0, 0, 0.0f");
- // Mobile Artillery
- GameObject * mobile_artillery = Commands->Find_Object(mobile_artillery_id);
- Commands->Attach_Script(mobile_artillery, "MX0_Vehicle_DLS", "1500084, 1500085, 0, 0, 1.0f");
- // Move Nod tanks into position on far side of river
- Commands->Start_Timer (obj, this, 2.0f, HUMMVEE_DESTRUCTION);
- // Humvee is now vulnerable
- Commands->Send_Custom_Event( obj, Commands->Find_Object(humvee_id), M00_ENABLE_DAMAGE_MOD, 0, 0.0f);
- // RocketTrooper sees Obelisk
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper1_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_SEES_OBELISK, 4.0f);
-
- }
- else
- {
- if(!say_need_here)
- {
- say_need_here = true;
- // We need you up here, Sir.
- Commands->Send_Custom_Event( obj, Commands->Find_Object(humvee_id), MX0_SPECIFIC_ACTION, MX0_NEED_YOU_HERE, 0.0f);
- }
- // "We need you Commando"
- Commands->Start_Timer (obj, this, 2.0f, AREA4_ACTIVATED);
- }
- }
- if(timer_id == HUMMVEE_DESTRUCTION)
- {
- if(star_area > 1) // Area 2 or Area 3
- {
-
- // Light Tank A
- Commands->Send_Custom_Event( obj, Commands->Find_Object(light_tank_a_id), MX0_VEHICLE_MOVE, 1, 0.0f);
-
- // Obelisk blasts Hummvee
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500020), MX0_OBELISK_HUMVEE, 1, 0.0f);
- // *** Adjusted 12/12/01 Medium Tank no longer destroyed, run through function anyways
- // Obelisk blasts GDI Medium Tank
- Commands->Start_Timer (obj, this, 0.0f, MEDIUM_TANK_DESTRUCTION);
- // RocketTrooper - The Obelisk is hot! Look out!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper1_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_HOT_OBELISK, 4.0f);
- // Relocate Troops
- Relocate_Soldiers (obj);
- }
- else
- {
- // We need your help - over here, Sir!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_CANT_TURN_BACK, 0.0f);
- // "We need you Commando"
- Commands->Start_Timer (obj, this, 6.0f, HUMMVEE_DESTRUCTION);
- }
-
- }
- if(timer_id == MEDIUM_TANK_DESTRUCTION)
- {
- switch(star_area)
- {
- case 0:
- case 1:
- {
- Wrong_Way(obj);
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, MEDIUM_TANK_DESTRUCTION);
- }
- break;
- case 2:
- {
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, MEDIUM_TANK_DESTRUCTION);
- }
- break;
- case 3:
- {
- // Activate Wall Nod Rocket Soldiers
- Commands->Enable_Spawner(1500042, true);
- Commands->Enable_Spawner(1500044, true);
- // Activate Wall Gun Emplacement
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500039), MX0_SPECIFIC_ACTION, 1, 0.0f);
- // Obelisk blasts GDI Medium Tank **** Ajdusted 12/12/01 No longer destroy tank
- // Commands->Send_Custom_Event( obj, Commands->Find_Object(1500020), MX0_OBELISK_MEDIUM_TANK, 2, 0.0f);
-
- // Relocate Medium Tank Escort
- Commands->Send_Custom_Event( obj, Commands->Find_Object(medium_tank_escort_id), MX0_VEHICLE_MOVE, 2, 0.0f);
- // Mobile Artillery
- Commands->Send_Custom_Event( obj, Commands->Find_Object(mobile_artillery_id), MX0_VEHICLE_MOVE, 1, 0.0f);
-
- // Orca is shot down with SAMs, slams into Obelisk
- Commands->Start_Timer (obj, this, 8.0f, OBELISK_DESTRUCTION);
- // Begin reinforcing GDI via Chinook
- // Additional GDI troop drop
- GameObject * chinook_obj2 = Commands->Create_Object ( "Invisible_Object", Commands->Get_Position(Commands->Find_Object(1500102)));
- Commands->Set_Facing(chinook_obj2, Commands->Get_Facing(Commands->Find_Object(1500102)));
- Commands->Attach_Script(chinook_obj2, "Test_Cinematic", "MX0_GDI_Reinforce_Area4.txt");
- // Relocate Troops
- Relocate_Soldiers (obj);
- }
- break;
- }
-
- }
- if(timer_id == OBELISK_DESTRUCTION)
- {
- switch(star_area)
- {
- case 0:
- case 1:
- {
- Wrong_Way(obj);
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, OBELISK_DESTRUCTION);
- }
- break;
- case 2:
- {
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, OBELISK_DESTRUCTION);
- }
- break;
- case 3:
- {
- // Orca Mix
- Commands->Create_2D_Sound("MX0_A4_Orca_Mix");
- // Cinematic of Orca
- // Shot down by SAMs, slams into Obelisk
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X0E_Obelisk.txt");
-
- // Remove Obelisk weapon
- Commands->Destroy_Object(Commands->Find_Object(obelisk_weapon_id));
-
- // Orcas sweeping in to take out Obelisk
- Commands->Start_Timer (obj, this, 5.0f, ORCA_STRIKE1);
- Commands->Start_Timer (obj, this, 10.0f, ORCA_STRIKE2);
- orca_strike = true;
-
- // Commando, take out those SAMs
- Commands->Start_Timer (obj, this, 8.0f, CONVERSATION_HAVOC_TAKE_OUT_SAMS);
- // Nod soldiers being shot off balcony
- Commands->Start_Timer (obj, this, 2.0f, SAMS_DESTRUCTION);
-
- // Relocate Troops
- Relocate_Soldiers (obj);
- }
- break;
- }
-
- }
- // Commando, take out those SAMs
- if(timer_id == CONVERSATION_HAVOC_TAKE_OUT_SAMS)
- {
- // Havoc, you’ve got to clear out those SAM sites!
- const char *conv_name = ("MX0_A04_CON005");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- // RocketTrooper - It’s down! The Obelisk is down!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_OBELISK_DOWN, 3.0f);
- }
- if(timer_id == SAMS_DESTRUCTION)
- {
- switch(star_area)
- {
- case 0:
- case 1:
- {
- Wrong_Way(obj);
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, SAMS_DESTRUCTION);
- }
- break;
- case 2:
- {
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, SAMS_DESTRUCTION);
- }
- break;
- case 3:
- {
- // If the SAMs still exist get Havoc to take them out
- if(Commands->Find_Object(1500015) || Commands->Find_Object(1500016))
- {
- // Orcas sweeping in to take out Obelisk
- Commands->Start_Timer (obj, this, 5.0f, ORCA_STRIKE1);
- Commands->Start_Timer (obj, this, 10.0f, ORCA_STRIKE2);
- orca_strike = false;
-
- // Commando, take out those SAMs ** Only say it once
- if(!say_take_out_sams)
- {
- say_take_out_sams = true;
- // RocketTrooper - Go! Go! Knock out those SAMs!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_TAKE_SAMS, 9.0f);
- // Send custom to disable damage modifier on SAMs
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500015), M00_ENABLE_DAMAGE_MOD, 0, 0.0f);
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500016), M00_ENABLE_DAMAGE_MOD, 0, 0.0f);
- // Start timer to take out SAMs regardless of player intervention
- Commands->Start_Timer (obj, this, 20.0f, DESTROY_SAM1);
- Commands->Start_Timer (obj, this, 24.0f, DESTROY_SAM2);
- }
- // Nod soldiers being shot off balcony
- Commands->Start_Timer (obj, this, 5.0f, SAMS_DESTRUCTION);
- }
- // If SAMs no longer exist, trigger A10 strike
- else
- {
- //Nice job Havoc
- // RocketTrooper - The SAMs are history!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper2_id), MX0_SPECIFIC_ACTION, MX0_ROCKETTROOPER_SAMS_HISTORY, 0.0f);
- // Trooper1 - There, on the wall!
- Commands->Send_Custom_Event( obj, Commands->Find_Object(gdi_trooper1_id), MX0_SPECIFIC_ACTION, MX0_TROOPER_UP_ON_WALL, 2.0f);
- // Nod RocketSoldier on base wall fire at Havoc's tank
- Commands->Send_Custom_Event (obj, Commands->Find_Object(nod_base_rocketsoldier_a_id), MX0_SPECIFIC_ACTION, player_tank_id, 0.0f);
- Commands->Send_Custom_Event (obj, Commands->Find_Object(nod_base_rocketsoldier_b_id), MX0_SPECIFIC_ACTION, player_tank_id, 0.0f);
-
- // A10 strike and destruction
- Commands->Start_Timer (obj, this, 5.0f, A10_STRIKE);
- }
-
- }
- break;
- }
-
- }
- if(timer_id == DESTROY_SAM1)
- {
- Commands->Apply_Damage(Commands->Find_Object(1500015), 50000.0f, "STEEL");
- }
- if(timer_id == DESTROY_SAM2)
- {
- Commands->Apply_Damage(Commands->Find_Object(1500016), 50000.0f, "STEEL");
- }
- if(timer_id == A10_STRIKE)
- {
- switch(star_area)
- {
- case 0:
- case 1:
- {
- Wrong_Way(obj);
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, A10_STRIKE);
- }
- break;
- case 2:
- {
- // Shouts from units calling Havoc back
- Commands->Start_Timer (obj, this, 5.0f, A10_STRIKE);
- }
- break;
- case 3:
- {
- // Start A10 - Outro muzak
- Commands->Fade_Background_Music( "Renegade_A10_Outro.mp3", 1, 1);
- // A10 - This is Eagle Claw 1 –Starting attack run
- const char *conv_name = ("MX0_A04_CON010");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- // A10 - I’m hit! I’m hit!
- Commands->Start_Timer (obj, this, 5.0f, A10_HIT);
- // A10 cinematic
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X0D_A10_Crash.txt");
-
- // Apaches rise up from behind wall, Ion cannon strike
- Commands->Start_Timer (obj, this, 6.0f, ION_CANNON_STRIKE);
- // Relocate Troops
- Relocate_Soldiers (obj);
- }
- break;
- }
-
- }
- // A10 - I’m hit! I’m hit!
- if(timer_id == A10_HIT)
- {
- const char *conv_name = ("MX0_A04_CON011");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- }
- if(timer_id == ION_CANNON_STRIKE)
- {
- // We have a lock on that base
- // This is Eagle Base. I’m not risking any more pilots.
- const char *conv_name = ("MX0_A04_CON012");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 1);
- // Ion Cannon strike
- GameObject * ion_cannon_strike = Commands->Create_Object("Nod_RocketSoldier_1Off", Commands->Get_Position(Commands->Find_Object(1500087)));
- Commands->Attach_Script(ion_cannon_strike, "MX0_Plant_Ion_Beacon_DLS", "");
- Commands->Start_Timer (obj, this, 22.0f, FLASH_TO_WHITE);
- Commands->Start_Timer (obj, this, 25.0f, FINALE);
- // Relocate Troops
- Relocate_Soldiers (obj);
-
- }
- if(timer_id == FLASH_TO_WHITE)
- {
- Commands->Set_Screen_Fade_Color(1.0f, 1.0f, 1.0f, 0.2f);
- Commands->Set_Screen_Fade_Opacity(1.0f, 0.2f);
-
- }
- if(timer_id == FINALE)
- {
- Commands->Destroy_Object(Commands->Find_Object(basewall_id));
- GameObject *controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(controller, 0.000f);
- Commands->Attach_Script(controller, "Test_Cinematic", "X0Z_Finale.txt");
- }
- if(timer_id == ORCA_STRIKE1 && orca_strike)
- {
- GameObject *orca_controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(orca_controller, 0.000f);
- Commands->Attach_Script(orca_controller, "Test_Cinematic", "X0C_Flyovers_01.txt");
- }
- if(timer_id == ORCA_STRIKE2 && orca_strike)
- {
- GameObject *orca_controller = Commands->Create_Object("Invisible_Object", Vector3(0.0f, 0.0f, 0.0f));
- Commands->Set_Facing(orca_controller, 0.000f);
- Commands->Attach_Script(orca_controller, "Test_Cinematic", "X0C_Flyovers_02.txt");
- }
-
- }
- };
- DECLARE_SCRIPT (MX0_Area4_Zone_DLS, "Area=0:int")
- {
- bool first_time;
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( first_time, 1 );
- }
- void Created (GameObject * obj)
- {
- first_time = true;
- }
- void Entered (GameObject * obj, GameObject * enterer)
- {
- if(Commands->Is_A_Star(enterer) && first_time )
- {
- int area = Get_Int_Parameter("Area");
- // Send custom to area controller to determine STAR location
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500017), MX0_STAR_AREA, area, 0.0f);
- first_time = false;
- }
- }
- };
- DECLARE_SCRIPT (MX0_Vehicle_DLS, "Attack_Loc0=0:int, Attack_Loc1=0:int, Attack_Loc2=0:int, Attack_Loc3=0:int, Speed=1.0:float")
- {
- int attack_loc [4];
- int loc;
- float speed;
- enum{CON001, CON002};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( attack_loc, 1 );
- SAVE_VARIABLE( loc, 2 );
- SAVE_VARIABLE( speed, 3 );
- }
- void Created (GameObject * obj)
- {
- Commands->Enable_Enemy_Seen( obj, true);
- Commands->Enable_Engine(obj, true);
- attack_loc [0] = Get_Int_Parameter("Attack_Loc0");
- attack_loc [1] = Get_Int_Parameter("Attack_Loc1");
- attack_loc [2] = Get_Int_Parameter("Attack_Loc2");
- attack_loc [3] = Get_Int_Parameter("Attack_Loc3");
- loc = 0;
- speed = Get_Float_Parameter("Speed");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(Commands->Find_Object(1500024), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- Commands->Debug_Message("ID %d sees Enemy ID %d \n", Commands->Get_ID(obj), Commands->Get_ID(enemy));
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(enemy, 200.0f, 5.0f, true);
- // params.AttackCheckBlocked = false;
- // params.AttackForceFire = true;
-
- Commands->Action_Attack(obj, params);
- }
- void Custom( GameObject * obj, int type, int param, GameObject * sender )
- {
- ActionParamsStruct params;
- if(type == MX0_VEHICLE_MOVE)
- {
- loc = param;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(Commands->Find_Object(1500024), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- Commands->Debug_Message("Attack_Loc [%d] = %d \n", loc, attack_loc[loc]);
-
- }
- if(type == MX0_SPECIFIC_ACTION)
- {
- // Humvee announces discovery of Nod Base
- if(param == MX0_DISCOVERS_NOD_BASE)
- {
- // Eagle Base– We found it!
- const char *conv_name = ("MX0_A04_CON001");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, CON001);
- Commands->Monitor_Conversation (obj, conv_id);
- }
- // We need you up here, Sir.
- if(param == MX0_NEED_YOU_HERE)
- {
- // We need you up here, Sir.
- const char *conv_name = ("MX0_A04_CON013");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
-
- }
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if((action_id == CON001) && (reason == ACTION_COMPLETE_CONVERSATION_ENDED))
- {
- // Confirmed. Excellent work!
- const char *conv_name = ("MX0_A04_CON002");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(NULL, conv_id, false, true);
- Commands->Start_Conversation (conv_id, CON002);
- // Commands->Monitor_Conversation (obj, conv_id);
- }
- if((action_id == CON002) && (reason == ACTION_COMPLETE_CONVERSATION_ENDED))
- {
- // They have an Obelisk!
- const char *conv_name = ("MX0_A04_CON003");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, CON002);
-
-
- }
- if(action_id == 10)
- {
- Commands->Debug_Message("Action_Complete");
- }
-
- }
- };
- DECLARE_SCRIPT (MX0_Obelisk_Weapon_DLS, "Max_Range=75.0f:float")
- {
- bool able_to_fire;
- int current_target;
- int powerup_effect_id;
- int humvee_id;
- int humvee_driver_id;
- int medium_tank_blasted_id;
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE (able_to_fire, 1);
- SAVE_VARIABLE (current_target, 2);
- SAVE_VARIABLE (powerup_effect_id, 3);
- SAVE_VARIABLE (humvee_id, 4);
- SAVE_VARIABLE (humvee_driver_id, 5);
- SAVE_VARIABLE (medium_tank_blasted_id, 6);
- }
- void Created (GameObject * obj)
- {
- powerup_effect_id = 0;
- current_target = 0;
- able_to_fire = true;
- Commands->Set_Player_Type (obj, SCRIPT_PLAYERTYPE_NOD);
- Commands->Set_Is_Rendered (obj, false);
- // Commands->Enable_Enemy_Seen (obj, true);
- Commands->Enable_Hibernation (obj, false);
- // Commands->Innate_Enable (obj);
- Vector3 my_position = Commands->Get_Position (obj);
- GameObject * effect = Commands->Create_Object ("Obelisk Effect", my_position);
- if (effect)
- {
- powerup_effect_id = Commands->Get_ID (effect);
- Commands->Set_Animation_Frame (effect, "OBL_POWERUP.OBL_POWERUP", 0);
- }
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- if(type == MX0_OBELISK_HUMVEE)
- {
- Commands->Send_Custom_Event (obj, obj, 2, humvee_id, 0.0f);
- }
- if(type == MX0_OBELISK_DRIVER)
- {
- Commands->Send_Custom_Event (obj, obj, 2, humvee_driver_id, 1.0f);
- }
- if(type == MX0_OBELISK_MEDIUM_TANK)
- {
- Commands->Send_Custom_Event (obj, obj, 2, medium_tank_blasted_id, 0.0f);
- }
- // Actor IDs
- if(type == M00_SEND_OBJECT_ID)
- {
- if(param == 1)
- {
- humvee_id = Commands->Get_ID(sender);
- }
- if(param == 2)
- {
- humvee_driver_id = Commands->Get_ID(sender);
- }
- if(param == 3)
- {
- medium_tank_blasted_id = Commands->Get_ID(sender);
- }
- }
- if (type == 1)
- {
- if (param == 0)
- {
- Commands->Enable_Enemy_Seen (obj, false);
- able_to_fire = false;
- ActionParamsStruct params;
- params.Set_Basic (this, 100, 0);
- params.Set_Attack (obj, 0.0f, 0.0f, true);
- Commands->Action_Attack (obj, params);
- Commands->Action_Reset (obj, 100.0f);
- Destroy_Obelisk_Effect ();
- }
- else
- {
- Commands->Enable_Enemy_Seen (obj, true);
- able_to_fire = true;
- }
- }
- else if (type == 2)
- {
- if (able_to_fire)
- {
- GameObject * target_obj = Commands->Find_Object (param);
- if (target_obj)
- {
- Vector3 enemy_position = Commands->Get_Position (target_obj);
- Vector3 my_position = Commands->Get_Position (obj);
- float distance = Commands->Get_Distance (my_position, enemy_position);
- enemy_position.Z = 0.0f;
- my_position.Z = 0.0f;
- float difference = Commands->Get_Distance (my_position, enemy_position);
- float max_range = Get_Float_Parameter("Max_Range");
- if ((difference > 15.0f) && (distance < max_range))
- {
- current_target = param;
- able_to_fire = false;
- Commands->Start_Timer (obj, this, 2.5f, 1);
- GameObject * effect = Commands->Find_Object (powerup_effect_id);
- if (effect)
- {
- Commands->Set_Animation_Frame (effect, "OBL_POWERUP.OBL_POWERUP", 1);
- }
- my_position.Z -= 20.0f;
- Commands->Create_Sound ("Obelisk_Warm_Up", my_position, obj);
- }
- else
- {
- Destroy_Obelisk_Effect ();
- Commands->Action_Reset (obj, 100.0f);
- }
- }
- }
- }
- }
- void Timer_Expired (GameObject * obj, int timer_id)
- {
- if (timer_id == 1)
- {
- GameObject * target_obj = Commands->Find_Object (current_target);
- if (target_obj)
- {
- Vector3 my_position = Commands->Get_Position (obj);
- Vector3 enemy_position = Commands->Get_Position (target_obj);
- float distance = Commands->Get_Distance (my_position, enemy_position);
- enemy_position.Z = 0.0f;
- my_position.Z = 0.0f;
- float difference = Commands->Get_Distance (my_position, enemy_position);
- float max_range = Get_Float_Parameter("Max_Range");
- if ((difference > 15.0f) && (distance < max_range))
- {
- ActionParamsStruct params;
- params.Set_Basic (this, 100, 0);
- params.Set_Attack (target_obj, max_range, 0.0f, true);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack (obj, params);
- current_target = 0;
- Commands->Start_Timer (obj, this, 2.0f, 2);
- }
- else
- {
- Destroy_Obelisk_Effect ();
- Commands->Action_Reset (obj, 100.0f);
- able_to_fire = true;
- }
- }
- else
- {
- Destroy_Obelisk_Effect ();
- Commands->Action_Reset (obj, 100.0f);
- able_to_fire = true;
- }
- }
- else if (timer_id == 2)
- {
- Destroy_Obelisk_Effect ();
- able_to_fire = true;
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- if(action_id == 0)
- {
- Commands->Debug_Message("Action_Complete Obelisk Firing");
- }
- }
- void Destroy_Obelisk_Effect (void)
- {
- if (powerup_effect_id)
- {
- GameObject * effect = Commands->Find_Object (powerup_effect_id);
- if (effect)
- {
- Commands->Set_Animation_Frame (effect, "OBL_POWERUP.OBL_POWERUP", 0);
- }
- }
- }
- void Destroyed(GameObject * obj )
- {
- if (powerup_effect_id)
- {
- GameObject * effect = Commands->Find_Object (powerup_effect_id);
- if (effect)
- {
- Commands->Set_Animation_Frame (effect, "OBL_POWERUP.OBL_POWERUP", 0);
- }
- }
- }
- };
- DECLARE_SCRIPT (MX0_GDI_Killed_DLS, "Unit_ID=0:int")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( attack_loc, 1 );
- }
- void Created (GameObject * obj)
- {
-
- }
- void Damaged (GameObject * obj, GameObject * damager, float amount)
- {
- // If damaged by the Obelisk Weapon
- if((damager == Commands->Find_Object(1500020)) && (Commands->Find_Object(1500020)))
- {
- Commands->Apply_Damage( obj, 50000.0f, "STEEL");
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- int unit_id = Get_Int_Parameter("Unit_ID");
- switch(unit_id)
- {
- case 1:
- {
- GameObject * humvee_driver = Commands->Create_Object("GDI_Minigunner_1Off", Commands->Get_Position(obj));
- Commands->Set_Facing(humvee_driver, 0.000f);
- Commands->Attach_Script(humvee_driver, "M00_Send_Object_ID", "1500020, 2, 0.0f");
- Commands->Attach_Script(humvee_driver, "MX0_GDI_Soldier_DLS", "0,0,0,0,0.0f");
- // Custom for Humvee driver to be covwering and fleeing
- Commands->Send_Custom_Event (obj, humvee_driver, MX0_SPECIFIC_ACTION, MX0_HUMVEE_DRIVER_COWER, 0.0f);
- // Obelisk blasts Hummvee
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500020), MX0_OBELISK_DRIVER, 1, 1.0f);
- }
- break;
- // When Medium Tank is destroyed replace with destroyed model
- case 2:
- {
- GameObject * destroyed_medium_tank = Commands->Create_Object("MX0_GDI_Medium_Tank_Destroyed", Commands->Get_Position(obj));
- Commands->Set_Facing(destroyed_medium_tank, Commands->Get_Facing(obj));
- }
- break;
- // GDI Reinforcement, send custom to controller on killed
- case 3:
- {
- Commands->Send_Custom_Event( obj, Commands->Find_Object(1500017), MX0_GDI_REINFORCEMENT_KILLED, 1, 1.0f);
- }
- break;
- }
- }
- };
- DECLARE_SCRIPT (MX0_GDI_Soldier_DLS, "Attack_Loc0=0:int, Attack_Loc1=0:int, Attack_Loc2=0:int, Attack_Loc3=0:int, Speed=1.0:float")
- {
- int attack_loc [4];
- int loc;
- float speed;
- int mx0_soldier_move_attempts;
- enum{CON001};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( attack_loc, 1 );
- SAVE_VARIABLE( loc, 2 );
- SAVE_VARIABLE( speed, 3 );
- SAVE_VARIABLE( mx0_soldier_move_attempts, 4 );
- }
- void Created (GameObject * obj)
- {
- Commands->Enable_Enemy_Seen( obj, true);
- Commands->Enable_Engine(obj, true);
- attack_loc [0] = Get_Int_Parameter("Attack_Loc0");
- attack_loc [1] = Get_Int_Parameter("Attack_Loc1");
- attack_loc [2] = Get_Int_Parameter("Attack_Loc2");
- attack_loc [3] = Get_Int_Parameter("Attack_Loc3");
- loc = 0;
- speed = Get_Float_Parameter("Speed");
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(Commands->Find_Object(1500024), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- Commands->Debug_Message("ID %d sees Enemy ID %d \n", Commands->Get_ID(obj), Commands->Get_ID(enemy));
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(enemy, 200.0f, 5.0f, true);
- // params.AttackCheckBlocked = false;
- // params.AttackForceFire = true;
-
- Commands->Action_Attack(obj, params);
- }
- void Custom( GameObject * obj, int type, int param, GameObject * sender )
- {
- ActionParamsStruct params;
- if(type == MX0_SOLDIER_MOVE)
- {
- loc = param;
- bool move_crouched = Commands->Get_Random_Int(0, 1) ? false : true;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, MX0_SOLDIER_MOVE );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(Commands->Find_Object(1500024), 0.0f, 0.0f, true);
- params.MoveCrouched = move_crouched;
- Commands->Action_Attack(obj, params);
- Commands->Debug_Message("Attack_Loc [%d] = %d \n", loc, attack_loc[loc]);
-
- }
- if(type == MX0_SPECIFIC_ACTION)
- {
- // Soldier that pops out of destroyed Humvee
- if(param == MX0_HUMVEE_DRIVER_COWER) // Cower animation
- {
- Commands->Innate_Disable(obj);
- ActionParamsStruct params;
- params.Set_Basic( this, 100, 1 );
- params.Set_Animation ("H_A_A0A0_L51", true);
- Commands->Action_Play_Animation (obj, params);
-
- // Death #1 - Bullet death scream
- const char *conv_name = ("MX0_A04_CON019");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, 10);
- }
- // Rocket Trooper sights obelisk
- if(param == MX0_ROCKETTROOPER_SEES_OBELISK)
- {
- // They have an Obelisk!
- const char *conv_name = ("MX0_A04_CON003");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_SEES_OBELISK);
-
- // Start Area4 muzak
- Commands->Fade_Background_Music( "Level 0 Nod base.mp3", 2, 2);
-
- }
- // Rocket Trooper announces obelisk is hot
- if(param == MX0_ROCKETTROOPER_HOT_OBELISK)
- {
- // The Obelisk is hot! Look out!
- const char *conv_name = ("MX0_A04_CON004");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_HOT_OBELISK);
- }
- // Rocket Trooper - It’s down! The Obelisk is down!
- if(param == MX0_ROCKETTROOPER_OBELISK_DOWN)
- {
- // It’s down! The Obelisk is down!
- const char *conv_name = ("MX0_A04_CON006");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_OBELISK_DOWN);
- }
- // Rocket Trooper - Go! Go! Knock out those SAMs!
- if(param == MX0_ROCKETTROOPER_TAKE_SAMS)
- {
- // Go! Go! Knock out those SAMs!
- const char *conv_name = ("MX0_A04_CON007");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_TAKE_SAMS);
- }
- // Rocket Trooper - The SAMs are history!
- if(param == MX0_ROCKETTROOPER_SAMS_HISTORY)
- {
- // The SAMs are history!
- const char *conv_name = ("MX0_A04_CON008");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_SAMS_HISTORY);
- }
- // Trooper1 - There, on the wall!
- if(param == MX0_TROOPER_UP_ON_WALL)
- {
- // There, on the wall!
- const char *conv_name = ("MX0_A04_CON009");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_TROOPER_UP_ON_WALL);
- }
- // If Havoc turns back and exits Area4
- if(param == MX0_ROCKETTROOPER_CANT_TURN_BACK)
- {
- // We need your help - over here, Sir!
- const char *conv_name = ("MX0_A04_CON014");
- int conv_id = Commands->Create_Conversation (conv_name, 100.0f, 200.0f, false);
- Commands->Join_Conversation(obj, conv_id, false, true);
- Commands->Start_Conversation (conv_id, MX0_ROCKETTROOPER_CANT_TURN_BACK);
- }
-
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == MX0_SOLDIER_MOVE)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, MX0_SOLDIER_MOVE );
- params.Set_Movement( Commands->Get_Position (Commands->Find_Object (attack_loc [loc])), speed, 5.0f );
- params.Set_Attack(Commands->Find_Object(1500024), 0.0f, 0.0f, true);
- Commands->Action_Attack(obj, params);
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- // If action fails, reattempt
- if((action_id == MX0_SOLDIER_MOVE) && (reason != ACTION_COMPLETE_NORMAL) && (mx0_soldier_move_attempts < 4))
- {
- mx0_soldier_move_attempts++;
- Commands->Start_Timer (obj, this, 4.0f, MX0_SOLDIER_MOVE);
- Commands->Debug_Message("Attempt %d for MX0_SOLDIER_MOVE on loc %d");
- }
- if(action_id == 10)
- {
- Commands->Debug_Message("Action_Complete");
- }
- }
- };
- DECLARE_SCRIPT (MX0_Gun_Emplacement_DLS, "Left_Point=0:int, Right_Point=0:int")
- {
- bool left;
- enum{STRAFE};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- left = true;
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == MX0_SPECIFIC_ACTION)
- {
- Timer_Expired(obj, STRAFE);
-
- }
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- ActionParamsStruct params;
- if(timer_id == STRAFE)
- {
- if(left)
- {
- left = false;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (Commands->Find_Object(Get_Int_Parameter("Left_Point")), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- else
- {
- left = true;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (Commands->Find_Object(Get_Int_Parameter("Right_Point")), 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- Commands->Start_Timer (obj, this, 4.0f, STRAFE);
- }
- }
- };
- DECLARE_SCRIPT (MX0_Nod_RocketSoldier_DLS, "Stationary_Point=0:int")
- {
- enum{GO_POSITION};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, GO_POSITION );
- params.Set_Movement( Commands->Find_Object(Get_Int_Parameter("Stationary_Point")), RUN, 0.0f );
- Commands->Action_Goto(obj, params);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if(type == MX0_SPECIFIC_ACTION)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (Commands->Find_Object(param), 150.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- }
- void Action_Complete(GameObject * obj, int action_id, ActionCompleteReason reason)
- {
- ActionParamsStruct params;
- if((action_id == GO_POSITION) && (reason == ACTION_COMPLETE_NORMAL))
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (enemy, 150.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- };
- DECLARE_SCRIPT (MX0_SAM_DLS, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
- ActionParamsStruct params;
- if (type == MX0_FIRE_SAM)
- {
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 1 );
- params.Set_Attack (Commands->Find_Object(1500081), 250.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- Commands->Action_Attack( obj, params );
- }
- }
- };
- DECLARE_SCRIPT (MX0_Nod_Bunker_DLS, "")
- {
- enum{GO_POSITION};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Set_Innate_Is_Stationary(obj, true);
- }
- void Enemy_Seen(GameObject * obj, GameObject *enemy )
- {
- ActionParamsStruct params;
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (enemy, 0.0f, 0.0f, 1);
- params.AttackCheckBlocked = false;
- params.AttackCrouched = true;
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- };
- DECLARE_SCRIPT (MX0_Plant_Ion_Beacon_DLS, "")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- ActionParamsStruct params;
- Commands->Give_PowerUp(obj, "POW_IonCannonBeacon_Ai" );
- Commands->Select_Weapon(obj, "Weapon_IonCannonBeacon_Ai" );
- params.Set_Basic( this, INNATE_PRIORITY_ENEMY_SEEN + 5, 10 );
- params.Set_Attack (Commands->Get_Position(obj), 5.0f, 0.0f, 1);
- params.AttackForceFire = true;
- Commands->Action_Attack( obj, params );
- }
- };
- DECLARE_SCRIPT (DLS_Star_No_Fall, "")
- {
- enum{ATTACH_SCRIPT};
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
- Commands->Start_Timer (obj, this, 1.0f, ATTACH_SCRIPT);
- }
- void Timer_Expired(GameObject * obj, int timer_id )
- {
- if(timer_id == ATTACH_SCRIPT)
- {
- if(STAR)
- {
- Commands->Attach_Script(STAR, "M00_No_Falling_Damage_DME", "");
- }
- else
- {
- Commands->Start_Timer (obj, this, 1.0f, ATTACH_SCRIPT);
- }
- }
-
- }
- };
- DECLARE_SCRIPT (MX0_Explosive_Barrels_DLS, "Logical_Sound=0:int, Radius:float")
- {
- // Register variables to be Auto-Saved
- // All variables must have a unique ID, less than 256, that never changes
- REGISTER_VARIABLES()
- {
- // SAVE_VARIABLE( left, 1 );
- }
- void Created (GameObject * obj)
- {
-
- }
- void Custom (GameObject * obj, int type, int param, GameObject * sender)
- {
-
- }
- void Sound_Heard( GameObject * obj, const CombatSound & sound )
- {
- if(sound.Type == Get_Int_Parameter("Logical_Sound"))
- {
- Commands->Apply_Damage( obj, 50000.0f, "STEEL");
- }
- }
- void Killed (GameObject * obj, GameObject * killer)
- {
- float radius = Get_Float_Parameter("Radius");
- Commands->Create_Explosion("Air Explosions Twiddler", Commands->Get_Position(obj), obj);
- Commands->Create_Logical_Sound(obj, Get_Int_Parameter("Logical_Sound"), Commands->Get_Position(obj), radius);
- }
- };
|