Display the Badges after the name in scoreboard
How does one modify the order in which the scoreboard displays things?
I did the obvious thing and moved all of the "playerBadge" related stuff in GUIScoreboard:CreatePlayerItem after the "playernameitem" stuff, but I don't think that worked.
Note that I'm trying to edit this within ns2+'s files so that the modification works off of what's already there in NS2+. So if this is how you're supposed to do it, how do I tell NS2+ not to override my changes in this mod?
I did the obvious thing and moved all of the "playerBadge" related stuff in GUIScoreboard:CreatePlayerItem after the "playernameitem" stuff, but I don't think that worked.
// Player name text item. local playerNameItem = GUIManager:CreateTextItem() playerNameItem:SetFontName(GUIScoreboard.kPlayerStatsFontName) playerNameItem:SetAnchor(GUIItem.Left, GUIItem.Center) playerNameItem:SetTextAlignmentX(GUIItem.Align_Min) playerNameItem:SetTextAlignmentY(GUIItem.Align_Center) playerNameItem:SetPosition(Vector( playerItemChildX, 0, 0)) playerNameItem:SetColor(Color(1, 1, 1, 1)) playerNameItem:SetStencilFunc(GUIItem.NotEqual) playerItem:AddChild(playerNameItem) //---------------------------------------- // Badge icons //---------------------------------------- local maxBadges = Badges_GetMaxBadges() local badgeItems = {} // Player badges for i = 1,maxBadges do local playerBadge = GUIManager:CreateGraphicItem() playerBadge:SetSize(Vector(kPlayerBadgeIconSize, kPlayerBadgeIconSize, 0)) playerBadge:SetAnchor(GUIItem.Left, GUIItem.Center) playerBadge:SetPosition(Vector(playerItemChildX, -kPlayerBadgeIconSize/2, 0)) playerItemChildX = playerItemChildX + kPlayerBadgeIconSize + kPlayerBadgeRightPadding playerBadge:SetIsVisible(false) playerBadge:SetStencilFunc(GUIItem.NotEqual) playerItem:AddChild(playerBadge) table.insert( badgeItems, playerBadge ) end
Note that I'm trying to edit this within ns2+'s files so that the modification works off of what's already there in NS2+. So if this is how you're supposed to do it, how do I tell NS2+ not to override my changes in this mod?
Comments
But what function is really interesting for you is https://github.com/Mendasp/NS2Plus/blob/05fdc7e89acd4b873f884604a52c6ed92f47f022/lua/GUIScoreboard.lua#L622
So for entry priority, there would be something similar to this somewhere?
With regards to that function:
So if I'm reading this right, it's taking the number of badges there are, multiplying it by however wide they are and then returning that as the value of the offset that is applied to the text of the name.
So basically I'd need the text offset to be 0 all the time, but find a way to apply an offset to the badges equal to the length of the text? I feel like it would be simpler to make the badges appear on the far right of the name column, but then again, everything is complicated to me.
Thanks for the help, I'll tinker with this some more tonight and report back.
You should avoid naming your mod files like ns2 vanilla files if you use the entry system. Otherwise you end up overloading vanilla files! Some more details can be found in my never finished mod guide i started writing a year ago but never finished (but might help you)