Valheim - Scheduled message (event) variables incorrect

System Information

Field Value
Operating System Linux - Debian GNU/Linux 12 on x86_64
Product AMP ‘Phobos’ v2.6.0.6 (Mainline)
Virtualization Docker
Application Valheim
Module GenericModule
Running in Container Yes
Current State Ready

Task

Valheim @User and @UserCount wrong

Problem Description

Issue

I have scheduled tasks for the events of when a player either leaves or joins my Valheim server. It is formatted like this “{@User} has joined ({@UserCount} playing).” and posted to our Discord server. This seems to work just fine for when players are joining the server, but then the values become erratic when someone leaves.

For example, we had 8 people playing and the last message was (names redacted):
Player 8 has joined (8 playing).

But then as people starting leaving we got these messages:
Player 1 has left (7 playing). → Correct
Player 8 has left (0 playing). → The issue. Why down to 0 players now?
Player 3 has left (3 playing). → Somehow we are at 3 now
Player 2 has left (2 playing). → Counting down again?

Additionally one of my players reported that it incorrectly reported that he left the server, even though he was still playing.

It seems like the server has trouble keeping track of the active players. I took a look at the docker logs and players are identified by SteamID so in theory it should be straight forward to keep track of who is there. Is there something I need to configure that would help fix this? Please let me know if there’s anything else you need, thank you!

Reproduction Steps

  • Create a stock Valheim server
  • Add scheduled tasks to emit user and usercount values when a player leaves or joins
  • Have several players join
  • Have several players leave

I am having a similar issue with scheduled tasks and backups. I have a backup scheduled to run when the last user leaves and this happens incorrectly when players are still logged in.

I have noticed that the user count can report 0 on the status page, but if you go to the console page you can still see that it has recorded users and knows they are still logged in. I do get the random user account that never leaves as well sometimes.

I was trying to do scheduled tasks based on if users where in the server or not and this weird issue is making that very inconsistent.

System Information

Field Value
Operating System Windows Server 2019
Product AMP ‘Phobos’ v2.6.0.6 (Mainline)
Virtualization None
Application Valheim
Module GenericModule
Running in Container No
Current State Ready

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.