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

Exhaust for healing item

eardrums

Member
Joined
May 27, 2010
Messages
94
Solutions
1
Reaction score
10
Hello,

Can anyone help create a script where when I use a certain item it heals me for a certain amount and also sets an exhaust rate. I got the script down but without being able to put the exhaust rate. This is what i did so far but so far i cant get it to get exhausted
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))


function onUse(cid, item, fromPosition, itemEx, toPosition)
        if itemEx.itemid == 6542 then
            doRemoveItem(cid, item.uid, 1)
            doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 500, CONST_ME_HEARTS)
            doAddCondition(cid, exhaust)
            doPlayerFeed(cid, 50)
                doCreatureSay(cid, "Crack", TALKTYPE_ORANGE_1)
                    elseif(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
                        end
        return TRUE
end

if anyone can help me and tell me what i might be doing wrong I would be very grateful :) thanks
 
You are checking the exhaust in the wrong place.
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.itemid == 6542 then
        if getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE then
        doRemoveItem(cid, item.uid, 1)
        doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 500, CONST_ME_HEARTS)
        doAddCondition(cid, exhaust)
        doPlayerFeed(cid, 50)
        doCreatureSay(cid, "Crack", TALKTYPE_ORANGE_1)
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        end
    end
    return TRUE
end
 

Similar threads

Back
Top