Jump to content

How to stop a sound?


PapaLegaBooboo

Recommended Posts

MoveTo, PositionCell, PositionWorld don't work on an instantiated Sound Object.

 

We can put an Activator with required Loop Sound out of earshot such as a utilities interior - move it to/from player as required.

 

A problem is that it requires an Activator per Sound which takes up Save Game space.

A solution would be to use OBSE SetLoopSound but it does not seem to work - I'll post on that.

 

So it's impossible? i'm confused.

Link to comment
Share on other sites

Looking in OBSE it would seem Oblivion PlaySound calls Windows API PlaySound of which there is no StopSound that I know of. The fact that enable/disable works on sound objects suggests Oblivion is using a sound player - anyone know this?

As far as dynamically play on Player with Stop/Start that leaves 2 ways I can think of.

1. Create an OBSE Plugin that uses a sound player.
2. Use activator(s) with Loop Sound and a quest script.

With step 2 I mentioned save game space but I think that would be a tiny one off of Transform - much as when we bump into clutter.

QstSoundOnPlayerScript - Activator.MoveTo 'Location' works. Activator.MoveTo 'Origin' works but the sound persists in 'Location' until that cell is unloaded - Disable is used to overcome that...

Note the PositionCell on the next line. What if we save in SomeOtherMod cell while the activator is there. I did this, uninstalled SomeOtherMod. Reload was in Tiber Septim, of course. Stood still and the activator.MoveTo worked. I see no great need for the PositionCell line.

Note that the Mesh+Collision was exported from Blender using AnimStatic (to make sure the collision moves with the mesh) however those properties can be set on collision mesh using NifSkope.

Here is the working example.

Cast the "+Travel SOP Test01" spell, wait till sound plays, walk to other end of hall, wait till the other sound plays.

Feel free to message me as I usually only come here when searching for answers.

Link to comment
Share on other sites

One thing that pops up in my mind is that if it is not working and KatsAwful do not happen to pop by here, is to put an Issue at the xOBSE github and maybe Idle is able to take a peek at it? You will most likely get an answer there from either of them I guess. You could send KatsAwful a PM and ask her peek here.

Link to comment
Share on other sites

I'm not sure what you mean by 'not working' Pellape. Unless I've missed something, I've provided working solutions to each thing that PapaLegaBooBoo has asked for...

  • Start/Stop sound by activator.
  • Play Sound on Player when we stand still for whatever time and a way to Stop that too.

EDIT: Just looked and I missed the xOBSE link on the Nexus OBSE page - so, if anyone resolves StopSound then that's a far better solution.

Link to comment
Share on other sites

I've provided working solutions to each thing that PapaLegaBooBoo has asked for...

 

LOL I pat myself on the back for creating my username. But anyways, I'll download the working example that you provided through Google Drive, and I'll see how it all works. I'll post an update soon. Thanks.

Link to comment
Share on other sites

Here is the working example.

 

Cast the "+Travel SOP Test01" spell, wait till sound plays, walk to other end of hall, wait till the other sound plays.

 

Feel free to message me as I usually only come here when searching for answers.

 

A spell would be out of the question. So far, I've tried using the MoveTo command, as suggested by KatsAwful, in the other thread, but it doesn't seem to work. It goes like this:

ref pSound

Begin OnActivate
  
  if (player.IsRunning == 1)
       let pSound := testSoundRef
       pSound.MoveTo player
       pSound.enable
  else
       let pSound := testSoundRef
       pSound.disable
  endif

end
Edited by PapaLegaBooboo
Link to comment
Share on other sites

I'm a little concerned by the use of "OnActivate" here. OnActivate will only run once every time, not loop, and only when the object itself gets activated by something, that is usually clicked on by the player, attempted to pick up/interact with by an NPC, or directly through a script. But I'm not seeing anything that does. All I'm seeing is an action that's meant to loop in something I don't see looping.

Link to comment
Share on other sites

Hi DrakeTheDragon,

Loop is ticked on the Sound in the editor.
That sound is used for Loop Sound on an Activator.
That Activator is instantiated as Reference and Initially Disabled ticked.
That Reference object is Moved/Enabled or Disabled, in code, 'as and when' per requirements.

In short, simulate PlaySound/StopSound on player, 'as and when'.

As per original request, I did that on Idle-Play, Move-Stop.

PapaLegaBooboo messaged me that the above should be IsInAir which I have working. I've messaged back regarding other requirements.

 

Edit: for anyone who does not know, drag'n'drop a Sound File to create a Sound Reference - that Object can not be moved by code.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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