Carrigage, you make it harder than it is. Integer variable is a variable that has a certain value, e.g. number 5.
How do they work?
-
triggr
-
Events
-
Unit - A unit dies
-
Conditions
-
Actions
-
Set Kills[Player Number of (Owner of (Killing unit))] = ((Kills[Player Number of (Owner of (Killing unit))]) + 1)
What's this?
Go to Set Variable action and make a variable called "Kills" of type "Integer". Then, tick the "Array".
What this specific action does? When you have an action of type set Variable = Variable + 1, then, this variable increases by 1, once the specified event has fired. For our occasion, the event is "A unit dies", so, this integer variable will increase its value once a unit dies. So, 1 unit dies, the Integer Variable will become 1. A second unit dies, it will become 2, and so on.
What's the array: The array attaches the specified variable to a specific unit/player and other stuff, up to what you want to do. For our occasion, it attaches the kills variable to the owner of killing unit, so that we get the famous MPI result (= Multi Player Instanceability). So, the Integer variable will increase for each player seperately, once a unit owned by that player kills another unit.
Then, we can have: Player 1 for example kills a unit, so, his integer variable will become 1. Player 2 kills two units, but his integer variable will become 2, not 1, while Player's 1 will remain one, since he only killed one unit.
There are other twists you can do, e.g.:
-
Trigger
-
Events
-
Unit - A unit dies
-
Conditions
-
((Dying unit) is a Hero) Equal to True
-
(Race of (Dying unit)) Equal to Orc
-
Actions
-
Set Kills[Player Number of (Owner of (Killing unit))] = ((Kills[Player Number of (Owner of (Killing unit))]) + 1)
You can see we have a condition attached now, not only one condition, but two.
So, this one will do:
Once a unit dies, the trigger will detect whether the dying a unit was a hero and belonged to the Orc race. To define the race of the unit, simply go to the Object Editor, "Units" tab, go to your unit and scroll down to "Stats - Race". There is the race of the unit. So, for this trigger only, once a unit dies and is a hero AND orc, the Kills integer will increase by 1. If the unit IS a hero, but not of race orc, the Kills variable won't increase, since it has to meet both requirements: race & hero classification.
For the deaths part, it goes the same, although the variable will look like this:
-
Trigger2
-
Events
-
Unit - A unit dies
-
Conditions
-
Actions
-
Set Deaths[Player Number of (Owner of (Dying unit))] = ((Deaths[Player Number of (Owner of (Dying unit))]) + 1)
This works exactly like the first trigger, although this variable is attached to the owner of the dying unit, so that it will result the deaths' score of a player's units.
Also, the action:
-
Multiboard - Set the Item text to Row (1 + (Player Number of (Owner of (Killing unit))), Column 2 to (Kills[Player Number of (Owner of (Killing unit))])
This will be implemented within the first trigger i gave you, the one with the "Kills" variable, it will actually "refresh" the text in the multiboard for the owner of the killing unit.
-
Multiboard - Set the Item text to Row (1 + (Player Number of (Owner of (Dying unit))), column 3 to Deaths[Player Number of (Owner of (Dying unit))]
This will be for the deaths integer variable. You can see that the column is "3", not "2", as in "Kills" variable.
The initial trigger will be like this:
-
Trigger0
-
Events
-
Time - Elapsed time is 0.00 seconds
-
Conditions
-
Actions
-
Multiboard - Create a multiboard with (1 + <your players>) rows and 3 columns
-
Multiboard - Set the item text of Row 1, column 1 to "Players"
-
Multiboard - Set the item text of Row 1, column 2 to "Kills"
-
Multiboard - Set the item text of Row 1, column 3 to "Deaths"
-> (1 + <your players>): E.g. if your map has 10 players, your rows will be 11, because one row will be used for titles (the Players/ Kills/ Deaths titles).