Trigger on/off
I was wondering if there was a way I could set up a trigger (which I know how to do). but have it enabled/disabled depending on if a box is on a button?
I need the trigger to play a line from Glados (I know where to get the lines).
This is because I want to play a different line from Glados depending on if the player has the cube on the button.
OnButtonPress > math_counter > Add > 1
OnTrigger > math_counter > Add > 1
OnHitMax > ...play glados line... however you do that
1) Make the button.
2) Make two triggers in the same place named (example) glados1trigger and glados2trigger and make the first one start enabled, while the second starts disabled (if you want the sound to play more than once, every time the player goes into it, make it a trigger multiple, if you want it to play once, make it a trigger_once)
3) Make the outputs for the button:
- OnPressed - glados1trigger - enable
- OnPressed - glados2trigger - disable
- OnUnpressed - glados1trigger - disable
- OnUnpressed - glados2trigger - enable
4) Next, make 2 ambient_generic entities, with the flags "start silent" and "play everywhere" checked. Put your glados line for when the button is not pressed in the ambient_generic called (example) gladosline1 and the line for when the button is pressed in an ambient_generic called (example) gladosline2.
5) Here are the outputs for your triggers:
Glados1trigger:
- OnTrigger - gladosline1 - PlaySound
Glados2trigger:
- OnTrigger - gladosline2 - PlaySound
That's how you do it in the simplest way possible. I hope that helps, and if it doesn't, just ask for more help.
iWork925 wrote:
This might be solved better if you use a math_counter or logic_branches then the disabled/enable thingo.OnButtonPress > math_counter > Add > 1
OnTrigger > math_counter > Add > 1
OnHitMax > ...play glados line... however you do that
I need the trigger to disable/enable dependant on the button being pressed or not. Then when the player passes through the first trigger (when button is not pressed) it plays a sound, then when the button is pressed I need that first trigger to enable and when the player passes through, play another sound.
@Vordwann - I set it up exactly how you described, however when the button is not pressed, it plays both sounds. When the button is pressed it plays nothing.
I have checked and re-checked my outputs and names etc on everything, to make sure it's correct. I don't know why it's playing both the sounds when the button is unpressed, and nothing when it is.
iWork925 wrote:
Or alternatively you could use math_counter or logic_branches as your supposed to.
I'm not trying to be combative, just curious, but why do you insist that your way is the correct way to do it when the other way described in this thread works just fine? I've personally always done it this way and never had any issues.
I haven't even seen it done your way in Valves maps, at least, in the maps I've looked at. What's the benefit in your way? I'm always willing to adapt to new, better ways of doing things.
floor_button:
OnPressed > logic_branch_1 > SetValue > 1
OnPressed > logic_branch_2 > SetValue > 0
OnUnpressed > logic_branch_1 > SetValue > 0
OnUnpressed > logic_branch_2 > SetValue > 1
trigger_multiple_1:
OnStartTouch > logic_branch_3 > Setvalue > 1
OnEndTouch > logic_branch_3 > Setvalue > 0
trigger_multiple_2:
OnStartTouch > logic_branch_4 > Setvalue > 1
OnEndTouch > logic_branch_4 > Setvalue > 0
logic_branch_listener_1:
Logic Branch's = logic_branch_2, logic_branch_3
OnAllTrue > play_glados_sound_1
logic_branch_listener_2:
Logic Branch's = logic_branch_1, logic_branch_4
OnAllTrue > play_glados_sound_2
As for why you should do it this way, you should because you should. You can drive a car with your feet but that doesnt make it a good idea.
iWork925 wrote:
As for why you should do it this way, you should because you should.
Ahh, the circuital logic hurts.
iWork925 wrote:
You can drive a car with your feet but that doesnt make it a good idea.
Except that in this case--if I've got your analogy correctly mapped--driving with your feet is simpler. The logic method uses eight entities, Vordwann's uses two. Not to mention the fact that the logic method requires a fair bit more I/O work than Vordwann's method.
iWork925 wrote:
Irrelevant, do it the correct way.
As Vordwann's stated, what you've implied is the incorrect way is simpler and more efficient. How is what I said irrelevant? And do tell, why is the logic method the "correct" way?
As for why I said irrelevant, is was just joking but now I have seen you all got butthurt Ill stop. I was my hands of this thread. Good day gentlement.
iWork925 wrote:
The trigger/enable disable method is not always acurate and the logic method is easier if you have to change something.As for why I said irrelevant, is was just joking but now I have seen you all got butthurt Ill stop. I was my hands of this thread. Good day gentlement.
What are you, five? All you do is spark arguments and throw around cruddy insults.