当我尝试使用AI制作八卦NPC时,sGossipSelect
带有错误的操作ID。
如果我添加八卦项目:
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testone", GOSSIP_SENDER_MAIN, 1);
sGossipSelect
被触发时,它带有错误的uint32
操作值,因此它将不起作用。
这是我的完整代码:
class gossip_test : public CreatureScript
{
public:
gossip_test() : CreatureScript("gossip_test") { }
struct gossip_testAI : public ScriptedAI
{
gossip_testAI(Creature* creature) : ScriptedAI(creature) {}
void sGossipHello(Player* player)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testone", GOSSIP_SENDER_MAIN, 1);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "testwo", GOSSIP_SENDER_MAIN, 2);
SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, me);
}
void sGossipSelect(Player* player, uint32 sender, uint32 action)
{
// UINT32 ACTION ALAWAYS HAVE WRONG VALUE
if (action == 1)
{
me->MonsterYell("testone, LANG_UNIVERSAL, me);
}
if (action == 2)
{
me->MonsterYell("testwo, LANG_UNIVERSAL, me);
}
ClearGossipMenuFor(player);
CloseGossipMenuFor(player);
}
};
CreatureAI* GetAI(Creature* creature) const
{
return new gossip_testAI(creature);
}
};