Add Script to Item

How can I add a script to an Item? I have already tried to insert the name of the script into the “ScriptName” column, but nothing happens if I right-click the item then.

I am trying to make an Item change the players Display ID if he right clicks on it (so a pretty easy script)

Thanks for any replies.

A right click usually casts a spell. Script the spell instead.

thanks, but how do I do that?

I mean, I already tried to make a SpellScript and add it then to a new row in “spell_script_names” and added the new spell to the item then, but didnt work either. Then I tried to modify the AuraEffects.cpp (something like this) to handle a new effect and assigned it then to the item, but still nothing. So the only thing that I can think of now is to edit the spell.dbc, but I didnt try that yet.

Define your spell in the spell_dbc table.

ok, thanks.

Ill try that as soon as Im home.

Ok, Im pretty confused now /emoticons/default_biggrin.png

How do I add it there, just enter the ID of the entry I added to “SpellAuraEffects.cpp” to “EffectAuraApllyName1”?

Thank you

https://github.com/T…le_misc.cpp#L50

That’s an ItemScript. In db you write “example_item” in http://www.trinitycore.info/Item_template_tc2#ScriptName

For spells, you create a SpellScript and use the table spell_script_names