natesmithzombies

shootable_door_func

Feb 11th, 2017
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. function shootable_trigs()
  2. {
  3. level.shootable_door_count = 0;
  4. trigs = GetEntArray( "shootable_door", "targetname" );
  5. level.shootable_door_goal = trigs.size;
  6. foreach( trig in trigs )
  7. trig thread wait_for_shoot();
  8. }
  9.  
  10. function wait_for_shoot()
  11. {
  12. self waittill( "trigger", player );
  13. player PlayLocalSound( "zmb_cha_ching" ); // Change this to any sound alias you want
  14. level.shootable_door_count++;
  15. if( level.shootable_door_count == level.shootable_door_goal )
  16. self open_door();
  17. }
  18.  
  19. function open_door()
  20. {
  21. doors = GetEntArray( "shootable_door_reward", "targetname" );
  22.  
  23. foreach( door in doors )
  24. door PlaySound( "zmb_cha_ching" );
  25. wait(0.05);
  26. foreach( door in doors )
  27. door delete();
  28.  
  29. flag = doors[0].script_flag;
  30. level flag::set( flag );
  31. }
Advertisement
Add Comment
Please, Sign In to add comment