Set the blood volume display color||doc135472

September 20, 2022


  • The class to which the function belongs:Entity


Sets the color of the entity object's HP value, the value is the color value of 0x hexadecimal. If it is -1, use the value of the health bar color property of the entity object in the editor.


In the editor, uncheck the attribute option of the hidden health bar in the properties of the unit-player to see the display of the health bar in the game

Note: When the player initializes the game, the health bar will be forced to change to green


Variable name type Description
color int hex color value

Code Samples

on the client sideglobal script, when a registered player logs inCallback, change the color of the player's health bar to blue when logging in

Lib.subscribeEvent(Event.EVENT_PLAYER_LOGIN, function(info)
    local userId = info.userId
    local player = Game.GetPlayerByUserId(userId)
    if player then