Jump to content

Recommended Posts

Posted (edited)

I wrote a logic to use Fire Ball (42833) to trigger the removal of Harvest Soul (28679) that Gothik the Harvester from Naxxramas casts on me.

When worldserver.exe is loaded, the command window prints an error: attempt to index global 'spell' (a nil value).

Although the code still works, but I hate to see errors. Any idea how to mitigate this error?

local function RemoveHarvestSoul(event, player)
    spell = player:GetCurrentSpell(1)
    if ((spell:GetEntry() == 42833) and player:HasAura(28679))
    then
        player:RemoveAura(28679)
    end
end
 
RegisterPlayerEvent(5, RemoveHarvestSoul)
Edited by Chen Jiang
  • 2 months later...
  • 1 month later...
Posted

Try this instead: 

local function RemoveHarvestSoul(event, player, spell, skipCheck)
    if ((spell:GetEntry() == 42833) and player:HasAura(28679))
    then
        player:RemoveAura(28679)
    end
end
 
RegisterPlayerEvent(5, RemoveHarvestSoul)

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use