May 12, 20232 yr So I haven't found a way to add a cool down timer to a lua script, certain conditions work but it seems to ignore the cooldown time left condition and continues to spam the lua script ability. Below is the lua script for casting growl, how would I go about implementing a 8 second cooldown before it tries to run the script again? for i=1,50 do local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_PET) if spellName and spellName == "Growl" then CastSpell(i, BOOKTYPE_PET); end end
May 12, 20232 yr You can check for your pet's spell cooldown like so: local start, duration, enable = GetSpellCooldown(PET_SPELL_INDEX, 'pet') return (duration - (GetTime() - start)) * 1000 This returns the spell cooldown in milliseconds. The spell is ready when it returns a value lower than 0. You'll need to replace PET_SPELL_INDEX with i in your case.
May 13, 20232 yr Author 2 hours ago, Zer0 said: You can check for your pet's spell cooldown like so: local start, duration, enable = GetSpellCooldown(PET_SPELL_INDEX, 'pet') return (duration - (GetTime() - start)) * 1000 This returns the spell cooldown in milliseconds. The spell is ready when it returns a value lower than 0. You'll need to replace PET_SPELL_INDEX with i in your case. How should I implement this? I tried as Lua condition made the adjustments but crash due to to many characters.
May 13, 20232 yr Author I've got all this working and even added some more C sharp and Lua scripts to my fightclass but struggling with certain conditions like. Hostile Unit Near, I am trying to setup disengage to activate when units are within a smaller range of 8. But this condition also seems to trigger from my pet which is always next to the target so it's always just spamming it when it's off cooldown.
May 14, 20232 yr It's c# code to ignore your pet : ObjectManager.GetWoWUnitHostile().Count(u => u.Position.DistanceTo(ObjectManager.Target.Position) <= 10 && u.IsAttackable && !u.IsMyPet) >= 3 Replace 10 by the radius (distance), and 3 by the number of hostile unit near the target require.
Create an account or sign in to comment