The getBotIndex AI script function is used to get the bot index in the group by its entityId.
(botIndex: f)getBotIndex(botEid: s) // getBotIndex_s_f
($botEid)getCurrentSpeakerEid();
(index)getBotIndex($botEid);
if (index != -1)
{
()phrasePushValue("entity", $botEid);
()phraseEndNpcMsg(index, "PHRASE_YOUR_ARE_CLICKING_ON_ME");
}
This example code gets the current speaker's entityId and then gets its index in the group using the getBotIndex
function. If the index is not -1 (meaning the entityId is from a bot of the group), it pushes the entityId on the parameter stack and ends an npc message with the phraseEndNpcMsg
function.