Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Looping Gun Sound Example
- @inputs [Trigger] [Gun]:entity
- @outputs [Fire]
- @trigger [Trigger]
- #- This code example is provided by DatAmazingCheese for use with the machine gun sound library from Tank Sound Pack, which is available here:
- #- https://steamcommunity.com/sharedfiles/filedetails/?id=906654112
- SOUND_SHOT = "acf_tank_sound_pack/guns/mg_12mm_m2_loop.wav"
- SOUND_LASTSHOT = "acf_tank_sound_pack/guns/mg_12mm_m2_lastshot.wav"
- SOUND_SHELL = "acf_tank_sound_pack/guns/shells_12mm_loop.wav"
- SOUND_LASTSHELL = "acf_tank_sound_pack/guns/shells_12mm_single.wav"
- if (first()|dupefinished()) {
- #- Playing sounds and silencing them.
- Gun:soundPlay("shot", 0, SOUND_SHOT)
- Gun:soundPlay("shell", 0, SOUND_SHELL)
- soundVolume("shot", 0)
- soundVolume("shell", 0)
- }
- if (~Trigger & Trigger) {
- #- Unsilencing sounds when finger is on the trigger.
- Fire = 1
- soundVolume("shot", 1)
- soundVolume("shell", 1)
- }
- if (~Trigger & !Trigger) {
- #- Silencing sounds when finger is off the trigger.
- Fire = 0
- Gun:soundPlay("lastshot", 1, SOUND_LASTSHOT)
- Gun:soundPlay("lastshell", 1, SOUND_LASTSHELL)
- soundVolume("shot", 0)
- soundVolume("shell", 0)
- }
- if (!Trigger) {
- Fire = 0
- }
Advertisement
Add Comment
Please, Sign In to add comment