- Joined
- Jan 5, 2009
- Messages
- 1,127
Control-Point System
What is a control-point system?A control-point system is where there are multiple forces going after certain areas to control, known as "control points". Every few seconds, you will get points from controlling those points, but there's a catch; only the team with the most control points gets the points. It detects whoever has the most and uses the amount of control points to calculate the points the team gets by: counting them, taking away the amount the other team has, and getting the result to add to the total.
This tutorial will show you how to create an effective control-point system using GUI Triggering.
What you need:
- WE Editor (Any type, whether it be regular, JNGP, or WEU)
- Basic GUI Knowledge.
- WE Experience.
Making the System:
- First, open the World Editor.
- Open your map that you want to have a control-point system in, or create a new map.
- I suggest you separate the players into opposing forces for these particular triggers to work properly. In this tutorial, we will be using 2 opposing forces of 2 players, Player 1 and Player 7.
- Open the object editor.
- Create a new unit (Use the Circle of Power as a base. [any size]).
- Name it Capture Point. Change the life to something decent, because this will be the deciding factor on how fast the control point can be taken. Make sure you remove the ability Invulnerable from the unit to make sure it can be attacked.
- Put however many you want around the map. Make sure you are careful where you place them due to balancing issues.
- Open the trigger editor.
- Create triggers named Capture CP and CP Points.
- Open the variable editor, and create the following variables:
Variable Name Type [tr][td]CP_Group1[/td][TD]Unit Group[/TD][/tr]
[tr][td]CP_Group2[/td][TD]Unit Group[/TD][/tr]
[tr][td]CP_Points1[/td][TD]Integer[/TD][/tr]
[tr][td]CP_Points2[/td][TD]Integer[/TD][/tr]
What variable does what?
- CP_Group1 - This unit group will contain all the control points owned by Force 1.
- CP_Group2 - This unit group will contain all the control points owned by Force 2.
- CP_Points1 - This will track Force 1's points.
- CP_Points2 - This will track Force 2's points.
Trigger:Capture CP
-
Capture CP
-
Events
-
Unit - A unit Is attacked
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Attacked unit)) Equal to Capture Point
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Owner of (Attacked unit)) Equal to Player 1 (Red)
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Percentage life of (Attacked unit)) Less than or equal to 25.00
-
-
Then - Actions
-
Unit - Set life of (Attacked unit) to (Max life of (Attacked unit))
-
Unit - Change ownership of (Attacked unit) to Player 7 (Green) and Change color
-
-
Else - Actions
-
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Owner of (Attacked unit)) Equal to Player 7 (Green)
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Percentage life of (Attacked unit)) Less than or equal to 25.00
-
-
Then - Actions
-
Unit - Set life of (Attacked unit) to (Max life of (Attacked unit))
-
Unit - Change ownership of (Attacked unit) to Player 1 (Red) and Change color
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
This trigger shows how units capture control points. When an enemy attacks a control point, it checks the life of the control point, and it will be claimed by the attacking player when the control point reaches below 25% health. For example, the red player attacks a point controlled by green. When the control point reaches below 25% health, the possession will be switched and the red player will now have control, with the point at 100% health.
-
CP Points
-
Events
-
Time - Every 20.00 seconds of game time
-
-
Conditions
-
Actions
-
Set CP_Group1 = (Units owned by Player 1 (Red) of type Control Point)
-
Set CP_Group2 = (Units owned by Player 7 (Green) of type Control Point)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in CP_Group1) Greater than (Number of units in CP_Group2)
-
-
Then - Actions
-
Set CP_Points1 = (CP_Points1 + ((Number of units in CP_Group1) - (Number of units in CP_Group2)))
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in CP_Group2) Greater than (Number of units in CP_Group1)
-
-
Then - Actions
-
Set CP_Points2 = (CP_Points2 + ((Number of units in CP_Group2) - (Number of units in CP_Group1)))
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in CP_Group2) Equal to (Number of units in CP_Group1)
-
-
Then - Actions
-
Set CP_Points1 = (CP_Points1 + 1)
-
Set CP_Points2 = (CP_Points2 + 1)
-
-
Else - Actions
-
-
Custom script: call DestroyGroup(udg_CP_Group1)
-
Custom script: call DestroyGroup(udg_CP_Group2)
-
-
You may be wondering what
Basic Memory Leaks
In the trigger above, it collects all the control points owned by the red player and all the control points owned by the green player, and counts them. Whoever has the most control points gets literal "points" in the game. (for scoring) If they have an equal amount of points, each team will get the same amount of points. You can make the number of control points odd if you want to prevent people from getting ties. (for the most part) It will make people have to go for the last base instead of just holding half the bases.
Be sure there is nothing that kills the control point within one hit. If you do insist on having something like that, make sure that in the first trigger, you add something to check if the unit is dead, and revive it if so. Then you can change the ownership. It is best to have the control points have enough health, that way people will have a chance to defend.
call DestroyGroup(udg_CP_Group1)
is for; it is for removing leaks from creating handles. For more information on leaks, view this tutorial:Basic Memory Leaks
In the trigger above, it collects all the control points owned by the red player and all the control points owned by the green player, and counts them. Whoever has the most control points gets literal "points" in the game. (for scoring) If they have an equal amount of points, each team will get the same amount of points. You can make the number of control points odd if you want to prevent people from getting ties. (for the most part) It will make people have to go for the last base instead of just holding half the bases.
Be sure there is nothing that kills the control point within one hit. If you do insist on having something like that, make sure that in the first trigger, you add something to check if the unit is dead, and revive it if so. Then you can change the ownership. It is best to have the control points have enough health, that way people will have a chance to defend.
Attachments
Last edited: