• 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

Active Member
Joined
Aug 26, 2007
Messages
253
Solutions
1
Reaction score
45
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
 
OP
OP
darkmu

darkmu

Active Member
Joined
Aug 26, 2007
Messages
253
Solutions
1
Reaction score
45
Location
Paraná,Brazil
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.
 

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,247
Solutions
71
Reaction score
587
Location
Hell

Evil Puncker

I know nothing
TFS Developer
Joined
May 30, 2009
Messages
8,128
Solutions
219
Reaction score
4,053
here is the source part responsible for clearing conditions onDeath:

and according to this, you can set the tick to -1 and it wont end on death, but you will need to find another way to end it
 
Last edited:
Top