Advertisement
Abnormal202

Untitled

Jul 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. function rock_song_easter_egg()
  2. {
  3. level.song = "ALIAS NAME HERE"; //use same name as defined in your alias
  4. level.songname = "SONG NAME HERE"; //Optional: type in the name of your song to display when it starts playing, so players know song it is. Otherwise set it to level.songname = Undefined;
  5. level.loop_the_easter_egg = true; //Set to true if you want players to be able to repeat easter egg.
  6. level.humming_sound = "ALIAS NAME HERE"; //use name for sound rocks emit when players are near. Should be defined as a looping sound.
  7. level.press_f_sound = "ALIAS NAME HERE"; //name for sound when you press f on rock
  8.  
  9. level.easter_egg_rocks_activated = 0;
  10.  
  11. trigs = GetEntArray("rock_easter_egg_trig","targetname");
  12. for(i=0;i<trigs.size;i++)
  13. {
  14. trigs[i] thread rock_easter_egg_trig_think();
  15. }
  16. }
  17.  
  18. function rock_easter_egg_trig_think()
  19. {
  20. self SetHintString("");
  21. self SetCursorHint("HINT_NOICON");
  22. self PlayLoopSound(level.humming_sound);
  23.  
  24. self waittill("trigger",player);
  25. self PlaySound(level.press_f_sound);
  26.  
  27. self StopLoopSound();
  28. level.easter_egg_rocks_activated ++;
  29. if(level.easter_egg_rocks_activated >= 3)
  30. {
  31. if(!IsDefined(level.songname))
  32. {
  33. thread play_2d_sound( level.song);
  34. }
  35. Else if(IsDefined(level.songname))
  36. {
  37. thread play_2d_sound( level.song, level.songname);
  38. }
  39. }
  40. }
  41. function play_2d_sound( sound, songname)
  42. {
  43. level.temp_ent = spawn("script_origin", (0,0,0));
  44. if(IsDefined(songname))
  45. IPrintLnBold( "Playing: " + songname );
  46. level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
  47. level.song_is_playing = true;
  48. level.temp_ent waittill (sound + "wait");
  49. wait(0.05);
  50. if(level.song_is_playing == true)
  51. {
  52. level.song_is_playing = false;
  53. level.temp_ent delete();
  54. }
  55. if(level.loop_the_easter_egg == true)
  56. {
  57. rock_song_easter_egg();
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement