Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
hardcore_gamer

I want my script to play a sound, but it the sound loops instead of only playing once

Recommended Posts

EDIT: Oh common! Nobody knows? I have been browsing the zdoom wiki for hours trying to figure this out wit no success :(

But I now have a new problem, how can I make the sound stop? It just loops over and over again!

How can I make it so that it only plays once and then stops?

So I am trying to figure out how to use sounds effects with zdoom for the first time and I have run into problem.

Basically, I made a map with a switch (just a single box room for testing purposes) and then I made a script that is suppose to fire when the switch is pressed and trigger a sound.

Here is the script:

-----------------------------------------
#include "zcommon.acs"

script 1 (void)
{

ActivatorSound("world/heart", 127);

}

--------------------------------------------


And here is the text in put into the SNDINFO lump and SNDSEQ lump withing the WAD file itself:

SNDINFO: world/heart tsounds

SNDSEQ:

:testsound
play tsound
volume 127
end

The actual sound file that is suppose to play is a wav file and it is named tsound.

When I start the map and press the switch that is suppose to trigger the script nothing happens.

What Am I doing wrong exactly?

EDIT: I know what is wrong now, the word "heart" in the script should be "tsound". However, Now the sounds loops endlessly and never stops! How can I prevent that from happening?

Share this post


Link to post

I'm not sure if you even need a SNDSEQ entry. Once a sound lump is mapped to a text string in SNDINFO, SNDSEQ doesn't need defining if it is not a part of a sequence, like a lift or door (start sound, moving sound, end sound).

Share this post


Link to post

Yeah. No SNDSEQ needed for that purpose.

I did have problems with uncontrolled looping sounds, but that was in Quake. Some imported sounds were always looping when started, even if my command wasn't of ambient sound.

Share this post


Link to post
printz said:

Yeah. No SNDSEQ needed for that purpose.

I did have problems with uncontrolled looping sounds, but that was in Quake. Some imported sounds were always looping when started, even if my command wasn't of ambient sound.

Mista_T said:

I'm not sure if you even need a SNDSEQ entry. Once a sound lump is mapped to a text string in SNDINFO, SNDSEQ doesn't need defining if it is not a part of a sequence, like a lift or door (start sound, moving sound, end sound).


Oh! Ok.

So how would a simple script that would make the switch on the wall play a single sound look like?

Share this post


Link to post

If the sound lump in the Wad in named "TSOUND"...

In SNDINFO:

world/heart    tsound
Your script:
script 1 (void)
{
    ActivatorSound("world/heart", 127);
    }
The name of the lump is referenced in SNDINFO.
The name of the SNDINFO entry is referenced in ACS.

Share this post


Link to post
Mista_T said:

If the sound lump in the Wad in named "TSOUND"...

In SNDINFO:

world/heart    tsound
Your script:
script 1 (void)
{
    ActivatorSound("world/heart", 127);
    }
The name of the lump is referenced in SNDINFO.
The name of the SNDINFO entry is referenced in ACS.


But would the sound only play once or would it loop?

Share this post


Link to post

I do things slightly differently from mista_T. In your ACS script, I have used:

script 1 (void)
{
    AmbientSound("world/heart", 127);
    }
instead of
script 1 (void)
{
    ActivatorSound("world/heart", 127);
    }
has worked for me. I don't know the difference between the two commands, but try it and see what happens.


But that said, I have had the same problem as you. Most sounds work fine like this, but there are some sounds that I have come across that will just loop over and over all by themselves, and I have never been able to figure out why.

Unless it is something in the sound itself. These sounds will loop over and over even if you just play them in SlumpED in their natural .WAV format.

SO I am curious to see if anyone else knows why this is too.

Share this post


Link to post

The only other thing I can think of as to why the sound would loop is that sometimes WAV files have a set of flags that tell a bunch of sound mixers to loop a sample rather than play it once. I think Quake's mixer obeys this flag and so does FMOD.

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×