The getCurrentPlayerAggroListTarget native AI script function returns the Entity ID (as a string) of the player with the most aggro in the aggro list of a bot.
(playerEidAsString: s)getCurrentPlayerAggroListTarget(botIndex: f)
($playerId)getCurrentPlayerAggroListTarget(4);
(distance)getPlayerDistance(4, $playerId);
This example code gets the Entity ID of the player with the most aggro in the aggro list of the bot at index 4 in the current group. The resulting Entity ID is stored in the $playerId
variable. The distance between the bot at index 4 and the player with the most aggro is then calculated using the getPlayerDistance
function.
A bot index is used to identify the bot. If there is only one spawned bot in a group, then the index value is 0. If the bot index of a specific bot is needed, the getBotIndexByName
function can be used. The getBotCount
function can be used to determine the number of bots in a group. The isGroupAlived
or isBotAlived
functions can be used to verify if the bot index is valid.
If no bot is identified by the bot index (or if the bot is not spawned), the function returns an empty string and displays a warning message. The isBotAlived
function can be used to ensure that the bot index is still a valid value.