Advertisement
Adam445

char_museum.gsc

Mar 26th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 54.42 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\_hud_util;
  3. #include maps\_utility;
  4. #include maps\_anim;
  5. #include maps\_vehicle;
  6. #include maps\char_museum_code;
  7. #using_animtree( "generic_human" );
  8.  
  9. main()
  10. {
  11. level.GLOBAL_ANIM_SPEED = .65;
  12. level.guys = [];
  13. level.activeRoom = "none";
  14. level.anim_ai = [];
  15. level.panic_guys = 0;
  16. level.pmc_alljuggernauts = true;
  17.  
  18. flag_init( "do_museum_credits" );
  19. flag_init( "panic_button" );
  20. flag_init( "fade_from_black" );
  21. flag_init( "looked_at_big_board" );
  22. flag_init( "museum_ready" );
  23. flag_init( "spawn_room1_civs" );
  24. flag_init( "af_caves_done" );
  25. flag_init( "dc_burning_done" );
  26. flag_init( "airport_done" );
  27. flag_init( "cliffhanger_done" );
  28. flag_init( "favela_done" );
  29. flag_init( "oilrig_done" );
  30. flag_init( "estate_done" );
  31. flag_init( "hostage_done" );
  32. flag_init( "arcadia_done" );
  33. flag_init( "trainer_done" );
  34.  
  35. switch( level.level_mode )
  36. {
  37. case "free": //-> free roam
  38. default_start( ::start_free );
  39. add_start( "free", ::start_free, "[free_roam]", ::museum_main );
  40. setdvar( "start", "" );
  41. break;
  42.  
  43. case "credits_black": //-> coming from menu after never beating game
  44. maps\_credits::initcredits( "all" );
  45. level.credits_speed = level.credits_speed * .75;
  46. default_start( ::start_black );
  47. add_start( "black", ::start_black, "[black_credits]", ::black_main );
  48. break;
  49.  
  50. case "credits_1": //-> coming from af_chase
  51. maps\_credits::initcredits( "all" );
  52. break;
  53. case "credits_2": //-> coming from menu after beating game
  54. maps\_credits::initcredits( "all" );
  55. default_start( ::start_afcaves );
  56. break;
  57. }
  58.  
  59. add_start( "af_caves", ::start_afcaves, "[af_caves]", ::afcaves_main );
  60. add_start( "dc_burning", ::start_dcburning, "[dc_burning]", ::dcburning_main );
  61. add_start( "airport", ::start_airport, "[airport]", ::airport_main );
  62. add_start( "cliffhanger", ::start_cliffhanger,"[cliffhanger]", ::cliffhanger_main );
  63. add_start( "favela", ::start_favela, "[favela]", ::favela_main );
  64. add_start( "hallway1", ::start_hallway1, "[hallway1]", ::hallway1_main );
  65. add_start( "vehicles", ::start_vehicles, "[vehicles]", ::vehicles_main );
  66. add_start( "hallway2", ::start_hallway2, "[hallway2]", ::hallway2_main );
  67. add_start( "oilrig", ::start_oilrig, "[oilrig]", ::oilrig_main );
  68. add_start( "estate", ::start_estate, "[estate]", ::estate_main );
  69. add_start( "hostage", ::start_hostage, "[hostage]", ::hostage_main );
  70. add_start( "trainer", ::start_trainer, "[trainer]", ::trainer_main );
  71. add_start( "arcadia", ::start_arcadia, "[arcadia]", ::arcadia_main );
  72.  
  73. animscripts\dog\dog_init::initDogAnimations();
  74. maps\char_museum_precache::main();
  75. maps\char_museum_fx::main();
  76.  
  77. if( level.level_mode != "credits_1" )
  78. {
  79. maps\_load::main();
  80. //HAS TO COME AFTER _LOAD::MAIN()
  81. setSavedDvar( "sv_saveOnStartMap", false );
  82. imagename = "levelshots / autosave / autosave_" + level.script + "start";
  83. // string not found for AUTOSAVE_LEVELSTART
  84. SaveGame( "levelstart", &"AUTOSAVE_LEVELSTART", imagename, true );
  85. maps\_load::set_player_viewhand_model( "viewhands_player_us_army" );
  86. }
  87.  
  88. maps\_drone_civilian::init();
  89. maps\_drone_ai::init();
  90.  
  91. thread post_init();
  92. }
  93.  
  94. post_init()
  95. {
  96. if( level.level_mode == "credits_1" )
  97. {
  98. flag_wait( "do_museum_credits" );
  99. thread start_afcaves();
  100. }
  101.  
  102. maps\char_museum_anim::main();
  103.  
  104. thread sign_departure_status();
  105. array_thread( getentarray( "c4barrelPacks", "script_noteworthy" ), ::c4_packs_think );
  106.  
  107. SetSavedDvar( "player_sprintUnlimited", "1" );
  108. SetSavedDvar( "ui_hidemap", "1" );
  109.  
  110. level.friendlyFireDisabled = true;
  111. thread battlechatter_off();
  112. }
  113.  
  114.  
  115.  
  116. /************************************************************************************************************/
  117. /* AF_CAVES */
  118. /************************************************************************************************************/
  119.  
  120. afcaves_setup()
  121. {
  122. level.anim_ai[ "af_caves" ] = [];
  123. array_thread( getentarray( "ai_af_caves", "script_noteworthy" ), ::add_spawn_function, ::afcaves_ai_setup );
  124. array_thread( getentarray( "ai_af_caves", "script_noteworthy" ), ::add_spawn_function, ::afcaves_ai_think );
  125. }
  126.  
  127. afcaves_main()
  128. {
  129. if( level.level_mode == "credits_1" )
  130. {
  131. flag_wait( "do_museum_credits" );
  132. flag_wait( "museum_ready" );
  133. }
  134.  
  135. array_thread( getentarray( "civ_af_caves_1", "script_noteworthy" ), ::add_spawn_function, ::afcaves_civ1_think );
  136. thread afcaves_camera_think();
  137.  
  138. flag_wait( "af_caves_spawn_civs" );
  139. array_thread( getentarray( "civ_af_caves_1", "script_noteworthy" ), ::spawn_ai, true );
  140.  
  141. flag_wait( "spawn_room1_civs" );
  142. array_thread( getentarray( "civ_af_caves_2", "script_noteworthy" ), ::spawn_ai, true );
  143.  
  144. flag_wait( "af_caves_done" );
  145. wait 1.25;
  146. array_thread( getentarray( "civ_af_caves_3", "script_noteworthy" ), ::delaythread, 1.25, ::spawn_ai, true );
  147. camera_move( "camara_path_dc_burning", 25 );
  148. }
  149.  
  150. afcaves_camera_think()
  151. {
  152. flag_wait( "fade_from_black" );
  153.  
  154. node = getvehiclenode( "camara_path_af_caves", "targetname" );
  155. level.camera vehicle_teleport( node.origin, node.angles );
  156. level.camera thread vehicle_paths( node );
  157. level.camera attachpath( node );
  158. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  159.  
  160. wait .5;
  161.  
  162. level.camera ResumeSpeed( .5 );
  163. level.camera waittill( "reached_end_node" );
  164. camera_move( "camara_path_af_caves2", 6.5 );
  165.  
  166. level.camera ResumeSpeed( .5 );
  167. level.camera waittill( "reached_end_node" );
  168. }
  169.  
  170. afcaves_civ1_think()
  171. {
  172. guys = [];
  173. foreach( ai in level.anim_ai[ "af_caves" ] )
  174. {
  175. switch( ai.animation )
  176. {
  177. case "training_intro_foley_idle_talk_1":
  178. guys[ 0 ] = ai;
  179. break;
  180. case "afgan_caves_Price_rappel_idle":
  181. guys[ 1 ] = ai;
  182. break;
  183. case "casual_stand_v2_twitch_shift":
  184. guys[ 2 ] = ai;
  185. break;
  186. case "afchase_ending_shepherd_gun_monologue":
  187. guys[ 3 ] = ai;
  188. break;
  189. case "zodiac_trans_L2R":
  190. guys[ 4 ] = ai;
  191. break;
  192. case "casual_stand_v2_idle":
  193. guys[ 5 ] = ai;
  194. break;
  195. }
  196. }
  197.  
  198. num = 0;
  199. while( num < 6 )
  200. {
  201. wait .05;
  202.  
  203. p1 = level.player.origin;
  204. p1 = ( p1[0], p1[1], 0 );
  205.  
  206. p2 = self.origin;
  207. p2 = ( p2[0], p2[1], 0 );
  208.  
  209. p3 = guys[ num ].origin;
  210. p3 = ( p3[0], p3[1], 0 );
  211.  
  212. dot = vectordot( vectornormalize( p3 - p1 ), vectornormalize( p2 - p1 ) );
  213.  
  214. if( dot < .999 )
  215. continue;
  216.  
  217. guys[ num ] ent_flag_set( "do_anim" );
  218. num++;
  219. }
  220.  
  221. flag_set( "spawn_room1_civs" );
  222. }
  223.  
  224. afcaves_ai_setup()
  225. {
  226. self ai_default_setup( "af_caves" );
  227. node = self.anim_node;
  228.  
  229. wait .05;
  230.  
  231. switch( node.animation )
  232. {
  233. case "afchase_ending_shepherd_gun_monologue":
  234. self.anim_speed = level.GLOBAL_ANIM_SPEED * 1.23;
  235. break;
  236. case "zodiac_trans_L2R":
  237. self.animtime = .28;
  238. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  239. break;
  240. }
  241. }
  242.  
  243. afcaves_ai_think()
  244. {
  245. self endon( "panic_button" );
  246. self endon( "death" );
  247. while( !self ent_flag_exist( "do_anim" ) )
  248. wait .05;
  249. self ent_flag_wait( "do_anim" );
  250. node = self.anim_node;
  251.  
  252.  
  253. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  254.  
  255. switch( node.animation )
  256. {
  257. case "zodiac_trans_L2R":
  258. self thread ai_zodiac_anims( node.animation );
  259. break;
  260. case "afgan_caves_Price_rappel_idle":
  261. self thread ai_idle( node.animation );
  262. break;
  263. case "training_intro_foley_idle_talk_1":
  264. self thread ai_loop_random( node.animation, "foley_talk" );
  265. break;
  266. case "afchase_ending_shepherd_gun_monologue":
  267. if( isai( self ) )
  268. ai_wait_current_anim();
  269. else
  270. ai_wait_current_anim( .40 );
  271. foreach( ent in level.anim_ai[ "af_caves" ] )
  272. ent ent_flag_clear( "do_anim" );
  273. flag_set( "af_caves_done" );
  274. break;
  275. default:
  276. self thread ai_loop_random( node.animation, "casual_stand" );
  277. break;
  278. }
  279. }
  280.  
  281. ai_zodiac_anims( animation )
  282. {
  283. self endon( "panic_button" );
  284. self endon( "death" );
  285. self endon( "do_anim" );
  286. self.current_anim = getanim_generic( animation );
  287. self thread ai_current_anim_stop();
  288.  
  289. self ai_next_anim( %zodiac_rightside_wave );
  290. self ai_next_anim( %zodiac_trans_R2L );
  291. self ai_next_anim( %zodiac_leftside_wave );
  292. self ai_next_anim( %zodiac_trans_L2R );
  293. }
  294.  
  295. /************************************************************************************************************/
  296. /* DC_BURNING */
  297. /************************************************************************************************************/
  298. dcburning_setup()
  299. {
  300. level.anim_ai[ "dc_burning" ] = [];
  301. array_thread( getentarray( "ai_dc_burning", "script_noteworthy" ), ::add_spawn_function, ::dcburning_ai_setup );
  302. array_thread( getentarray( "ai_dc_burning", "script_noteworthy" ), ::add_spawn_function, ::dcburning_ai_think );
  303. }
  304.  
  305. dcburning_main()
  306. {
  307. thread dcburning_camera_think();
  308.  
  309. flag_wait( "dc_burning_go" );
  310. wait 2;
  311. foreach( ent in level.anim_ai[ "dc_burning" ] )
  312. ent ent_flag_set( "do_anim" );
  313.  
  314. array_thread( getentarray( "civ_dc_burning_1", "script_noteworthy" ), ::delaythread, 11, ::spawn_ai, true );
  315.  
  316. flag_wait( "dc_burning_done" );
  317. array_thread( getentarray( "civ_dc_burning_2", "script_noteworthy" ), ::spawn_ai, true );
  318. array_thread( getentarray( "room1_civ_talkers", "targetname" ), ::spawn_ai, true );
  319.  
  320. wait 2;
  321.  
  322. array_thread( getentarray( "civ_dc_burning_3", "script_noteworthy" ), ::spawn_ai, true );
  323. array_thread( getentarray( "civ_dc_burning_4", "script_noteworthy" ), ::delaythread, 1.25, ::spawn_ai, true );
  324. camera_move( "camara_path_airport_mid", 35 );
  325. level.camera ResumeSpeed( 5 );
  326. wait 2;
  327. camera_move( "camara_path_airport", 45, 0 );
  328. }
  329.  
  330. dcburning_camera_think()
  331. {
  332. node = getvehiclenode( "camara_path_dc_burning", "targetname" );
  333. level.camera vehicle_teleport( node.origin, node.angles );
  334. level.camera thread vehicle_paths( node );
  335.  
  336. if( level.start_point == "dc_burning" )
  337. {
  338. level.camera vehicle_teleport( node.origin, node.angles );
  339. level.camera attachpath( node );
  340. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  341. }
  342.  
  343. level.camera ResumeSpeed( .5 );
  344. level.camera waittill( "reached_end_node" );
  345. }
  346.  
  347. dcburning_ai_setup()
  348. {
  349. self ai_default_setup( "dc_burning" );
  350. node = self.anim_node;
  351.  
  352. wait .05;
  353.  
  354. switch( node.animation )
  355. {
  356. case "training_pit_sitting_welcome":
  357. self.gun_remove = true;
  358. self gun_remove();
  359. self.animtime = .6;
  360. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  361. self.anim_speed = level.GLOBAL_ANIM_SPEED * 1.23;
  362. self.animplaybackrate = self.anim_speed;
  363. self.moveplaybackrate = self.anim_speed;
  364. //self SetAnimTime( getanim_generic( node.animation ), .25 );
  365. //self dcburning_dunn_gun_setup( node );
  366. break;
  367. case "training_intro_foley_begining":
  368. self.animtime = .64;
  369. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  370. self.anim_speed = level.GLOBAL_ANIM_SPEED * 1.23;
  371. self.animplaybackrate = self.anim_speed;
  372. self.moveplaybackrate = self.anim_speed;
  373. break;
  374. case "civilian_sitting_talking_A_1":
  375. self.gun_remove = true;
  376. self gun_remove();
  377. break;
  378. case "riotshield_idle":
  379. if( !isai( self ) )
  380. self attach( "weapon_riot_shield", "TAG_WEAPON_LEFT" );
  381. break;
  382. }
  383. }
  384.  
  385. dcburning_ai_think()
  386. {
  387. self endon( "panic_button" );
  388. self endon( "death" );
  389. while( !self ent_flag_exist( "do_anim" ) )
  390. wait .05;
  391. self ent_flag_wait( "do_anim" );
  392. node = self.anim_node;
  393.  
  394. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  395.  
  396. switch( node.animation )
  397. {
  398. case "training_pit_sitting_welcome":
  399. self thread dcburning_dunn( node.animation );
  400. break;
  401. case "training_intro_foley_begining":
  402. self thread dcburning_foley( node.animation );
  403. break;
  404. case "civilian_sitting_talking_A_1":
  405. self thread ai_idle( node.animation );
  406. break;
  407. case "stinger_fire":
  408. self thread ai_loop_random( node.animation, "rpg" );
  409. case "casual_crouch_idle":
  410. self thread ai_loop_random( node.animation, "casual_crouch" );
  411. break;
  412. case "riotshield_idle":
  413. self thread ai_idle( node.animation );
  414. break;
  415. default:
  416. self thread ai_loop_random( node.animation, "casual_stand" );
  417. break;
  418. }
  419. }
  420.  
  421. dcburning_dunn( animation )
  422. {
  423. self endon( "panic_button" );
  424. self endon( "death" );
  425. self endon( "do_anim" );
  426. self.current_anim = getanim_generic( animation );
  427. self thread ai_current_anim_stop();
  428.  
  429. //self thread dcburning_dunn_gun( animation );
  430. self ai_next_anim( %training_pit_open_case );
  431.  
  432. //this is important - dont take this out...its to make up for
  433. //a sleight frame diference between drone and AI logic where in
  434. //on the current_anim gets set one frame too late.
  435. percent = .41;
  436. delay = .1;
  437. wait delay;
  438.  
  439. self ai_wait_current_anim( percent, delay * -1 );
  440.  
  441. thread dcburning_dunn_stop();
  442. }
  443.  
  444. dcburning_dunn_stop()
  445. {
  446. foreach( ent in level.anim_ai[ "dc_burning" ] )
  447. ent ent_flag_clear( "do_anim" );
  448. flag_set( "dc_burning_done" );
  449. }
  450.  
  451. #using_animtree( "script_model" );
  452. dcburning_dunn_gun_setup( node )
  453. {
  454. self.anim_gun = spawn( "script_model", ( 0, 0, 0 ) );
  455. self.anim_gun setmodel( "viewmodel_desert_eagle" );
  456. self.anim_gun.origin = node.origin;
  457. self.anim_gun.animname = "pit_gun";
  458. self.anim_gun assign_animtree();
  459. self.anim_gun set_start_pos( node.animation + "_gun", node.origin, node.angles );
  460. self.anim_gun _setanim( self.anim_gun getanim( node.animation + "_gun" ), 1, 0, 0 );
  461. }
  462.  
  463. dcburning_dunn_gun( animation )
  464. {
  465. self.anim_gun ent_flag_init( "do_anim" );
  466. self.anim_gun ent_flag_set( "do_anim" );
  467. self.anim_gun thread ai_current_anim_stop();
  468. self.anim_gun _setanim( self.anim_gun getanim( animation + "_gun" ), 1, 0, self.anim_speed );
  469. self.anim_gun.current_anim = self.anim_gun getanim( animation + "_gun" );
  470.  
  471. self.anim_gun ai_next_anim( %training_pit_open_case_gun );
  472. }
  473. #using_animtree( "generic_human" );
  474.  
  475. dcburning_foley( animation )
  476. {
  477. self endon( "panic_button" );
  478. self endon( "death" );
  479. self endon( "do_anim" );
  480. self.current_anim = getanim_generic( animation );
  481. self thread ai_current_anim_stop();
  482.  
  483. // self ai_next_anim( %training_intro_foley_turnaround_2 );
  484. // self ai_next_anim( %training_intro_foley_idle_talk_1 );
  485. self ai_next_anim( %training_intro_foley_end );
  486. }
  487.  
  488. /************************************************************************************************************/
  489. /* AIRPORT */
  490. /************************************************************************************************************/
  491. airport_setup()
  492. {
  493. level.anim_ai[ "airport" ] = [];
  494. array_thread( getentarray( "ai_airport", "script_noteworthy" ), ::add_spawn_function, ::airport_ai_setup );
  495. array_thread( getentarray( "ai_airport", "script_noteworthy" ), ::add_spawn_function, ::airport_ai_think );
  496. }
  497.  
  498. airport_main()
  499. {
  500. thread airport_camera_think();
  501.  
  502. flag_wait( "airport_go" );
  503. thread flag_set_delayed( "looked_at_big_board", 3 );
  504. wait 1.5;
  505.  
  506. foreach( ent in level.anim_ai[ "airport" ] )
  507. ent ent_flag_set( "do_anim" );
  508.  
  509. array_thread( getentarray( "civ_airport_1", "script_noteworthy" ), ::delaythread, 6.5, ::spawn_ai, true );
  510. flag_wait( "airport_done" );
  511. wait 1.5;
  512. array_thread( getentarray( "civ_airport_2", "script_noteworthy" ), ::delaythread, .5, ::spawn_ai, true );
  513. array_thread( getentarray( "civ_airport_3", "script_noteworthy" ), ::delaythread, 2.5, ::spawn_ai, true );
  514.  
  515. camera_move( "camara_path_cliffhanger", 70 );
  516. }
  517.  
  518. airport_camera_think()
  519. {
  520. node = getvehiclenode( "camara_path_airport", "targetname" );
  521. level.camera thread vehicle_paths( node );
  522.  
  523. if( level.start_point == "airport" )
  524. {
  525. level.camera vehicle_teleport( node.origin, node.angles );
  526. level.camera attachpath( node );
  527. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  528. }
  529.  
  530. level.camera ResumeSpeed( .5 );
  531. level.camera waittill( "reached_end_node" );
  532. }
  533.  
  534. airport_ai_setup()
  535. {
  536. self ai_default_setup( "airport" );
  537. node = self.anim_node;
  538.  
  539. wait .05;
  540.  
  541. switch( node.animation )
  542. {
  543. case "airport_elevator_sequence_guy1":
  544. case "airport_elevator_sequence_guy2":
  545. self.animtime = .25;
  546. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  547. break;
  548. case "airport_security_guard_pillar_react_R":
  549. case "airport_security_civ_rush_guard":
  550. self thread give_beretta();
  551. break;
  552. case "riotshield_bashB_attack":
  553. if( !isai( self ) )
  554. {
  555. self attach( "weapon_riot_shield", "TAG_WEAPON_LEFT" );
  556. }
  557. break;
  558. }
  559. }
  560.  
  561. airport_ai_think()
  562. {
  563. self endon( "panic_button" );
  564. self endon( "death" );
  565. while( !self ent_flag_exist( "do_anim" ) )
  566. wait .05;
  567. self ent_flag_wait( "do_anim" );
  568. node = self.anim_node;
  569.  
  570. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  571.  
  572. switch( node.animation )
  573. {
  574. case "airport_elevator_sequence_guy2":
  575. self ai_wait_current_anim( .42 );
  576. foreach( ent in level.anim_ai[ "airport" ] )
  577. ent ent_flag_clear( "do_anim" );
  578. flag_set( "airport_done" );
  579. break;
  580. case "airport_security_guard_pillar_react_R":
  581. case "airport_security_civ_rush_guard":
  582. self thread airport_security_guard();
  583. break;
  584. case "casual_stand_v2_idle":
  585. self thread ai_loop_random( node.animation, "casual_stand" );
  586. break;
  587. }
  588. }
  589.  
  590. airport_security_guard()
  591. {
  592. self endon( "panic_button" );
  593. self endon( "death" );
  594. self endon( "do_anim" );
  595.  
  596. self ai_next_anim( %airport_security_guard_pillar_death_R );
  597. }
  598.  
  599. /************************************************************************************************************/
  600. /* CLIFFHANGER */
  601. /************************************************************************************************************/
  602. cliffhanger_setup()
  603. {
  604. level.anim_ai[ "cliffhanger" ] = [];
  605. array_thread( getentarray( "ai_cliffhanger", "script_noteworthy" ), ::add_spawn_function, ::cliffhanger_ai_setup );
  606. array_thread( getentarray( "ai_cliffhanger", "script_noteworthy" ), ::add_spawn_function, ::cliffhanger_ai_think );
  607. }
  608.  
  609. cliffhanger_main()
  610. {
  611. thread cliffhanger_camera_think();
  612.  
  613. flag_wait( "cliffhanger_go" );
  614. wait 2;
  615. foreach( ent in level.anim_ai[ "cliffhanger" ] )
  616. ent ent_flag_set( "do_anim" );
  617.  
  618. flag_wait( "cliffhanger_done" );
  619. wait 1.5;
  620. array_thread( getentarray( "civ_favela_0", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  621. array_thread( getentarray( "civ_favela_1", "script_noteworthy" ), ::delaythread, 1.5, ::spawn_ai, true );
  622.  
  623. camera_move( "camara_path_favela" );
  624. }
  625.  
  626. cliffhanger_camera_think()
  627. {
  628. node = getvehiclenode( "camara_path_cliffhanger", "targetname" );
  629. level.camera vehicle_teleport( node.origin, node.angles );
  630. level.camera thread vehicle_paths( node );
  631.  
  632. if( level.start_point == "cliffhanger" )
  633. {
  634. level.camera vehicle_teleport( node.origin, node.angles );
  635. level.camera attachpath( node );
  636. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  637. }
  638.  
  639. level.camera ResumeSpeed( .5 );
  640. level.camera waittill( "reached_end_node" );
  641. }
  642.  
  643. cliffhanger_ai_setup()
  644. {
  645. self ai_default_setup( "cliffhanger" );
  646. node = self.anim_node;
  647.  
  648. wait .05;
  649. switch( node.animation )
  650. {
  651. case "killhouse_sas_price":
  652. self.gun_remove = true;
  653. self gun_remove();
  654. self.animtime = .2;
  655. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  656. break;
  657. case "killhouse_sas_1":
  658. case "killhouse_sas_2":
  659. case "killhouse_sas_3":
  660. self.animtime = .15;
  661. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  662. break;
  663. default:
  664. self.animtime = .01;
  665. self SetAnimTime( getanim_generic( node.animation ), self.animtime );
  666. break;
  667. }
  668. }
  669.  
  670. cliffhanger_ai_think()
  671. {
  672. self endon( "panic_button" );
  673. self endon( "death" );
  674. while( !self ent_flag_exist( "do_anim" ) )
  675. wait .05;
  676. self ent_flag_wait( "do_anim" );
  677. node = self.anim_node;
  678.  
  679. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  680.  
  681. switch( node.animation )
  682. {
  683. /* case "killhouse_sas_1":
  684. case "killhouse_sas_2":
  685. case "killhouse_sas_3":*/
  686. case "killhouse_sas_price":
  687. self ai_wait_current_anim( .5 );
  688. foreach( ent in level.anim_ai[ "cliffhanger" ] )
  689. ent ent_flag_clear( "do_anim" );
  690. flag_set( "cliffhanger_done" );
  691. break;
  692. case "guardA_standing_cold_idle":
  693. case "guardB_standing_cold_idle":
  694. self thread ai_idle( node.animation );
  695. break;
  696. case "casual_crouch_idle":
  697. self thread ai_loop_random( node.animation, "casual_crouch" );
  698. break;
  699. case "casual_stand_v2_idle":
  700. self thread ai_loop_random( node.animation, "casual_stand" );
  701. break;
  702. }
  703. }
  704.  
  705. /************************************************************************************************************/
  706. /* FAVELA */
  707. /************************************************************************************************************/
  708. favela_setup()
  709. {
  710. level.anim_ai[ "favela" ] = [];
  711. array_thread( getentarray( "ai_favela", "script_noteworthy" ), ::add_spawn_function, ::favela_ai_setup );
  712. array_thread( getentarray( "ai_favela", "script_noteworthy" ), ::add_spawn_function, ::favela_ai_think );
  713. }
  714.  
  715. favela_main()
  716. {
  717. thread favela_camera_think();
  718.  
  719. flag_wait( "favela_go" );
  720.  
  721. wait 3;
  722.  
  723. foreach( ent in level.anim_ai[ "favela" ] )
  724. ent ent_flag_set( "do_anim" );
  725.  
  726. array_thread( getentarray( "civ_favela_3", "script_noteworthy" ), ::delaythread, 6, ::spawn_ai, true );
  727.  
  728. flag_wait( "favela_done" );
  729.  
  730. wait 1;
  731.  
  732. array_thread( getentarray( "civ_hallway1_1", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  733.  
  734. camera_move( "camara_path_hallway1", 70 );
  735. }
  736.  
  737. favela_camera_think()
  738. {
  739. node = getvehiclenode( "camara_path_favela", "targetname" );
  740. level.camera vehicle_teleport( node.origin, node.angles );
  741. level.camera thread vehicle_paths( node );
  742.  
  743. if( level.start_point == "favela" )
  744. {
  745. level.camera vehicle_teleport( node.origin, node.angles );
  746. level.camera attachpath( node );
  747. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  748. }
  749.  
  750. level.camera ResumeSpeed( .5 );
  751. level.camera waittill( "reached_end_node" );
  752. }
  753.  
  754. favela_ai_setup()
  755. {
  756. self ai_default_setup( "favela" );
  757. node = self.anim_node;
  758.  
  759. switch( node.animation )
  760. {
  761. case "airport_civ_in_line_15_B":
  762. self setanimtime( getanim_generic( node.animation ), .05 );
  763. break;
  764. case "estate_ghost_radio":
  765. self set_anim_time( node, .09 );
  766. break;
  767. case "invasion_vehicle_cover_dialogue_guy1":
  768. case "invasion_vehicle_cover_dialogue_guy2":
  769. self set_anim_time( node, .03 );
  770. break;
  771. case "gulag_end_evac_soap":
  772. self.anim_speed = level.GLOBAL_ANIM_SPEED * .65;
  773. break;
  774. }
  775. }
  776.  
  777. favela_ai_think()
  778. {
  779. self endon( "panic_button" );
  780. self endon( "death" );
  781. while( !self ent_flag_exist( "do_anim" ) )
  782. wait .05;
  783. self ent_flag_wait( "do_anim" );
  784. node = self.anim_node;
  785.  
  786. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  787.  
  788. switch( node.animation )
  789. {
  790. case "gulag_end_evac_soap":
  791. link = spawn( "script_origin", self.origin );
  792. self linkto( link );
  793. self ai_wait_current_anim( .20 );
  794. foreach( ent in level.anim_ai[ "favela" ] )
  795. ent ent_flag_clear( "do_anim" );
  796. flag_set( "favela_done" );
  797. break;
  798. case "favela_chaotic_standcover_gunjamB":
  799. self thread ai_loop_random( node.animation, "favela_stand" );
  800. break;
  801. case "favela_chaotic_crouchcover_grenadefireA":
  802. self thread ai_loop_random( node.animation, "favela_crouch" );
  803. break;
  804. case "german_shepherd_attackidle":
  805. self thread ai_loop_dog( node.animation, "dog" );
  806. break;
  807. }
  808. }
  809.  
  810. /************************************************************************************************************/
  811. /* HALLWAY 1 */
  812. /************************************************************************************************************/
  813. hallway1_main()
  814. {
  815. thread hallway1_camera_think();
  816.  
  817. array_thread( getentarray( "civ_hallway1_2", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  818.  
  819. flag_wait( "skip_vehicles" );
  820.  
  821. ai = get_living_ai_array( "civ_talkers", "script_noteworthy" );
  822. array_call( ai, ::delete );
  823. array_thread( getentarray( "room3_civ_talkers", "targetname" ), ::delaythread, .5, ::spawn_ai, true );
  824.  
  825. array_thread( getentarray( "civ_hallway1_3", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  826. flag_wait( "hallway1_go" );
  827. }
  828.  
  829. hallway1_camera_think()
  830. {
  831. node = getvehiclenode( "camara_path_hallway1", "targetname" );
  832. level.camera vehicle_teleport( node.origin, node.angles );
  833. level.camera thread vehicle_paths( node );
  834.  
  835. if( level.start_point == "hallway1" )
  836. {
  837. level.camera vehicle_teleport( node.origin, node.angles );
  838. level.camera attachpath( node );
  839. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  840. }
  841.  
  842. level.camera ResumeSpeed( 5 );
  843. level.camera waittill( "reached_end_node" );
  844. }
  845.  
  846. /************************************************************************************************************/
  847. /* VEHICLES */
  848. /************************************************************************************************************/
  849. vehicles_main()
  850. {
  851. array_thread( getentarray( "civ_vehicles_1", "script_noteworthy" ), ::delaythread, 10, ::spawn_ai, true );
  852.  
  853. thread vehicles_camera_think();
  854. flag_wait( "vehicles_go" );
  855. }
  856.  
  857. vehicles_camera_think()
  858. {
  859. if( level.start_point == "vehicles" )
  860. {
  861. node = getvehiclenode( "camara_path_vehicles", "targetname" );
  862. level.camera vehicle_teleport( node.origin, node.angles );
  863. level.camera thread vehicle_paths( node );
  864.  
  865. level.camera vehicle_teleport( node.origin, node.angles );
  866. level.camera attachpath( node );
  867. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  868.  
  869. level.camera ResumeSpeed( 2 );
  870. }
  871.  
  872. level.camera waittill( "reached_end_node" );
  873.  
  874. array_thread( getentarray( "civ_vehicles_2", "script_noteworthy" ), ::delaythread, 2, ::spawn_ai, true );
  875.  
  876. camera_move( "camara_path_vehicles2", 20, .25, .75 );
  877.  
  878. wait 1.5;
  879.  
  880. array_thread( getentarray( "civ_vehicles_3", "script_noteworthy" ), ::delaythread, 3.5, ::spawn_ai, true );
  881. array_thread( getentarray( "civ_vehicles_4", "script_noteworthy" ), ::delaythread, 10, ::spawn_ai, true );
  882.  
  883. camera_move( "camara_path_vehicles3", 20, .75, .25 );
  884. level.camera ResumeSpeed( 2 );
  885. level.camera waittill( "reached_end_node" );
  886. }
  887.  
  888. /************************************************************************************************************/
  889. /* HALLWAY 2 */
  890. /************************************************************************************************************/
  891. hallway2_main()
  892. {
  893. thread hallway2_camera_think();
  894.  
  895. flag_wait( "skip_vehicles_to" );
  896. ai = get_living_ai_array( "civ_talkers", "script_noteworthy" );
  897. array_call( ai, ::delete );
  898. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::delaythread, .5, ::spawn_ai, true );
  899. array_thread( getentarray( "civ_hallway2_1", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  900.  
  901. flag_wait( "hallway2_go" );
  902. }
  903.  
  904. hallway2_camera_think()
  905. {
  906. if( level.start_point == "hallway2" )
  907. {
  908. node = getvehiclenode( "camara_path_hallway2", "targetname" );
  909. level.camera vehicle_teleport( node.origin, node.angles );
  910. level.camera thread vehicle_paths( node );
  911. level.camera vehicle_teleport( node.origin, node.angles );
  912. level.camera attachpath( node );
  913. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  914.  
  915. level.camera ResumeSpeed( 5 );
  916. }
  917.  
  918. level.camera waittill( "reached_end_node" );
  919. }
  920.  
  921. /************************************************************************************************************/
  922. /* OILRIG */
  923. /************************************************************************************************************/
  924. oilrig_setup()
  925. {
  926. level.anim_ai[ "oilrig" ] = [];
  927. array_thread( getentarray( "ai_oilrig", "script_noteworthy" ), ::add_spawn_function, ::oilrig_ai_setup );
  928. array_thread( getentarray( "ai_oilrig", "script_noteworthy" ), ::add_spawn_function, ::oilrig_ai_think );
  929. }
  930.  
  931. oilrig_main()
  932. {
  933. thread oilrig_camera_think();
  934.  
  935. flag_wait( "oilrig_go" );
  936. wait 2;
  937.  
  938. foreach( ent in level.anim_ai[ "oilrig" ] )
  939. ent ent_flag_set( "do_anim" );
  940.  
  941. array_thread( getentarray( "civ_oilrig_1", "script_noteworthy" ), ::delaythread, 12, ::spawn_ai, true );
  942. flag_wait( "oilrig_done" );
  943. array_thread( getentarray( "civ_oilrig_2", "script_noteworthy" ), ::delaythread, 1.5, ::spawn_ai, true );
  944. wait 1.75;
  945. camera_move( "camara_path_estate" );
  946. }
  947.  
  948. oilrig_camera_think()
  949. {
  950. if( level.start_point == "oilrig" )
  951. {
  952. node = getvehiclenode( "camara_path_oilrig", "targetname" );
  953. level.camera vehicle_teleport( node.origin, node.angles );
  954. level.camera thread vehicle_paths( node );
  955.  
  956. level.camera vehicle_teleport( node.origin, node.angles );
  957. level.camera attachpath( node );
  958. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  959. level.camera ResumeSpeed( .5 );
  960. }
  961.  
  962. level.camera waittill( "reached_end_node" );
  963. }
  964.  
  965. oilrig_ai_setup()
  966. {
  967. wait .1;
  968. self ai_default_setup( "oilrig" );
  969. node = self.anim_node;
  970.  
  971. }
  972.  
  973. oilrig_ai_think()
  974. {
  975. self endon( "panic_button" );
  976. self endon( "death" );
  977. while( !self ent_flag_exist( "do_anim" ) )
  978. wait .05;
  979. self ent_flag_wait( "do_anim" );
  980. node = self.anim_node;
  981.  
  982. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  983.  
  984. switch( node.animation )
  985. {
  986. case "roadkill_opening_foley":
  987. self ai_wait_current_anim( .73 );
  988. foreach( ent in level.anim_ai[ "oilrig" ] )
  989. ent ent_flag_clear( "do_anim" );
  990. flag_set( "oilrig_done" );
  991. break;
  992. case "roadkill_opening_shepherd":
  993. self ai_wait_current_anim( .83 );
  994. foreach( ent in level.anim_ai[ "oilrig" ] )
  995. ent ent_flag_clear( "do_anim" );
  996. flag_set( "oilrig_done" );
  997. break;
  998. case "oilrig_sub_B_idle_3":
  999. case "oilrig_sub_B_idle_4":
  1000. self thread bubbles();
  1001. default:
  1002. self thread ai_idle( node.animation );
  1003. break;
  1004. }
  1005. }
  1006.  
  1007. /************************************************************************************************************/
  1008. /* ESTATE */
  1009. /************************************************************************************************************/
  1010. estate_setup()
  1011. {
  1012. level.anim_ai[ "estate" ] = [];
  1013. array_thread( getentarray( "ai_estate", "script_noteworthy" ), ::add_spawn_function, ::estate_ai_setup );
  1014. array_thread( getentarray( "ai_estate", "script_noteworthy" ), ::add_spawn_function, ::estate_ai_think );
  1015. getent( "bh_node", "target" ) estate_struct_setup();
  1016. }
  1017.  
  1018. estate_main()
  1019. {
  1020. thread estate_camera_think();
  1021.  
  1022. flag_wait( "estate_go" );
  1023. wait 2;
  1024.  
  1025. foreach( ent in level.anim_ai[ "estate" ] )
  1026. ent ent_flag_set( "do_anim" );
  1027.  
  1028. array_thread( getentarray( "civ_estate_1", "script_noteworthy" ), ::delaythread, 6, ::spawn_ai, true );
  1029.  
  1030. flag_wait( "estate_done" );
  1031. wait 2;
  1032.  
  1033. array_thread( getentarray( "civ_estate_2", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  1034.  
  1035. camera_move( "camara_path_hostage_mid", 55 );
  1036. level.camera ResumeSpeed( 5 );
  1037. wait 3.5;
  1038. camera_move( "camara_path_hostage", 75, 0 );
  1039. }
  1040.  
  1041. estate_camera_think()
  1042. {
  1043. node = getvehiclenode( "camara_path_estate", "targetname" );
  1044. level.camera vehicle_teleport( node.origin, node.angles );
  1045. level.camera thread vehicle_paths( node );
  1046.  
  1047. if( level.start_point == "estate" )
  1048. {
  1049. level.camera vehicle_teleport( node.origin, node.angles );
  1050. level.camera attachpath( node );
  1051. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  1052. }
  1053.  
  1054. level.camera ResumeSpeed( .5 );
  1055. level.camera waittill( "reached_end_node" );
  1056. }
  1057.  
  1058. estate_ai_setup()
  1059. {
  1060. if( isdefined( self.target ) && self.target == "bh_ai_node" )
  1061. self estate_bh_setup();
  1062.  
  1063. self ai_default_setup( "estate" );
  1064. node = self.anim_node;
  1065.  
  1066. switch( node.animation )
  1067. {
  1068. case "bh_rope_drop_le":
  1069. case "bh_6_drop":
  1070. self.ragdoll_immediate = true;
  1071. self.anim_speed = level.GLOBAL_ANIM_SPEED * .3;
  1072. self set_anim_time( node, .765 );
  1073. break;
  1074. case "roadkill_cover_spotter":
  1075. case "roadkill_cover_soldier":
  1076. case "roadkill_cover_active_soldier2":
  1077. if( isai( self ) )
  1078. self.a.pose = "crouch";
  1079. break;
  1080. }
  1081. }
  1082.  
  1083. estate_ai_think()
  1084. {
  1085. self endon( "panic_button" );
  1086. self endon( "death" );
  1087. while( !self ent_flag_exist( "do_anim" ) )
  1088. wait .05;
  1089. self ent_flag_wait( "do_anim" );
  1090. node = self.anim_node;
  1091.  
  1092. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  1093.  
  1094. switch( node.animation )
  1095. {
  1096. case "bh_rope_drop_le":
  1097. case "bh_6_drop":
  1098. self ai_wait_current_anim( .936 );
  1099. foreach( ent in level.anim_ai[ "estate" ] )
  1100. ent ent_flag_clear( "do_anim" );
  1101. flag_set( "estate_done" );
  1102. break;
  1103. default:
  1104. self thread ai_idle( node.animation );
  1105. break;
  1106. }
  1107. }
  1108.  
  1109. estate_struct_setup()
  1110. {
  1111. helo = getent( self.target, "targetname" );
  1112.  
  1113. node = spawnstruct();
  1114. if( level.level_mode == "free" )
  1115. node.origin = helo GetTagOrigin( "TAG_DETACH" ) + (0,0,-10);
  1116. else
  1117. node.origin = helo GetTagOrigin( "TAG_DETACH" );
  1118.  
  1119. node.angles = helo GetTagangles( "TAG_DETACH" );
  1120. node.animation = "bh_6_drop";
  1121. node.targetname = "bh_ai_node";
  1122.  
  1123. if ( !isdefined( level.struct_class_names[ "targetname" ][ node.targetname ] ) )
  1124. level.struct_class_names[ "targetname" ][ node.targetname ] = [];
  1125. size = level.struct_class_names[ "targetname" ][ node.targetname ].size;
  1126. level.struct_class_names[ "targetname" ][ node.targetname ][ size ] = node;
  1127.  
  1128. node = spawnstruct();
  1129. node.origin = helo GetTagOrigin( "TAG_FASTROPE_LE" ) + (0,0,.5);;
  1130. node.angles = helo GetTagangles( "TAG_FASTROPE_LE" );
  1131. node.animation = "bh_rope_drop_le";
  1132. node.targetname = "bh_rope_node";
  1133.  
  1134. if ( !isdefined( level.struct_class_names[ "targetname" ][ node.targetname ] ) )
  1135. level.struct_class_names[ "targetname" ][ node.targetname ] = [];
  1136. size = level.struct_class_names[ "targetname" ][ node.targetname ].size;
  1137. level.struct_class_names[ "targetname" ][ node.targetname ][ size ] = node;
  1138.  
  1139. self.target = "bh_ai_node";
  1140. }
  1141.  
  1142. estate_bh_setup()
  1143. {
  1144. rope = spawn( "script_model", self.origin );
  1145. rope setmodel( "rope_test" );
  1146.  
  1147. rope.target = "bh_rope_node";
  1148. rope UseAnimTree( #animtree );
  1149.  
  1150. rope ent_flag_init( "do_anim" );
  1151. level.guys[ level.guys.size ] = rope;
  1152. level.rope = rope;
  1153. rope thread estate_ai_setup();
  1154. rope thread estate_ai_think();
  1155. }
  1156.  
  1157. /************************************************************************************************************/
  1158. /* HOSTAGE */
  1159. /************************************************************************************************************/
  1160. hostage_setup()
  1161. {
  1162. level.anim_ai[ "hostage" ] = [];
  1163. array_thread( getentarray( "ai_hostage", "script_noteworthy" ), ::add_spawn_function, ::hostage_ai_setup );
  1164. array_thread( getentarray( "ai_hostage", "script_noteworthy" ), ::add_spawn_function, ::hostage_ai_think );
  1165. }
  1166.  
  1167. hostage_main()
  1168. {
  1169. if( level.start_point == "hostage" )
  1170. level waittill( "cam_hostage" );
  1171.  
  1172. thread hostage_camera_think();
  1173.  
  1174. flag_wait( "hostage_go" );
  1175.  
  1176. foreach( ent in level.anim_ai[ "hostage" ] )
  1177. ent ent_flag_set( "do_anim" );
  1178.  
  1179. array_thread( getentarray( "civ_hostage_1", "script_noteworthy" ), ::delaythread, 5, ::spawn_ai, true );
  1180.  
  1181. flag_wait( "hostage_done" );
  1182. wait 1;
  1183. camera_move( "camara_path_trainer", 35 );
  1184. }
  1185.  
  1186. hostage_camera_think()
  1187. {
  1188. node = getvehiclenode( "camara_path_hostage", "targetname" );
  1189. level.camera thread vehicle_paths( node );
  1190.  
  1191. level.camera ResumeSpeed( .5 );
  1192. level.camera waittill( "reached_end_node" );
  1193. }
  1194.  
  1195. hostage_ai_setup()
  1196. {
  1197. self ai_default_setup( "hostage" );
  1198. node = self.anim_node;
  1199.  
  1200. switch( node.animation )
  1201. {
  1202. case "takedown_room1B_hostage":
  1203. self.anim_mode = "gravity";
  1204. if( isai( self ) )
  1205. self.a.pose = "crouch";
  1206. case "takedown_room1B_soldier":
  1207. self set_anim_time( node, .19 );
  1208. break;
  1209. case "hostage_chair_dive":
  1210. self.anim_mode = "gravity";//zonly_physics, nophysics, none gravity
  1211. break;
  1212. }
  1213. }
  1214.  
  1215. hostage_ai_think()
  1216. {
  1217. self endon( "panic_button" );
  1218. self endon( "death" );
  1219. while( !self ent_flag_exist( "do_anim" ) )
  1220. wait .05;
  1221. self ent_flag_wait( "do_anim" );
  1222. node = self.anim_node;
  1223.  
  1224. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  1225.  
  1226. switch( node.animation )
  1227. {
  1228. case "takedown_room1B_hostage":
  1229. case "takedown_room1B_soldier":
  1230. self thread hostage_pose( node.animation );
  1231. self ai_wait_current_anim( .74 );
  1232. foreach( ent in level.anim_ai[ "hostage" ] )
  1233. ent ent_flag_clear( "do_anim" );
  1234. flag_set( "hostage_done" );
  1235. break;
  1236. case "hostage_chair_dive":
  1237. self thread hostage_dive( node.animation );
  1238. break;
  1239. default:
  1240. self thread hostage_chair( node.animation );
  1241. break;
  1242. }
  1243. }
  1244.  
  1245. hostage_pose( animation )
  1246. {
  1247. self endon( "death" );
  1248.  
  1249. if( !isai( self ) )
  1250. return;
  1251.  
  1252. self ai_wait_current_anim( .39 );
  1253.  
  1254. switch ( animation )
  1255. {
  1256. case "takedown_room1B_hostage":
  1257. self.a.pose = "prone";
  1258. break;
  1259. case "takedown_room1B_soldier":
  1260. self.a.pose = "crouch";
  1261. break;
  1262. }
  1263. }
  1264.  
  1265. hostage_chair( animation )
  1266. {
  1267. self endon( "death" );
  1268. self endon( "do_anim" );
  1269. self.current_anim = getanim_generic( animation );
  1270. self thread ai_current_anim_stop();
  1271.  
  1272. self ai_next_anim( %hostage_chair_twitch2 );
  1273. self ai_next_anim( %hostage_chair_twitch );
  1274. self ai_next_anim( %hostage_chair_idle );
  1275. }
  1276.  
  1277. hostage_dive( animation )
  1278. {
  1279. self endon( "death" );
  1280. self endon( "do_anim" );
  1281. self.current_anim = getanim_generic( animation );
  1282. self thread ai_current_anim_stop();
  1283.  
  1284. self ai_next_anim( %hostage_chair_ground_idle );
  1285. if( isai( self ) )
  1286. self.a.pose = "prone";
  1287. self ai_next_anim( %hostage_chair_ground_idle );
  1288. self ai_next_anim( %hostage_chair_ground_idle );
  1289. self ai_next_anim( %hostage_chair_ground_idle );
  1290. }
  1291.  
  1292. /************************************************************************************************************/
  1293. /* TRAINER */
  1294. /************************************************************************************************************/
  1295. trainer_setup()
  1296. {
  1297. level.anim_ai[ "trainer" ] = [];
  1298. array_thread( getentarray( "ai_trainer", "script_noteworthy" ), ::add_spawn_function, ::trainer_ai_setup );
  1299. array_thread( getentarray( "ai_trainer", "script_noteworthy" ), ::add_spawn_function, ::trainer_ai_think );
  1300. }
  1301.  
  1302. trainer_main()
  1303. {
  1304. thread trainer_camera_think();
  1305.  
  1306. flag_wait( "trainer_go" );
  1307. wait 2.5;
  1308.  
  1309. foreach( ent in level.anim_ai[ "trainer" ] )
  1310. ent ent_flag_set( "do_anim" );
  1311.  
  1312. flag_wait( "trainer_done" );
  1313. array_thread( getentarray( "civ_trainer_1", "script_noteworthy" ), ::delaythread, 0, ::spawn_ai, true );
  1314.  
  1315. wait 2;
  1316. camera_move( "camara_path_arcadia" );
  1317. }
  1318.  
  1319. trainer_camera_think()
  1320. {
  1321. node = getvehiclenode( "camara_path_trainer", "targetname" );
  1322. level.camera vehicle_teleport( node.origin, node.angles );
  1323. level.camera thread vehicle_paths( node );
  1324.  
  1325. if( level.start_point == "trainer" )
  1326. {
  1327. level.camera vehicle_teleport( node.origin, node.angles );
  1328. level.camera attachpath( node );
  1329. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  1330. }
  1331.  
  1332. level.camera ResumeSpeed( .5 );
  1333. level.camera waittill( "reached_end_node" );
  1334. }
  1335.  
  1336. trainer_ai_setup()
  1337. {
  1338. self ai_default_setup( "trainer" );
  1339. node = self.anim_node;
  1340.  
  1341. switch( node.animation )
  1342. {
  1343. case "training_pushups_guy1":
  1344. self.gun_remove = true;
  1345. self gun_remove();
  1346. self.grenadeweapon = "fraggrenade";
  1347. self.grenadeammo = 0;
  1348. self set_anim_time( node, .93 );
  1349. break;
  1350. case "parabolic_leaning_guy_idle_training":
  1351. self.grenadeweapon = "fraggrenade";
  1352. self.grenadeammo = 0;
  1353. break;
  1354. case "training_intro_translator_end":
  1355. self.gun_remove = true;
  1356. self gun_remove();
  1357. case "training_intro_trainee_1_end":
  1358. case "training_intro_foley_end":
  1359. self set_anim_time( node, .25 );
  1360. break;
  1361. }
  1362. }
  1363.  
  1364. trainer_ai_think()
  1365. {
  1366. self endon( "panic_button" );
  1367. self endon( "death" );
  1368. while( !self ent_flag_exist( "do_anim" ) )
  1369. wait .05;
  1370. self ent_flag_wait( "do_anim" );
  1371. node = self.anim_node;
  1372.  
  1373. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  1374.  
  1375. switch( node.animation )
  1376. {
  1377. case "training_intro_trainee_1_end":
  1378. case "training_intro_translator_end":
  1379. case "training_intro_foley_end":
  1380. self ai_wait_current_anim( .50 );
  1381. foreach( ent in level.anim_ai[ "trainer" ] )
  1382. ent ent_flag_clear( "do_anim" );
  1383. flag_set( "trainer_done" );
  1384. break;
  1385. default:
  1386. self thread ai_idle( node.animation );
  1387. break;
  1388. }
  1389. }
  1390.  
  1391. /************************************************************************************************************/
  1392. /* ARCADIA */
  1393. /************************************************************************************************************/
  1394. arcadia_setup()
  1395. {
  1396. level.anim_ai[ "arcadia" ] = [];
  1397. array_thread( getentarray( "ai_arcadia", "script_noteworthy" ), ::add_spawn_function, ::arcadia_ai_setup );
  1398. array_thread( getentarray( "ai_arcadia", "script_noteworthy" ), ::add_spawn_function, ::arcadia_ai_think );
  1399. }
  1400.  
  1401. arcadia_main()
  1402. {
  1403. thread arcadia_camera_think();
  1404.  
  1405. flag_wait( "arcadia_go" );
  1406. wait 2;
  1407.  
  1408. foreach( ent in level.anim_ai[ "arcadia" ] )
  1409. ent ent_flag_set( "do_anim" );
  1410.  
  1411. array_thread( getentarray( "civ_arcadia_1", "script_noteworthy" ), ::delaythread, 2.5, ::spawn_ai, true );
  1412.  
  1413. flag_wait( "arcadia_done" );
  1414.  
  1415. wait 1;
  1416.  
  1417. level.black FadeOverTime( 3 );
  1418. level.black.alpha = 1;
  1419. }
  1420.  
  1421. arcadia_camera_think()
  1422. {
  1423. node = getvehiclenode( "camara_path_arcadia", "targetname" );
  1424. level.camera vehicle_teleport( node.origin, node.angles );
  1425. level.camera thread vehicle_paths( node );
  1426.  
  1427. if( level.start_point == "arcadia" )
  1428. {
  1429. level.camera vehicle_teleport( node.origin, node.angles );
  1430. level.camera attachpath( node );
  1431. level.camera vehicle_setspeedimmediate( 0, 1000, 1000 );
  1432. }
  1433.  
  1434. level.camera ResumeSpeed( .5 );
  1435. level.camera waittill( "reached_end_node" );
  1436. }
  1437.  
  1438. arcadia_ai_setup()
  1439. {
  1440. switch( self.animation )
  1441. {
  1442. case "coup_guard2_jeera":
  1443. self.animtime = .35;
  1444. self.animation = "coup_guard2_jeera";
  1445. break;
  1446. case "coup_guard2_jeerb":
  1447. self.animtime = .05;
  1448. self.animation = "coup_guard2_jeera";
  1449. break;
  1450. case "coup_guard2_jeerc":
  1451. self.animtime = .85;
  1452. self.animation = "coup_guard2_jeera";
  1453. break;
  1454. case "coup_guard1_jeer":
  1455. self.animtime = .6;
  1456. self.animation = "coup_guard2_jeera";
  1457. break;
  1458. }
  1459.  
  1460. self ai_default_setup( "arcadia" );
  1461. node = self.anim_node;
  1462.  
  1463. switch( self.animation )
  1464. {
  1465. case "village_interrogationA_Price":
  1466. case "village_interrogationA_Zak":
  1467. self.gun_remove = true;
  1468. self gun_remove();
  1469. self set_anim_time( node, .677 );
  1470. self.anim_speed = level.GLOBAL_ANIM_SPEED * .5;
  1471. break;
  1472. default:
  1473. self set_anim_time( node, self.animtime );
  1474. break;
  1475. }
  1476. }
  1477.  
  1478. arcadia_ai_think()
  1479. {
  1480. self endon( "panic_button" );
  1481. self endon( "death" );
  1482. while( !self ent_flag_exist( "do_anim" ) )
  1483. wait .05;
  1484. self ent_flag_wait( "do_anim" );
  1485. node = self.anim_node;
  1486.  
  1487. self _setanim( getanim_generic( node.animation ), 1, 0, self.anim_speed );
  1488.  
  1489. switch( node.animation )
  1490. {
  1491. case "village_interrogationA_Zak":
  1492. case "village_interrogationA_Price":
  1493. self thread arcadia_pose( node.animation );
  1494. self ai_wait_current_anim( .97 );
  1495. foreach( ent in level.anim_ai[ "arcadia" ] )
  1496. ent ent_flag_clear( "do_anim" );
  1497. flag_set( "arcadia_done" );
  1498. break;
  1499. default:
  1500. self thread ai_idle( node.animation );
  1501. break;
  1502. }
  1503. }
  1504.  
  1505. arcadia_pose( animation )
  1506. {
  1507. self endon( "panic_button" );
  1508. self endon( "death" );
  1509.  
  1510. if( !isai( self ) )
  1511. return;
  1512.  
  1513. switch( animation )
  1514. {
  1515. case "village_interrogationA_Zak":
  1516. self ai_wait_current_anim( .75 );
  1517. self.ragdoll_immediate = true;
  1518. break;
  1519. case "village_interrogationA_Price":
  1520. self ai_wait_current_anim( .78 );
  1521. self.a.pose = "crouch";
  1522. break;
  1523. }
  1524. }
  1525.  
  1526. /************************************************************************************************************/
  1527. /* BLACK CREDITS */
  1528. /************************************************************************************************************/
  1529. black_main()
  1530. {
  1531. thread maps\_credits::playCredits();
  1532.  
  1533. wait 263 - 6;
  1534.  
  1535. thread music_stop( 4 );
  1536.  
  1537. wait 6;
  1538.  
  1539. nextmission();
  1540.  
  1541. level waittill( "never" );
  1542. }
  1543.  
  1544. /************************************************************************************************************/
  1545. /* MUSEUM FREE ROAM */
  1546. /************************************************************************************************************/
  1547. museum_main()
  1548. {
  1549. // black screen while we do things in the background
  1550. blackscreen_start();
  1551.  
  1552. flag_wait( "museum_ready" );
  1553.  
  1554. // room 1 guys spawn initially
  1555. room1trig = GetEnt( "room1", "script_noteworthy" );
  1556. room1trig spawn_museum_dudes();
  1557.  
  1558. thread maps\_introscreen::char_museum_intro();
  1559.  
  1560. set_console_status();
  1561. if( level.Console )
  1562. {
  1563. if( level.ps3 )
  1564. wait 9.0;
  1565. if( level.xenon )
  1566. wait 6.0;
  1567. }
  1568. else
  1569. {
  1570. wait 2;
  1571. }
  1572.  
  1573. array_call( level.players, ::freezecontrols, false );
  1574. blackscreen_fadeout( 1.5 );
  1575.  
  1576. level waittill( "never" );
  1577. }
  1578.  
  1579. museum_room1_anim_go()
  1580. {
  1581. level notify( "new_room_anim_go" );
  1582.  
  1583. add_wait( ::flag_wait, "af_caves_go" );
  1584. add_func( ::do_anim, "af_caves" );
  1585. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1586. thread do_wait();
  1587.  
  1588. add_wait( ::flag_wait, "dc_burning_go" );
  1589. add_func( ::do_anim, "dc_burning" );
  1590. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1591. thread do_wait();
  1592.  
  1593. add_wait( ::flag_wait, "airport_go" );
  1594. add_func( ::do_anim, "airport" );
  1595. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1596. thread do_wait();
  1597.  
  1598. add_wait( ::flag_wait, "cliffhanger_go" );
  1599. add_func( ::do_anim, "cliffhanger" );
  1600. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1601. thread do_wait();
  1602.  
  1603. add_wait( ::flag_wait, "favela_go" );
  1604. add_func( ::do_anim, "favela" );
  1605. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1606. thread do_wait();
  1607. }
  1608.  
  1609. museum_room2_anim_go()
  1610. {
  1611. level notify( "new_room_anim_go" );
  1612.  
  1613. add_wait( ::flag_wait, "oilrig_go" );
  1614. add_func( ::do_anim, "oilrig" );
  1615. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1616. thread do_wait();
  1617.  
  1618. add_wait( ::flag_wait, "estate_go" );
  1619. add_func( ::do_anim, "estate" );
  1620. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1621. thread do_wait();
  1622.  
  1623. add_wait( ::flag_wait, "hostage_go" );
  1624. add_func( ::do_anim, "hostage" );
  1625. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1626. thread do_wait();
  1627.  
  1628. add_wait( ::flag_wait, "arcadia_go" );
  1629. add_func( ::do_anim, "arcadia" );
  1630. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1631. thread do_wait();
  1632.  
  1633. add_wait( ::flag_wait, "trainer_go" );
  1634. add_func( ::do_anim, "trainer" );
  1635. level add_abort( ::waittill_msg, "new_room_anim_go" );
  1636. thread do_wait();
  1637. }
  1638.  
  1639. /************************************************************************************************************/
  1640. /* START POINTS */
  1641. /************************************************************************************************************/
  1642. start_common()
  1643. {
  1644. SetSavedDvar( "hud_drawHUD", "0" );
  1645. SetSavedDvar( "ammoCounterHide", "1" );
  1646. SetSavedDvar( "actionSlotsHide", "1" );
  1647. SetSavedDvar( "compass", "0" );
  1648. setsaveddvar( "g_friendlyNameDist", "0" );
  1649. setsaveddvar( "g_enteqDist", "0" );
  1650.  
  1651. trigger_off( "free_roam_look_ats", "targetname" );
  1652.  
  1653. sidebar = create_client_overlay_custom_size( "credits_side_bar", .45, 600, 480 );
  1654. sidebar.alignX = "left";
  1655. sidebar.horzAlign = "left";
  1656. sidebar.x = -280;
  1657.  
  1658. level.black = create_client_overlay( "black", 1 );
  1659.  
  1660. if( level.level_mode != "credits_1" )
  1661. {
  1662. player_lerp_eq();
  1663. thread music_loop( "af_chase_ending_credits" , 122, 1 );
  1664. }
  1665. else
  1666. level.black_overlay delaycall( .5, ::destroy );
  1667.  
  1668. level.player allowcrouch( false );
  1669. level.player allowprone( false );
  1670. level.player TakeAllWeapons();
  1671.  
  1672. add_global_spawn_function( "axis", ::museum_ai_think );
  1673. add_global_spawn_function( "allies", ::museum_ai_think );
  1674. add_global_spawn_function( "neutral", ::museum_ai_think );
  1675.  
  1676. level.camera = spawn_vehicle_from_targetname_and_drive( "credits_camera" );
  1677. level.player playerlinkto( level.camera, undefined, 1, 0,0,0,0,0 );
  1678.  
  1679. level.player delaycall( .1, ::freezecontrols, true );
  1680. noself_delaycall( 1, ::SetSavedDvar, "cg_fov", 45 );
  1681.  
  1682. spawntrigs = GetEntArray( "spawntrig", "targetname" );
  1683. array_thread( spawntrigs, ::spawner_trig_think );
  1684. ai_anim_setups();
  1685.  
  1686. thread end_credits();
  1687. }
  1688.  
  1689. player_lerp_eq()
  1690. {
  1691. level.player SetEqLerp( .05, level.eq_main_track );
  1692. AmbientStop( .05 );
  1693. thread maps\_ambient::use_eq_settings( "fadeall_but_music", level.eq_mix_track );
  1694. thread maps\_ambient::blend_to_eq_track( level.eq_mix_track , .05 );
  1695. }
  1696.  
  1697. ai_anim_setups()
  1698. {
  1699. array_thread( getentarray( "civ_talkers", "script_noteworthy" ), ::add_spawn_function, ::civ_talkers );
  1700. array_thread( getentarray( "room1", "targetname" ), ::set_diarama_ai );
  1701. array_thread( getentarray( "room2", "targetname" ), ::set_diarama_ai );
  1702. array_thread( getentarray( "civilians", "targetname" ), ::set_civilian_ai );
  1703. array_thread( getentarray( "civilians", "targetname" ), ::add_spawn_function, ::delete_civ_on_goal );
  1704. array_thread( getentarray( "civ_talkers", "script_noteworthy" ), ::set_civilian_ai );
  1705.  
  1706. afcaves_setup();
  1707. dcburning_setup();
  1708. airport_setup();
  1709. cliffhanger_setup();
  1710. favela_setup();
  1711. oilrig_setup();
  1712. estate_setup();
  1713. hostage_setup();
  1714. trainer_setup();
  1715. arcadia_setup();
  1716.  
  1717. thread flag_set_delayed( "museum_ready", .05 );
  1718. }
  1719.  
  1720. start_free()
  1721. {
  1722. precachestring( &"CHAR_MUSEUM_LINE1" );
  1723. precachestring( &"CHAR_MUSEUM_LINE3" );
  1724. precachestring( &"CHAR_MUSEUM_LINE4" );
  1725. add_global_spawn_function( "axis", ::museum_ai_think );
  1726. add_global_spawn_function( "allies", ::museum_ai_think );
  1727. add_global_spawn_function( "neutral", ::museum_ai_think );
  1728.  
  1729. array_thread( level.players, ::museum_player_setup );
  1730.  
  1731. spawntrigs = GetEntArray( "spawntrig", "targetname" );
  1732. array_thread( spawntrigs, ::spawner_trig_think );
  1733.  
  1734. ai_anim_setups();
  1735.  
  1736. array_thread( getentarray( "panic_button", "targetname" ), ::panic_button );
  1737. }
  1738.  
  1739. start_afcaves()
  1740. {
  1741. start_common();
  1742.  
  1743. flag_wait( "museum_ready" );
  1744. wait .05;
  1745. room1trig = GetEnt( "room1", "script_noteworthy" );
  1746. room1trig spawn_museum_dudes();
  1747. }
  1748.  
  1749. start_dcburning()
  1750. {
  1751. start_common();
  1752.  
  1753. flag_wait( "museum_ready" );
  1754. wait .05;
  1755. room1trig = GetEnt( "room1", "script_noteworthy" );
  1756. room1trig spawn_museum_dudes();
  1757. }
  1758.  
  1759. start_airport()
  1760. {
  1761. start_common();
  1762.  
  1763. flag_wait( "museum_ready" );
  1764. wait .05;
  1765. room1trig = GetEnt( "room1", "script_noteworthy" );
  1766. room1trig spawn_museum_dudes();
  1767. array_thread( getentarray( "room1_civ_talkers", "targetname" ), ::spawn_ai, true );
  1768. }
  1769.  
  1770. start_cliffhanger()
  1771. {
  1772. start_common();
  1773.  
  1774. flag_wait( "museum_ready" );
  1775. wait .05;
  1776. room1trig = GetEnt( "room1", "script_noteworthy" );
  1777. room1trig spawn_museum_dudes();
  1778. array_thread( getentarray( "room1_civ_talkers", "targetname" ), ::spawn_ai, true );
  1779. }
  1780.  
  1781. start_favela()
  1782. {
  1783. start_common();
  1784.  
  1785. flag_wait( "museum_ready" );
  1786. wait .05;
  1787. room1trig = GetEnt( "room1", "script_noteworthy" );
  1788. room1trig spawn_museum_dudes();
  1789. array_thread( getentarray( "room1_civ_talkers", "targetname" ), ::spawn_ai, true );
  1790. }
  1791.  
  1792. start_hallway1()
  1793. {
  1794. start_common();
  1795.  
  1796. flag_wait( "museum_ready" );
  1797. wait .05;
  1798. room1trig = GetEnt( "room1", "script_noteworthy" );
  1799. room1trig spawn_museum_dudes();
  1800. array_thread( getentarray( "room1_civ_talkers", "targetname" ), ::spawn_ai, true );
  1801. }
  1802.  
  1803. start_vehicles()
  1804. {
  1805. start_common();
  1806.  
  1807. flag_wait( "museum_ready" );
  1808. wait .05;
  1809. array_thread( getentarray( "room3_civ_talkers", "targetname" ), ::spawn_ai, true );
  1810. }
  1811.  
  1812. start_hallway2()
  1813. {
  1814. start_common();
  1815.  
  1816. flag_wait( "museum_ready" );
  1817. wait .05;
  1818. }
  1819.  
  1820. start_oilrig()
  1821. {
  1822. start_common();
  1823.  
  1824. flag_wait( "museum_ready" );
  1825. wait .05;
  1826. room2trig = GetEnt( "room2", "script_noteworthy" );
  1827. room2trig spawn_museum_dudes();
  1828. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::spawn_ai, true );
  1829. }
  1830.  
  1831. start_estate()
  1832. {
  1833. start_common();
  1834.  
  1835. flag_wait( "museum_ready" );
  1836. wait .05;
  1837. room2trig = GetEnt( "room2", "script_noteworthy" );
  1838. room2trig spawn_museum_dudes();
  1839. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::spawn_ai, true );
  1840. }
  1841.  
  1842. start_hostage()
  1843. {
  1844. start_common();
  1845.  
  1846. flag_wait( "museum_ready" );
  1847. wait .05;
  1848. room2trig = GetEnt( "room2", "script_noteworthy" );
  1849. room2trig spawn_museum_dudes();
  1850. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::spawn_ai, true );
  1851.  
  1852. camera_move( "camara_path_hostage_mid", 500, 0, .05 );
  1853. level.camera ResumeSpeed( 5 );
  1854. wait 3.5;
  1855. camera_move( "camara_path_hostage", 75, 0 );
  1856. level notify( "cam_hostage" );
  1857. }
  1858.  
  1859. start_trainer()
  1860. {
  1861. start_common();
  1862.  
  1863. flag_wait( "museum_ready" );
  1864. wait .05;
  1865. room2trig = GetEnt( "room2", "script_noteworthy" );
  1866. room2trig spawn_museum_dudes();
  1867. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::spawn_ai, true );
  1868. }
  1869.  
  1870. start_arcadia()
  1871. {
  1872. start_common();
  1873.  
  1874. flag_wait( "museum_ready" );
  1875. wait .05;
  1876. room2trig = GetEnt( "room2", "script_noteworthy" );
  1877. room2trig spawn_museum_dudes();
  1878. array_thread( getentarray( "room2_civ_talkers", "targetname" ), ::spawn_ai, true );
  1879. }
  1880.  
  1881. start_black()
  1882. {
  1883. level.black = create_client_overlay( "black", 1 );
  1884. thread music_loop( "af_chase_ending_credits" , 122, 1 );
  1885.  
  1886. level.player SetEqLerp( .05, level.eq_main_track );
  1887. AmbientStop( .05 );
  1888. thread maps\_ambient::use_eq_settings( "fadeall_but_music", level.eq_mix_track );
  1889. thread maps\_ambient::blend_to_eq_track( level.eq_mix_track , .05 );
  1890.  
  1891. level.player allowcrouch( false );
  1892. level.player allowprone( false );
  1893. level.player TakeAllWeapons();
  1894. level.player DisableWeapons();
  1895. level.player FreezeControls( true );
  1896. }
  1897.  
  1898. end_credits()
  1899. {
  1900. level.credits_speed = 25.5;
  1901.  
  1902. thread maps\_credits::playCredits();
  1903. if( level.level_mode == "credits_1" )
  1904. wait 3.5;
  1905. thread fade_from_black();
  1906.  
  1907. wait 290; //-> magic timing - do not change...change credit speed instead
  1908. wait 28; //additional time after credits changes
  1909. level.credits_speed = 4;
  1910. flag_set( "atvi_credits_go" );
  1911.  
  1912. wait 20;
  1913.  
  1914. thread music_stop( 4 );
  1915. wait 5;
  1916.  
  1917. if( level.level_mode == "credits_1" )
  1918. flag_set( "af_chase_nextmission" );
  1919. else
  1920. nextmission();
  1921. }
  1922.  
  1923. fade_from_black()
  1924. {
  1925. wait 9;
  1926. flag_set( "fade_from_black" );
  1927. wait 1;
  1928.  
  1929. level.black FadeOverTime( 2 );
  1930. level.black.alpha = 0;
  1931. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement