Spell Scripting

Hi guys i need some help here.

I was trying to find out how to fix spell bug cause i saw a lot of servers telling 'bout some spell system but i dont find it anywhere. Can you post me link to some guide or some core of it i will learn by myself but i need link /emoticons/default_smile.png

Use the search function?

There is no guide, cause it is not possibile to give a universal way to fix spellbugs. They could be located in the database, the spell part in the core, the vmap system, packet handling and so on and so on…

Just have a look into the files on github. Maybe you are able to figure out some things. https://github.com/TrinityCore/TrinityCore/tree/master/src/server/game

Yes sure but i dont find any topic related to this. All topics about spell scripts are talking about spellmgr.cpp or something like these but not anything special.

Ok thanks i will do so.

I think you should talk to Rat. If i remember correclty it was him developing the actual spell system.

I realy don’t think that it is a good idea to contact him. Maybe he is familiar with the spell system…maybe he is working on it…but…developers are developers and not forumsupporters and as I said, its not possible to teach somebody how to fix bugs. So what should he ask him? Just a “Hey bro…how to fix spell bugs?” will cause a “Don’t waste my time noob”.

True… but @ least we could have more people knowing about how that system works… since nobody here really knows what’s in there.

Edit: If we don’t ask, we’ll never know. /emoticons/default_biggrin.png

To understand how it works, you have to learn how to read and understand code. It should be clear by reading the functions, the commands in the code and try to follow the way a spell goes through the core when casted. I think its realy hard to find a start for teaching somebody how to handle spells, or how the core actual handles spells. The better way is reading .cpp’s and taking part in discussions about code.

That’s very basic:

[CODE]// spell can go to spell::cancel at almost any point

// by delayed TC means that spell has travel time

spell::prepare // sets targets, checks cast conditions

if (!instant)


while (casting)


	spell::update // called from unit's event executor (counts down cast timer)



spell::cast // take mana, reagents, checks cast conditions for non-instant spells

if (!delayed)


spell::handle_immediate // applies auras/damage/procs and all stuff




while (!finished)



	spell::handle_delayed // applies auras/damage/procs and all stuff



spell::handle_finish_phase // removes combo points, adds combo points from procs

spell::finish // cleans up all stuff[/CODE]delayed mostly equals channelled or flying or multi target

To get better info read spell/unit/eventprocessor .h and .cpp

[edit] look at code tag, please, spaces make it all messy, can’t indent properly. It’s kinda needed for software oriented forum to have working code tag

[CODE]// 0 spaces

// 2 spaces

// 4 spaces

  // 6 spaces

	// 8 spaces[/CODE]


You can also find many examples in some instances and class scripts.