Help with some logic stuff.

  • If you're asking a question make sure to set the thread type to be a question!

FrekyD

L1: Registered
May 30, 2009
3
0
I'm making a soccer type map, in which when a goal is scored 1 point is added into a math_counter. There are two separate math_counters: One for Blue, and One for Red. What I'm trying to accomplish is for the map to compare the two values at the end of the round, and whichever teams counter is higher, that team wins. I'm familiar with entities, but this is a little confusing. Anybody able to help? Thanks.
 
Last edited:

Artesia

L6: Sharp Member
Nov 11, 2008
278
72
I always have problems with the damn compare entity... so what I do for things like this is...

have another math counter
when red scores, add one to this counter
when blu scores, subtract one

at the end of the game if the value is positive, red is winner, if it is negative blu wins, if it's equal its stalemate, an easy way to check the value is to fire the output into a logic_case which has all the possible values
 

FrekyD

L1: Registered
May 30, 2009
3
0
I always have problems with the damn compare entity... so what I do for things like this is...

have another math counter
when red scores, add one to this counter
when blu scores, subtract one

at the end of the game if the value is positive, red is winner, if it is negative blu wins, if it's equal its stalemate, an easy way to check the value is to fire the output into a logic_case which has all the possible values
I never would have thought of this. I'll try it out.
 

Artesia

L6: Sharp Member
Nov 11, 2008
278
72
another thing you could do that would replace the need for the logic_case is to make yet another math counter, min=-1 max=1, the first math counter that we made sends its value to this new one, this new counter enables different logic_relays based on its value (-1 or 1) each of the logic relays tries to fire victory condition for a team, but only one should be enabled when your timer counts down and you try to fire them...
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Do the first thing art said, except at the end of the game have the counter send it's value to a logic_compare via SetValueCompare (which sets the 'initial value' value, and then compares it to the other).
Set the initial value to 0
Set the compare value to 0

Then use the OnLessThan OnGreaterThan and OnEqual outputs.
 

Artesia

L6: Sharp Member
Nov 11, 2008
278
72
yeah booj, I didn't tell him to do that because every time I've tried to use logic_compare... nothing happens :S

although the only time I really tried was for that timer system I was working on, which had other parts that might not have been working, in which case I would have never noticed if the logic_compare was doing anything.