Ok so my leaderboard isn't updating when there is more then one player on a team. These are the triggers:
Unit Dies
Leaderboard Unit Dies
Events
Unit - Any Unit dies
Local Variables
p = 0 <Integer>
Conditions
(Unit type of (Triggering unit)) != Auto Turret (Lv1)
(Unit type of (Triggering unit)) != Auto Turret (Lv2)
(Unit type of (Triggering unit)) != Auto Turret (Lv3)
(Unit type of (Triggering unit)) != Teleporter Entrance
(Unit type of (Triggering unit)) != Teleporter Exit
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
((Owner of (Triggering unit)) is in Team 1) == true
((Owner of (Killing unit)) is in Team 1) == false
Then
Variable - Set p = (Killing player)
Variable - Set Kills[p] = (Kills[p] + 1)
Leaderboard - Set Leaderboard item text at column 2 and row (p + 1) to (Text(Kills[p]))
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
((Owner of (Triggering unit)) is in Team 2) == true
((Owner of (Killing unit)) is in Team 2) == false
Then
Variable - Set p = (Killing player)
Variable - Set Kills[p] = (Kills[p] + 1)
Leaderboard - Set Leaderboard item text at column 2 and row (p + 1) to (Text(Kills[p]))
Else
Update Leaderboard
Leaderboard Update
Events
Timer - Every 0.3 seconds of Game Time
Local Variables
Conditions
Actions
Leaderboard - Set Leaderboard item text at column 2 and row 8 to (Text(Kills[(1 + (Kills[2] + (Kills[3] + (Kills[4] + (Kills[5] + Kills[6])))))]))
Leaderboard - Set Leaderboard item text at column 2 and row 16 to (Text(Kills[(7 + (Kills[8] + (Kills[9] + (Kills[10] + (Kills[11] + Kills[12])))))]))
Leaderboard - Set Leaderboard item text at column 3 and row 8 to (Text(Caps[(1 + (Caps[2] + (Caps[3] + (Caps[4] + (Caps[5] + Caps[6])))))]))
Variable - Set Total Caps = Caps[(1 + (Caps[2] + (Caps[3] + (Caps[4] + (Caps[5] + Caps[6])))))]
Leaderboard - Set Leaderboard item text at column 3 and row 16 to (Text(Caps[(7 + (Caps[8] + (Caps[9] + (Caps[10] + (Caps[11] + Caps[12])))))]))
Variable - Set Total Caps 2 = Caps[(7 + (Caps[8] + (Caps[9] + (Caps[10] + (Caps[11] + Caps[12])))))]
General - If (Conditions) then do (Actions) else do (Actions)
If
Start Counting Caps == true
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Total Caps > Total Caps 2
Then
Leaderboard - Set Leaderboard item text at column 3 and row (18 + 0) to "Team 1"
Else
Leaderboard - Set Leaderboard item text at column 3 and row (18 + 0) to "Team 2"
Else
There is two teams. I don't want the leaderboard to update if you kill your own teammate. The individual leaderboard tracking works fine. It tracks all of the kills and cap's you do for every player.
The problem is, the TOTAL isn't working. In single player, the total matches your kills as the player. When there is more then one player though, the TOTAL doesn't add up, which is the second trigger.
Leaderboard Update
Events
Timer - Every 0.3 seconds of Game Time
Local Variables
Conditions
Actions
Leaderboard - Set Leaderboard item text at column 2 and row 8 to IntToText(gv_Kills[1] + gv_Kills[2] + gv_Kills[3] + gv_Kills[4] + gv_Kills[5] + gv_Kills[6])
Leaderboard - Set Leaderboard item text at column 2 and row 16 to IntToText(gv_Kills[7] + gv_Kills[8] + gv_Kills[9] + gv_Kills[10] + gv_Kills[11] + gv_Kills[12])
Leaderboard - Set Leaderboard item text at column 3 and row 8 to IntToText(gv_Caps[1] + gv_Caps[2] + gv_Caps[3] + gv_Caps[4] + gv_Caps[5] + gv_Caps[6])
Variable - Set Total Caps = (gv_Caps[1] + gv_Caps[2] + gv_Caps[3] + gv_Caps[4] + gv_Caps[5] + gv_Caps[6])
Leaderboard - Set Leaderboard item text at column 3 and row 16 to IntToText(gv_Caps[7] + gv_Caps[8] + gv_Caps[9] + gv_Caps[10] + gv_Caps[11] + gv_Caps[12])
Variable - Set Total Caps 2 = (gv_Caps[7] + gv_Caps[8] + gv_Caps[9] + gv_Caps[10] + gv_Caps[11] + gv_Caps[12])
General - If (Conditions) then do (Actions) else do (Actions)
If
Start Counting Caps == true
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Total Caps > Total Caps 2
Then
Leaderboard - Set Leaderboard item text at column 3 and row (18 + 0) to "Team 1"
Else
Leaderboard - Set Leaderboard item text at column 3 and row (18 + 0) to "Team 2"
Else
mhh... maybe you changed the name of the variable Kills earlier ? If you did so, uncheck "Based on Name" in your variable definition and change the script identifier to "Kills". Hope that works.
Ok so I just noticed another problem that doesn't make any sense to me.
This is the trigger I have setup when you capture the enemy flag:
Team 1 Flag Capture
Events
Unit - Any Unit Enters Team 1 Flag Spot
Local Variables
p = 0 <Integer>
Conditions
(Triggering unit) == Team 2 Flag Carrier
(Intelligence (Zerg Large) [48.01, 9.88] is in Team 1 Flag Spot) == true
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Team 2 Flag Carrier == Scout Cap[(Owner of (Triggering unit))]
Then
Variable - Set Team 2 Flag Carrier = No Unit
Variable - Set Team 2's Flag = false
Variable - Set Start Counting Caps = true
Variable - Set p = (Owner of (Triggering unit))
Variable - Set Caps[p] = (Caps[p] + 2)
Leaderboard - Set Leaderboard item text at column 3 and row (p + 1) to (Text(Caps[p]))
Sound - Play We Captured Flag for Team 1 (at 100.0% volume, skip the first 0.0 seconds)
Sound - Play Enemy Captured Flag for Team 2 (at 100.0% volume, skip the first 0.0 seconds)
Unit - Move Intelligence (Protoss Large) [48.06, 110.86] instantly to (Center of Team 2 Flag Spot) (No Blend)
Unit - Remove (Triggering unit) from the game
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing 270.0 degrees (No Options)
Unit - Set (Last created unit) Life (Percent) to 100.0
Variable - Set Player's Unit[(Owner of (Last created unit))] = (Last created unit)
Variable - Set Unit Alive[(Triggering player)] = true
Unit Selection - Select (Last created unit) for player (Triggering player)
Else
Variable - Set Team 2 Flag Carrier = No Unit
Variable - Set Team 2's Flag = false
Variable - Set Start Counting Caps = true
Variable - Set p = (Owner of (Triggering unit))
Variable - Set Caps[p] = (Caps[p] + 1)
Leaderboard - Set Leaderboard item text at column 3 and row (p + 1) to (Text(Caps[p]))
Sound - Play We Captured Flag for Team 1 (at 100.0% volume, skip the first 0.0 seconds)
Sound - Play Enemy Captured Flag for Team 2 (at 100.0% volume, skip the first 0.0 seconds)
Unit - Move Intelligence (Protoss Large) [48.06, 110.86] instantly to (Center of Team 2 Flag Spot) (No Blend)
Unit - Remove (Triggering unit) from the game
Unit - Create 1 (Unit type of (Triggering unit)) for player (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing 270.0 degrees (No Options)
Unit - Set (Last created unit) Life (Percent) to 100.0
Variable - Set Player's Unit[(Owner of (Last created unit))] = (Last created unit)
Variable - Set Unit Alive[(Triggering player)] = true
Unit Selection - Select (Last created unit) for player (Triggering player)
It pretty much says when you capture the flag, if your the scout class then award 2 points for the cap, and if not only award 1.
Well, it's only giving the two points on your initial capture, then it's reverting back to 1 per cap...
It isn't "Team 2 Flag Carrier == Scout Cap[(Owner of (Triggering unit))]" this condition that's making the else part fire, because there is no trigger anywhere that says set "Scout Cap" to no unit. So, this should fire EVERY time if your the scout class...
two thoughts:
1. if you remove a unit it will no longer be stored in your scout cap. you have to change Scout Cap[(Owner of (Triggering unit))] to the newly created unit.
2. put chat messages in the else part which return "Team 2 Flag Carrier" and "Scout Cap[(Owner of (Triggering unit))]" and "(Owner of (Triggering unit))" for you to check which unit it is. Also I don't think the error is necessarily in this trigger.
Ya, the only time the "scout cap" variable is set is when you pick your class as the scout and the unit is spawned. There is no trigger removing it. So, this isn't the problem.
Well the only other related trigger (besides the one setting scout cap) is this:
Team 1 Flag Pick Up
Events
Unit - Any Unit Enters Team 1 Flag
Local Variables
Conditions
Team 1's Flag == false
((Triggering player) is in Team 2) == true
Actions
Variable - Set Team 1's Flag = true
Variable - Set Team 1 Flag Carrier = (Triggering unit)
Actor - Attach Unit Holding the Red Flag to Center on (Triggering unit)
Sound - Play Enemy Has Our Flag for Team 1 (at 100.0% volume, skip the first 0.0 seconds)
Sound - Play We Have the Enemy Flag for Team 2 (at 100.0% volume, skip the first 0.0 seconds)
Unit - Move Intelligence (Zerg Large) [48.01, 9.88] instantly to (Center of Move Flag Here) (No Blend)
As I was typing this I just figured it out! The only way I can get rid of that attached actor to the unit is to replace the unit. Upon replacing it, the variable isn't being set to the unit. DUH! lol
Ya that fixed it. Thanks again lol. AND for the LAST bug in my map, besides the stupid player thing with the lobby, is this.
This is the general trigger when a unit dies:
Unit Dies
Events
Unit - Any Unit dies
Local Variables
A = 0 <Integer>
P = 0 <Integer>
Conditions
Repick Unit[(Owner of (Triggering unit))] == false
Unit Alive[(Owner of (Triggering unit))] == true
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) != Auto Turret (Lv1)
(Unit type of (Triggering unit)) != Auto Turret (Lv2)
(Unit type of (Triggering unit)) != Auto Turret (Lv3)
(Unit type of (Triggering unit)) != Teleporter Entrance
(Unit type of (Triggering unit)) != Teleporter Exit
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
Team 1's Flag == true
Team 1 Flag Carrier == (Triggering unit)
Then
Variable - Set Team 1's Flag = false
Variable - Set Team 1 Flag Can Be Recaptured = true
Variable - Set Team 1 Flag Carrier = No Unit
Sound - Play Enemy Dropped Flag for Team 1 (at 100.0% volume, skip the first 0.0 seconds)
Sound - Play We Have Dropped Flag for Team 2 (at 100.0% volume, skip the first 0.0 seconds)
Unit - Move Intelligence (Zerg Large) [48.01, 9.88] instantly to (Position of (Triggering unit)) (No Blend)
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Team 2's Flag == true
Team 2 Flag Carrier == (Triggering unit)
Then
Variable - Set Team 2's Flag = false
Variable - Set Team 2 Flag Can Be Recaptured = true
Variable - Set Team 2 Flag Carrier = No Unit
Sound - Play Enemy Dropped Flag for Team 2 (at 100.0% volume, skip the first 0.0 seconds)
Sound - Play We Have Dropped Flag for Team 1 (at 100.0% volume, skip the first 0.0 seconds)
Unit - Move Intelligence (Protoss Large) [48.06, 110.86] instantly to (Position of (Triggering unit)) (No Blend)
Else
Variable - Set Dying Unit[(Owner of (Triggering unit))] = (Unit type of (Triggering unit))
Variable - Set Unit Alive[(Owner of (Triggering unit))] = false
Timer - Start Respawn Timer[(Owner of (Triggering unit))] as a One Shot timer that will expire in 15.0 Real Time seconds
Variable - Set Respawn Timer[(Owner of (Triggering unit))] = (Last started timer)
Timer - Create a timer window for Respawn Timer[(Owner of (Triggering unit))], with the title "Repawn In:", using Remaining time (initially Visible)
Variable - Set Respawn Timer Window[(Owner of (Triggering unit))] = (Last created timer window)
Timer - Show Respawn Timer Window[(Owner of (Triggering unit))] for (Player group((Owner of (Triggering unit))))
Leaderboard - Minimize Leaderboard for (Player group((Owner of (Triggering unit))))
General - Wait 15.0 Real Time seconds
General - For each integer A from 1 to 12 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Unit Alive[A] == false
Then
General - If (Conditions) then do (Actions) else do (Actions)
If
(A is in Team 1) == true
Then
Camera - Pan the camera for player A to (Center of Team 1 Spawn) over 0.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Lock camera input for player A
Variable - Set Unit Alive[A] = false
Unit - Create 1 Dying Unit[A] for player A at Team 1 facing 270.0 degrees (No Options)
Unit - Set (Last created unit) Life (Percent) to 100.0
Variable - Set Player's Unit[(Owner of (Last created unit))] = (Last created unit)
Variable - Set Unit Alive[A] = true
Unit Selection - Select (Last created unit) for player A
Camera - Unlock camera input for player A
Sound - Play Spawn for (Player group(A)) (at 100.0% volume, skip the first 0.0 seconds)
Timer - Hide Respawn Timer Window[A] for (Player group(A))
Leaderboard - Maximize Leaderboard for All Players[A]
Else
Camera - Pan the camera for player A to (Center of Team 2 Spawn) over 0.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Do Not use smart panning
Camera - Lock camera input for player A
Variable - Set Unit Alive[A] = false
Unit - Create 1 Dying Unit[A] for player A at Team 2 facing 270.0 degrees (No Options)
Unit - Set (Last created unit) Life (Percent) to 100.0
Variable - Set Player's Unit[(Owner of (Last created unit))] = (Last created unit)
Variable - Set Unit Alive[A] = true
Unit Selection - Select (Last created unit) for player A
Camera - Unlock camera input for player A
Sound - Play Spawn for (Player group(A)) (at 100.0% volume, skip the first 0.0 seconds)
Timer - Hide Respawn Timer Window[A] for All Players[A]
Leaderboard - Show all leaderboards for All Players[A]
Else
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == (Unit type of Turret[(Owner of (Triggering unit))])
Then
Variable - Set Turret[(Owner of (Triggering unit))] = No Unit
Player - Modify player (Owner of (Triggering unit)) Minerals: Set To 1
UI - Display "Your Turret has been destroyed!" for All Players[(Owner of (Triggering unit))] to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == (Unit type of Teleporter Entrance[(Owner of (Triggering unit))])
Then
Variable - Set Teleporter Entrance[(Owner of (Triggering unit))] = No Unit
Variable - Set Tele Entrance Alive[(Owner of (Triggering unit))] = false
Region - Move Tele Entrance Regions[(Owner of (Triggering unit))] to (Random point in move tele"s here)
Player - Modify player (Owner of (Triggering unit)) Vespene: Set To 1
UI - Display "Your Teleporter Entrance has been d..." for All Players[(Owner of (Triggering unit))] to Subtitle area
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of (Triggering unit)) == (Unit type of Teleporter Exit[(Owner of (Triggering unit))])
Then
Variable - Set Teleporter Exit[(Owner of (Triggering unit))] = No Unit
Variable - Set Tele Exit Alive[(Owner of (Triggering unit))] = false
Player - Modify player (Owner of (Triggering unit)) Terrazine: Set To 1
Region - Move Tele Exit Regions[(Owner of (Triggering unit))] to (Random point in move tele"s here)
UI - Display "Your Teleporter Exit has been destr..." for All Players[(Owner of (Triggering unit))] to Subtitle area
Else
Ok, so everything works in this trigger, with the exception of a few things.... When a teammates dies it's showing the respawn timer and minimizing leaderboard for every player and not just the player in question. What do I have setup here that's wrong? It looks right to me :\
Ok that fixed the respawn windows. The leaderboard isn't working. However, I just noticed if the minimize leaderboard fires if ANY player dies. So, your opponent can die and it minimizes your leaderboard...
This is what you meant right?
Leaderboard - Maximize Leaderboard for (All players)
Leaderboard - Minimize Leaderboard for (Player group((Owner of (Triggering unit))))
Anyone else know how to fix the leaderboard aspect? From what I can tell, you can't target 1 individual player for the leaderboard maximize/minimize function.
I would imagine you should be able to. I havent tried to decrypt what youre trying to do from the mess above too much so im not sure exactly on the problem, but it seems to me that this block of text:
is part of the first if..then..else statement and that is why its being triggered for everyone because its being told to.
That what it seems like anyways. Either way, my advice to you is to disable that large trigger, make a new one to use, and strip it down to only what the problem is so you can better see what is happening, then come back with that so its not cluttered with the rest of your stuff. Also you can look at the script code perhaps to get a more clean look at the logic.
Edit: Also you could add in some debugging messages in places to see how the code is being run, for example, by the leaderboard minimize action, put a UI Display message action for example that spits out some variables, like the owner of triggering unit, etc, that way you can see where the problem is.
The trigger works fine. The only thing that doesn't work is the "leaderboard maximize/minimize function." Whenever it fires, it minimizes the leaderboard for ALL players. It's dumb
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Ok so my leaderboard isn't updating when there is more then one player on a team. These are the triggers:
Unit Dies
Update Leaderboard
What it looks like:
What am I doing wrong?
So, Kills[p] never changes (?) then
doesn't work. So, you might have no players in your teams.
There is two teams. I don't want the leaderboard to update if you kill your own teammate. The individual leaderboard tracking works fine. It tracks all of the kills and cap's you do for every player.
The problem is, the TOTAL isn't working. In single player, the total matches your kills as the player. When there is more then one player though, the TOTAL doesn't add up, which is the second trigger.
Lets try something else for this:
Try this custom script for Text:
gv_ means global variable and is necessary when writing a custom script (lv_ is local variable). IntToText means change Integer into text.
Do this with your other Leaderboard Items as well.
This is the error I get when trying to do that:
Code format:
mhh... maybe you changed the name of the variable Kills earlier ? If you did so, uncheck "Based on Name" in your variable definition and change the script identifier to "Kills". Hope that works.
Ok, so I checked the identifier and the based on name showed "kills." So I guess it's case sensitive. Changed it to lower case k and it saved.
Let's see if it works!
Ok, that worked! Thanks man. That's weird how it's the exact same thing, but it only works as custom script.
great. Good that this worked, because I really ran out of ideas. :)
Ok so I just noticed another problem that doesn't make any sense to me.
This is the trigger I have setup when you capture the enemy flag:
It pretty much says when you capture the flag, if your the scout class then award 2 points for the cap, and if not only award 1.
Well, it's only giving the two points on your initial capture, then it's reverting back to 1 per cap...
It isn't "Team 2 Flag Carrier == Scout Cap[(Owner of (Triggering unit))]" this condition that's making the else part fire, because there is no trigger anywhere that says set "Scout Cap" to no unit. So, this should fire EVERY time if your the scout class...
two thoughts: 1. if you remove a unit it will no longer be stored in your scout cap. you have to change Scout Cap[(Owner of (Triggering unit))] to the newly created unit.
2. put chat messages in the else part which return "Team 2 Flag Carrier" and "Scout Cap[(Owner of (Triggering unit))]" and "(Owner of (Triggering unit))" for you to check which unit it is. Also I don't think the error is necessarily in this trigger.
Ya, the only time the "scout cap" variable is set is when you pick your class as the scout and the unit is spawned. There is no trigger removing it. So, this isn't the problem.
Well the only other related trigger (besides the one setting scout cap) is this:
As I was typing this I just figured it out! The only way I can get rid of that attached actor to the unit is to replace the unit. Upon replacing it, the variable isn't being set to the unit. DUH! lol
Ya that fixed it. Thanks again lol. AND for the LAST bug in my map, besides the stupid player thing with the lobby, is this.
This is the general trigger when a unit dies:
Ok, so everything works in this trigger, with the exception of a few things.... When a teammates dies it's showing the respawn timer and minimizing leaderboard for every player and not just the player in question. What do I have setup here that's wrong? It looks right to me :\
maybe add a line in front of this:
do something similar to the leaderboard action.
Ok that fixed the respawn windows. The leaderboard isn't working. However, I just noticed if the minimize leaderboard fires if ANY player dies. So, your opponent can die and it minimizes your leaderboard...
This is what you meant right?
Anyone else know how to fix the leaderboard aspect? From what I can tell, you can't target 1 individual player for the leaderboard maximize/minimize function.
No one knows!?
Has anyone come up with a solution to fixing the leaderboard aspect?
From what I can tell, you can't target 1 individual player for the leaderboard maximize/minimize function.
I would imagine you should be able to. I havent tried to decrypt what youre trying to do from the mess above too much so im not sure exactly on the problem, but it seems to me that this block of text:
is part of the first if..then..else statement and that is why its being triggered for everyone because its being told to.
That what it seems like anyways. Either way, my advice to you is to disable that large trigger, make a new one to use, and strip it down to only what the problem is so you can better see what is happening, then come back with that so its not cluttered with the rest of your stuff. Also you can look at the script code perhaps to get a more clean look at the logic.
Edit: Also you could add in some debugging messages in places to see how the code is being run, for example, by the leaderboard minimize action, put a UI Display message action for example that spits out some variables, like the owner of triggering unit, etc, that way you can see where the problem is.
@Joshjje: Go
The trigger works fine. The only thing that doesn't work is the "leaderboard maximize/minimize function." Whenever it fires, it minimizes the leaderboard for ALL players. It's dumb