Score System

Three types of scores can be obtained from the metapro plugin:

  • Best score: The highest score the user has achieved on a given map ID.

  • Current score: The cumulative score, which can be used as the user’s current balance and can be spent, used, or reduced for various purposes (e.g., buying items).

  • Total score: The cumulative score the user has earned, similar to the current balance, but it cannot be reduced.

How to add a new score to the leaderboard?

How to get the best score for certain mapIDs?

How to get a current score?

How to update a current score for actions like item purchasing for scores?

Current and total scores retrieval

The Request User Score action retrieves the user's current and total scores from the leaderboard using the provided user ID and leaderboard ID. The current score represents the user's available balance that can be spent or used, while the total score reflects the cumulative score the user has earned over time. Upon successful retrieval, the plugin updates the respective variables, which can be obtained using the Get Current Score and Get Total Score expressions => number. It also triggers the On User Score Received condition.

Best scores retrieval

The Request Best Score action retrieves the user's best score for a specific map from the leaderboard using the provided leaderboard ID and map ID. It is required to pass the map ID parameter (as a number) to specify which map's score should be retrieved. If the request is successful, it updates the best score variable, which can be accessed using the Get Best Score expression => number. Upon retrieval, it triggers the On Best Score Received condition.

Adding a score for a specific map

The Add Score action adds a new score entry for the user on the specified map by interacting with the leaderboard API. It requires passing the mapID parameter (as a number) to indicate the map on which the score was achieved. First, it creates a matchID to represent the session in which the score was achieved. Then, it sends the score data to the leaderboard, including the mapID, userID, matchID, and projectID. Once the score is successfully added, the system requests the user's best score for the provided mapID. This best score represents the highest score achieved by the user for that specific map. After the best score is retrieved, it updates the internal best score variable and triggers the On Best Score Received condition.

Updating score

The Update Score action updates the user's current and total scores on the leaderboard. It sends a request to the leaderboard API with the provided score and adjusts both the current score and the total score based on the value of the input. If the score is positive, it adds to both the current and total scores. If the score is negative, it reduces only the current score, without affecting the total score. Once the update is successful, the internal variables for the current and total scores are updated, and the On User Score Received condition is triggered to reflect the changes.

Last updated