I hope that this isn't covered in another post here or anywhere else, but I searched for a good hour and couldn't find the results I need. Currently in my map I have a simple dialog leaderboard which has a progression bar, listed player names, and their life count. I need a way to update the leaderboard for when a player leaves. I would like to set the player's lives to 0 and their name to "Left" or something similar.
The code below shows the trigger which creates the leaderboard...
LeaderBoardSetupEventsTimer-Elapsedtimeis0.0GameTimesecondsLocalVariablesConditionsActionsPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer(Pickedplayer))==PlayingThenVariable-ModifyNumberOfPlayingPlayers:+1ElseDialog-CreateaModaldialogofsize(350,(125+(NumberOfPlayingPlayers*27)))at(0,8)relativetoTopRightofscreenVariable-SetLeaderboard=(Lastcreateddialog)Variable-SetRowOffset=90Variable-SetLabel_ProBar=(Lastcreateddialogitem)Dialog-SetLabel_ProBarstyleto"International13"for(Allplayers)------- HeadersDialog-CreatealabelfordialogLeaderboardwiththedimensions(175,25)anchoredtoTopLeftwithanoffsetof(45,70)withthetext"Player Name"colorsettoWhitetextwriteoutsettofalsewithawriteoutdurationof2.0Dialog-CreatealabelfordialogLeaderboardwiththedimensions(75,25)anchoredtoTopRightwithanoffsetof(25,70)withthetext"Lifes"colorsettoWhitetextwriteoutsettofalsewithawriteoutdurationof2.0------- PlayersPlayerGroup-Pickeachplayerin(Allplayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer(Pickedplayer))==PlayingThenDialog-CreateanimagefordialogLeaderboardwiththedimensions(282,37)anchoredtoTopLeftwithanoffsetof(35,(RowOffset-9))settingthetooltipto""usingtheimageAssets\Textures\ui_battlenet_loading_bar_player_frame_highlighted.ddsasaNormaltypewithtiledsettofalsetintcolor(Color((Currentplayer(Pickedplayer)color)))andblendmodeNormalDialog-CreatealabelfordialogLeaderboardwiththedimensions(125,25)anchoredtoTopLeftwithanoffsetof(50,RowOffset)withthetext(Nameofplayer(Pickedplayer))colorsetto(Color((Defaultplayer(Pickedplayer)color)))textwriteoutsettotruewithawriteoutdurationof2.0------- Label Points and LivesDialog-CreatealabelfordialogLeaderboardwiththedimensions(75,25)anchoredtoTopRightwithanoffsetof(17,RowOffset)withthetext(Text(Lives[0]))colorsetto(Color((Defaultplayer(Pickedplayer)color)))textwriteoutsettofalsewithawriteoutdurationof2.0Variable-SetLabel_Lives[(Pickedplayer)]=(Lastcreateddialogitem)Variable-ModifyRowOffset:+27ElseGeneral-Wait2.0GameTimesecondsDialog-ShowLeaderboardfor(Allplayers)
And this next trigger updates and changes the player's life when they die and creates a new unit for them...
UpdateLivesEventsUnit-AnyUnitdiesLocalVariablesConditions(Unittypeof(Triggeringunit))==BanelingActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfLives[(Ownerof(Triggeringunit))]>=2Then------- Updates leaderboard, pans camera, creates Baneling and displays "has died."Variable-ModifyLives[(Ownerof(Triggeringunit))]:-1Dialog-SetLabel_Lives[(Ownerof(Triggeringunit))]textto(Text(Lives[(Ownerof(Triggeringunit))]))for(Allplayers)Camera-Panthecameraforplayer(Ownerof(Triggeringunit))toRespawnover0.75secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningUnit-Create1Banelingforplayer(Ownerof(Triggeringunit))atRespawnfacingRespawn(NoOptions)UI-Display((Text(Nameofplayer(Ownerof(Triggeringunit)))withcolor(Color((Currentplayer(Triggeringplayer)color))))+" has died.")for(Allplayers)toChatareaElse------- Updates leaderboard to 0 and displays "has no remaining lives."Variable-SetLives[(Ownerof(Triggeringunit))]=0Dialog-SetLabel_Lives[(Ownerof(Triggeringunit))]textto(Text(Lives[(Ownerof(Triggeringunit))]))for(Allplayers)UI-Display((Text(Nameofplayer(Ownerof(Triggeringunit)))withcolor(Color((Currentplayer(Ownerof(Triggeringunit))color))))+" has no remaining lives.")for(Allplayers)toChatarea
Those are the two triggers which are important. If you have the solution, I'd love to hear your suggestion! Thanks much!
Would this method require me to set a spot for each player in the dialog box? Rather then using the "Pick Each Player and then.." action?
I tried what you said and it updates all of the players names.
I hope that this isn't covered in another post here or anywhere else, but I searched for a good hour and couldn't find the results I need. Currently in my map I have a simple dialog leaderboard which has a progression bar, listed player names, and their life count. I need a way to update the leaderboard for when a player leaves. I would like to set the player's lives to 0 and their name to "Left" or something similar.
The code below shows the trigger which creates the leaderboard...
LeaderBoardSetupEventsTimer-Elapsedtimeis0.0GameTimesecondsLocalVariablesConditionsActionsPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer(Pickedplayer))==PlayingThenVariable-ModifyNumberOfPlayingPlayers:+1ElseDialog-CreateaModaldialogofsize(350,(125+(NumberOfPlayingPlayers*27)))at(0,8)relativetoTopRightofscreenVariable-SetLeaderboard=(Lastcreateddialog)Variable-SetRowOffset=90Variable-SetLabel_ProBar=(Lastcreateddialogitem)Dialog-SetLabel_ProBarstyleto"International13"for(Allplayers)------- HeadersDialog-CreatealabelfordialogLeaderboardwiththedimensions(175,25)anchoredtoTopLeftwithanoffsetof(45,70)withthetext"Player Name"colorsettoWhitetextwriteoutsettofalsewithawriteoutdurationof2.0Dialog-CreatealabelfordialogLeaderboardwiththedimensions(75,25)anchoredtoTopRightwithanoffsetof(25,70)withthetext"Lifes"colorsettoWhitetextwriteoutsettofalsewithawriteoutdurationof2.0------- PlayersPlayerGroup-Pickeachplayerin(Allplayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)If(Statusofplayer(Pickedplayer))==PlayingThenDialog-CreateanimagefordialogLeaderboardwiththedimensions(282,37)anchoredtoTopLeftwithanoffsetof(35,(RowOffset-9))settingthetooltipto""usingtheimageAssets\Textures\ui_battlenet_loading_bar_player_frame_highlighted.ddsasaNormaltypewithtiledsettofalsetintcolor(Color((Currentplayer(Pickedplayer)color)))andblendmodeNormalDialog-CreatealabelfordialogLeaderboardwiththedimensions(125,25)anchoredtoTopLeftwithanoffsetof(50,RowOffset)withthetext(Nameofplayer(Pickedplayer))colorsetto(Color((Defaultplayer(Pickedplayer)color)))textwriteoutsettotruewithawriteoutdurationof2.0------- Label Points and LivesDialog-CreatealabelfordialogLeaderboardwiththedimensions(75,25)anchoredtoTopRightwithanoffsetof(17,RowOffset)withthetext(Text(Lives[0]))colorsetto(Color((Defaultplayer(Pickedplayer)color)))textwriteoutsettofalsewithawriteoutdurationof2.0Variable-SetLabel_Lives[(Pickedplayer)]=(Lastcreateddialogitem)Variable-ModifyRowOffset:+27ElseGeneral-Wait2.0GameTimesecondsDialog-ShowLeaderboardfor(Allplayers)Andthisnexttriggerupdatesandchangestheplayer's life when they die and creates a new unit for them...UpdateLivesEventsUnit-AnyUnitdiesLocalVariablesConditions(Unittypeof(Triggeringunit))==BanelingActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfLives[(Ownerof(Triggeringunit))]>=2Then------- Updates leaderboard, pans camera, creates Baneling and displays "has died."Variable-ModifyLives[(Ownerof(Triggeringunit))]:-1Dialog-SetLabel_Lives[(Ownerof(Triggeringunit))]textto(Text(Lives[(Ownerof(Triggeringunit))]))for(Allplayers)Camera-Panthecameraforplayer(Ownerof(Triggeringunit))toRespawnover0.75secondswithExistingVelocity%initialvelocity,10%deceleration,andDoNotusesmartpanningUnit-Create1Banelingforplayer(Ownerof(Triggeringunit))atRespawnfacingRespawn(NoOptions)UI-Display((Text(Nameofplayer(Ownerof(Triggeringunit)))withcolor(Color((Currentplayer(Triggeringplayer)color))))+" has died.")for(Allplayers)toChatareaElse------- Updates leaderboard to 0 and displays "has no remaining lives."Variable-SetLives[(Ownerof(Triggeringunit))]=0Dialog-SetLabel_Lives[(Ownerof(Triggeringunit))]textto(Text(Lives[(Ownerof(Triggeringunit))]))for(Allplayers)UI-Display((Text(Nameofplayer(Ownerof(Triggeringunit)))withcolor(Color((Currentplayer(Ownerof(Triggeringunit))color))))+" has no remaining lives.")for(Allplayers)toChatarea
Those are the two triggers which are important. If you have the solution, I'd love to hear your suggestion! Thanks much!
Ok:
you set a veraible to a dialog item before a dialog item is created. That will cause an error.
As you do a 'pick each player' loop at the end, you don't need the first one.
Other than those it all seems fine :/.
First part is a separate action i call in my main trigger this will create all the dialog labels in the dialog at the position of X an Y with the players name in thier color
Built in inc of 34 pixels to stack em up neatly underneath each other.
Also note im refering to my dialog data table entry "Balance Dialog Main" i sugest you add your main dialog/leaderboard to the data table as well to refer to it here.
Second part is the update section for if someone leaves
And last line is the trigger action call i make in my main trigger to get everything going (using my own dialog to test so has modifyd xy pos
When removing a computer from the game with end game trigger it does not register the event "player leaves" as the player actually didnt but was removed(event victory/defeat not leave). You would need to manually update the info on the board if you use triggers to remove a player.
The event leave is triggerd mostly when the player clicks on the "Show Score Screen" button. The computer players do not do this.
@wOlfLisK: Go
I need that loop to set the height for the dialog box :p
@Bezerker18: Go
I'm going to work on this for a bit and let you know what results I get. I think I understand what you're saying but it's different from what I'm use to. Thanks for the help so far though man, seriously appreciated.
Alright, I tried what you said without success. All I need to do is set a data table for the label and set it to something that can be specific, like a player name right? So I tried this.
I hope that this isn't covered in another post here or anywhere else, but I searched for a good hour and couldn't find the results I need. Currently in my map I have a simple dialog leaderboard which has a progression bar, listed player names, and their life count. I need a way to update the leaderboard for when a player leaves. I would like to set the player's lives to 0 and their name to "Left" or something similar.
The code below shows the trigger which creates the leaderboard...
And this next trigger updates and changes the player's life when they die and creates a new unit for them...
Those are the two triggers which are important. If you have the solution, I'd love to hear your suggestion! Thanks much!
After creating the dialog item that shows the value in text (label) use this trigger to save it to the data table
Then when you want the dialog to be updated use this one to do it
Using the data table makes it alot easier to refer to the item in what ever function or action you want to use it in.
@Bezerker18: Go
Would this method require me to set a spot for each player in the dialog box? Rather then using the "Pick Each Player and then.." action? I tried what you said and it updates all of the players names.
if i understand correctly you could use "Picked Player" instead of "All Players" at the end of the second trigger.
That would update it individualy for every player in the same spot
@Bezerker18: Go
Like this? I'll try it and let you know quick.
Update: I'm trying it with this trigger. Still isn't working though.
I'm using a computer player to test it. I kick the computer out when typing in "test." Nothing on the leaderboard changes.
ok thats going to fail :P
Let me get back to ya i think i know what you need
Ok:
Ok this should work fine
First part is a separate action i call in my main trigger this will create all the dialog labels in the dialog at the position of X an Y with the players name in thier color
Built in inc of 34 pixels to stack em up neatly underneath each other.
Also note im refering to my dialog data table entry "Balance Dialog Main" i sugest you add your main dialog/leaderboard to the data table as well to refer to it here.
Second part is the update section for if someone leaves
And last line is the trigger action call i make in my main trigger to get everything going (using my own dialog to test so has modifyd xy pos
If you use these three parts it will work as intended :)
Btw one more thing.
When removing a computer from the game with end game trigger it does not register the event "player leaves" as the player actually didnt but was removed(event victory/defeat not leave). You would need to manually update the info on the board if you use triggers to remove a player.
The event leave is triggerd mostly when the player clicks on the "Show Score Screen" button. The computer players do not do this.
@wOlfLisK: Go I need that loop to set the height for the dialog box :p
@Bezerker18: Go I'm going to work on this for a bit and let you know what results I get. I think I understand what you're saying but it's different from what I'm use to. Thanks for the help so far though man, seriously appreciated.
Question: Where did you get the string picked player section? Can't figure that out for anything.
glad to hear i was able to get a new approch going
That string is an "integer to string" conversion
Picked player number is an integer :)
If you need any assistance just let me know
@Bezerker18: Go
Alright, I tried what you said without success. All I need to do is set a data table for the label and set it to something that can be specific, like a player name right? So I tried this.
This did nothing as the player left. :( What am I doing wrong? Is "PlayerName" suppose to be a variable?
@Bionic1: Go
Setting it as a DialogItem variable did the trick! Finally! Hahha. Thanks for the help man.