Jump to content

Training Dummy


Guest deviljohn

Recommended Posts

  • 6 months later...
I have a good training dummy. at this dummy players can also use finisher. and no rotation^^

/*######
## npc_training_dummy
######*/
#define OUT_OF_COMBAT_TIME 5000
#define AFK_TIME 300000

struct MANGOS_DLL_DECL npc_training_dummyAI : public Scripted_NoMovementAI
{
   npc_training_dummyAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature)
   {
       Reset();
   }

   uint32 afk_timer;
   uint32 combat_timer;

   void Reset()
   {
       //m_creature->addUnitState(UNIT_STAT_STUNNED);
       combat_timer = 0;
       afk_timer = 0;
   }

   void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
   {
       combat_timer = 0;
   }

   void UpdateAI(const uint32 diff)
   {
       if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
       return;

       if (m_creature->GetHealthPercent() < 10.0f) // allow players using finishers
       m_creature->ModifyHealth(m_creature->GetMaxHealth());

       m_creature->SetTargetGuid(ObjectGuid()); // prevent from rotating
       combat_timer += diff;
       afk_timer += diff;

       if (combat_timer > OUT_OF_COMBAT_TIME || afk_timer > AFK_TIME)
       EnterEvadeMode();
   }
};

CreatureAI* GetAI_npc_training_dummy(Creature* pCreature)
{
return new npc_training_dummyAI(pCreature);
}

There are a problem here: If there are 2 players attacking, then one "leave" he will still be in combat, since the target dummy's combat timer will keep being zeroed

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use