Please or Register to create posts and topics.

multiple outputs based on conditions

Page 1 of 2Next

I have all the questions today :P
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

- Science isn't about why, it's about why not!

First of all, how would this relate to portal if it needs to detect 4players?

My YouTube Channel: https://www.youtube.com/user/Camben24
Aperture Science: We do our science asbestos we can!

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.

ImageImage

OnStartTouch > counter > Add > 1.
OnEndTouch > counter > Subtract > 1.
OnHitMax > do something.

Falsi sumus crusto!
CamBen wrote:
First of all, how would this relate to portal if it needs to detect 4players?

Like this

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... :P

- Science isn't about why, it's about why not!
lord_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 > 1

Button

OnPressed > counter_2 > Add > 1
OnUnPressed > counter_2 > Subtract > 1

______________________________

Counter #2
OnHitMax > do something

BRANCH MONITORING

Spoiler
Using the logic_branch and logic_branch_listener entities,
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

Spoiler
Using the coop_manager entity,
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

ImageImage

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 :P

- Science isn't about why, it's about why not!

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.

ImageImage

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?

- Science isn't about why, it's about why not!

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).

ImageImage
Page 1 of 2Next