HUD / CP problems

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

mishi

L1: Registered
Jan 30, 2014
38
3
Im trying to make a 5 CP map with a 2-1-2 structure. So like this:

Red 1 ----- Red 2

------- Mid -------

Blu 1 ----- Blu 2

For the red team Red 1 and Red 2 dont have any requirements. Red 1 and Red 2 are needed to cap Mid and Mid is required for Blu 1 and Blu 2. Blu 1 / Blu 2 / Red 1 / Red 2 can all be capped at the same time. It's all the other way round for the blue team.

Now I have three problems:

1) Ingame the capping works the way it should, but the HUD doesn't display the 'locked' symbol over the last two points, the HUD only shows the lock on Mid. Screenshot of the CP settings

2) I want the HUD to show a 2-1-2 structure instead of 1-1-1-1-1, how can I change that?

3) Blu 1 / 2 or Red 1 / 2 can all be possible final capture points depending on which point is capped first, how can I tell the game when to do the final capture announcement?
 
Last edited:
Apr 14, 2013
663
343
https://developer.valvesoftware.com/wiki/TF2/Setting_the_cap_point_layout
This should help with the HUD
About the cp's, maybe make it like they did on G-pit?
for the warning you'll need some logic
my idea (no promise it'll work...) is you can change all the warnings into ambient_generics with the flag that says Play Everywhere (or something like that) turned on
there should be four: RED_final, BLU_final, RED_normal, BLU_normal

Playing The Sounds:
for cp BLU_1 and BLU_2:
Code:
OnStartTeam1   BLU_normal   PlaySound

same for RED but w/ OnStartTeam2


Changing Sounds to Final ones:
for cp BLU_1:
Code:
OnCapTeam1  BLU_2   AddOutput   OnStartTeam1   BLU_normal   StopSound   0.01
OnCapTeam1  BLU_2   AddOutput   OnStartTeam1   BLU_final   playsound

same for BLU_2 w/ replaced names
same for RED but w/ OnCapTeam2


Removing Replacements in red/blu recaps
for cp BLU_1:
OnCapTeam2 BLU_2 AddOutput OnStartTeam1 BLU_final StopSound 0.01
OnCapTeam2 BLU_2 AddOutput OnStartTeam1 BLU_normal playsound

same for BLU_2 w/ replaced names
same for RED but w/ OnCapTeam1
 
Last edited:

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
For the locking symbols, try sending SetLocked 1 to the two CPs when the middle point is taken, and conversely SetLocked 0 to the other two. For both directions of course.


For the sounds, takabuschik's idea won't work as it will just keep adding more outputs, and stuff will happen at the same time. You need some logic to keep track of what is owned by who.

Start by setting every CP except the middle to "no announcements"

Then make two logic_branch, which are true/false entities that we will use to answer the question "is it the last cp?" You probably already have a tf_gamerules, but if not, make one named whatever.

logic_branch named: red_last_point
OnTrue > tf_gamerules > PlayVORed > ControlPoint.CaptureWarn

logic_branch named: blue_last_point
OnTrue > tf_gamerules > PlayVOBlue > ControlPoint.CaptureWarn

Those will let us play the warning sounds to each team when needed.

EDIT: ignore everything in the quote box and follow the instructions afterward. after a few hours I realized a much simpler way to do it, but I wanted to leave this here if it is useful knowledge to anyone.
Now we need to keep track of which points are owned. The following is assuming your screenshot is correct and all CPs will start out neutral, if not then things would need to be adjusted.

Make a logic_case and name it red_points_case. Assign cases 1 through 4 a value of 1 through 4, respectively. Give it the following outputs:
OnCase01|red_last_point|SetValue|1
OnCase02|red_last_point|SetValue|0
OnCase03|blue_last_point|SetValue|0
OnCase04|blue_last_point|SetValue|1

Make a math_counter and name it red_points_counter and give it:
OutValue > red_points_case > InValue
(initial/min/max left at 0)

Put the following outputs on all five team_control_point
OnCapTeam1|red_points_counter|Add|1|
OnCapTeam1|!self|AddOutput|OnCapTeam2 red_points_counter:Subtract:1| only once

This will add 1 to the counter for every CP red takes, and subtract 1 every time blue takes it (but only if red had it already, hence the AddOutput). The counter will forward the amount of CPs held by red to the case, which will set our branches as necessary. When red only owns 1 CP, it is their last, so the branch is set to true(1). If they hold 4 points, that means blue only has one left.

Lastly the sounds need to be hooked up.
On the trigger_capture_areas for the red CPs add:
OnStartTeam2 > red_last_point > Test

and for blue's:
OnStartTeam1 > blue_last_point > Test

On the trigger_capture_area for both of blue's CPs put:
OnStartTeam1|blue_last_point|Test|
OnCapTeam1|blue_last_point|SetValue|1
OnCapTeam2|blue_last_point|SetValue|0

and likewise on red's:
OnStartTeam2|red_last_point|Test|
OnCapTeam2|red_last_point|SetValue|1
OnCapTeam1|red_last_point|SetValue|0

This will try to play the sound when either point starts being taken, but the branch will only be true(1) if one of the points has already been lost.

The only thing this can't account for is if both final CPs are being captured at the same time... and there isn't really any good way to handle that because neither one IS the last. Also, it assumed both teams capture both of their own points before the enemy is attempting to get a 4th, because the likelyhood of that not happening seems so low it isn't worth dealing with.
 
Last edited:

mishi

L1: Registered
Jan 30, 2014
38
3
For the locking symbols, try sending SetLocked 1 to the two CPs when the middle point is taken, and conversely SetLocked 0 to the other two. For both directions of course.

iVk8gJM.png


like this? it didnt work. wouldnt it also set the last 2 points locked only as soon as the middle point gets capped, so that they appear unlocked at the beginning of the match?
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
The 1/0 should be flipped I think. OnCapTeam1 is when red takes it, at which point red's (which blue cannot take) should be locked (1), and blue's should be unlocked (0).

If it doesn't work, you can try using the SetTeamCanCap input sent to the trigger_capture_area itself. The parameter for it is two numbers, team and allowed state. 2 0 = red can not cap. 3 1 = blue can cap. 2 1 = red can cap. The two teams are independent of each other, it is the same as changing the "Can X cap?" keys on the entity.

I'm not sure what you mean by your question though. Yes it only sets it when the middle is taken. Your previous screenshot showed that all CPs start neutral so they would need to be unlocked to start?
 

mishi

L1: Registered
Jan 30, 2014
38
3
I'm not sure what you mean by your question though. Yes it only sets it when the middle is taken. Your previous screenshot showed that all CPs start neutral so they would need to be unlocked to start?

They start neutral, but until mid is capped Blue/Red should only be able to cap the points next to their spawns. They cant rush over to the other team's base and cap the points there, which should be symbolized by the lock, no?
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Oh, I see what you mean. However I don't think you can help that because the HUD is not team-specific, even if red cannot capture blue's CPs, blue themselves can, and thus they must be shown as unlocked.