So I have been working with a attribute for items that will give you a certen % of chance to cast a spell. It look like this in the items.xml:
So each time you hit a monster/player you have 50% chance to cast a utevo lux for free(no mana cost). And your character dose it automaticly. Well lets come to the problem... I have everything with the attributes and such ready. Its when I try to call the spell the server freeze this is how it looks like:
Note: I haven't added the random procentage yet just because iam testing.
I have been trying with castSpell() function also. But same effect.
Thanks for help
Code:
<item id="2380" article="a" name="hand axe">
<attribute key="weight" value="1800" />
<attribute key="spellOnHit" value="Light" chance="50" />
<attribute key="defense" value="6" />
<attribute key="attack" value="5" />
<attribute key="weaponType" value="axe" />
</item>
Code:
for(int32_t i = SLOT_FIRST; i < SLOT_LAST; ++i)
{
if(Item* item = getInventoryItem((slots_t)i))
{
if(item->getSpellChanceOnHit() > 0 && item->getSpellChanceOnHit() <= 100)
{
if(g_spells->getInstantSpellByName(item->getSpellNameOnHit()) != NULL)
{
(g_spells->getInstantSpellByName(item->getSpellNameOnHit()))->playerCastInstant(this,"");
}
}
}
}
I have been trying with castSpell() function also. But same effect.
Thanks for help