./sh02.lua

  1. --[[ 
  2. 	sh02.lua 
  3. 	Stronghold 02 Script 
  4. 	DATE: 08/04/2010 
  5. 	AUTHOR:	Nicholas Zippmann 
  6. ]]-- 
  7.  
  8.  
  9. -- CONSTANTS -- 
  10. TRIG_LOC = 0 
  11. TRIG_INV = 1 
  12. TRIG_USE_LOC = 2 
  13. TRIG_USE_INV = 3 
  14.  
  15. -- GROUPS -- 
  16. sh02_group = { 
  17. 	homies = { 
  18. 		name = "grp_homies", 
  19. 		members = { "npc_zimos" } 
  20. 	}, 
  21. 	collection_guards = { 
  22. 		name = "grp_collection_guards", 
  23. 		members = { "npc_collection_guard<001>", "npc_collection_guard<002>", "npc_collection_guard<003>" } 
  24. 	}, 
  25. 	collection_hos = { 
  26. 		name = "grp_collection_hos", 
  27. 		members = { "npc_collection_ho<001>", "npc_collection_ho<002>", "npc_collection_ho<003>" } 
  28. 	}, 
  29. 	collection_wave = { 
  30. 		name = "grp_collection_wave", 
  31. 		members = { "npc_collection_wave<001>", "npc_collection_wave<002>", "npc_collection_wave<003>" } 
  32. 	}, 
  33. 	lounge_guards = { 
  34. 		name = "grp_lounge_guards", 
  35. 		members = { "npc_lounge_guard<001>", "npc_lounge_guard<002>", "npc_lounge_guard<003>", 
  36. 					"npc_lounge_guard<004>", "npc_lounge_guard<005>", "npc_lounge_guard<006>" } 
  37. 	}, 
  38. 	lounge_snipers = { 
  39. 		name = "grp_lounge_snipers", 
  40. 		members = { "npc_lounge_sniper<001>", "npc_lounge_sniper<002>", "npc_lounge_sniper<003>", 
  41. 					"npc_lounge_sniper<004>" } 
  42. 	}, 
  43. 	lounge_flee01 = { 
  44. 		name = "grp_lounge_flee<001>", 
  45. 		members = { "npc_lounge_flee<001>", "npc_lounge_flee<002>" } 
  46. 	}, 
  47. 	lounge_flee02 = { 
  48. 		name = "grp_lounge_flee<002>", 
  49. 		members = { "npc_lounge_flee<003>", "npc_lounge_flee<004>" } 
  50. 	}, 
  51. 	lounge_flee03 = { 
  52. 		name = "grp_lounge_flee<003>", 
  53. 		members = { "npc_lounge_flee<005>", "npc_lounge_flee<006>" } 
  54. 	}, 
  55. 	lounge_flee04 = { 
  56. 		name = "grp_lounge_flee<004>", 
  57. 		members = { "npc_lounge_flee<007>", "npc_lounge_flee<008>" } 
  58. 	}, 
  59. 	jailcell01_guards = { 
  60. 		name = "grp_jailcell01_guards", 
  61. 		members = { "npc_jailcell01_guard<001>", "npc_jailcell01_guard<002>", "npc_jailcell01_guard<003>", 
  62. 					"npc_jailcell01_guard<004>" } 
  63. 	}, 
  64. 	jailcell01_hos = { 
  65. 		name = "grp_jailcell01_hos", 
  66. 		members = { "npc_jailcell01_ho<001>", "npc_jailcell01_ho<002>", "npc_jailcell01_ho<003>", 
  67. 					"npc_jailcell01_ho<004>", "npc_jailcell01_ho<005>" } 
  68. 	}, 
  69. 	jailcell01_wave = { 
  70. 		name = "grp_jailcell01_wave", 
  71. 		members = { "npc_jailcell01_wave<001>", "npc_jailcell01_wave<002>" } 
  72. 	}, 
  73. 	jailcell02_guards = { 
  74. 		name = "grp_jailcell02_guards", 
  75. 		members = { "npc_jailcell02_guard<001>", "npc_jailcell02_guard<002>", "npc_jailcell02_guard<003>", 
  76. 					"npc_jailcell02_guard<004>" } 
  77. 	}, 
  78. 	jailcell02_brutella = { 
  79. 		name = "grp_jailcell02_brutella", 
  80. 		members = { "npc_jailcell02_brutella" } 
  81. 	}, 
  82. 	jailcell02_hos = { 
  83. 		name = "grp_jailcell02_hos", 
  84. 		members = { "npc_jailcell02_ho<001>", "npc_jailcell02_ho<002>", "npc_jailcell02_ho<003>", 
  85. 					"npc_jailcell02_ho<004>", "npc_jailcell02_ho<005>" } 
  86. 	}, 
  87. 	jailcell02_wave = { 
  88. 		name = "grp_jailcell02_wave", 
  89. 		members = { "npc_jailcell02_wave<001>", "npc_jailcell02_wave<002>", "npc_jailcell02_wave<003>" } 
  90. 	}, 
  91. 	jailcell03_guards = { 
  92. 		name = "grp_jailcell03_guards", 
  93. 		members = { "npc_jailcell03_guard<001>", "npc_jailcell03_guard<002>", "npc_jailcell03_guard<003>", 
  94. 					"npc_jailcell03_guard<004>", "npc_jailcell03_guard<005>", "npc_jailcell03_guard<006>" } 
  95. 	}, 
  96. 	jailcell03_hos = { 
  97. 		name = "grp_jailcell03_hos", 
  98. 		members = { "npc_jailcell03_ho<001>", "npc_jailcell03_ho<002>", "npc_jailcell03_ho<003>", 
  99. 					"npc_jailcell03_ho<004>", "npc_jailcell03_ho<005>", "npc_jailcell03_ho<006>",  
  100. 					"npc_jailcell03_ho<007>", "npc_jailcell03_ho<008>", "npc_jailcell03_ho<009>",  
  101. 					"npc_jailcell03_ho<010>" } 
  102. 	}, 
  103. 	jailcell03_wave = { 
  104. 		name = "grp_jailcell03_wave", 
  105. 		members = { "npc_jailcell03_wave<001>", "npc_jailcell03_wave<002>", "npc_jailcell03_wave<003>", 
  106. 					"npc_jailcell03_wave<004>" } 
  107. 	}, 
  108. 	jailcell03_final = { 
  109. 		name = "grp_jailcell03_final", 
  110. 		members = { "npc_jailcell03_final<001>", "npc_jailcell03_final<002>", "npc_jailcell03_final<003>", 
  111. 					"npc_jailcell03_final<004>" } 
  112. 	}, 
  113. 	cont_spawn01 = { 
  114. 		name = "grp_cont_spawn<001>", 
  115. 		members = { "npc_cont_spawn<001>", "npc_cont_spawn<002>" } 
  116. 	}, 
  117. 	cont_spawn02 = { 
  118. 		name = "grp_cont_spawn<002>", 
  119. 		members = { "npc_cont_spawn<003>", "npc_cont_spawn<004>" } 
  120. 	}, 
  121. 	cont_spawn03 = { 
  122. 		name = "grp_cont_spawn<003>", 
  123. 		members = { "npc_cont_spawn<005>", "npc_cont_spawn<006>" } 
  124. 	}, 
  125. 	cont_spawn04 = { 
  126. 		name = "grp_cont_spawn<004>", 
  127. 		members = { "npc_cont_spawn<007>", "npc_cont_spawn<008>" } 
  128. 	}, 
  129. 	cont_spawn05 = { 
  130. 		name = "grp_cont_spawn<005>", 
  131. 		members = { "npc_cont_spawn<009>", "npc_cont_spawn<010>" } 
  132. 	}, 
  133. 	cont_spawn06 = { 
  134. 		name = "grp_cont_spawn<006>", 
  135. 		members = { "npc_cont_spawn<011>", "npc_cont_spawn<012>" } 
  136. 	}, 
  137. 	cte_npcs = { 
  138. 		name = "grp_cte_npc" 
  139. 	}, 
  140. 	garage_vehicles = { 
  141. 		name = "grp_garage_vehicles", 
  142. 		vehicles = { "veh_garage<001>", "veh_garage<002>", "veh_garage<003>" } 
  143. 	}, 
  144. 	garage_brute = { 
  145. 		name = "grp_garage_brute", 
  146. 		members = { "npc_garage_brute" } 
  147. 	} 
  148. } 
  149. sh02_zimos = sh02_group.homies.members[1] 
  150.  
  151. -- NAVPOINTS -- 
  152. NAV_CANCEL = { "nav_cancel<001>", "nav_cancel<002>" } 
  153. NAV_CHKPNT01 = { "nav_checkpoint01<001>", "nav_checkpoint01<002>", "nav_checkpoint01<003>" } 
  154. NAV_HACKING = { "nav_hacking<001>", "nav_hacking<002>", "nav_hacking<003>", "nav_hacking<004>" } 
  155. NAV_HOS = { "nav_hos<001>", "nav_hos<002>", "nav_hos<003>", "nav_hos<004>", 
  156. 			"nav_hos<005>", "nav_hos<006>", "nav_hos<007>", "nav_hos<008>" } 
  157. NAV_LEASH01 = { "nav_leash01<001>", "nav_leash01<002>", "nav_leash01<003>", "nav_leash01<004>", 
  158. 				"nav_leash01<005>", "nav_leash01<006>" } 
  159. NAV_CHKPNT02 = { "nav_checkpoint02<001>", "nav_checkpoint02<002>", "nav_checkpoint02<003>" } 
  160. NAV_COLLECTION = { "nav_collection<001>", "nav_collection<002>", "nav_collection<003>" } 
  161. NAV_CHKPNT03 = { "nav_checkpoint03<001>", "nav_checkpoint03<002>", "nav_checkpoint03<003>" } 
  162. NAV_LEASH02 = { "nav_leash02<001>", "nav_leash02<002>", "nav_leash02<003>", "nav_leash02<004>" } 
  163. NAV_JAILCELL01 = { "nav_jailcell01<001>", "nav_jailcell01<002>" } 
  164. NAV_LEASH03 = { "nav_leash03<001>", "nav_leash03<002>", "nav_leash03<003>", "nav_leash03<004>" } 
  165. NAV_JAILCELL02 = { "nav_jailcell02<001>", "nav_jailcell02<002>", "nav_jailcell02<003>" } 
  166. NAV_CHKPNT04 = { "nav_checkpoint04<001>", "nav_checkpoint04<002>", "nav_checkpoint04<003>" } 
  167. NAV_LEASH04 = { "nav_leash04<001>", "nav_leash04<002>", "nav_leash04<003>", "nav_leash04<004>", 
  168. 				"nav_leash04<005>", "nav_leash04<006>" } 
  169. NAV_JAILCELL03 = { "nav_jailcell03<001>", "nav_jailcell03<002>", "nav_jailcell03<003>", "nav_jailcell03<004>" } 
  170. NAV_JAILCELL04 = { "nav_jailcell04<001>", "nav_jailcell04<002>", "nav_jailcell04<003>", "nav_jailcell04<004>" } 
  171. NAV_CHKPNT05 = { "nav_checkpoint05<001>", "nav_checkpoint05<002>", "nav_checkpoint05<003>" } 
  172. NAV_FINAL = { "nav_final_local", "nav_final_remote"} 
  173. NAV_CP_START = { "nav_checkpoint01<001>", "nav_checkpoint01<002>" } 
  174.  
  175. -- SPAWN REGIONS -- 
  176. sh02_spawn = { 
  177. 	lounge = "sr_lounge", 
  178. 	stairwell = "sr_stairwell", 
  179. 	jailcell01 = "sr_jailcell01", 
  180. 	jailcell02 = "sr_jailcell02", 
  181. 	jailcell03 = "sr_jailcell03" 
  182. } 
  183.  
  184. -- SCRIPT MOVERS -- 
  185. sh02_door = { 
  186. 	auction = "door_auction", 
  187. 	coll_hos = "door_collect_hos", 
  188. 	coll_out = "door_collect_out", 
  189. 	flee01 = "door_flee<001>", 
  190. 	flee02 = "door_flee<002>", 
  191. 	flee03 = "door_flee<003>", 
  192. 	flee04 = "door_flee<004>", 
  193. 	stairwell = "door_stairwell", 
  194. 	cells01 = "door_cells<001>", 
  195. 	spawn01 = "door_spawn<001>", 
  196. 	cells02 = "door_cells<002>", 
  197. 	spawn02 = "door_spawn<002>", 
  198. 	spawn03 = "door_spawn<003>", 
  199. 	cells03 = "door_cells<003>", 
  200. 	spawn04 = "door_spawn<004>", 
  201. 	garage = "door_garage" 
  202. } 
  203.  
  204. -- TEXT -- 
  205. -- Objective: Go To The Collection Room 
  206. SH02_OBJ_COLLECTION = "sh02_obj_collection_room" 
  207. -- Objective: Disable Security 
  208. SH02_OBJ_OVERRIDE = "sh02_obj_override_button" 
  209. -- Objective: Go To The Security Center 
  210. SH02_OBJ_BASEMENT = "sh02_obj_basement" 
  211. -- Objective: Free Hos 
  212. SH02_OBJ_FREE_HOS = "sh02_obj_free_hos" 
  213. -- Objective: Eliminate Morningstar 
  214. SH02_OBJ_CLEAN_HOUSE = "sh02_obj_clean_house" 
  215. -- Objective: Head To The Garage 
  216. SH02_OBJ_GARAGE = "sh02_obj_garage" 
  217. -- Objective: Kill Brute 
  218. SH02_OBJ_KILL_BRUTE = "sh02_obj_kill_brute" 
  219. -- Failure: Zimos Died 
  220. SH02_FAILURE_ZIMOS_DIED = "sh02_failure_zimos_died" 
  221. -- Failure: Zimos Abandoned 
  222. SH02_FAILURE_ABANDON_ZIMOS = "sh02_failure_abandon_zimos" 
  223.  
  224. -- TRIGGERS -- 
  225. sh02_trigger = { 
  226. 	collection01 = { 
  227. 		name = "trig_collection<001>", 
  228. 		callback = "sh02_collection01_cb", 
  229. 		triggered = false, 
  230. 		style = TRIG_INV 
  231. 	}, 
  232. 	collection02 = { 
  233. 		name = "trig_collection<002>", 
  234. 		callback = "sh02_collection02_cb", 
  235. 		triggered = false, 
  236. 		style = TRIG_INV 
  237. 	}, 
  238. 	collection03 = { 
  239. 		name = "trig_override<001>", 
  240. 		callback = "sh02_collection03_cb", 
  241. 		triggered = false, 
  242. 		style = TRIG_LOC 
  243. 	},	 
  244. 	override01 = { 
  245. 		name = "trig_override<001>", 
  246. 		callback = "sh02_override01_cb", 
  247. 		triggered = false, 
  248. 		style = TRIG_USE_LOC 
  249. 	}, 
  250. 	lounge = { 
  251. 		name = "trig_lounge", 
  252. 		callback = "sh02_lounge_cb", 
  253. 		triggered = false, 
  254. 		style = TRIG_INV 
  255. 	}, 
  256. 	hallway = { 
  257. 		name = "trig_hallway", 
  258. 		callback = "sh02_hallway_cb", 
  259. 		triggered = false, 
  260. 		style = TRIG_INV 
  261. 	}, 
  262. 	stairwell01 = { 
  263. 		name = "trig_stairwell<001>", 
  264. 		callback = "sh02_stairwell01_cb", 
  265. 		triggered = false, 
  266. 		style = TRIG_LOC 
  267. 	}, 
  268. 	stairwell02 = { 
  269. 		name = "trig_stairwell<002>", 
  270. 		callback = "sh02_stairwell02_cb", 
  271. 		triggered = false, 
  272. 		style = TRIG_LOC 
  273. 	}, 
  274. 	stairwell03 = { 
  275. 		name = "trig_stairwell<003>", 
  276. 		callback = "sh02_stairwell03_cb", 
  277. 		triggered = false, 
  278. 		style = TRIG_LOC 
  279. 	}, 
  280. 	stairwell04 = { 
  281. 		name = "trig_stairwell<004>", 
  282. 		callback = "sh02_stairwell04_cb", 
  283. 		triggered = false, 
  284. 		style = TRIG_LOC 
  285. 	}, 
  286. 	wrongway = { 
  287. 		name = "trig_wrong_way", 
  288. 		callback = "sh02_wrongway_cb", 
  289. 		triggered = false, 
  290. 		style = TRIG_INV 
  291. 	}, 
  292. 	jailcell01_01 = { 
  293. 		name = "trig_jailcell01<001>", 
  294. 		callback = "sh02_jailcell01_01_cb", 
  295. 		triggered = false, 
  296. 		style = TRIG_LOC 
  297. 	}, 
  298. 	freehos01 = { 
  299. 		name = "trig_free_hos<001>", 
  300. 		callback = "sh02_freehos01_cb", 
  301. 		triggered = false, 
  302. 		style = TRIG_INV 
  303. 	}, 
  304. 	override02 = { 
  305. 		name = "trig_override<002>", 
  306. 		callback = "sh02_override02_cb", 
  307. 		triggered = false, 
  308. 		style = TRIG_USE_INV 
  309. 	}, 
  310. 	jailcell01_02 = { 
  311. 		name = "trig_jailcell01<002>", 
  312. 		callback = "sh02_jailcell01_02_cb", 
  313. 		triggered = false, 
  314. 		style = TRIG_LOC 
  315. 	}, 
  316. 	freehos02 = { 
  317. 		name = "trig_free_hos<002>", 
  318. 		callback = "sh02_freehos02_cb", 
  319. 		triggered = false, 
  320. 		style = TRIG_INV 
  321. 	}, 
  322. 	override03 = { 
  323. 		name = "trig_override<003>", 
  324. 		callback = "sh02_override03_cb", 
  325. 		triggered = false, 
  326. 		style = TRIG_USE_INV 
  327. 	}, 
  328. 	jailcell02_01 = { 
  329. 		name = "trig_jailcell02<001>", 
  330. 		callback = "sh02_jailcell02_01_cb", 
  331. 		triggered = false, 
  332. 		style = TRIG_LOC 
  333. 	}, 
  334. 	jailcell02_02 = { 
  335. 		name = "trig_jailcell02<002>", 
  336. 		callback = "sh02_jailcell02_02_cb", 
  337. 		triggered = false, 
  338. 		style = TRIG_LOC 
  339. 	}, 
  340. 	jailcell03_01 = { 
  341. 		name = "trig_jailcell03<001>", 
  342. 		callback = "sh02_jailcell03_01_cb", 
  343. 		triggered = false, 
  344. 		style = TRIG_LOC 
  345. 	}, 
  346. 	jailcell03_02 = { 
  347. 		name = "trig_jailcell03<002>", 
  348. 		callback = "sh02_jailcell03_02_cb", 
  349. 		triggered = false, 
  350. 		style = TRIG_INV 
  351. 	}, 
  352. 	backroom = { 
  353. 		name = "trig_backroom", 
  354. 		callback = "sh02_backroom_cb", 
  355. 		triggered = false, 
  356. 		style = TRIG_INV 
  357. 	}, 
  358. 	override04 = { 
  359. 		name = "trig_override<004>", 
  360. 		callback = "sh02_override04_cb", 
  361. 		triggered = false, 
  362. 		style = TRIG_USE_LOC 
  363. 	}, 
  364. 	garage = { 
  365. 		name = "trig_garage", 
  366. 		callback = "sh02_garage_cb", 
  367. 		triggered = false, 
  368. 		style = TRIG_LOC 
  369. 	} 
  370. } 
  371.  
  372. -- PERSONA LINES -- 
  373. sh02_persona = { 
  374. 	-- Player: "Whoa, pretty colors... Ok, let's do this." X 
  375. 	woozy = { 
  376. 		speaker = LOCAL_PLAYER, 
  377. 		line = "SH02_Player_Woozy_Start" 
  378. 	},		 
  379. 	-- Zimos: "We'll have to shut down security. Should be up ahead." X 
  380. 	follow = { 
  381. 		speaker = sh02_zimos, 
  382. 		line = "SH02_Follow_Me" 
  383. 	}, 
  384. 	-- Zimos: "Find somethin' to shut off those alarms." X 
  385. 	unlock = { 
  386. 		speaker = sh02_zimos, 
  387. 		line = "SH02_Unlock_Doors" 
  388. 	}, 
  389. 	-- Zimos: "We'll have to go down to find the security room." X 
  390. 	godown = { 
  391. 		speaker = sh02_zimos, 
  392. 		line = "SH02_Down_To_Security" 
  393. 	}, 
  394. 	-- Zimos: "Where you headed?  We gotta go down, remember?" X 
  395. 	wrongway = { 
  396. 		speaker = sh02_zimos, 
  397. 		line = "SH02_Wrong_Way" 
  398. 	}, 
  399. 	-- Zimos: "Shit, we can't leave them like this. I say we let 'em out." X 
  400. 	helphos = { 
  401. 		speaker = sh02_zimos, 
  402. 		line = "SH02_Help_People" 
  403. 	}, 
  404. 	-- Zimos: "Damn things are still goin'�" X 
  405. 	override01 = { 
  406. 		speaker = sh02_zimos, 
  407. 		line = "SH02_Security_Override_01" 
  408. 	}, 
  409. 	-- Zimos: "Override these doors and let's keep movin'." 
  410. 	override02 = { 
  411. 		speaker = sh02_zimos, 
  412. 		line = "SH02_Security_Override_02" 
  413. 	}, 
  414. 	-- Zimos: "More to let out. Get on that." X 
  415. 	override03 = { 
  416. 		speaker = sh02_zimos, 
  417. 		line = "SH02_Security_Override_03" 
  418. 	}, 
  419. 	-- Player: "None of these things are labeled�" X 
  420. 	hacking01 = { 
  421. 		speaker = LOCAL_PLAYER, 
  422. 		line = "SH02_Commenting_On_Hacking_01" 
  423. 	}, 
  424. 	-- Player: "Perhaps that button�" X 
  425. 	hacking02 = { 
  426. 		speaker = LOCAL_PLAYER, 
  427. 		line = "SH02_Commenting_On_Hacking_02" 
  428. 	}, 
  429. 	-- Player: "Come on, everyone out." X 
  430. 	release01 = { 
  431. 		speaker = LOCAL_PLAYER, 
  432. 		line = "SH02_Release_Prisoners_01" 
  433. 	}, 
  434. 	-- Player: "Get some fresh air!" X 
  435. 	release02 = { 
  436. 		speaker = LOCAL_PLAYER, 
  437. 		line = "SH02_Release_Prisoners_02" 
  438. 	}, 
  439. 	-- Player: "Move along! Don't waste time!" X 
  440. 	release03 = { 
  441. 		speaker = LOCAL_PLAYER, 
  442. 		line = "SH02_Release_Prisoners_03" 
  443. 	}, 
  444. 	-- Morningstar: Mission specific attack lines 
  445. 	ms_attack = { 
  446. 		speaker = nil, 
  447. 		line = "SH02_Attack" 
  448. 	}, 
  449. 	-- Morningstar: Attacked lines when ho attacks 
  450. 	ms_attacked = { 
  451. 		speaker = nil, 
  452. 		line = "SH02_Scared" 
  453. 	}, 
  454. 	-- Ho: Attack lines when attacking Morningstar 
  455. 	ho_attack = { 
  456. 		speaker = nil, 
  457. 		line = "SH02_Freedom" 
  458. 	} 
  459. } 
  460.  
  461. -- CHATTER LINES -- 
  462. sh02_chatter = { 
  463. 	-- Chatter data 
  464. 	playing = false, 
  465. 	main_thd = INVALID_THREAD_HANDLE, 
  466. 	wait_thd = INVALID_THREAD_HANDLE, 
  467. 	-- Player: "Oh my god...the floor is so wobbly!" X 
  468. 	drugged_out = { 
  469. 		{ 
  470. 			speaker = LOCAL_PLAYER, 
  471. 			line = "SH02_Drugged_Out_01", 
  472. 			spoken = false 
  473. 		}, 
  474. 		{ 
  475. 			speaker = LOCAL_PLAYER, 
  476. 			line = "SH02_Drugged_Out_02", 
  477. 			spoken = false 
  478. 		}, 
  479. 		{ 
  480. 			speaker = LOCAL_PLAYER, 
  481. 			line = "SH02_Drugged_Out_03", 
  482. 			spoken = false 
  483. 		}, 
  484. 		{ 
  485. 			speaker = LOCAL_PLAYER, 
  486. 			line = "SH02_Drugged_Out_04", 
  487. 			spoken = false 
  488. 		}, 
  489. 		{ 
  490. 			speaker = LOCAL_PLAYER, 
  491. 			line = "SH02_Drugged_Out_05", 
  492. 			spoken = false 
  493. 		} 
  494. 	}, 
  495. 	-- Player: "Think these girls are pissed off?" X 
  496. 	hos_fighting = { 
  497. 		{ 
  498. 			speaker = LOCAL_PLAYER, 
  499. 			line = "SH02_Hos_Fighting_01", 
  500. 			spoken = false 
  501. 		}, 
  502. 		{ 
  503. 			speaker = LOCAL_PLAYER, 
  504. 			line = "SH02_Hos_Fighting_02", 
  505. 			spoken = false 
  506. 		} 
  507. 	}, 
  508. 	-- Zimos: "What are you doing!?" X 
  509. 	ho_killed = { 
  510. 		{ 
  511. 			speaker = sh02_zimos, 
  512. 			line = "SH02_No_Kill_Hos_01", 
  513. 			spoken = false 
  514. 		}, 
  515. 		{ 
  516. 			speaker = sh02_zimos, 
  517. 			line = "SH02_No_Kill_Hos_02", 
  518. 			spoken = false 
  519. 		}, 
  520. 		{ 
  521. 			speaker = sh02_zimos, 
  522. 			line = "SH02_No_Kill_Hos_03", 
  523. 			spoken = false 
  524. 		} 
  525. 	} 
  526. } 
  527.  
  528. -- CONVERSATIONS -- 
  529. sh02_convo = { 
  530. 	-- Convo data 
  531. 	playing = false, 
  532. 	main_thd = INVALID_THREAD_HANDLE, 
  533. 	-- Player/Zimos: "Here's your guns back." X 
  534. 	mission_start = { 
  535. 		name = "SH02_Convo_2", 
  536. 		handle = INVALID_CONVERSATION_HANDLE, 
  537. 		load_direct = false 
  538. 	}, 
  539. 	-- Player/Zimos: "You're handling this naked thing better than I thought you would." X 
  540. 	combat02 = { 
  541. 		name = "SH02_Combat_2", 
  542. 		handle = INVALID_CONVERSATION_HANDLE, 
  543. 		load_direct = false 
  544. 	}, 
  545. 	-- Player/Zimos: "Don't expect me to be down with doin' this again. It's a one time thing." X 
  546. 	combat03 = { 
  547. 		name = "SH02_Combat_3", 
  548. 		handle = INVALID_CONVERSATION_HANDLE, 
  549. 		load_direct = false 
  550. 	}, 
  551. 	-- Player/Zimos: "Time to go after their head of security, only�" X 
  552. 	kill_brute = { 
  553. 		name = "SH02_Kill_Brute", 
  554. 		handle = INVALID_CONVERSATION_HANDLE, 
  555. 		load_direct = false 
  556. 	}, 
  557. } 
  558.  
  559. -- THREADS -- 
  560. sh02_thread = { 
  561. 	player = INVALID_THREAD_HANDLE, 
  562. 	homies = INVALID_THREAD_HANDLE, 
  563. 	enemies = INVALID_THREAD_HANDLE, 
  564. 	ms_wait = INVALID_THREAD_HANDLE, 
  565. 	ho_wait = INVALID_THREAD_HANDLE, 
  566. 	chatter_main = sh02_chatter.main_thd, 
  567. 	chatter_wait = sh02_chatter.wait_thd, 
  568. 	convo_main = sh02_convo.main_thd 
  569. }  
  570.  
  571. -- CHECKPOINTS -- 
  572. SH02_CHECKPOINT_START = MISSION_START_CHECKPOINT -- defined in ug_lib.lua 
  573. SH02_CHECKPOINT_COLLECTION = "sh02_checkpoint_collection_room" 
  574. SH02_CHECKPOINT_BASEMENT = "sh02_checkpoint_basement" 
  575. SH02_CHECKPOINT_CLEAN_HOUSE = "sh02_checkpoint_clean_house" 
  576. SH02_CHECKPOINT_KILL_BRUTE = "sh02_checkpoint_kill_brute" 
  577.  
  578. -- CUTSCENES -- 
  579. SH02_CUTSCENE_MISSION_INTRO = "MS_SH02" 
  580. SH02_CUTSCENE_BRUTE_CTE = "sh02_cte_01" 
  581.  
  582. -- GLOBAL VARIABLES -- 
  583. sh02_in_coop = false 
  584. sh02_hos_nav = 1 
  585. sh02_prompt01 = -1 
  586. sh02_prompt02 = -1 
  587. sh02_guys_killed = 0 
  588. sh02_brute_killed = false 
  589.  
  590.  
  591.  
  592.  
  593. -- *************************************************** 
  594. -- SH02 Main Functions 
  595. -- *************************************************** 
  596.  
  597. -- CALLED FROM CODE 
  598. -- This is the primary entry point for the mission, and is  
  599. -- responsible for starting up the mission at the specified checkpoint. 
  600. -- sh02_checkpoint:	The checkpoint the mission should begin at 
  601. -- is_restart: TRUE if the mission is restarting, FALSE otherwise 
  602. function sh02_start(sh02_checkpoint, is_restart) 
  603. 	 
  604. 	-- Check if mission is starting from the beginning 
  605. 	if (sh02_checkpoint == SH02_CHECKPOINT_START) then 
  606. 		if (is_restart == false) then 
  607. 		 
  608. 			-- Play intro cutscene (no fade in after) 
  609. 			cutscene_play(SH02_CUTSCENE_MISSION_INTRO, nil, NAV_CP_START, false, false) 
  610. 			 
  611. 			-- Teleport player(s) to Auction Room 
  612. 			--teleport_coop(NAV_CHKPNT01[1], NAV_CHKPNT01[2], true) 
  613. 			 
  614. 			-- Play intro audio sequence 
  615. 			audio_object_post_event("sh02_intro_sequence") 
  616. 			 
  617. 			-- Wait some time 
  618. 			delay(15.0) 
  619. 			 
  620. 		end 
  621. 	end 
  622. 	 
  623. 	-- Init the mission from the current checkpoint 
  624. 	sh02_initialize(sh02_checkpoint) 
  625. 	 
  626. 	-- Run the mission from the current checkpoint 
  627. 	sh02_run(sh02_checkpoint) 
  628. 	 
  629. end 
  630.  
  631. -- This is the primary function responsible for running the entire mission from start to finish. 
  632. -- first_checkpoint: the first checkpoint to begin running the mission at 
  633. function sh02_run(first_checkpoint) 
  634. 	local current_checkpoint = first_checkpoint 
  635. 	 
  636. 	-- Run the mission from the beginning 
  637. 	if (current_checkpoint == SH02_CHECKPOINT_START) then 
  638. 	 
  639. 		-- Setup player(s) being drugged (strongest) 
  640. 		sh02_setup_player_drugged(1.0) 
  641. 		 
  642. 		-- Have player(s) stumble to ground 
  643. 		sh02_players_stumble_thd() 
  644. 		 
  645. 		-- Set persona situation override (Drugged). 
  646. 		persona_set_global_situation_override(PS_OVERRIDE_SH02) 
  647. 		 
  648. 		-- Player: "Whoa, pretty colors... Ok, let's do this." 
  649. 		sh02_play_persona_line(sh02_persona.woozy) 
  650. 		 
  651. 		-- Wait until player is done speaking 
  652. 		while sh02_persona_line_playing() do 
  653. 			thread_yield() 
  654. 		end 
  655. 		 
  656. 		-- Set Collection 01 trigger 
  657. 		sh02_set_trigger(sh02_trigger.collection01) 
  658. 		 
  659. 		-- Have Zimos greet player and wait for it 
  660. 		sh02_zimos_greet_player_thd() 
  661. 		while not sh02_check_homies_thread() do 
  662. 			thread_yield() 
  663. 		end 
  664. 		 
  665. 		-- Give back player(s) weapons 
  666. 		inv_weapon_disable_all_slots(false) 
  667. 		 
  668. 		-- Player/Zimos: "Here's your guns back." 
  669. 		sh02_start_convo_thread(sh02_convo.mission_start) 
  670. 		 
  671. 		-- Objective: Go To The Collection Room 
  672. 		sh02_show_objective_loc(SH02_OBJ_COLLECTION) 
  673. 		 
  674. 		-- Set Collection 02/03 triggers 
  675. 		sh02_set_trigger(sh02_trigger.collection02) 
  676. 		sh02_set_trigger(sh02_trigger.collection03) 
  677. 		 
  678. 		-- Wait until Collection 01 trigger is reached 
  679. 		while not sh02_check_trigger(sh02_trigger.collection01) do  
  680. 			thread_yield() 
  681. 		end 
  682. 		 
  683. 		-- Wait until Collection 02 trigger is reached 
  684. 		while not sh02_check_trigger(sh02_trigger.collection02) do  
  685. 			thread_yield() 
  686. 		end 
  687. 		 
  688. 		-- Wait until Override 01 trigger is reached 
  689. 		while not sh02_check_trigger(sh02_trigger.override01) do 
  690. 			thread_yield() 
  691. 		end 
  692. 		 
  693. 		-- Reset Checkpoint 02 doors 
  694. 		sh02_reset_doors_chkpnt02() 
  695. 		 
  696. 		-- Goto next checkpoint 
  697. 		current_checkpoint = SH02_CHECKPOINT_COLLECTION 
  698. 		mission_set_checkpoint(SH02_CHECKPOINT_COLLECTION, true) 
  699. 		 
  700. 	end 
  701. 	 
  702. 	-- Run the mission from the Collection Room checkpoint 
  703. 	if (current_checkpoint == SH02_CHECKPOINT_COLLECTION) then 
  704. 	 
  705. 		-- Setup player(s) being drugged (medium) 
  706. 		sh02_setup_player_drugged(0.5) 
  707. 		 
  708. 		-- Zimos: "Damn things are still goin'�" 
  709. 		sh02_play_persona_line(sh02_persona.override01) 
  710. 		 
  711. 		-- Setup Collection hos to join player 
  712. 		sh02_setup_collection_hos() 
  713. 		 
  714. 		-- Open Collection Hos door 
  715. 		door_open(sh02_door.coll_hos, true) 
  716. 		 
  717. 		-- Setup Collection wave to move in 
  718. 		sh02_setup_collection_wave() 
  719. 		 
  720. 		-- Setup Lounge guards/snipers 
  721. 		sh02_setup_lounge_enemies() 
  722. 		 
  723. 		-- Open Collection Out door 
  724. 		door_open(sh02_door.coll_out, true) 
  725. 		 
  726. 		-- Wait until Zimos is done speaking 
  727. 		while sh02_persona_line_playing() do 
  728. 			thread_yield() 
  729. 		end 
  730. 		 
  731. 		-- Have player(s) come down from drugs 
  732. 		sh02_player_come_down_thd() 
  733. 		 
  734. 		-- Zimos: "We'll have to go down to find the security room." 
  735. 		sh02_play_persona_line(sh02_persona.godown) 
  736. 		 
  737. 		-- Objective: Go To The Security Center 
  738. 		sh02_show_objective_loc(SH02_OBJ_BASEMENT) 
  739. 		 
  740. 		-- Set Lounge/Hallway triggers 
  741. 		sh02_set_trigger(sh02_trigger.lounge) 
  742. 		sh02_set_trigger(sh02_trigger.hallway) 
  743. 		 
  744. 		-- Set Stairwell 01 trigger and wait for it 
  745. 		sh02_set_trigger(sh02_trigger.stairwell01) 
  746. 		while not sh02_check_trigger(sh02_trigger.stairwell01) do 
  747. 			thread_yield() 
  748. 		end 
  749. 		 
  750. 		-- Player/Zimos: "You're handling this naked thing better than I thought you would." 
  751. 		sh02_start_convo_thread(sh02_convo.combat02) 
  752. 		 
  753. 		-- Set Wrong Way trigger 
  754. 		sh02_set_trigger(sh02_trigger.wrongway) 
  755. 		 
  756. 		-- Start Stairwell continuous spawning 
  757. 		sh02_stairwell_spawn_start_thd() 
  758. 		 
  759. 		-- Open Stairwell door 
  760. 		door_open(sh02_door.stairwell, true, false) 
  761. 		 
  762. 		-- Set Stairwell 02 trigger and wait for it 
  763. 		sh02_set_trigger(sh02_trigger.stairwell02) 
  764. 		while not sh02_check_trigger(sh02_trigger.stairwell02) do 
  765. 			thread_yield() 
  766. 		end 
  767. 		 
  768. 		-- Set Stairwell 03 trigger and wait for it 
  769. 		sh02_set_trigger(sh02_trigger.stairwell03) 
  770. 		while not sh02_check_trigger(sh02_trigger.stairwell03) do 
  771. 			thread_yield() 
  772. 		end 
  773. 		 
  774. 		-- Set Stairwell 04 trigger and wait for it 
  775. 		sh02_set_trigger(sh02_trigger.stairwell04) 
  776. 		while not sh02_check_trigger(sh02_trigger.stairwell04) do 
  777. 			thread_yield() 
  778. 		end 
  779. 		 
  780. 		-- Cleanup Checkpoint 01/02 enemies 
  781. 		sh02_cleanup_enemies_chkpnt01() 
  782. 		sh02_cleanup_enemies_chkpnt02() 
  783. 		 
  784. 		-- Cleanup remaining npcs 
  785. 		sh02_cleanup_npcs() 
  786. 		 
  787. 		-- Reset Checkpoint 03 doors 
  788. 		sh02_reset_doors_chkpnt03() 
  789. 		 
  790. 		-- Stop chatter/convo threads 
  791. 		sh02_stop_chatter_thread() 
  792. 		sh02_stop_convo_thread() 
  793. 		 
  794. 		-- Goto next checkpoint 
  795. 		current_checkpoint = SH02_CHECKPOINT_BASEMENT 
  796. 		mission_set_checkpoint(SH02_CHECKPOINT_BASEMENT, true) 
  797. 		 
  798. 	end 
  799. 	 
  800. 	-- Run the mission from the Basement checkpoint 
  801. 	if (current_checkpoint == SH02_CHECKPOINT_BASEMENT) then 
  802. 	 
  803. 		-- Cleanup player(s) being drugged 
  804. 		sh02_cleanup_player_drugged() 
  805. 		 
  806. 		-- Set Morningstar notoriety (2.0) 
  807. 		notoriety_set("Morningstar", 2.0) 
  808. 		notoriety_set_min("Morningstar", 2.0) 
  809. 		 
  810. 		-- Clear persona situation override (Drugged). 
  811. 		persona_clear_global_situation_override() 
  812. 		 
  813. 		-- Set persona situation override (Brutella). 
  814. 		persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE) 
  815. 		 
  816. 		-- Have Jailcell 01 guards leash to navpoints 
  817. 		sh02_group_leash_to(sh02_group.jailcell01_guards, NAV_LEASH02, 4.0) 
  818. 		 
  819. 		-- Objective: Go To The Security Center 
  820. 		sh02_show_objective_loc(SH02_OBJ_BASEMENT) 
  821. 		 
  822. 		-- Set Jailcell 01-01 trigger 
  823. 		sh02_set_trigger(sh02_trigger.jailcell01_01) 
  824. 		 
  825. 		-- Set Free Hos 01 trigger and wait for it 
  826. 		sh02_set_trigger(sh02_trigger.freehos01) 
  827. 		while not sh02_check_trigger(sh02_trigger.freehos01) do 
  828. 			thread_yield() 
  829. 		end 
  830. 		 
  831. 		-- Zimos: "Shit, we can't leave them like this. I say we let 'em out." 
  832. 		sh02_play_persona_line(sh02_persona.helphos) 
  833. 		 
  834. 		-- Set Override 02 trigger 
  835. 		sh02_set_trigger(sh02_trigger.override02) 
  836. 		sh02_prompt01 = effect_play_finisher(NAV_HACKING[2], 2.5) 
  837. 		 
  838. 		-- Wait until Jailcell 01-01 trigger is reached 
  839. 		while not sh02_check_trigger(sh02_trigger.jailcell01_01) do 
  840. 			thread_yield() 
  841. 		end 
  842. 		 
  843. 		-- Have all hos leash to next navpoint 
  844. 		sh02_hos_nav = 4 
  845. 		sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav]) 
  846. 		 
  847. 		-- Set Jailcell 01-02 trigger and wait for it 
  848. 		sh02_set_trigger(sh02_trigger.jailcell01_02) 
  849. 		while not sh02_check_trigger(sh02_trigger.jailcell01_02) do 
  850. 			thread_yield() 
  851. 		end 
  852. 		 
  853. 		-- Have all hos leash to next navpoint 
  854. 		sh02_hos_nav = 5 
  855. 		sh02_all_hos_leash_to(5.0, NAV_HOS[sh02_hos_nav]) 
  856. 		 
  857. 		-- Stop Jailcell 01 continuous spawning 
  858. 		sh02_jailcell01_spawn_stop_thd() 
  859. 		 
  860. 		-- Have Jailcell 02 guards leash to navpoints 
  861. 		sh02_group_leash_to(sh02_group.jailcell02_guards, NAV_LEASH03, 4.0) 
  862. 		 
  863. 		-- Set Jailcell 02-01 trigger 
  864. 		sh02_set_trigger(sh02_trigger.jailcell02_01) 
  865. 		 
  866. 		-- Set Free Hos 02 trigger and wait for it 
  867. 		sh02_set_trigger(sh02_trigger.freehos02) 
  868. 		while not sh02_check_trigger(sh02_trigger.freehos02) do 
  869. 			thread_yield() 
  870. 		end 
  871. 		 
  872. 		-- Wait until Jailcell 02-01 trigger is reached 
  873. 		while not sh02_check_trigger(sh02_trigger.jailcell02_01) do 
  874. 			thread_yield() 
  875. 		end 
  876. 		 
  877. 		-- Have all hos leash to next navpoint 
  878. 		sh02_hos_nav = 6 
  879. 		sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav]) 
  880. 		 
  881. 		-- Set Jailcell 02-02 trigger and wait for it 
  882. 		sh02_set_trigger(sh02_trigger.jailcell02_02) 
  883. 		while not sh02_check_trigger(sh02_trigger.jailcell02_02) do 
  884. 			thread_yield() 
  885. 		end 
  886. 		 
  887. 		-- Have all hos leash to next navpoint 
  888. 		sh02_hos_nav = 7 
  889. 		sh02_all_hos_leash_to(7.5, NAV_HOS[sh02_hos_nav]) 
  890. 		 
  891. 		-- Cleanup Checkpoint 03 enemies 
  892. 		sh02_cleanup_enemies_chkpnt03() 
  893. 		 
  894. 		-- Reset Checkpoint 04 doors 
  895. 		sh02_reset_doors_chkpnt04() 
  896. 		 
  897. 		-- Goto next checkpoint 
  898. 		current_checkpoint = SH02_CHECKPOINT_CLEAN_HOUSE 
  899. 		mission_set_checkpoint(SH02_CHECKPOINT_CLEAN_HOUSE, true) 
  900. 		 
  901. 	end 
  902. 	 
  903. 	-- Run the mission from Clean House checkpoint 
  904. 	if (current_checkpoint == SH02_CHECKPOINT_CLEAN_HOUSE) then 
  905. 	 
  906. 		-- Set Morningstar notoriety (3.0) 
  907. 		notoriety_set("Morningstar", 3.0) 
  908. 		notoriety_set_min("Morningstar", 3.0) 
  909. 		 
  910. 		-- Have Jailcell 03 guards leash to navpoints 
  911. 		sh02_group_leash_to(sh02_group.jailcell03_guards, NAV_LEASH04, 4.0) 
  912. 		 
  913. 		-- Player/Zimos: "Don't expect me to be down with doin' this again. It's a one time thing." 
  914. 		sh02_start_convo_thread(sh02_convo.combat03) 
  915. 		 
  916. 		-- Objective: Go To The Security Center 
  917. 		sh02_show_objective_loc(SH02_OBJ_BASEMENT) 
  918. 		 
  919. 		-- Set Jailcell 03-01 trigger and wait for it 
  920. 		sh02_set_trigger(sh02_trigger.jailcell03_01) 
  921. 		while not sh02_check_trigger(sh02_trigger.jailcell03_01) do 
  922. 			thread_yield() 
  923. 		end 
  924. 		 
  925. 		-- Have all hos leash to last navpoint 
  926. 		sh02_hos_nav = 8 
  927. 		sh02_all_hos_leash_to(10.0, NAV_HOS[sh02_hos_nav]) 
  928. 		 
  929. 		-- Set Jailcell 03-02 trigger and wait for it 
  930. 		sh02_set_trigger(sh02_trigger.jailcell03_02) 
  931. 		while not sh02_check_trigger(sh02_trigger.jailcell03_02) do 
  932. 			thread_yield() 
  933. 		end 
  934. 		 
  935. 		-- Zimos: "Override these doors and let's keep movin'." 
  936. 		sh02_play_persona_line(sh02_persona.override02) 
  937. 		 
  938. 		-- Objective: Disable Security 
  939. 		sh02_show_objective_use(SH02_OBJ_OVERRIDE) 
  940. 		 
  941. 		-- Set Backroom trigger. 
  942. 		sh02_set_trigger(sh02_trigger.backroom) 
  943. 		 
  944. 		-- Set Override 04 trigger and wait for it 
  945. 		sh02_set_trigger(sh02_trigger.override04) 
  946. 		while not sh02_check_trigger(sh02_trigger.override04) do 
  947. 			thread_yield() 
  948. 		end 
  949. 		 
  950. 		-- Stop Jailcell 03 continuous spawning 
  951. 		sh02_jailcell03_spawn_stop_thd() 
  952. 		 
  953. 		-- Create Jailcell 03 final 
  954. 		sh02_setup_jailcell03_final() 
  955. 		 
  956. 		-- Setup Jailcell 03 guards/wave as must kill 
  957. 		sh02_enemies_must_kill(sh02_group.jailcell03_guards) 
  958. 		sh02_enemies_must_kill(sh02_group.jailcell03_wave) 
  959. 		 
  960. 		-- Open Spawn 04 door 
  961. 		door_open(sh02_door.spawn04) 
  962. 		 
  963. 		-- Objective: Eliminate Morningstar 
  964. 		sh02_show_objective_kill(SH02_OBJ_CLEAN_HOUSE) 
  965. 		 
  966. 		-- Wait until Morningstar are dead 
  967. 		while (sh02_guys_killed > 0) do 
  968. 			thread_yield() 
  969. 		end 
  970. 		 
  971. 		-- Player/Zimos: "Time to go after their head of security, only�" 
  972. 		sh02_start_convo_thread(sh02_convo.kill_brute) 
  973. 		 
  974. 		-- Objective: Head To The Garage 
  975. 		sh02_show_objective_loc(SH02_OBJ_GARAGE) 
  976. 		 
  977. 		-- Open Garage door 
  978. 		door_open(sh02_door.garage, true) 
  979. 		 
  980. 		-- Set Garage Trigger and wait for it 
  981. 		sh02_set_trigger(sh02_trigger.garage) 
  982. 		while not sh02_check_trigger(sh02_trigger.garage) do 
  983. 			thread_yield() 
  984. 		end 
  985. 		 
  986. 		-- Fade out 
  987. 		fade_out(0.5) 
  988. 		fade_out_block() 
  989. 		 
  990. 		-- Cleanup Checkpoint 04 enemies 
  991. 		sh02_cleanup_enemies_chkpnt04() 
  992. 		 
  993. 		-- Reset Checkpoint 05 doors 
  994. 		sh02_reset_doors_chkpnt05() 
  995. 		 
  996. 		-- Stop chatter/convo threads 
  997. 		sh02_stop_chatter_thread() 
  998. 		sh02_stop_convo_thread(sh02_convo.kill_brute) 
  999. 		 
  1000. 		-- Goto next checkpoint 
  1001. 		current_checkpoint = SH02_CHECKPOINT_KILL_BRUTE 
  1002. 		mission_set_checkpoint(SH02_CHECKPOINT_KILL_BRUTE, true) 
  1003. 		 
  1004. 	end 
  1005. 	 
  1006. 	-- Run the mission from Kill Brute checkpoint 
  1007. 	if (current_checkpoint == SH02_CHECKPOINT_KILL_BRUTE) then 
  1008. 	 
  1009. 		-- Set Morningstar notoriety (4.0) 
  1010. 		notoriety_set("Morningstar", 4.0) 
  1011. 		notoriety_set_min("Morningstar", 4.0) 
  1012. 		 
  1013. 		-- Clear persona situation override (Brutella). 
  1014. 		persona_clear_global_situation_override() 
  1015. 		 
  1016. 		-- Spawn Garage vehicles 
  1017. 		group_create(sh02_group.garage_vehicles, true) 
  1018. 		 
  1019. 		-- Play Brute CTE 
  1020. 		cutscene_in() 
  1021. 		group_create(sh02_group.cte_npcs.name, true) 
  1022. 		cutscene_play(SH02_CUTSCENE_BRUTE_CTE, nil, nil, false) 
  1023. 		group_destroy(sh02_group.cte_npcs.name) 
  1024. 		cutscene_out() 
  1025. 		 
  1026. 		-- Setup Garage brute 
  1027. 		sh02_setup_garage_brute() 
  1028. 		 
  1029. 		-- Teleport player(s)/Zimos to Garage 
  1030. 		sh02_teleport_to_chkpnt(NAV_CHKPNT05) 
  1031. 		 
  1032. 		-- Reset Checkpoint 05 doors 
  1033. 		sh02_reset_doors_chkpnt05() 
  1034. 		 
  1035. 		-- Fade in 
  1036. 		fade_in(0.5) 
  1037. 		fade_in_block() 
  1038. 		 
  1039. 		-- Objective: Kill Brute 
  1040. 		sh02_show_objective_kill(SH02_OBJ_KILL_BRUTE) 
  1041. 		 
  1042. 		-- Wait until Brute is dead 
  1043. 		while not sh02_brute_killed do 
  1044. 			thread_yield() 
  1045. 		end 
  1046. 		 
  1047. 		-- Wait some time 
  1048. 		delay(4.0) 
  1049. 		 
  1050. 	end 
  1051. 	 
  1052. 	-- Teleport player(s) to final positions 
  1053. 	--fade_out(0.5) 
  1054. 	--fade_out_block() 
  1055. 	--teleport_coop(NAV_FINAL[1], NAV_FINAL[2], true) 
  1056. 	 
  1057. 	-- Complete mission 
  1058. 	mission_end_success("sh02") 
  1059. 	 
  1060. end 
  1061.  
  1062. -- Initialize the mission for the specified checkpoint 
  1063. -- checkpoint:	checkpoint to initialize the mission to 
  1064. function sh02_initialize(checkpoint) 
  1065.  
  1066. 	-- Make sure the screen is completly faded out 
  1067. 	mission_start_fade_out(0.0) 
  1068. 	 
  1069. 	-- Common initialization 
  1070. 	sh02_initialize_common() 
  1071. 	 
  1072. 	-- Checkpoint specific initialization 
  1073. 	sh02_initialize_checkpoint(checkpoint) 
  1074. 	 
  1075. 	-- Start fading in  
  1076. 	mission_start_fade_in() 
  1077. 	 
  1078. end 
  1079.  
  1080. -- Handle any common initialization 
  1081. function sh02_initialize_common() 
  1082.  
  1083. 	-- Set the mission author 
  1084. 	set_mission_author("Nicholas Zippmann") 
  1085. 	 
  1086. 	-- Reset doors 
  1087. 	sh02_reset_doors() 
  1088. 	 
  1089. 	-- Set in co-op status 
  1090. 	sh02_in_coop = coop_is_active() 
  1091. 	 
  1092. 	-- Clear any hanging text 
  1093. 	objective_text_clear(0) 
  1094. 	 
  1095. 	-- Remove player(s) clothes 
  1096. 	players_naked() 
  1097. 	 
  1098. 	-- Allow max followers 
  1099. 	party_allow_max_followers(true) 
  1100. 	 
  1101. 	-- Make sure not to auto-spawn cops/gangs 
  1102. 	notoriety_force_no_spawn("police", true) 
  1103. 	notoriety_force_no_spawn("morningstar", true) 
  1104. 	 
  1105. 	-- Setup players cancel warp locations 
  1106. 	mission_set_cancel_warp_location(NAV_CANCEL[1], NAV_CANCEL[2]) 
  1107. 	 
  1108. end 
  1109.  
  1110. -- Checkpoint specific initialization 
  1111. -- checkpoint: the checkpoint to be initialized 
  1112. function sh02_initialize_checkpoint(checkpoint) 
  1113.  
  1114. 	-- Initialize the mission from the beginning 
  1115. 	if (checkpoint == SH02_CHECKPOINT_START) then 
  1116. 	 
  1117. 		-- Remove player(s) weapons 
  1118. 		inv_weapon_disable_all_slots(true) 
  1119. 		 
  1120. 		-- Setup player(s) being drugged (strongest) 
  1121. 		sh02_setup_player_drugged(1.0)		 
  1122. 		 
  1123. 		-- Create homies (Zimos) 
  1124. 		group_create(sh02_group.homies.name, true)		 
  1125. 		 
  1126. 		-- Teleport player(s)/Zimos to Auction Room 
  1127. 		sh02_teleport_to_chkpnt(NAV_CHKPNT01) 
  1128. 		 
  1129. 		-- Reset Checkpoint 01 doors 
  1130. 		sh02_reset_doors_chkpnt01() 
  1131. 		 
  1132. 		-- Set persona situation override (Drugged). 
  1133. 		persona_set_global_situation_override(PS_OVERRIDE_SH02) 
  1134. 		 
  1135. 	end 
  1136. 	 
  1137. 	-- Initialize the mission from the Collection Room checkpoint 
  1138. 	if (checkpoint == SH02_CHECKPOINT_COLLECTION) then 
  1139. 	 
  1140. 		-- Setup player(s) being drugged (medium) 
  1141. 		sh02_setup_player_drugged(0.5) 
  1142. 		 
  1143. 		-- Setup homies (Zimos) 
  1144. 		sh02_setup_homies() 
  1145. 		 
  1146. 		-- Teleport player(s)/Zimos to Collection Room 
  1147. 		sh02_teleport_to_chkpnt(NAV_CHKPNT02) 
  1148. 		 
  1149. 		-- Reset Checkpoint 02 doors 
  1150. 		sh02_reset_doors_chkpnt02() 
  1151. 		 
  1152. 		-- Set Morningstar notoriety (1.0) 
  1153. 		notoriety_set("Morningstar", 1.0) 
  1154. 		notoriety_set_min("Morningstar", 1.0) 
  1155. 		 
  1156. 		-- Start alarms 
  1157. 		sh02_start_alarms() 
  1158. 		 
  1159. 		-- Set persona situation override (Drugged). 
  1160. 		persona_set_global_situation_override(PS_OVERRIDE_SH02) 
  1161. 		 
  1162. 	end 
  1163. 	 
  1164. 	-- Initialize the mission from the Basement checkpoint 
  1165. 	if (checkpoint == SH02_CHECKPOINT_BASEMENT) then 
  1166. 	 
  1167. 		-- Cleanup player(s) being drugged 
  1168. 		sh02_cleanup_player_drugged() 
  1169. 		 
  1170. 		-- Setup homies (Zimos) 
  1171. 		sh02_setup_homies() 
  1172. 		 
  1173. 		-- Create Jailcell 01 guards/hos 
  1174. 		sh02_setup_jailcell01_npcs() 
  1175. 		 
  1176. 		-- Teleport player(s)/Zimos to Jail Cell Area 
  1177. 		sh02_teleport_to_chkpnt(NAV_CHKPNT03) 
  1178. 		 
  1179. 		-- Reset Checkpoint 03 doors 
  1180. 		sh02_reset_doors_chkpnt03() 
  1181. 		 
  1182. 		-- Set Morningstar notoriety (2.0) 
  1183. 		notoriety_set("Morningstar", 2.0) 
  1184. 		notoriety_set_min("Morningstar", 2.0) 
  1185. 		 
  1186. 		-- Start alarms 
  1187. 		sh02_start_alarms() 
  1188. 		 
  1189. 		-- Set persona situation override (Brutella). 
  1190. 		persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE) 
  1191. 		 
  1192. 	end 
  1193. 	 
  1194. 	-- Initialize the mission from the Clean House checkpoint 
  1195. 	if (checkpoint == SH02_CHECKPOINT_CLEAN_HOUSE) then 
  1196. 	 
  1197. 		-- Setup homies (Zimos) 
  1198. 		sh02_setup_homies() 
  1199. 		 
  1200. 		-- Create Jailcell 03 guards/hos 
  1201. 		sh02_setup_jailcell03_npcs() 
  1202. 		 
  1203. 		-- Teleport player(s)/Zimos to Garage 
  1204. 		sh02_teleport_to_chkpnt(NAV_CHKPNT04) 
  1205. 		 
  1206. 		-- Reset Checkpoint 04 doors 
  1207. 		sh02_reset_doors_chkpnt04() 
  1208. 		 
  1209. 		-- Set Morningstar notoriety (3.0) 
  1210. 		notoriety_set("Morningstar", 3.0) 
  1211. 		notoriety_set_min("Morningstar", 3.0) 
  1212. 		 
  1213. 		-- Set persona situation override (Brutella). 
  1214. 		persona_set_global_situation_override(PS_OVERRIDE_SH02_BRUTE) 
  1215. 		 
  1216. 	end 
  1217. 	 
  1218. 	-- Initialize the mission from the Kill Brute checkpoint 
  1219. 	if (checkpoint == SH02_CHECKPOINT_KILL_BRUTE) then 
  1220. 	 
  1221. 		-- Fade out 
  1222. 		fade_out(0.5) 
  1223. 		fade_out_block() 
  1224. 		 
  1225. 		-- Setup homies (Zimos) 
  1226. 		sh02_setup_homies() 
  1227. 		 
  1228. 		-- Teleport player(s)/Zimos to Garage 
  1229. 		sh02_teleport_to_chkpnt(NAV_CHKPNT05) 
  1230. 		 
  1231. 		-- Reset Checkpoint 05 doors 
  1232. 		sh02_reset_doors_chkpnt05() 
  1233. 		 
  1234. 		-- Set Morningstar notoriety (4.0) 
  1235. 		notoriety_set("Morningstar", 4.0) 
  1236. 		notoriety_set_min("Morningstar", 4.0) 
  1237. 		 
  1238. 	end 
  1239.  
  1240. end 
  1241.  
  1242. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++)  
  1243. -- This is the primary function responsible for cleaning up the entire mission 
  1244. function sh02_cleanup() 
  1245.  
  1246. 	-- Cleanup NPCs 
  1247. 	sh02_cleanup_homies() 
  1248. 	sh02_cleanup_enemies() 
  1249. 	sh02_cleanup_hos() 
  1250. 	sh02_cleanup_npcs() 
  1251. 	 
  1252. 	-- Cleanup spawn regions/groups 
  1253. 	sh02_cleanup_spawn_regions() 
  1254. 	sh02_cleanup_spawn_groups() 
  1255. 	 
  1256. 	-- Clear triggers 
  1257. 	sh02_clear_triggers() 
  1258. 	 
  1259. 	-- Remove y-prompts, if needed 
  1260. 	if (sh02_prompt01 ~= -1) then 
  1261.       effect_stop(sh02_prompt01) 
  1262.       sh02_prompt01 = -1 
  1263. 	end 
  1264. 	if (sh02_prompt02 ~= -1) then 
  1265.       effect_stop(sh02_prompt02) 
  1266.       sh02_prompt02 = -1 
  1267. 	end	 
  1268. 	 
  1269. 	-- Reset doors 
  1270. 	sh02_reset_doors() 
  1271. 	 
  1272. 	-- Cleanup conversations 
  1273. 	cleanup_conversations(sh02_convo) 
  1274. 	 
  1275. 	-- Cleanup threads 
  1276. 	cleanup_threads(sh02_thread) 
  1277. 	 
  1278. 	-- Clear ragdoll last resort position 
  1279. 	character_ragdoll_clear_last_resort_position() 
  1280. 	 
  1281. 	-- Give back player(s) weapons and clothes 
  1282. 	inv_weapon_disable_all_slots(false) 
  1283. 	customization_item_revert() 
  1284. 	 
  1285. 	-- Clear player(s) being drugged 
  1286. 	sh02_cleanup_player_drugged() 
  1287. 	 
  1288. 	-- Disallow max followers 
  1289. 	party_allow_max_followers(false) 
  1290. 	 
  1291. 	-- Allow notoriety spawning again 
  1292. 	notoriety_force_no_spawn("police", false)	 
  1293. 	notoriety_force_no_spawn("morningstar", false) 
  1294. 	 
  1295. 	-- Stop alarms 
  1296. 	sh02_stop_alarms() 
  1297. 	 
  1298. 	-- Clear persona situation override (Drugged/Brutella). 
  1299. 	persona_clear_global_situation_override() 
  1300. 	 
  1301. end 
  1302.  
  1303. -- CALLED FROM CODE (+++MUST RETURN IMMEDIATLY+++) 
  1304. -- Called when the mission has ended with success 
  1305. function sh02_success()		 
  1306. 	local skip_teleport = true 
  1307. 	sh02_coop_skip(skip_teleport) 
  1308.  
  1309. 	teleport( LOCAL_PLAYER, NAV_FINAL[1] ) 
  1310. 	if coop_is_active() == true then 
  1311. 		teleport( REMOTE_PLAYER, NAV_FINAL[2] ) 
  1312. 	end 
  1313. end 
  1314.  
  1315.  
  1316.  
  1317.  
  1318. -- *************************************************** 
  1319. -- SH02 Setup Functions 
  1320. -- *************************************************** 
  1321.  
  1322. -- Setup homies 
  1323. function sh02_setup_homies() 
  1324. 	if not group_is_loaded(sh02_group.homies) then 
  1325. 		group_create(sh02_group.homies.name, true) 
  1326. 	end 
  1327. 	sh02_zimos_join_player() 
  1328. end 
  1329.  
  1330. -- Setup Checkpoint 01 NPCs 
  1331. function sh02_setup_collection_guards() 
  1332. 	if not group_is_loaded(sh02_group.collection_guards.name) then 
  1333. 		group_create(sh02_group.collection_guards.name, true) 
  1334. 	end 
  1335. 	sh02_enemies_join_fight(sh02_group.collection_guards) 
  1336. end 
  1337.  
  1338. -- Setup Checkpoint 02 NPCs 
  1339. function sh02_setup_collection_hos() 
  1340. 	group_create(sh02_group.collection_hos.name, true) 
  1341. 	sh02_hos_join_player(sh02_group.collection_hos, true) 
  1342. 	sh02_hos_leash_to(sh02_group.collection_hos, 6.0, NAV_HOS[sh02_hos_nav])	 
  1343. end 
  1344. function sh02_setup_collection_wave() 
  1345. 	group_create(sh02_group.collection_wave.name, true) 
  1346. 	sh02_enemies_join_fight(sh02_group.collection_wave) 
  1347. 	sh02_group_move_to(sh02_group.collection_wave, NAV_COLLECTION, 2.0) 
  1348. end 
  1349. function sh02_setup_lounge_enemies() 
  1350. 	group_create(sh02_group.lounge_guards.name, true) 
  1351. 	sh02_enemies_join_fight(sh02_group.lounge_guards) 
  1352. 	group_create(sh02_group.lounge_snipers.name, true) 
  1353. 	sh02_enemies_join_fight(sh02_group.lounge_snipers) 
  1354. end 
  1355. function sh02_setup_lounge_flee01_npcs() 
  1356. 	if not group_is_loaded(sh02_group.lounge_flee01.name) then 
  1357. 		group_create(sh02_group.lounge_flee01.name, true) 
  1358. 	end 
  1359. 	sh02_group_flee_to(sh02_group.lounge_flee01, "nav_flee", 1.0) 
  1360. 	door_open(sh02_door.flee01, true) 
  1361. end 
  1362. function sh02_setup_lounge_flee02_npcs() 
  1363. 	if not group_is_loaded(sh02_group.lounge_flee02.name) then 
  1364. 		group_create(sh02_group.lounge_flee02.name, true) 
  1365. 	end 
  1366. 	sh02_group_flee_to(sh02_group.lounge_flee02, "nav_flee", 1.0) 
  1367. 	door_open(sh02_door.flee02, true) 
  1368. end 
  1369. function sh02_setup_lounge_flee03_npcs() 
  1370. 	if not group_is_loaded(sh02_group.lounge_flee03.name) then 
  1371. 		group_create(sh02_group.lounge_flee03.name, true) 
  1372. 	end 
  1373. 	sh02_group_flee_to(sh02_group.lounge_flee03, "nav_flee", 1.0) 
  1374. 	door_open(sh02_door.flee03) 
  1375. end 
  1376. function sh02_setup_lounge_flee04_npcs() 
  1377. 	if not group_is_loaded(sh02_group.lounge_flee04.name) then 
  1378. 		group_create(sh02_group.lounge_flee04.name, true) 
  1379. 	end 
  1380. 	sh02_group_flee_to(sh02_group.lounge_flee04, "nav_flee", 1.0) 
  1381. 	door_open(sh02_door.flee04) 
  1382. end 
  1383.  
  1384. -- Setup Checkpoint 03 NPCs 
  1385. function sh02_setup_jailcell01_npcs() 
  1386. 	if not group_is_loaded(sh02_group.jailcell01_guards.name)then 
  1387. 		group_create(sh02_group.jailcell01_guards.name, true) 
  1388. 	end 
  1389. 	sh02_enemies_join_fight(sh02_group.jailcell01_guards) 
  1390. 	if not group_is_loaded(sh02_group.jailcell01_hos.name) then 
  1391. 		group_create(sh02_group.jailcell01_hos.name, true) 
  1392. 	end 
  1393. 	sh02_hos_incarcerate(sh02_group.jailcell01_hos) 
  1394. end 
  1395. function sh02_setup_jailcell01_wave() 
  1396. 	if not group_is_loaded(sh02_group.jailcell01_wave.name) then 
  1397. 		group_create(sh02_group.jailcell01_wave.name, true) 
  1398. 	end 
  1399. 	sh02_enemies_join_fight(sh02_group.jailcell01_wave) 
  1400. 	sh02_group_move_to(sh02_group.jailcell01_wave, NAV_JAILCELL01, 2.0) 
  1401. end 
  1402. function sh02_setup_jailcell02_npcs() 
  1403. 	if not group_is_loaded(sh02_group.jailcell02_guards.name) then 
  1404. 		group_create(sh02_group.jailcell02_guards.name, true) 
  1405. 	end 
  1406. 	sh02_enemies_join_fight(sh02_group.jailcell02_guards) 
  1407. 	if not group_is_loaded(sh02_group.jailcell02_brutella.name) then 
  1408. 		group_create(sh02_group.jailcell02_brutella.name, true) 
  1409. 	end 
  1410. 	npc_combat_enable(sh02_group.jailcell02_brutella.members[1], false) 
  1411. 	wander_start(sh02_group.jailcell02_brutella.members[1], nil, 8) 
  1412. 	if not group_is_loaded(sh02_group.jailcell02_hos.name)then 
  1413. 		group_create(sh02_group.jailcell02_hos.name, true) 
  1414. 	end 
  1415. 	sh02_hos_incarcerate(sh02_group.jailcell02_hos) 
  1416. end 
  1417. function sh02_setup_jailcell02_wave() 
  1418. 	if not group_is_loaded(sh02_group.jailcell02_wave.name) then 
  1419. 		group_create(sh02_group.jailcell02_wave.name, true) 
  1420. 	end 
  1421. 	sh02_enemies_join_fight(sh02_group.jailcell02_wave) 
  1422. 	sh02_group_move_to(sh02_group.jailcell02_wave, NAV_JAILCELL02, 2.0) 
  1423. end 
  1424.  
  1425. -- Setup Checkpoint 04 NPCs 
  1426. function sh02_setup_jailcell03_npcs() 
  1427. 	if not group_is_loaded(sh02_group.jailcell03_guards.name)then 
  1428. 		group_create(sh02_group.jailcell03_guards.name, true) 
  1429. 	end 
  1430. 	sh02_enemies_join_fight(sh02_group.jailcell03_guards) 
  1431. 	if not group_is_loaded(sh02_group.jailcell03_hos.name) then 
  1432. 		group_create(sh02_group.jailcell03_hos.name, true) 
  1433. 	end 
  1434. 	sh02_hos_incarcerate(sh02_group.jailcell03_hos) 
  1435. end 
  1436. function sh02_setup_jailcell03_wave() 
  1437. 	if not group_is_loaded(sh02_group.jailcell03_wave.name)then 
  1438. 		group_create(sh02_group.jailcell03_wave.name, true) 
  1439. 	end 
  1440. 	sh02_enemies_join_fight(sh02_group.jailcell03_wave) 
  1441. 	sh02_group_move_to(sh02_group.jailcell03_wave, NAV_JAILCELL03, 2.0) 
  1442. end 
  1443. function sh02_setup_jailcell03_final() 
  1444. 	group_create(sh02_group.jailcell03_final.name, true) 
  1445. 	sh02_enemies_join_fight(sh02_group.jailcell03_final) 
  1446. 	sh02_enemies_must_kill(sh02_group.jailcell03_final) 
  1447. 	sh02_group_move_to(sh02_group.jailcell03_final, NAV_JAILCELL03, 2.0) 
  1448. end 
  1449.  
  1450. -- Setup Checkpoint 05 NPCs 
  1451. function sh02_setup_garage_vehicles() 
  1452. 	group_create(sh02_group.garage_vehicles, true) 
  1453. end 
  1454. function sh02_setup_garage_brute() 
  1455. 	group_create(sh02_group.garage_brute.name, true) 
  1456. 	sh02_brute_must_kill(sh02_group.garage_brute.members[1]) 
  1457. end 
  1458.  
  1459.  
  1460.  
  1461.  
  1462. -- *************************************************** 
  1463. -- SH02 Cleanup Functions 
  1464. -- *************************************************** 
  1465.  
  1466. -- Cleanup homies 
  1467. function sh02_cleanup_homies() 
  1468. 	sh02_zimos_leave_player() 
  1469. 	if group_is_loaded(sh02_group.homies) then 
  1470. 		group_destroy(sh02_group.homies) 
  1471. 	end 
  1472. end 
  1473.  
  1474. -- Cleanup enemies 
  1475. function sh02_cleanup_enemies_chkpnt01() 
  1476. 	if group_is_loaded(sh02_group.collection_guards) then 
  1477. 		sh02_enemies_leave_fight(sh02_group.collection_guards) 
  1478. 		release_to_world(sh02_group.collection_guards.name) 
  1479. 	end 
  1480. end 
  1481. function sh02_cleanup_enemies_chkpnt02() 
  1482. 	if group_is_loaded(sh02_group.collection_wave) then 
  1483. 		sh02_enemies_leave_fight(sh02_group.collection_wave) 
  1484. 		release_to_world(sh02_group.collection_wave.name) 
  1485. 	end 
  1486. 	if group_is_loaded(sh02_group.lounge_guards) then 
  1487. 		sh02_enemies_leave_fight(sh02_group.lounge_guards) 
  1488. 		release_to_world(sh02_group.lounge_guards.name) 
  1489. 	end 
  1490. 	if group_is_loaded(sh02_group.lounge_snipers) then 
  1491. 		sh02_enemies_leave_fight(sh02_group.lounge_snipers) 
  1492. 		release_to_world(sh02_group.lounge_snipers.name) 
  1493. 	end 
  1494. end 
  1495. function sh02_cleanup_enemies_chkpnt03() 
  1496. 	if group_is_loaded(sh02_group.jailcell01_guards) then 
  1497. 		sh02_enemies_leave_fight(sh02_group.jailcell01_guards) 
  1498. 		release_to_world(sh02_group.jailcell01_guards.name) 
  1499. 	end 
  1500. 	if group_is_loaded(sh02_group.jailcell01_wave) then 
  1501. 		sh02_enemies_leave_fight(sh02_group.jailcell01_wave) 
  1502. 		release_to_world(sh02_group.jailcell01_wave.name) 
  1503. 	end 
  1504. 	if group_is_loaded(sh02_group.jailcell02_guards) then 
  1505. 		sh02_enemies_leave_fight(sh02_group.jailcell02_guards) 
  1506. 		release_to_world(sh02_group.jailcell02_guards.name) 
  1507. 	end 
  1508. 	if group_is_loaded(sh02_group.jailcell02_wave) then 
  1509. 		sh02_enemies_leave_fight(sh02_group.jailcell02_wave) 
  1510. 		release_to_world(sh02_group.jailcell02_wave.name) 
  1511. 	end 
  1512. end 
  1513. function sh02_cleanup_enemies_chkpnt04() 
  1514. 	if group_is_loaded(sh02_group.jailcell03_guards) then 
  1515. 		sh02_enemies_leave_fight(sh02_group.jailcell03_guards) 
  1516. 		sh02_enemies_kill_done(sh02_group.jailcell03_guards) 
  1517. 		group_destroy(sh02_group.jailcell03_guards) 
  1518. 	end 
  1519. 	if group_is_loaded(sh02_group.jailcell03_wave) then 
  1520. 		sh02_enemies_leave_fight(sh02_group.jailcell03_wave) 
  1521. 		sh02_enemies_kill_done(sh02_group.jailcell03_wave) 
  1522. 		group_destroy(sh02_group.jailcell03_wave) 
  1523. 	end 
  1524. 	if group_is_loaded(sh02_group.jailcell03_final) then 
  1525. 		sh02_enemies_leave_fight(sh02_group.jailcell03_final) 
  1526. 		sh02_enemies_kill_done(sh02_group.jailcell03_final) 
  1527. 		group_destroy(sh02_group.jailcell03_final) 
  1528. 	end 
  1529. end 
  1530. function sh02_cleanup_enemies_chkpnt05() 
  1531. 	if group_is_loaded(sh02_group.garage_vehicles) then 
  1532. 		group_destroy(sh02_group.garage_vehicles) 
  1533. 	end 
  1534. 	if group_is_loaded(sh02_group.garage_brute) then 
  1535. 		sh02_brute_kill_done(sh02_group.garage_brute.members[1]) 
  1536. 		group_destroy(sh02_group.garage_brute) 
  1537. 	end 
  1538. end 
  1539. function sh02_cleanup_enemies() 
  1540. 	sh02_cleanup_enemies_chkpnt01() 
  1541. 	sh02_cleanup_enemies_chkpnt02() 
  1542. 	sh02_cleanup_enemies_chkpnt03() 
  1543. 	sh02_cleanup_enemies_chkpnt04() 
  1544. 	sh02_cleanup_enemies_chkpnt05() 
  1545. end 
  1546.  
  1547. -- Cleanup hos 
  1548. function sh02_cleanup_hos() 
  1549. 	if group_is_loaded(sh02_group.collection_hos) then 
  1550. 		sh02_hos_leave_player(sh02_group.collection_hos) 
  1551. 		group_destroy(sh02_group.collection_hos) 
  1552. 	end 
  1553. 	if group_is_loaded(sh02_group.jailcell01_hos) then 
  1554. 		sh02_hos_leave_player(sh02_group.jailcell01_hos) 
  1555. 		group_destroy(sh02_group.jailcell01_hos) 
  1556. 	end 
  1557. 	if group_is_loaded(sh02_group.jailcell02_brutella) then 
  1558. 		sh02_hos_leave_player(sh02_group.jailcell02_brutella) 
  1559. 		group_destroy(sh02_group.jailcell02_brutella) 
  1560. 	end 
  1561. 	if group_is_loaded(sh02_group.jailcell02_hos) then 
  1562. 		sh02_hos_leave_player(sh02_group.jailcell02_hos) 
  1563. 		group_destroy(sh02_group.jailcell02_hos) 
  1564. 	end 
  1565. 	if group_is_loaded(sh02_group.jailcell03_hos) then 
  1566. 		sh02_hos_leave_player(sh02_group.jailcell03_hos) 
  1567. 		group_destroy(sh02_group.jailcell03_hos) 
  1568. 	end 
  1569. end 
  1570.  
  1571. -- Cleanup npcs 
  1572. function sh02_cleanup_npcs() 
  1573. 	if group_is_loaded(sh02_group.lounge_flee01) then 
  1574. 		release_to_world(sh02_group.lounge_flee01.name) 
  1575. 	end 
  1576. 	if group_is_loaded(sh02_group.lounge_flee02) then 
  1577. 		release_to_world(sh02_group.lounge_flee02.name) 
  1578. 	end 
  1579. 	if group_is_loaded(sh02_group.lounge_flee03) then 
  1580. 		release_to_world(sh02_group.lounge_flee03.name) 
  1581. 	end 
  1582. 	if group_is_loaded(sh02_group.lounge_flee04) then 
  1583. 		release_to_world(sh02_group.lounge_flee04.name) 
  1584. 	end 
  1585. end 
  1586.  
  1587. -- Cleanup spawn regions/groups 
  1588. function sh02_cleanup_spawn_regions() 
  1589. 	spawn_region_enable(sh02_spawn.lounge, false) 
  1590. 	spawn_region_enable(sh02_spawn.jailcell01, false) 
  1591. 	spawn_region_enable(sh02_spawn.jailcell02, false) 
  1592. 	spawn_region_enable(sh02_spawn.jailcell03, false) 
  1593. 	spawn_region_enable(sh02_spawn.stairwell, false) 
  1594. end 
  1595. function sh02_cleanup_spawn_groups() 
  1596. 	continuous_spawn_stop(sh02_group.cont_spawn01.name) 
  1597. 	continuous_spawn_stop(sh02_group.cont_spawn02.name) 
  1598. 	continuous_spawn_stop(sh02_group.cont_spawn03.name) 
  1599. 	continuous_spawn_stop(sh02_group.cont_spawn04.name) 
  1600. 	continuous_spawn_stop(sh02_group.cont_spawn05.name) 
  1601. 	continuous_spawn_stop(sh02_group.cont_spawn06.name) 
  1602. end 
  1603.  
  1604. -- Reset doors 
  1605. function sh02_reset_doors_locked() 
  1606. 	mesh_mover_reset("door_locked<001>") 
  1607. 	door_close("door_locked<001>", false) 
  1608. 	door_lock("door_locked<001>", true) 
  1609. 	mesh_mover_reset("door_locked<002>") 
  1610. 	door_close("door_locked<002>", false) 
  1611. 	door_lock("door_locked<002>", true) 
  1612. 	mesh_mover_reset("door_locked<003>") 
  1613. 	door_close("door_locked<003>", false) 
  1614. 	door_lock("door_locked<003>", true) 
  1615. end 
  1616. function sh02_reset_doors_chkpnt01() 
  1617. 	mesh_mover_reset(sh02_door.auction) 
  1618. 	door_close(sh02_door.auction, false) 
  1619. 	door_lock(sh02_door.auction, true) 
  1620. end 
  1621. function sh02_reset_doors_chkpnt02() 
  1622. 	mesh_mover_reset(sh02_door.coll_hos) 
  1623. 	door_close(sh02_door.coll_hos, false) 
  1624. 	door_lock(sh02_door.coll_hos, true) 
  1625. 	mesh_mover_reset(sh02_door.coll_out) 
  1626. 	door_close(sh02_door.coll_out, false) 
  1627. 	door_lock(sh02_door.coll_out, true) 
  1628. 	mesh_mover_reset(sh02_door.flee01) 
  1629. 	door_close(sh02_door.flee01, false) 
  1630. 	door_lock(sh02_door.flee01, true) 
  1631. 	mesh_mover_reset(sh02_door.flee02) 
  1632. 	door_close(sh02_door.flee02, false) 
  1633. 	door_lock(sh02_door.flee02, true) 
  1634. 	mesh_mover_reset(sh02_door.flee03) 
  1635. 	door_close(sh02_door.flee03, false) 
  1636. 	door_lock(sh02_door.flee03, true) 
  1637. 	mesh_mover_reset(sh02_door.flee04) 
  1638. 	door_close(sh02_door.flee04, false) 
  1639. 	door_lock(sh02_door.flee04, true) 
  1640. 	mesh_mover_reset(sh02_door.stairwell) 
  1641. 	door_close(sh02_door.stairwell, false) 
  1642. 	door_lock(sh02_door.stairwell, true) 
  1643. end 
  1644. function sh02_reset_doors_chkpnt03() 
  1645. 	mesh_mover_reset(sh02_door.cells01) 
  1646. 	door_close(sh02_door.cells01, false) 
  1647. 	door_lock(sh02_door.cells01, true) 
  1648. 	mesh_mover_reset(sh02_door.spawn01) 
  1649. 	door_close(sh02_door.spawn01, false) 
  1650. 	door_lock(sh02_door.spawn01, true) 
  1651. 	mesh_mover_reset(sh02_door.cells02) 
  1652. 	door_close(sh02_door.cells02, false) 
  1653. 	door_lock(sh02_door.cells02, true) 
  1654. 	mesh_mover_reset(sh02_door.spawn02) 
  1655. 	door_close(sh02_door.spawn02, false) 
  1656. 	door_lock(sh02_door.spawn02, true) 
  1657. end 
  1658. function sh02_reset_doors_chkpnt04() 
  1659. 	mesh_mover_reset(sh02_door.cells03) 
  1660. 	door_close(sh02_door.cells03, false) 
  1661. 	door_lock(sh02_door.cells03, true) 
  1662. 	mesh_mover_reset(sh02_door.spawn03) 
  1663. 	door_close(sh02_door.spawn03, false) 
  1664. 	door_lock(sh02_door.spawn03, true) 
  1665. 	mesh_mover_reset(sh02_door.spawn04) 
  1666. 	door_close(sh02_door.spawn04, false) 
  1667. 	door_lock(sh02_door.spawn04, true) 
  1668. end 
  1669. function sh02_reset_doors_chkpnt05() 
  1670. 	mesh_mover_reset(sh02_door.garage) 
  1671. 	door_close(sh02_door.garage, false) 
  1672. 	door_lock(sh02_door.garage, true) 
  1673. end 
  1674. function sh02_reset_doors() 
  1675. 	sh02_reset_doors_locked() 
  1676. 	sh02_reset_doors_chkpnt01() 
  1677. 	sh02_reset_doors_chkpnt02() 
  1678. 	sh02_reset_doors_chkpnt03() 
  1679. 	sh02_reset_doors_chkpnt04() 
  1680. 	sh02_reset_doors_chkpnt05() 
  1681. end 
  1682.  
  1683.  
  1684.  
  1685.  
  1686. -- *************************************************** 
  1687. -- SH02 Player Functions 
  1688. -- *************************************************** 
  1689.  
  1690. -- Teleport player(s)/Zimos to checkpoint 
  1691. function sh02_teleport_to_chkpnt(navpoints) 
  1692. 	teleport_coop(navpoints[1], navpoints[2], true) 
  1693. 	teleport(sh02_zimos, navpoints[3]) 
  1694. 	character_ragdoll_set_last_resort_position(navpoints[1]) 
  1695. end 
  1696.  
  1697. -- Setup player(s) being drugged 
  1698. function sh02_setup_player_drugged(scalar) 
  1699. 	drug_effect_set_override_values(scalar, scalar)	 
  1700. 	if (scalar >= 1.0) then 
  1701. 		refraction_situation_set("drug strong") 
  1702. 		audio_object_post_event("sh02_drug_pitch", nil, nil, LOCAL_PLAYER) 
  1703. 	elseif (scalar >= 0.75) then 
  1704. 		refraction_situation_set("drug weak") 
  1705. 	elseif (scalar >= 0.5) then 
  1706. 		refraction_situation_set("drug weakest") 
  1707. 		audio_object_post_event("sh02_drug_pitch_50", nil, nil, LOCAL_PLAYER) 
  1708. 	elseif (scalar >= 0.25) then 
  1709. 		refraction_situation_clear() 
  1710. 	end 
  1711. end 
  1712.  
  1713. -- Cleanup player(s) being drugged 
  1714. function sh02_cleanup_player_drugged() 
  1715. 	refraction_situation_clear() 
  1716. 	audio_object_post_event("sh02_drug_pitch_normal", nil, nil, LOCAL_PLAYER) 
  1717. end 
  1718.  
  1719. -- Have player hack a computer console 
  1720. function sh02_player_hacking(player, navpoint, vomit) 
  1721. 	--player_movement_disable(player) 
  1722. 	if vomit then 
  1723. 		action_play(player, "sh03 vomit hack", "sh03 vomit hack", false, 1.0, true, true, navpoint) --true, false, true, "", navpoint) 
  1724. 		while action_play_is_finished( player, 1.0 ) == false do 
  1725. 			thread_yield() 
  1726. 		end 
  1727. 	else 
  1728. 		action_play(player, "m24 computer hack", "m24 computer hack",  false, 1.0, true, true, navpoint) 
  1729. 		while action_play_is_finished( player, 1.0 ) == false do 
  1730. 			thread_yield() 
  1731. 		end 
  1732. 	end 
  1733. 	--player_movement_enable(player) 
  1734. end 
  1735.  
  1736. -- Have player play vomit hack noises 
  1737. function sh02_player_vomit_hack_noises() 
  1738. 	delay(0.5) 
  1739. 	audio_object_post_event("anim_plym_cmptr_hack", nil, nil, LOCAL_PLAYER) 
  1740. 	delay(3.0) 
  1741. 	audio_play_persona_line(LOCAL_PLAYER, "voc_vomit") 
  1742. end 
  1743.  
  1744.  
  1745.  
  1746.  
  1747. -- *************************************************** 
  1748. -- SH02 NPC Functions 
  1749. -- *************************************************** 
  1750.  
  1751. -- Setup zimos to join player 
  1752. function sh02_zimos_join_player() 
  1753. 	party_add(sh02_zimos, LOCAL_PLAYER) 
  1754. 	follower_set_can_abandon(sh02_zimos, true) 
  1755. 	on_death("sh02_zimos_died_cb", sh02_zimos) 
  1756. 	on_dismiss("sh02_zimos_abandoned_cb", sh02_zimos) 
  1757. end 
  1758.  
  1759. -- Setup zimos to leave player 
  1760. function sh02_zimos_leave_player() 
  1761. 	on_death("", sh02_zimos) 
  1762. 	on_dismiss("", sh02_zimos) 
  1763. end 
  1764.  
  1765. -- Setup ho to be incarcerated 
  1766. function sh02_ho_incarcerate(name) 
  1767. 	npc_use_closest_action_node_of_type(name, "ColdHo", 1.0) 
  1768. end 
  1769.  
  1770. -- Setup ho group to be incarcerated 
  1771. function sh02_hos_incarcerate(group) 
  1772. 	for i, member in pairs(group.members) do 
  1773. 		sh02_ho_incarcerate(member) 
  1774. 	end 
  1775. end 
  1776.  
  1777. -- Setup ho to join player 
  1778. function sh02_ho_join_player(name, armed) 
  1779. 	set_team(name, "playas") 
  1780. 	set_cant_flee_flag(name, true) 
  1781. 	set_cant_cower_flag(name, true) 
  1782. 	set_always_cower_flag(name, false) 
  1783. 	ai_set_personality(name, "gang offensive") 
  1784. 	character_use_synced_finishers(name, true) 
  1785. 	if armed then 
  1786. 		inv_item_add("dildo_bat", 1, name, false) 
  1787. 	end 
  1788. 	on_attack_performed("sh02_ho_attack_cb", name) 
  1789. 	on_take_damage("sh02_ho_attacked_cb", name) 
  1790. end 
  1791.  
  1792. -- Setup ho group to join player 
  1793. function sh02_hos_join_player(group, armed) 
  1794. 	for i, member in pairs(group.members) do 
  1795. 		sh02_ho_join_player(member, armed) 
  1796. 	end 
  1797. end 
  1798.  
  1799. -- Setup ho to leash to player/navpoint 
  1800. function sh02_ho_leash_to(name, dist, navpoint) 
  1801. 	if (navpoint ~= nil) then 
  1802. 		ai_attack_region(name, navpoint, dist) 
  1803. 	else 
  1804. 		npc_leash_to_object(name, LOCAL_PLAYER, dist)		 
  1805. 	end 
  1806. end 
  1807.  
  1808. -- Setup ho group to leash to player/navpoint 
  1809. function sh02_hos_leash_to(group, dist, navpoint) 
  1810. 	for i, member in pairs(group.members) do 
  1811. 		sh02_ho_leash_to(member, dist, navpoint) 
  1812. 	end 
  1813. end 
  1814.  
  1815. -- Setup all ho groups to leash to player/navpoint 
  1816. function sh02_all_hos_leash_to(dist, navpoint) 
  1817. 	if sh02_check_trigger(sh02_trigger.override01) then 
  1818. 		if group_is_loaded(sh02_group.collection_hos) then 
  1819. 			sh02_hos_leash_to(sh02_group.collection_hos, dist, navpoint) 
  1820. 		end 
  1821. 	end 
  1822. 	if sh02_check_trigger(sh02_trigger.override02) then 
  1823. 		if group_is_loaded(sh02_group.jailcell01_hos) then 
  1824. 			sh02_hos_leash_to(sh02_group.jailcell01_hos, dist, navpoint) 
  1825. 		end 
  1826. 	end 
  1827. 	if sh02_check_trigger(sh02_trigger.override03) then 
  1828. 		if group_is_loaded(sh02_group.jailcell02_hos) then 
  1829. 			sh02_hos_leash_to(sh02_group.jailcell02_hos, dist, navpoint) 
  1830. 		end 
  1831. 	end 
  1832. 	if sh02_check_trigger(sh02_trigger.override04) then 
  1833. 		if group_is_loaded(sh02_group.jailcell03_hos) then 
  1834. 			sh02_hos_leash_to(sh02_group.jailcell03_hos, dist, navpoint) 
  1835. 		end 
  1836. 	end 
  1837. end 
  1838.  
  1839. -- Setup ho to leave player 
  1840. function sh02_ho_leave_player(name) 
  1841. 	set_cant_cower_flag(name, false) 
  1842. 	set_cant_flee_flag(name, false) 
  1843. 	npc_leash_remove(name) 
  1844. 	on_attack_performed("", name) 
  1845. 	on_take_damage("", name) 
  1846. end 
  1847.  
  1848. -- Setup ho group to leave player 
  1849. function sh02_hos_leave_player(group) 
  1850. 	for i, member in pairs(group.members) do 
  1851. 		sh02_ho_leave_player(member) 
  1852. 	end 
  1853. end 
  1854.  
  1855. -- Setup enemy to join fight 
  1856. function sh02_enemy_join_fight(name) 
  1857. 	set_cant_cower_flag(name, true) 
  1858. 	set_cant_flee_flag(name, true) 
  1859. 	on_attack_performed("sh02_enemy_attack_cb", name) 
  1860. 	on_take_damage("sh02_enemy_attacked_cb", name) 
  1861. end 
  1862.  
  1863. -- Setup enemy group to join fight 
  1864. function sh02_enemies_join_fight(group) 
  1865. 	for i, member in pairs(group.members) do 
  1866. 		sh02_enemy_join_fight(member) 
  1867. 	end 
  1868. end 
  1869.  
  1870. -- Setup enemy to leave fight 
  1871. function sh02_enemy_leave_fight(name) 
  1872. 	set_cant_cower_flag(name, false) 
  1873. 	set_cant_flee_flag(name, false) 
  1874. 	on_attack_performed("", name) 
  1875. 	on_take_damage("", name) 
  1876. end 
  1877.  
  1878. -- Setup enemy group to leave fight 
  1879. function sh02_enemies_leave_fight(group) 
  1880. 	for i, member in pairs(group.members) do 
  1881. 		sh02_enemy_leave_fight(member) 
  1882. 	end 
  1883. end 
  1884.  
  1885. -- Setup enemy as must kill 
  1886. function sh02_enemy_must_kill(name) 
  1887. 	if not character_is_dead(name) then 
  1888. 		on_death("sh02_enemy_killed_cb", name) 
  1889. 		marker_add(name, MINIMAP_ICON_KILL, OI_ASSET_KILL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  1890. 		sh02_guys_killed = sh02_guys_killed + 1 
  1891. 	end 
  1892. end 
  1893.  
  1894. -- Setup enemy group as must kill 
  1895. function sh02_enemies_must_kill(group) 
  1896. 	for i, member in pairs(group.members) do 
  1897. 		sh02_enemy_must_kill(member) 
  1898. 	end 
  1899. end 
  1900.  
  1901. -- Cleanup enemy as must kill 
  1902. function sh02_enemy_kill_done(name) 
  1903. 	on_death("", name) 
  1904. 	marker_remove(name, SYNC_ALL) 
  1905. end 
  1906.  
  1907. -- Cleanup enemy group as must kill 
  1908. function sh02_enemies_kill_done(group) 
  1909. 	for i, member in pairs(group.members) do 
  1910. 		sh02_enemy_kill_done(member) 
  1911. 	end 
  1912. end 
  1913.  
  1914. -- Setup brute as must kill 
  1915. function sh02_brute_must_kill(name) 
  1916. 	on_death("sh02_brute_killed_cb", name) 
  1917. 	marker_add(name, MINIMAP_ICON_KILL, OI_ASSET_KILL_FULL, OI_FLAGS_DEFAULT, SYNC_ALL) 
  1918. end 
  1919.  
  1920. -- Cleanup brute as must kill 
  1921. function sh02_brute_kill_done(name) 
  1922. 	on_death("", name) 
  1923. 	marker_remove(name, SYNC_ALL) 
  1924. end 
  1925.  
  1926. -- Setup group to move to nav points 
  1927. function sh02_group_move_to(group, navpoints, stagger) 
  1928. 	local wait = 0.0 
  1929. 	for i, member in pairs(group.members) do 
  1930. 		sh02_ai_move_to_thd(member, navpoints[i], wait) 
  1931. 		wait = wait + stagger 
  1932. 	end 
  1933. end 
  1934.  
  1935. -- Setup group to leash to nav points 
  1936. function sh02_group_leash_to(group, navpoints, dist) 
  1937. 	for i, member in pairs(group.members) do 
  1938. 		npc_leash_to_nav(member, navpoints[i], dist) 
  1939. 		--ai_attack_region(member, navpoints[i], dist) 
  1940. 	end 
  1941. end 
  1942.  
  1943. -- Setup group to flee to nav point 
  1944. function sh02_group_flee_to(group, navpoint, stagger) 
  1945. 	local wait = 0.0 
  1946. 	for i, member in pairs(group.members) do 
  1947. 		npc_leash_to_nav(member, navpoint, 10.0) 
  1948. 		override_npc_run_and_cower_run(member, "Cower Run", "Cower Run") 
  1949. 		sh02_ai_move_to_thd(member, navpoint, wait) 
  1950. 		wait = wait + stagger 
  1951. 	end 
  1952. end 
  1953.  
  1954. --[[ SAVE: May need this for something... 
  1955. -- Setup enemy to start attacking player 
  1956. function sh02_enemy_start_attack(name) 
  1957. 	set_ignore_ai_flag(name, false) 
  1958. 	set_attack_player_flag(name, true) 
  1959. 	set_attack_enemies_flag(name, true) 
  1960. 	set_always_sees_player_flag(name, true) 
  1961. end 
  1962. ]]-- 
  1963.  
  1964.  
  1965.  
  1966.  
  1967. -- *************************************************** 
  1968. -- SH02 Attack/Death/Abandon Callbacks 
  1969. -- *************************************************** 
  1970.  
  1971. -- Zimos died callback 
  1972. function sh02_zimos_died_cb() 
  1973. 	mission_end_failure("sh02", SH02_FAILURE_ZIMOS_DIED) 
  1974. end 
  1975.  
  1976. -- Zimos abandoned callback 
  1977. function sh02_zimos_abandoned_cb() 
  1978. 	mission_end_failure("sh02", SH02_FAILURE_ABANDON_ZIMOS) 
  1979. end 
  1980.  
  1981. -- Enemy attack callback 
  1982. function sh02_enemy_attack_cb(name, weapon, attack) 
  1983.  
  1984. 	-- Check if Morningstar wait thread is done 
  1985. 	if not sh02_check_ms_wait_thread() then 
  1986. 		return 
  1987. 	end 
  1988. 	 
  1989. 	-- Start Morningstar wait thread 
  1990. 	sh02_start_ms_wait_thread(10.0) 
  1991. 	 
  1992. 	-- Morningstar: Mission specific attack lines 
  1993. 	sh02_persona.ms_attack.speaker = name 
  1994. 	sh02_play_persona_line(sh02_persona.ms_attack) 
  1995. 	 
  1996. end 
  1997.  
  1998. -- Enemy attacked callback 
  1999. function sh02_enemy_attacked_cb(attackee, attacker, hp)	 
  2000.  
  2001. 	-- Check if player(s)/Zimos aren't attacker 
  2002. 	if not (attacker == LOCAL_PLAYER) 
  2003. 	and not (attacker == REMOTE_PLAYER) 
  2004. 	and not (attacker == sh02_zimos) then 
  2005. 	 
  2006. 		-- Check if Morningstar wait thread is done 
  2007. 		if not sh02_check_ms_wait_thread() then 
  2008. 			return 
  2009. 		end 
  2010. 		 
  2011. 		-- Start Morningstar wait thread 
  2012. 		sh02_start_ms_wait_thread(10.0) 
  2013. 		 
  2014. 		-- Morningstar: Attacked lines when ho attacks 
  2015. 		sh02_persona.ms_attacked.speaker = attackee 
  2016. 		sh02_play_persona_line(sh02_persona.ms_attacked) 
  2017. 		 
  2018. 	end 
  2019. 	 
  2020. end 
  2021.  
  2022. -- Enemy killed callback 
  2023. function sh02_enemy_killed_cb(name) 
  2024. 	sh02_enemy_kill_done(name) 
  2025. 	sh02_guys_killed = sh02_guys_killed - 1 
  2026. end 
  2027.  
  2028. -- Brute killed callback 
  2029. function sh02_brute_killed_cb(name) 
  2030. 	sh02_brute_kill_done(name) 
  2031. 	sh02_brute_killed = true 
  2032. end 
  2033.  
  2034. -- Ho attack callback 
  2035. function sh02_ho_attack_cb(name, weapon, attack) 
  2036.  
  2037. 	-- Check if Ho wait thread is done 
  2038. 	if not sh02_check_ho_wait_thread() then 
  2039. 		return 
  2040. 	end 
  2041. 	 
  2042. 	-- Start Ho wait thread 
  2043. 	sh02_start_ho_wait_thread(10.0) 
  2044. 	 
  2045. 	-- Ho: Attack lines when attacking Morningstar 
  2046. 	sh02_persona.ho_attack.speaker = name 
  2047. 	sh02_play_persona_line(sh02_persona.ho_attack) 
  2048. 	 
  2049. end 
  2050.  
  2051. -- Ho attacked callback 
  2052. function sh02_ho_attacked_cb(attackee, attacker, hp) 
  2053.  
  2054. 	-- Check if player(s) are attacker 
  2055. 	if (attacker == LOCAL_PLAYER) 
  2056. 	or (attacker == REMOTE_PLAYER) then 
  2057. 	 
  2058. 		-- Zimos: "What are you doing!?" 
  2059. 		sh02_start_chatter_thread(sh02_chatter.ho_killed, 0.0, 0.0) 
  2060. 		 
  2061. 	end 
  2062. 	 
  2063. end 
  2064.  
  2065.  
  2066.  
  2067.  
  2068. -- *************************************************** 
  2069. -- SH02 Trigger Functions 
  2070. -- *************************************************** 
  2071.  
  2072. -- Set trigger according to type 
  2073. function sh02_set_trigger(trigger) 
  2074. 	trigger.triggered = false 
  2075. 	trigger_enable(trigger.name, true) 
  2076. 	if (trigger.style == TRIG_LOC) then 
  2077. 		marker_add_trigger(trigger.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL) 
  2078. 	elseif (trigger.style == TRIG_USE_LOC) then 
  2079. 		marker_add(trigger.name, MINIMAP_ICON_USE, OI_ASSET_USE, OI_FLAGS_FULL) 
  2080. 	end 
  2081. 	on_trigger(trigger.callback, trigger.name) 
  2082. end 
  2083.  
  2084. -- Check if trigger has been triggered 
  2085. function sh02_check_trigger(trigger) 
  2086. 	return trigger.triggered 
  2087. end 
  2088.  
  2089. -- Set trigger as triggered 
  2090. function sh02_set_triggered(trigger) 
  2091. 	trigger.triggered = true 
  2092. end 
  2093.  
  2094. -- Clear trigger according to type 
  2095. function sh02_clear_trigger(trigger, clear_obj) 
  2096. 	if (trigger.style == TRIG_USE_LOC) then 
  2097. 		marker_remove(trigger.name) 
  2098. 	end 
  2099. 	on_trigger("", trigger.name) 
  2100. 	trigger_enable(trigger.name, false) 
  2101. 	marker_remove_trigger(trigger.name, SYNC_ALL) 
  2102. 	mission_waypoint_remove() 
  2103. 	if (trigger.style == TRIG_LOC) 
  2104. 	or (trigger.style == TRIG_USE_LOC) then 
  2105. 		waypoint_remove(SYNC_ALL) 
  2106. 		if not (clear_obj == nil) and clear_obj then 
  2107. 			objective_text_clear(0) 
  2108. 		end 
  2109. 	end 
  2110. end 
  2111.  
  2112. -- Clear triggers according to type 
  2113. function sh02_clear_triggers() 
  2114. 	for i, trigger in pairs(sh02_trigger) do 
  2115. 		sh02_clear_trigger(trigger) 
  2116. 		sh02_set_triggered(trigger) 
  2117. 	end 
  2118. end 
  2119.  
  2120.  
  2121.  
  2122.  
  2123. -- *************************************************** 
  2124. -- SH02 Trigger Callbacks 
  2125. -- *************************************************** 
  2126.  
  2127. -- Collection 01 trigger callback 
  2128. function sh02_collection01_cb() 
  2129. 	sh02_clear_trigger(sh02_trigger.collection01) 
  2130. 	 
  2131. 	-- Setup player(s) being drugged (strong) 
  2132. 	sh02_setup_player_drugged(0.75) 
  2133. 	 
  2134. 	-- Have player(s) stumble to ground 
  2135. 	sh02_players_stumble_thd() 
  2136. 	 
  2137. 	-- Setup Collection guards 
  2138. 	sh02_setup_collection_guards() 
  2139. 	 
  2140. 	-- Wait until player/Zimos are done speaking 
  2141. 	while sh02_conversation_playing() do 
  2142. 		thread_yield() 
  2143. 	end 
  2144. 	 
  2145. 	-- Zimos: "We'll have to shut down security. Should be up ahead." 
  2146. 	sh02_play_persona_line(sh02_persona.follow) 
  2147. 	 
  2148. 	sh02_set_triggered(sh02_trigger.collection01) 
  2149. end 
  2150.  
  2151. -- Collection 02 trigger callback 
  2152. function sh02_collection02_cb() 
  2153. 	sh02_clear_trigger(sh02_trigger.collection02) 
  2154. 	 
  2155. 	-- Wait some time 
  2156. 	delay(2.0) 
  2157. 	 
  2158. 	-- Set Morningstar notoriety (1.0) 
  2159. 	notoriety_set("Morningstar", 1.0) 
  2160. 	notoriety_set_min("Morningstar", 1.0) 
  2161. 	 
  2162. 	-- Start alarms 
  2163. 	sh02_start_alarms() 
  2164. 	 
  2165. 	-- Wait some time 
  2166. 	delay(2.0) 
  2167. 	 
  2168. 	-- Wait until player/Zimos are done speaking 
  2169. 	while sh02_persona_line_playing() 
  2170. 	or sh02_conversation_playing() do 
  2171. 		thread_yield() 
  2172. 	end 
  2173. 	 
  2174. 	-- Zimos: "Find somethin' to shut off those alarms." 
  2175. 	sh02_play_persona_line(sh02_persona.unlock) 
  2176. 	 
  2177. 	-- Clear Collection 03 trigger 
  2178. 	sh02_clear_trigger(sh02_trigger.collection03) 
  2179. 	 
  2180. 	-- Objective: Disable Security 
  2181. 	sh02_show_objective_use(SH02_OBJ_OVERRIDE) 
  2182. 	 
  2183. 	-- Set Override 01 trigger 
  2184. 	sh02_set_trigger(sh02_trigger.override01) 
  2185. 	 
  2186. 	sh02_set_triggered(sh02_trigger.collection02) 
  2187. end 
  2188.  
  2189. -- Collection 03 trigger callback 
  2190. function sh02_collection03_cb() 
  2191. 	sh02_clear_trigger(sh02_trigger.collection03) 
  2192. 	sh02_set_triggered(sh02_trigger.collection03) 
  2193. end 
  2194.  
  2195. -- Override 01 trigger callback 
  2196. function sh02_override01_cb(player) 
  2197. 	sh02_clear_trigger(sh02_trigger.override01, true) 
  2198. 	 
  2199. 	-- Have player do vomit hack animation 
  2200. 	player_movement_disable(player) 
  2201. 	thread_new("sh02_player_vomit_hack_noises") 
  2202. 	sh02_player_hacking(player, NAV_HACKING[1], true) 
  2203. 	player_movement_enable(player) 
  2204. 	sh02_set_triggered(sh02_trigger.override01) 
  2205. end 
  2206.  
  2207. -- Lounge trigger callback 
  2208. function sh02_lounge_cb() 
  2209. 	sh02_clear_trigger(sh02_trigger.lounge) 
  2210. 	sh02_set_triggered(sh02_trigger.lounge) 
  2211. 	 
  2212. 	-- Have all hos leash to next navpoint 
  2213. 	sh02_hos_nav = 2 
  2214. 	sh02_all_hos_leash_to(20.0, NAV_HOS[sh02_hos_nav]) 
  2215. 	 
  2216. 	-- Have Lounge guards leash to navpoints 
  2217. 	sh02_group_leash_to(sh02_group.lounge_guards, NAV_LEASH01, 4.0) 
  2218. 	 
  2219. 	-- Start Lounge continuous spawning 
  2220. 	sh02_lounge_spawn_start_thd() 
  2221. 	 
  2222. 	-- Wait some time 
  2223. 	delay(8.0) 
  2224. 	 
  2225. 	-- Setup Lounge Flee 01 npcs to flee 
  2226. 	sh02_setup_lounge_flee01_npcs() 
  2227. 	 
  2228. 	-- Wait some time 
  2229. 	delay(8.0) 
  2230. 	 
  2231. 	-- Setup Lounge Flee 02 npcs to flee 
  2232. 	sh02_setup_lounge_flee02_npcs() 
  2233. 	 
  2234. 	-- Wait some time 
  2235. 	delay(8.0) 
  2236. 	 
  2237. 	-- Setup Lounge Flee 03 npcs to flee 
  2238. 	sh02_setup_lounge_flee03_npcs() 
  2239. 	 
  2240. 	-- Wait some time 
  2241. 	delay(8.0) 
  2242. 	 
  2243. 	-- Setup Lounge Flee 04 npcs to flee 
  2244. 	sh02_setup_lounge_flee04_npcs() 
  2245. 	 
  2246. end 
  2247.  
  2248. -- Hallway trigger callback 
  2249. function sh02_hallway_cb() 
  2250. 	sh02_clear_trigger(sh02_trigger.hallway) 
  2251. 	sh02_set_triggered(sh02_trigger.hallway) 
  2252. 	 
  2253. 	-- Have all hos leash to player 
  2254. 	sh02_all_hos_leash_to(10.0) 
  2255. 	 
  2256. 	-- Stop Lounge continuous spawning 
  2257. 	sh02_lounge_spawn_stop_thd() 
  2258. 	 
  2259. end 
  2260.  
  2261. -- Stairwell 01 trigger callback 
  2262. function sh02_stairwell01_cb() 
  2263. 	sh02_clear_trigger(sh02_trigger.stairwell01) 
  2264. 	sh02_set_triggered(sh02_trigger.stairwell01)	 
  2265. end 
  2266.  
  2267. -- Wrong Way trigger callback 
  2268. function sh02_wrongway_cb() 
  2269. 	sh02_clear_trigger(sh02_trigger.wrongway) 
  2270. 	sh02_set_triggered(sh02_trigger.wrongway) 
  2271. 	 
  2272. 	-- Wait until player/Zimos are done speaking 
  2273. 	while sh02_persona_line_playing() 
  2274. 	or sh02_conversation_playing() do 
  2275. 		thread_yield() 
  2276. 	end 
  2277. 	 
  2278. 	-- Zimos: "Where you headed?  We gotta go down, remember?" 
  2279. 	sh02_play_persona_line(sh02_persona.wrongway) 
  2280. 	 
  2281. end 
  2282.  
  2283. -- Stairwell 02 trigger callback 
  2284. function sh02_stairwell02_cb() 
  2285. 	sh02_clear_trigger(sh02_trigger.stairwell02)	 
  2286. 	sh02_set_triggered(sh02_trigger.stairwell02) 
  2287. end 
  2288.  
  2289. -- Stairwell 03 trigger callback 
  2290. function sh02_stairwell03_cb() 
  2291. 	sh02_clear_trigger(sh02_trigger.stairwell03) 
  2292. 	sh02_set_triggered(sh02_trigger.stairwell03) 
  2293. 	 
  2294. 	-- Stop Stairwell continuous spawning 
  2295. 	sh02_stairwell_spawn_stop_thd() 
  2296. 	 
  2297. 	-- Create Jailcell 01 guards/hos 
  2298. 	sh02_setup_jailcell01_npcs() 
  2299. 	 
  2300. end 
  2301.  
  2302. -- Stairwell 04 trigger callback 
  2303. function sh02_stairwell04_cb() 
  2304. 	sh02_clear_trigger(sh02_trigger.stairwell04) 
  2305. 	sh02_set_triggered(sh02_trigger.stairwell04) 
  2306. end 
  2307.  
  2308. -- Free Hos 01 trigger callback 
  2309. function sh02_freehos01_cb() 
  2310. 	sh02_clear_trigger(sh02_trigger.freehos01) 
  2311. 	sh02_set_triggered(sh02_trigger.freehos01) 
  2312. end 
  2313.  
  2314. -- Override 02 trigger callback 
  2315. function sh02_override02_cb(player) 
  2316. 	sh02_clear_trigger(sh02_trigger.override02) 
  2317. 	 
  2318. 	-- Remove y-prompt 01, if needed 
  2319. 	if (sh02_prompt01 ~= -1) then 
  2320.       effect_stop(sh02_prompt01) 
  2321.       sh02_prompt01 = -1 
  2322. 	end 
  2323. 	 
  2324. 	-- Player: "None of these things are labeled�" 
  2325. 	sh02_play_persona_line(sh02_persona.hacking01) 
  2326. 	 
  2327. 	-- Have player do normal hack animation 
  2328. 	player_movement_disable(player) 
  2329. 	sh02_player_hacking(player, NAV_HACKING[2], false) 
  2330. 	player_movement_enable(player) 
  2331. 	 
  2332. 	-- Open Cells 01 door 
  2333. 	door_open(sh02_door.cells01) 
  2334. 	 
  2335. 	-- Play jail cells opening sound 
  2336. 	audio_object_post_event("sh02_release_the_hos") 
  2337. 	 
  2338. 	-- Have Jailcell 01 hos join player (unarmed) 
  2339. 	sh02_hos_join_player(sh02_group.jailcell01_hos, false) 
  2340. 	 
  2341. 	-- Have Jailcell 01 hos leash to next navpoint 
  2342. 	if (sh02_hos_nav < 3) then 
  2343. 		sh02_hos_nav = 3 
  2344. 	end 
  2345. 	sh02_hos_leash_to(sh02_group.jailcell01_hos, 5.0, NAV_HOS[sh02_hos_nav]) 
  2346. 	 
  2347. 	-- Wait some time 
  2348. 	delay(1.0) 
  2349. 	 
  2350. 	-- Player: "Come on, everyone out." 
  2351. 	sh02_play_persona_line(sh02_persona.release01) 
  2352. 	 
  2353. 	-- Player: "Think these girls are pissed off?" 
  2354. 	sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0) 
  2355. 	 
  2356. 	sh02_set_triggered(sh02_trigger.override02) 
  2357. end 
  2358.  
  2359. -- Jailcell 01-01 trigger callback 
  2360. function sh02_jailcell01_01_cb() 
  2361. 	sh02_clear_trigger(sh02_trigger.jailcell01_01) 
  2362. 	sh02_set_triggered(sh02_trigger.jailcell01_01) 
  2363. 	 
  2364. 	-- Setup Jailcell 01 wave to move in 
  2365. 	sh02_setup_jailcell01_wave() 
  2366. 	 
  2367. 	-- Open Spawn 01 door 
  2368. 	door_open(sh02_door.spawn01) 
  2369. 	 
  2370. 	-- Start Jailcell 01 continuous spawning 
  2371. 	sh02_jailcell01_spawn_start_thd() 
  2372. 	 
  2373. 	-- Create Jailcell 02 guards/hos 
  2374. 	sh02_setup_jailcell02_npcs() 
  2375. 	 
  2376. end 
  2377.  
  2378. -- Jailcell 01-02 trigger callback 
  2379. function sh02_jailcell01_02_cb() 
  2380. 	sh02_clear_trigger(sh02_trigger.jailcell01_02) 
  2381. 	sh02_set_triggered(sh02_trigger.jailcell01_02) 
  2382. end 
  2383.  
  2384. -- Free Hos 01 trigger callback 
  2385. function sh02_freehos02_cb() 
  2386. 	sh02_clear_trigger(sh02_trigger.freehos02) 
  2387. 	sh02_set_triggered(sh02_trigger.freehos02) 
  2388. 	 
  2389. 	-- Zimos: "More to let out. Get on that." 
  2390. 	sh02_play_persona_line(sh02_persona.override03) 
  2391. 	 
  2392. 	-- Set Override 03 trigger 
  2393. 	sh02_set_trigger(sh02_trigger.override03) 
  2394. 	sh02_prompt02 = effect_play_finisher(NAV_HACKING[3], 2.5) 
  2395. 	 
  2396. 	-- Setup Jailcell 02 wave to move in 
  2397. 	sh02_setup_jailcell02_wave() 
  2398. 	 
  2399. 	-- Open Spawn 02 door 
  2400. 	door_open(sh02_door.spawn02) 
  2401. 	 
  2402. 	-- Start Jailcell 02 continuous spawning 
  2403. 	sh02_jailcell02_spawn_start_thd() 
  2404. 	 
  2405. end 
  2406.  
  2407. -- Override 03 trigger callback 
  2408. function sh02_override03_cb(player) 
  2409. 	sh02_clear_trigger(sh02_trigger.override03) 
  2410. 	 
  2411. 	-- Remove y-prompt 02, if needed 
  2412. 	if (sh02_prompt02 ~= -1) then 
  2413.       effect_stop(sh02_prompt02) 
  2414.       sh02_prompt02 = -1 
  2415. 	end 
  2416. 	 
  2417. 	-- Player: "Perhaps that button�" 
  2418. 	sh02_play_persona_line(sh02_persona.hacking02) 
  2419. 	 
  2420. 	-- Have player do normal hack animation 
  2421. 	player_movement_disable(player) 
  2422. 	sh02_player_hacking(player, NAV_HACKING[3], false) 
  2423. 	player_movement_enable(player) 
  2424. 	 
  2425. 	-- Open Cells 02 door 
  2426. 	door_open(sh02_door.cells02) 
  2427. 	 
  2428. 	-- Play jail cells opening sound 
  2429. 	audio_object_post_event("sh02_release_the_hos") 
  2430. 	 
  2431. 	-- Have Jailcell 02 hos join player (armed) 
  2432. 	sh02_hos_join_player(sh02_group.jailcell02_hos, true) 
  2433. 	 
  2434. 	-- Have Jailcell 02 hos leash to next navpoint 
  2435. 	if (sh02_hos_nav < 5) then 
  2436. 		sh02_hos_nav = 5 
  2437. 	end 
  2438. 	sh02_hos_leash_to(sh02_group.jailcell02_hos, 5.0, NAV_HOS[sh02_hos_nav]) 
  2439. 	 
  2440. 	-- Wait some time 
  2441. 	delay(1.0) 
  2442. 	 
  2443. 	-- Player: "Get some fresh air!" 
  2444. 	sh02_play_persona_line(sh02_persona.release02) 
  2445. 	 
  2446. 	-- Player: "Think these girls are pissed off?" 
  2447. 	sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0) 
  2448. 	 
  2449. 	sh02_set_triggered(sh02_trigger.override03) 
  2450. end 
  2451.  
  2452. -- Jailcell 02-01 trigger callback 
  2453. function sh02_jailcell02_01_cb() 
  2454. 	sh02_clear_trigger(sh02_trigger.jailcell02_01) 
  2455. 	sh02_set_triggered(sh02_trigger.jailcell02_01) 
  2456. 	 
  2457. 	-- Stop Jailcell 02 continuous spawning 
  2458. 	sh02_jailcell02_spawn_stop_thd() 
  2459. 	 
  2460. 	-- Create Jailcell 03 guards/hos 
  2461. 	sh02_setup_jailcell03_npcs() 
  2462. 	 
  2463. end 
  2464.  
  2465. -- Jailcell 02-02 trigger callback 
  2466. function sh02_jailcell02_02_cb() 
  2467. 	sh02_clear_trigger(sh02_trigger.jailcell02_02) 
  2468. 	sh02_set_triggered(sh02_trigger.jailcell02_02) 
  2469. end 
  2470.  
  2471. -- Jailcell 03-01 trigger callback 
  2472. function sh02_jailcell03_01_cb() 
  2473. 	sh02_clear_trigger(sh02_trigger.jailcell03_01) 
  2474. 	sh02_set_triggered(sh02_trigger.jailcell03_01) 
  2475. 	 
  2476. 	-- Setup Jailcell 03 wave to move in 
  2477. 	sh02_setup_jailcell03_wave() 
  2478. 	 
  2479. 	-- Open Spawn 03 door 
  2480. 	door_open(sh02_door.spawn03) 
  2481. 	 
  2482. 	-- Start Jailcell 03 continuous spawning 
  2483. 	sh02_jailcell03_spawn_start_thd() 
  2484. 	 
  2485. end 
  2486.  
  2487. -- Jailcell 03-02 trigger callback 
  2488. function sh02_jailcell03_02_cb() 
  2489. 	sh02_clear_trigger(sh02_trigger.jailcell03_02) 
  2490. 	sh02_set_triggered(sh02_trigger.jailcell03_02) 
  2491. end 
  2492.  
  2493. -- Backroom trigger callback 
  2494. function sh02_backroom_cb() 
  2495. 	sh02_clear_trigger(sh02_trigger.backroom) 
  2496. 	sh02_set_triggered(sh02_trigger.backroom) 
  2497. 	 
  2498. 	-- Stop Jailcell 03 continuous spawning 
  2499. 	sh02_jailcell03_spawn_stop_thd() 
  2500. 	 
  2501. end 
  2502.  
  2503. -- Override 04 trigger callback 
  2504. function sh02_override04_cb(player) 
  2505. 	sh02_clear_trigger(sh02_trigger.override04) 
  2506. 	 
  2507. 	-- Player: "None of these things are labeled�" 
  2508. 	if (rand_int(1, 10000) < 5000) then 
  2509. 		sh02_play_persona_line(sh02_persona.hacking01) 
  2510. 	-- Player: "Perhaps that button�" 
  2511. 	else 
  2512. 		sh02_play_persona_line(sh02_persona.hacking02) 
  2513. 	end 
  2514. 	 
  2515. 	-- Have player do normal hack animation 
  2516. 	player_movement_disable(player) 
  2517. 	sh02_player_hacking(player, NAV_HACKING[4], false) 
  2518. 	player_movement_enable(player) 
  2519. 	 
  2520. 	-- Open Cells 03 door 
  2521. 	door_open(sh02_door.cells03) 
  2522. 	 
  2523. 	-- Play jail cells opening sound 
  2524. 	audio_object_post_event("sh02_release_the_hos") 
  2525. 	 
  2526. 	-- Have Jailcell 03 hos join player (unarmed) 
  2527. 	sh02_hos_join_player(sh02_group.jailcell03_hos, false) 
  2528. 	 
  2529. 	-- Have Jailcell 03 hos leash to next navpoint 
  2530. 	if (sh02_hos_nav < 8) then 
  2531. 		sh02_hos_nav = 8 
  2532. 	end 
  2533. 	sh02_hos_leash_to(sh02_group.jailcell03_hos, 5.0, NAV_HOS[sh02_hos_nav]) 
  2534. 	 
  2535. 	-- Wait some time 
  2536. 	delay(1.0) 
  2537. 	 
  2538. 	-- Player: "Move along! Don't waste time!" 
  2539. 	sh02_play_persona_line(sh02_persona.release03) 
  2540. 	 
  2541. 	-- Player: "Think these girls are pissed off?" 
  2542. 	sh02_start_chatter_thread(sh02_chatter.hos_fighting, 10.0, 10.0) 
  2543. 	 
  2544. 	sh02_set_triggered(sh02_trigger.override04) 
  2545. end 
  2546.  
  2547. -- Garage trigger callback 
  2548. function sh02_garage_cb() 
  2549. 	sh02_clear_trigger(sh02_trigger.garage) 
  2550. 	sh02_set_triggered(sh02_trigger.garage) 
  2551. end 
  2552.  
  2553.  
  2554.  
  2555.  
  2556. -- *************************************************** 
  2557. -- SH02 Thread Functions (Tracked) 
  2558. -- *************************************************** 
  2559.  
  2560. -- Check if player thread is done 
  2561. function sh02_check_player_thread() 
  2562. 	return thread_check_done(sh02_thread.player) 
  2563. end 
  2564.  
  2565. -- Stop player thread, if needed 
  2566. function sh02_stop_player_thread() 
  2567. 	if not sh02_check_player_thread() then 
  2568. 		thread_kill(sh02_thread.player) 
  2569. 	end 
  2570. end 
  2571.  
  2572. -- Have player(s) come down from drugs 
  2573. function sh02_player_come_down() 
  2574.  
  2575. 	-- Wait some time 
  2576. 	delay(20.0) 
  2577. 	 
  2578. 	-- Setup player(s) being drugged (weak) 
  2579. 	sh02_setup_player_drugged(0.25) 
  2580. 	 
  2581. 	-- Have player(s) stumble to ground 
  2582. 	sh02_players_stumble_thd() 
  2583. 	 
  2584. 	-- Player: "Oh my god...the floor is so wobbly!" 
  2585. 	sh02_start_chatter_thread(sh02_chatter.drugged_out, 0.0, 10.0) 
  2586. 	 
  2587. 	-- Wait until player is done speaking 
  2588. 	while sh02_chatter_lines_playing() do 
  2589. 		thread_yield() 
  2590. 	end 
  2591. 	 
  2592. 	-- Cleanup player(s) being drugged 
  2593. 	sh02_cleanup_player_drugged() 
  2594. 	 
  2595. 	-- Clear persona situation override (Drugged). 
  2596. 	persona_clear_global_situation_override() 
  2597. 	 
  2598. end 
  2599.  
  2600. -- Have player(s) come down from drugs (start thread) 
  2601. function sh02_player_come_down_thd() 
  2602. 	sh02_thread.player = thread_new("sh02_player_come_down") 
  2603. end 
  2604.  
  2605. -- Check if homies thread is done 
  2606. function sh02_check_homies_thread() 
  2607. 	return thread_check_done(sh02_thread.homies) 
  2608. end 
  2609.  
  2610. -- Stop homies thread, if needed 
  2611. function sh02_stop_homies_thread() 
  2612. 	if not sh02_check_homies_thread() then 
  2613. 		thread_kill(sh02_thread.homies) 
  2614. 	end 
  2615. end 
  2616.  
  2617. -- Have Zimos greet player 
  2618. function sh02_zimos_greet_player() 
  2619.  
  2620. 	-- Have Zimos ignore everyone 
  2621. 	set_ignore_ai_flag(sh02_zimos, true) 
  2622. 	 
  2623. 	-- Have Zimos kick open Auction door 
  2624. 	door_open(sh02_door.auction, false, true, sh02_zimos, "kick door") 
  2625. 	 
  2626. 	-- Wait some time 
  2627. 	delay(2.5) 
  2628. 	 
  2629. 	-- Have Zimos stop ignoring everyone 
  2630. 	set_ignore_ai_flag(sh02_zimos, false) 
  2631. 	 
  2632. 	-- Setup homies (Zimos) 
  2633. 	sh02_setup_homies() 
  2634. 	 
  2635. end 
  2636.  
  2637. -- Have Zimos greet player (start thread) 
  2638. function sh02_zimos_greet_player_thd() 
  2639. 	sh02_thread.homies = thread_new("sh02_zimos_greet_player") 
  2640. end 
  2641.  
  2642. -- Check if enemies thread is done 
  2643. function sh02_check_enemies_thread() 
  2644. 	return thread_check_done(sh02_thread.enemies) 
  2645. end 
  2646.  
  2647. -- Stop enemies thread, if needed 
  2648. function sh02_stop_enemies_thread() 
  2649. 	if not sh02_check_enemies_thread() then 
  2650. 		thread_kill(sh02_thread.enemies) 
  2651. 	end 
  2652. end 
  2653.  
  2654. -- Lounge continuous spawning 
  2655. function sh02_lounge_spawn() 
  2656.  
  2657. 	-- Wait some time 
  2658. 	delay(20.0) 
  2659. 	 
  2660. 	-- Enable Lounge spawn region 
  2661. 	spawn_region_enable(sh02_spawn.lounge, true) 
  2662. 	 
  2663. 	-- Increase continuous spawning as time passes 
  2664. 	continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0) 
  2665. 	delay(40.0) 
  2666. 	continuous_spawn_stop(sh02_group.cont_spawn01.name) 
  2667. 	continuous_spawn_start(sh02_group.cont_spawn02.name, 2, 4.0) 
  2668. 	continuous_spawn_start(sh02_group.cont_spawn03.name, 2, 8.0) 
  2669. 	delay(80.0) 
  2670. 	continuous_spawn_stop(sh02_group.cont_spawn02.name) 
  2671. 	continuous_spawn_stop(sh02_group.cont_spawn03.name) 
  2672. 	continuous_spawn_start(sh02_group.cont_spawn04.name, 3, 4.0) 
  2673. 	continuous_spawn_start(sh02_group.cont_spawn05.name, 3, 8.0) 
  2674. 	continuous_spawn_start(sh02_group.cont_spawn06.name, 3, 12.0) 
  2675. 	 
  2676. end 
  2677.  
  2678. -- Lounge continuous spawning (start thread) 
  2679. function sh02_lounge_spawn_start_thd() 
  2680. 	sh02_thread.enemies = thread_new("sh02_lounge_spawn") 
  2681. end 
  2682.  
  2683. -- Lounge continuous spawning (stop thread) 
  2684. function sh02_lounge_spawn_stop_thd() 
  2685.  
  2686. 	-- Stop enemies thread, if needed 
  2687. 	sh02_stop_enemies_thread() 
  2688. 	 
  2689. 	-- Disable Lounge spawn region/groups 
  2690. 	spawn_region_enable(sh02_spawn.lounge, false) 
  2691. 	sh02_cleanup_spawn_groups() 
  2692. 	 
  2693. end 
  2694.  
  2695. -- Stairwell continuous spawning 
  2696. function sh02_stairwell_spawn() 
  2697.  
  2698. 	-- Wait some time 
  2699. 	delay(20.0) 
  2700. 	 
  2701. 	-- Enable Stairwell spawn region 
  2702. 	spawn_region_enable(sh02_spawn.stairwell, true) 
  2703. 	 
  2704. 	-- Increase continuous spawning as time passes 
  2705. 	continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0) 
  2706. 	delay(20.0) 
  2707. 	continuous_spawn_stop(sh02_group.cont_spawn01.name) 
  2708. 	continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0) 
  2709. 	delay(20.0) 
  2710. 	continuous_spawn_stop(sh02_group.cont_spawn02.name) 
  2711. 	continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0) 
  2712. 	delay(20.0) 
  2713. 	continuous_spawn_stop(sh02_group.cont_spawn03.name) 
  2714. 	continuous_spawn_start(sh02_group.cont_spawn04.name, 1, 4.0) 
  2715. 	delay(20.0) 
  2716. 	continuous_spawn_stop(sh02_group.cont_spawn04.name) 
  2717. 	continuous_spawn_start(sh02_group.cont_spawn05.name, 1, 4.0) 
  2718. 	delay(20.0) 
  2719. 	continuous_spawn_stop(sh02_group.cont_spawn05.name) 
  2720. 	continuous_spawn_start(sh02_group.cont_spawn06.name, 1, 4.0) 
  2721. 	 
  2722. end 
  2723.  
  2724. -- Stairwell continuous spawning (start thread) 
  2725. function sh02_stairwell_spawn_start_thd() 
  2726. 	sh02_thread.enemies = thread_new("sh02_stairwell_spawn") 
  2727. end 
  2728.  
  2729. -- Stairwell continuous spawning (stop thread) 
  2730. function sh02_stairwell_spawn_stop_thd() 
  2731.  
  2732. 	-- Stop enemies thread, if needed 
  2733. 	sh02_stop_enemies_thread() 
  2734. 	 
  2735. 	-- Disable Stairwell spawn region/groups 
  2736. 	spawn_region_enable(sh02_spawn.stairwell, false) 
  2737. 	sh02_cleanup_spawn_groups() 
  2738. 	 
  2739. end 
  2740.  
  2741. -- Jailcell 01 continuous spawning 
  2742. function sh02_jailcell01_spawn() 
  2743.  
  2744. 	-- Wait some time 
  2745. 	delay(20.0) 
  2746. 	 
  2747. 	-- Enable Jailcell 01 spawn region 
  2748. 	spawn_region_enable(sh02_spawn.jailcell01, true) 
  2749. 	 
  2750. 	-- Increase continuous spawning as time passes 
  2751. 	continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0) 
  2752. 	delay(10.0) 
  2753. 	continuous_spawn_stop(sh02_group.cont_spawn01.name) 
  2754. 	continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0) 
  2755. 	delay(10.0) 
  2756. 	continuous_spawn_stop(sh02_group.cont_spawn02.name) 
  2757. 	continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0) 
  2758. 	 
  2759. end 
  2760.  
  2761. -- Jailcell 01 continuous spawning (start thread) 
  2762. function sh02_jailcell01_spawn_start_thd() 
  2763. 	sh02_thread.enemies = thread_new("sh02_jailcell01_spawn") 
  2764. end 
  2765.  
  2766. -- Jailcell 01 continuous spawning (stop thread) 
  2767. function sh02_jailcell01_spawn_stop_thd() 
  2768.  
  2769. 	-- Stop enemies thread, if needed 
  2770. 	sh02_stop_enemies_thread() 
  2771. 	 
  2772. 	-- Disable Jailcell 01 spawn region/groups 
  2773. 	spawn_region_enable(sh02_spawn.jailcell01, false) 
  2774. 	sh02_cleanup_spawn_groups() 
  2775. 	 
  2776. end 
  2777.  
  2778. -- Jailcell 02 continuous spawning 
  2779. function sh02_jailcell02_spawn() 
  2780.  
  2781. 	-- Wait some time 
  2782. 	delay(20.0) 
  2783. 	 
  2784. 	-- Enable Jailcell 02 spawn region 
  2785. 	spawn_region_enable(sh02_spawn.jailcell02, true) 
  2786. 	 
  2787. 	-- Increase continuous spawning as time passes 
  2788. 	continuous_spawn_start(sh02_group.cont_spawn04.name, 1, 4.0) 
  2789. 	delay(10.0) 
  2790. 	continuous_spawn_stop(sh02_group.cont_spawn04.name) 
  2791. 	continuous_spawn_start(sh02_group.cont_spawn05.name, 1, 4.0) 
  2792. 	delay(10.0) 
  2793. 	continuous_spawn_stop(sh02_group.cont_spawn05.name) 
  2794. 	continuous_spawn_start(sh02_group.cont_spawn06.name, 1, 4.0) 
  2795. 	 
  2796. end 
  2797.  
  2798. -- Jailcell 02 continuous spawning (start thread) 
  2799. function sh02_jailcell02_spawn_start_thd() 
  2800. 	sh02_thread.enemies = thread_new("sh02_jailcell02_spawn") 
  2801. end 
  2802.  
  2803. -- Jailcell 02 continuous spawning (stop thread) 
  2804. function sh02_jailcell02_spawn_stop_thd() 
  2805.  
  2806. 	-- Stop enemies thread, if needed 
  2807. 	sh02_stop_enemies_thread() 
  2808. 	 
  2809. 	-- Disable Jailcell 02 spawn region/groups 
  2810. 	spawn_region_enable(sh02_spawn.jailcell02, false) 
  2811. 	sh02_cleanup_spawn_groups() 
  2812. 	 
  2813. end 
  2814.  
  2815. -- Jailcell 03 continuous spawning 
  2816. function sh02_jailcell03_spawn() 
  2817.  
  2818. 	-- Wait some time 
  2819. 	delay(20.0) 
  2820. 	 
  2821. 	-- Enable Jailcell 03 spawn region 
  2822. 	spawn_region_enable(sh02_spawn.jailcell03, true) 
  2823. 	 
  2824. 	-- Increase continuous spawning as time passes 
  2825. 	continuous_spawn_start(sh02_group.cont_spawn01.name, 1, 4.0) 
  2826. 	delay(10.0) 
  2827. 	continuous_spawn_stop(sh02_group.cont_spawn01.name) 
  2828. 	continuous_spawn_start(sh02_group.cont_spawn02.name, 1, 4.0) 
  2829. 	delay(10.0) 
  2830. 	continuous_spawn_stop(sh02_group.cont_spawn02.name) 
  2831. 	continuous_spawn_start(sh02_group.cont_spawn03.name, 1, 4.0) 
  2832. 	 
  2833. end 
  2834.  
  2835. -- Jailcell 03 continuous spawning (start thread) 
  2836. function sh02_jailcell03_spawn_start_thd() 
  2837. 	sh02_thread.enemies = thread_new("sh02_jailcell03_spawn") 
  2838. end 
  2839.  
  2840. -- Jailcell 03 continuous spawning (stop thread) 
  2841. function sh02_jailcell03_spawn_stop_thd() 
  2842.  
  2843. 	-- Stop enemies thread, if needed 
  2844. 	sh02_stop_enemies_thread() 
  2845. 	 
  2846. 	-- Disable Jailcell 03 spawn region/groups 
  2847. 	spawn_region_enable(sh02_spawn.jailcell03, false) 
  2848. 	sh02_cleanup_spawn_groups() 
  2849. 	 
  2850. end 
  2851.  
  2852. -- Check if Morningstar wait thread is done 
  2853. function sh02_check_ms_wait_thread() 
  2854. 	return thread_check_done(sh02_thread.ms_wait) 
  2855. end 
  2856.  
  2857. -- Stop Morningstar wait thread, if needed 
  2858. function sh02_stop_ms_wait_thread() 
  2859. 	if not sh02_check_ms_wait_thread() then 
  2860. 		thread_kill(sh02_thread.ms_wait) 
  2861. 	end 
  2862. end 
  2863.  
  2864. -- Start Morningstar wait thread 
  2865. function sh02_start_ms_wait_thread(wait) 
  2866. 	sh02_stop_ms_wait_thread() 
  2867. 	sh02_thread.ms_wait = thread_new("delay", wait) 
  2868. end 
  2869.  
  2870. -- Check if Ho wait thread is done 
  2871. function sh02_check_ho_wait_thread() 
  2872. 	return thread_check_done(sh02_thread.ho_wait) 
  2873. end 
  2874.  
  2875. -- Stop Ho wait thread, if needed 
  2876. function sh02_stop_ho_wait_thread() 
  2877. 	if not sh02_check_ho_wait_thread() then 
  2878. 		thread_kill(sh02_thread.ho_wait) 
  2879. 	end 
  2880. end 
  2881.  
  2882. -- Start Ho wait thread 
  2883. function sh02_start_ho_wait_thread(wait) 
  2884. 	sh02_stop_ho_wait_thread() 
  2885. 	sh02_thread.ho_wait = thread_new("delay", wait) 
  2886. end 
  2887.  
  2888.  
  2889.  
  2890. -- *************************************************** 
  2891. -- SH02 Thread Functions (Untracked) 
  2892. -- *************************************************** 
  2893.  
  2894. -- Have player stumble to ground 
  2895. function sh02_player_stumble(player) 
  2896. 	if (not character_is_dead(player) and not human_is_downed(player)) then 
  2897. 		player_movement_disable(player) 
  2898. 		action_play(player, "plym drunk stumble", "", false, 1.0, true, true) 
  2899. 		player_movement_enable(player) 
  2900. 	end 
  2901. end 
  2902.  
  2903. -- Have player(s) stumble to ground (start thread(s)) 
  2904. function sh02_players_stumble_thd() 
  2905. 	thread_new("sh02_player_stumble", LOCAL_PLAYER) 
  2906. 	if (sh02_in_coop) then 
  2907. 		thread_new("sh02_player_stumble", REMOTE_PLAYER) 
  2908. 	end 
  2909. end 
  2910.  
  2911. -- Update ai move to nav point 
  2912. function sh02_ai_move_to(name, navpoint, wait) 
  2913.  
  2914. 	-- Wait for desired time before moving 
  2915. 	delay(wait) 
  2916. 	 
  2917. 	-- Update ai scripted move until close 
  2918. 	local close = false 
  2919. 	while not close do 
  2920. 		ai_do_scripted_move(name, navpoint, true, true) 
  2921. 		thread_yield() 
  2922. 		while not ai_scripted_action_is_complete(name) do 
  2923. 			thread_yield() 
  2924. 		end 
  2925. 		close = (get_dist(name, navpoint) < 4.0) 
  2926. 	end 
  2927. 	 
  2928. end 
  2929.  
  2930. -- Update ai move to nav point (start thread) 
  2931. function sh02_ai_move_to_thd(name, navpoint, wait) 
  2932. 	thread_new("sh02_ai_move_to", name, navpoint, wait) 
  2933. end 
  2934.  
  2935.  
  2936.  
  2937.  
  2938. -- *************************************************** 
  2939. -- SH02 Text Functions 
  2940. -- *************************************************** 
  2941.  
  2942. -- Show objective (generic) 
  2943. function sh02_show_objective(tag, icon) 
  2944. 	objective_text_clear(0) 
  2945. 	objective_text(0, tag, "", "", SYNC_ALL, icon) 
  2946. end 
  2947.  
  2948. -- Show objective (location) 
  2949. function sh02_show_objective_loc(tag) 
  2950. 	sh02_show_objective(tag, OI_ASSET_LOCATION) 
  2951. end 
  2952.  
  2953. -- Show objective (use target) 
  2954. function sh02_show_objective_use(tag) 
  2955. 	sh02_show_objective(tag, OI_ASSET_USE) 
  2956. end 
  2957.  
  2958. -- Show objective (kill target(s)) 
  2959. function sh02_show_objective_kill(tag) 
  2960. 	sh02_show_objective(tag, OI_ASSET_KILL) 
  2961. end 
  2962.  
  2963.  
  2964.  
  2965.  
  2966. -- *************************************************** 
  2967. -- SH02 Audio Functions 
  2968. -- *************************************************** 
  2969.  
  2970. -- Start alarms 
  2971. function sh02_start_alarms() 
  2972. 	audio_ambient_emitter_start("sh02_alarm_a") 
  2973. 	audio_ambient_emitter_start("sh02_alarm_b") 
  2974. end 
  2975.  
  2976. -- Stop alarms 
  2977. function sh02_stop_alarms() 
  2978. 	audio_ambient_emitter_stop("sh02_alarm_a") 
  2979. 	audio_ambient_emitter_stop("sh02_alarm_b") 
  2980. end 
  2981.  
  2982. -- Check if a persona line is playing (player/Zimos) 
  2983. function sh02_persona_line_playing() 
  2984. 	return (audio_persona_line_playing(LOCAL_PLAYER) 
  2985. 	or audio_persona_line_playing(sh02_zimos)) 
  2986. end 
  2987.  
  2988. -- Play persona line 
  2989. function sh02_play_persona_line(persona) 
  2990. 	if (persona == nil) then 
  2991. 		return 
  2992. 	end 
  2993. 	audio_play_persona_line(persona.speaker, persona.line) 
  2994. end 
  2995.  
  2996. -- Check if chatter lines are playing 
  2997. function sh02_chatter_lines_playing() 
  2998. 	return sh02_chatter.playing 
  2999. end 
  3000.  
  3001. -- Play chatter line 
  3002. function sh02_play_chatter_line(chat, buff) 
  3003. 	audio_play_persona_line(chat.speaker, chat.line) 
  3004. 	sh02_chatter.playing = true 
  3005. 	chat.spoken = true 
  3006. 	sh02_chatter.wait_thd = thread_new("delay", buff) 
  3007. 	delay(1.0) 
  3008. 	while sh02_persona_line_playing() 
  3009. 	or not thread_check_done(sh02_chatter.wait_thd) do 
  3010. 		thread_yield() 
  3011. 	end 
  3012. 	sh02_chatter.playing = false 
  3013. end 
  3014.  
  3015. -- Play chatter lines 
  3016. function sh02_play_chatter_lines(chatter, wait, buff) 
  3017. 	delay(wait) 
  3018. 	for i, chat in pairs(chatter) do 
  3019. 		if not chat.spoken then 
  3020. 			while sh02_persona_line_playing() 
  3021. 			or sh02_conversation_playing() do 
  3022. 				thread_yield() 
  3023. 			end 
  3024. 			sh02_play_chatter_line(chat, buff) 
  3025. 		end 
  3026. 	end 
  3027. end 
  3028.  
  3029. -- Stop chatter thread 
  3030. function sh02_stop_chatter_thread() 
  3031. 	sh02_chatter.playing = false 
  3032. 	if not thread_check_done(sh02_chatter.main_thd) then 
  3033. 		thread_kill(sh02_chatter.main_thd) 
  3034. 	end 
  3035. 	if not thread_check_done(sh02_chatter.wait_thd) then 
  3036. 		thread_kill(sh02_chatter.wait_thd) 
  3037. 	end 
  3038. end 
  3039.  
  3040. -- Start chatter thread 
  3041. function sh02_start_chatter_thread(chatter, wait, buff) 
  3042. 	if (chatter == nil) then 
  3043. 		return 
  3044. 	end 
  3045. 	if (wait <= 0.0) and (buff <= 0.0) then 
  3046. 		if sh02_persona_line_playing() 
  3047. 		or sh02_chatter_lines_playing() 
  3048. 		or sh02_conversation_playing() then		 
  3049. 			return 
  3050. 		end 
  3051. 	end 
  3052. 	sh02_stop_chatter_thread() 
  3053. 	sh02_chatter.main_thd = thread_new("sh02_play_chatter_lines", chatter, wait, buff) 
  3054. end 
  3055.  
  3056. -- Check if conversation is playing 
  3057. function sh02_conversation_playing() 
  3058. 	return sh02_convo.playing 
  3059. end 
  3060.  
  3061. -- Play conversation 
  3062. function sh02_play_conversation(convo) 
  3063. 	while sh02_persona_line_playing() 
  3064. 	or sh02_chatter_lines_playing() 
  3065. 	or sh02_conversation_playing() do 
  3066. 		thread_yield() 
  3067. 	end 
  3068. 	if (convo.load_direct) then 
  3069. 		convo.handle = audio_conversation_load_direct(convo.name) 
  3070. 	else 
  3071. 		convo.handle = audio_conversation_load(convo.name) 
  3072. 	end 
  3073. 	audio_conversation_play(convo.handle) 
  3074. 	sh02_convo.playing = true 
  3075. 	delay(1.0) 
  3076. 	audio_conversation_wait_for_end(convo.handle) 
  3077. 	convo.handle = INVALID_CONVERSATION_HANDLE 
  3078. 	sh02_convo.playing = false 
  3079. end 
  3080.  
  3081. -- Stop conversation thread 
  3082. function sh02_stop_convo_thread(convo) 
  3083. 	sh02_convo.playing = false 
  3084. 	if not thread_check_done(sh02_convo.main_thd) then 
  3085. 		thread_kill(sh02_convo.main_thd) 
  3086. 	end 
  3087. 	if not (convo == nil) then 
  3088. 		if audio_conversation_playing(convo.handle) then 
  3089. 			audio_conversation_end(convo.handle) 
  3090. 		end 
  3091. 	end 
  3092. end 
  3093.  
  3094. -- Start conversation thread 
  3095. function sh02_start_convo_thread(convo) 
  3096. 	if (convo == nil) then 
  3097. 		return 
  3098. 	end 
  3099. 	sh02_stop_convo_thread() 
  3100. 	sh02_convo.main_thd = thread_new("sh02_play_conversation", convo) 
  3101. end