PDA

View Full Version : Lua Honor mob NPC scipt


DJ DieSeL
05-14-2009, 04:42 AM
Hey, so i was interested in making a mob/NPC yield honor when it dies. Well i managed to create a fully working script (i am using repack 8.0) and i'm satisfied with it. How about you guys?

CODE:

-----------------------
-- DJ DieSeL Edition --
-----------------------

-- 20 Enemy Mage
function lvl20enemymage_OnCombat(Unit, Event)
Unit:RegisterEvent("lvl20enemymage_bolt", 30000, 3)
Unit:RegisterEvent("lvl20enemymage_ball", 30000, 3)
Unit:RegisterEvent("lvl20enemymage_nova", 100, 1)
end

function lvl20enemymage_bolt(Unit, Event)
local plr = Unit:GetMainTank()
if (plr ~= nil) then
Unit:FullCastSpellOnTarget(7322, plr)
end
end

function lvl20enemymage_ball(Unit, Event)
local plr = Unit:GetMainTank()
if (plr ~= nil) then
Unit:FullCastSpellOnTarget(3140, Unit:GetMainTank())
end
end

function lvl20enemymage_nova(Unit, Event)
if Unit:GetHealthPct() <= 35 then
Unit:FullCastSpell(122)
end
end

function lvl20enemymage_OnLeaveCombat(Unit, Event)
Unit:RemoveEvents()
end

function lvl20enemymage_OnDied(Unit, Event)
Unit:FullCastSpellOnTarget(24960, Unit:GetClosestPlayer())
Unit:RemoveEvents()
end

RegisterUnitEvent(220001, 1, "lvl20enemymage_OnCombat")
RegisterUnitEvent(220001, 2, "lvl20enemymage_OnLeaveCombat")
RegisterUnitEvent(220001, 4, "lvl20enemymage_OnDied")

sammyg69
05-14-2009, 04:55 AM
and this does what?

Alvanaar
05-14-2009, 06:52 AM
You could clean that script up a bit. Fix up your nil checks. :)

This is just a combat script, sammy.

DJ DieSeL
05-15-2009, 01:54 AM
and this does what?

well it mimics a minimal PVP encounter (due to my laziness :P) but the FullCastSpellOnTarget when OnDied represents honor yield on death.

nicdude
05-16-2009, 06:35 AM
I think I understand. It's like pvp without real people. Nice for those who play with themselves... =)

Double
05-16-2009, 02:16 PM
nice for those who play with themselves... =)

...........lol

bonedeath6
05-17-2009, 06:38 AM
Wow.......oh and good work.its nice for those who play with themselves... =) :D.