How can I make a mob cast a healing spell on a nearby friendly target? Is there a Lua Script for this?, cause I've tried many things nothing seems to work, plz Help! ^^
This is what I've been able to work so far, need help on what needs fixes.
Code:
function Shaman_OnCombat(Unit, Event)
Unit:RegisterEvent("ChainHeal", 3500, 0)
end
function ChainHeal(pUnit, Event)
if pUnit:GetHealthPct() >= 40 then
pUnit:FullCastSpell(55459, pUnit:TargetNearestFriend())
end
end
function Shaman_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end
function Shaman_OnKilledTarget(Unit, Event)
Unit:SendChatMessage(12, 0, "May the spirits guide you to a better place.")
end
function Shaman_OnDied(Unit, Event)
Unit:RemoveEvents()
end
RegisterUnitEvent(70002, 1, "Shaman_OnCombat")
RegisterUnitEvent(70002, 2, "Shaman_OnLeaveCombat")
RegisterUnitEvent(70002, 3, "Shaman_OnKilledTarget")
RegisterUnitEvent(70002, 4, "Shaman_OnDied")
Have tried with "pUnit:GetRandomFriend()" also, but nothing seems to work... Owh and also I just wanna say it works but he can only target himself.... Oo So I need fix to that.
Help plz, Best regards Grothar93