Trying to make a song swapper on GoldSrc Hammer Created 4 months ago2019-07-01 01:43:15 UTC by puntero puntero

Created 4 months ago2019-07-01 01:43:15 UTC by puntero puntero

Posted 4 months ago2019-07-01 01:43:15 UTC Post #342821
Hello there, I'm new to the forums and the site. Just found it while looking for resources to aid my current problem.

I'm trying to make a button that when its pressed it will switch through a list of songs that I have added to my map (when pressed it plays the 1st song, when pressed again song 1 stops and song 2 plays and so on). There are 6 different custom songs (they all work in-game).
The problem is that, me coming from the Source Engine, GoldSrc doesn't have any logical entities like Source does (which I was aware of) so I can't think of a practical way to make this work.
Does anybody know a method to get my idea to work? Even if it is crazy I'm listening to anybody willing to help.

Thank you!
puntero punteroStudent, learning programming
Posted 4 months ago2019-07-01 08:54:07 UTC Post #342822
use multiple ambient_generics with "start silent" flag and then play around with trigger_changetarget. I done it once, not very hard
Posted 4 months ago2019-07-01 16:32:45 UTC Post #342826
Thanks for the reply! But I'm kinda confused as to how trigger_changetarget works in this spectrum. I know how the entity functions, but I can't seem to get right how to handle a list of songs with it via a button. I have red the Wiki article on the entity, but I'm not quite understanding how to get this going :zonked:

All of the songs are named song1, song2, etc. When the last song is played, it would switch back to the 1st one and back again (like a loop). Problem is, everything is done via 1 button that when pressed it goes up one song, and idk if I'm dumb as hell to not see the solution in front of me or there's something I don't know.
puntero punteroStudent, learning programming
Posted 4 months ago2019-07-01 17:37:10 UTC Post #342827
I'm sorry for double-posting, but I got it working :nuts:

What I did was making 7 multi_manager, each would turn on one of the songs and turn off the other and trigger the trigger_changetarget (also 7 of them). I've named the trigger_changetargets tgt and the multi_manager mm.
When the button is pressed, it triggers mm1 (triggers song1 and tgt1 (changes button's target to mm2)). When its pressed again, it triggers mm2 (triggers song1 to stop it and plays song2, and triggers tgt2 (changes button's target to mm3)). It does this for all 6 songs, then a 7th mm and tgt are added.
When the button is pressed at last, it triggers mm7 (stops song6 and triggers tgt7 (changes button's target back to mm1, repeating the loop))

I figured it out after looking a bit about multi_manager and trigger_changetargets on teleport destinations, it made me think about the situation on a song spectrum. Thanks for the help!
puntero punteroStudent, learning programming
You must be logged in to post a response.