Advertisement
salahzar

disco pad

May 23rd, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. For this script to work you must set up the following parameters:
  2.  
  3. name: disco
  4. type: sequencer
  5. value: a sequencer that has the keywords ‘fever’ and ‘hips’ corresponding to animations
  6.  
  7. name: discomusic
  8. type: sound
  9. value: browse to the ogg file you want to play
  10.  
  11.  
  12. function animPlayDelayed() {
  13.   animPlay(context.data);
  14. }
  15.  
  16. function foundPlayer() {
  17.   var playerEnt = context.data.ent;
  18.  
  19.   //if (!get(playerEnt)) {  
  20.     animAddSequencer({ ent: playerEnt, sequencer: 'disco'});
  21.     set(playerEnt, true);
  22.   //}
  23.  
  24.   var animation = 'fever';
  25.   if (randomInt(0,1) === 0) {
  26.     animation = 'hips';
  27.   }
  28.  
  29.   timerCreate({
  30.     name: 'animPlayDelayed' + playerEnt,
  31.     script: 'animPlayDelayed',
  32.     delay: 0.75,
  33.     data: {
  34.       ent: playerEnt,
  35.       keyword: animation
  36.     }
  37.   });
  38. }
  39.  
  40. function findPlayers() {
  41.   getEnts({
  42.     radius: 3.0,
  43.     callback: 'foundPlayer',
  44.     channel: 'physics'
  45.   });
  46. }
  47.  
  48. function init() {
  49.   timerCreate({
  50.     name: 'findPlayers',
  51.     period: 1.0
  52.   });
  53.   soundStart({sound: 'discoMusic'});
  54. }
  55.  
  56. call('init');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement