set_aggro_list_target - ryzom/ryzomcore GitHub Wiki


title: Set Aggro List Target description: published: true date: 2023-03-13T15:08:56.384Z tags: editor: markdown dateCreated: 2023-03-13T15:07:55.380Z

setAggroListTarget

The setAggroListTarget native AI script function maximizes the aggro of a player in the aggro list of a bot.

Syntax

()setAggroListTarget(botIndex: f, playerEidAsString: s) // setAggroListTarget_fs_

Arguments

  • botIndex (float): The index of the bot member of the current group.
  • playerEidAsString (string): The Entity ID (as a string) of the player to be attacked.

Examples

($playerId)getRandomPlayerAggroListTarget(4); ()setAggroListTarget(4, $playerId);

This example code gets the Entity ID of a player from the aggro list of the bot at index 4 in the current group using the getRandomPlayerAggroListTarget function, and then sets the aggro list target of the bot to the selected player using the setAggroListTarget function.

Notes

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.

A player Entity ID (as a string) is used to identify the player to be attacked. If the Entity ID is not from the aggro list, a warning message is displayed in the log. If the Entity ID is an empty string, no message is displayed.

If no bot is identified by the bot index (or if the bot is not spawned), the function displays a warning message. The isBotAlived function can be used to ensure that the bot index is still a valid value.

⚠️ **GitHub.com Fallback** ⚠️