get_player_stat - ryzom/ryzomcore GitHub Wiki
title: Get Player Stat description: published: true date: 2023-03-16T23:07:44.992Z tags: editor: markdown dateCreated: 2023-03-16T22:24:34.004Z
The getPlayerStat native AI script function retrieves a specified statistic for a given player.
(result: s)getPlayerStat(playerEidAsString: s, statName: s)- playerEidAsString (string): The entity ID of the player as a string.
 - statName (string): The name of the property to retrieve. Valid values are "HP", "MaxHp", and "RatioHp".
 
- result (string): The value of the specified statistic for the given player.
 
- The player must be in the same AI instance (continent) as the calling entity.
 - If the input string is empty or the player is not in the same AI instance, the function returns zero and displays a warning message in the log.
 - The argument is case sensitive.
 
($playerEid)getCurrentPlayerEid();
print($playerEid); //log (0x00001fbd50:00:00:81)
($maxHp)getPlayerStat($playerEid, "MaxHp");This example code retrieves the maximum hit points for the current player and stores the result in the variable maxHp.