diff --git a/src/game/DBScripts/ScriptMgr.cpp b/src/game/DBScripts/ScriptMgr.cpp index e8f865ac45..e95d3c779e 100644 --- a/src/game/DBScripts/ScriptMgr.cpp +++ b/src/game/DBScripts/ScriptMgr.cpp @@ -1470,13 +1470,17 @@ std::pair ScriptAction::GetScriptProcessTargets(WorldObject* origina if ((m_script->data_flags & SCRIPT_FLAG_ALL_ELIGIBLE_BUDDIES) != 0) { for (WorldObject* wo : *worldObjects) - buddies.push_back(wo); + if (!wo->IsCreature() || static_cast(wo)->IsAlive() != m_script->IsDeadOrDespawnedBuddy()) + buddies.push_back(wo); } else { WorldObject* closest = nullptr; for (WorldObject* wo : *worldObjects) { + if (wo->IsCreature() && static_cast(wo)->IsAlive() == m_script->IsDeadOrDespawnedBuddy()) + continue; + if (!closest) closest = wo; else if (origin->GetDistance(wo, true, DIST_CALC_NONE) < origin->GetDistance(closest, true, DIST_CALC_NONE))