# Steam leaderboards add new value to existing

**URL:** <https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052>\
**Category:** Platform & Builds\
**Tags:** Steam, online, leaderboard, unreal-engine, question\
**Created:** [December 21, 2015, 7:21am UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052 "2015-12-21T07:21:43Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f9756538](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f9756538](https://forums.unrealengine.com/u/anonymous_user_f9756538)\
**Post date:** [December 21, 2015, 7:21am UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/1 "2015-12-21T07:21:43Z")

</div>

In OnlineLeaderboardInterfaceSteam.cpp

FOnlineAsyncTaskSteamUpdateStats::Tick

on line 293 and line 304 do an additive operation:

bSuccess = SteamUserStatsPtr-\>SetStat(TCHAR\_TO\_UTF8(\*StatName), OldValue + Value) ? true : false;

Where it should simply be:

bSuccess = SteamUserStatsPtr-\>SetStat(TCHAR\_TO\_UTF8(\*StatName), Value) ? true : false;

this issue currently causes the wrong value to be saved in the leaderboard

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [December 22, 2015, 6:12pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/2 "2015-12-22T18:12:14Z")

</div>

Hi supagu,

I looked at the code that you are referring to and it does appear that, depending on what you are trying to accomplish, it may not do what you want. For something like a counter stat, such as total time played, this should work fine. However, if you are trying to update a list of high scores, then this wouldn’t do what you want.

Are you trying to do something like the latter?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f9756538](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f9756538](https://forums.unrealengine.com/u/anonymous_user_f9756538)\
**Post date:** [December 22, 2015, 9:06pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/3 "2015-12-22T21:06:34Z")

</div>

, you are correct.  
I am trying to update a high score list, which I would think would be pretty standard for a leader board.  
Now, another problem I may run into is checking if the current high score exceeds the players existing leader board score.  
Ideally being able to get and set stats in ue4 code would be ideal, this would eliminate any issues.  
I have worked around the problem in my own code by bypassing the ue4 code and going straight to the steam code, which isn’t nice but let’s me work around the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [December 23, 2015, 10:56pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/4 "2015-12-23T22:56:50Z")

</div>

Hi supagu,

I have submitted a report about the issue that you described (UE-24791). We will look over this segment of code again and see if it can be improved on.

---

<div class="post-metadata">

**Author:** ![motorsep](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/motorsep/32/918698_2.png) [@motorsep](https://forums.unrealengine.com/u/motorsep)\
**Post date:** [May 13, 2016, 6:04pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/5 "2016-05-13T18:04:25Z")

</div>

Has this been fixed (and made available for Blueprint) ?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [May 16, 2016, 5:55pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/6 "2016-05-16T17:55:33Z")

</div>

Hi motorsep,

I checked the ticket that I had entered for this issue and it is still open, so it has not been resolved yet.

---

<div class="post-metadata">

**Author:** ![motorsep](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/motorsep/32/918698_2.png) [@motorsep](https://forums.unrealengine.com/u/motorsep)\
**Post date:** [June 1, 2016, 7:28pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/7 "2016-06-01T19:28:14Z")

</div>

Ouch ☹

Could you please confirm if it will be a part of 4.12 hot fix or at least fixed in 4.13 ?

Thanks

---

<div class="post-metadata">

**Author:** ![motorsep](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/motorsep/32/918698_2.png) [@motorsep](https://forums.unrealengine.com/u/motorsep)\
**Post date:** [June 2, 2016, 9:32pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/8 "2016-06-02T21:32:18Z")

</div>

Btw, someone already proposed a working fix: [https://lordihean.net/2016/04/21/ue4-tutorial-resolving-steam-leaderboards/](https://lordihean.net/2016/04/21/ue4-tutorial-resolving-steam-leaderboards/)

Shouldn’t be that hard to fix for 4.12 hotfix or at least 4.13 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [June 11, 2016, 2:40pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/9 "2016-06-11T14:40:50Z")

</div>

Hi motorsep,

I thought I had seen a Pull Request on GitHub related to this recently, but when I went looking for it today I wasn’t able to find it. I glanced over the fix proposed in the link you provided and I am not sure it would be a complete fix for all possible needs.

It does seem to solve the issue where you would need to replace a previous stat with the current stat if the current stat is larger. However, what if you wanted the stat to track the lowest value (fastest time through a level, for example), or wanted the stat to be cumulative as it is now (total time played, for example)? The proposed fix does not appear to take those options into consideration.

---

<div class="post-metadata">

**Author:** ![Malharhak](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Malharhak](https://forums.unrealengine.com/u/Malharhak)\
**Post date:** [June 20, 2016, 12:51pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/10 "2016-06-20T12:51:40Z")

</div>

Just let us read the value ourselves and do the math depending on what we want, instead of forcing a default behavior that doesn’t suit most games.

The pull request I made was here [https://github.com/EpicGames/UnrealEngine/pull/2498](https://github.com/EpicGames/UnrealEngine/pull/2498)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [June 28, 2016, 9:14pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/11 "2016-06-28T21:14:40Z")

</div>

Hi Malharhak,

Thank you for the pull request. I just wanted to let you know that we have a ticket in place to track it and we will review it when we get a .

---

<div class="post-metadata">

**Author:** ![Genova](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Genova](https://forums.unrealengine.com/u/Genova)\
**Post date:** [November 18, 2017, 10:17pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/12 "2017-11-18T22:17:28Z")

</div>

Yeah, it’s been reviewed alright. Won’t fix. What the hell?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [November 20, 2017, 9:37pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/13 "2017-11-20T21:37:51Z")

</div>

Hi Genova,

Thank you for letting us know that this issue is still important to you. The ticket that I had entered previously was closed due to an extended period of inactivity. I have re-opened that ticket again. The ticket for Malharhak’s pull request is still open and waiting to be reviewed.

---

<div class="post-metadata">

**Author:** ![Isaac\_S](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Isaac\_S](https://forums.unrealengine.com/u/Isaac_S)\
**Post date:** [December 8, 2017, 4:21pm UTC](https://forums.unrealengine.com/t/steam-leaderboards-add-new-value-to-existing/342052/14 "2017-12-08T16:21:21Z")

</div>

I changed those two lines of code and re-saved the cpp file yet it’s still adding the new value to existing. I also tried restarting the editor. Am I missing something? Any help greatly appreciated!
