• 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!

Lua when the player dies he loses the condition

darkmu

Well-Known Member
Joined
Aug 26, 2007
Messages
274
Solutions
1
Reaction score
50
Location
Paraná,Brazil
When the players use the potion, when they die automatically they lose the condition, does anyone know how I can solve this?

Lua:
local critical = Condition(CONDITION_ATTRIBUTES)
critical:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
critical:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_CHANCE, 30)
critical:setParameter(CONDITION_PARAM_SKILL_CRITICAL_HIT_DAMAGE, 30)

local config = {
    [40000] = critical,
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)

    item:remove(1)
    return true
end
 
You can use storage to check if the time has expired.

onUse
-> add player storage conditionTime + os.time()

onLogin
-> set condition again if StorageConditionTime > os.time()
but would that be the best way to do it? or there is an attribute in the condition that I can inject so that I don't miss it.
 
Back
Top