Advertisement
Guest User

zombie_temple_sq_bttp2

a guest
Dec 14th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. /* zombie_temple_sq_bttp2.gsc
  2. *
  3. * Purpose : Sidequest declaration and side-quest logic for zombie_temple stage 7.
  4. * Backer to the pasterer.
  5. *
  6. *
  7. * Author : Dan L
  8. *
  9. */
  10.  
  11.  
  12.  
  13. #include maps\_utility;
  14. #include common_scripts\utility;
  15. #include maps\_zombiemode_utility;
  16. #include maps\_zombiemode_sidequests;
  17.  
  18. init()
  19. {
  20. declare_sidequest_stage("sq", "bttp2", ::init_stage, ::stage_logic, ::exit_stage);
  21. set_stage_time_limit("sq", "bttp2", 5 * 60, ::bttp2_timer_func); // 5 minute limit.
  22. // declare_stage_title("sq", "bttp2", &"ZOMBIE_TEMPLE_SIDEQUEST_STAGE_7_TITLE");
  23. }
  24.  
  25. init_stage()
  26. {
  27. level notify ("bttp2_start");
  28.  
  29. level._num_dials_correct = 0;
  30.  
  31. dials = GetEntArray("sq_bttp2_dial", "targetname");
  32.  
  33. level._num_dials_to_match = dials.size;
  34.  
  35. array_thread(dials, ::dial_handler);
  36. maps\zombie_temple_sq_brock::delete_radio();
  37.  
  38. if(flag("radio_7_played"))
  39. {
  40. level thread delayed_start_skit("tt7a");
  41. }
  42. else
  43. {
  44. level thread delayed_start_skit("tt7b");
  45. }
  46.  
  47. level thread bolt_from_the_blue();
  48.  
  49. }
  50.  
  51. delayed_start_skit( skit )
  52. {
  53. wait(.5);
  54. level thread maps\zombie_temple_sq_skits::start_skit(skit);
  55. }
  56.  
  57. bolt_from_the_blue()
  58. {
  59. wait(25);
  60. a_struct = getstruct("sq_bttp2_bolt_from_the_blue_a", "targetname");
  61. b_struct = getstruct("sq_bttp2_bolt_from_the_blue_b", "targetname");
  62.  
  63. a = Spawn("script_model", a_struct.origin );
  64. a SetModel("p_ztem_glyphs_00");
  65. a Hide();
  66. wait_network_frame();
  67.  
  68. b = Spawn("script_model", b_struct.origin );
  69. b SetModel("p_ztem_glyphs_00");
  70. b Hide();
  71. wait_network_frame();
  72.  
  73. original_origin = a.origin;
  74.  
  75. for(i = 0; i < 7; i ++)
  76. {
  77.  
  78. yaw = randomFloat( 360 );
  79. r = randomFloatRange( 500, 1000);
  80.  
  81. amntx = cos( yaw ) * r;
  82. amnty = sin( yaw ) * r;
  83.  
  84.  
  85. a.origin = original_origin + (amntx, amnty, 0);
  86.  
  87. maps\zombie_temple_sq::bounce_from_a_to_b(a,b,false);
  88.  
  89. wait(0.55);
  90. }
  91.  
  92. wait(5);
  93.  
  94. a.origin = original_origin;
  95.  
  96. maps\zombie_temple_sq::bounce_from_a_to_b(b,a,true);
  97.  
  98. wait(1);
  99.  
  100. a Delete();
  101. b Delete();
  102. }
  103.  
  104. bttp2_timer_func()
  105. {
  106. if(flag("radio_7_played"))
  107. {
  108. return 5 * 60;
  109. }
  110. else
  111. {
  112. return 60; // If radio not listened to, stage lasts 1 minute.
  113. }
  114. }
  115.  
  116. stage_logic()
  117. {
  118. while(level._num_dials_correct != level._num_dials_to_match)
  119. {
  120. wait(0.1);
  121. }
  122.  
  123. level notify("raise_crystal_1");
  124. level notify("raise_crystal_2");
  125. level notify("raise_crystal_3");
  126. level notify("raise_crystal_4");
  127. level notify("raise_crystal_5");
  128. level notify("raise_crystal_6", true);
  129. level waittill("raised_crystal_6");
  130.  
  131. wait(5.0);
  132.  
  133. stage_completed("sq", "bttp2");
  134. }
  135.  
  136. exit_stage(success)
  137. {
  138. dials = GetEntArray("sq_bttp2_dial", "targetname");
  139. array_thread(dials, ::dud_dial_handler);
  140.  
  141. if(success)
  142. {
  143. maps\zombie_temple_sq_brock::create_radio(8);
  144. }
  145. else
  146. {
  147. maps\zombie_temple_sq_brock::create_radio(7, maps\zombie_temple_sq_brock::radio7_override);
  148. level thread maps\zombie_temple_sq_skits::fail_skit();
  149. }
  150. }
  151.  
  152. dial_trigger()
  153. {
  154. level endon("bttp2_start");
  155. level endon("sq_bttp2_over");
  156.  
  157. while(1)
  158. {
  159. self waittill("triggered", who);
  160. self.owner_ent notify("triggered", who);
  161. }
  162. }
  163.  
  164. dial_handler()
  165. {
  166. if(!flag("radio_7_played"))
  167. {
  168. self thread dud_dial_handler("We don't know what we're doing.");
  169. }
  170.  
  171. level endon("sq_bttp2_over");
  172.  
  173. self.angles = self.original_angles;
  174.  
  175. pos = RandomIntRange(0,3);
  176.  
  177. if(pos == self.script_int)
  178. {
  179. pos = (pos + 1) % 4;
  180. }
  181.  
  182. self RotatePitch(90 * pos, 0.01);
  183.  
  184. correct = false;
  185.  
  186. while(1)
  187. {
  188. self waittill("triggered", who);
  189.  
  190. self playsound( "evt_sq_bttp2_wheel_turn" );
  191. self RotatePitch(90, 0.25);
  192. self waittill("rotatedone");
  193.  
  194. pos = (pos + 1) % 4;
  195.  
  196. if(pos == self.script_int)
  197. {
  198. level._num_dials_correct ++;
  199. Print3d(self.origin, "+", (0,255,0), 10);
  200. correct = true;
  201. //self playsound( "evt_sq_bttp2_wheel_correct" );
  202.  
  203. if( isdefined( who ) && isPlayer( who ) )
  204. {
  205. if( level._num_dials_correct == level._num_dials_to_match )
  206. {
  207. who thread maps\_zombiemode_audio::create_and_play_dialog( "eggs", "quest7", undefined, 0 );
  208. }
  209. }
  210. }
  211. else
  212. {
  213. if(correct)
  214. {
  215. correct = false;
  216. level._num_dials_correct --;
  217. }
  218. }
  219.  
  220. wait(0.1);
  221. }
  222. }
  223.  
  224. dud_dial_handler(dont_know_alias)
  225. {
  226. level endon("bttp2_start");
  227. self.trigger thread dial_trigger();
  228.  
  229. if(!IsDefined(self.original_angles))
  230. {
  231. self.original_angles = self.angles;
  232. }
  233.  
  234. self.angles = self.original_angles;
  235.  
  236. rot = RandomIntRange(0,3);
  237.  
  238. self RotatePitch(rot * 90, 0.01);
  239.  
  240. while(1)
  241. {
  242. self waittill("triggered");
  243.  
  244. self playsound( "evt_sq_bttp2_wheel_turn" );
  245.  
  246. if(IsDefined(dont_know_alias))
  247. {
  248. /#
  249. IPrintLnBold("Temp player vox : " + dont_know_alias);
  250. #/
  251. }
  252.  
  253. self RotatePitch(90, 0.25);
  254. }
  255. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement