trying to randomize player usefail sound

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
Jerry_Bambo
Posts: 4
Joined: Fri Oct 31, 2025 10:51 am
Preferred Pronouns: He/Him
Operating System Version (Optional): windows T3N
Graphics Processor: ATI/AMD (Modern GZDoom)

trying to randomize player usefail sound

Post by Jerry_Bambo »

I have 15 ogg audio files for different things my character will say when hitting the walls for secrets.

I tried talking to Microsoft Copilot first, about how to do this.


I also checked this other forum :
viewtopic.php?t=65569

I typed this code in my sndinfo.txt , but I can't get random sounds for when the player presses use at random walls. The AI chatbots I talked to don't seem to know how to do this. Perhaps a human computer wizard in these data forums can help me out?

Code: Select all

$playersound	player	male	*usefail	TRYDOOR
$playersound	player	other	*usefail	TRYDOOR

$random player/usefail

{ TRYDOOR TRYDOOR
  TRYDOR01 TRYDOR02 TRYDOR03
  TRYDOR04 TRYDOR05 TRYDOR06
  TRYDOR07 TRYDOR08 TRYDOR09
  TRYDOR10 TRYDOR11 TRYDOR12
  TRYDOR13 TRYDOR14 TRYDOR15
  TRYDOR16 TRYDOR17 TRYDOR18
  TRYDOR19 TRYDOR20 TRYDOR21
}

TRYDOR01 TRYDOR01
TRYDOR02 TRYDOR02
TRYDOR03 TRYDOR03
TRYDOR04 TRYDOR04
TRYDOR05 TRYDOR05
TRYDOR06 TRYDOR06
TRYDOR07 TRYDOR07
TRYDOR08 TRYDOR08
TRYDOR09 TRYDOR09
TRYDOR10 TRYDOR10
TRYDOR11 TRYDOR11
TRYDOR12 TRYDOR12
TRYDOR13 TRYDOR13
TRYDOR14 TRYDOR14
TRYDOR15 TRYDOR15
TRYDOR16 TRYDOR16
TRYDOR17 TRYDOR17
TRYDOR18 TRYDOR18
TRYDOR19 TRYDOR19
TRYDOR20 TRYDOR20
TRYDOR21 TRYDOR21

EDIT : yes I originally typed $random TRYDOOR or $random TRYDOR01 instead of player/usefail. I was trying different ways of typing it, AI advice gave me,
User avatar
Enjay
 
 
Posts: 27290
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: trying to randomize player usefail sound

Post by Enjay »

I'm making no guarantees here because the player sound definitions always catch me out, but I *think* it would work if you alias the names and allocate the random sound to the alias:

Code: Select all

$playeralias 	player 	male 	*usefail 	TRYDOORMASTER
$playeralias 	player 	other 	*usefail 	TRYDOORMASTER

$random TRYDOORMASTER

{ TRYDOOR TRYDOOR
  TRYDOR01 TRYDOR02 TRYDOR03
  TRYDOR04 TRYDOR05 TRYDOR06
  TRYDOR07 TRYDOR08 TRYDOR09
  TRYDOR10 TRYDOR11 TRYDOR12
  TRYDOR13 TRYDOR14 TRYDOR15
  TRYDOR16 TRYDOR17 TRYDOR18
  TRYDOR19 TRYDOR20 TRYDOR21
}

TRYDOR01 TRYDOR01
TRYDOR02 TRYDOR02
TRYDOR03 TRYDOR03
TRYDOR04 TRYDOR04
TRYDOR05 TRYDOR05
TRYDOR06 TRYDOR06
TRYDOR07 TRYDOR07
TRYDOR08 TRYDOR08
TRYDOR09 TRYDOR09
TRYDOR10 TRYDOR10
TRYDOR11 TRYDOR11
TRYDOR12 TRYDOR12
TRYDOR13 TRYDOR13
TRYDOR14 TRYDOR14
TRYDOR15 TRYDOR15
TRYDOR16 TRYDOR16
TRYDOR17 TRYDOR17
TRYDOR18 TRYDOR18
TRYDOR19 TRYDOR19
TRYDOR20 TRYDOR20
TRYDOR21 TRYDOR21
Maybe.

Note, there is nothing special about the name TRYDOORMASTER. I just made that up because it seemed to fit. You could call it anything you like.
Jerry_Bambo
Posts: 4
Joined: Fri Oct 31, 2025 10:51 am
Preferred Pronouns: He/Him
Operating System Version (Optional): windows T3N
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: trying to randomize player usefail sound

Post by Jerry_Bambo »

nah that didn't work. GZDoom is still only playing one sound, not randomizing them. It either plays "DSNOWAY" or the "trydor" sound i made, but only one the whole time, none of the others

I thought this would be simple because I made so many random sounds for fun projects but I just never happened to try this one yet. I didn't know it would be so strangely complicated. The AI's don't know how to do it. they knew everything about GZDoom. How odd
User avatar
Enjay
 
 
Posts: 27290
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: trying to randomize player usefail sound

Post by Enjay »

Are you sure?

I just tried this simplified version of what I posted and it worked perfectly - whenever I used a wall, it randomly picked one of the built-in Doom chat sounds.

Code: Select all

$playeralias 	player 	male 	*usefail 	TRYDOORMASTER
$playeralias 	player 	other 	*usefail 	TRYDOORMASTER

$random TRYDOORMASTER { TRYDOR01 TRYDOR02 }

TRYDOR01 dsradio
TRYDOR02 dstink
Note, that's the entirety of the SNDINFO that I used. I did not redefine the *usefail sound like the first line of your code does. That may, or may not be important.
Jerry_Bambo
Posts: 4
Joined: Fri Oct 31, 2025 10:51 am
Preferred Pronouns: He/Him
Operating System Version (Optional): windows T3N
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: trying to randomize player usefail sound

Post by Jerry_Bambo »

I am still only getting one sound. It is not randomizing the other sounds. It just uses whatever sound is next to the usefail section.

I do have a new player, named StarkFox, with a keyconfig clearing player classes and replacing the doom player. But I already tried typing the player name in the sndinfo next to $playeralias.

There seems to be some incorrect way I'm typing something.

Is there any way to change the usefail sound in the player DECORATE code ? Any way is fine if it works
User avatar
Enjay
 
 
Posts: 27290
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: trying to randomize player usefail sound

Post by Enjay »

I'm not sure what's going on with your setup, because the SNDINFO I posted is working perfectly for me:


OK, it sounds weird, but it's doing what it's meant to.

I have also tried it with a custom player class. It worked fine too.

Have you tried it with the Doom default player class just to see if it works? If it does, then we know that it's your player class somehow.

There is the Player.SoundClass parameter that you can specify when defining a class. However, it defaults to "player". So, unless you've changed it, it should be fine. ( There isn't much detail, but you can read about it here: https://zdoom.org/wiki/Classes:PlayerPawn )
Jerry_Bambo
Posts: 4
Joined: Fri Oct 31, 2025 10:51 am
Preferred Pronouns: He/Him
Operating System Version (Optional): windows T3N
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: trying to randomize player usefail sound

Post by Jerry_Bambo »

Enjay wrote: Sat Nov 01, 2025 4:32 pm

Have you tried it with the Doom default player class just to see if it works? If it does, then we know that it's your player class somehow.

There is the Player.SoundClass parameter that you can specify when defining a class. However, it defaults to "player".

So, unless you've changed it, it should be fine.

( There isn't much detail, but you can read about it here: https://zdoom.org/wiki/Classes:PlayerPawn )
I haven't tried that yet, I will see if the default works without changing the player class
Post Reply

Return to “Scripting”