Random song of choosing on load?
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- Armaetus
- Posts: 1256
- Joined: Fri Mar 13, 2009 3:55 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 10 Home
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Location: New York State
- Contact:
Random song of choosing on load?
Say I want to make a music WAD with multiple renditions of the same song (IE D_RUNNIN, D_RUNNI2, D_RUNNI3, D_RUNNI4, etc) but want the game to randomly choose one of those and loop it for the duration of the level and repeat the same with the next track (D_STALKS, STLKS2-4, etc)
Is this possible?
Is this possible?
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: Random song of choosing on load?
Probably with an ACS ENTER script of some type that checks the current map number and chooses from an array of song lump titles.
- Xeotroid
- Posts: 448
- Joined: Sat Jun 23, 2012 7:44 am
- Graphics Processor: nVidia with Vulkan support
- Location: Czech Rep.
Re: Random song of choosing on load?
I didn't test this script, but you could try if it works. This picks from 3 random music tracks for each of 4 maps. I don't know how to get around the switch/case block because afaik, ACS can't mix two different strings together.
Spoiler:
-
- Posts: 35
- Joined: Wed May 07, 2008 2:54 am
Re: Random song of choosing on load?
You don't need to concatenate strings. I tested this version.Xeotroid wrote:I don't know how to get around the switch/case block because afaik, ACS can't mix two different strings together.
Spoiler:
Re: Random song of choosing on load?
Why is this an enter script for a global, non-player, action? This is what open scripts are for.
- Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
- Contact:
Re: Random song of choosing on load?
To be fair, it could also be fixed with LocalSetMusic instead of SetMusic, too. That'd mean each player gets to roll for which music file is used, instead of all of them using the same one.
-
- Posts: 35
- Joined: Wed May 07, 2008 2:54 am
Re: Random song of choosing on load?
I tried that. It didn't change the music.edward850 wrote:Why is this an enter script for a global, non-player, action? This is what open scripts are for.
I didn't think of LocalSetMusic().
Re: Random song of choosing on load?
Really? Because it works perfectly fine. Why would it not work?
-
- Posts: 35
- Joined: Wed May 07, 2008 2:54 am
Re: Random song of choosing on load?
Turns out using "open" works with SetMusic(), but not LocalSetMusic(). That was my mistake when I changed two things at the same time and didn't pay enough attention.
Last edited by Aliotroph? on Mon Jun 01, 2015 4:37 am, edited 1 time in total.
-
- Posts: 35
- Joined: Wed May 07, 2008 2:54 am
Re: Random song of choosing on load?
Yeah, I forgot I changed that one. I then stared at the two otherwise superficially different versions of the script for a while and didn't see my mistake. Dumb.