-
Notifications
You must be signed in to change notification settings - Fork 94
set_aggro_list_target
title: Set Aggro List Target description: published: true date: 2023-03-16T23:10:00.868Z tags: editor: markdown dateCreated: 2023-03-16T22:27:25.162Z
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_
- 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.
($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.