Code:
int32_t LuaScriptInterface::luaDoTargetCombatHealth(lua_State* L)
{
//doTargetCombatHealth(cid, target, type, min, max, effect[, color])
ScriptEnviroment* env = getEnv();
int32_t params = lua_gettop(L);
TextColor_t color = TEXTCOLOR_UNKNOWN;
if(params > 6)
color = (TextColor_t)popNumber(L);
MagicEffect_t effect = (MagicEffect_t)popNumber(L);
int32_t maxChange = (int32_t)popNumber(L), minChange = (int32_t)popNumber(L);
CombatType_t combatType = (CombatType_t)popNumber(L);
uint32_t targetCid = popNumber(L), cid = popNumber(L);
Creature* creature = NULL;
if(cid)
{
if(!(creature = env->getCreatureByUID(cid)))
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
}
Creature* target = env->getCreatureByUID(targetCid);
if(target)
{
g_game.combatChangeHealth(combatType, creature, target, random_range(minChange, maxChange, DISTRO_NORMAL), effect, color, false);
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
Cyko has added in this fucntion the hitcolor for me but
i need another change.
My problem i have monster with PHYSICALDAMAGE not effects this monsters
but if i use this function with the PHYSICALDAMAGE the monster suffers the attack
i need a change to if monster element physicalPercent is 20% hits 20% more lower.
If is physicalPercent -20% hits cause 20% more higher.
Please help me...