I'm trying to create a Kill count and Leaderboard but it's not working and I'm not sure why.
Here is my Trigger:
Kills
Events
Unit - Any Unit dies
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Killing player) == 1
Then
Variable - Modify P1Kills: + 1
Leaderboard - Set (Last created leaderboard) item text at column 2 and row 1 to (Text(P1Kills))
Else
There's more for the other players. P1Kills is Global. Player 1 is the player I am during test (As on the Leaderboard it shows "Local Player"), and I put a bunch of Player 5 Drones on the map to test. I kill them, nothing happens, then during my End-Game Trigger, it says that the Neutral Player (First one on the Player List if I remember correctly) has won with Zero kills, meaning it's not recording my kills to the variable.
If that were it, then it would still give me the Victory at the Endgame Trigger (Which compares all players scores to a local variable in that trigger, then gives Victory to the best player). I can post that too if you want, but it's just 9 copies of
Compare if p1Kills > localvar
if true, localvar = p1kills
etc, then at the end, victory is given to the winning player and defeat to everyone else. It successfully does all of that, as both are null values, but the game reports Neutral Player wins with 0 kills. Since Neutral Player is Player 0, it's the first compared, then after every comparison comes out false because they are equal to not greater, so it never changes.
Sorry if that was a little confusing, but I don't think it's that. I'll check that map regardless see if I can find a different reason.
@uiasdnmb: Killing Player works just fine (see my example map).
Having copies of triggers is always a bad idea to start with. Every instance of redundancy is bad imho if it can be easily avoided. If you have 9 (more or less) equal triggers and you want to change a little thing, you will have to change all 9 triggers and if you forget one of them, you will never find the error.
You want to know, which player has the most kills? Here is the way to do it:
I'm trying to create a Kill count and Leaderboard but it's not working and I'm not sure why.
Here is my Trigger:
Kills
Events
Unit - Any Unit dies
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Killing player) == 1
Then
Variable - Modify P1Kills: + 1
Leaderboard - Set (Last created leaderboard) item text at column 2 and row 1 to (Text(P1Kills))
Else
There's more for the other players. P1Kills is Global. Player 1 is the player I am during test (As on the Leaderboard it shows "Local Player"), and I put a bunch of Player 5 Drones on the map to test. I kill them, nothing happens, then during my End-Game Trigger, it says that the Neutral Player (First one on the Player List if I remember correctly) has won with Zero kills, meaning it's not recording my kills to the variable.
Any idea what's wrong anyone?
@Polantaris: Go
It's maybe because you are using "Last Created Leaderboard", which is not defined at that point.
Here is a small example map with a working kill counter:
@Pfaeff:
If that were it, then it would still give me the Victory at the Endgame Trigger (Which compares all players scores to a local variable in that trigger, then gives Victory to the best player). I can post that too if you want, but it's just 9 copies of
Compare if p1Kills > localvar
if true, localvar = p1kills
etc, then at the end, victory is given to the winning player and defeat to everyone else. It successfully does all of that, as both are null values, but the game reports Neutral Player wins with 0 kills. Since Neutral Player is Player 0, it's the first compared, then after every comparison comes out false because they are equal to not greater, so it never changes.
Sorry if that was a little confusing, but I don't think it's that. I'll check that map regardless see if I can find a different reason.
Try using Owner of (Killing unit) instead of Killing player, think it may help.
@uiasdnmb: Killing Player works just fine (see my example map).
Having copies of triggers is always a bad idea to start with. Every instance of redundancy is bad imho if it can be easily avoided. If you have 9 (more or less) equal triggers and you want to change a little thing, you will have to change all 9 triggers and if you forget one of them, you will never find the error.
You want to know, which player has the most kills? Here is the way to do it:
Edit: After a while trying my own, then basing it off of your examples, I'm happy to say that it's working. Thanks a lot Pfaeff.