Advertisement
BananasTheKing

Passive Dispatch

Oct 23rd, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. local PLUGIN = PLUGIN;
  2.  
  3. --[[
  4.  
  5. I honestly could not think of another way to do this.
  6. edit line 40 to change times
  7. Credits go to Rj for inital design.
  8. To add more, add the line to the random sounds, then add another if statement
  9. ]]--
  10. function PLUGIN:EmitRandomChatter(player)
  11. local randomSounds = {
  12. "npc/overwatch/cityvoice/f_innactionisconspiracy_spkr.wav",
  13. "npc/overwatch/cityvoice/f_trainstation_offworldrelocation_spkr.wav",
  14. "npc/overwatch/cityvoice/fprison_missionfailurereminder.wav"
  15. };
  16.  
  17.  
  18.  
  19. local randomSound = randomSounds[ math.random(1, #randomSounds) ];
  20. if(randomSound == "npc/overwatch/cityvoice/f_innactionisconspiracy_spkr.wav") then
  21. Clockwork.chatBox:Add(nil, player, "dispatch", "Citizen reminder. Inaction is conspiracy. Report counter behaviour to a Civil Protection team immediately.");
  22. end
  23. if(randomSound == "npc/overwatch/cityvoice/f_trainstation_offworldrelocation_spkr.wav") then
  24. Clockwork.chatBox:Add(nil, player, "dispatch", "Citizen reminder: Inaction is conspiracy.");
  25. end
  26. if(randomSound == "npc/overwatch/cityvoice/fprison_missionfailurereminder.wav") then
  27. Clockwork.chatBox:Add(nil, player, "dispatch", "Attention, ground-units: Mission-failure will result in permanent off-world assignment. Code-reminder: SACRIFICE; COAGULATE; CLAMP.");
  28. end
  29.  
  30. player:EmitSound( randomSound, 60)
  31. end;
  32.  
  33. -- Called each tick.
  34. function PLUGIN:Tick()
  35. for k, v in ipairs( _player.GetAll() ) do
  36.  
  37. local curTime = CurTime();
  38.  
  39. if (!self.nextChatterEmit) then
  40. self.nextChatterEmit = curTime + math.random(120, 150);
  41. end;
  42.  
  43. if ( (curTime >= self.nextChatterEmit) ) then
  44. self.nextChatterEmit = nil;
  45.  
  46. PLUGIN:EmitRandomChatter(v);
  47. end;
  48.  
  49. end;
  50. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement