Trigger on team win for CTF?

shpladoink

L3: Member
Dec 19, 2007
108
6
I'd like to trigger an event at the end of each CTF round. One of you gents mentioned an OnTeamWin trigger, but I don't know where I would go about finding it. I tried using OnFinished in team_round_timer, but that doesn't seem to trigger after a team wins.

I could set up a counter on the cap points themselves, but it seems that that would interfere with servers that wish to change the number of caps needed to win the match. I did some digging around the older topics here, but it's difficult to find what I'm looking for if I don't know what it's called.

Thanks in advance.
 

GrimGriz

L10: Glamorous Member
Jan 2, 2009
774
133
there's an OnRoundWin output in the game_round_win entity....if that would work for what you want
 

shpladoink

L3: Member
Dec 19, 2007
108
6
there's an OnRoundWin output in the game_round_win entity....if that would work for what you want

Cool, that seems to be what I want. However, the trigger isn't going off. Do I need to trigger OnRoundWin manually, or is this automatically triggered when a team wins? Here's what I've got:

triggerwindow.jpg


This should make the window breakable when the game is won, but I must be missing something.
 

shpladoink

L3: Member
Dec 19, 2007
108
6
Alright, so now I've got a math_counter set up to trigger RoundWin after one team caps 3 times, but what about servers that wish to play to more or less than 3? Is there a way to read the server's cfg info for tf_flag_caps_per_round and use that number in the map?

I'd rather not have the cap limit set in stone if I can help it, since the cap limit is more important than what happens after the match is won.
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
....don't you need to set the health to 0 for it to break?

Anyways, that's not the way I would get your glass to break.

Set up a logic_relay




On the game _round_win, use output

Onroundwin
your_logic_relay01
trigger




On the logic relay use ouput

Ontrigger
Your_breakable01
break
.2 delay


Keep all the other game entities normal.
 
Last edited:

shpladoink

L3: Member
Dec 19, 2007
108
6
....don't you need to set the health to 0 for it to break?

Anyways, that's not the way I would get your glass to break.

Set up a logic_relay




On the game _round_win, use output

Onroundwin
your_logic_relay01
trigger




On the logic relay use ouput

Ontrigger
Your_breakable01
break
.2 delay


Keep all the other game entities normal.
I actually want the window to be breakable at the end of the round rather than have it just break on its own, hence 1hp.

The counter method I've got set up works, but involves me having to trigger the end of the round myself by having the math_counter throw a RoundWin at game_round_win, then setting the window's HP change to trigger on OnRoundWin. It feels like taking the long way around, and forces the number of caps per round, which is undesirable.

I tried your method, but it doesn't work because OnRoundWin still doesn't seem to be triggering on its own at the end of the round. Out of curiosity though, why add the delay to the trigger?
 

Tinker

aa
Oct 30, 2008
672
334
If it's going to be BREAKABLE during humilation and not actually break, while it's not breakable at all during normal gameplay, I doubt people will notice it. I say make it break during humilation, because first of all that makes it look much cooler (you win, instantly glass shatters) and easier to understand.
 

Pianodan

L3: Member
Apr 11, 2009
108
16
To answer your other question, you can use an entity called point_servercommand to manually force the number of caps to other than 3 (which is set SERVER side for no readily apparent reason). HOWEVER, doing so means the teams will not switch properly at the end of the round. I have been beating my head against this problem, since I have an asymmetrical ctf map. It means I'm either stuck with 3 captures, or else the teams never switch.

(The work around is to force a switch during humiliation, but that means that everyone on the winning team is switched to the losing team for the humiliation phase.)
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
To answer your other question, you can use an entity called point_servercommand to manually force the number of caps to other than 3 (which is set SERVER side for no readily apparent reason). HOWEVER, doing so means the teams will not switch properly at the end of the round. I have been beating my head against this problem, since I have an asymmetrical ctf map. It means I'm either stuck with 3 captures, or else the teams never switch.

(The work around is to force a switch during humiliation, but that means that everyone on the winning team is switched to the losing team for the humiliation phase.)

ummmm


I have avantiville set to 4 caps, and team switch at the end of each round (4 cap-out).

It's an asymmetrical attack/defend map, red wins on time out, and blue wins on cap-out.


I believe your problem is you're using one team_flag, set up one for each cap:

Attackers win:

For each of the four flags, use a new one. As they get capped, enable/disable them in sequence, when flag 4 is capped, send an output to Blue's game_round_win to win the round and switch teams.

Defenders win:

The round_timer sends an output to Red's game_round_win to win and switch teams OnFinish.



PM me for more help.
 
Last edited:

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
lol, you tell me, can you?

If that's your style, sure!

...I didn't say it was the only way. :)


So, you would:

flag
- oncapture ->math_counter -> add -> 1

and your max on the counter be 4

then:

math_counter

- OnHitMax -> game_round_win -> win


** Don't forget to reset the math_counter to zero at the end of the round.



That way would work awesome if your flag spawns at the same location every time! Very smart and stream-lined, no?
 
Last edited:

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
The counter wouldn't need to be reset unless he is doing multiple rounds. Every entity reverts to it's default state when a full round restart occurs.

Excellent piece of info to know, thank you.
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
actually, now that I think about it....

there's no reason why you couldn't use multiple flags with the counter method.
 

Pianodan

L3: Member
Apr 11, 2009
108
16
The problem was that if I manually set the flag count via point_servercommand so that the hud displayed "Playing To" correctly, then the server WIN logic would take over before the counter had a chance to fire.

Then the teams wouldn't switch.

The trick is to get the hud to work right, set a custom number of flags, AND have the teams switch at the end of the round.

Actually, now that I think about it, I'm not sure the multiple flag method solves this problem either.

Argh.

How do you tell the HUD there are 4 caps in Avantiville? And yet NOT have it trigger the server WIN logic before you trigger your own round_win entities?
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
Off the top of my head:

If you have multiple rounds, and each round has multiple flags, you'd have to set the "Playing to" equal to the total number of flags for the entire map. So if you have 3 rounds of two flags each, your "Playing to" number would be 6.

It would help me a lot if I knew exactly how you want your rounds set up (# of rounds, # of flags, attack/defend, SCTF, RCTF, etc).
 

Pianodan

L3: Member
Apr 11, 2009
108
16
There's only one round. I suppose one solution would be to set up a second round which is never actually used. Could that work?

It's a map where blue has to capture the flag a certain number of times before time runs out. Reds sole goal is to stop them by preventing x number of captures before the timer expires.

The problem is, the only way to have the HUD correctly display the number of captures is to either use the point_servercommand to set the capture number, or just use whatever value the server operator sets. Either way, as soon as that final capture happens, the SERVER takes over and triggers the round end, preventing any user entities from firing. For some reason, this means that the teams do not automagically seem to switch.

When RED runs the time out, the round_win entity switches the teams just fine. The big problem seems to be that there is no equivalent of the team_train_watcher or team_round_master for ctf maps... it's largely done serverside.
 

l3eeron

L8: Fancy Shmancy Member
Jan 4, 2008
593
88
what a cool, simple idea... attack/defend rctf.

Are you stil triggering Blue's game_roundwin, regardless?

I got it to work on the first try using a math_counter....

All it needs is a simultaneous output to Blue's game_roundwin.... it still needs to be triggered (even though blu wins by server variable) because it has the team switch option, which doesn't fire by default.


Download the .vmf if need be.