Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rock_song_easter_egg()
- {
- level.song = "ALIAS NAME HERE"; //use same name as defined in your alias
- 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;
- level.loop_the_easter_egg = true; //Set to true if you want players to be able to repeat easter egg.
- level.humming_sound = "ALIAS NAME HERE"; //use name for sound rocks emit when players are near. Should be defined as a looping sound.
- level.press_f_sound = "ALIAS NAME HERE"; //name for sound when you press f on rock
- level.easter_egg_rocks_activated = 0;
- trigs = GetEntArray("rock_easter_egg_trig","targetname");
- for(i=0;i<trigs.size;i++)
- {
- trigs[i] thread rock_easter_egg_trig_think();
- }
- }
- function rock_easter_egg_trig_think()
- {
- self SetHintString("");
- self SetCursorHint("HINT_NOICON");
- self PlayLoopSound(level.humming_sound);
- self waittill("trigger",player);
- self PlaySound(level.press_f_sound);
- self StopLoopSound();
- level.easter_egg_rocks_activated ++;
- if(level.easter_egg_rocks_activated >= 3)
- {
- if(!IsDefined(level.songname))
- {
- thread play_2d_sound( level.song);
- }
- Else if(IsDefined(level.songname))
- {
- thread play_2d_sound( level.song, level.songname);
- }
- }
- }
- function play_2d_sound( sound, songname)
- {
- level.temp_ent = spawn("script_origin", (0,0,0));
- if(IsDefined(songname))
- IPrintLnBold( "Playing: " + songname );
- level.temp_ent PlaySoundWithNotify(sound, sound + "wait");
- level.song_is_playing = true;
- level.temp_ent waittill (sound + "wait");
- wait(0.05);
- if(level.song_is_playing == true)
- {
- level.song_is_playing = false;
- level.temp_ent delete();
- }
- if(level.loop_the_easter_egg == true)
- {
- rock_song_easter_egg();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement