Despawn Adds after combat ends.

Hey guys,

I’m wanting to make these adds despawn off the first boss in Sethekk Halls.

Here is the add script:

class npc_syth_fire : public CreatureScript
{
public:
npc_syth_fire() : CreatureScript(“npc_syth_fire”) { }

struct npc_syth_fireAI : public ScriptedAI
{
    npc_syth_fireAI(Creature* creature) : ScriptedAI(creature)
    {
    }

    uint32 flameshock_timer;
    uint32 flamebuffet_timer;

    void Reset() OVERRIDE
    {
        me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
        flameshock_timer = 2500;
        flamebuffet_timer = 5000;
    }

    void EnterCombat(Unit* /*who*/) OVERRIDE { }

    void UpdateAI(uint32 diff) OVERRIDE
    {
        if (!UpdateVictim())
            return;

        if (flameshock_timer <= diff)
        {
            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                DoCast(target, SPELL_FLAME_SHOCK);

            flameshock_timer = 5000;
        } else flameshock_timer -= diff;

        if (flamebuffet_timer <= diff)
        {
            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                DoCast(target, SPELL_FLAME_BUFFET);

            flamebuffet_timer = 5000;
        } else flamebuffet_timer -= diff;

        DoMeleeAttackIfReady();
    }
};

CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
    return new npc_syth_fireAI(creature);
}

};

There are 4 adds but I was just wondering how to despawn them after X seconds of being out of combat. There is a problem right now on the build that causes them to remain after a wipe making it very difficult to do the boss.

Thanks!

You could store them in a container inside the boss’s script and despawn them manually in that boss’s EnterEvadeMode (That’s how you should do it).

You can also use TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT when you call SummonCreature to summon them

How would I go about adding them to a container? Or if you know of a boss that does this already point me to it.

I haven’t been able to find documentation for trinity yet so I’m kinda just winging it lol

Thanks!

For despawning based on the boss reset, check the script for Vazruden (Hellfire Ramparts).

I was just looking at these myself though and I think a better solution may be to switch these spawns to DoSummonCreature with a temp despawn, because I don’t think they’re currently scaling correctly for Heroics. They are currently being spawned via specifically cast spells which are ignoring placement and some values from creature_template.