local minHealthPercent = 50;
local PetAlly = 1;
local PetEnemy = 2;
local activePetEnemy = C_PetBattles.GetActivePet(PetEnemy);
local typePetEnemy = C_PetBattles.GetPetType(PetEnemy, activePetEnemy);
local activePetAlly = C_PetBattles.GetActivePet(PetAlly);
local typePetAlly = C_PetBattles.GetPetType(PetAlly, activePetAlly);
if C_PetBattles.GetHealth(PetAlly, activePetAlly) * 100 / C_PetBattles.GetMaxHealth(PetAlly, activePetAlly) <= minHealthPercent then
for i = 1, NUM_BATTLE_PETS_IN_BATTLE do
if C_PetBattles.GetHealth(PetAlly, i) * 100 / C_PetBattles.GetMaxHealth(PetAlly, i) > minHealthPercent and not (i == activePetAlly) then
C_PetBattles.ChangePet(i);
break;
end
end
end
put this in the top box in your pet battle product settings, the rest of what you want is in there