steam_set_stat_int(stat_name, value);
参数 | 描述 |
---|---|
stat_name | The name of the statistic to set (a string). |
值 | The value (a 32bit integer) to set the stat to. |
返回: N/A(无返回值)
With this function you can set a specific statistic to a new,
signed integer, value. The statistic should have been
previously defined on the Steamworks control panel accounts page
for your game and the string that is passed to the function should
match that used as the API Name on the control panel.
Examples of when you could use this are for tracking how many times
the player dies or for tracking progress towards an
achievement.
xp += 100;
steam_set_stat_int("Total_XP", steam_get_stat_int("Total_XP") + 100);
if steam_get_stat_int("Total_XP") > 1000
{
if !steam_get_achievement("Ach_1000XP") steam_set_achievement("Ach_1000XP");
}
The above code sets a statistic and then checks the final value for it to decide whether to award an achievement or not.