На текущий момент код СД2 выглядит так:
Код:
/*######
## npc_nexus_drake_hatchling
######*/
enum
{
SPELL_CAPTURE_TRIGGER = 46673,
SPELL_SUBDUED = 46675,
SPELL_DRAKE_VOMIT_PERIODIC = 46678,
SPELL_DRAKE_HATCHLING_SUBDUED = 46691
};
struct MANGOS_DLL_DECL npc_nexus_drake_hatchlingAI : public ScriptedAI
{
npc_nexus_drake_hatchlingAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
uint32 m_uiDespawnTimer;
void Reset()
{
m_uiDespawnTimer = 0;
}
};
bool EffectDummyCreature_npc_nexus_drake_hatchling(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pCreatureTarget)
{
//always check spellid and effectindex
if (spellId == SPELL_CAPTURE_TRIGGER && effIndex == EFFECT_INDEX_0)
{
if (!pCaster || pCaster->GetTypeId() != TYPEID_PLAYER || !pCaster->isAlive())
return true;
//no effect if player/creature already have aura from spells
if (pCaster->HasAura(SPELL_DRAKE_HATCHLING_SUBDUED) || pCreatureTarget->HasAura(SPELL_SUBDUED))
return true;
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUBDUED, true);
pCreatureTarget->CastSpell(pCreatureTarget, SPELL_DRAKE_VOMIT_PERIODIC, true);
pCreatureTarget->CastSpell(pCaster, SPELL_DRAKE_HATCHLING_SUBDUED, true);
if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
pCreatureTarget->GetMotionMaster()->MoveIdle();
pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
//always return true when we are handling this spell and effect
}
return true;
}
CreatureAI* GetAI_npc_nexus_drake_hatchling(Creature* pCreature)
{
return new npc_nexus_drake_hatchlingAI(pCreature);
}
Только нпц не следует за игроком