[TUTORIAL] Adding a working control point in CTF

Discussion in 'Tutorials & Resources' started by spaceweasels, Dec 8, 2007.

  1. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    First, let me say that on this example map, we'll be scoring using the flag. The Control Point is only being used as a visual trigger. This tutorial was created at Marnmai's request. I think this is what he wanted to know.

    You can download my hammer VMF file here
    You can download my playable BSP file here

    Create a large two part or three part map. I create an L shaped map, where the control point, capture zone and flag are in seperate rooms. Add a light entity in each room, and a info_player_teamspawn in the capture zone room.

    The door
    Place a door between the capture zone and flag room. Give is a name, make it a toggle and remove the touch opens option.


    Team Filters
    Create a Filter_tfteam entity for each team. Give each one a specific name (like bluefilter and redfilter).


    The control point
    First, the base. It's a prop_dynamic, with a skin of 0. Give it a name (CPBASE).

    Second, the team_control_point entity. Give it a name (like CP). Create two outputs.
    OnOwnerChangetoTeam1->CPBASE->SKIN->1
    OnOwnerChangeToTeam2->CPBASE->SKIN->2


    Third, create a trigger_multiple over the control point. We're using trigger_multiple instead of trigger_capturezone because this is a CTF map, not a CP map. Give it a name, specify the blue team's filter in the filter name. Now create two outputs:
    OnStarTouchAll->CP->SetOwner->3
    OnStartTouchAll->DOOR->OPEN
    [​IMG]

    Fourth, create another trigger_multiple, but for the red team filter. Create two outputs:
    OnStarTouchAll->CP->SetOwner->2
    OnStartTouchAll->DOOR->OPEN


    The flag
    Create a func_capture_zone entity in the capture room.

    Create a item_teamflag entity in the flag room. Give it a name (like flag), keep the team to any. Create 2 outputs:
    OnCapture->CP->SetOwner->0
    OnCapture->DOOR->Close

    [​IMG]

    If you capture the flag, the CP goes back to neutral and the door closes.

    I added a few extras, such as a message when the door is closed saying that you must capture the control point. Play around, and let me know if you have any questions. If you want points awarded from the Capture Point, you can have an output pointed at a game_Score entity.
     
    • Thanks Thanks x 1
    Last edited: Dec 8, 2007
  2. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    THis can be very cool. Im impressed by your knowledge spaceweasel, you know more than me and im playing with the sdk a few years now :D

    And how you link things with the triggers, i bet you would be a good programmer too.

    Thanx for this tutorial.
     
  3. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Thank you Snipergen, I'm glad you appreciated it.
     
  4. marnamai

    marnamai L1: Registered

    Messages:
    48
    Positive Ratings:
    2
    Thanks for the tutorial, it is almost what I wanted to achieve. But since there isn't a delay on the capture, instant captures would be too easy for both teams.

    I would like to copy the behaviour of a trigger_capturezone, so there should be a way to create a delay before the point is captured. So the player remain on the point for lets say 30 seconds before they capture it.

    I guess this would require a few trigger_multiple's and a filter_team entity.

    However, situation => red and blue are on the capzone at the same moment and both capture the point (even if seconds from each other) ...

    Gah its hard to explain, but basicly I want the cap point to behave as a real trigger_capturezone


    trigger_multiple => ontouching => math_counter +1 => onmaxvalue => set owner (red or blue)?
    A timer could send the +1 after each 10 seconds on the trigger multiple.
    I am sure there should be a better way to do this.

    My first idea was to have on cap point in the middle of the map, but what if I make 2 cappoints but inside the enemy base=> so players need to enter the base and hold the point so a flagrunner can cap it => but the enemy team has a chance to setup defenses instead of the mindless run and gun for the center point.
     
    Last edited: Dec 9, 2007
  5. samn

    samn L4: Comfortable Member

    Messages:
    158
    Positive Ratings:
    47
    I'd also like to know how to do this
     
  6. tortilaman

    tortilaman L1: Registered

    Messages:
    17
    Positive Ratings:
    1
    First post, yeah. and now:

    I've also been working on this for a while, and found the map CTF_Powerhouse, made by a friend that i used to play CS:S with. He wasn't really much help, but decompiling his map helped a little. Here's what I've learned:

    1. To make the Control point work as a control point, use trigger_capturearea
    2. What makes it a CTF map and not a CP map is leaving out the entity team_control_point_master, or whatever it's called
    3. The only problem is the fact that i haven't figured out how to make the control point progress show up on the hud, any help with this would be great

    So, At the moment in my map CTF_Teleporter_Tag I have a control point that opens a door (just like spaceweasels) you then get the intel and bring it back to capture zone.

    Difference is My control Point works like control point. the "Light" above the CP changes teams, but doesn't show progress at bottom of HUD. You still hear it capturing, but that's it. Once I figure out how to put CP progress on HUD i'll let you know.