elnelson
Lunaria World Dev
Hello otlanders, im trying to create a spell like "exura sio" but instead of healing, it dispels all buffs (like attributes, speed, etc)
i was trying to make it with this script (Lua - [0.4] Dispel is not working. (https://otland.net/threads/0-4-dispel-is-not-working.260295/)), but it doesnt work with attributes
the only way i could dispel an enemy was using the same SUBID (setConditionParam(condition, CONDITION_PARAM_SUBID, 1995))
but i need a practical way to make it work with all buffs without the need of using SUBID?
i was trying to make it with this script (Lua - [0.4] Dispel is not working. (https://otland.net/threads/0-4-dispel-is-not-working.260295/)), but it doesnt work with attributes
the only way i could dispel an enemy was using the same SUBID (setConditionParam(condition, CONDITION_PARAM_SUBID, 1995))
but i need a practical way to make it work with all buffs without the need of using SUBID?
Post automatically merged:
i was seeing source and i found this but i dont know if there is a way to make it work via lua better:Hello otlanders, im trying to create a spell like "exura sio" but instead of healing, it dispels all buffs (like attributes, speed, etc)
i was trying to make it with this script (Lua - [0.4] Dispel is not working. (https://otland.net/threads/0-4-dispel-is-not-working.260295/)), but it doesnt work with attributes
the only way i could dispel an enemy was using the same SUBID (setConditionParam(condition, CONDITION_PARAM_SUBID, 1995))
but i need a practical way to make it work with all buffs without the need of using SUBID?
C++:
int32_t LuaInterface::luaDoRemoveCondition(lua_State* L)
{
//doRemoveCondition(cid, type[, subId])
uint32_t subId = 0;
if(lua_gettop(L) > 2)
subId = popNumber(L);
ConditionType_t conditionType = (ConditionType_t)popNumber(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;
}
Condition* condition = NULL;
while((condition = creature->getCondition(conditionType, CONDITIONID_COMBAT, subId)))
creature->removeCondition(condition);
while((condition = creature->getCondition(conditionType, CONDITIONID_DEFAULT, subId)))
creature->removeCondition(condition);
lua_pushboolean(L, true);
return 1;
}
int32_t LuaInterface::luaDoRemoveConditions(lua_State* L)
{
//doRemoveConditions(cid[, onlyPersistent])
bool onlyPersistent = true;
if(lua_gettop(L) > 1)
onlyPersistent = popNumber(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;
}
creature->removeConditions(CONDITIONEND_ABORT, onlyPersistent);
lua_pushboolean(L, true);
return 1;
}