• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X Dispel target

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
580
Solutions
2
Reaction score
58
Location
México
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?
Post automatically merged:

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 seeing source and i found this but i dont know if there is a way to make it work via lua better:
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;
}
 

Similar threads

Replies
2
Views
538
Back
Top