Scripts / A simple way to play several music tracks in a single map

Author
Message
Moshroom
10
Years of Service
User Offline
Joined: 18th Jul 2015
Location: Finland
Posted: 25th Nov 2015 09:51
I noticed that if player runs into two musicinzones, the musics play simultaneously, which sounds cacophonic. Here's a simple solution: Use etc_musicplayer.lua to start music and etc_musicstopper.lua to stop it.

etc_musicplayer.lua


etc_musicstopper.lua


The etc_musicstopper only stop sounds that are coming from etc_musicplayer.

Ps. I'm pretty sure this is not the only way to do it, but at least it's the simplest way that came into my mind.
Yogendra
10
Years of Service
User Offline
Joined: 19th Sep 2015
Location: Rajasthan,India
Posted: 3rd Dec 2015 10:40
thanks for it
AceRimmer
Reviewed GameGuru on Steam
11
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 3rd Dec 2015 18:39
nice - thanks very much
Pirate Myke
Forum Support
16
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th Dec 2015 13:01
Thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

HarryWever
3D Media Maker
16
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 12th Dec 2015 15:14
Thats very handy... thank you for this

Harry
Harry
PM
Pirate Myke
Forum Support
16
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 18th Dec 2015 12:48
I am trying to incorporate these scripts with your RPG scripts and notice that these work on an empty map just fine.
But when I get them into the level with your RPG menu savepoint as the main rpg script, These will just keep starting the next music and not stop the last.

I notice the FLAG_MUSIC for use with your RPG scripts, Do I need to change that setting?

Thanks
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Pirate Myke
Forum Support
16
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 19th Dec 2015 16:18
Ok, I got it working with your RPG mode, But I had to change these lines as follows:

Commented out the global
--NUM_COUNTERS = 999

And changed this.


The reason I did this is that the --NUM_COUNTERS = 999 would never match the entity number, therefore never matching it in RPG menu script. I was getting entity number of 17581 for the sounds zones, because I added them last in the level.
Once I changed the for do upper count number to 99999 then it worked perfect.

May not work as you intended, but I am good with it as modified.

Still interested in the intended use of this stuff in the etc_musicplayer script and your RPG scripts. Do let me know on that.
-- Define flags to communicate with the RPG scripts
FLAG_MUSIC = 1

IsPlayer = {}

Thanks for making the scripts they really add a new level to the game engine.

The scripts work flawless without the use of the RPG scripts as they were on a testmap.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

smallg
Community Leader
20
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 19th Dec 2015 17:26
you could have just changed NUM_COUNTERS = 99999

i dont see FLAG_MUSIC actually used in either of those scripts (just the global) so it wouldn't change anything here, probably just a variable he was thinking about adding to work with his other script(s) and didn't need.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, AMD R9 200 series , directx 11
Pirate Myke
Forum Support
16
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 19th Dec 2015 20:02
I did change the number to 99999 in the script, but it would not read over 999 in the level with the RPG menu in it. messed with it for a day till I started setting up prompts for debug, then I found that out. But thank you.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2026-06-05 07:02:31
Your offset time is: 2026-06-05 07:02:31