The phraseEndEmoteMsg native AI script function is used to send a custom emote message with parameters through a chat message. The parameters are taken from the parameter stack created by phrasePushValue and phrasePushString functions.
phraseEndEmoteMsg(botIndex: s, phraseIdentifier: s) // phraseEndEmoteMsg_fs_
getBotIndexByName function.The function uses the parameter stack created by phrasePushValue and phrasePushString functions.
($playerEid)getCurrentPlayerEid();
($botEid)getCurrentSpeakerEid();
()phrasePushString("player", $playerEid);
()groupOf5Bot.phraseEndEmoteMsg(0, "PHRASE_TOTO1");
()phrasePushString("bot", $botEid);
()groupOf5Bot.phraseEndEmoteMsg(0, "PHRASE_TOTO2");
In this example code, two emote messages are sent using phraseEndEmoteMsg. The first message uses the PHRASE_TOTO1 identifier phrase, which takes a player parameter. The phrasePushString function is used to push the parameter onto the parameter stack. The second message uses the PHRASE_TOTO2 identifier phrase, which takes a bot parameter. Again, phrasePushString is used to push the parameter onto the parameter stack.
In the phrase_wk.txt, the PHRASE_TOTO1 and PHRASE_TOTO2 must be defined to take either a player or a bot as a parameter, respectively.
PHRASE_TOTO1(player p)
{
[$p$ is laughing.]
}
PHRASE_TOTO2(bot b)
{
[$b$ is sad.]
}
The first parameter is not automatically the bot that says the text as phraseEndNpcMsg, because a bot can make a player do an emote text. The emote message must be sent by a bot that has a valid position.