creature->GetGUIDLow();
uint32 pGuid = player->GetGUIDLow();
uint32 cGuid = creature->GetGUIDLow();
uint32 gGuid = go->GetGUIDLow();
did you try the Global method `GetGUIDLow`:
Code:creature->GetGUIDLow();
it returns the low guid of player, creature, gob...
Code:uint32 pGuid = player->GetGUIDLow(); uint32 cGuid = creature->GetGUIDLow(); uint32 gGuid = go->GetGUIDLow();
bool OnGossipSelect(Player* player, Creature* creature, uint32/*sender*/, uint32 action)
{ .........
player->GetSession()->SendTrainerList(creature->GetGUID());
........
}
uint32 gGuid = go->GetSpawnId();
uint32 gGuid = creature->GetSpawnId();
uint32 pGuid = player->GetGUID();
hmm,thank you ,but it`s not i want.
now,i want below:
this is send traner window to player,but the creature i want use another my specify traner npc in game,not the creature of OnGossipSelect function`s param.Code:bool OnGossipSelect(Player* player, Creature* creature, uint32/*sender*/, uint32 action) { ......... player->GetSession()->SendTrainerList(creature->GetGUID()); ........ }
so,i want send the trainer npc window of my specify to player.
have anyway achieve it?
thanks
There's more than a few choices you can go about doing this.
1. You could make the gossip npc the player is using into a Gossip + Trainer and then you can show its own list.
2. You could spawn the trainer and set a despawn timer
3. If the trainer is near the actual gossip npc, you can use FindNearestCreature to get the trainer and return its guid.
4. If the trainer is already spawned you could find its guid by doing .npc info and use its guid that way (don't think this would be the right thing to do, nor do I know if it is recommended).
case GOSSIP_ACTION_INFO_DEF + 12:
const uint32 centry = 99999;
const float crange = 20;
Creature* magictrainer = magictrainer->FindNearestCreature(centry, crange, true);
player->GetSession()->SendTrainerList(magictrainer->GetGUID());
break;
if (!magictrainer) return;
Yes. Trainer code is a bit different from gossip and vendors.
I would also assume that you need to create a gossip menu for the other trainer first and only then open the trainer list.
But test first if removing the "SendTrainerList" function call will prevent the crash. If it does, then do the menu test.
Also MAKE SURE
that you testor similar before you actually use magictrainer for anything. It could be NULL!Code:if (!magictrainer) return;
actualy,this method is not i want, i want achieve the effects same as multivendor.
hope who can achieve it.
hoping...