The setAggroListTarget native AI script function maximizes the aggro of a player in the aggro list of a bot.
()setAggroListTarget(botIndex: f, playerEidAsString: s) // setAggroListTarget_fs_
($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.
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.