The setManagerAggroListTarget native AI script function is used to maximize the aggro of a target of one bot to one or more bots in the same NPC manager as the current NPC group. The target player entity ID must be in the aggro list of the bot, and it can be obtained using the getRandomPlayerAggroListTarget
function for example.
A player entity ID is used to identify the player. If the entity ID is not in the aggro list, a warning message is displayed in the log. If the entity ID is an empty string, no message is displayed.
A string is used to select groups of the manager (group names must contain this string).
()setManagerAggroListTarget(playerEidAsString: s, nameElement: s) // setManagerAggroListTarget_ss_
($playerId)getRandomPlayerAggroListTarget(0);
()setManagerAggroListTarget(0, $playerId, "group_bandit_"); // All groups that have names like "group_bandit_*" will attack the player
This example code gets the entity ID of a random player from the aggro list of the bot at index 0 in the current group, and then sets the player as the aggro target for all groups in the same NPC manager as the current NPC group with names containing "group_bandit_".
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 displays a warning message.
The getRandomPlayerAggroListTarget
function can be used to get a random player entity ID from the aggro list of a bot.
This function sets the aggro target for some groups managed by the bot. If you want to set the aggro target for a specific bot, use the setAggroListTarget
function instead.