Creature* pCreature = WorldManager.GetCreature(12345); if(pCreature) { AIInterface* pAI = pCreature->GetAIInterface(); pAI->MoveTo(x, y, z); }
Creature* pCreature = WorldManager.GetCreature(67890); if(pCreature) { AIInterface* pAI = pCreature->GetAIInterface(); pAI->CastSpell(1234, pCreature); }This code gets a creature with ID 67890 from the world manager, gets its AI interface, and instructs it to cast a spell with ID 1234 on itself. This would be useful for implementing creature abilities and special attacks. Package library: This method is a part of the TrinityCore package library, which is an open source World of Warcraft MMORPG emulator.