# Help with some logic stuff.

Discussion in 'Mapping Questions & Discussion' started by FrekyD, May 30, 2009.

1. ### FrekyDL1: Registered

Messages:
3
Positive Ratings:
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: May 30, 2009
2. ### ArtesiaL6: Sharp Member

Messages:
278
Positive Ratings:
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

3. ### FrekyDL1: Registered

Messages:
3
Positive Ratings:
0
I never would have thought of this. I'll try it out.

4. ### ArtesiaL6: Sharp Member

Messages:
278
Positive Ratings:
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...

5. ### aaA Boojum SnarkToraipoddodezain Mazahabado

Messages:
4,769
Positive Ratings:
5,543
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.

6. ### ArtesiaL6: Sharp Member

Messages:
278
Positive Ratings:
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.

7. ### FrekyDL1: Registered

Messages:
3
Positive Ratings:
0
I think that worked! Thanks a lot guys.