multiple outputs based on conditions
Quote from lord_blex on March 29, 2013, 12:36 amI have all the questions today
What I want to achieve is: If I press a button and there are at least 4 (yep, 4) players in an area, it should fire a relay, and if there are less, trigger another. How do I do this?
I've been messing around with counters and stuff, but didn't get anywhere... Thanks
I have all the questions today
What I want to achieve is: If I press a button and there are at least 4 (yep, 4) players in an area, it should fire a relay, and if there are less, trigger another. How do I do this?
I've been messing around with counters and stuff, but didn't get anywhere... Thanks
Quote from CamBen on March 29, 2013, 1:36 amFirst of all, how would this relate to portal if it needs to detect 4players?
First of all, how would this relate to portal if it needs to detect 4players?
Aperture Science: We do our science asbestos we can!
Quote from srs bsnss on March 29, 2013, 2:24 amWell, 'trigger_playerteam' and a 'math_counter' (or 'logic_coop_manager') works well for 2 players. But I don't think there's a way to do it with four.
Well, 'trigger_playerteam' and a 'math_counter' (or 'logic_coop_manager') works well for 2 players. But I don't think there's a way to do it with four.
Quote from FelixGriffin on March 29, 2013, 8:10 amOnStartTouch > counter > Add > 1.
OnEndTouch > counter > Subtract > 1.
OnHitMax > do something.
OnStartTouch > counter > Add > 1.
OnEndTouch > counter > Subtract > 1.
OnHitMax > do something.
Quote from lord_blex on March 29, 2013, 8:37 amCamBen wrote:First of all, how would this relate to portal if it needs to detect 4players?FelixGriffin wrote:OnStartTouch > counter > Add > 1.
OnEndTouch > counter > Subtract > 1.
OnHitMax > do something.Yeah, I got this far. What I can't figure out is that after the counter has maxed out, I need to check if the button is pressed. Or the other way around: if the button is pressed, I need to know if there are at least 4 players.
Seriously there isn't a way to decide if a statement is true or false?
I was actually thinking about this yesterday dawn, so I couldn't really think properly, but I was trying to do it with a second counter, but something felt off about it. If there are no other ideas, I guess I'll look at it again.EDIT: I could do two buttons for both outcomes and enable-disable them using the player counter. How haven't I thought of this before? I guess next time I shouldn't try to do productive stuff after midnight...
OnEndTouch > counter > Subtract > 1.
OnHitMax > do something.
Yeah, I got this far. What I can't figure out is that after the counter has maxed out, I need to check if the button is pressed. Or the other way around: if the button is pressed, I need to know if there are at least 4 players.
Seriously there isn't a way to decide if a statement is true or false?
I was actually thinking about this yesterday dawn, so I couldn't really think properly, but I was trying to do it with a second counter, but something felt off about it. If there are no other ideas, I guess I'll look at it again.
EDIT: I could do two buttons for both outcomes and enable-disable them using the player counter. How haven't I thought of this before? I guess next time I shouldn't try to do productive stuff after midnight...
Quote from srs bsnss on March 29, 2013, 9:08 amlord_blex wrote:What I can't figure out is that after the counter has maxed out, I need to check if the button is pressed. Or the other way around: if the button is pressed, I need to know if there are at least 4 players.That's simply an AND gate.
An AND gate can be done in 3 ways (in Hammer):Counter Layering
[spoiler]Counter #1:OnHitMax > counter_2 > Add > 1
OnChangedFromMax > counter_2 > Subtract > 1Button
OnPressed > counter_2 > Add > 1
OnUnPressed > counter_2 > Subtract > 1______________________________
Counter #2
OnHitMax > do something[/spoiler]BRANCH MONITORING
[spoiler]Using the logic_branch and logic_branch_listener entities,
Counter #1:OnHitMax > branch_1> SetValue> 1
OnChangedFromMax > branch_1 > SetValue > 0Button
OnPressed > branch_2 > SetValue > 1
OnUnPressed > branch_2 > SetValue > 0______________________________
Logic Branch Monitor
Logic Branch 01: branch_1
Logic Branch 02: branch_2OnAllTrue > Do something
OnMixed/AllFalse > Don't do something[/spoiler]COOP MANAGING
[spoiler]Using the coop_manager entity,
Counter #1:OnHitMax > coop_manager> SetStateATrue
OnChangedFromMax > coop_manager > SetStateAFalseButton
OnPressed > coop_manager > SetStateBTrue
OnUnPressed > coop_manager > SetStateBFalse______________________________
Coop Manager
OnAllTrue > Do something
OnMixed/AllFalse > Don't do something[/spoiler]Those all work for what (it seems) you're trying to do.
EDIT: You can also look at this diagram
|
|
V
That's simply an AND gate.
An AND gate can be done in 3 ways (in Hammer):
Counter Layering
OnHitMax > counter_2 > Add > 1
OnChangedFromMax > counter_2 > Subtract > 1
Button
OnPressed > counter_2 > Add > 1
OnUnPressed > counter_2 > Subtract > 1
______________________________
Counter #2
OnHitMax > do something
BRANCH MONITORING
Counter #1:
OnHitMax > branch_1> SetValue> 1
OnChangedFromMax > branch_1 > SetValue > 0
Button
OnPressed > branch_2 > SetValue > 1
OnUnPressed > branch_2 > SetValue > 0
______________________________
Logic Branch Monitor
Logic Branch 01: branch_1
Logic Branch 02: branch_2
OnAllTrue > Do something
OnMixed/AllFalse > Don't do something
COOP MANAGING
Counter #1:
OnHitMax > coop_manager> SetStateATrue
OnChangedFromMax > coop_manager > SetStateAFalse
Button
OnPressed > coop_manager > SetStateBTrue
OnUnPressed > coop_manager > SetStateBFalse
______________________________
Coop Manager
OnAllTrue > Do something
OnMixed/AllFalse > Don't do something
Those all work for what (it seems) you're trying to do.
EDIT: You can also look at this diagram
|
|
V
Quote from lord_blex on March 29, 2013, 10:51 amThank you, this seems helpful
I still have one problem though. I just realized, that the counter caps at the max value, right? So if the value is already 4, it can't go up one more. Which is all fine, if you play the map in ideal circumstances. But if let's say there are 5 players total in the map and they all enter the trigger, the counter caps at 4. Then one player exits and it will say 3, but there are still 4 players there..
I'm just making this more and more complicated
Thank you, this seems helpful
I still have one problem though. I just realized, that the counter caps at the max value, right? So if the value is already 4, it can't go up one more. Which is all fine, if you play the map in ideal circumstances. But if let's say there are 5 players total in the map and they all enter the trigger, the counter caps at 4. Then one player exits and it will say 3, but there are still 4 players there..
I'm just making this more and more complicated
Quote from srs bsnss on March 29, 2013, 11:16 amHmm...well, I think there's 2 ways:
1. Simply make the Max Value 5. Of course, this assumes there's SUPPOSED to be 5 players in the trigger. If there's meant to be one on a button or something, then this wouldn't work.
2. Maybe these settings on the button?
OnPressed > Counter > SetMaxValue > 4 > Delay 0.1
OnUnPressed > Counter > SetMaxValue> (something unattainable, e.g. 10)Theoretically, changing the MaxValue with the button means it won't fire the output until it has the correct conditions.
Hmm...well, I think there's 2 ways:
1. Simply make the Max Value 5. Of course, this assumes there's SUPPOSED to be 5 players in the trigger. If there's meant to be one on a button or something, then this wouldn't work.
2. Maybe these settings on the button?
OnPressed > Counter > SetMaxValue > 4 > Delay 0.1
OnUnPressed > Counter > SetMaxValue> (something unattainable, e.g. 10)
Theoretically, changing the MaxValue with the button means it won't fire the output until it has the correct conditions.
Quote from lord_blex on March 29, 2013, 1:35 pmThanks, I could only test it alone (2 player splitscreen) but it seems to be working fine.
I also did an "else-thingy" (a relay which activates if you press the button and there aren't enough players in the area) with another counter, it seems to be working as well. I almost started asking about it, but as I started to write the question, I figured out how to do it.On a sort of related note: How do I get game_text work properly in multiplayer? It only shows up for one player, even if I set the all players flag. (still on splitscreen, but I assume it's no different in actual online multiplayer)Or should I use another entity?
Thanks, I could only test it alone (2 player splitscreen) but it seems to be working fine.
I also did an "else-thingy" (a relay which activates if you press the button and there aren't enough players in the area) with another counter, it seems to be working as well. I almost started asking about it, but as I started to write the question, I figured out how to do it.
On a sort of related note: How do I get game_text work properly in multiplayer? It only shows up for one player, even if I set the all players flag. (still on splitscreen, but I assume it's no different in actual online multiplayer)Or should I use another entity?
Quote from srs bsnss on March 30, 2013, 1:20 amMaybe try 'env_message'? Though the game_text can be a bit deceptive in split-screen because it will only show for the primary player, which means it may actually be working.
EDIT: Nevermind, env_message doesn't work (as far as I know).
Maybe try 'env_message'? Though the game_text can be a bit deceptive in split-screen because it will only show for the primary player, which means it may actually be working.
EDIT: Nevermind, env_message doesn't work (as far as I know).