Jump to content

Toggleable music


Recommended Posts

I'm making a map with a switch designed to change the entire theme and atmosphere, by activating some doors, func_walls, and such. I have two valid song files for each of these switch states, but I can't seem to find a way to apply both of them effectively. I'm afraid this is impossible, but I'd like to consult here before giving up or devising an incredibly ineffective method. Is it possible to create a toggle-able (looping included) global sound file? If so, how?

Link to comment

Whoa, I completely missed that. Is there a way to invert the input so one can start off, and one trigger switches between them? It switches automatically if the worldspawn music is set as one, but it won't switch back.

Whenever you target one, the current music stops and the new one starts looping.

Link to comment

That doesn't work if I only have one trigger for on/off. It has to target one, both, or none, not one at a time. The only way to branch off into separate alternating inputs I can find is target_randoms or target_relays with the random key (By the descriptions they work the same way). However that's random, and so I gather it won't reliably alternate.

 

Then again I could be missing something obvious again.

Link to comment

You'd simply need a somewhat more elaborate setup of target_activates and target_deactivates - or a script, which has the benefit of keeping the entity count down.

Here's the entity solution:

ay9Pr.jpg

you just target the bottom relays to switch music. The entity tower will then trigger one of the groups of entities and then deactivate one relay, and activate another, to make it trigger the other group of entities next time you target the system.

Link to comment

Thanks for the help, that picture really seemed like it would work. Really. I can't see any flaws in it. It's really clear and easy to see how it works.

 

The trigger toggles the bottom two, m0 (cropped out of the 2d view, sorry)

which goes to the second two, m1 and m2. m1 has the 'inactive' box checked.

Both sides have an activator, targeting the other side's relay, a deactivator targeting its own relay, and a music file.

Two possibilities attempted:

 

1. m1 targets the three entities titled music1. m2 targets the three entities named music2.

Result: Each time I press the button, music2's file restarts.

 

2. m1 targets music1, and applies target2 and target3 to m1a and m1d. m2 has the same, but with music2, m2a, and m2d.

Result: First press activates music2's music, every subsequent press does nothing.

 

In the latter I switched the order of target2 and target3, thinking it was important whether it hit the deactivator or activator first, but there was no change. I've checked, re-checked, and re-re-checked all the targets and targetnames and entity types to make sure everything is in order.

tree.png

Link to comment

@@Naythan okay, cracked it. This is slightly crazy. Basically, what was happening, was whenever you pressed the button, it would send a "pulse" up both the relay lines. As we go up the first line, we play the music and also activate the other relay. Our "pulse" would still be live on the other relay line when it was activated, so it would actually set off the first music, and instantly unlock, and set off the second music.

 

My fix for this was to add a target_delay before each of the target_activates. Ensuring that our "pulse" had finished before the second relay was activated. Only downside is if you try to toggle the music again before the target_delay is over, it wont do anything. Wont break it though.

Link to comment

I think the easiest way is 2 triggers pointing to separate music changers and then have the activates and deactivates alternate the active trigger each time it is used.

That's kinda exactly what we have already done at length =P

Link to comment

You've proven me wrong by doing what exactly? I never said what you are doing cant be done strictly with entities. I was saying a script would have been much simpler, and used less entities.

 

I'm not saying I've proven you wrong. I was bringing to light your obvious contradiction in this post. You said that some things won't work without icarus. Right after that, you said it's fun to prove people wrong who say something won't work. So you inadvertently said it's fun to prove yourself wrong. Is that clear now?

Link to comment

I cant help but think if they were more reliable everything would have been scripted. However from many coder posts here it does appear Raven are somewhat lax in their work ethic :P

 

Ive never had any problems with entity setups but scripts (performing the same actions) occasionally throw up silly problems for no good reason. Just my two cents.

Link to comment

Somehow this off-topic argument brought me out of lurk mode o.o...

 

1. Simplest way to make a toggle using entities (or otherwise) is to use a proxy func_door :P

2. Entity limit isn't an issue unless you know you're going to approach it... if you know your map will never use enough ents to get there, then there is some wisdom to NOT using scripts because it will introduce unnecessary modularizations (people with engineering degrees are allowed to make up words!) to your map content, which increases the risk of incompatibility or other issues and also makes development versioning a tad trickier to keep track of.

3. Effective scripting DOES make things easier, especially for large event sequences, and having mental access to the logical basis of scripting lets you think more efficiently and may increase development productivity... if you are intending to utilize such complexities to begin with.

 

In other words, personal preference :) .

 

inb4lock :ph34r:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...