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

Drain Health For Speed

Collz

Pandas Go RAWR!!!
Joined
Oct 10, 2008
Messages
2,091
Reaction score
57
Location
New York
I need a script so that when you use an item (5953), it drains your health (2 hp per second) seconds and gives you a speed boost. I want it so that the affects last for only 30 seconds.
 
Lua:
local condition = createConditionObject(CONDITION_HASTE, 30000)
setConditionParam(condition, CONDITION_PARAM_SPEED, 400)

function doHealthDrain(cid, timer)
    if isPlayer(cid) and timer > 0 and getCreatureHealth(cid) > 3 then
        doTargetCombatHealth(0, cid, COMBAT_LIFEDRAIN, -2, -2, CONST_ME_MAGIC_RED)
        addEvent(doHealthDrain, 1000, cid, timer-1)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    
    if getCreatureCondition(cid, CONDITION_HASTE) then
        return doPlayerSendCancel(cid, 'You are already hasted.')
    end
    
    doHealthDrain(cid, 30)
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition)
    return true
end
XML:
<action itemid="5953" event="script" value="drain.lua"/>
 
Back
Top