Advertisement
Guest User

Untitled

a guest
Sep 29th, 2010
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.09 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include common_scripts\_fx;
  3. #include common_scripts\_createfx;
  4. #include maps\mp\_utility;
  5. #include maps\mp\_createfx;
  6.  
  7. /*
  8. ****************************************************************************************************************
  9. OneShotfx: Fires an effect once.
  10. maps\mp\_fx::OneShotfx( effectname, (x y z), predelay);
  11.  
  12. Example:
  13. maps\mp\_fx::OneShotfx(level.medFire, // Medium fire effect
  14. (-701, -18361, 148), // Origin
  15. 5); // Wait 5 seconds before doing effect
  16. ****************************************************************************************************************
  17.  
  18.  
  19. ****************************************************************************************************************
  20. Loopfx: Loops an effect with a waittime.
  21. maps\mp\_fx::loopfx( effectname, (x y z), delay_between_shots);
  22.  
  23. Example:
  24. maps\mp\_fx::loopfx(level.medFire, // Medium fire effect
  25. (-701, -18361, 148), // Origin
  26. 0.3); // Wait 0.3 seconds between shots
  27. ****************************************************************************************************************
  28.  
  29.  
  30. ****************************************************************************************************************
  31. GunFireLoopfx: Simulates bursts of fire.
  32. maps\mp\_fx::gunfireloopfx(fxId, fxPos, shotsMin, shotsMax, shotdelayMin, shotdelayMax, betweenSetsMin, betweenSetsMax)
  33.  
  34. Example:
  35. maps\mp\_fx::gunfireloopfx (level.medFire, // Medium fire effect
  36. (-701, -18361, 148), // Origin
  37. 10, 15, // 10 to 15 shots
  38. 0.1, 0.3, // 0.1 to 0.3 seconds between shots
  39. 2.5, 9); // 2.5 to 9 seconds between sets of shots.
  40. ****************************************************************************************************************
  41.  
  42. ****************************************************************************************************************
  43. GrenadeExplosionfx: Creates a grenade explosion with view jitter.
  44. maps\mp\_fx::GrenadeExplosionfx((x y z));
  45.  
  46. Example:
  47. maps\mp\_fx::GrenadeExplosionfx( (-701, -18361, 148) ); // origin
  48. ****************************************************************************************************************
  49. */
  50.  
  51. script_print_fx()
  52. {
  53. if ( ( !isdefined( self.script_fxid ) ) || ( !isdefined( self.script_fxcommand ) ) || ( !isdefined( self.script_delay ) ) )
  54. {
  55. println( "Effect at origin ", self.origin, " doesn't have script_fxid/script_fxcommand/script_delay" );
  56. self delete();
  57. return;
  58. }
  59.  
  60. if ( isdefined( self.target ) )
  61. org = getent( self.target ).origin;
  62. else
  63. org = "undefined";
  64.  
  65. // println ("^a Command:", self.script_fxcommand, " Effect:", self.script_fxID, " Delay:", self.script_delay, " ", self.origin);
  66. if ( self.script_fxcommand == "OneShotfx" )
  67. println( "maps\mp\_fx::OneShotfx(\"" + self.script_fxid + "\", " + self.origin + ", " + self.script_delay + ", " + org + ");" );
  68.  
  69. if ( self.script_fxcommand == "loopfx" )
  70. println( "maps\mp\_fx::LoopFx(\"" + self.script_fxid + "\", " + self.origin + ", " + self.script_delay + ", " + org + ");" );
  71.  
  72. if ( self.script_fxcommand == "loopsound" )
  73. println( "maps\mp\_fx::LoopSound(\"" + self.script_fxid + "\", " + self.origin + ", " + self.script_delay + ", " + org + ");" );
  74. }
  75.  
  76. script_playfx( id, pos, pos2 )
  77. {
  78. if ( !id )
  79. return;
  80.  
  81. if ( isdefined( pos2 ) )
  82. playfx( id, pos, pos2 );
  83. else
  84. playfx( id, pos );
  85. }
  86.  
  87. script_playfxontag( id, ent, tag )
  88. {
  89. if ( !id )
  90. return;
  91.  
  92. playfxontag( id, ent, tag );
  93. }
  94.  
  95. GrenadeExplosionfx( pos )
  96. {
  97. playfx( level._effect[ "mechanical explosion" ], pos );
  98. earthquake( 0.15, 0.5, pos, 250 );
  99. // TODO: Add explosion effect and view jitter
  100. // println("The script command grenadeExplosionEffect has been removed. maps\\mp\\_fx::GrenadeExplosionfx must be set up to make an effect and jitter the view.");
  101. }
  102.  
  103.  
  104. soundfx( fxId, fxPos, endonNotify )
  105. {
  106. org = spawn( "script_origin", ( 0, 0, 0 ) );
  107. org.origin = fxPos;
  108. org playloopsound( fxId );
  109. if ( isdefined( endonNotify ) )
  110. org thread soundfxDelete( endonNotify );
  111.  
  112. /*
  113. ent = level thread createfx_showOrigin ( fxId, fxPos, undefined, undefined, "soundfx" );
  114. ent.delay = 0;
  115. ent endon ("effect deleted");
  116. ent.soundfx = org;
  117. */
  118. }
  119.  
  120. soundfxDelete( endonNotify )
  121. {
  122. level waittill( endonNotify );
  123. self delete();
  124. }
  125.  
  126.  
  127. /*rainfx( fxId, fxId2, fxPos )
  128. {
  129. org = spawn( "script_origin", ( 0, 0, 0 ) );
  130. org.origin = fxPos;
  131. org thread rainLoop( fxId, fxId2 );
  132.  
  133. //ent = level thread createfx_showOrigin( fxId, fxPos, undefined, undefined, "rainfx", undefined, fxId2 );
  134. //ent.delay = 0;
  135. //ent endon ("effect deleted");
  136. //ent.soundfx = org;
  137. }
  138.  
  139. rainLoop( hardRain, lightRain )
  140. {
  141. // org playloopsound (fxId);
  142. self endon( "death" );
  143. blend = spawn( "sound_blend", ( 0.0, 0.0, 0.0 ) );
  144. blend.origin = self.origin;
  145. self thread blendDelete( blend );
  146.  
  147. blend2 = spawn( "sound_blend", ( 0.0, 0.0, 0.0 ) );
  148. blend2.origin = self.origin;
  149. self thread blendDelete( blend2 );
  150.  
  151.  
  152. // lerp of 0 will play _null only
  153. blend setSoundBlend( lightRain + "_null", lightRain, 0 );
  154. blend2 setSoundBlend( hardRain + "_null", hardRain, 1 );
  155. rain = "hard";
  156. blendTime = undefined;
  157. for ( ;; )
  158. {
  159. level waittill( "rain_change", change, blendTime );
  160. blendTime *= 20;// internal framerate
  161. assert( change == "hard" || change == "light" || change == "none" );
  162. assert( blendtime > 0 );
  163.  
  164. if ( change == "hard" )
  165. {
  166. if ( rain == "none" )
  167. {
  168. blendTime *= 0.5;// gotta do 2 blends to go from none to hard
  169. for ( i = 0;i < blendtime;i++ )
  170. {
  171. blend setSoundBlend( lightRain + "_null", lightRain, i / blendtime );
  172. wait( 0.05 );
  173. }
  174. rain = "light";
  175. }
  176. if ( rain == "light" )
  177. {
  178. for ( i = 0;i < blendtime;i++ )
  179. {
  180. blend setSoundBlend( lightRain + "_null", lightRain, 1 - ( i / blendtime ) );
  181. blend2 setSoundBlend( hardRain + "_null", hardRain, i / blendtime );
  182. wait( 0.05 );
  183. }
  184. }
  185. }
  186. if ( change == "none" )
  187. {
  188. if ( rain == "hard" )
  189. {
  190. blendTime *= 0.5;// gotta do 2 blends to go from hard to none
  191. for ( i = 0;i < blendtime;i++ )
  192. {
  193. blend setSoundBlend( lightRain + "_null", lightRain, ( i / blendtime ) );
  194. blend2 setSoundBlend( hardRain + "_null", hardRain, 1 - ( i / blendtime ) );
  195. wait( 0.05 );
  196. }
  197. rain = "light";
  198. }
  199. if ( rain == "light" )
  200. {
  201. for ( i = 0;i < blendtime;i++ )
  202. {
  203. blend setSoundBlend( lightRain + "_null", lightRain, 1 - ( i / blendtime ) );
  204. wait( 0.05 );
  205. }
  206. }
  207. }
  208. if ( change == "light" )
  209. {
  210. if ( rain == "none" )
  211. {
  212. for ( i = 0;i < blendtime;i++ )
  213. {
  214. blend setSoundBlend( lightRain + "_null", lightRain, i / blendtime );
  215. wait( 0.05 );
  216. }
  217. }
  218. if ( rain == "hard" )
  219. {
  220. for ( i = 0;i < blendtime;i++ )
  221. {
  222. blend setSoundBlend( lightRain + "_null", lightRain, i / blendtime );
  223. blend2 setSoundBlend( hardRain + "_null", hardRain, 1 - ( i / blendtime ) );
  224. wait( 0.05 );
  225. }
  226. }
  227. }
  228.  
  229. rain = change;
  230. }
  231. }*/
  232.  
  233. blendDelete( blend )
  234. {
  235. self waittill( "death" );
  236. blend delete();
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement