[Trigger] Control Points

ndh

ndh

Level 8
Joined
Apr 21, 2012
Messages
344
Hey, I made a basic version of a Control Point, but i would like to improve it. I was wondering if anyone more experienced with triggering could make a trigger that does the following:

>When a player has the majority of units around a point, they will start to capture it passively just by standing by it (capture time = 15 seconds). This will not work on allied Points however (works on neutral passive).

>When starting to capture a point, the owner of the point will be warned that "Name of Control Point" is being captured by the enemy and will ping the location on the map.

>When captured, the new owner will get a message saying you have captured "Name of Control Point".

>If possible, would love some sort of visual as to the progress of capturing a point.

Thanks,
ndh
 
Level 8
Joined
Oct 26, 2008
Messages
387
I hope this helps you

NOTE: This is just to give you a general idea, these triggers leak, and are for a 2 player scenario.


  • Human Tower Point Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set HTLoc = (Center of Human Tower <gen>)
      • Set HT_AoE = 500


  • Capturing Init
    • Events
      • Unit - A unit enters (Region centered at (Center of Human Tower <gen>) with size (500.00, 500.00))
    • Conditions
    • Actions
      • Trigger - Turn on Capturing Loop <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of Scout Tower 0000 <gen>) Equal to Player 1 (Red)
        • Then - Actions
          • Cinematic - Ping minimap for Player Group - Player 1 (Red) at HTLoc for 1.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
          • Game - Display to Player Group - Player 1 (Red) the text: Tower Point, is und...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of Scout Tower 0000 <gen>) Equal to Player 2 (Blue)
            • Then - Actions
              • Cinematic - Ping minimap for Player Group - Player 2 (Blue) at HTLoc for 1.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
              • Game - Display to Player Group - Player 2 (Blue) the text: Tower Point, is und...
            • Else - Actions
              • Do nothing

  • Capturing Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set P1_Group = (Units within 500.00 of HTLoc matching ((Owner of (Matching unit)) Equal to Player 1 (Red)))
      • Set P1_Number = (Number of units in P1_Group)
      • Set P2_Group = (Units within 500.00 of HTLoc matching ((Owner of (Matching unit)) Equal to Player 2 (Blue)))
      • Set P2_Number = (Number of units in P2_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • P1_Number Not equal to P2_Number
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • P1_Number Greater than P2_Number
            • Then - Actions
              • Trigger - Turn on Capturing Loop 2 <gen>
              • Trigger - Turn off Capturing Loop 3 <gen>
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P1_Number Less than P2_Number
                • Then - Actions
                  • Trigger - Turn on Capturing Loop 3 <gen>
                  • Trigger - Turn off Capturing Loop 2 <gen>
                • Else - Actions
                  • Do nothing
        • Else - Actions
          • Do nothing

  • Capturing Loop 2
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Capturing_Integer[1] = (Capturing_Integer[1] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Capturing_Integer[1] Equal to 15
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Capturing Loop 3 <gen>
          • Trigger - Turn off Capturing Loop <gen>
          • Set Capturing_Integer[1] = 0
          • Set Capturing_Integer[2] = 0
          • Unit - Change ownership of Scout Tower 0000 <gen> to Player 1 (Red) and Change color
          • Game - Display to Player Group - Player 1 (Red) the text: You have won, Tower...
          • Game - Display to Player Group - Player 2 (Blue) the text: You have lost, Towe...
          • Cinematic - Ping minimap for Player Group - Player 2 (Blue) at HTLoc for 1.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
          • Cinematic - Ping minimap for Player Group - Player 1 (Red) at HTLoc for 1.00 seconds, using a Flashy ping of color (0.00%, 100.00%, 0.00%)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Capturing_Integer[2] Greater than 0
        • Then - Actions
          • Set Capturing_Integer[2] = (Capturing_Integer[2] - 1)
        • Else - Actions
          • Do nothing

  • Capturing Loop 3
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Capturing_Integer[2] = (Capturing_Integer[2] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Capturing_Integer[2] Equal to 15
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn off Capturing Loop 3 <gen>
          • Trigger - Turn off Capturing Loop <gen>
          • Set Capturing_Integer[1] = 0
          • Set Capturing_Integer[2] = 0
          • Unit - Change ownership of Scout Tower 0000 <gen> to Player 2 (Blue) and Change color
          • Game - Display to Player Group - Player 2 (Blue) the text: You have won, Tower...
          • Game - Display to Player Group - Player 1 (Red) the text: You have lost, Towe...
          • Cinematic - Ping minimap for Player Group - Player 1 (Red) at HTLoc for 1.00 seconds, using a Flashy ping of color (100.00%, 0.00%, 0.00%)
          • Cinematic - Ping minimap for Player Group - Player 2 (Blue) at HTLoc for 1.00 seconds, using a Flashy ping of color (0.00%, 100.00%, 0.00%)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Capturing_Integer[1] Greater than 0
        • Then - Actions
          • Set Capturing_Integer[1] = (Capturing_Integer[1] - 1)
        • Else - Actions
          • Do nothing
 

Attachments

  • PointSystem.w3x
    23.3 KB · Views: 35
  • Like
Reactions: ndh
Level 25
Joined
Jul 10, 2006
Messages
3,315
So I decided to give it a go as well.

Features:
- Works for any number of control points (in theory)
- Captures if #enemies > #allies, based on a configurable capture rate variable
- Capture rate increases based on the number of units you have more than the other player
- Floating text indicator showing the current progress

EDIT: How many control points do you intend to have?

EDIT2: Whoops, there was a bug that caused CPs to be "recaptured" after capturing. Fixed, uploaded.
 

Attachments

  • ControlPointSystem002.w3x
    20.1 KB · Views: 44
  • ControlPointSystem003.w3x
    20.1 KB · Views: 45
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
@rulerofireon99
You should reset the counter when there's no unit left in the control point.
It's quite unfair if you go to that control point and stops at 5/20.
After quite some times, you go to the control point again (provided that no other Player tamper with it), you will continue the counter starting from 5.
 
Top