我的LUA老板脚本中有一个问题,第11行,
creature.RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)
正在运行时引发错误。这是它给我的错误。
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应该是一个自投,我使用了与我发现的一个示例老板脚本相同的格式,在这个脚本中,克鲁尔对自己投了一个buff。
creature:RegisterEvent(Kruul.Rage, 60000, 0)
...
function Kruul.Rage(event, delay, pCall, creature)
creature:CastSpell(creature, 21340)
end
哇,在我发布这个问题后不到一分钟,我就发现了语法错误。
creature.RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)
应该是
creature:RegisterEvent(Arcanist_Doan.Arcane_Explosion, {3000, 7000}, 0)
分号而不是句点。