Jump to content

Activate one-time sound with a trigger?


entropiachrome

Recommended Posts

Yeah, so... I would like a sound .wav file to activate ONCE (and only once, never to be repeated) when a player enters the trigger area.

 

Looking through the activators section, I found the defaultPlaySoundAtLink trigger. It says it only plays the sound once, so I figured it would work. Of course it does not, so I'm probably using the wrong trigger or script.

 

Suggestions, please?

 

 

 

While we're on the topic, I'd also like to do the opposite... have a sound file play every single time the player enters a specific cell. Suggestions for that would be appreciated as well

 

 

(I apologize if these seem like super easy things to figure out, I am just feeling overwhelmed with trying to comprehend these scripts.)

Edited by entropiachrome
Link to comment
Share on other sites

I'm fairly new to scripting, so no guarantees, but I think what you're looking for is something like this...

 

Scriptname PlaySoundOnceScript extends ObjectReference 

int Property pAlreadyPlayed Auto Conditional
ObjectReference Property pMySound Auto

Event onTriggerEnter (ObjectReference akActionRef)

    if pAlreadyPlayed == 0
         if akActionRef == Game.GetPlayer() 
              pMySound.Enable()
              pAlreadyPlayed = 1
         endif
    endif

endEvent

 

As far as having a sound play every time, I think you could just remove the "AlreadyPlayed" condition and set the script on a trigger box just inside the door to the cell. However, I think this would cause the sound to play both when you enter and when you leave the cell, so there's probably a better way to do it.

Edited by kryptopyr
Link to comment
Share on other sites

I'm fairly new to scripting, so no guarantees, but I think what you're looking for is something like this...

 

Scriptname PlaySoundOnceScript extends ObjectReference 

int Property pAlreadyPlayed Auto Conditional
ObjectReference Property pMySound Auto

Event onTriggerEnter (ObjectReference akActionRef)

    if pAlreadyPlayed == 0
         if akActionRef == Game.GetPlayer() 
              pMySound.Enable()
              pAlreadyPlayed = 1
         endif
    endif

endEvent

 

As far as having a sound play every time, I think you could just remove the "AlreadyPlayed" condition and set the script on a trigger box just inside the door to the cell. However, I think this would cause the sound to play both when you enter and when you leave the cell, so there's probably a better way to do it.

 

 

OK, I'll give that a try and see what I came work out... thanks :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...