Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.38 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include common_scripts\utility;
  3.  
  4. radiation()
  5. {
  6. precacheString( &"SCRIPT_RADIATION_DEATH" );
  7. radiationFields = getentarray("radiation", "targetname");
  8.  
  9. if (radiationFields.size > 0)
  10. {
  11.  
  12. precacheshellshock( "mp_radiation_low" );
  13. precacheshellshock( "mp_radiation_med" );
  14. precacheshellshock( "mp_radiation_high" );
  15.  
  16. foreach ( trigger in radiationFields )
  17. trigger thread common_scripts\_dynamic_world::triggerTouchThink( ::playerEnterArea, ::playerLeaveArea );
  18.  
  19. thread onPlayerConnect();
  20. }
  21.  
  22. }
  23.  
  24. onPlayerConnect()
  25. {
  26. for ( ;; )
  27. {
  28. level waittill ( "connected", player );
  29. player.numAreas = 0;
  30. }
  31. }
  32.  
  33. playerEnterArea( trigger )
  34. {
  35. self.numAreas++;
  36.  
  37. if ( self.numAreas == 1 )
  38. self radiationEffect();
  39. }
  40.  
  41.  
  42. playerLeaveArea( trigger )
  43. {
  44. self.numAreas--;
  45. assert( self.numAreas >= 0 );
  46.  
  47. if ( self.numAreas != 0 )
  48. return;
  49.  
  50. self.poison = 0;
  51. self notify( "leftTrigger");
  52.  
  53. if ( isDefined( self.radiationOverlay ) )
  54. self.radiationOverlay fadeoutBlackOut( .10, 0 );
  55. }
  56.  
  57. soundWatcher( soundOrg )
  58. {
  59. self waittill_any( "death", "leftTrigger" );
  60.  
  61. self stopLoopSound();
  62. }
  63.  
  64. radiationEffect()
  65. {
  66. self endon( "disconnect" );
  67. self endon( "game_ended" );
  68. self endon( "death" );
  69. self endon( "leftTrigger" );
  70.  
  71. self.poison = 0;
  72. self thread soundWatcher( self );
  73.  
  74. while (1)
  75. {
  76. self.poison ++;
  77.  
  78. switch( self.poison )
  79. {
  80. case 1:
  81. self.radiationSound = "item_geigercouner_level2";
  82. self playLoopSound( self.radiationSound );
  83. self ViewKick( 1, self.origin );
  84. break;
  85. case 3:
  86. self shellshock( "mp_radiation_low", 4);
  87. self.radiationSound = "item_geigercouner_level3";
  88. self stopLoopSound();
  89. self playLoopSound( self.radiationSound );
  90. self ViewKick( 3, self.origin );
  91. self doRadiationDamage(15);
  92. break;
  93. case 4:
  94. self shellshock( "mp_radiation_med", 5);
  95. self.radiationSound = "item_geigercouner_level3";
  96. self stopLoopSound();
  97. self playLoopSound( self.radiationSound );
  98. self ViewKick( 15, self.origin );
  99. self thread blackout();
  100. self doRadiationDamage(25);
  101. break;
  102. case 6:
  103. self shellshock( "mp_radiation_high", 5);
  104. self.radiationSound = "item_geigercouner_level4";
  105. self stopLoopSound();
  106. self playLoopSound( self.radiationSound );
  107. self ViewKick( 75, self.origin );
  108. self doRadiationDamage(45);
  109. break;
  110. case 8:
  111. self shellshock( "mp_radiation_high", 5);
  112. self.radiationSound = "item_geigercouner_level4";
  113. self stopLoopSound();
  114. self playLoopSound( self.radiationSound );
  115. self ViewKick( 127, self.origin );
  116. self doRadiationDamage(175);
  117.  
  118. break;
  119. }
  120. wait(1);
  121. }
  122. wait(5);
  123. }
  124. blackout( )
  125. {
  126. self endon( "disconnect" );
  127. self endon( "game_ended" );
  128. self endon( "death" );
  129. self endon( "leftTrigger" );
  130.  
  131. if ( !isDefined( self.radiationOverlay ) )
  132. {
  133. self.radiationOverlay = newClientHudElem( self );
  134. self.radiationOverlay.x = 0;
  135. self.radiationOverlay.y = 0;
  136. self.radiationOverlay setshader( "black", 640, 480 );
  137. self.radiationOverlay.alignX = "left";
  138. self.radiationOverlay.alignY = "top";
  139. self.radiationOverlay.horzAlign = "fullscreen";
  140. self.radiationOverlay.vertAlign = "fullscreen";
  141. self.radiationOverlay.alpha = 0;
  142. }
  143.  
  144. min_length = 1;
  145. max_length = 2;
  146. min_alpha = .25;
  147. max_alpha = 1;
  148.  
  149. min_percent = 5;
  150. max_percent = 100;
  151.  
  152. fraction = 0;
  153.  
  154. for ( ;; )
  155. {
  156. while ( self.poison > 1 )
  157. {
  158. percent_range = max_percent - min_percent;
  159. fraction = ( self.poison - min_percent ) / percent_range;
  160.  
  161. if ( fraction < 0 )
  162. fraction = 0;
  163. else if ( fraction > 1 )
  164. fraction = 1;
  165.  
  166. length_range = max_length - min_length;
  167. length = min_length + ( length_range * ( 1 - fraction ) );
  168.  
  169. alpha_range = max_alpha - min_alpha;
  170. alpha = min_alpha + ( alpha_range * fraction );
  171.  
  172. end_alpha = fraction * 0.5;
  173.  
  174. if ( fraction == 1 )
  175. break;
  176.  
  177. duration = length / 2;
  178.  
  179. self.radiationOverlay fadeinBlackOut( duration, alpha );
  180. self.radiationOverlay fadeoutBlackOut( duration, end_alpha);
  181.  
  182. // wait a variable amount based on self.radiation.totalpercent, this is the space in between pulses
  183. //wait 1;
  184. wait( fraction * 0.5 );
  185. }
  186.  
  187. if ( fraction == 1 )
  188. break;
  189.  
  190. if ( self.radiationOverlay.alpha != 0 )
  191. self.radiationOverlay fadeoutBlackOut( 1, 0);
  192.  
  193. wait 0.05;
  194. }
  195. self.radiationOverlay fadeinBlackOut( 2, 0);
  196. }
  197.  
  198. doRadiationdamage( iDamage )
  199. {
  200.  
  201. self thread [[ level.callbackPlayerDamage ]](
  202. self,// eInflictor The entity that causes the damage.( e.g. a turret )
  203. self,// eAttacker The entity that is attacking.
  204. iDamage,// iDamage Integer specifying the amount of damage done
  205. 0,// iDFlags Integer specifying flags that are to be applied to the damage
  206. "MOD_SUICIDE",// sMeansOfDeath Integer specifying the method of death
  207. "claymore_mp",// sWeapon The weapon number of the weapon used to inflict the damage
  208. self.origin,// vPoint The point the damage is from?
  209. ( 0,0,0 ) - self.origin,// vDir The direction of the damage
  210. "none",// sHitLoc The location of the hit
  211. 0// psOffsetTime The time offset for the damage
  212. );
  213. }
  214.  
  215. fadeinBlackOut( duration, alpha )
  216. {
  217. self fadeOverTime( duration );
  218. self.alpha = alpha;
  219. wait duration;
  220. }
  221.  
  222. fadeoutBlackOut( duration, alpha )
  223. {
  224. self fadeOverTime( duration );
  225. self.alpha = alpha;
  226. wait duration;
  227. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement