- Joined
- Nov 12, 2024
- Messages
- 2
Having trouble with leadboard, I have created a leadboard listing all the players and display their current unit count. I am having trouble when any of the player creates a unit, whether it be a unit trained or summoned by hero ability, it doesn't add up the that player's unit count. But, when a unit dies, either a unit or structure, it manages to deduct it from the unit count in the leadboard.
Variables:
Leadboard - Leadboard
TempGroup - (Unit Group)
UnitCount - (Integer) (Array)
Variables:
Leadboard - Leadboard
TempGroup - (Unit Group)
UnitCount - (Integer) (Array)
-
Leadboard
-

Events
-


Time - Elapsed game time is 0.00 seconds
-
-

Conditions
-

Actions
-


Leaderboard - Create a leaderboard for (All players) titled Living Units
-


Set Leadboard = (Last created leaderboard)
-


Player Group - Pick every player in (All players) and do (Actions)
-



Loop - Actions
-




Leaderboard - Add (Picked player) to Leadboard with label (Name of (Picked player)) and value 0
-




Set TempGroup = (Units owned by (Picked player))
-




Unit Group - Pick every unit in TempGroup and do (Actions)
-





Loop - Actions
-






Set UnitCount[(Player number of (Picked player))] = (UnitCount[(Player number of (Picked player))] + 1)
-
-
-




Leaderboard - Change the value for (Picked player) in Leadboard to UnitCount[(Player number of (Picked player))]
-




Custom script: call DestroyGroup(udg_TempGroup)
-
-
-
-
-
Unit Enters
-

Events
-


Unit - A unit enters (Entire map)
-
-

Conditions
-

Actions
-


Set UnitCount[(Player number of (Triggering player))] = (UnitCount[(Player number of (Triggering player))] + 1)
-


Leaderboard - Change the value for (Picked player) in Leadboard to UnitCount[(Player number of (Picked player))]
-
-
-
Unit Dies
-

Events
-


Unit - A unit Dies
-
-

Conditions
-

Actions
-


Set UnitCount[(Player number of (Owner of (Triggering unit)))] = (UnitCount[(Player number of (Owner of (Triggering unit)))] - 1)
-


Leaderboard - Change the value for (Owner of (Triggering unit)) in Leadboard to UnitCount[(Player number of (Owner of (Triggering unit)))]
-
-
-
[/TRGGER]
-
The Unit Enters trigger is not detecting if a unit is created by a player, whether it's a structure or a unit.
Last edited:





