• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Linux Fix Potion, its simple.

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hi,
How I do to this doesn't end when the player logout / die. Only when the time runs out?

PHP:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10 * 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 50)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
setConditionParam(condition, CONDITION_PARAM_SUBID, 99)

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(not isSorcerer(cid) and not isDruid(cid)) then
		doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1, cid)
		return true
	end

	if(doAddCondition(cid, condition)) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doRemoveItem(item.uid, 1)
		doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
	end

	return true
end
 
Last edited:
LUA:
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10* 60 * 1000) -- 10 minutes
setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, 50)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, -10)
setConditionParam(condition, CONDITION_PARAM_SUBID, 99)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not isSorcerer(cid) and not isDruid(cid)) then
        return doCreatureSay(cid, "Only sorcerers and druids may drink this fluid.", TALKTYPE_ORANGE_1, cid)
    end
 
    if exhaustion.get(cid, 20251) then
        return doCreatureSay(cid, "Your latest used potion has not expired its effect yet.", TALKTYPE_ORANGE_1, cid)
    end
 
    if doAddCondition(cid, condition) then
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
        exhaustion.set(cid, 20251, 60*10)
        doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
    end
    return true
end

LUA:
local condition = {}
for n = 1, 10 do
    condition[n] = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition[n], CONDITION_PARAM_TICKS, n * 60 * 1000)
    setConditionParam(condition[n], CONDITION_PARAM_STAT_MAGICLEVEL, 50)
    setConditionParam(condition[n], CONDITION_PARAM_SKILL_SHIELD, -10)
    setConditionParam(condition[n], CONDITION_PARAM_SUBID, 99)
end


function onLogin(cid)
    
    if not exhaustion.get(cid, 20251) then
        return true
    end
    
    local i = math.floor(exhaustion.get(cid, 20251)/60)
    if condition[i] then
        doAddCondition(cid, condition[i])
        doCreatureSay(cid, "You feel smarter.", TALKTYPE_ORANGE_1, cid)
    end
    
    return true
end
 
Last edited:

Similar threads

Back
Top