View Full Version : How to use ITEM_EVENT_ON_DUMMY_EFFECT event?

11-08-2013, 03:32 PM
Could anybody make an example for me how to use this? Thanks a lot.
I thought this event is when some spell casting on some item and triggered this event, like disenchant some item. But it not work, so i think i'm misunderstanding this event.

11-08-2013, 04:04 PM
I think this is when you equip a weapon / or when you use an item like a spell on a weapon

11-08-2013, 05:14 PM
First off, it tells you the function arguments and how to register it:

RegisterItemEvent(entry, EventId, function)
ITEM_EVENT_ON_DUMMY_EFFECT = 1, (event, caster, spellid, effindex, item)

Item method page http://wiki.emudevs.com/doku.php?id=eluna_item_class and Unit Method Page: http://wiki.emudevs.com/doku.php?id=eluna_unit_class

If you want to use spell related methods. Now, you want to disenchant an item? I'm not quite sure what you mean considering what you wrote made no sense. Also, you did mention that it did not work and you're misunderstanding the event. Does that mean you already have code? If so, it would also be best if you showed us your code so we can fix it and you can learn from your mistakes.

local spellEntry = 30000

function OnItemDummyEffect(event, caster, spellId, effindex, item)
if (caster:GetUnitType() == "Player" and spellId == spellEntry) then
-- Do something

RegisterItemEvent(30000, 1, OnItemDummyEffect) -- ItemId, eventId and Function

11-09-2013, 12:19 PM
Thank you Tommy, here is my code:

local upgradeSepllId = 13262
local itemCanUpgrade = 19019
function GossipHello( event, caster, spellid, effindex, upgradeItem )
print("inside the function! ")
if spellid ~= upgradeSepllId then return end
--other stuff
RegisterItemEvent(itemCanUpgrade, 1, GossipHello)

In your code, the first param of RegisterItemEvent function is a spell ID not item ID, but wiki shows that the first param of RegisterItemEvent function should be an item ID.
I tried spell id and item id, both are not working.
And another question, what does the param "effindex" mean?

11-09-2013, 04:14 PM
I meant itemId, don't know why I put spellId. :/

effIndex is the spell effect index, it goes by:

EFFECT_0 = 0,
EFFECT_1 = 1,
EFFECT_2 = 2

It is mostly used when registering spells in SpellScript, AuraScript, etc. To find the correct effect index, go into DBCStructure.h and look for struct SpellEntry and every array that has 'MAX_SPELL_EFFECTS' in it is where you get the effect value from in Spell.dbc. However, I don't think the variable serves a purpose just yet.

11-11-2013, 07:00 AM
Thanks. but it did not solve my problem. It seems my code is correct, but it doesn't working. When the spell cast target on the given item, nothing happened.