• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] how to get the specify npc`s objectguid from DB guid?

Status
Not open for further replies.

dfdf2015

Emulation Addict
etc:
creature->GetGuid();
this guid is objectguid of function`s param,if i want to get a specify npc`s objectguid from guid in Database(etc:creature table),then how to get?



or any other way to get it ?

thanks
 

slp13at420

Mad Scientist
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();
 
Last edited:

dfdf2015

Emulation Addict
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();

hmm,thank you ,but it`s not i want.
now,i want below:
Code:
	bool OnGossipSelect(Player* player, Creature* creature, uint32/*sender*/, uint32 action)
	{  .........
              player->GetSession()->SendTrainerList(creature->GetGUID());
           ........
        }
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.
so,i want send the trainer npc window of my specify to player.
have anyway achieve it?

thanks
 

slp13at420

Mad Scientist
ugh new core lol , this returns the guid entry for gob/creature from the DB:
Code:
uint32 gGuid = go->GetSpawnId();
uint32 gGuid = creature->GetSpawnId();

for players:
Code:
uint32 pGuid = player->GetGUID();
 
Last edited:

Tommy

Founder
hmm,thank you ,but it`s not i want.
now,i want below:
Code:
	bool OnGossipSelect(Player* player, Creature* creature, uint32/*sender*/, uint32 action)
	{  .........
              player->GetSession()->SendTrainerList(creature->GetGUID());
           ........
        }
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.
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).
 

dfdf2015

Emulation Addict
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).


i try your the three method,and code below, when click menu,the service will crash.what`s wrong?

Code:
	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;


the gossip menu npc has closed the actual trainer npc. when i click the menu, i should send the actual trainer npc`s dialog to player first?

thanks
 
Last edited:

Rochet2

Moderator / Eluna Dev
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 test
Code:
if (!magictrainer) return;
or similar before you actually use magictrainer for anything. It could be NULL!
 
Last edited:

dfdf2015

Emulation Addict
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 test
Code:
if (!magictrainer) return;
or similar before you actually use magictrainer for anything. It could be NULL!

actualy,this method is not i want, i want achieve the effects same as multivendor.
hope who can achieve it.
hoping...
 

Rochet2

Moderator / Eluna Dev
actualy,this method is not i want, i want achieve the effects same as multivendor.
hope who can achieve it.
hoping...

That is not possible. Multivendor is not possible either. - unless you get a patch.
You MUST use a multivendor core patch or a multitrainer core patch to get those functionalities properly done.
Otherwise you need to do as suggested and use a workaround like sending trainer/vendor menus from different NPCs than who the initial gossip was with.

I want to note though that using the tactics described in this thread makes it look EXACTLY like a multivendor/trainer.
 
Status
Not open for further replies.
Top