Okay i create a script to make custom pets, for example like a chicken
its very simple edit the item Id
and the creature ID
and when you click the item it will spawn the creature at your location and he will follow you around
Make sure the pet is friendly to everyone
Code:
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4018) // signed/unsigned mismatch in comparison op
#endif;
#define ENTRYID 47832
#define ITEMID 42353
class SCRIPT_DECL FollowGossip : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy(){ delete this;}
};
void FollowGossip::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
Creature * cre = Plr->GetMapMgr()->GetInterface()->SpawnCreature(ENTRYID,Plr->GetPositionX(),Plr->GetPositionY(),Plr->GetPositionZ(),Plr->GetOrientation(),true,false,0,0);
cre->m_escorter = Plr;
}
void FollowGossip::GossipEnd(Object * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void FollowGossip::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
return;
switch(IntId)
{
case 1:
break;
}
}
class FollowAI : CreatureAIScript
{
public:
ADD_CREATURE_FACTORY_FUNCTION(FollowAI);
FollowAI(Creature* pCreature) : CreatureAIScript(pCreature)
{
RegisterAIUpdateEvent(100);
}
void AIUpdate()
{
if(_unit->m_escorter != NULL)
{
Player * Plr = _unit->m_escorter;
_unit->GetAIInterface()->MoveTo(Plr->GetPositionX() + .1f,Plr->GetPositionY(),Plr->GetPositionZ(),Plr->GetOrientation());
}
}
};
void SetupMorphNPC(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new FollowGossip();
mgr->register_item_gossip_script(ITEMID, gs);
mgr->register_creature_script(ENTRYID,&FollowAI::Create);
}