Jump to content

Looking for a tutorial to debug spells


saphiria

Recommended Posts

Hi Mangos community,

I've downloaded and configured the last release of Mangos and now I'm trying to fix a few spells. For example, I am trying to fix the Shaman talent "Feral spirit', but I don't really know where to find parts of code to fix the problem of this spell.

I'm looking for a tutorial (or an example, anyway) to help me debugging spells : where do I have to search ? what are the files I have to modify ? I've tried in spell.cpp but I'm sure this is not the only file to look to.

Please don't just give me a patch, it will resolve my problem but I won't learn Mangos mechanisms... I just would like to know where and how are scripted spells.

Thanks a lot for helping.

Link to comment
Share on other sites

For example, I am trying to fix the Shaman talent "Feral spirit'

Oh picking the "easiest" one right for the start...you only have to rewrite parts of the pet system for this...

It's impossible to make a tutorial for fixing spells like this one, because for most of the broken ones, there simply is no generic solution.

If there was, someone certainly would've already implemented them instead of writing a tutorial...but reality is, that the majority of the core code is required to handle some kind of spells.

Spirit wolves doesn't work correctly because the core doesn't support multiple controlled pets.

So it's not really the spell that is broken, it's the pets. Search around for pet related patches and you'll see how complex this problem is...

Link to comment
Share on other sites

Oh picking the "easiest" one right for the start...you only have to rewrite parts of the pet system for this...

I'm sorry to ask this kind of questions, I'm starting with Mangos emulation so I don't see if what I ask is difficult or not :)

Anyway, thanks for your answers.

I will try to find some patches, even if I don't think I will find something...

Link to comment
Share on other sites

  • 2 months later...

I see this patch there is a long time (by laise) for multipet support but need more improvement, seek in the forum. There is not a tutorial as the mangos installation, because every spell are different, we can't make a general turorial, you can just learn the base of coding in mangos and understand how its working.

Link to comment
Share on other sites

I see this patch there is a long time (by laise) for multipet support but need more improvement, seek in the forum. There is not a tutorial as the mangos installation, because every spell are different, we can't make a general turorial, you can just learn the base of coding in mangos and understand how its working.

He hasn't replied in 3 months, so I assume he is a master of spells by now.

Link to comment
Share on other sites

I see this patch there is a long time (by laise) for multipet support but need more improvement, seek in the forum. There is not a tutorial as the mangos installation, because every spell are different, we can't make a general turorial, you can just learn the base of coding in mangos and understand how its working.

He hasn't replied in 3 months, so I assume he is a master of spells by now.

Yes I think too ^^

Link to comment
Share on other sites

  • 2 months later...

I wonder, when a spell get casted ingame.

What is telling the spell what Spelleffects it should use? The .dbc(client) part or also the server part?

So for example

When i cast fireball

What says that it should use EffectSchoolDMG effect?? The client or the server self? If server , where does the function get called?

Link to comment
Share on other sites

I wonder, when a spell get casted ingame.

What is telling the spell what Spelleffects it should use? The .dbc(client) part or also the server part?

So for example

When i cast fireball

What says that it should use EffectSchoolDMG effect?? The client or the server self? If server , where does the function get called?

The spell Fireball would have effect 2 for one of it's spell effects (Spell.DBC fields 71-73, there's up to 3 different effects per spell).

The spell effect callbacks are registered in pEffect SpellEffects[TOTAL_SPELL_EFFECTS] as function pointers. These are stored in SpellEffects.cpp; that one at index 2 is registered as:

&Spell::EffectSchoolDMG, // 2 SPELL_EFFECT_SCHOOL_DAMAGE

When the server wants to do the effect of a spell, it simply calls the function located at SpellEffects[the index of the spell effect], in this case SpellEffects[2], which is Spell::EffectSchoolDMG.

The exact code is in Spell::HandleEffects:

if(eff < TOTAL_SPELL_EFFECTS)
{
   (*this.*SpellEffects[eff])(i);
}

Link to comment
Share on other sites

I wont do this but this is just example to understand how it works!

If you want to create a new spell, called frost ball, or something like that

And you want to give some effects to, you only need to fill the data in .dbc or also in some cpp files?

Link to comment
Share on other sites

  • 2 weeks later...
I started a spell tutorial a few months ago : http://getmangos.eu/wiki/Spell_system

Unfortunately it's not complete at all....but at the moment I have very few time to continue it.

I hope someone will find time to correct it/continue it with or without me :)

Thank you a lot for the tutorial, are there other similar tutorial like it? It would be good to have a tutorial like this for each part of MaNGOS

Link to comment
Share on other sites

×
×
  • 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