Trigger on/off

Avatar
Lostprophetpunk
409 Posts
Posted Aug 07, 2011
Heya there,

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.

Advertisement
Registered users don’t see ads! Register now!
Avatar
Rubrica
305 Posts
Posted Aug 07, 2011
Replied 58 minutes later
Just name the trigger and send it inputs on Enable or Disable. That easy! ...I hope. :smile:
Avatar
Vordwann
767 Posts
Posted Aug 07, 2011
Replied 7 hours later
Yes. If you name your trigger "trigger1", here are your outputs from the button. "OnPressed -> trigger1 -> Enable" and "OnUnpressed -> trigger1 -> Disable"
Avatar
iWork925
1,080 Posts
Posted Aug 07, 2011
Replied 4 hours later
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

Avatar
Vordwann
767 Posts
Posted Aug 07, 2011
Replied 1 hour later
Here's my way of doing what you need to do. Pretty simple:

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.

Avatar
iWork925
1,080 Posts
Posted Aug 08, 2011
Replied 6 hours later
Or alternatively you could use math_counter or logic_branches as your supposed to.
Avatar
Lostprophetpunk
409 Posts
Posted Aug 08, 2011
Replied 47 minutes later

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.

Avatar
Vordwann
767 Posts
Posted Aug 08, 2011
Replied 11 hours later
can you PM me the map?
Avatar
Lostprophetpunk
409 Posts
Posted Aug 08, 2011
Replied 13 minutes later
I have fixed it. Just forgot to set the other trigger to 'start disabled'. Completely overlooked this earlier. xD
Avatar
Vordwann
767 Posts
Posted Aug 08, 2011
Replied 5 hours later
Well as long as my elaborate plan worked, that's good :biggrin:
Avatar
synthemesc
13 Posts
Posted Aug 08, 2011
Replied 1 hour later

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.

Avatar
iWork925
1,080 Posts
Posted Aug 09, 2011
Replied 1 hour later
Ok, create two trigger_multiples, on inside of the other or however you used it your way. Create 4 logic_branch's and 2 logic_branch_listener's aswell as the floor_button.

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.

Avatar
WinstonSmith
940 Posts
Posted Aug 09, 2011
Replied 23 minutes later

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.

Avatar
iWork925
1,080 Posts
Posted Aug 09, 2011
Replied 2 hours later
Irrelevant, do it the correct way.
Avatar
Vordwann
767 Posts
Posted Aug 09, 2011
Replied 4 hours later
The (according to you) "incorrect way" consumes less memory in your map and works just as well. Besides, my originally proposed way is very clean.
Avatar
Lostprophetpunk
409 Posts
Posted Aug 09, 2011
Replied 21 minutes later
Alright, that's enough you two. I have the solution to the problem I posted, so therefore it is solved. No need for any arguments in here.
Avatar
Vordwann
767 Posts
Posted Aug 09, 2011
Replied 7 minutes later
You are completely welcome :biggrin:
Avatar
WinstonSmith
940 Posts
Posted Aug 09, 2011
Replied 10 hours later
I know you said you don't want arguments, Lostprophetpunk, but I have to figure out why iWork thinks the logic method is so much better.

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?

Avatar
iWork925
1,080 Posts
Posted Aug 09, 2011
Replied 1 hour later
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.

Advertisement
Registered users don’t see ads! Register now!
Avatar
ForbiddenDonut
142 Posts
Posted Aug 10, 2011
Replied 12 hours later

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.