hi i have problem with this code : (tfs 0.3.6)
i had no problems with compile.
but when monster use a spell its sending magic effect but nothig else. Target dont recieve damage.
i would be grateful if someone can help me
int32_t LuaScriptInterface::luaDoCreatureCastSpell(lua_State* L)
{
//doCreatureCastSpell (uid, spell)
std::string spellname = popString(L);
ScriptEnviroment *env = getEnv();
Creature *creature = env->getCreatureByUID(popNumber(L));
if(!creature)
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean (L, false);
return 1;
}
Spell *spell = g_spells->getInstantSpellByName(spellname);
if(spell)
{
if(spell->castSpell(creature))
{
lua_pushboolean(L, true);
return 1;
}
}
errorEx(getError(LUA_ERROR_SPELL_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
{
//doCreatureCastSpell (uid, spell)
std::string spellname = popString(L);
ScriptEnviroment *env = getEnv();
Creature *creature = env->getCreatureByUID(popNumber(L));
if(!creature)
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean (L, false);
return 1;
}
Spell *spell = g_spells->getInstantSpellByName(spellname);
if(spell)
{
if(spell->castSpell(creature))
{
lua_pushboolean(L, true);
return 1;
}
}
errorEx(getError(LUA_ERROR_SPELL_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
i had no problems with compile.
but when monster use a spell its sending magic effect but nothig else. Target dont recieve damage.
i would be grateful if someone can help me