parent each item_teamflag to a func_tracktrain and set the tracktrain's starting path_track to control where they spawn and return to.
each team's func_capturezone can have outputs to each teamflag that is:
"OnCapTeam1 for red, OnCapTeam2 for blue -> [item_teamflag] -> SetTeam -> [3 for blue, 2 for red]"
and then to get them to return to each side's capzone you can do, for blue team:
blue's func_capturezone:
"OnCapTeam2 -> [func_tracktrain associated with each flag] -> TeleportToPathTrack -> [path_track inside blue's capzone]"
red's func_capturezone:
"OnCapTeam1 -> [func_tracktrain associated with each flag] -> TeleportToPathTrack -> [path_track inside red's capzone]"
but this will make it so you can't pick the flag up as blue. I think if you want each team able to pick it up after capturing you can just do:
all 4 item_teamflag's output:
OnDrop -> !self -> SetTeam -> 0
but the tricky part is when they return, how does it know which team to set the flag to again? This might take a lot of work because I can't think of a better way than having two logic_relay's for each flag that get disabled and enabled when the other team captures like "flag1_red_relay" "flag1_blue_relay" and so on for the other flags. so each flag would need:
OnCapTeam1 -> flag[X]_red_owns_relay -> Enable & OnCapTeam1 -> flag[X]_blue_owns_relay -> Disable
OnCapTeam2 -> flag[X]_blue_owns_relay -> Disable & OnCapTeam2 -> flag[X]_red_owns_relay -> Disable
This makes it so you don't send red's outputs when you want to send blue's and vice versa. so each item_teamflag's can send the outputs of: OnReturn -> flagx_red_owns_relay -> trigger and OnReturn -> flagx_blue_owns_relay -> trigger, but only the enabled relay will trigger.
flag[X] outputs:
"OnReturn -> flag[x]_red_owns_relay -> Trigger
"OnReturn -> flag[x]_blue_owns_relay -> Trigger
flag[x]_red_owns_relay:
OnTrigger -> Flag[x] -> SetTeam -> 2
flag[x]_blue__owns_relay:
OnTrigger -> flag[x] -> SetTeam -> 3
To set up the win condition,
you can have a math_counter for each team that tracks the # of flags captured by each team and triggers a game_roundwin when you get to 4 so every teamflag would need the outputs:
all 4 flags:
"OnCapTeam1 -> [red's math_counter] -> Add -> 1" & "OnCapTeam1 -> [blue's math_counter] -> Subtract -> 1"
"OnCapTeam2 -> [blue's math_counter -> Add -> 1" & "OnCapTeam2 -> [red's math_counter] -> Subtract -> 1"
This makes it so each flag is accounted for as either contributing to red's victory or blue's victory but not both.
BUT
theres tricky things with the 2 flags starting as neutral because they will subtract from blue's score at the start if capped by red and vice versa and the numbers wont be tracked properly. I think the neutral flags need a one-time output when they are first capped to add a point from blue's math_counter if capped by red and vice versa (add a point to red's math_counter if capped by blue). I think the best way is to use the two logic_relay methods from above that disable themselves when triggered so:
NEUTRAL FLAGS ONLY:
OnCapTeam1 -> neutralflag_relay_red_once -> Trigger
OnCapTeam2 -> neutralflag_relay_blue_once -> Trigger
neutralflag_relay_red_once:
OnTrigger -> blue's math_counter -> Add -> 1
OnTrigger -> !self -> Disable
neutralflag_relay_blue_once:
OnTrigger -> red's math_counter -> Add -> 1
OnTrigger -> !self -> Disable
This makes it so it only contributes to subtracting the enemy team score after it's been captured by the enemy team and will cancel out the OnCapTeam1 subtraction just for the opening capture.
and then you can have each math_counter be connected to a logic_case via OutValue and then when you get the math_counter up to 4, it will set the logic_case to Case04 and then you can do outputs from the logic_case to the game_round_win as "OnCase04 -> blue_round_win -> Trigger" or something like that. this part will be easy, dont worry about it yet.
you can add me on discord if you have questions. my name on there is peegurts.