Modding Help Making a gun play a special sound that stops if you put it away

Discussion in 'Starbound Modding' started by Brasswind the Bard, Apr 28, 2017.

  1. Brasswind the Bard

    Brasswind the Bard Void-Bound Voyager

    I want to make a gun that plays a special sound as you fire it, but currently the gun starts playing the sound over and over again as you shoot it, and the sound overlaps. The sound continues to play even if you put the gun away (because it is really long).

    I want the sound to continue to play as the trigger is held down, but stop if you let go or put the weapon away.
    The sound should only start playing once.

    In the .activeitem script right now

    "animationCustom" : {
    "sounds" : {
    "fire" : [ "/sfx/gun/sound_name.ogg" ]
    }
    },

    This is not the proper way to do it, because holding down the trigger seems to count as firing again and again. Each time the sound starts playing along with the ones already playing. It hurts your ears and nobody would like it.
     
  2. bk3k

    bk3k Oxygen Tank

    I'd suggest looking at the animation files for the solus katana. It makes use of the things you're looking for.

    Some things which sadly don't function when used in an object's animation files. But you're talking another activeitem so you should be good.
     
  3. Brasswind the Bard

    Brasswind the Bard Void-Bound Voyager

    I managed to cobble together exactly what I needed from the solus katana files. Now the item works like I intended! Your suggestion was just the thing, thanks bk3k!
     

Share This Page