The setGroupAggroListTarget native AI script function maximizes the aggro of a target from the aggro list of one bot to the entire group. The target player entity ID must be in the aggro list of the bot, and it can be obtained using the getRandomPlayerAggroListTarget
function.
A player entity ID is used to identify the player. 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.
()setGroupAggroListTarget(playerEidAsString: s) // setGroupAggroListTarget_s_
($playerId)getRandomPlayerAggroListTarget(4);
()setGroupAggroListTarget($playerId);
This example code gets the Entity ID of a random player from the aggro list of the bot at index 4 in the current group, and then sets the player as the aggro target for the whole group.
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 the whole group. If you want to set the aggro target for a specific bot, use the setAggroListTarget
function instead.