gabrielbsales
New Member
- Joined
- Dec 13, 2010
- Messages
- 35
- Reaction score
- 0
How to do for the doCreatureAddHealth ignore stats change creature event?
I tried:
But also keep running stats change. :s
I tried:
Code:
int32_t LuaScriptInterface::luaDoCreatureAddHealth(lua_State* L)
{
//doCreatureAddHealth(uid, health[, hitEffect[, hitColor[, force]]])
int32_t params = lua_gettop(L);
bool force = false;
char buffer[20];
if(params > 4)
force = popNumber(L);
TextColor_t hitColor = TEXTCOLOR_UNKNOWN;
if(params > 3)
hitColor = (TextColor_t)popNumber(L);
MagicEffect_t hitEffect = MAGIC_EFFECT_UNKNOWN;
if(params > 2)
hitEffect = (MagicEffect_t)popNumber(L);
int32_t healthChange = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Creature* creature = env->getCreatureByUID(popNumber(L)))
{
if(healthChange) //do not post with 0 value
//test
sprintf(buffer, "+%d", healthChange);
if (creature->getHealth() > 0 || force)
creature->gainHealth(NULL, healthChange);
if (hitEffect != MAGIC_EFFECT_UNKNOWN)
g_game.addMagicEffect(g_game.getSpectators(creature->getPosition()), creature->getPosition(), hitEffect);
if (hitColor != TEXTCOLOR_UNKNOWN)
g_game.addAnimatedText(g_game.getSpectators(creature->getPosition()), creature->getPosition(), hitColor, buffer);
//at here
// g_game.combatChangeHealth(healthChange < 1 ? COMBAT_UNDEFINEDDAMAGE : COMBAT_HEALING,
// NULL, creature, healthChange, hitEffect, hitColor, force);
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
But also keep running stats change. :s