natesmithzombies

Untitled

Dec 29th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. #define SHOT_FX                             "electric/fx_elec_gp_wire_sparking_xsml_thick_anim"
  2. #precache( "fx", SHOT_FX );
  3.  
  4. // add the above underneath the #using statements at the top of your mapname.gsc
  5.  
  6. function shootable_trigs()
  7. {
  8.     level.shootable_door_count = 0;
  9.     trigs = GetEntArray( "shootable_door", "targetname" );
  10.     level.shootable_door_goal = trigs.size;
  11.     foreach( trig in trigs )
  12.         trig thread wait_for_shoot();
  13. }
  14.  
  15. function wait_for_shoot()
  16. {
  17.     self waittill( "trigger", player );
  18.     player PlayLocalSound( "zmb_cha_ching" );   // Change this to any sound alias you want
  19.     model = GetEnt( self.target, "targetname" );
  20.     PlayFx( SHOT_FX, model.origin );
  21.     waiti(0.05);
  22.     model delete();
  23.     level.shootable_door_count++;
  24.     if( level.shootable_door_count == level.shootable_door_goal )
  25.         self open_door();
  26. }
  27.  
  28. function open_door()
  29. {
  30.     doors = GetEntArray( "shootable_door_reward", "targetname" );
  31.    
  32.     foreach( door in doors )
  33.         door PlaySound( "zmb_cha_ching" );
  34.     wait(0.05);
  35.     foreach( door in doors )
  36.         door delete();
  37.    
  38.     flag = doors[0].script_flag;
  39.     level flag::set( flag );
  40. }
  41.  
  42.  
  43. 2) At the top of your mapname.gsc add the following code
Advertisement
Add Comment
Please, Sign In to add comment