How to make sounds NOT loop (like a death cry)

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

How to make sounds NOT loop (like a death cry)

Post by Hidden Hands »

I have pasted my code below. This is an animation that happens in a scene and the problem I have is that the sounds used with "A_PlaySound" keep looping. How do I make them play and stop, like a demons death cry? Also, sounds cut off previous ones. Can I fix this?

Code: Select all

ACTOR DemonKillsDonnie 2222
{
//$Category Apparition
//$Title DemonKillsDonnie
//$Sprite DEXEC0
    Scale 0.7
    Renderstyle "Normal"
    Height 60
	Mass 40
    +SOLID
    States
	{
	Spawn:
    DAPR A 8
    DAPR B 8
    DAPR C 8
    DAPR D 15
    DEXE A 8
    DEXE B 8
    DEXE C 8 A_PlaySound ("Gore/Slash", CHAN_VOICE, 0.7, 1, ATTN_STATIC, 0)
    DEXE D 8 A_PlaySound ("Gore/Drop1", CHAN_VOICE, 0.7, 1, ATTN_STATIC, 0)
    DEXE E 8 
    DEXE F 8
    DEXE G 8
    DEXE H 8
    DEXE I 8 A_PlaySound ("Gore/Drop2", CHAN_VOICE, 0.7, 1, ATTN_STATIC, 0)
    DEXE J 8
    DEXE K -1
    Stop
	}
}
User avatar
Caligari87
Admin
Posts: 6174
Joined: Thu Feb 26, 2004 3:02 pm
Preferred Pronouns: He/Him
Contact:

Re: How to make sounds NOT loop (like a death cry)

Post by Caligari87 »

Check your parameters [wiki]A_PlaySound[/wiki]

8-)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: How to make sounds NOT loop (like a death cry)

Post by Graf Zahl »

Also, use A_StartSound which has clearer parameters than A_PlaySound.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: How to make sounds NOT loop (like a death cry)

Post by ramon.dexter »

Hidden Hands, are you checking the wiki when you encounter a problem, or do you head straight here, without trying to solve the problem by yourself? This issue could be 100% solved by yourself, if you just opened the wiki and pasted the A_playsound there.

Also, are you using slade to edit the actor definitions? If so, you dont even need to head to wiki, slade shows you the functions parameters, so again, you should be able to solve it by careful check...

The sound is looping, because you told the function to make it looping. Copied the code somewhere, don't you?
Post Reply

Return to “Scripting”