-
Notifications
You must be signed in to change notification settings - Fork 90
set_hp_scale
Ryzom Core Wiki edited this page Jul 8, 2024
·
3 revisions
title: Set HP Scale description: published: true date: 2023-03-16T23:10:55.832Z tags: editor: markdown dateCreated: 2023-03-16T22:28:34.633Z
The setHPScale native AI script function sets the current HP level of each bot in the current group based on a given coefficient. The maximum HP of the bot is used to calculate the HP level to be set.
setHPScale(coef: f)
- coef (float): The percentage of the bot's maximum HP that each bot will have after the function call. The coefficient must be in the range [0,1].
setHPScale(0.8);
This example code sets the current HP level of each bot in the current group to 80% of the bot's maximum HP.
The setHPScale
function updates the current HP level of each bot in the group based on the given coefficient by sending the difference with the current HP. The HP difference is calculated using the following formula: maxHP * coef - currentHP
.
If a bot is not spawned, the function will skip that bot.
-
setHPLevel
: Sets the current HP level of each bot in the current group to a specified value. The value is an absolute HP level rather than a percentage of the bot's maximum HP.