How can I create control point capturing and display it in a leaderboard ?

Level 2
Joined
Dec 29, 2017
Messages
11
Hello, I'm trying to make a trigger for my map; I want it so that when a Control Point gets below a certain Health threshold it changes ownership to the player attacking it. Additionally, I would like it to display the number of captured Control Points per player using a leaderboard, like the ones shown in Lordaeron TA or Warcraft legacies, how could I make this happen?
 
Level 29
Joined
Sep 26, 2009
Messages
2,594
You will need to track count of each control point per player in a variable or variable array. An array will make your life easier.
Assuming you already have a leaderboard, something like this could work:
  • ChangeOwnership
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Control Point
      • ((Life of (Triggering unit)) - (Damage taken)) Less than or equal to ((Max life of (Triggering unit)) x 0.30)
    • Actions
      • -------- Decrease count for old owner --------
      • Set VariableSet PN = (Player number of (Triggering player))
      • Set VariableSet PlayerControlPointCount[PN] = (PlayerControlPointCount[PN] - 1)
      • Leaderboard - Change the value for (Player(PN)) in PlayerLeaderboard to PlayerControlPointCount[PN]
      • -------- -------------------------------- --------
      • -------- Increase count for new owner --------
      • Set VariableSet PN = (Player number of (Owner of (Damage source)))
      • Set VariableSet PlayerControlPointCount[PN] = (PlayerControlPointCount[PN] + 1)
      • Leaderboard - Change the value for (Player(PN)) in PlayerLeaderboard to PlayerControlPointCount[PN]
      • -------- -------------------------------- --------
      • Unit - Change ownership of (Triggering unit) to (Owner of (Damage source)) and Change color
      • Unit - Order (Damage source) to Stop.
This will change ownership of a Control Point when it gets hit below 30% of its max hp. It will also update number of control points each player owns via PlayerControlPointCount integer array and uses that value to update leaderboard referenced here via variable called PlayerLeaderboard
 
Top