Hi, i want to make this script that you randomly get HP between two amount's for example 10, 20
Thanks!
Heres the script
Thanks!
Heres the script
Lua:
local config = {
amount = 50, -- HPs by second
time = 4, -- seconds
exhaust = {
storage = 1000,
time = 4, -- Exhaust time seconds~
}
}
local function doRegeneration(cid, amount, seconds)
if seconds <= 0 then
return false
end
doCreatureAddHealth(cid, amount)
doSendAnimatedText(getThingPos(cid), "+" .. amount, COLOR_LIGHTBLUE)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return addEvent(doRegeneration, 1000, cid, amount, seconds - 1)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.check(cid, config.exhaust.storage) then
return doPlayerSendCancel(cid, "You can only this kind of potion once every four seconds.")
end
doRemoveItem(item.uid, 1)
doRegeneration(cid, config.amount, config.time)
exhaustion.set(cid, config.exhaust.storage, config.exhaust.time)
return true
end