Bad argument for RegisterEvent in Eluna script

235 views Asked by At

I'm having an issue in my LUA boss script where line 11,

creature.RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)

is throwing an error on runtime. Here's the error it gives me.

lua_scripts/Boss_ArcanistDoan.lua:11: bad argument #1 to 'RegisterEvent' (bad argument : Creature expected, got function)

--[[
    -= Script Information =-
    * Script Type: Boss
    * Npc: Arcanist Doan <6487>
--]]

local Arcanist_Doan = {};

function Arcanist_Doan.OnEnterCombat(event, creature, target)
    creature:RegisterEvent(Arcanist_Doan.Curse_of_Agony, 12000, 0)
    creature.RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)
    creature:SendUnitYell("You will not defile these mysteries!", 0)
    creature:PlayDirectSound(5842)
end

function Arcanist_Doan.Curse_of_Agony(event, delay, pCall, creature)
    if (math.random(1, 100) <= 85) then
        local players = creature:GetPlayersInRange()
        creature:CastSpell(players[math.random(1, #players)], 18266)
    end
end

function Arcanist_Doan.Arcane_Explosion(event, delay, pCall, creature)
    creature:CastSpell(creature, 9433)
end

function Arcanist_Doan.Reset(event, creature)
    creature:RemoveEvents()
end

RegisterCreatureEvent(6487, 1, Arcanist_Doan.OnEnterCombat)
RegisterCreatureEvent(6487, 2, Arcanist_Doan.Reset) -- OnLeaveCombat
RegisterCreatureEvent(6487, 4, Arcanist_Doan.Reset) -- OnDied

Arcane Explosion should be a self cast, and I used the same format as an example boss script I found where Kruul casts a buff on himself.

creature:RegisterEvent(Kruul.Rage, 60000, 0)
...
function Kruul.Rage(event, delay, pCall, creature)
    creature:CastSpell(creature, 21340)
end
1

There are 1 answers

0
Zak Freeman On

Wow, not a minute after I posted this question, I found my syntax error.

creature.RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)

should be

creature:RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)

Semi-colon rather than dot.