Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.78 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include common_scripts\utility;
  3.  
  4.  
  5. init()
  6. {
  7. level.ac130_use_duration = 40;
  8. level.ac130_num_flares = 2;
  9.  
  10. makeDvarServerInfo( "ui_ac130usetime", level.ac130_use_duration );
  11.  
  12. precacheShader( "black" );
  13.  
  14. precacheString( &"AC130_HUD_THERMAL_WHOT" );
  15. precacheString( &"AC130_HUD_THERMAL_BHOT" );
  16. precacheString( &"AC130_HUD_AGL" );
  17. precacheString( &"MP_CIVILIAN_AIR_TRAFFIC" );
  18.  
  19. precacheMenu( "ac130timer" );
  20.  
  21. precacheModel( "vehicle_ac130_coop" );
  22.  
  23. precacheItem("ac130_25mm_mp");
  24. precacheItem("ac130_40mm_mp");
  25. precacheItem("ac130_105mm_mp");
  26.  
  27. PrecacheMiniMapIcon( "compass_objpoint_ac130_friendly" );
  28. PrecacheMiniMapIcon( "compass_objpoint_ac130_enemy" );
  29.  
  30. precacheShellShock("ac130");
  31.  
  32. angelFlarePrecache();
  33.  
  34. level._effect[ "cloud" ] = loadfx( "misc/ac130_cloud" );
  35. level._effect[ "beacon" ] = loadfx( "misc/ir_beacon_coop" );
  36. level._effect[ "ac130_explode" ] = loadfx( "explosions/aerial_explosion_ac130_coop" );
  37. level._effect[ "ac130_flare" ] = loadfx( "misc/flares_cobra" );
  38. level._effect[ "ac130_light_red" ] = loadfx( "misc/aircraft_light_wingtip_red" );
  39. level._effect[ "ac130_light_white_blink" ] = loadfx( "misc/aircraft_light_white_blink" );
  40. level._effect[ "ac130_light_red_blink" ] = loadfx( "misc/aircraft_light_red_blink" );
  41. level._effect[ "ac130_engineeffect" ] = loadfx( "fire/jet_engine_ac130" );
  42.  
  43. // ac130 muzzleflash effects for player on ground to see
  44. level._effect[ "coop_muzzleflash_105mm" ] = loadfx( "muzzleflashes/ac130_105mm" );
  45. level._effect[ "coop_muzzleflash_40mm" ] = loadfx( "muzzleflashes/ac130_40mm" );
  46.  
  47. level.radioForcedTransmissionQueue = [];
  48. level.enemiesKilledInTimeWindow = 0;
  49. level.lastRadioTransmission = getTime();
  50.  
  51. level.color[ "white" ] = ( 1, 1, 1 );
  52. level.color[ "red" ] = ( 1, 0, 0 );
  53. level.color[ "blue" ] = ( .1, .3, 1 );
  54.  
  55. level.cosine = [];
  56. level.cosine[ "45" ] = cos( 45 );
  57. level.cosine[ "5" ] = cos( 5 );
  58.  
  59. level.HUDItem = [];
  60.  
  61. level.physicsSphereRadius[ "ac130_25mm_mp" ] = 60;
  62. level.physicsSphereRadius[ "ac130_40mm_mp" ] = 600;
  63. level.physicsSphereRadius[ "ac130_105mm_mp" ] = 1000;
  64.  
  65. level.physicsSphereForce[ "ac130_25mm_mp" ] = 0;
  66. level.physicsSphereForce[ "ac130_40mm_mp" ] = 3.0;
  67. level.physicsSphereForce[ "ac130_105mm_mp" ] = 6.0;
  68.  
  69. level.weaponReloadTime[ "ac130_25mm_mp" ] = 1.5;
  70. level.weaponReloadTime[ "ac130_40mm_mp" ] = 3.0;
  71. level.weaponReloadTime[ "ac130_105mm_mp" ] = 5.0;
  72.  
  73. level.ac130_Speed[ "move" ] = 250;
  74. level.ac130_Speed[ "rotate" ] = 70;
  75.  
  76. //flag_init( "ir_beakons_on" );
  77. flag_init( "allow_context_sensative_dialog" );
  78. flag_set( "allow_context_sensative_dialog" );
  79. minimapOrigins = getEntArray( "minimap_corner", "targetname" );
  80. ac130Origin = (0,0,0);
  81.  
  82. if ( miniMapOrigins.size )
  83. ac130Origin = maps\mp\gametypes\_spawnlogic::findBoxCenter( miniMapOrigins[0].origin, miniMapOrigins[1].origin );
  84.  
  85. level.ac130 = spawn( "script_model", ac130Origin );
  86. level.ac130 setModel( "c130_zoomrig" );
  87. level.ac130.angles = ( 0, 115, 0 );
  88. level.ac130.owner = undefined;
  89.  
  90. level.ac130 hide();
  91.  
  92. level.ac130InUse = false;
  93.  
  94. init_sounds();
  95.  
  96. thread rotatePlane( "on" );
  97. thread ac130_spawn();
  98. thread onPlayerConnect();
  99.  
  100. thread handleIncomingStinger();
  101.  
  102. level.killstreakFuncs["ac130"] = ::tryUseAC130;
  103.  
  104. level.ac130Queue = [];
  105. }
  106.  
  107.  
  108. tryUseAC130( lifeId )
  109. {
  110. if ( isDefined( level.civilianJetFlyBy ) )
  111. {
  112. self iPrintLnBold( &"MP_CIVILIAN_AIR_TRAFFIC" );
  113. return false;
  114. }
  115.  
  116. if ( isDefined( level.ac130player ) || level.ac130InUse )
  117. {
  118. self iPrintLnBold( &"MP_AIR_SPACE_TOO_CROWDED" );
  119. return false;
  120. }
  121.  
  122. if ( self isUsingRemote() )
  123. {
  124. return false;
  125. }
  126.  
  127. level.ac130InUse = true;
  128. self setUsingRemote( "ac130" );
  129. result = self maps\mp\killstreaks\_killstreaks::initRideKillstreak();
  130. if ( result != "success" )
  131. {
  132. if ( result != "disconnect" )
  133. self clearUsingRemote();
  134.  
  135. level.ac130InUse = false;
  136. return false;
  137. }
  138.  
  139. self maps\mp\_matchdata::logKillstreakEvent( "ac130", self.origin );
  140.  
  141. self.ac130LifeId = lifeId;
  142. level.ac130.planeModel.crashed = undefined;
  143.  
  144. thread setAC130Player( self );
  145. return true;
  146. }
  147.  
  148.  
  149. init_sounds()
  150. {
  151. setAC130Ambience( "ambient_ac130_int1" );
  152.  
  153. level.scr_sound["foo"]["bar"] = "";
  154. //-------------------------------------------------------------------------------------------------
  155. //CONTEXT SENSATIVE DIALOG
  156. //-------------------------------------------------------------------------------------------------
  157.  
  158. add_context_sensative_dialog( "ai", "in_sight", 0, "ac130_fco_moreenemy" ); // More enemy personnel.
  159. add_context_sensative_dialog( "ai", "in_sight", 1, "ac130_fco_getthatguy" ); // Get that guy.
  160. add_context_sensative_dialog( "ai", "in_sight", 2, "ac130_fco_guymovin" ); // Roger, guy movin'.
  161. add_context_sensative_dialog( "ai", "in_sight", 3, "ac130_fco_getperson" ); // Get that person.
  162. add_context_sensative_dialog( "ai", "in_sight", 4, "ac130_fco_guyrunnin" ); // Guy runnin'.
  163. add_context_sensative_dialog( "ai", "in_sight", 5, "ac130_fco_gotarunner" ); // Uh, we got a runner here.
  164. add_context_sensative_dialog( "ai", "in_sight", 6, "ac130_fco_backonthose" ); // Get back on those guys.
  165. add_context_sensative_dialog( "ai", "in_sight", 7, "ac130_fco_gonnagethim" ); // You gonna get him?
  166. add_context_sensative_dialog( "ai", "in_sight", 8, "ac130_fco_personnelthere" ); // Personnel right there.
  167. add_context_sensative_dialog( "ai", "in_sight", 9, "ac130_fco_nailthoseguys" ); // Nail those guys.
  168. add_context_sensative_dialog( "ai", "in_sight", 11, "ac130_fco_lightemup" ); // Light ?em up.
  169. add_context_sensative_dialog( "ai", "in_sight", 12, "ac130_fco_takehimout" ); // Yeah take him out.
  170. add_context_sensative_dialog( "ai", "in_sight", 14, "ac130_plt_yeahcleared" ); // Yeah, cleared to engage.
  171. add_context_sensative_dialog( "ai", "in_sight", 15, "ac130_plt_copysmoke" ); // Copy, smoke ?em.
  172. add_context_sensative_dialog( "ai", "in_sight", 16, "ac130_fco_rightthere" ); // Right there...tracking.
  173. add_context_sensative_dialog( "ai", "in_sight", 17, "ac130_fco_tracking" ); // Tracking.
  174.  
  175. add_context_sensative_dialog( "ai", "wounded_crawl", 0, "ac130_fco_movingagain" ); // Ok he?s moving again.
  176. add_context_sensative_timeout( "ai", "wounded_crawl", undefined, 6 );
  177.  
  178. add_context_sensative_dialog( "ai", "wounded_pain", 0, "ac130_fco_doveonground" ); // Yeah, he just dove on the ground.
  179. add_context_sensative_dialog( "ai", "wounded_pain", 1, "ac130_fco_knockedwind" ); // Probably just knocked the wind out of him.
  180. add_context_sensative_dialog( "ai", "wounded_pain", 2, "ac130_fco_downstillmoving" ); // That guy's down but still moving.
  181. add_context_sensative_dialog( "ai", "wounded_pain", 3, "ac130_fco_gettinbackup" ); // He's gettin' back up.
  182. add_context_sensative_dialog( "ai", "wounded_pain", 4, "ac130_fco_yepstillmoving" ); // Yep, that guy?s still moving.
  183. add_context_sensative_dialog( "ai", "wounded_pain", 5, "ac130_fco_stillmoving" ); // He's still moving.
  184. add_context_sensative_timeout( "ai", "wounded_pain", undefined, 12 );
  185.  
  186. add_context_sensative_dialog( "weapons", "105mm_ready", 0, "ac130_gnr_gunready1" );
  187.  
  188. add_context_sensative_dialog( "weapons", "105mm_fired", 0, "ac130_gnr_shot1" );
  189.  
  190. add_context_sensative_dialog( "plane", "rolling_in", 0, "ac130_plt_rollinin" );
  191.  
  192. add_context_sensative_dialog( "explosion", "secondary", 0, "ac130_nav_secondaries1" );
  193. add_context_sensative_dialog( "explosion", "secondary", 1, "ac130_tvo_directsecondary1" );
  194. add_context_sensative_dialog( "explosion", "secondary", 1, "ac130_tvo_directsecondary2" );
  195. add_context_sensative_timeout( "explosion", "secondary", undefined, 7 );
  196.  
  197. add_context_sensative_dialog( "kill", "single", 0, "ac130_plt_gottahurt" ); // Ooo that's gotta hurt.
  198. add_context_sensative_dialog( "kill", "single", 1, "ac130_fco_iseepieces" ); // Yeah, good kill. I see lots of little pieces down there.
  199. add_context_sensative_dialog( "kill", "single", 2, "ac130_fco_oopsiedaisy" ); // (chuckling) Oopsie-daisy.
  200. add_context_sensative_dialog( "kill", "single", 3, "ac130_fco_goodkill" ); // Good kill good kill.
  201. add_context_sensative_dialog( "kill", "single", 4, "ac130_fco_yougothim" ); // You got him.
  202. add_context_sensative_dialog( "kill", "single", 5, "ac130_fco_yougothim2" ); // You got him!
  203. add_context_sensative_dialog( "kill", "single", 6, "ac130_fco_thatsahit" ); // That's a hit.
  204. add_context_sensative_dialog( "kill", "single", 7, "ac130_fco_directhit" ); // Direct hit.
  205. add_context_sensative_dialog( "kill", "single", 8, "ac130_fco_rightontarget" ); // Yep, that was right on target.
  206. add_context_sensative_dialog( "kill", "single", 9, "ac130_fco_okyougothim" ); // Ok, you got him. Get back on the other guys.
  207. add_context_sensative_dialog( "kill", "single", 10, "ac130_fco_within2feet" ); // All right you got the guy. That might have been within two feet of him.
  208.  
  209. add_context_sensative_dialog( "kill", "small_group", 0, "ac130_fco_nice" ); // (chuckling) Niiiice.
  210. add_context_sensative_dialog( "kill", "small_group", 1, "ac130_fco_directhits" ); // Yeah, direct hits right there.
  211. add_context_sensative_dialog( "kill", "small_group", 2, "ac130_fco_iseepieces" ); // Yeah, good kill. I see lots of little pieces down there.
  212. add_context_sensative_dialog( "kill", "small_group", 3, "ac130_fco_goodkill" ); // Good kill good kill.
  213. add_context_sensative_dialog( "kill", "small_group", 4, "ac130_fco_yougothim" ); // You got him.
  214. add_context_sensative_dialog( "kill", "small_group", 5, "ac130_fco_yougothim2" ); // You got him!
  215. add_context_sensative_dialog( "kill", "small_group", 6, "ac130_fco_thatsahit" ); // That's a hit.
  216. add_context_sensative_dialog( "kill", "small_group", 7, "ac130_fco_directhit" ); // Direct hit.
  217. add_context_sensative_dialog( "kill", "small_group", 8, "ac130_fco_rightontarget" );// Yep, that was right on target.
  218. add_context_sensative_dialog( "kill", "small_group", 9, "ac130_fco_okyougothim" ); // Ok, you got him. Get back on the other guys.
  219.  
  220. add_context_sensative_dialog( "misc", "action", 0, "ac130_plt_scanrange" ); // Set scan range.
  221. add_context_sensative_timeout( "misc", "action", 0, 70 );
  222.  
  223. add_context_sensative_dialog( "misc", "action", 1, "ac130_plt_cleanup" ); // Clean up that signal.
  224. add_context_sensative_timeout( "misc", "action", 1, 80 );
  225.  
  226. add_context_sensative_dialog( "misc", "action", 2, "ac130_plt_targetreset" ); // Target reset.
  227. add_context_sensative_timeout( "misc", "action", 2, 55 );
  228.  
  229. add_context_sensative_dialog( "misc", "action", 3, "ac130_plt_azimuthsweep" ); // Recalibrate azimuth sweep angle. Adjust elevation scan.
  230. add_context_sensative_timeout( "misc", "action", 3, 100 );
  231. }
  232.  
  233.  
  234. add_context_sensative_dialog( name1, name2, group, soundAlias )
  235. {
  236. assert( isdefined( name1 ) );
  237. assert( isdefined( name2 ) );
  238. assert( isdefined( group ) );
  239. assert( isdefined( soundAlias ) );
  240.  
  241. fullSoundAlias = maps\mp\gametypes\_teams::getTeamVoicePrefix( "allies" ) + soundAlias;
  242. assertex( soundexists( fullSoundAlias ), "ERROR: missing soundalias " + fullSoundAlias );
  243.  
  244. fullSoundAlias = maps\mp\gametypes\_teams::getTeamVoicePrefix( "axis" ) + soundAlias;
  245. assertex( soundexists( fullSoundAlias ), "ERROR: missing soundalias " + fullSoundAlias );
  246.  
  247. if( ( !isdefined( level.scr_sound[ name1 ] ) ) || ( !isdefined( level.scr_sound[ name1 ][ name2 ] ) ) || ( !isdefined( level.scr_sound[ name1 ][ name2 ][group] ) ) )
  248. {
  249. // creating group for the first time
  250. level.scr_sound[ name1 ][ name2 ][group] = spawnStruct();
  251. level.scr_sound[ name1 ][ name2 ][group].played = false;
  252. level.scr_sound[ name1 ][ name2 ][group].sounds = [];
  253. }
  254.  
  255. //group exists, add the sound to the array
  256. index = level.scr_sound[ name1 ][ name2 ][group].sounds.size;
  257. level.scr_sound[ name1 ][ name2 ][group].sounds[index] = soundAlias;
  258. }
  259.  
  260.  
  261. add_context_sensative_timeout( name1, name2, groupNum, timeoutDuration )
  262. {
  263. if( !isdefined( level.context_sensative_dialog_timeouts ) )
  264. level.context_sensative_dialog_timeouts = [];
  265.  
  266. createStruct = false;
  267. if ( !isdefined( level.context_sensative_dialog_timeouts[ name1 ] ) )
  268. createStruct = true;
  269. else if ( !isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ] ) )
  270. createStruct = true;
  271. if ( createStruct )
  272. level.context_sensative_dialog_timeouts[ name1 ][ name2 ] = spawnStruct();
  273.  
  274. if ( isdefined( groupNum ) )
  275. {
  276. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups = [];
  277. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ] = spawnStruct();
  278. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v["timeoutDuration"] = timeoutDuration * 1000;
  279. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v["lastPlayed"] = ( timeoutDuration * -1000 );
  280. }
  281. else
  282. {
  283. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v["timeoutDuration"] = timeoutDuration * 1000;
  284. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v["lastPlayed"] = ( timeoutDuration * -1000 );
  285. }
  286. }
  287.  
  288.  
  289. /*
  290. =============
  291. ///ScriptDocBegin
  292. "Name: play_sound_on_entity( <alias> )"
  293. "Summary: Play the specified sound alias on an entity at it's origin"
  294. "Module: Sound"
  295. "CallOn: An entity"
  296. "MandatoryArg: <alias> : Sound alias to play"
  297. "Example: level.player play_sound_on_entity( "breathing_better" );"
  298. "SPMP: singleplayer"
  299. ///ScriptDocEnd
  300. =============
  301. */
  302. play_sound_on_entity( alias )
  303. {
  304. play_sound_on_tag( alias );
  305. }
  306.  
  307. within_fov( start_origin, start_angles, end_origin, fov )
  308. {
  309. normal = vectorNormalize( end_origin - start_origin );
  310. forward = anglestoforward( start_angles );
  311. dot = vectorDot( forward, normal );
  312.  
  313. return dot >= fov;
  314. }
  315.  
  316. /*
  317. =============
  318. ///ScriptDocBegin
  319. "Name: array_remove_nokeys( <ents> , <remover> )"
  320. "Summary: array_remove used on non keyed arrays doesn't flip the array "
  321. "Module: Utility"
  322. "CallOn: Level"
  323. "MandatoryArg: <ents>: array to remove from"
  324. "MandatoryArg: <remover>: thing to remove from the array"
  325. "Example: "
  326. "SPMP: singleplayer"
  327. ///ScriptDocEnd
  328. =============
  329. */
  330.  
  331. array_remove_nokeys( ents, remover )
  332. {
  333. newents = [];
  334. for ( i = 0; i < ents.size; i++ )
  335. if ( ents[ i ] != remover )
  336. newents[ newents.size ] = ents[ i ];
  337. return newents;
  338. }
  339.  
  340. array_remove_index( array, index )
  341. {
  342. newArray = [];
  343. keys = getArrayKeys( array );
  344. for ( i = ( keys.size - 1 );i >= 0 ; i -- )
  345. {
  346. if ( keys[ i ] != index )
  347. newArray[ newArray.size ] = array[ keys[ i ] ];
  348. }
  349.  
  350. return newArray;
  351. }
  352.  
  353.  
  354. string( num )
  355. {
  356. return( "" + num );
  357. }
  358.  
  359.  
  360. onPlayerConnect()
  361. {
  362. for(;;)
  363. {
  364. level waittill( "connected", player );
  365.  
  366. player thread onPlayerSpawned();
  367. }
  368. }
  369.  
  370.  
  371. onPlayerSpawned()
  372. {
  373. self endon("disconnect");
  374.  
  375. for(;;)
  376. {
  377. self waittill("spawned_player");
  378. }
  379. }
  380.  
  381.  
  382. deleteOnAC130PlayerRemoved()
  383. {
  384. level waittill ( "ac130player_removed" );
  385.  
  386. self delete();
  387. }
  388.  
  389. setAC130Player( player )
  390. {
  391. self endon ( "ac130player_removed" );
  392.  
  393. assert( !isDefined( level.ac130player ) );
  394. level.ac130player = player;
  395. level.ac130.owner = player;
  396. level.ac130.planeModel show();
  397. level.ac130.planemodel thread playAC130Effects();
  398. level.ac130.incomingMissile = false;
  399.  
  400. level.ac130.planeModel playLoopSound( "veh_ac130_ext_dist" );
  401.  
  402. level.ac130.planeModel.maxhealth = 1000;
  403. level.ac130.planeModel.health = level.ac130.planeModel.maxhealth;
  404.  
  405. objModel = spawnPlane( player, "script_model", level.ac130.planeModel.origin, "compass_objpoint_ac130_friendly", "compass_objpoint_ac130_enemy" );
  406. objModel notSolid();
  407. objModel linkTo( level.ac130, "tag_player", ( 0, 80, 32 ), ( 0, -90, 0 ) );
  408. objModel thread deleteOnAC130PlayerRemoved();
  409.  
  410. player startAC130();
  411. player openMenu( "ac130timer" );
  412.  
  413. level.ac130.numFlares = level.ac130_num_flares;
  414.  
  415. /*
  416. result = player maps\mp\killstreaks\_killstreaks::initRideKillstreak();
  417. if ( result != "success" )
  418. {
  419. if ( result != "disconnect" )
  420. {
  421. if ( result == "fail" )
  422. player maps\mp\killstreaks\_killstreaks::giveKillstreak( "ac130", player.ac130LifeId == player.pers["deaths"], false );
  423.  
  424. level thread removeAC130Player( player, result == "disconnect" );
  425. }
  426.  
  427. return;
  428. }
  429. */
  430. thread teamPlayerCardSplash( "used_ac130", player );
  431.  
  432. player VisionSetThermalForPlayer( "black_bw", 0 );
  433. player ThermalVisionOn();
  434. player ThermalVisionFOFOverlayOn();
  435.  
  436. if ( getDvarInt( "camera_thirdPerson" ) )
  437. player setThirdPersonDOF( false );
  438.  
  439. player _giveWeapon("ac130_105mm_mp");
  440. player _giveWeapon("ac130_40mm_mp");
  441. player _giveWeapon("ac130_25mm_mp");
  442. player SwitchToWeapon("ac130_105mm_mp");
  443.  
  444. player thread overlay( player );
  445. player thread attachPlayer( player );
  446. player thread changeWeapons();
  447. player thread weaponFiredThread();
  448. player thread thermalVision();
  449. player thread context_Sensative_Dialog();
  450. player thread shotFired();
  451. player thread clouds();
  452. //thread maps\_ac130_amb::main();
  453.  
  454. player thread removeAC130PlayerAfterTime( level.ac130_use_duration * player.killStreakScaler);
  455. player thread removeAC130PlayerOnDisconnect();
  456. player thread removeAC130PlayerOnChangeTeams();
  457. player thread removeAC130PlayerOnSpectate();
  458. //player thread removeAC130PlayerOnDeath();
  459. player thread removeAC130PlayerOnCrash();
  460. //player thread removeAC130PlayerOnGameEnd();
  461. player thread removeAC130PlayerOnGameCleanup();
  462.  
  463. thread AC130_AltScene();
  464. }
  465.  
  466. playAC130Effects()
  467. {
  468. wait .05;
  469. PlayFXOnTag( level._effect[ "ac130_light_red_blink" ] , self, "tag_light_belly" );
  470. PlayFXOnTag( level._effect[ "ac130_engineeffect" ] , self, "tag_body" );
  471. wait .5;
  472. PlayFXOnTag( level._effect[ "ac130_light_white_blink" ] , self, "tag_light_tail" );
  473. PlayFXOnTag( level._effect[ "ac130_light_red" ] , self, "tag_light_top" );
  474. }
  475.  
  476. AC130_AltScene()
  477. {
  478. // need team check
  479. foreach ( player in level.players )
  480. {
  481. if ( player != level.ac130player && player.team == level.ac130player.team )
  482. player thread setAltSceneObj( level.ac130.cameraModel, "tag_origin", 20 );
  483. }
  484. }
  485.  
  486.  
  487. removeAC130PlayerOnGameEnd()
  488. {
  489. self endon ( "ac130player_removed" );
  490.  
  491. level waittill ( "game_ended" );
  492.  
  493. level thread removeAC130Player( self, false );
  494. }
  495.  
  496.  
  497. removeAC130PlayerOnGameCleanup()
  498. {
  499. self endon ( "ac130player_removed" );
  500.  
  501. level waittill ( "game_cleanup" );
  502.  
  503. level thread removeAC130Player( self, false );
  504. }
  505.  
  506.  
  507. removeAC130PlayerOnDeath()
  508. {
  509. self endon ( "ac130player_removed" );
  510.  
  511. self waittill ( "death" );
  512.  
  513. level thread removeAC130Player( self, false );
  514. }
  515.  
  516.  
  517. removeAC130PlayerOnCrash()
  518. {
  519. self endon ( "ac130player_removed" );
  520.  
  521. level.ac130.planeModel waittill ( "crashing" );
  522.  
  523. level thread removeAC130Player( self, false );
  524. }
  525.  
  526.  
  527. removeAC130PlayerOnDisconnect()
  528. {
  529. self endon ( "ac130player_removed" );
  530.  
  531. self waittill ( "disconnect" );
  532.  
  533. level thread removeAC130Player( self, true );
  534. }
  535.  
  536. removeAC130PlayerOnChangeTeams()
  537. {
  538. self endon ( "ac130player_removed" );
  539.  
  540. self waittill ( "joined_team" );
  541.  
  542. level thread removeAC130Player( self, false);
  543. }
  544.  
  545. removeAC130PlayerOnSpectate()
  546. {
  547. self endon ( "ac130player_removed" );
  548.  
  549. self waittill_any ( "joined_spectators", "spawned" );
  550.  
  551. level thread removeAC130Player( self, false);
  552. }
  553.  
  554. removeAC130PlayerAfterTime( removeDelay )
  555. {
  556. self endon ( "ac130player_removed" );
  557.  
  558. maps\mp\gametypes\_hostmigration::waitLongDurationWithHostMigrationPause( removeDelay );
  559.  
  560. level thread removeAC130Player( self, false );
  561. }
  562.  
  563.  
  564. removeAC130Player( player, disconnected )
  565. {
  566. player notify ( "ac130player_removed" );
  567. level notify ( "ac130player_removed" );
  568.  
  569. level.ac130.cameraModel notify ( "death" );
  570.  
  571. waittillframeend;
  572.  
  573. if ( !disconnected )
  574. {
  575. player clearUsingRemote();
  576.  
  577. player stopLocalSound( "missile_incoming" );
  578.  
  579. player show();
  580. player unlink();
  581.  
  582. player ThermalVisionOff();
  583. player ThermalVisionFOFOverlayOff();
  584. player visionSetThermalForPlayer( game["thermal_vision"], 0 );
  585. player setBlurForPlayer( 0, 0 );
  586. player stopAC130();
  587.  
  588. if ( getDvarInt( "camera_thirdPerson" ) )
  589. player setThirdPersonDOF( true );
  590.  
  591. weaponList = player GetWeaponsListExclusives();
  592. foreach ( weapon in weaponList )
  593. player takeWeapon( weapon );
  594.  
  595. if ( isDefined( player.darkScreenOverlay ) )
  596. player.darkScreenOverlay destroy();
  597.  
  598. keys = getArrayKeys( level.HUDItem );
  599.  
  600. foreach ( key in keys )
  601. {
  602. level.HUDItem[key] destroy();
  603. level.HUDItem[key] = undefined;
  604. }
  605. }
  606.  
  607. // delay before AC130 can be used again
  608. wait ( 0.5 );
  609.  
  610. level.ac130.planeModel playSound( "veh_ac130_ext_dist_fade" );
  611.  
  612. wait ( 0.5 );
  613.  
  614. // TODO: this might already be undefined if the player disconnected... need a better solution.
  615. // we could set it to "true" or something... but we'll have to check places it is used for potential issues with that.
  616. level.ac130player = undefined;
  617. level.ac130.planeModel hide();
  618. level.ac130.planeModel stopLoopSound();
  619.  
  620. if ( isDefined( level.ac130.planeModel.crashed ) )
  621. {
  622. level.ac130InUse = false;
  623. return;
  624. }
  625.  
  626. ac130model = spawn( "script_model", level.ac130.planeModel getTagOrigin( "tag_origin" ) );
  627. ac130model.angles = level.ac130.planeModel.angles;
  628. ac130model setModel( "vehicle_ac130_coop" );
  629. destPoint = ac130model.origin + vector_multiply( anglestoright( ac130model.angles ), 20000 );
  630.  
  631. ac130model thread playAC130Effects();
  632. ac130model moveTo( destPoint, 40.0, 0.0, 0.0 );
  633. ac130model thread deployFlares( true );
  634.  
  635. wait ( 5.0 );
  636. ac130model thread deployFlares( true );
  637.  
  638. wait ( 5.0 );
  639. ac130model thread deployFlares( true );
  640.  
  641. level.ac130InUse = false;
  642.  
  643. wait ( 30.0 );
  644.  
  645. ac130model delete();
  646. }
  647.  
  648.  
  649. damageTracker()
  650. {
  651. for ( ;; )
  652. {
  653. self waittill ( "damage", damage, attacker, dir, point, type );
  654.  
  655. if ( isDefined( level.ac130player ) && level.teambased && isPlayer( attacker ) && attacker.team == level.ac130player.team && !isDefined( level.nukeDetonated ) )
  656. {
  657. self.health += damage;
  658. continue;
  659. }
  660.  
  661. if ( type == "MOD_RIFLE_BULLET" || type == "MOD_PISTOL_BULLET" || type == "MOD_EXPLOSIVE_BULLET" )
  662. {
  663. self.health += damage;
  664. continue;
  665. }
  666.  
  667. if ( isPlayer( attacker ) )
  668. {
  669. attacker maps\mp\gametypes\_damagefeedback::updateDamageFeedback( "" );
  670. if ( attacker _hasPerk( "specialty_armorpiercing" ) )
  671. {
  672. damageAdd = damage*level.armorPiercingMod;
  673. self.health -= int(damageAdd);
  674. }
  675. }
  676.  
  677. if ( self.health <= 0 )
  678. {
  679.  
  680. if ( isPlayer( attacker ) )
  681. {
  682. thread maps\mp\gametypes\_missions::vehicleKilled( level.ac130player, self, undefined, attacker, damage, type );
  683. thread teamPlayerCardSplash( "callout_destroyed_ac130", attacker );
  684. attacker thread maps\mp\gametypes\_rank::giveRankXP( "kill", 400 );
  685. attacker notify( "destroyed_killstreak" );
  686. }
  687.  
  688. level thread crashPlane( 10.0 );
  689. }
  690. }
  691. }
  692.  
  693.  
  694. ac130_spawn()
  695. {
  696. wait 0.05;
  697.  
  698. ac130model = spawn( "script_model", level.ac130 getTagOrigin( "tag_player" ) );
  699. ac130model setModel( "vehicle_ac130_coop" );
  700.  
  701. ac130model setCanDamage( true );
  702. ac130model.maxhealth = 1000;
  703. ac130model.health = ac130model.maxhealth;
  704. ac130model thread damageTracker();
  705.  
  706. //ac130model linkTo( level.ac130, "tag_player", ( 0, 0, 32 ), ( -25, 0, 0 ) );
  707. ac130model linkTo( level.ac130, "tag_player", ( 0, 80, 32 ), ( -25, 0, 0 ) );
  708. level.ac130.planeModel = ac130model;
  709. level.ac130.planeModel hide();
  710.  
  711. ac130CameraModel = spawn( "script_model", level.ac130 getTagOrigin( "tag_player" ) );
  712. ac130CameraModel setModel( "tag_origin" );
  713. ac130CameraModel hide();
  714.  
  715. ac130CameraModel linkTo( level.ac130, "tag_player", ( 0, 0, 32 ), ( -25, 0, 0 ) );
  716. level.ac130.cameraModel = ac130CameraModel;
  717.  
  718. level.ac130player = level.players[0];
  719. }
  720.  
  721.  
  722. overlay( player )
  723. {
  724. level.HUDItem = [];
  725.  
  726. thermalEnabled = getIntProperty( "ac130_hud_text_thermal", 0 );
  727. if ( thermalEnabled )
  728. {
  729. level.HUDItem[ "thermal_mode" ] = newClientHudElem( player );
  730. level.HUDItem[ "thermal_mode" ].x = -80;
  731. level.HUDItem[ "thermal_mode" ].y = 50;
  732. level.HUDItem[ "thermal_mode" ].alignX = "right";
  733. level.HUDItem[ "thermal_mode" ].alignY = "top";
  734. level.HUDItem[ "thermal_mode" ].horzAlign = "right";
  735. level.HUDItem[ "thermal_mode" ].vertAlign = "top";
  736. level.HUDItem[ "thermal_mode" ].fontScale = 2.5;
  737. level.HUDItem[ "thermal_mode" ] settext ( &"AC130_HUD_THERMAL_WHOT" );
  738. level.HUDItem[ "thermal_mode" ].alpha = 1.0;
  739. }
  740.  
  741. if( !level.splitscreen )
  742. player thread overlay_coords();
  743.  
  744. if ( thermalEnabled )
  745. {
  746. player setBlurForPlayer( 1.2, 0 );
  747. }
  748. }
  749.  
  750.  
  751. hud_timer( duration )
  752. {
  753. self endon ( "ac130player_removed" );
  754.  
  755. level.HUDItem[ "timer" ] = newClientHudElem( self );
  756. level.HUDItem[ "timer" ].x = -100;
  757. level.HUDItem[ "timer" ].y = 0;
  758. level.HUDItem[ "timer" ].alignX = "right";
  759. level.HUDItem[ "timer" ].alignY = "bottom";
  760. level.HUDItem[ "timer" ].horzAlign = "right_adjustable";
  761. level.HUDItem[ "timer" ].vertAlign = "bottom_adjustable";
  762. level.HUDItem[ "timer" ].fontScale = 2.5;
  763. level.HUDItem[ "timer" ] setTimer( 1.0 );
  764. level.HUDItem[ "timer" ].alpha = 1.0;
  765.  
  766. level.HUDItem[ "timer" ] setTimer( duration );
  767. }
  768.  
  769.  
  770. overlay_coords()
  771. {
  772. self endon ( "ac130player_removed" );
  773.  
  774. level.HUDItem[ "coordinate_long" ] = newClientHudElem( self );
  775. level.HUDItem[ "coordinate_long" ].x = -100;
  776. level.HUDItem[ "coordinate_long" ].y = 0;
  777. level.HUDItem[ "coordinate_long" ].alignX = "right";
  778. level.HUDItem[ "coordinate_long" ].alignY = "top";
  779. level.HUDItem[ "coordinate_long" ].horzAlign = "right";
  780. level.HUDItem[ "coordinate_long" ].vertAlign = "top";
  781. level.HUDItem[ "coordinate_long" ].fontScale = 2.5;
  782. level.HUDItem[ "coordinate_long" ].alpha = 1.0;
  783.  
  784. level.HUDItem[ "coordinate_lat" ] = newClientHudElem( self );
  785. level.HUDItem[ "coordinate_lat" ].x = 0;
  786. level.HUDItem[ "coordinate_lat" ].y = 0;
  787. level.HUDItem[ "coordinate_lat" ].alignX = "right";
  788. level.HUDItem[ "coordinate_lat" ].alignY = "top";
  789. level.HUDItem[ "coordinate_lat" ].horzAlign = "right";
  790. level.HUDItem[ "coordinate_lat" ].vertAlign = "top";
  791. level.HUDItem[ "coordinate_lat" ].fontScale = 2.5;
  792. level.HUDItem[ "coordinate_lat" ].alpha = 1.0;
  793.  
  794. level.HUDItem[ "coordinate_agl" ] = newClientHudElem( self );
  795. level.HUDItem[ "coordinate_agl" ].x = 0;
  796. level.HUDItem[ "coordinate_agl" ].y = 20;
  797. level.HUDItem[ "coordinate_agl" ].alignX = "right";
  798. level.HUDItem[ "coordinate_agl" ].alignY = "top";
  799. level.HUDItem[ "coordinate_agl" ].horzAlign = "right";
  800. level.HUDItem[ "coordinate_agl" ].vertAlign = "top";
  801. level.HUDItem[ "coordinate_agl" ].fontScale = 2.5;
  802. level.HUDItem[ "coordinate_agl" ].label = ( &"AC130_HUD_AGL" );
  803. level.HUDItem[ "coordinate_agl" ].alpha = 1.0;
  804.  
  805. wait 0.05;
  806. for(;;)
  807. {
  808. level.HUDItem[ "coordinate_long" ] setValue( abs( int( self.origin[0] ) ) );
  809. level.HUDItem[ "coordinate_lat" ] setValue( abs( int( self.origin[1] ) ) );
  810.  
  811. pos = physicstrace( self.origin, self.origin - ( 0, 0, 100000 ) );
  812. if( ( isdefined( pos ) ) && ( isdefined( pos[2] ) ) )
  813. {
  814. alt = ( ( self.origin[2] - pos[2] ) * 1.5 );
  815. level.HUDItem[ "coordinate_agl" ] setValue( abs( int( alt ) ) );
  816. }
  817.  
  818. wait ( 0.75 + randomfloat( 2 ) );
  819. }
  820. }
  821.  
  822.  
  823. ac130ShellShock()
  824. {
  825. self endon ( "ac130player_removed" );
  826.  
  827. level endon( "post_effects_disabled" );
  828. duration = 5;
  829. for (;;)
  830. {
  831. self shellshock( "ac130", duration );
  832. wait duration;
  833. }
  834. }
  835.  
  836.  
  837. rotatePlane( toggle )
  838. {
  839. level notify("stop_rotatePlane_thread");
  840. level endon("stop_rotatePlane_thread");
  841.  
  842. if (toggle == "on")
  843. {
  844. rampupDegrees = 10;
  845. rotateTime = ( level.ac130_Speed[ "rotate" ] / 360 ) * rampupDegrees;
  846. level.ac130 rotateyaw( level.ac130.angles[ 2 ] + rampupDegrees, rotateTime, rotateTime, 0 );
  847.  
  848. for (;;)
  849. {
  850. level.ac130 rotateyaw( 360, level.ac130_Speed[ "rotate" ] );
  851. wait level.ac130_Speed[ "rotate" ];
  852. }
  853. }
  854. else if (toggle == "off")
  855. {
  856. slowdownDegrees = 10;
  857. rotateTime = ( level.ac130_Speed[ "rotate" ] / 360 ) * slowdownDegrees;
  858. level.ac130 rotateyaw( level.ac130.angles[ 2 ] + slowdownDegrees, rotateTime, 0, rotateTime );
  859. }
  860. }
  861.  
  862.  
  863. attachPlayer( player )
  864. {
  865. self PlayerLinkWeaponviewToDelta( level.ac130, "tag_player", 1.0, 35, 35, 35, 35 );
  866. self setPlayerAngles( level.ac130 getTagAngles( "tag_player" ) );
  867. }
  868.  
  869.  
  870. changeWeapons()
  871. {
  872. self endon ( "ac130player_removed" );
  873.  
  874. wait( 0.05 );
  875. self EnableWeapons();
  876.  
  877. for(;;)
  878. {
  879. self waittill ( "change_weapon", newWeapon );
  880.  
  881. self thread play_sound_on_entity( "ac130_weapon_switch" );
  882. }
  883. }
  884.  
  885.  
  886. weaponFiredThread()
  887. {
  888. self endon ( "ac130player_removed" );
  889.  
  890. for(;;)
  891. {
  892. self waittill( "weapon_fired" );
  893.  
  894. weapon = self getCurrentWeapon();
  895.  
  896. if ( weapon == "ac130_105mm_mp" )
  897. {
  898. self thread gun_fired_and_ready_105mm();
  899. earthquake (0.2, 1, level.ac130.planeModel.origin, 1000);
  900. }
  901. else if ( weapon == "ac130_40mm_mp" )
  902. {
  903. earthquake (0.1, 0.5, level.ac130.planeModel.origin, 1000);
  904. }
  905.  
  906. if ( self getWeaponAmmoClip( weapon ) )
  907. continue;
  908.  
  909. self thread weaponReload( weapon );
  910. }
  911. }
  912.  
  913.  
  914. weaponReload( weapon )
  915. {
  916. self endon ( "ac130player_removed" );
  917.  
  918. wait level.weaponReloadTime[ weapon ];
  919.  
  920. self setWeaponAmmoClip( weapon, 9999 );
  921.  
  922. // force the reload to stop if we're currently using the weapon
  923. if ( self getCurrentWeapon() == weapon )
  924. {
  925. self takeWeapon( weapon );
  926. self _giveWeapon( weapon );
  927. self switchToWeapon( weapon );
  928. }
  929. }
  930.  
  931.  
  932. thermalVision()
  933. {
  934. self endon ( "ac130player_removed" );
  935.  
  936. if ( getIntProperty( "ac130_thermal_enabled", 1 ) == 0 )
  937. return;
  938.  
  939. inverted = false;
  940.  
  941. self visionSetThermalForPlayer( game["thermal_vision"], 1 );
  942.  
  943. self notifyOnPlayerCommand( "switch thermal", "+activate" );
  944.  
  945. for (;;)
  946. {
  947. self waittill ( "switch thermal" );
  948.  
  949. if ( !inverted )
  950. {
  951. self visionSetThermalForPlayer( "missilecam", 0.62 );
  952. if ( isdefined( level.HUDItem[ "thermal_mode" ] ) )
  953. level.HUDItem[ "thermal_mode" ] settext ( &"AC130_HUD_THERMAL_BHOT" );
  954. }
  955. else
  956. {
  957. self visionSetThermalForPlayer( game["thermal_vision"], 0.51 );
  958. if ( isdefined( level.HUDItem[ "thermal_mode" ] ) )
  959. level.HUDItem[ "thermal_mode" ] settext ( &"AC130_HUD_THERMAL_WHOT" );
  960. }
  961.  
  962. inverted = !inverted;
  963. }
  964. }
  965.  
  966.  
  967.  
  968.  
  969. clouds()
  970. {
  971. self endon ( "ac130player_removed" );
  972.  
  973. wait 6;
  974. clouds_create();
  975. for(;;)
  976. {
  977. wait( randomfloatrange( 40, 80 ) );
  978. clouds_create();
  979. }
  980. }
  981.  
  982.  
  983. clouds_create()
  984. {
  985. if ( ( isdefined( level.playerWeapon ) ) && ( issubstr( tolower( level.playerWeapon ), "25" ) ) )
  986. return;
  987. playfxontagforclients( level._effect[ "cloud" ], level.ac130, "tag_player", level.ac130player );
  988. }
  989.  
  990.  
  991. gun_fired_and_ready_105mm()
  992. {
  993. self endon ( "ac130player_removed" );
  994. level notify( "gun_fired_and_ready_105mm" );
  995. level endon( "gun_fired_and_ready_105mm" );
  996.  
  997. wait 0.5;
  998.  
  999. if ( randomint( 2 ) == 0 )
  1000. thread context_Sensative_Dialog_Play_Random_Group_Sound( "weapons", "105mm_fired" );
  1001.  
  1002. wait 5.0;
  1003.  
  1004. thread context_Sensative_Dialog_Play_Random_Group_Sound( "weapons", "105mm_ready" );
  1005. }
  1006.  
  1007.  
  1008. shotFired()
  1009. {
  1010. self endon ( "ac130player_removed" );
  1011.  
  1012. for (;;)
  1013. {
  1014. self waittill( "projectile_impact", weaponName, position, radius );
  1015.  
  1016. if ( issubstr( tolower( weaponName ), "105" ) )
  1017. {
  1018. earthquake( 0.4, 1.0, position, 3500 );
  1019. self thread shotFiredDarkScreenOverlay();
  1020. }
  1021. else if ( issubstr( tolower( weaponName ), "40" ) )
  1022. {
  1023. earthquake( 0.2, 0.5, position, 2000 );
  1024. }
  1025.  
  1026. if ( getIntProperty( "ac130_ragdoll_deaths", 0 ) )
  1027. thread shotFiredPhysicsSphere( position, weaponName );
  1028.  
  1029. wait 0.05;
  1030. }
  1031. }
  1032.  
  1033.  
  1034. shotFiredPhysicsSphere( center, weapon )
  1035. {
  1036. wait 0.1;
  1037. physicsExplosionSphere( center, level.physicsSphereRadius[ weapon ], level.physicsSphereRadius[ weapon ] / 2, level.physicsSphereForce[ weapon ] );
  1038. }
  1039.  
  1040.  
  1041. shotFiredDarkScreenOverlay()
  1042. {
  1043. self endon( "ac130player_removed" );
  1044. self notify( "darkScreenOverlay" );
  1045. self endon( "darkScreenOverlay" );
  1046.  
  1047. if ( !isdefined( self.darkScreenOverlay ) )
  1048. {
  1049. self.darkScreenOverlay = newClientHudElem( self );
  1050. self.darkScreenOverlay.x = 0;
  1051. self.darkScreenOverlay.y = 0;
  1052. self.darkScreenOverlay.alignX = "left";
  1053. self.darkScreenOverlay.alignY = "top";
  1054. self.darkScreenOverlay.horzAlign = "fullscreen";
  1055. self.darkScreenOverlay.vertAlign = "fullscreen";
  1056. self.darkScreenOverlay setshader ( "black", 640, 480 );
  1057. self.darkScreenOverlay.sort = -10;
  1058. self.darkScreenOverlay.alpha = 0.0;
  1059. }
  1060.  
  1061. self.darkScreenOverlay.alpha = 0.0;
  1062. self.darkScreenOverlay fadeOverTime( 0.2 );
  1063. self.darkScreenOverlay.alpha = 0.6;
  1064. wait 0.4;
  1065. self.darkScreenOverlay fadeOverTime( 0.8 );
  1066. self.darkScreenOverlay.alpha = 0.0;
  1067. }
  1068.  
  1069.  
  1070. add_beacon_effect()
  1071. {
  1072. self endon( "death" );
  1073.  
  1074. flashDelay = 0.75;
  1075.  
  1076. wait randomfloat(3.0);
  1077. for (;;)
  1078. {
  1079. if ( level.ac130player )
  1080. playfxontagforclients( level._effect[ "beacon" ], self, "j_spine4", level.ac130player );
  1081. wait flashDelay;
  1082. }
  1083. }
  1084.  
  1085.  
  1086. context_Sensative_Dialog()
  1087. {
  1088. thread enemy_killed_thread();
  1089.  
  1090. thread context_Sensative_Dialog_Guy_In_Sight();
  1091. thread context_Sensative_Dialog_Guy_Crawling();
  1092. thread context_Sensative_Dialog_Guy_Pain();
  1093. thread context_Sensative_Dialog_Secondary_Explosion_Vehicle();
  1094. thread context_Sensative_Dialog_Kill_Thread();
  1095. thread context_Sensative_Dialog_Locations();
  1096. thread context_Sensative_Dialog_Filler();
  1097. }
  1098.  
  1099.  
  1100. context_Sensative_Dialog_Guy_In_Sight()
  1101. {
  1102. self endon ( "ac130player_removed" );
  1103.  
  1104. for (;;)
  1105. {
  1106. if ( context_Sensative_Dialog_Guy_In_Sight_Check() )
  1107. thread context_Sensative_Dialog_Play_Random_Group_Sound( "ai", "in_sight" );
  1108. wait randomfloatrange( 1, 3 );
  1109. }
  1110. }
  1111.  
  1112.  
  1113. context_Sensative_Dialog_Guy_In_Sight_Check()
  1114. {
  1115. prof_begin( "AI_in_sight_check" );
  1116.  
  1117. //enemies = getaiarray( "axis" );
  1118. //replace with level of enemy team members?
  1119. enemies = [];
  1120.  
  1121. for( i = 0 ; i < enemies.size ; i++ )
  1122. {
  1123. if ( !isdefined( enemies[ i ] ) )
  1124. continue;
  1125.  
  1126. if ( !isalive( enemies[ i ] ) )
  1127. continue;
  1128.  
  1129. if ( within_fov( level.ac130player getEye(), level.ac130player getPlayerAngles(), enemies[ i ].origin, level.cosine[ "5" ] ) )
  1130. {
  1131. prof_end( "AI_in_sight_check" );
  1132. return true;
  1133. }
  1134. wait 0.05;
  1135. }
  1136.  
  1137. prof_end( "AI_in_sight_check" );
  1138. return false;
  1139. }
  1140.  
  1141.  
  1142. context_Sensative_Dialog_Guy_Crawling()
  1143. {
  1144. self endon ( "ac130player_removed" );
  1145.  
  1146. for (;;)
  1147. {
  1148. level waittill ( "ai_crawling", guy );
  1149.  
  1150. /#
  1151. if ( ( isdefined( guy ) ) && ( isdefined( guy.origin ) ) )
  1152. {
  1153. if ( getdvar( "ac130_debug_context_sensative_dialog", 0 ) == "1" )
  1154. thread debug_line(level.ac130player.origin, guy.origin, 5.0, ( 0, 1, 0 ) );
  1155. }
  1156. #/
  1157. thread context_Sensative_Dialog_Play_Random_Group_Sound( "ai", "wounded_crawl" );
  1158. }
  1159. }
  1160.  
  1161.  
  1162. context_Sensative_Dialog_Guy_Pain()
  1163. {
  1164. self endon ( "ac130player_removed" );
  1165.  
  1166. for (;;)
  1167. {
  1168. level waittill ( "ai_pain", guy );
  1169. /#
  1170. if ( ( isdefined( guy ) ) && ( isdefined( guy.origin ) ) )
  1171. {
  1172. if ( getdvar( "ac130_debug_context_sensative_dialog" ) == "1" )
  1173. thread debug_line( level.ac130player.origin, guy.origin, 5.0, ( 1, 0, 0 ) );
  1174. }
  1175. #/
  1176. thread context_Sensative_Dialog_Play_Random_Group_Sound( "ai", "wounded_pain" );
  1177. }
  1178. }
  1179.  
  1180.  
  1181. context_Sensative_Dialog_Secondary_Explosion_Vehicle()
  1182. {
  1183. self endon ( "ac130player_removed" );
  1184.  
  1185. for (;;)
  1186. {
  1187. level waittill ( "player_destroyed_car", player, vehicle_origin );
  1188.  
  1189. wait 1;
  1190. /#
  1191. if ( isdefined( vehicle_origin ) )
  1192. {
  1193. if ( getdvar( "ac130_debug_context_sensative_dialog" ) == "1" )
  1194. thread debug_line( level.ac130player.origin, vehicle_origin, 5.0, ( 0, 0, 1 ) );
  1195. }
  1196. #/
  1197.  
  1198. thread context_Sensative_Dialog_Play_Random_Group_Sound( "explosion", "secondary" );
  1199. }
  1200. }
  1201.  
  1202.  
  1203. enemy_killed_thread()
  1204. {
  1205. self endon ( "ac130player_removed" );
  1206.  
  1207. for ( ;; )
  1208. {
  1209. level waittill ( "ai_killed", guy );
  1210.  
  1211. // context kill dialog
  1212. thread context_Sensative_Dialog_Kill( guy, level.ac130player );
  1213. }
  1214. }
  1215.  
  1216.  
  1217. context_Sensative_Dialog_Kill( guy, attacker )
  1218. {
  1219. if ( !isdefined( attacker ) )
  1220. return;
  1221.  
  1222. if ( !isplayer( attacker ) )
  1223. return;
  1224.  
  1225. level.enemiesKilledInTimeWindow++;
  1226. level notify ( "enemy_killed" );
  1227.  
  1228. /#
  1229. if ( ( isdefined( guy ) ) && ( isdefined( guy.origin ) ) )
  1230. {
  1231. if ( getdvar( "ac130_debug_context_sensative_dialog" ) == "1" )
  1232. thread debug_line( level.ac130player.origin, guy.origin, 5.0, ( 1, 1, 0 ) );
  1233. }
  1234. #/
  1235.  
  1236. }
  1237.  
  1238.  
  1239. context_Sensative_Dialog_Kill_Thread()
  1240. {
  1241. self endon ( "ac130player_removed" );
  1242.  
  1243. timeWindow = 1;
  1244. for (;;)
  1245. {
  1246. level waittill ( "enemy_killed" );
  1247. wait timeWindow;
  1248. println ( "guys killed in time window: " );
  1249. println ( level.enemiesKilledInTimeWindow );
  1250.  
  1251. soundAlias1 = "kill";
  1252. soundAlias2 = undefined;
  1253.  
  1254. if ( level.enemiesKilledInTimeWindow >= 2 )
  1255. soundAlias2 = "small_group";
  1256. else
  1257. {
  1258. soundAlias2 = "single";
  1259. if ( randomint( 3 ) != 1 )
  1260. {
  1261. level.enemiesKilledInTimeWindow = 0;
  1262. continue;
  1263. }
  1264. }
  1265.  
  1266. level.enemiesKilledInTimeWindow = 0;
  1267. assert( isdefined( soundAlias2 ) );
  1268.  
  1269. thread context_Sensative_Dialog_Play_Random_Group_Sound( soundAlias1, soundAlias2, true );
  1270. }
  1271. }
  1272.  
  1273.  
  1274. context_Sensative_Dialog_Locations()
  1275. {
  1276. array_thread( getentarray( "context_dialog_car", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "car" );
  1277. array_thread( getentarray( "context_dialog_truck", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "truck" );
  1278. array_thread( getentarray( "context_dialog_building", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "building" );
  1279. array_thread( getentarray( "context_dialog_wall", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "wall" );
  1280. array_thread( getentarray( "context_dialog_field", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "field" );
  1281. array_thread( getentarray( "context_dialog_road", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "road" );
  1282. array_thread( getentarray( "context_dialog_church", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "church" );
  1283. array_thread( getentarray( "context_dialog_ditch", "targetname" ), ::context_Sensative_Dialog_Locations_Add_Notify_Event, "ditch" );
  1284.  
  1285. thread context_Sensative_Dialog_Locations_Thread();
  1286. }
  1287.  
  1288. context_Sensative_Dialog_Locations_Thread()
  1289. {
  1290. self endon ( "ac130player_removed" );
  1291.  
  1292. for (;;)
  1293. {
  1294. level waittill ( "context_location", locationType );
  1295.  
  1296. if ( !isdefined( locationType ) )
  1297. {
  1298. assertMsg( "LocationType " + locationType + " is not valid" );
  1299. continue;
  1300. }
  1301.  
  1302. if ( !flag( "allow_context_sensative_dialog" ) )
  1303. continue;
  1304.  
  1305. thread context_Sensative_Dialog_Play_Random_Group_Sound( "location", locationType );
  1306.  
  1307. wait ( 5 + randomfloat( 10 ) );
  1308. }
  1309. }
  1310.  
  1311. context_Sensative_Dialog_Locations_Add_Notify_Event( locationType )
  1312. {
  1313. self endon ( "ac130player_removed" );
  1314.  
  1315. for (;;)
  1316. {
  1317. self waittill ( "trigger", triggerer );
  1318.  
  1319. if ( !isdefined( triggerer ) )
  1320. continue;
  1321.  
  1322. if ( ( !isdefined( triggerer.team) ) || ( triggerer.team != "axis" ) )
  1323. continue;
  1324.  
  1325. level notify ( "context_location", locationType );
  1326.  
  1327. wait 5;
  1328. }
  1329. }
  1330.  
  1331. context_Sensative_Dialog_VehicleSpawn( vehicle )
  1332. {
  1333. if ( vehicle.script_team != "axis" )
  1334. return;
  1335.  
  1336. thread context_Sensative_Dialog_VehicleDeath( vehicle );
  1337.  
  1338. vehicle endon( "death" );
  1339.  
  1340. while( !within_fov( level.ac130player getEye(), level.ac130player getPlayerAngles(), vehicle.origin, level.cosine[ "45" ] ) )
  1341. wait 0.5;
  1342.  
  1343. context_Sensative_Dialog_Play_Random_Group_Sound( "vehicle", "incoming" );
  1344. }
  1345.  
  1346. context_Sensative_Dialog_VehicleDeath( vehicle )
  1347. {
  1348. vehicle waittill( "death" );
  1349. thread context_Sensative_Dialog_Play_Random_Group_Sound( "vehicle", "death" );
  1350. }
  1351.  
  1352. context_Sensative_Dialog_Filler()
  1353. {
  1354. self endon ( "ac130player_removed" );
  1355.  
  1356. for(;;)
  1357. {
  1358. if( ( isdefined( level.radio_in_use ) ) && ( level.radio_in_use == true ) )
  1359. level waittill ( "radio_not_in_use" );
  1360.  
  1361. // if 3 seconds has passed and nothing has been transmitted then play a sound
  1362. currentTime = getTime();
  1363. if ( ( currentTime - level.lastRadioTransmission ) >= 3000 )
  1364. {
  1365. level.lastRadioTransmission = currentTime;
  1366. thread context_Sensative_Dialog_Play_Random_Group_Sound( "misc", "action" );
  1367. }
  1368.  
  1369. wait 0.25;
  1370. }
  1371. }
  1372.  
  1373. context_Sensative_Dialog_Play_Random_Group_Sound( name1, name2, force_transmit_on_turn )
  1374. {
  1375. level endon ( "ac130player_removed" );
  1376.  
  1377. assert( isdefined( level.scr_sound[ name1 ] ) );
  1378. assert( isdefined( level.scr_sound[ name1 ][ name2 ] ) );
  1379.  
  1380. if ( !isdefined( force_transmit_on_turn ) )
  1381. force_transmit_on_turn = false;
  1382.  
  1383. if ( !flag( "allow_context_sensative_dialog" ) )
  1384. {
  1385. if ( force_transmit_on_turn )
  1386. flag_wait( "allow_context_sensative_dialog" );
  1387. else
  1388. return;
  1389. }
  1390.  
  1391. validGroupNum = undefined;
  1392.  
  1393. randGroup = randomint( level.scr_sound[ name1 ][ name2 ].size );
  1394.  
  1395. // if randGroup has already played
  1396. if ( level.scr_sound[ name1 ][ name2 ][ randGroup ].played == true )
  1397. {
  1398. //loop through all groups and use the next one that hasn't played yet
  1399.  
  1400. for( i = 0 ; i < level.scr_sound[ name1 ][ name2 ].size ; i++ )
  1401. {
  1402. randGroup++;
  1403. if ( randGroup >= level.scr_sound[ name1 ][ name2 ].size )
  1404. randGroup = 0;
  1405. if ( level.scr_sound[ name1 ][ name2 ][ randGroup ].played == true )
  1406. continue;
  1407. validGroupNum = randGroup;
  1408. break;
  1409. }
  1410.  
  1411. // all groups have been played, reset all groups to false and pick a new random one
  1412. if ( !isdefined( validGroupNum ) )
  1413. {
  1414. for( i = 0 ; i < level.scr_sound[ name1 ][ name2 ].size ; i++ )
  1415. level.scr_sound[ name1 ][ name2 ][ i ].played = false;
  1416. validGroupNum = randomint( level.scr_sound[ name1 ][ name2 ].size );
  1417. }
  1418. }
  1419. else
  1420. validGroupNum = randGroup;
  1421.  
  1422. assert( isdefined( validGroupNum ) );
  1423. assert( validGroupNum >= 0 );
  1424.  
  1425. if ( context_Sensative_Dialog_Timedout( name1, name2, validGroupNum ) )
  1426. return;
  1427.  
  1428. level.scr_sound[ name1 ][ name2 ][ validGroupNum ].played = true;
  1429. randSound = randomint( level.scr_sound[ name1 ][ name2 ][ validGroupNum ].size );
  1430. playSoundOverRadio( level.scr_sound[ name1 ][ name2 ][ validGroupNum ].sounds[ randSound ], force_transmit_on_turn );
  1431. }
  1432.  
  1433. context_Sensative_Dialog_Timedout( name1, name2, groupNum )
  1434. {
  1435. // dont play this sound if it has a timeout specified and the timeout has not expired
  1436.  
  1437. if( !isdefined( level.context_sensative_dialog_timeouts ) )
  1438. return false;
  1439.  
  1440. if( !isdefined( level.context_sensative_dialog_timeouts[ name1 ] ) )
  1441. return false;
  1442.  
  1443. if( !isdefined( level.context_sensative_dialog_timeouts[ name1 ][name2 ] ) )
  1444. return false;
  1445.  
  1446. if( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups ) && isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ] ) )
  1447. {
  1448. assert( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v[ "timeoutDuration" ] ) );
  1449. assert( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v[ "lastPlayed" ] ) );
  1450.  
  1451. currentTime = getTime();
  1452. if( ( currentTime - level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v[ "lastPlayed" ] ) < level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v[ "timeoutDuration" ] )
  1453. return true;
  1454.  
  1455. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].groups[ string( groupNum ) ].v[ "lastPlayed" ] = currentTime;
  1456. }
  1457. else if ( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v ) )
  1458. {
  1459. assert( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v[ "timeoutDuration" ] ) );
  1460. assert( isdefined( level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v[ "lastPlayed" ] ) );
  1461.  
  1462. currentTime = getTime();
  1463. if( ( currentTime - level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v[ "lastPlayed" ] ) < level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v[ "timeoutDuration" ] )
  1464. return true;
  1465.  
  1466. level.context_sensative_dialog_timeouts[ name1 ][ name2 ].v[ "lastPlayed" ] = currentTime;
  1467. }
  1468.  
  1469. return false;
  1470. }
  1471.  
  1472. playSoundOverRadio( soundAlias, force_transmit_on_turn, timeout )
  1473. {
  1474. if ( !isdefined( level.radio_in_use ) )
  1475. level.radio_in_use = false;
  1476. if ( !isdefined( force_transmit_on_turn ) )
  1477. force_transmit_on_turn = false;
  1478. if ( !isdefined( timeout ) )
  1479. timeout = 0;
  1480. timeout = timeout * 1000;
  1481. soundQueueTime = gettime();
  1482.  
  1483. soundPlayed = false;
  1484. soundPlayed = playAliasOverRadio( soundAlias );
  1485. if ( soundPlayed )
  1486. return;
  1487.  
  1488. // Dont make the sound wait to be played if force transmit wasn't set to true
  1489. if ( !force_transmit_on_turn )
  1490. return;
  1491.  
  1492. level.radioForcedTransmissionQueue[ level.radioForcedTransmissionQueue.size ] = soundAlias;
  1493. while( !soundPlayed )
  1494. {
  1495. if ( level.radio_in_use )
  1496. level waittill ( "radio_not_in_use" );
  1497.  
  1498. if ( ( timeout > 0 ) && ( getTime() - soundQueueTime > timeout ) )
  1499. break;
  1500.  
  1501. if ( !isDefined( level.ac130player ) )
  1502. break;
  1503.  
  1504. soundPlayed = playAliasOverRadio( level.radioForcedTransmissionQueue[ 0 ] );
  1505. if ( !level.radio_in_use && isDefined( level.ac130player ) && !soundPlayed )
  1506. assertMsg( "The radio wasn't in use but the sound still did not play. This should never happen." );
  1507. }
  1508. level.radioForcedTransmissionQueue = array_remove_index( level.radioForcedTransmissionQueue, 0 );
  1509. }
  1510.  
  1511.  
  1512. playAliasOverRadio( soundAlias )
  1513. {
  1514. if ( level.radio_in_use )
  1515. return false;
  1516.  
  1517. if ( !isDefined( level.ac130player ) )
  1518. return false;
  1519.  
  1520. level.radio_in_use = true;
  1521. if ( self.team == "allies" || self.team == "axis" )
  1522. {
  1523. soundAlias = maps\mp\gametypes\_teams::getTeamVoicePrefix( self.team ) + soundAlias;
  1524. level.ac130player playLocalSound( soundAlias );
  1525. }
  1526. wait ( 4.0 );
  1527. level.radio_in_use = false;
  1528. level.lastRadioTransmission = getTime();
  1529. level notify ( "radio_not_in_use" );
  1530. return true;
  1531. }
  1532.  
  1533.  
  1534. debug_circle(center, radius, duration, color, startDelay, fillCenter)
  1535. {
  1536. circle_sides = 16;
  1537.  
  1538. angleFrac = 360/circle_sides;
  1539. circlepoints = [];
  1540. for(i=0;i<circle_sides;i++)
  1541. {
  1542. angle = (angleFrac * i);
  1543. xAdd = cos(angle) * radius;
  1544. yAdd = sin(angle) * radius;
  1545. x = center[0] + xAdd;
  1546. y = center[1] + yAdd;
  1547. z = center[2];
  1548. circlepoints[circlepoints.size] = (x,y,z);
  1549. }
  1550.  
  1551. if (isdefined(startDelay))
  1552. wait startDelay;
  1553.  
  1554. thread debug_circle_drawlines(circlepoints, duration, color, fillCenter, center);
  1555. }
  1556.  
  1557.  
  1558. debug_circle_drawlines(circlepoints, duration, color, fillCenter, center)
  1559. {
  1560. if (!isdefined(fillCenter))
  1561. fillCenter = false;
  1562. if (!isdefined(center))
  1563. fillCenter = false;
  1564.  
  1565. for( i = 0 ; i < circlepoints.size ; i++ )
  1566. {
  1567. start = circlepoints[i];
  1568. if (i + 1 >= circlepoints.size)
  1569. end = circlepoints[0];
  1570. else
  1571. end = circlepoints[i + 1];
  1572.  
  1573. thread debug_line( start, end, duration, color);
  1574.  
  1575. if (fillCenter)
  1576. thread debug_line( center, start, duration, color);
  1577. }
  1578. }
  1579.  
  1580.  
  1581. debug_line(start, end, duration, color)
  1582. {
  1583. if (!isdefined(color))
  1584. color = (1,1,1);
  1585.  
  1586. for ( i = 0; i < (duration * 20) ; i++ )
  1587. {
  1588. line(start, end, color);
  1589. wait 0.05;
  1590. }
  1591. }
  1592.  
  1593.  
  1594. handleIncomingStinger()
  1595. {
  1596. level endon ( "game_ended" );
  1597.  
  1598. for ( ;; )
  1599. {
  1600. level waittill ( "stinger_fired", player, missile, lockTarget );
  1601.  
  1602. if ( !IsDefined( lockTarget ) || (lockTarget != level.ac130.planeModel) )
  1603. continue;
  1604.  
  1605. missile thread stingerProximityDetonate( player, player.team );
  1606. }
  1607. }
  1608.  
  1609. deleteAfterTime( delay )
  1610. {
  1611. wait ( delay );
  1612.  
  1613. self delete();
  1614. }
  1615.  
  1616.  
  1617. stingerProximityDetonate( player, missileTeam )
  1618. {
  1619. self endon ( "death" );
  1620.  
  1621. if ( isDefined( level.ac130player ) )
  1622. level.ac130player playLocalSound( "missile_incoming" );
  1623.  
  1624. level.ac130.incomingMissile = true;
  1625.  
  1626. missileTarget = level.ac130.planeModel;
  1627.  
  1628. self Missile_SetTargetEnt( missileTarget );
  1629.  
  1630. didSeatbelts = false;
  1631. minDist = distance( self.origin, missileTarget GetPointInBounds( 0, 0, 0 ) );
  1632.  
  1633. for ( ;; )
  1634. {
  1635. center = missileTarget GetPointInBounds( 0, 0, 0 );
  1636.  
  1637. curDist = distance( self.origin, center );
  1638.  
  1639. if ( !isDefined( level.ac130player ) )
  1640. {
  1641. self Missile_SetTargetPos( level.ac130.origin + (0,0,100000) );
  1642. return;
  1643. }
  1644.  
  1645. if ( curDist < 3000 && missileTarget == level.ac130.planeModel && level.ac130.numFlares > 0 )
  1646. {
  1647. level.ac130.numFlares--;
  1648.  
  1649. newTarget = missileTarget deployFlares();
  1650.  
  1651. self Missile_SetTargetEnt( newTarget );
  1652. missileTarget = newTarget;
  1653.  
  1654. if ( isDefined( level.ac130player ) )
  1655. level.ac130player stopLocalSound( "missile_incoming" );
  1656. }
  1657.  
  1658. if ( curDist < minDist )
  1659. {
  1660. speedPerFrame = (minDist - curDist) * 20;
  1661. eta = (curDist / speedPerFrame);
  1662.  
  1663. if ( eta < 1.5 && !didSeatbelts && missileTarget == level.ac130.planeModel )
  1664. {
  1665. if ( isDefined( level.ac130player ) )
  1666. level.ac130player playLocalSound( "fasten_seatbelts" );
  1667.  
  1668. didSeatbelts = true;
  1669. }
  1670.  
  1671. minDist = curDist;
  1672. }
  1673.  
  1674. if ( curDist > minDist )
  1675. {
  1676. if ( curDist > 1536 )
  1677. return;
  1678.  
  1679. if ( isDefined( level.ac130player ) )
  1680. {
  1681. level.ac130player stopLocalSound( "missile_incoming" );
  1682.  
  1683. if ( level.ac130player.team != missileTeam )
  1684. radiusDamage( self.origin, 1000, 1000, 1000, player );
  1685. }
  1686.  
  1687. /*
  1688. playFx( level.stingerFXid, self.origin );
  1689. //thread crashPlane( 20.0 );
  1690.  
  1691. self playSound( "remotemissile_explode" );
  1692. */
  1693. self hide();
  1694.  
  1695. wait ( 0.05 );
  1696. self delete();
  1697. }
  1698.  
  1699. wait ( 0.05 );
  1700. }
  1701. }
  1702.  
  1703.  
  1704.  
  1705. crashPlane( crashTime )
  1706. {
  1707. level.ac130.planeModel notify ( "crashing" );
  1708. level.ac130.planeModel.crashed = true;
  1709.  
  1710. playFxOnTag( level._effect[ "ac130_explode" ], level.ac130.planeModel, "tag_deathfx" );
  1711. wait .25;
  1712.  
  1713. level.ac130.planeModel hide();
  1714. }
  1715.  
  1716.  
  1717. playFlareFx( flareCount )
  1718. {
  1719. for ( i = 0; i < flareCount; i++ )
  1720. {
  1721. self thread angel_flare();
  1722.  
  1723. wait ( randomFloatRange( 0.1, 0.25 ) );
  1724. }
  1725. }
  1726.  
  1727.  
  1728. deployFlares( fxOnly )
  1729. {
  1730. self playSound( "ac130_flare_burst" );
  1731.  
  1732. if ( !isDefined( fxOnly ) )
  1733. {
  1734. flareObject = spawn( "script_origin", level.ac130.planemodel.origin );
  1735. flareObject.angles = level.ac130.planemodel.angles;
  1736.  
  1737. flareObject moveGravity( (0, 0, 0), 5.0 );
  1738.  
  1739. self thread playFlareFx( 10 );
  1740.  
  1741. flareObject thread deleteAfterTime( 5.0 );
  1742.  
  1743. return flareObject;
  1744. }
  1745. else
  1746. {
  1747. self thread playFlareFx( 5 );
  1748. }
  1749. }
  1750.  
  1751.  
  1752. angelFlarePrecache()
  1753. {
  1754. precacheModel( "angel_flare_rig" );
  1755.  
  1756. precacheMpAnim( "ac130_angel_flares01" );
  1757. precacheMpAnim( "ac130_angel_flares02" );
  1758. precacheMpAnim( "ac130_angel_flares03" );
  1759.  
  1760. level._effect[ "angel_flare_geotrail" ] = loadfx( "smoke/angel_flare_geotrail" );
  1761. level._effect[ "angel_flare_swirl" ] = loadfx( "smoke/angel_flare_swirl_runner" );
  1762. }
  1763.  
  1764. angel_flare()
  1765. {
  1766. rig = spawn( "script_model", self.origin );
  1767. rig setModel( "angel_flare_rig" );
  1768.  
  1769. rig.origin = self getTagOrigin( "tag_flash_flares" );
  1770. rig.angles = self getTagAngles( "tag_flash_flares" );
  1771.  
  1772. rig.angles = (rig.angles[0],rig.angles[1] + 180,rig.angles[2] + -90);
  1773.  
  1774. fx_id = level._effect[ "angel_flare_geotrail" ];
  1775.  
  1776. rig ScriptModelPlayAnim( "ac130_angel_flares0" + (randomInt( 3 )+1) );
  1777.  
  1778. wait 0.1;
  1779. PlayFXOnTag( fx_id, rig, "flare_left_top" );
  1780. PlayFXOnTag( fx_id, rig, "flare_right_top" );
  1781. wait 0.05;
  1782. PlayFXOnTag( fx_id, rig, "flare_left_bot" );
  1783. PlayFXOnTag( fx_id, rig, "flare_right_bot" );
  1784.  
  1785. //rig waittillmatch( "flare_anim", "end" );
  1786. wait ( 3.0 );
  1787.  
  1788. StopFXOnTag( fx_id, rig, "flare_left_top" );
  1789. StopFXOnTag( fx_id, rig, "flare_right_top" );
  1790. StopFXOnTag( fx_id, rig, "flare_left_bot" );
  1791. StopFXOnTag( fx_id, rig, "flare_right_bot" );
  1792.  
  1793. rig delete();
  1794. }
  1795.  
  1796. /*
  1797. #using_animtree( "script_model" );
  1798. angel_flare_rig_anims()
  1799. {
  1800. level.scr_animtree[ "angel_flare_rig" ] = #animtree;
  1801. level.scr_model[ "angel_flare_rig" ] = "angel_flare_rig";
  1802.  
  1803. level.scr_anim[ "angel_flare_rig" ][ "ac130_angel_flares" ][0] = %ac130_angel_flares01;
  1804. level.scr_anim[ "angel_flare_rig" ][ "ac130_angel_flares" ][1] = %ac130_angel_flares02;
  1805. level.scr_anim[ "angel_flare_rig" ][ "ac130_angel_flares" ][2] = %ac130_angel_flares03;
  1806.  
  1807. }
  1808.  
  1809. assign_model()
  1810. {
  1811. AssertEx( IsDefined( level.scr_model[ self.animname ] ), "There is no level.scr_model for animname " + self.animname );
  1812.  
  1813. if ( IsArray( level.scr_model[ self.animname ] ) )
  1814. {
  1815. randIndex = RandomInt( level.scr_model[ self.animname ].size );
  1816. self SetModel( level.scr_model[ self.animname ][ randIndex ] );
  1817. }
  1818. else
  1819. self SetModel( level.scr_model[ self.animname ] );
  1820. }
  1821. assign_animtree( animname )
  1822. {
  1823. if ( IsDefined( animname ) )
  1824. self.animname = animname;
  1825.  
  1826. AssertEx( IsDefined( level.scr_animtree[ self.animname ] ), "There is no level.scr_animtree for animname " + self.animname );
  1827. self UseAnimTree( level.scr_animtree[ self.animname ] );
  1828. }
  1829.  
  1830. spawn_anim_model( animname, origin )
  1831. {
  1832. if ( !isdefined( origin ) )
  1833. origin = ( 0, 0, 0 );
  1834. model = Spawn( "script_model", origin );
  1835. model.animname = animname;
  1836. model assign_animtree();
  1837. model assign_model();
  1838. return model;
  1839. }
  1840.  
  1841.  
  1842. angel_flare_burst( flare_count )
  1843. {
  1844. // Angel Flare Swirl
  1845. PlayFXOnTag( getfx( "angel_flare_swirl" ), self, "tag_flash_flares" );
  1846.  
  1847. // Angel Flare Trails
  1848. for( i=0; i<flare_count; i++ )
  1849. {
  1850. self thread angel_flare();
  1851. wait randomfloatrange( 0.1, 0.25 );
  1852. }
  1853. }
  1854. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement