The getBotIndexByName native AI script function is used to get the index of a bot in a group by its name, or return -1 if the bot is not found. This function is mainly useful for scripted bosses.
The bot index begins at zero for the first member of the group.
(botIndex: f)getBotIndexByName(botName: s)
(botIndex)getBotIndexByName("boss_random_aggro");
($playerId)getRandomPlayerAggroListTarget(botIndex);
()setAggroListTarget(botIndex, $playerId);
This example code uses getBotIndexByName to retrieve the index of the bot named "boss_random_aggro", stores it in a variable called botIndex, and uses that variable in two other functions.