So I have a few questions about LUA scripting
Code:
function Mage_OnCombat (Unit, Event)
Unit:RegisterEvent("Mage_Frostbolt",10000, 0)
Unit:RegisterEvent("Mage_Frostnova",35000, 0)
Unit:RegisterEvent("Mage_Barrier", 40000, 2)
Unit:RegisterEvent("Mage_Evocation",1000,0)
end
function Mage_Frostbolt(pUnit, Event)
pUnit:FullCastSpellOnTarget (42842, pUnit:GetRandomPlayer(0) )
end
function Mage_Frostnova(pUnit, Event)
pUnit:CastSpell (42917)
end
function Mage_Barrier(pUnit, Event)
pUnit:CastSpell (36481)
end
function Mage_OnDied (Unit, Event)
Unit:RemoveEvents()
end
function Mage_OnKilledTarget (Unit, Event)
end
function Mage_OnLeaveCombat (Unit, Event)
Unit:RemoveEvents()
end
RegisterUnitEvent (1759, 1, "Mage_OnCombat")
RegisterUnitEvent (1759, 2, "Mage_OnLeaveCombat")
RegisterUnitEvent(1759, 3, "Mage_OnKilledTarget")
RegisterUnitEvent(1759, 4, "Mage_OnDied")
So this is my script for a mage ( I'm new at LU so no flaming pls :P)
But when my mob runs out of mana, He still tries to cast his spells..
1. I've tried adding something like
Code:
function Mage_Evocation(Unit, event, miscunit, misc)
if Unit:GetManaPct() < 25 and Didthat == 0 then
print "Mage Evocation"
Unit:FullCastSpell(30254)
Didthat = 1
else
end
end
in it but he doesnt cast the evocation so if you could help me with that 
2.But what would be even better is, Is there any code or function so the mob knows when he doesnt have enough mana, He doesnt need to cast the spell? :P
3. They always seem to cast the spell on me only, even when they're fighting against other hostile mobs.
Thanks in advance.
-Greetings Ascelyn.