• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[GUI] Control Point System 0.11b

Control Point System
by rulerofiron99

Description:
A system that allows control points (units) to be captured by players, recaptured, and fought for.

Example Uses:
  • Captureable gold mines / buildings that give resources (resource generation included in system)
  • If you're making an AOS map, you could put one of these in each lane and give bonus spawns or something to the team that controls each lane.
  • King-of-the-hill type maps, you can determine which player is currently "winning" by make the hill a control point.

Features:
  • Works for any number of control points (in theory)
  • Works for any number of players
  • Works for player alliances - allied units prevent capture, attacking a point with an ally increases capture speed
  • Capture speed increases based on how many units near the control point
  • Configurable capture speed, capture requirement, range
  • Warning messages to the owning player
  • Two modes:
    • Style 1: point only starts being captured when all defenders are dead
    • Style 2: point starts to capture as soon as #attackers > #defenders
  • Floating text progress bar, coloured to the participating players.
  • Configurable gold and/or lumber income
Triggers:
  • CP Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- set system style --------
      • -------- style 1: all point defenders must be dead before capture starts --------
      • -------- style 2: capture starts the moment #enemies > #allies --------
      • Set cpVAR_SystemStyle = 1
      • -------- the amount of time units per unit in range per second towards capturing a point --------
      • Set cpVAR_CaptureRate = 1
      • -------- the amount of time units needed to capture a point --------
      • Set cpVAR_CaptureReq = 20
      • -------- the range from the center of the point that units must be to capture --------
      • Set cpVAR_Range = 150.00
      • -------- the cooldown (in seconds) between warning messages --------
      • Set cpVAR_NotifierCooldown = 5
      • -------- set control point types, and resource income (set to 0 if unwanted) --------
      • Set cpVAR_ControlPointType[1] = Circle of Power (large)
      • Set cpVAR_ControlPointIncGold[1] = 0
      • Set cpVAR_ControlPointIncLumber[1] = 3
      • Set cpVAR_ControlPointType[2] = Circle of Power (medium)
      • Set cpVAR_ControlPointIncGold[2] = 5
      • Set cpVAR_ControlPointIncLumber[2] = 0
      • Set cpVAR_ControlPointTypeId = 2
      • -------- set the interval at which income is awarded --------
      • Set cpVAR_IncomeRate = 5.00
      • Trigger - Add to CP Income <gen> the event (Time - Every cpVAR_IncomeRate seconds of game time)
      • -------- set game messages for warning and new capture --------
      • Set cpVAR_CaptureMessage = |cff8080aaNOTICE|r - You have captured a control point!
      • Set cpVAR_WarningMessage = |cffff0000WARNING|r - A control point is being captured!
      • Set cpVAR_PointLostMessage = |cffff0000WARNING|r - You have lost a control point!
      • -------- this variable is the distance per character in the progress bar, change it only if you have a different font or want to change the size --------
      • Set cpVAR_FloatOffset = 3.00
      • -------- set neutral victim to an enemy for all players to take the pre-placed CPs --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Make (Player((Integer A))) treat Neutral Victim as an Enemy
      • -------- initialize all pre-placed control points --------
      • For each (Integer A) from 1 to cpVAR_ControlPointTypeId, do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units of type cpVAR_ControlPointType[(Integer A)]) and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to Neutral Victim and Change color
              • Unit Group - Add (Picked unit) to cpPointsGroup
              • Set cpId = (cpId + 1)
              • Set cpUnit[cpId] = (Picked unit)
              • Set cpOwner[cpId] = Neutral Victim
  • CP Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • -------- loop through each control point --------
      • For each (Integer A) from 1 to cpId, do (Actions)
        • Loop - Actions
          • Set tempLoc = (Position of cpUnit[(Integer A)])
          • -------- check if there are any friendlies on it --------
          • Set tempUGAllies = (Units within cpVAR_Range of tempLoc matching ((((Owner of (Matching unit)) is an ally of cpOwner[(Integer A)]) Equal to True) and (((Matching unit) is dead) Equal to False)))
          • Unit Group - Remove cpUnit[(Integer A)] from tempUGAllies
          • -------- check if there are any enemies on it --------
          • Set tempUGEnemies = (Units within cpVAR_Range of tempLoc matching ((((Owner of (Matching unit)) is an ally of cpOwner[(Integer A)]) Equal to False) and (((Matching unit) is dead) Equal to False)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tempUGEnemies is empty) Equal to False
            • Then - Actions
              • -------- if there are multiple enemy players attacking, the one with more units is considered the attacker --------
              • For each (Integer B) from 1 to 12, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Player((Integer B))) is an enemy of cpOwner[(Integer A)]) Equal to True
                    • Then - Actions
                      • Set tempUGPerPlayer[(Integer B)] = (Units within cpVAR_Range of tempLoc matching ((Owner of (Matching unit)) Equal to (Player((Integer B)))))
                    • Else - Actions
              • -------- one pass of bubble sort to find which player has the most nearby units --------
              • Set testIndex = 0
              • Set testValue = 0
              • For each (Integer B) from 1 to 12, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Player((Integer B))) is an enemy of cpOwner[(Integer A)]) Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in tempUGPerPlayer[(Integer B)]) Greater than testValue
                        • Then - Actions
                          • Set testIndex = (Integer B)
                          • Set testValue = (Number of units in tempUGPerPlayer[(Integer B)])
                        • Else - Actions
                    • Else - Actions
              • Set cpAttacker[(Integer A)] = (Player(testIndex))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • cpVAR_SystemStyle Equal to 1
            • Then - Actions
              • -------- first check that there are no defenders --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (tempUGAllies is empty) Equal to True
                • Then - Actions
                  • -------- check that there are actually enemies --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (tempUGEnemies is empty) Equal to False
                    • Then - Actions
                      • Set tempCaptureRate = (Number of units in tempUGEnemies)
                      • Set cpProgress[(Integer A)] = (cpProgress[(Integer A)] + (tempCaptureRate x cpVAR_CaptureRate))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • cpProgress[(Integer A)] Greater than or equal to cpVAR_CaptureReq
                        • Then - Actions
                          • Set captureId = (Integer A)
                          • Trigger - Run CP Capture <gen> (ignoring conditions)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • cpNotified[(Player number of cpOwner[(Integer A)])] Equal to 0
                            • Then - Actions
                              • Set tempForce = (Player group((Owner of cpUnit[(Integer A)])))
                              • Quest - Display to tempForce the Warning message: cpVAR_WarningMessage
                              • Cinematic - Ping minimap for tempForce at tempLoc for 2.00 seconds, using a Warning ping of color (100.00%, 0.00%, 0.00%)
                              • Custom script: call DestroyForce(udg_tempForce)
                              • Set cpNotified[(Player number of cpOwner[(Integer A)])] = cpVAR_NotifierCooldown
                            • Else - Actions
                    • Else - Actions
                      • -------- no units, so point slowly resets --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • cpProgress[(Integer A)] Less than or equal to 0
                        • Then - Actions
                        • Else - Actions
                          • Set cpProgress[(Integer A)] = (cpProgress[(Integer A)] - 1)
                • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • cpVAR_SystemStyle Equal to 2
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in tempUGAllies) Greater than (Number of units in tempUGEnemies)
                • Then - Actions
                  • -------- allies > enemies, so decrease capture progress --------
                  • Set tempCaptureRate = ((Number of units in tempUGAllies) - (Number of units in tempUGEnemies))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • cpProgress[(Integer A)] Less than or equal to 0
                    • Then - Actions
                      • Set cpProgress[(Integer A)] = 0
                    • Else - Actions
                      • Set cpProgress[(Integer A)] = (cpProgress[(Integer A)] - (tempCaptureRate x cpVAR_CaptureRate))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in tempUGEnemies) Greater than (Number of units in tempUGAllies)
                    • Then - Actions
                      • -------- enemies > allies, so increase capture progress --------
                      • Set tempCaptureRate = ((Number of units in tempUGEnemies) - (Number of units in tempUGAllies))
                      • Set cpProgress[(Integer A)] = (cpProgress[(Integer A)] + (tempCaptureRate x cpVAR_CaptureRate))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • cpProgress[(Integer A)] Greater than or equal to cpVAR_CaptureReq
                        • Then - Actions
                          • Set captureId = (Integer A)
                          • Trigger - Run CP Capture <gen> (ignoring conditions)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • cpNotified[(Player number of cpOwner[(Integer A)])] Equal to 0
                            • Then - Actions
                              • Set tempForce = (Player group((Owner of cpUnit[(Integer A)])))
                              • Quest - Display to tempForce the Warning message: cpVAR_WarningMessage
                              • Cinematic - Ping minimap for tempForce at tempLoc for 2.00 seconds, using a Warning ping of color (100.00%, 0.00%, 0.00%)
                              • Custom script: call DestroyForce(udg_tempForce)
                            • Else - Actions
                    • Else - Actions
                      • -------- no units, so point slowly resets --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • cpProgress[(Integer A)] Less than or equal to 0
                        • Then - Actions
                        • Else - Actions
                          • Set cpProgress[(Integer A)] = (cpProgress[(Integer A)] - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • cpProgress[(Integer A)] Not equal to 0
            • Then - Actions
              • -------- show progress indicator --------
              • Set tempString = cpVAR_PlayerColour[(Player number of cpAttacker[(Integer A)])]
              • For each (Integer B) from 1 to cpProgress[(Integer A)], do (Actions)
                • Loop - Actions
                  • Set tempString = (tempString + l )
              • Set tempString = (tempString + |r)
              • Set tempString = (tempString + cpVAR_PlayerColour[(Player number of cpOwner[(Integer A)])])
              • For each (Integer B) from (cpProgress[(Integer A)] + 1) to cpVAR_CaptureReq, do (Actions)
                • Loop - Actions
                  • Set tempString = (tempString + l )
              • Set tempLoc2 = (tempLoc offset by ((-1.00 x ((Real((Length of tempString))) x cpVAR_FloatOffset)), 0.00))
              • Floating Text - Create floating text that reads (tempString + |r) at tempLoc2 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Custom script: call RemoveLocation(udg_tempLoc2)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_tempLoc)
          • Custom script: call DestroyGroup(udg_tempUGAllies)
          • Custom script: call DestroyGroup(udg_tempUGEnemies)
  • CP Capture
    • Events
    • Conditions
    • Actions
      • Set cpProgress[captureId] = 0
      • Set tempForce = (Player group((Owner of cpUnit[captureId])))
      • Quest - Display to tempForce the Warning message: cpVAR_PointLostMessage
      • Cinematic - Ping minimap for tempForce at tempLoc for 4.00 seconds, using a Warning ping of color (100.00%, 0.00%, 0.00%)
      • Unit - Change ownership of cpUnit[captureId] to cpAttacker[captureId] and Change color
      • Custom script: call DestroyForce(udg_tempForce)
      • Set cpOwner[captureId] = (Owner of cpUnit[captureId])
      • Set tempForce = (Player group((Owner of cpUnit[(Integer A)])))
      • Quest - Display to tempForce the New Unit Acquired message: cpVAR_CaptureMessage
      • Cinematic - Ping minimap for tempForce at tempLoc for 4.00 seconds, using a Simple ping of color (0.00%, 0.00%, 100.00%)
      • -------- show completed progress indicator --------
      • Set tempString = cpVAR_PlayerColour[(Player number of cpOwner[captureId])]
      • For each (Integer B) from 1 to cpVAR_CaptureReq, do (Actions)
        • Loop - Actions
          • Set tempString = (tempString + l )
      • Set tempLoc2 = (tempLoc offset by ((-1.00 x ((Real((Length of tempString))) x cpVAR_FloatOffset)), 0.00))
      • Floating Text - Create floating text that reads (tempString + |r) at tempLoc2 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Custom script: call RemoveLocation(udg_tempLoc2)
      • Custom script: call DestroyForce(udg_tempForce)
  • CP Income
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in cpPointsGroup and do (Actions)
        • Loop - Actions
          • Set tempForce = (Player group((Owner of (Picked unit))))
          • -------- find which control point type --------
          • For each (Integer A) from 1 to cpVAR_ControlPointTypeId, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to cpVAR_ControlPointType[(Integer A)]
                • Then - Actions
                  • Set tempId = (Integer A)
                • Else - Actions
          • Set tempInt = cpVAR_ControlPointIncGold[tempId]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt Greater than 0
            • Then - Actions
              • Player - Add tempInt to (Owner of (Picked unit)) Current gold
              • Floating Text - Create floating text that reads (+ + (String(tempInt))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 86.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
              • Floating Text - Hide (Last created floating text) for (All players)
              • Floating Text - Show (Last created floating text) for tempForce
            • Else - Actions
          • Set tempInt = cpVAR_ControlPointIncLumber[tempId]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInt Greater than 0
            • Then - Actions
              • Player - Add tempInt to (Owner of (Picked unit)) Current lumber
              • Floating Text - Create floating text that reads (+ + (String(tempInt))) above (Picked unit) with Z offset 0.00, using font size 10.00, color (0.00%, 90.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 4.00 seconds
              • Floating Text - Hide (Last created floating text) for (All players)
              • Floating Text - Show (Last created floating text) for tempForce
            • Else - Actions
          • Custom script: call DestroyForce(udg_tempForce)
Changelog:

0.11b
  • Fixed the thing not working at all, due to a memory leak removal in the initialization trigger. "set bj_wantDestroyGroup = true" somehow killed the unit group doing anything, so I've remove it. It's an insignificant leak anyway.
0.11
  • Fixed memory leaks.
  • Added Installation documentation.

    • 0.10
      • Added support for multiple control point types
      • Added option for gold and/or/neither lumber income for each control point type
      • Split some actions from CP Loop into another trigger to improve readability
      0.09
      • Changed the floating text to a progress bar on the control point, previously the floating text spam would go over war3's limit.
      0.08
      • Fixed the notifier cooldown not being set
      • Added some units to spawn in the game to demonstrate the system
      0.07
      • If multiple enemy players are busy capturing a point, the point will be given to the participating player with the most units. Previously this was randomised, which would allow "point stealing".

    • Credits:

      Thanks to:
      • defskull - Inspiration and recommendation to upload here.
      • StaRMaestroS - Theorycrafting early version of the system, recommendation to upload system.


      Keywords:
      control point system, control point, control system, point system, territory system, capture system, capture, territory
Contents

Control Point System 0.11b (Map)

Reviews
12:54, 20th Sep 2012 PurgeandFire111: Okay, looks good. It works and has a nice implementation. One thing to consider would be to make the texttags more configurable (such as the character used or font size). edit 15:56, 14th Oct 2012...

Moderator

M

Moderator

12:54, 20th Sep 2012
PurgeandFire111:
Okay, looks good. It works and has a nice implementation. One thing to consider would be to make the texttags more configurable (such as the character used or font size).

edit
15:56, 14th Oct 2012
Magtheridon96: This needs an in-game screenshot.
Thank you for your time :D
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Then why would we need another? >_<
It doesn't hurt to have a variety, right ?
Also, different resource gives different performance, you just gotta see which is better.
Also, different resource has different settings/configurables (eventhough the concept is the same).
You can have the same idea (mostly Systems, Spells are not advised), but you can have an additional features to it making it more configurables/user-friendly.

But mostly, efficiency would be the best thing to compare.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
the fact that someone creates the same system as others doesnt mean he has to credit them. Its like every system/spell/anything here should have whole Blizzard in credits list because they made Jass in first place.
My two cents
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
the fact that someone creates the same system as others doesnt mean he has to credit them. Its like every system/spell/anything here should have whole Blizzard in credits list because they made Jass in first place.
My two cents
Nestharus has created a thread discussing about "proper crediting", he said this too, well people should also credit Blizzard for making World Editor program, but you all never did that, why ? (if you're the type of person that likes to ask for credits)

You can (should) credit people, but depends on the situation, in which this case he should not credit that person for creating same system (maybe spells, but copying spells is rare cases) because system has pretty much possibilities of the creator can add features to it, and change the style of coding (could be more efficient as compared to other) and this certainly be an advantage to the newly created system.

But if it's the same (same features, same style of coding, etc), the system should not be created in the first place.

You have to have a "What makes this system more useful than other system exactly like this ?" paperwork or something.

@On Thread
You should make an example on how to utilize this system.
Like what do you gain from controlling those points ?
You know, examples make people easier to understand what you're trying to present.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
This is exactly the kind of system im looking for but there are some issues with it.

- If you place more units from different players on one CP it will only be fighting between red and blue.
- When purple was taking over a blue circle the progressbar was yellow vs blue instead of purple vs blue.
- When more units are on the CP it gets taken over in less then a second even if other players are on the circle. (Might have been because it was neutral.)
 
Last edited:
Level 4
Joined
Jun 5, 2012
Messages
54
I have discovered a major error that needs to be addressed: Neutral hostile (and possibly other neutral players) wandering into a control point crashes the game.

EDIT: Checking the error in game, this only occurs if the control point is under a player's control. It doesn't crash if it is controlled by the initial player (neutral victim)

Also, found a fix: in the integer B in loops, change from 1 to 12 to 1 to 13 (neutral hostile is designated that) to prevent the crash.
 
Last edited:
Level 8
Joined
Jun 26, 2019
Messages
318
Hello. Um. I have new problem right now as Feb 2020 for this program. The problem is the warning message "Warning, the control point is being captured!", after captured the control point for 2 times, then the only warning message "Warning, the control point is being captured!" is not working anymore after the control point is being captured for 2 times......


UPDATED: Nevermind. I fixed it. All good now.
 
Last edited:
Top